@photivra/engine 2.12.0 → 2.14.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 (148) hide show
  1. package/CHANGELOG.md +144 -1
  2. package/CITATION.cff +1 -1
  3. package/README.md +7 -7
  4. package/SECURITY.md +1 -1
  5. package/THIRD_PARTY.md +3 -0
  6. package/dist/camera/lens-projection.js +2 -1
  7. package/dist/camera/lens-projection.js.map +1 -1
  8. package/dist/capture/dng-import.js +1 -1
  9. package/dist/capture/dng-import.js.map +1 -1
  10. package/dist/capture/export-jpeg.d.ts +1 -1
  11. package/dist/capture/export-jpeg.js +6 -4
  12. package/dist/capture/export-jpeg.js.map +1 -1
  13. package/dist/capture/host-yield-cadence.js +1 -1
  14. package/dist/capture/host-yield-cadence.js.map +1 -1
  15. package/dist/capture/native-environment-optical-stage.js +1 -1
  16. package/dist/capture/native-environment-optical-stage.js.map +1 -1
  17. package/dist/capture/native-raw.js +1 -1
  18. package/dist/capture/native-raw.js.map +1 -1
  19. package/dist/capture/packed-sensor-raw.js +3 -3
  20. package/dist/capture/packed-sensor-raw.js.map +1 -1
  21. package/dist/capture/sensor-raw-producer.js +1 -1
  22. package/dist/capture/sensor-raw-producer.js.map +1 -1
  23. package/dist/color/capture-color.js +3 -3
  24. package/dist/color/capture-color.js.map +1 -1
  25. package/dist/color/chromatic-adaptation.js +2 -2
  26. package/dist/color/chromatic-adaptation.js.map +1 -1
  27. package/dist/color/color-matching-functions.js +1 -1
  28. package/dist/color/color-matching-functions.js.map +1 -1
  29. package/dist/color/colorimetry-math.js +2 -2
  30. package/dist/color/colorimetry-math.js.map +1 -1
  31. package/dist/color/illuminants.js +3 -3
  32. package/dist/color/illuminants.js.map +1 -1
  33. package/dist/color/rgb-color-spaces.js +1 -1
  34. package/dist/color/rgb-color-spaces.js.map +1 -1
  35. package/dist/color/sensor-color-development.js +1 -1
  36. package/dist/color/sensor-color-development.js.map +1 -1
  37. package/dist/core/record-validation.js +3 -3
  38. package/dist/core/record-validation.js.map +1 -1
  39. package/dist/core/version.d.ts +1 -1
  40. package/dist/core/version.js +1 -1
  41. package/dist/core/version.js.map +1 -1
  42. package/dist/equipment/generic-prime-lenses.js +3 -3
  43. package/dist/equipment/generic-prime-lenses.js.map +1 -1
  44. package/dist/equipment/generic-tier-assets.d.ts +23 -1
  45. package/dist/equipment/generic-tier-assets.js +58 -30
  46. package/dist/equipment/generic-tier-assets.js.map +1 -1
  47. package/dist/equipment/generic-tier-presets.d.ts +6 -3
  48. package/dist/equipment/generic-tier-presets.js +26 -13
  49. package/dist/equipment/generic-tier-presets.js.map +1 -1
  50. package/dist/exposure/auto-iso-slowest-shutter.d.ts +120 -0
  51. package/dist/exposure/auto-iso-slowest-shutter.js +217 -0
  52. package/dist/exposure/auto-iso-slowest-shutter.js.map +1 -0
  53. package/dist/exposure/exposure-mode-resolver.d.ts +57 -1
  54. package/dist/exposure/exposure-mode-resolver.js +238 -33
  55. package/dist/exposure/exposure-mode-resolver.js.map +1 -1
  56. package/dist/exposure/flash-ttl.js +1 -1
  57. package/dist/exposure/flash-ttl.js.map +1 -1
  58. package/dist/exposure/flash.js +1 -1
  59. package/dist/exposure/flash.js.map +1 -1
  60. package/dist/facade/chart-material-layers.js +2 -2
  61. package/dist/facade/chart-material-layers.js.map +1 -1
  62. package/dist/facade/chart-radiance-batch.js +1 -1
  63. package/dist/facade/chart-radiance-batch.js.map +1 -1
  64. package/dist/facade/chart-scenes.d.ts +45 -8
  65. package/dist/facade/chart-scenes.js +101 -44
  66. package/dist/facade/chart-scenes.js.map +1 -1
  67. package/dist/facade/color-patches.d.ts +129 -0
  68. package/dist/facade/color-patches.js +209 -0
  69. package/dist/facade/color-patches.js.map +1 -0
  70. package/dist/facade/diffraction-provider.js +12 -13
  71. package/dist/facade/diffraction-provider.js.map +1 -1
  72. package/dist/facade/display-view-gpu.js +1 -1
  73. package/dist/facade/display-view-gpu.js.map +1 -1
  74. package/dist/facade/display-view.d.ts +27 -0
  75. package/dist/facade/display-view.js +234 -65
  76. package/dist/facade/display-view.js.map +1 -1
  77. package/dist/facade/scene-radiance.js +2 -2
  78. package/dist/facade/scene-radiance.js.map +1 -1
  79. package/dist/facade/simulate-capture.d.ts +139 -12
  80. package/dist/facade/simulate-capture.js +209 -36
  81. package/dist/facade/simulate-capture.js.map +1 -1
  82. package/dist/facade/simulate-display-view.js +2 -2
  83. package/dist/facade/simulate-display-view.js.map +1 -1
  84. package/dist/gpu/chart-composite-gpu.js +2 -2
  85. package/dist/gpu/chart-composite-gpu.js.map +1 -1
  86. package/dist/gpu/display-view-composite-material-module.js +1 -1
  87. package/dist/gpu/display-view-composite-material-module.js.map +1 -1
  88. package/dist/gpu/display-view-quality-gpu.d.ts +2 -1
  89. package/dist/gpu/display-view-quality-gpu.js +24 -14
  90. package/dist/gpu/display-view-quality-gpu.js.map +1 -1
  91. package/dist/gpu/image-kernel-execution.js +2 -2
  92. package/dist/gpu/image-kernel-execution.js.map +1 -1
  93. package/dist/gpu/temporal-sum-gpu.js +23 -23
  94. package/dist/gpu/webgpu-runtime.js +1 -1
  95. package/dist/gpu/webgpu-runtime.js.map +1 -1
  96. package/dist/gpu/wgsl-chart-composite-kernel.js +318 -318
  97. package/dist/gpu/wgsl-chart-composite-kernel.js.map +1 -1
  98. package/dist/gpu/wgsl-chart-kernel.js +117 -117
  99. package/dist/gpu/wgsl-chart-kernel.js.map +1 -1
  100. package/dist/gpu/wgsl-display-view-quality-kernel.d.ts +13 -1
  101. package/dist/gpu/wgsl-display-view-quality-kernel.js +522 -488
  102. package/dist/gpu/wgsl-display-view-quality-kernel.js.map +1 -1
  103. package/dist/gpu/wgsl-display-view-speed-kernel.js +248 -248
  104. package/dist/gpu/wgsl-display-view-speed-kernel.js.map +1 -1
  105. package/dist/gpu/wgsl-kernels.js +203 -203
  106. package/dist/gpu/wgsl-kernels.js.map +1 -1
  107. package/dist/gpu/wgsl-sensor-kernel.js +302 -302
  108. package/dist/gpu/wgsl-sensor-kernel.js.map +1 -1
  109. package/dist/index.d.ts +8 -5
  110. package/dist/index.js +6 -3
  111. package/dist/index.js.map +1 -1
  112. package/dist/motion/temporal-exposure-sum.js +1 -1
  113. package/dist/motion/temporal-exposure-sum.js.map +1 -1
  114. package/dist/optics/diffraction-psf-profile.js +4 -4
  115. package/dist/optics/diffraction-psf-profile.js.map +1 -1
  116. package/dist/optics/front-of-lens-filter.js +1 -1
  117. package/dist/optics/front-of-lens-filter.js.map +1 -1
  118. package/dist/optics/irradiance-convolution.d.ts +10 -0
  119. package/dist/optics/irradiance-convolution.js +49 -14
  120. package/dist/optics/irradiance-convolution.js.map +1 -1
  121. package/dist/output/native-capture-sdr.js +1 -1
  122. package/dist/output/native-capture-sdr.js.map +1 -1
  123. package/dist/output/png-encoder.js +2 -2
  124. package/dist/output/png-encoder.js.map +1 -1
  125. package/dist/output/print-jpeg.js +13 -10
  126. package/dist/output/print-jpeg.js.map +1 -1
  127. package/dist/output/text-metadata.d.ts +22 -2
  128. package/dist/output/text-metadata.js +58 -9
  129. package/dist/output/text-metadata.js.map +1 -1
  130. package/dist/sensor/fixed-pattern-noise.js +1 -1
  131. package/dist/sensor/fixed-pattern-noise.js.map +1 -1
  132. package/dist/sensor/readout-exposure-linkage.js +1 -1
  133. package/dist/sensor/readout-exposure-linkage.js.map +1 -1
  134. package/docs/API_REFERENCE.md +49 -1
  135. package/docs/QUICK_START.md +104 -9
  136. package/docs/USAGE.md +241 -2
  137. package/docs/api/core-version.md +1 -1
  138. package/docs/api/equipment-generic-tier-assets.md +41 -1
  139. package/docs/api/equipment-generic-tier-presets.md +11 -3
  140. package/docs/api/exports.json +172 -2
  141. package/docs/api/exposure-auto-iso-slowest-shutter.md +139 -0
  142. package/docs/api/exposure-exposure-mode-resolver.md +68 -0
  143. package/docs/api/facade-chart-scenes.md +36 -5
  144. package/docs/api/facade-color-patches.md +150 -0
  145. package/docs/api/facade-simulate-capture.md +140 -9
  146. package/docs/api/output-text-metadata.md +34 -0
  147. package/llms.txt +1 -0
  148. package/package.json +2 -2
@@ -1 +1 @@
1
- {"version":3,"file":"simulate-capture.js","sourceRoot":"","sources":["../../src/facade/simulate-capture.ts"],"names":[],"mappings":"AAAA,sCAAsC;AAEtC;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAEH,OAAO,EAAE,4BAA4B,EAAE,kCAAkC,EAAE,8BAA8B,EAAE,MAAM,wCAAwC,CAAC;AAC1J,OAAO,EAAE,yBAAyB,EAAE,MAAM,gCAAgC,CAAC;AAC3E,OAAO,EAAE,4BAA4B,EAAE,MAAM,uBAAuB,CAAC;AACrE,OAAO,EAAE,kBAAkB,EAAE,MAAM,8BAA8B,CAAC;AAClE,OAAO,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAExD,OAAO,EAAE,mBAAmB,EAA8D,MAAM,qCAAqC,CAAC;AACtI,OAAO,EAAE,uBAAuB,EAAE,MAAM,oBAAoB,CAAC;AAC7D,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,EAAE,2CAA2C,EAAqD,MAAM,uCAAuC,CAAC;AACvJ,OAAO,EAAE,4BAA4B,EAAE,MAAM,+BAA+B,CAAC;AAC7E,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAChE,OAAO,EAAE,2CAA2C,EAAE,oCAAoC,EAAE,MAAM,gCAAgC,CAAC;AACnI,OAAO,EAAE,yBAAyB,EAAE,mCAAmC,EAAE,0CAA0C,EAAE,kCAAkC,EACrJ,8BAA8B,EAAiE,MAAM,uCAAuC,CAAC;AAC/I,OAAO,EAAE,+BAA+B,EAAmC,MAAM,6BAA6B,CAAC;AAC/G,OAAO,EAAE,sBAAsB,EAAE,MAAM,+BAA+B,CAAC;AACvE,OAAO,EAAE,qCAAqC,EAAqC,MAAM,sCAAsC,CAAC;AAChI,OAAO,EAAE,wCAAwC,EAAE,mCAAmC,EAAE,yBAAyB,EAC/G,yBAAyB,EAAE,w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AC,uBAAuB,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;gBAC7G,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,qDAAqD,EAAE,GAAG,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,sBAAsB,EAAE,GAAG,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,wBAAwB,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,sBAAsB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,oDAAoD,EAAE,sBAAsB,EAAE,GAAG,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,wBAAwB,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,gCAAgC,CAAC,CAAC;gBAClX,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,qBAAqB,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,mBAAmB,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,4BAA4B,EAAE,uBAAuB,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;YAC3J,WAAW,EAAE,CAAC,sKAAsK;gBAClL,uOAAuO,CAAC,EAAE;QAC9O,WAAW,EAAE,MAAM,CAAC,MAAM,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;KACrE,CAAC,CAAC;AACL,CAAC;AAED,6EAA6E;AAC7E,MAAM,CAAC,MAAM,8BAA8B,GAAG,mBAAmB,CAAC","sourcesContent":["// SPDX-License-Identifier: Apache-2.0\n\n/**\n * `simulateCapture()` is the easy starting point. It turns a small input into a complete native\n * environment RAW request: scene radiance → optics → spectral EQE (external quantum efficiency) →\n * charge → readout and ADC. That request then runs through the existing native RAW development task\n * and, optionally, the existing JPEG encoder.\n *\n * It adds no physics of its own. Every number comes from existing public contracts: generic tier\n * presets, exposure metering and mode resolution, colorimetry, native environment RAW, native RAW\n * development and print JPEG.\n *\n * Everything the facade decides for the caller is listed in `result.assumptions`: defaults, derived\n * values and fixed modelling choices. Nothing is hidden. The complete underlying request is returned\n * in `result.request`; get the per-site inputs with `request.siteInput(index)`.\n *\n * The 2.0 options are opt-in and only combine existing public contracts. If none is given, the\n * request, RAW, samples and JPEG are byte-identical to the 1.0 facade:\n * - output formats: `png` (`serializePngImage`; sRGB, or Display P3 / Rec. 2020 through the colorimetry\n * matrices and transfer functions) and `dng`\n * (`serializeNativeRawDng` of the packed native RAW; no linear master is declared);\n * - demosaic: `createBuiltInBayerDemosaicProfiles` (bilinear) and mirror borders;\n * - optics: the environment `lensFieldMapping` (projection, radial / Brown–Conrady distortion), radial\n * illumination vignetting as field throughput and a caller sampled lens PSF;\n * - motion: constant camera angular velocity and the electronic rolling-shutter exposure schedule.\n * The 2.1 options are opt-in in the same way: `lens.diffraction`, `output.demosaic: \"ahd\"` and\n * `sensor.antiAliasing` (a birefringent point-splitting low-pass filter in the sensor optical stack).\n * The 2.4 `output.metadata` adds the caller's text to JPEG, PNG and DNG files (see `src/output/text-metadata.ts`);\n * without it every encoded file is byte-identical to 2.3.\n * @see docs/QUICK_START.md\n */\n\nimport { markInternalNativeTileReader, markInternalSceneRadianceEvaluator, registerInternalRadianceAccess } from \"../core/internal-radiance-evaluator.js\";\nimport { InvalidConfigurationError } from \"../core/configuration-error.js\";\nimport { InvalidScientificResultError } from \"../core/validation.js\";\nimport { requireInputObject } from \"../core/record-validation.js\";\nimport { ENGINE_API_VERSION } from \"../core/version.js\";\nimport type { EvidenceProvenance } from \"../core/evidence-provenance.js\";\nimport { GENERIC_TIER_ASSETS, type GenericEquipmentTier, type GenericEquipmentTierPreset } from \"../equipment/generic-tier-assets.js\";\nimport { parseCallerCameraPreset } from \"./camera-preset.js\";\nimport { createHostYield } from \"./host-yield.js\";\nimport { resolveGenericEquipmentExposureCapabilities, type ResolvedGenericEquipmentExposureCapabilities } from \"../equipment/exposure-capabilities.js\";\nimport { resolveGenericIsoSignalChain } from \"../sensor/iso-signal-chain.js\";\nimport { meterRelativeExposure } from \"../exposure/metering.js\";\nimport { createExposureMeterTargetFromMeteringResult, setExposureCompensationOnMeterTarget } from \"../exposure/metering-target.js\";\nimport { resolveManualExposureMode, resolveAperturePriorityExposureMode, resolveAperturePriorityAutoIsoExposureMode, resolveShutterPriorityExposureMode,\n resolveProgramAutoExposureMode, type AutoIsoBaselinePolicy, type ExposureResolutionConstraint } from \"../exposure/exposure-mode-resolver.js\";\nimport { parseExposureProgramLineProfile, type ExposureProgramLineProfile } from \"../exposure/program-line.js\";\nimport { resolveCaptureGeometry } from \"../output/capture-geometry.js\";\nimport { estimateCie1931ColorMatchingFunctions, type PreparedColorimetricSpectrum } from \"../color/color-matching-functions.js\";\nimport { createColorTemperatureWhiteBalanceIntent, resolveColorTemperatureWhiteBalance, resolveCustomWhiteBalance,\n resolveManualWhiteBalance, estimateAutoWhiteBalance, type ResolvedWhiteBalanceState } from \"../color/white-balance.js\";\nimport { createCaptureWhiteBalanceIntent, type CaptureWhiteBalanceIntent } from \"../capture/simulated-capture.js\";\nimport { SENSOR_RAW_PRODUCER_NOISE_MODEL } from \"../capture/sensor-raw-producer.js\";\nimport { calculateNativeRawPlan, nativeRawMaximumProviderEvaluations, NATIVE_RAW_LIMITS, type NativeRawInput, type NativeRawOutput, type NativeRawPlan } from \"../capture/native-raw.js\";\nimport { renderTabulatedNativeRaw, TABULATED_RELATIVE_TOLERANCE } from \"../capture/native-environment-tabulated.js\";\nimport { createDisplayViewExpectedSignal } from \"./expected-signal.js\";\nimport type { DisplayViewFastReport } from \"./display-view-gpu.js\";\nimport { buildExpectedSignalInput } from \"./expected-signal-setup.js\";\nimport { createNativeEnvironmentRawTask, createNativeEnvironmentRawRegionTask, type NativeEnvironmentRawInput,\n type NativeEnvironmentRawTask, type NativeEnvironmentRawTile } from \"../capture/native-environment-raw.js\";\nimport { createNativeRawDevelopmentTask, type NativeRawDevelopmentInput, type RawHighlightDiagnostics } from \"../capture/native-raw-development.js\";\nimport type { RawFrameReconstructionPhaseProfile } from \"../capture/raw-frame-reconstruction.js\";\nimport type { ExportSensorColorProfile } from \"../capture/photographic-export.js\";\nimport { parseSdrRenderingProfile, type SdrRenderingProfile, type SdrToneCurve, type SdrToneCurveParameters, type SdrRenderingResult } from \"../output/sdr-rendering.js\";\nimport type { RawHighlightMode } from \"../color/sensor-color-development.js\";\nimport { createPrintJpegTask, PRINT_JPEG_LIMITS } from \"../output/print-jpeg.js\";\nimport type { SimulateEnvironmentSensorRawFrameInput } from \"../capture/environment-raw-producer.js\";\nimport { checkNativeRawIntegrity, prepareNativeRawDevelopment } from \"../capture/native-raw-development.js\";\nimport { createRawPixelDeveloper, normalizedRawSite, rawSiteSaturated, type RawDevelopmentSource } from \"../capture/raw-development-kernel.js\";\nimport { createAhdDemosaicTask } from \"../processing/demosaic.js\";\nimport { PROCESSING_MAX_PIXELS } from \"../processing/processing-task.js\";\nimport { renderSdrRunInto, type SdrPixelCounts } from \"../output/native-capture-sdr.js\";\nimport { prepareSdrPixelTone } from \"../output/sdr-rendering.js\";\nimport { BUILT_IN_BAYER_DEMOSAIC_MODEL_VERSION as BUILT_IN_DEMOSAIC_VERSION, createBuiltInBayerDemosaicProfiles } from \"../sensor/raw-reconstruction.js\";\nimport { transformOrientedRasterPointToNative } from \"../output/capture-geometry.js\";\nimport { resolveCaptureColorModel } from \"../color/capture-color.js\";\nimport { evaluateBt709Oetf, evaluateSrgbEncoding, resolveRgbColorSpace } from \"../color/rgb-color-spaces.js\";\nimport { serializePngImage, PNG_ENCODER_LIMITS, type PngColourEncoding } from \"../output/png-encoder.js\";\nimport { addJpegTextMetadata, addPngTextMetadata, parseOutputTextMetadata, type OutputTextMetadata } from \"../output/text-metadata.js\";\nimport { parseLensProjectionModel, type LensProjectionModel } from \"../camera/lens-projection.js\";\nimport { prepareEnvironmentLensFieldMapping, type EnvironmentLensFieldMapping } from \"../optics/sensor-environment-query.js\";\nimport type { RadialDistortionProfile } from \"../optics/radial-distortion.js\";\nimport type { BrownConradyDistortionProfile } from \"../optics/brown-conrady-distortion.js\";\nimport type { IlluminationVignettingProfile } from \"../optics/illumination-vignetting.js\";\nimport type { CalculateSensorPsfIrradianceQuadratureInput } from \"../optics/sensor-psf-quadrature.js\";\nimport type { CalculateEnvironmentSensorPhotoSignalInput } from \"../sensor/environment-photo-signal.js\";\nimport { createRollingShutterCaptureExposureSchedule, resolveElectronicRollingShutterExposureSchedule,\n type ElectronicRollingShutterExposureSchedule } from \"../sensor/readout-exposure-linkage.js\";\nimport { calculateCaptureExposureWindows } from \"../sensor/exposure-window.js\";\nimport { calculateSensorSpectralQuadrature } from \"../sensor/spectral-quadrature.js\";\nimport { createDiffractionLimitedPsfProfile, type DiffractionLimitedPsfProfile } from \"../optics/diffraction-psf-profile.js\";\nimport { registerDiffractionPsfKey, siteDiffractionKernel } from \"../optics/site-diffraction-kernel.js\";\nimport { convolveSiteKernels, createDefocusDiscSiteKernel, requireDefocusDiscKernelRadius, resolveDefocusDisc, type ResolvedDefocusDisc } from \"../optics/defocus-disc-kernel.js\";\nimport { createDiffractedPlanarProvider } from \"./diffraction-provider.js\";\nimport { resolveGenericPrimeLens, type GenericPrimeLens } from \"../equipment/generic-prime-lenses.js\";\nimport { calculateChannelElectronsPerRadiance } from \"./channel-response.js\";\nimport { calculateSiteEffectiveSaturationCode } from \"../capture/raw-white-level.js\";\nimport { prepareSensorColorDevelopment } from \"../color/sensor-color-development.js\";\nimport { resolveAntiAliasingSpatialKernel, type AntiAliasingPointSplitComponent, type SensorOpticalStackProfile } from \"../sensor/optical-stack.js\";\nimport { multiplyMatrices, type ColorMatrix3x3, type ColorVector3 } from \"../color/colorimetry-math.js\";\nimport { prepareRgbGamutMapping, type PreparedRgbGamutMapping } from \"../color/gamut-mapping.js\";\nimport { serializeNativeRawDng, type NativeRawDng } from \"../capture/native-raw-dng.js\";\nimport { parseSensorReadoutConversionProfile, resolveSensorReadoutRegime } from \"../sensor/raw-readout.js\";\nimport { resolveChartScene, chartMaterialInputs, CHART_SCENE_PRESETS, type ChartScene, type ResolvedChartScene } from \"./chart-scenes.js\";\nimport { resolveChartMaterialLayers, type ChartMaterialLayerScene, type ResolvedChartMaterialLayers } from \"./chart-material-layers.js\";\nimport { resolveCaptureIlluminant, calculateIlluminantIrradianceScale, buildPlanarSceneRadianceProvider, requireCallerScene, FACADE_SPECTRAL_RANGE_NANOMETERS,\n resolveChartSizeOption, type ChartSizeOption,\n PHOTOPIC_MAXIMUM_LUMINOUS_EFFICACY_LM_PER_W, type CaptureIlluminant, type CallerMaterialScene, type CallerRadianceScene, type CallerReflectanceScene, type ResolvedCallerScene,\n planarProviderMaterialOfDirection, type PlanarSceneRadianceProvider, type ResolvedCallerMaterialScene, type ResolvedCaptureIlluminant } from \"./scene-radiance.js\";\n\n/** Version of how the facade builds requests. It changes whenever the same input would build a different request. */\nexport const SIMULATE_CAPTURE_FACADE_VERSION = \"1.0.0\" as const;\n\nexport type SimulateCaptureExposureMode = \"manual\" | \"aperture-priority\" | \"shutter-priority\" | \"program\";\n/**\n * #516: what aperture priority does with Auto ISO once the ISO reaches the body's Auto ISO maximum and the exposure is\n * still under the meter target: `\"allow-slower-shutter\"` lengthens the shutter past the slowest preferred shutter to reach\n * the target; `\"hold-preferred-shutter\"` keeps the preferred shutter and leaves the exposure under target.\n */\nexport type SimulateCaptureAutoIsoAfterMaximum = \"allow-slower-shutter\" | \"hold-preferred-shutter\";\n/**\n * #516: how Auto ISO chose the ISO (`exposure.iso: \"auto\"`), reported in the result's `exposure.autoIso`. The full\n * resolver output stays in the capture's `exposure.resolution`.\n */\nexport interface SimulateCaptureAutoIsoReport {\n /** The ISO the meter target asked for at the resolved aperture and shutter, before the Auto ISO range and the ISO grid. */\n idealIsoBeforeConstraints: number;\n /** The Auto ISO range the ISO was chosen in: the body's Auto ISO bounds, or its ISO range when it declares none (the tiers: ISO 100 to their maximum). */\n autoIsoMinimum: number;\n autoIsoMaximum: number;\n /** Whether the ISO was held at an end of the Auto ISO range. */\n clamped: false | \"minimum\" | \"maximum\";\n /**\n * The constraint that limited the resolved exposure: the resolver's `targetResidual.limitingConstraint`, for example\n * `\"iso-maximum\"` (the exposure stays under target at the Auto ISO maximum), `\"iso-grid-quantization\"` (the nearest\n * selectable ISO) or `\"none\"` (on target).\n */\n limitingConstraint: ExposureResolutionConstraint;\n /** The resolver's residual, log2(target / achieved exposure), in stops: positive when the exposure is under the meter target, negative when over it. */\n residualStops: number;\n /** Aperture priority only: the policy and slowest preferred shutter used, and whether the slower-shutter fallback ran. */\n afterMaximumIso?: SimulateCaptureAutoIsoAfterMaximum;\n slowestPreferredShutterSeconds?: number;\n afterMaximumIsoFallbackUsed?: boolean;\n}\nexport type SimulateCaptureOutputFormat = \"srgb-8\" | \"srgb-16\" | \"jpeg\" | \"png\" | \"dng\";\nexport type SimulateCaptureWhiteBalance =\n | \"scene-illuminant\"\n | \"auto\"\n | \"none\"\n | { kelvin: number; tint?: number }\n | { channelGains: { red: number; green: number; blue: number } };\n/**\n * PNG colour encoding. `srgb` is the developed sRGB output. The others take the developed linear\n * colour (camera → XYZ → linear sRGB/D65, unclipped) and convert it through CIE XYZ into the target\n * primaries:\n * - `display-p3`: Display P3 primaries (W3C CSS Color 4 `display-p3`; also SMPTE EG 432-1) with the\n * sRGB transfer function;\n * - `rec2020`: ITU-R BT.2020 primaries and OETF.\n * PQ and HLG (BT.2100) are not part of 2.0; see THIRD_PARTY.md.\n */\nexport type SimulateCaptureColorEncoding = \"srgb\" | \"display-p3\" | \"rec2020\";\n/**\n * Demosaic. `bilinear`: the built-in Bayer kernels (`createBuiltInBayerDemosaicProfiles`). `ahd` (2.1): adaptive\n * homogeneity-directed demosaicing (`createAhdDemosaicTask`, after Hirakawa & Parks 2005), a non-linear\n * edge-directed method that reduces zipper and false colour on sharp edges.\n */\nexport type SimulateCaptureDemosaic = \"bilinear\" | \"ahd\";\n/** `output.demosaic` as a record (#395): the demosaic and its `fast` override (see {@link SimulateCaptureOptions.fast}). */\nexport interface SimulateCaptureDemosaicRecord { kind: SimulateCaptureDemosaic; fast?: boolean }\n/**\n * `margin` renders extra native sites around the output, as far as the kernel reaches. `mirror` renders\n * exactly the output and reads mirrored (reflect-101) copies of the missing border sites. Mirroring is\n * checked to keep the CFA (colour filter array) pattern consistent.\n */\nexport type SimulateCaptureBorderHandling = \"margin\" | \"mirror\";\nexport type SimulateCaptureLensDistortion =\n | { kind: \"radial\"; profile: RadialDistortionProfile }\n | { kind: \"brown-conrady\"; profile: BrownConradyDistortionProfile };\n/**\n * Diffraction model (2.1): the shorthand or a record with an explicit kernel radius in sites and (#395) a `fast` override\n * (see {@link SimulateCaptureOptions.fast}). The record names the model by `kind`; `aperture`, its name before #395, is still\n * accepted as a deprecated alias until 3.0.0, and giving both is an error.\n */\nexport type SimulateCaptureLensDiffraction =\n | \"circular-aperture\"\n | { kind: \"circular-aperture\"; kernelRadiusSamples?: number; fast?: boolean }\n | {\n /** @deprecated Since #395: use `kind`. Accepted until 3.0.0. */\n aperture: \"circular-aperture\"; kernelRadiusSamples?: number; fast?: boolean;\n };\n/**\n * Optical anti-aliasing (low-pass) filter (2.1), modelled as birefringent point splitting: each image point is\n * split into equally bright copies (the engine's `normalized-point-splitting-kernel` optical-stack response).\n * - `four-spot`: two crossed birefringent plates; copies at (±d/2, ±d/2), weight 1/4 each, MTF |cos(π·f_x·d)·cos(π·f_y·d)|.\n * - `two-spot`: one plate splitting along `axis`; copies at ±d/2, weight 1/2 each, MTF |cos(π·f·d)|.\n * - `point-splitting`: the engine contract itself, offsets in micrometres (+x right, +y down) and positive weights\n * summing to 1 (at most 16 components, each within 4 sites).\n * d = `separationSites` × pixel pitch, 0 < separationSites ≤ 4, default 1 (first MTF zero at the sensor's Nyquist\n * frequency 1/(2·pitch)).\n */\nexport type SimulateCaptureSensorAntiAliasing =\n | { kind: \"four-spot\"; separationSites?: number; fast?: boolean }\n | { kind: \"two-spot\"; axis: \"horizontal\" | \"vertical\"; separationSites?: number; fast?: boolean }\n | { kind: \"point-splitting\"; components: readonly AntiAliasingPointSplitComponent[]; fast?: boolean };\n/** Pixel aperture (2.3): centre sampling, or the square photosite integrated with an N × N midpoint rule; `fast` (#395) overrides the top-level flag. */\nexport type SimulateCapturePixelAperture = \"point\" | \"box\" | { kind: \"box\"; samplesPerAxis?: number; fast?: boolean };\n/** Default midpoint samples per axis of `sensor.pixelAperture: \"box\"`. */\nexport const SIMULATE_CAPTURE_BOX_APERTURE_DEFAULT_SAMPLES = 4;\nexport interface SimulateCaptureMotion {\n /** Constant camera angular velocity, rad/s, in the engine's pitch/yaw/roll convention. Missing axes are 0. */\n angularVelocityRadPerSec?: { pitch?: number; yaw?: number; roll?: number };\n /** Default \"global\". `rolling` derives the exposure schedule from the body's rolling readout declaration. */\n shutter?: \"global\" | \"rolling\";\n /** Rolling shutter only: time from the first to the last line over the simulated frame, in s. Default: the body's declared readout skew. */\n rollingShutterSkewSeconds?: number;\n}\n\nexport interface SimulateCaptureOptions {\n /** Generic tier preset id or a full preset record (for example a modified copy of a catalog entry). Default \"professional\". */\n camera?: GenericEquipmentTier | GenericEquipmentTierPreset;\n lens?: {\n /** Must lie in the lens capability (the generic primes are 50 mm). Default: the lens's shortest focal length. */\n focalLengthMm?: number;\n /**\n * Opt-in (2.3): a lens of the generic prime family by its full-frame-equivalent focal length\n * (`GENERIC_PRIME_EQUIVALENT_FOCAL_LENGTHS_MM`). Its physical focal length is the equivalent ÷ the diagonal crop\n * factor of the simulated frame (output width × height × pixel pitch); it replaces the tier lens's focal length and\n * f-number range (the tier lens's transmission is kept). An f-number outside the prime's range, or a subject or\n * focus distance below its minimum focus distance, is rejected. Not combinable with `focalLengthMm`.\n */\n prime?: number;\n /** Aperture for manual and aperture-priority modes. Default 8. */\n fNumber?: number;\n /** Focus distance in metres. Default: the subject distance. */\n focusDistanceM?: number;\n /** Opt-in ideal circular-pupil ray sampling (defocus/depth of field). Default off (central ray only). */\n pupilSampling?: { radialSamples: number; angularSamples: number };\n /** Ideal lens projection (`LENS_PROJECTION_MODELS`). Default \"rectilinear\". Not combinable with pupilSampling. */\n projection?: LensProjectionModel;\n /** Caller-declared radial or Brown–Conrady distortion profile. Default none. Not combinable with pupilSampling. */\n distortion?: SimulateCaptureLensDistortion;\n /** Caller-declared radial relative-illumination (vignetting) profile, applied as environment field throughput. */\n vignetting?: IlluminationVignettingProfile;\n /**\n * Caller sampled lens PSF, passed unchanged to the environment contract. Its focal length, f-number and\n * focus must equal the resolved capture settings exactly. Not combinable with pupilSampling.\n */\n psf?: Extract<CalculateEnvironmentSensorPhotoSignalInput[\"psf\"], { kind: \"sampled-local\" }>;\n /**\n * Opt-in (2.1) diffraction blur of an ideal, aberration-free, in-focus lens with a circular pupil at the\n * capture's resolved f-number: the engine builds the Airy kernels (`createDiffractionLimitedPsfProfile`)\n * on the site pitch. `kernelRadiusSamples` (0–32) sets the kernel window; default: the third dark ring at\n * the longest spectral node, capped at 32 sites. Not combinable with `psf` or `pupilSampling`. Default off.\n */\n diffraction?: SimulateCaptureLensDiffraction;\n /**\n * Opt-in (#492): defocus of the flat scene plane when `focusDistanceM` differs from the subject distance, as a\n * geometric disc (`model: \"geometric-disc\"`): the thin-lens blur circle of an ideal uniform circular pupil\n * (`calculateDefocusCircle`), an approximation. The blur diameter is recorded in the `lens.defocus` assumption.\n * `simulateCapture` renders the blur as an object-space convolution of the scene radiance on the site lattice and\n * `simulateDisplayView` as a site kernel in its expected signal; with `diffraction` each spectral node's diffraction\n * kernel is convolved with the disc (a further approximation). In focus the result is that of the same request\n * without the option, plus the assumption.\n * Not combinable with `pupilSampling` or `psf`. Default off.\n */\n defocus?: { model: \"geometric-disc\" };\n };\n exposure?: {\n /** Default \"manual\". */\n mode?: SimulateCaptureExposureMode;\n /**\n * Default 100. #516: `\"auto\"` lets the body's Auto ISO choose the ISO from the meter target, within its Auto ISO range\n * (the tiers: ISO 100 to their maximum), in every mode: manual keeps the aperture and shutter; aperture priority keeps the\n * aperture and follows `autoIso`; shutter priority picks the aperture at the lowest Auto ISO (no wider than the target\n * needs, so at most the widest) and raises the ISO for the rest; program picks the program line at the lowest Auto ISO and\n * raises the ISO beyond the line's end. The result reports the ISO in `exposure.settings.iso` and how it was chosen in\n * `exposure.autoIso`.\n */\n iso?: number | \"auto\";\n /**\n * #516: aperture priority with `iso: \"auto\"` only (required there). The shutter gets as long as\n * `slowestPreferredShutterSeconds` (seconds, within the body's shutter range) at the lowest Auto ISO; beyond it the ISO\n * rises; at the Auto ISO maximum `afterMaximumIso` decides (default `\"allow-slower-shutter\"`).\n */\n autoIso?: { slowestPreferredShutterSeconds: number; afterMaximumIso?: SimulateCaptureAutoIsoAfterMaximum };\n /** Shutter for manual and shutter-priority modes. Default 1/125 s. */\n shutterSeconds?: number;\n /** Exposure compensation applied to the meter target, in stops. Default 0. */\n compensationStops?: number;\n };\n /**\n * Required: an engine chart (for example `{ preset: \"uniform\" }`, an 18 % grey card), a declared `material-layers` scene (#491:\n * a chart under shape-mask layers, as `resolveChartMaterialLayers` takes it; the capture is that of its `callerScene`, byte for\n * byte, and the display view can render it on the GPU), or a caller reflectance, radiance or material function.\n */\n scene: ChartScene | ChartMaterialLayerScene | CallerReflectanceScene | CallerRadianceScene | CallerMaterialScene;\n /** Distance from the camera to the scene plane in metres. Default 5. */\n subjectDistanceM?: number;\n /**\n * Opt-in (2.3) fixed-size chart: place the scene at this physical size on the plane at the subject distance,\n * centred on the optical axis, instead of sizing it to fill the frame. Outside it the plane is a neutral surround\n * (default 18 %). Chart presets are resolved in the chart's own frame (aspect heightM / widthM); caller functions\n * are called only on the chart and receive chart-local `chartU`, `chartV`. `result.scene.chart` reports the\n * framed width, the fraction of the frame the chart covers and the thin-lens magnification.\n */\n chartSize?: ChartSizeOption;\n /** Default: Planckian 6500 K (a blackbody stand-in for daylight; CIE D65 is not bundled). */\n illuminant?: CaptureIlluminant;\n /** Illuminance on the scene plane, lux. Default about 21 481 lux (see `SIMULATE_CAPTURE_DEFAULT_ILLUMINANCE_LUX` and the assumptions). */\n illuminanceLux?: number;\n output?: {\n /** Output pixels; the native sensor raster adds a one-site demosaic border on each side. Defaults 64 × 64. */\n width?: number;\n height?: number;\n /** Default \"srgb-8\". */\n format?: SimulateCaptureOutputFormat;\n /** Default \"identity\". */\n toneCurve?: SdrToneCurve;\n /** Required by the luminance tone curves (see `SdrToneCurveParameters`). The facade does not make one up. */\n toneCurveParameters?: SdrToneCurveParameters;\n /** Default \"clip\". */\n highlightMode?: RawHighlightMode;\n /** Default \"scene-illuminant\". */\n whiteBalance?: SimulateCaptureWhiteBalance;\n /** JPEG constant quantization step 1-255 (not a manufacturer 'quality'). Default 2. */\n jpegQuantizationStep?: number;\n /** PNG only. Default \"srgb\". */\n colorEncoding?: SimulateCaptureColorEncoding;\n /** PNG only: 8 or 16 bits per sample. Default 8. */\n bitDepth?: 8 | 16;\n /**\n * PNG SDR encodings only. Default \"clip\" (per-component clip to the target gamut). \"perceptual\" maps\n * through `prepareRgbGamutMapping`: constant CIELAB L* and hue, chroma above 90 % of the boundary compressed.\n */\n gamutMapping?: \"clip\" | \"perceptual\";\n /** Default: the 1.0 facade's bilinear RGGB kernels. The record form (#395) adds a `fast` override. */\n demosaic?: SimulateCaptureDemosaic | SimulateCaptureDemosaicRecord;\n /** Default \"margin\". */\n borderHandling?: SimulateCaptureBorderHandling;\n /** DNG only: optional capture-event time (YYYY-MM-DDTHH:mm:ss.sssZ); without it no date tags are written. */\n dng?: { capturedAtUtc?: string };\n /**\n * Opt-in (2.4) text written into the file for formats \"jpeg\", \"png\" and \"dng\": the caller's description,\n * software, copyright and comment, unchanged (JPEG XMP + COM, PNG tEXt/iTXt, DNG TIFF tags + XMP; see the\n * quick start). Each field is 1–2048 UTF-8 bytes with no control characters except line feed. Default: none.\n */\n metadata?: OutputTextMetadata;\n /**\n * Opt-in large images: the most native sensor sites (the output plus the demosaic margin on each side) the\n * capture may allocate, an integer up to `NATIVE_RAW_LIMITS.ceilingPixels` (2^27). With it, `width` and\n * `height` may each reach 16 384 sites including the margin; without it they stay at most 4094. Time and\n * memory grow with the pixel count (see \"Large images\" in the quick start); browsers may fail at large sizes.\n */\n maximumPixels?: number;\n /**\n * Opt-in (2.3) region rendering: render only this rectangle, in output-pixel coordinates of the whole frame\n * `width` × `height` (x right, y down from its top-left). The pixels are byte-identical to the same pixels of\n * the whole render: framing, metering, exposure, noise seeds (absolute native site indices), rolling-shutter row\n * timing, diffraction and demosaic all use the whole frame. Use it to tile a large frame across workers or to\n * render a 100 % crop. `result.image` is the region; `result.region` reports it. Not combinable with\n * `whiteBalance: \"auto\"`, whose statistics would come from the region only. From 2.6 the diffraction convolution\n * covers only the region plus the kernel and filter reach, so a small region of a large frame costs about as much\n * as a capture of the region's size.\n */\n region?: { x: number; y: number; width: number; height: number };\n };\n /** Camera motion and shutter type. Default: still camera, global electronic shutter. */\n motion?: SimulateCaptureMotion;\n sensor?: {\n /**\n * Pixel pitch in micrometres, 0.5–1000. Default 6. The simulated sensor is output width × pitch wide. 2.5: above 100 µm the\n * capture is a downsized view of a whole frame (for example 36 mm / 48 pixels = 750 µm), recorded in the assumption\n * `sensor.wholeFrameView`: brightness is unchanged and the noise is that of a binned view, not of the real sensor's pixels.\n */\n pixelPitchMicrometers?: number;\n /** Maximum spectral quadrature subinterval in nm. Default 20. */\n spectralStepNanometers?: number;\n /** Temporal midpoint samples across the exposure. Default 1. */\n temporalSampleCount?: number;\n /** Noise seed (uint32). Default 1. */\n noiseSeed?: number;\n /**\n * Opt-in (2.1) optical anti-aliasing filter (birefringent point splitting, `SimulateCaptureSensorAntiAliasing`).\n * Multiplies the scene queries by the number of split points. Default off (the tiers declare no filter).\n */\n antiAliasing?: SimulateCaptureSensorAntiAliasing;\n /**\n * Opt-in (2.3) pixel aperture. `\"point\"` (default): each site samples the irradiance at its centre.\n * `\"box\"`: each site integrates the irradiance over its whole square photosite (fill factor 1) with an\n * N × N midpoint rule, N = `samplesPerAxis` (1–16, default 4), so detail finer than a pixel averages out as\n * on a real sensor (pixel MTF |sinc(f·p)|) instead of aliasing. Multiplies the scene queries by N².\n */\n pixelAperture?: SimulateCapturePixelAperture;\n };\n /**\n * Exact or fast (#395). `false` or omitted: every option runs its exact method, the engine reference. `true`: each option\n * listed in {@link SIMULATE_CAPTURE_FAST_OPTIONS} runs its fast method where it has one, a measured, bounded approximation of\n * the exact one; an option without a fast method runs exact. An option's own record `fast` overrides this for that option\n * only. `diagnostics.fast` reports what was requested and what ran. No option has a fast method yet, so every result is exact.\n */\n fast?: boolean;\n /** Aborting cancels the running task; the promise rejects with a domain error and returns no partial image. */\n signal?: AbortSignal;\n /** Called after each committed RAW, development or JPEG tile. Cannot change output. */\n onProgress?: (progress: SimulateCaptureProgress) => void;\n}\n\n/**\n * Options reported in `diagnostics.options` (2.1), in this order, when they ran: the ones that change how much work\n * a capture does. `motion.rotation` is a non-zero angular velocity; `sensor.temporalSampleCount` a count above 1.\n */\nexport const SIMULATE_CAPTURE_COST_OPTIONS = Object.freeze([\"lens.pupilSampling\", \"lens.projection\", \"lens.distortion\", \"lens.vignetting\", \"lens.psf\",\n \"lens.diffraction\", \"lens.defocus\", \"sensor.antiAliasing\", \"sensor.pixelAperture.box\", \"sensor.temporalSampleCount\", \"motion.rotation\", \"motion.shutter.rolling\", \"output.borderHandling.mirror\", \"output.region\",\n \"output.whiteBalance.auto\", \"output.demosaic.ahd\", \"output.highlightMode.reconstruct\", \"output.colorEncoding.wide-gamut\", \"output.gamutMapping.perceptual\",\n \"output.format.jpeg\", \"output.format.png\", \"output.format.dng\"] as const);\nexport type SimulateCaptureCostOption = typeof SIMULATE_CAPTURE_COST_OPTIONS[number];\n\n/**\n * The options that take the exact-or-fast flag (#395), in the path style of {@link SIMULATE_CAPTURE_COST_OPTIONS}: each accepts\n * the record form with `fast` and is reported in `diagnostics.fast.applied` when it runs. Every one of them takes the flag,\n * whether or not it has a fast method yet; one without runs exact and reports `false`.\n */\nexport const SIMULATE_CAPTURE_FAST_OPTIONS = Object.freeze([\"lens.diffraction\", \"sensor.antiAliasing\", \"sensor.pixelAperture.box\", \"output.demosaic.ahd\"] as const);\nexport type SimulateCaptureFastOption = typeof SIMULATE_CAPTURE_FAST_OPTIONS[number];\n\n/** `diagnostics.fast` of a capture or display view (#395): what was asked for and what ran. */\nexport interface SimulateCaptureFastReport {\n /** True when `fast: true` was given at the top level or in any option's record. */\n requested: boolean;\n /** Each fast-capable option that ran, in {@link SIMULATE_CAPTURE_FAST_OPTIONS} order: true where its fast method ran. */\n applied: Readonly<Partial<Record<SimulateCaptureFastOption, boolean>>>;\n /** `engine-reference` when every option ran exact; `approximation-with-a-priori-bound` when any fast method ran (the WebGPU execution record's values). */\n assurance: \"engine-reference\" | \"approximation-with-a-priori-bound\";\n}\n\nexport interface SimulateCaptureProgress {\n stage: \"raw\" | \"white-balance\" | \"development\" | \"jpeg\";\n completedTileCount: number;\n totalTileCount: number;\n}\n\n/** One decision the facade made: a default, a derived value or a fixed modelling choice. */\nexport interface SimulateCaptureAssumption {\n /** Dotted option path or modelling topic, for example \"exposure.shutterSeconds\" or \"model.lens-psf\". */\n id: string;\n kind: \"default\" | \"derived\" | \"model\";\n value: unknown;\n explanation: string;\n}\n\nexport interface SimulateCaptureResult {\n facadeVersion: typeof SIMULATE_CAPTURE_FACADE_VERSION;\n engineApiVersion: string;\n image: {\n width: number;\n height: number;\n format: SimulateCaptureOutputFormat;\n /** Interleaved RGB, row by row from the top-left. sRGB-encoded (W3C CSS Color 4 sRGB; also IEC 61966-2-1) unless `colorEncoding` says otherwise. */\n samples: Uint8Array | Uint16Array;\n /** Baseline JPEG bytes when format is \"jpeg\". */\n jpeg?: Uint8Array;\n /** PNG file bytes when format is \"png\". */\n png?: Uint8Array;\n /** Encoding of `samples` and `png` when format is \"png\". */\n colorEncoding?: SimulateCaptureColorEncoding;\n /** Lossless uncompressed CFA DNG of the packed RAW when format is \"dng\" (`serializeNativeRawDng`); `samples` are then sRGB 8-bit. */\n dng?: Uint8Array;\n };\n /**\n * Packed native RAW (codes, black levels, saturation flags) as produced by the native environment RAW task. With\n * `output.region` (2.3): the region's native sites only, with `plan` describing that raster (its active area is the\n * region); `request.environmentRaw` and `request.siteInput` stay those of the whole frame.\n */\n raw: NativeRawOutput;\n plan: NativeRawPlan;\n /**\n * 2.3, present with `output.region`: the rendered rectangle in output pixels of the whole `frameWidth` × `frameHeight`\n * frame, and the native sites rendered for it (`nativeRect`, in the whole frame's native raster: the region, the\n * demosaic reach on each side clipped to the raster, and its origin rounded down to the 2 × 2 CFA repeat).\n */\n region?: { x: number; y: number; width: number; height: number; frameWidth: number; frameHeight: number; nativeRect: { x: number; y: number; width: number; height: number } };\n /** The complete underlying request. */\n request: {\n environmentRaw: NativeEnvironmentRawInput;\n /** Rebuilds the exact physical site input the provider supplied for a native row-major index. */\n siteInput(nativeIndex: number): SimulateEnvironmentSensorRawFrameInput[\"sites\"][number];\n development: Omit<NativeRawDevelopmentInput, \"raw\">;\n whiteBalanceState: ResolvedWhiteBalanceState | null;\n /**\n * Present with lens.diffraction (2.1): the engine-built Airy profile, the equivalent environment sampled PSF\n * selection, and how it was applied. With `object-space-convolution` the site inputs declare no PSF and the\n * provider answers with the PSF-convolved radiance; putting `psf` into each site input and using the plain\n * scene provider gives the same expected signal (to float rounding) through the per-tap environment quadrature.\n */\n diffraction?: { profile: DiffractionLimitedPsfProfile; psf: Extract<CalculateEnvironmentSensorPhotoSignalInput[\"psf\"], { kind: \"sampled-local\" }>;\n execution: \"object-space-convolution\" | \"environment-psf-quadrature\" };\n };\n exposure: {\n mode: SimulateCaptureExposureMode;\n settings: { fNumber: number; shutterSeconds: number; iso: number };\n /** Exposure value at ISO 100 of the settings, log2(N²/t). */\n ev100: number;\n /** #516: `\"automatic\"` when the request asked for `iso: \"auto\"`, else `\"manual\"`. */\n isoControl: \"manual\" | \"automatic\";\n /** #516: present with `iso: \"auto\"`: how Auto ISO chose `settings.iso` and what limited it. */\n autoIso?: SimulateCaptureAutoIsoReport;\n meteredSceneLuminanceCdPerSquareMeter: number;\n /**\n * #515: deviation, in stops, of the exposure used from the CIPA DC-004-2020 standard exposure for the metered luminance L:\n * log2(N²/t) − log2(0.65·L·S/10). Positive is darker than the standard exposure (under), negative brighter (over). In an\n * automatic mode it is the compensation with the opposite sign plus any step or limit the resolver hit. Finite, or null when\n * the metered luminance is 0 (a black scene has no standard exposure).\n */\n standardExposureDeviationStops: number | null;\n /** Full output of the existing exposure-mode resolver. */\n resolution: unknown;\n };\n scene: {\n sceneId: string;\n preset: string;\n parameters: Readonly<Record<string, unknown>>;\n illuminant: { id: string; description: string; illuminanceLux: number };\n distanceM: number;\n /** Physical size of the framed scene plane, metres. */\n framedWidthM: number;\n framedHeightM: number;\n /**\n * 2.3, present with `chartSize`: the chart's physical size and surround, the fraction of the frame width and\n * height it covers (above 1 when it is larger than the frame and cropped), the thin-lens magnification\n * v/d (image distance over subject distance, the scale the facade's framing uses) and the chart's size on the\n * sensor in millimetres and output pixels.\n */\n chart?: { widthM: number; heightM: number; surroundReflectance: number; frameWidthFraction: number; frameHeightFraction: number;\n magnification: number; imageWidthMm: number; imageHeightMm: number; imageWidthPixels: number; imageHeightPixels: number };\n /**\n * SHA-256 of the canonical scene description, recorded as the capture source digest. Caller spectra (a\n * `spectrum` or `daylight` illuminant, chart reflectance spectra) are part of the description: tabulated\n * data exactly, function spectra sampled at 1 nm over 380-780 nm, plus the daylight basis datasetId.\n * The body of a caller scene's evaluate function is not hashed.\n */\n sourceSha256: string;\n };\n diagnostics: {\n providerEvaluationCount: number;\n highlight: RawHighlightDiagnostics;\n rendering: SdrRenderingResult[\"diagnostics\"];\n /** Present with output.gamutMapping \"perceptual\": pixels whose chroma or lightness the mapping changed. */\n gamutMapping?: { method: \"cielab-hue-preserving-chroma-compression\"; kneeFraction: number; adjustedPixelCount: number; lightnessClippedPixelCount: number };\n /**\n * Wall-clock milliseconds per stage. `raw`, `whiteBalance` (the second RAW pass of auto white balance), `development`\n * (includes DNG writing), `jpeg` and `total` are whole milliseconds (`Date.now()`). Since 2.1, where a stage ran:\n * `diffraction` (the object-space convolution of `lens.diffraction`; part of `raw` and `whiteBalance`), `demosaic`\n * (the AHD demosaic; part of `development`) and `encode` (PNG, JPEG or DNG serialization), with sub-millisecond\n * resolution where the host has `performance.now()`. Timings vary from run to run and never enter any digest or output byte.\n * #492: `defocus`, the object-space convolution of `lens.defocus` out of focus (with `lens.diffraction` the combined\n * kernel's convolution, reported here instead of under `diffraction`).\n */\n timingsMs: { raw: number; whiteBalance: number; development: number; jpeg: number; total: number; diffraction?: number; defocus?: number; demosaic?: number; encode?: number };\n /**\n * 2.1: the opt-in options that changed the work of this run, in a fixed order (see `SIMULATE_CAPTURE_COST_OPTIONS`).\n * Empty for a capture with every default. With `timingsMs` it lets an application measure each option's cost on\n * the user's device.\n */\n options: readonly SimulateCaptureCostOption[];\n /** #395: exact or fast, as requested and as run (see {@link SimulateCaptureFastReport}). */\n fast: SimulateCaptureFastReport;\n };\n provenance: {\n scientificStatus: \"approximation\";\n cameraPresetId: string;\n cameraPresetVersion: string;\n evidence: readonly EvidenceProvenance[];\n /** Existing engine contracts the facade composed, in execution order. */\n composedContracts: readonly string[];\n limitations: readonly string[];\n };\n assumptions: readonly SimulateCaptureAssumption[];\n}\n\nexport const FACADE_EVIDENCE: readonly EvidenceProvenance[] = Object.freeze([Object.freeze({ sourceOrigin: \"photivra\" as const,\n sourceReference: \"photivra:simulate-capture-facade\", reuseStatus: \"photivra-owned\" as const })]);\nconst DEFAULTS = Object.freeze({ camera: \"professional\" as const, fNumber: 8, shutterSeconds: 1 / 125, iso: 100, compensationStops: 0,\n subjectDistanceM: 5, width: 64, height: 64, format: \"srgb-8\" as const, toneCurve: \"identity\" as const, highlightMode: \"clip\" as const,\n whiteBalance: \"scene-illuminant\" as const, jpegQuantizationStep: 2, pixelPitchMicrometers: 6, spectralStepNanometers: 20,\n temporalSampleCount: 1, noiseSeed: 1, illuminantKelvin: 6500 });\n/** Standard output sensitivity S = 10 / H (CIPA DC-004-2020 §3.2): the reference exposure in lx·s is 10 / S. */\nconst SOS_REFERENCE_EXPOSURE_NUMERATOR_LUX_SECONDS = 10;\n/** Camera equation H = 0.65·L·t/N² (CIPA DC-004-2020 §5.5 (4); 0.65 = τ·π/4 with τ = 0.828, Explanation 4). */\nconst CAMERA_EQUATION_CONSTANT = 0.65;\n/** Neutral reference reflectance: DC-004 ties the SOS reference level to an 18 % grey (Explanation 1 and 2.2). */\nconst GREY_CARD_REFLECTANCE = 0.18;\n/** Scene luminance (cd/m²) whose focal-plane exposure 0.65·L·t/N² equals the SOS reference exposure 10/S. */\nfunction sosReferenceLuminance(fNumber: number, shutterSeconds: number, iso: number): number {\n return SOS_REFERENCE_EXPOSURE_NUMERATOR_LUX_SECONDS * fNumber ** 2 / (CAMERA_EQUATION_CONSTANT * shutterSeconds * iso);\n}\n/**\n * #515: deviation, in stops, of the exposure the settings give from the CIPA DC-004-2020 standard exposure for the metered\n * luminance L: Δ = log2(N²/t) − log2(0.65·L·S/10) = log2(L_ref(N, t, S) / L), with L_ref the luminance that the settings\n * expose at H = 10/S (S = 10/H, §3.2; H = 0.65·L·t/N², §5.5 (4)). Positive is darker than the standard exposure (under).\n * A scene with no metered luminance (L = 0, which manual mode still captures) has no standard exposure: null, never ±Infinity.\n */\nfunction standardExposureDeviationStops(fNumber: number, shutterSeconds: number, iso: number, meteredLuminance: number): number | null {\n if (!(meteredLuminance > 0)) return null;\n const deviation = Math.log2(sosReferenceLuminance(fNumber, shutterSeconds, iso) / meteredLuminance);\n if (!Number.isFinite(deviation)) throw new InvalidScientificResultError(\"exposure.standardExposureDeviationStops is not finite (metered scene luminance \" +\n meteredLuminance + \" cd/m²).\");\n return deviation;\n}\n/**\n * Default illuminance, lux: an 18 % Lambertian grey card (L = 0.18·E/π) then gets exactly the CIPA DC-004 standard\n * output sensitivity reference exposure H = 10/S at f/8, 1/125 s, ISO 100:\n * E = π·10·N²/(0.65·t·S·0.18) = π·80 000/11.7 ≈ 21 480.98 lux.\n */\nexport const SIMULATE_CAPTURE_DEFAULT_ILLUMINANCE_LUX = Math.PI * sosReferenceLuminance(DEFAULTS.fNumber, DEFAULTS.shutterSeconds, DEFAULTS.iso) /\n GREY_CARD_REFLECTANCE;\n/**\n * Sensitive-aperture area (µm²) at which the tier's ISO signal chain applies unchanged: the default 6 µm square\n * aperture with fill factor 1. At other areas the facade scales the electron-domain readout values by\n * area / this reference, so the same focal-plane exposure H gives the same output code (see `isoAreaScaledReadout`).\n */\n/** 2.5: the largest accepted pixel pitch, µm (44 mm ÷ 48 pixels ≈ 917 µm, a whole full-frame or larger sensor at a small output). */\nconst SIMULATE_CAPTURE_PIXEL_PITCH_MAXIMUM_MICROMETERS = 1000;\n/** Pitches above this, µm, are larger than any camera photosite: the capture is a downsized whole-frame view (assumption sensor.wholeFrameView). */\nconst SIMULATE_CAPTURE_PHOTOSITE_PITCH_MAXIMUM_MICROMETERS = 100;\nconst ISO_REFERENCE_APERTURE_AREA_SQUARE_MICROMETERS = DEFAULTS.pixelPitchMicrometers * DEFAULTS.pixelPitchMicrometers;\n/** Demosaic border, native sites per side. */\nconst MARGIN = 1;\n/**\n * AHD border, native sites per side: an AHD output pixel depends on sites up to 5 away (directional green ±2,\n * colour differences ±1 of it, the homogeneity's 4-neighbours and its 3 × 3 sum), so a 5-site rendered margin keeps\n * every output pixel off the plane's mirrored edge.\n */\nconst AHD_MARGIN = 5;\n/** Sites whose values enter an AHD output pixel (interpolation reach), for the saturated-pixel count. */\nconst AHD_VALUE_REACH = 3;\n\n/** Anti-aliasing filter limits: split points, and the largest offset in sites (bounds the scene work and the convolution margin). */\nconst AA_MAXIMUM_COMPONENTS = 16;\nconst AA_MAXIMUM_OFFSET_SITES = 4;\n/** Channel responses kept across calls (`axisChannelResponse`): one entry per distinct sensor, exposure and optics state. */\nconst CHANNEL_RESPONSE_CACHE_SIZE = 8;\nconst channelResponseCache = new Map<string, Record<\"red\" | \"green\" | \"blue\", Map<number, number>>>();\n/**\n * #449: diffraction profiles kept across calls, by the JSON of their `createDiffractionLimitedPsfProfile` input (the last\n * DIFFRACTION_PROFILE_CACHE_SIZE, most recently used last). Every region part and detail tile of one request builds the same\n * input. The kept record is private: each call gets its own copy, as mutable as a newly built one, so a caller's change\n * never reaches another call. The copy is made of plain records and arrays (plainDataCopy): the kernel set-up structured-clones\n * the profile once per spectral node, and in a CPU profile of the 96 × 64 Quality tile that clone took about twice as long\n * (24 instead of 12 ms per call) on a deep-frozen record or on a structuredClone copy as on a newly built record or this copy.\n */\nconst DIFFRACTION_PROFILE_CACHE_SIZE = 8;\nconst diffractionProfileCache = new Map<string, DiffractionLimitedPsfProfile>();\n/** A copy of plain data (records, arrays, primitives; typed arrays are sliced), built from ordinary literals. */\nfunction plainDataCopy<T>(value: T): T {\n if (Array.isArray(value)) return value.map(plainDataCopy) as T;\n if (ArrayBuffer.isView(value)) return (value as unknown as { slice(): T }).slice();\n if (value === null || typeof value !== \"object\") return value;\n const copy: Record<string, unknown> = {};\n for (const key of Object.keys(value)) copy[key] = plainDataCopy((value as Record<string, unknown>)[key]);\n return copy as T;\n}\n/** The profile of `input` (a pure function of the input record): a copy of the kept one when the same input was built before. */\nfunction cachedDiffractionProfile(input: Parameters<typeof createDiffractionLimitedPsfProfile>[0]): DiffractionLimitedPsfProfile {\n const key = JSON.stringify(input);\n let kept = diffractionProfileCache.get(key);\n if (kept) diffractionProfileCache.delete(key);\n else kept = createDiffractionLimitedPsfProfile(input).value;\n diffractionProfileCache.set(key, kept);\n if (diffractionProfileCache.size > DIFFRACTION_PROFILE_CACHE_SIZE) diffractionProfileCache.delete(diffractionProfileCache.keys().next().value!);\n // The same fields in the same order as the built record, frozen at the top level like it; `model` is the frozen constant.\n return Object.freeze({ ...kept, profile: plainDataCopy(kept.profile), wavelengths: plainDataCopy(kept.wavelengths), quadrature: plainDataCopy(kept.quadrature) });\n}\n/** Default birefringent separation in sites: the two-spot MTF |cos(π·f·d)| then has its first zero at Nyquist, f = 1/(2·pitch). */\nconst AA_DEFAULT_SEPARATION_SITES = 1;\ninterface ParsedAntiAliasing { kind: SimulateCaptureSensorAntiAliasing[\"kind\"]; separationSites?: number; axis?: \"horizontal\" | \"vertical\";\n components: AntiAliasingPointSplitComponent[] }\n/** #395: the `fast` override of an option record (undefined when absent), which must be a Boolean. */\nfunction fastOverride(record: Record<string, unknown>, path: string): boolean | undefined {\n const value = record.fast;\n if (value !== undefined && typeof value !== \"boolean\") fail(path + \".fast must be true or false.\");\n return value as boolean | undefined;\n}\n/** Parses `sensor.antiAliasing` into engine point-splitting components (offsets in µm, +x right, +y down). */\nfunction parseAntiAliasing(value: unknown, pitch: number): ParsedAntiAliasing {\n requireInputObject(value, \"sensor.antiAliasing\");\n const kind = (value as { kind?: unknown }).kind;\n const separation = (record: Record<string, unknown>): number => {\n if (record.separationSites === undefined) return AA_DEFAULT_SEPARATION_SITES;\n const d = positive(record.separationSites, \"sensor.antiAliasing.separationSites\");\n if (d > AA_MAXIMUM_OFFSET_SITES) fail(\"sensor.antiAliasing.separationSites must be greater than 0 and at most \" + AA_MAXIMUM_OFFSET_SITES + \".\");\n return d;\n };\n if (kind === \"four-spot\") {\n const record = allowKeys(value, \"sensor.antiAliasing\", [\"kind\", \"separationSites\", \"fast\"]), d = separation(record), h = d * pitch / 2;\n return { kind, separationSites: d, components: [[-h, -h], [h, -h], [-h, h], [h, h]].map(([x, y]) => ({ offsetMicrometers: { x: x!, y: y! }, normalizedWeight: 0.25 })) };\n }\n if (kind === \"two-spot\") {\n const record = allowKeys(value, \"sensor.antiAliasing\", [\"kind\", \"axis\", \"separationSites\", \"fast\"]), d = separation(record), h = d * pitch / 2;\n if (record.axis !== \"horizontal\" && record.axis !== \"vertical\") fail(\"sensor.antiAliasing.axis must be horizontal or vertical.\");\n const axis = record.axis as \"horizontal\" | \"vertical\";\n return { kind, axis, separationSites: d, components: [-h, h].map((o) => ({ offsetMicrometers: axis === \"horizontal\" ? { x: o, y: 0 } : { x: 0, y: o }, normalizedWeight: 0.5 })) };\n }\n if (kind === \"point-splitting\") {\n const record = allowKeys(value, \"sensor.antiAliasing\", [\"kind\", \"components\", \"fast\"]);\n if (!Array.isArray(record.components) || record.components.length === 0 || record.components.length > AA_MAXIMUM_COMPONENTS) {\n fail(\"sensor.antiAliasing.components must be an array of 1 to \" + AA_MAXIMUM_COMPONENTS + \" components.\");\n }\n // The engine's optical-stack parser checks shape, finiteness, positive weights and the unit sum (1e-12).\n const kernel = resolveAntiAliasingSpatialKernel({ schemaVersion: \"0.1.0\", profileId: \"facade-aa-check\", evidence: FACADE_EVIDENCE,\n effectiveAntiAliasingSpatialResponse: { kind: \"normalized-point-splitting-kernel\", evidence: FACADE_EVIDENCE, coordinateSystem: \"native-sensor-physical\",\n scope: \"field-wavelength-polarization-invariant-approximation\", components: record.components as AntiAliasingPointSplitComponent[] } });\n for (const c of kernel.components) if (Math.max(Math.abs(c.offsetMicrometers.x), Math.abs(c.offsetMicrometers.y)) > AA_MAXIMUM_OFFSET_SITES * pitch) {\n fail(\"sensor.antiAliasing.components offsets must lie within \" + AA_MAXIMUM_OFFSET_SITES + \" sites (\" + AA_MAXIMUM_OFFSET_SITES * pitch + \" µm) of the site centre.\");\n }\n return { kind, components: kernel.components.map((c) => ({ offsetMicrometers: { ...c.offsetMicrometers }, normalizedWeight: c.normalizedWeight })) };\n }\n return fail(\"sensor.antiAliasing.kind must be four-spot, two-spot or point-splitting.\");\n}\n\n/** Midpoint nodes of an N × N rule over a square photosite, as offsets from its centre in sites (+x right, +y down). */\nexport function apertureNodeOffsets(n: number): { x: number; y: number }[] {\n const out: { x: number; y: number }[] = [];\n for (let j = 0; j < n; j++) for (let i = 0; i < n; i++) out.push({ x: (i + 0.5) / n - 0.5, y: (j + 0.5) / n - 0.5 });\n return out;\n}\n/** Third dark ring of the Airy pattern in units of λ·N_w (j₁,₃/π, j₁,₃ = 10.1734681351): the default diffraction kernel reach. */\nconst AIRY_THIRD_ZERO_PER_LAMBDA_N = 10.173468135062722 / Math.PI;\n/** Default temporal midpoints when the camera rotates (2.0 motion option). */\nconst ROTATING_TEMPORAL_SAMPLE_COUNT = 8;\nconst IDS = Object.freeze({ frame: \"facade-frame\", mode: \"native-still\", cfa: \"photivra-generic-bayer\", binding: \"facade-native-cfa\",\n sceneState: \"facade-scene-state\", scene: \"facade-scene\", provider: \"facade-provider\", lights: \"facade-lights\", materials: \"facade-materials\",\n capture: \"facade-capture\", spectral: \"facade-colorimetric-eqe\", sampling: \"facade-sampling\", stack: \"facade-no-aa\", stackAa: \"facade-aa\",\n stationarity: \"facade-stationarity\", operatingState: \"facade-operating-state\", dark: \"facade-dark\", completeness: \"facade-completeness\",\n chargeSampling: \"facade-charge-sampling\", capacity: \"facade-capacity\" });\nexport const CHANNELS = [\"red\", \"green\", \"blue\"] as const;\ntype Channel = typeof CHANNELS[number];\n/**\n * Synthetic colorimetric sensor: channel EQE(λ) = a·cmf(λ)·(555 nm/λ), with cmf = x̄, ȳ, z̄. The λ factor turns\n * the energy-weighted CMF (colour-matching function) into a photon-counting response. So channel counts are\n * proportional to CIE XYZ (the Luther–Ives condition holds, up to quadrature error), and the camera→XYZ\n * matrix is diagonal.\n */\nconst EQE_SCALE: Readonly<Record<Channel, number>> = Object.freeze({ red: 0.5, green: 0.5, blue: 0.25 });\nconst CMF_KEY: Readonly<Record<Channel, \"x\" | \"y\" | \"z\">> = Object.freeze({ red: \"x\", green: \"y\", blue: \"z\" });\nexport const CAMERA_TO_XYZ: readonly (readonly number[])[] = Object.freeze([[EQE_SCALE.green / EQE_SCALE.red, 0, 0], [0, 1, 0], [0, 0, EQE_SCALE.green / EQE_SCALE.blue]].map((r) => Object.freeze(r)));\nconst XYZ_TO_CAMERA = [[EQE_SCALE.red / EQE_SCALE.green, 0, 0], [0, 1, 0], [0, 0, EQE_SCALE.blue / EQE_SCALE.green]] as const;\n/** Synthetic dark current per site at the operating temperature, e⁻/s. */\nexport const DARK_CURRENT_ELECTRONS_PER_SECOND = 1;\nconst OPERATING_TEMPERATURE_C = 20;\n\nexport function fail(message: string): never { throw new InvalidConfigurationError(message); }\n/** Where `output.metadata` goes in each file format (reported in the `output.metadata` assumption). */\nconst TEXT_METADATA_LAYOUT = Object.freeze({\n jpeg: \"XMP packet in APP1 (dc:description, xmp:CreatorTool, dc:rights, exif:UserComment), plus a COM segment holding the comment\",\n png: \"One tEXt (printable Latin-1) or iTXt (UTF-8) chunk per field, keywords Description, Software, Copyright, Comment, before the first IDAT\",\n dng: \"ImageDescription (statement, then the description) and Copyright when printable ASCII; an XMP packet in tag 700 with every field\"\n});\ntype ReadoutProfile = GenericEquipmentTierPreset[\"body\"][\"readout\"][number][\"profile\"];\n/**\n * The readout profile with every regime's charge-domain transfer scaled by `areaScale`: system conversion gain\n * (e⁻ per code) and pre-ADC saturation (e⁻ equivalent) are multiplied by it, so codes per unit focal-plane exposure\n * stay those of the reference aperture. Read noise stays in electrons per pixel; codes, black level, ADC and digital\n * gain are unchanged. The result is re-checked by the readout parser.\n */\nfunction isoAreaScaledReadout(profile: ReadoutProfile, areaScale: number): ReadoutProfile {\n return parseSensorReadoutConversionProfile({ ...profile, regimes: profile.regimes.map((regime) => ({ ...regime,\n systemConversionGainElectronsPerCode: { ...regime.systemConversionGainElectronsPerCode, value: regime.systemConversionGainElectronsPerCode.value * areaScale },\n preAdcSaturationElectronEquivalent: { ...regime.preAdcSaturationElectronEquivalent, value: regime.preAdcSaturationElectronEquivalent.value * areaScale } })) });\n}\n/** Diagnostic clock for the 2.1 stage timings: `performance.now()` where the host has it. Never affects output. */\nexport function clockMs(): number { return globalThis.performance?.now() ?? Date.now(); }\nfunction positive(value: unknown, name: string): number {\n if (typeof value !== \"number\" || !Number.isFinite(value) || value <= 0) fail(name + \" must be a positive finite number.\");\n return value as number;\n}\nfunction integerIn(value: unknown, name: string, minimum: number, maximum: number): number {\n if (typeof value !== \"number\" || !Number.isSafeInteger(value) || value < minimum || value > maximum) fail(name + \" must be an integer from \" + minimum + \" to \" + maximum + \".\");\n return value as number;\n}\nexport function allowKeys(value: unknown, name: string, keys: readonly string[]): Record<string, unknown> {\n if (value === undefined) return {};\n requireInputObject(value, name);\n for (const key of Object.keys(value as object)) if (!keys.includes(key)) fail(\"Unknown \" + name + \" field: \" + key + \".\");\n return value as Record<string, unknown>;\n}\nfunction sampled(values: readonly { nm: number; value: number }[]): { wavelengthUnit: \"nm\"; wavelengthBasis: \"vacuum\"; interpolation: \"piecewise-linear\";\n outsideRangeBehavior: \"fail-closed\"; evidence: readonly EvidenceProvenance[]; samples: { wavelengthNanometers: number; value: number }[] } {\n return { wavelengthUnit: \"nm\", wavelengthBasis: \"vacuum\", interpolation: \"piecewise-linear\", outsideRangeBehavior: \"fail-closed\", evidence: FACADE_EVIDENCE,\n samples: values.map((s) => ({ wavelengthNanometers: s.nm, value: s.value })) };\n}\nasync function sha256Hex(text: string): Promise<string> {\n const subtle = globalThis.crypto?.subtle;\n if (!subtle) fail(\"simulateCapture needs crypto.subtle (a secure browser context or Node 22+) to digest the scene description.\");\n const bytes = new Uint8Array(await subtle.digest(\"SHA-256\", new TextEncoder().encode(text)));\n return Array.from(bytes, (b) => b.toString(16).padStart(2, \"0\")).join(\"\");\n}\n/**\n * The form in which a caller spectrum enters the scene digest. Tabulated data is hashed exactly as its\n * (wavelength, value) pairs. A function spectrum has no data to hash, so it is sampled at the facade's\n * 1 nm integer nodes over 380-780 nm (the grid the facade also uses to normalize illuminance).\n */\nfunction spectrumDigestForm(raw: unknown, prepared: PreparedColorimetricSpectrum): unknown {\n const record = raw as { kind?: unknown; samples?: readonly { wavelengthNanometers: number; value: number }[] };\n if (record.kind === \"tabulated\" && Array.isArray(record.samples)) {\n return { kind: \"tabulated\", samples: record.samples.map((sample) => [sample.wavelengthNanometers, sample.value]) };\n }\n const values: number[] = [];\n for (let nm = FACADE_SPECTRAL_RANGE_NANOMETERS.minimum; nm <= FACADE_SPECTRAL_RANGE_NANOMETERS.maximum; nm++) values.push(prepared.evaluate(nm));\n return { kind: \"function-sampled-1nm\", rangeNanometers: [FACADE_SPECTRAL_RANGE_NANOMETERS.minimum, FACADE_SPECTRAL_RANGE_NANOMETERS.maximum], values };\n}\n/**\n * #449: the CIE 1931 ȳ values at luminanceOf's 5 nm nodes, evaluated once (estimateCie1931ColorMatchingFunctions is a pure\n * function of the wavelength, so each entry is the value the loop would compute).\n */\nlet luminanceCmfY: Float64Array | undefined;\nfunction luminanceNodesY(): Float64Array {\n if (luminanceCmfY) return luminanceCmfY;\n const values: number[] = [];\n for (let nm = FACADE_SPECTRAL_RANGE_NANOMETERS.minimum; nm <= FACADE_SPECTRAL_RANGE_NANOMETERS.maximum; nm += 5) values.push(estimateCie1931ColorMatchingFunctions(nm).y);\n return (luminanceCmfY = Float64Array.from(values));\n}\nfunction luminanceOf(radiance: (nm: number) => number): number {\n const cmfY = luminanceNodesY();\n let sum = 0;\n for (let nm = FACADE_SPECTRAL_RANGE_NANOMETERS.minimum, i = 0; nm <= FACADE_SPECTRAL_RANGE_NANOMETERS.maximum; nm += 5, i++) {\n const w = nm === FACADE_SPECTRAL_RANGE_NANOMETERS.minimum || nm === FACADE_SPECTRAL_RANGE_NANOMETERS.maximum ? 2.5 : 5;\n sum += w * radiance(nm) * cmfY[i]!;\n }\n return PHOTOPIC_MAXIMUM_LUMINOUS_EFFICACY_LM_PER_W * sum;\n}\n/** The white balance measured from a perfect white diffuser under the scene illuminant (\"scene-illuminant\"). */\nexport function sceneIlluminantWhiteBalance(illuminant: ResolvedCaptureIlluminant): ResolvedWhiteBalanceState {\n const xyz = illuminantXyz(illuminant), camera = XYZ_TO_CAMERA.map((row) => row[0] * xyz[0] + row[1] * xyz[1] + row[2] * xyz[2]);\n return resolveCustomWhiteBalance({ stateId: \"facade-wb-scene-illuminant\", sampleSet: { imageStateId: \"facade-white-diffuser\",\n inputDomain: \"relative-pre-wb-camera-linear-rgb\", samples: [{ sampleId: \"white\", red: camera[0]!, green: camera[1]!, blue: camera[2]!, weight: 1, clipped: false }] } });\n}\nfunction illuminantXyz(illuminant: ResolvedCaptureIlluminant): [number, number, number] {\n let x = 0, y = 0, z = 0;\n for (let nm = FACADE_SPECTRAL_RANGE_NANOMETERS.minimum; nm <= FACADE_SPECTRAL_RANGE_NANOMETERS.maximum; nm++) {\n const s = illuminant.shape.evaluate(nm), c = estimateCie1931ColorMatchingFunctions(nm);\n x += s * c.x; y += s * c.y; z += s * c.z;\n }\n return [x / y, 1, z / y];\n}\n/** Bilinear RGGB demosaic as explicit linear neighbourhood kernels (weights sum to one per output channel). */\nexport function bilinearPhaseProfiles(): RawFrameReconstructionPhaseProfile[] {\n const cross = [[1, 0], [-1, 0], [0, 1], [0, -1]], diagonal = [[1, 1], [1, -1], [-1, 1], [-1, -1]], horizontal = [[1, 0], [-1, 0]], vertical = [[0, 1], [0, -1]];\n type Contribution = { offsetX: number; offsetY: number; sourceChannelId: Channel; weight: number };\n const average = (offsets: number[][], channel: Channel): Contribution[] => offsets.map(([x, y]) => ({ offsetX: x!, offsetY: y!, sourceChannelId: channel, weight: 1 / offsets.length }));\n const self = (channel: Channel): Contribution[] => [{ offsetX: 0, offsetY: 0, sourceChannelId: channel, weight: 1 }];\n const kernels: Record<string, Record<Channel, ReturnType<typeof self>>> = {\n \"0,0\": { red: self(\"red\"), green: average(cross, \"green\"), blue: average(diagonal, \"blue\") },\n \"1,0\": { red: average(horizontal, \"red\"), green: self(\"green\"), blue: average(vertical, \"blue\") },\n \"0,1\": { red: average(vertical, \"red\"), green: self(\"green\"), blue: average(horizontal, \"blue\") },\n \"1,1\": { red: average(diagonal, \"red\"), green: average(cross, \"green\"), blue: self(\"blue\") }\n };\n return [[0, 0], [1, 0], [0, 1], [1, 1]].map(([px, py], index) => ({ phaseX: px!, phaseY: py!, profile: { schemaVersion: \"0.1.0\" as const,\n profileId: \"facade-bilinear-phase-\" + index, profileVersion: \"1\", captureModeId: IDS.mode, colorSamplingProfileId: IDS.cfa,\n scientificStatus: \"approximation\" as const, method: \"explicit-linear-native-neighborhood\" as const,\n normalization: \"weights-sum-to-one-per-output-channel\" as const, negativeBlackSubtractedValuesAllowed: true,\n kernels: CHANNELS.map((c) => ({ outputChannelId: c, contributions: kernels[px + \",\" + py]![c] })), evidence: FACADE_EVIDENCE,\n limitations: [\"Bilinear interpolation of the RGGB mosaic; no edge-directed demosaic, false-colour suppression or calibration.\"] } })) as unknown as RawFrameReconstructionPhaseProfile[];\n}\n/**\n * #516: the result's Auto ISO report, read from a resolved Auto ISO resolution (every mode's resolved Auto ISO branch carries\n * `idealIsoBeforeConstraints`, `isoResolution` and a resolved `targetResidual`; aperture priority adds its fallback flag).\n */\nfunction autoIsoReport(resolution: unknown, iso: ResolvedGenericEquipmentExposureCapabilities[\"iso\"],\n aperturePriority: { slowestPreferredShutterSeconds: number; afterMaximumIso: SimulateCaptureAutoIsoAfterMaximum } | undefined): SimulateCaptureAutoIsoReport {\n const r = resolution as { idealIsoBeforeConstraints?: unknown; isoResolution?: { clamped?: unknown }; afterMaximumIsoFallbackUsed?: unknown;\n targetResidual?: { status?: unknown; limitingConstraint?: unknown; residualStops?: unknown } };\n const ideal = r.idealIsoBeforeConstraints, residual = r.targetResidual?.residualStops, clamped = r.isoResolution?.clamped;\n if (typeof ideal !== \"number\" || !Number.isFinite(ideal) || typeof residual !== \"number\" || !Number.isFinite(residual) || r.targetResidual?.status !== \"resolved\" ||\n (clamped !== false && clamped !== \"minimum\" && clamped !== \"maximum\"))\n throw new InvalidScientificResultError(\"Auto ISO resolution did not report a finite ideal ISO and residual.\");\n // The resolvers' Auto ISO range: the body's Auto ISO bounds, else its ISO range.\n return { idealIsoBeforeConstraints: ideal, autoIsoMinimum: iso.autoIsoMinimum ?? iso.minimum, autoIsoMaximum: iso.autoIsoMaximum ?? iso.maximum, clamped,\n limitingConstraint: r.targetResidual.limitingConstraint as ExposureResolutionConstraint, residualStops: residual,\n ...(aperturePriority ? { ...aperturePriority, afterMaximumIsoFallbackUsed: r.afterMaximumIsoFallbackUsed === true } : {}) };\n}\nfunction defaultProgramLine(): ExposureProgramLineProfile {\n // Generic educational program line written for the engine, relative to the f/8, 1/125 s reference. For less light\n // it first opens the aperture toward f/4, then lengthens the shutter. For more light it first closes toward\n // f/16, then shortens the shutter.\n return parseExposureProgramLineProfile({ schemaVersion: \"0.1.0\", profileId: \"facade-generic-program-line\", profileVersion: \"1.0.0\",\n scientificStatus: \"approximation\", policyKind: \"generic-program-line\", interpolation: \"log2-aperture-shutter\", evidence: FACADE_EVIDENCE,\n limitations: [\"Generic educational program line authored for the capture facade; not any manufacturer's program.\"],\n nodes: [\n { nodeId: \"minus-6\", opticalExposureStopsFromReference: -6, aperture: 16, shutterSeconds: 1 / 2000 },\n { nodeId: \"minus-2\", opticalExposureStopsFromReference: -2, aperture: 16, shutterSeconds: 1 / 125 },\n { nodeId: \"zero\", opticalExposureStopsFromReference: 0, aperture: 8, shutterSeconds: 1 / 125 },\n { nodeId: \"plus-2\", opticalExposureStopsFromReference: 2, aperture: 4, shutterSeconds: 1 / 125 },\n { nodeId: \"plus-9\", opticalExposureStopsFromReference: 9, aperture: 4, shutterSeconds: 128 / 125 }\n ] });\n}\n\n/** PNG colour signalling: the sRGB chunk for sRGB, ITU-T H.273 code points through cICP otherwise. */\nfunction pngColourEncoding(encoding: SimulateCaptureColorEncoding): PngColourEncoding {\n if (encoding === \"srgb\") return { kind: \"srgb\", renderingIntent: \"perceptual\" };\n if (encoding === \"display-p3\") return { kind: \"cicp\", primaries: \"display-p3\", transfer: \"srgb\", fullRange: true };\n return { kind: \"cicp\", primaries: \"bt2020\", transfer: \"bt709\", fullRange: true };\n}\n/**\n * Develops the packed RAW to unclipped linear sRGB/D65, using the exact operator inside\n * `createNativeRawDevelopmentTask`. Validation, demosaic kernels, border handling, per-site white-level\n * clipping, white balance, highlight mode and the camera→XYZ→linear-sRGB matrices are all the same. It\n * stops before tone mapping, gamut clipping and quantization. It reads the RAW without taking ownership.\n */\nasync function developLinearSrgb(input: NativeRawDevelopmentInput, afterRow: (completed: number, total: number) => Promise<void>,\n ahd?: { yieldControl: () => Promise<void>; checkAbort: () => void; onDemosaicMs?: (milliseconds: number) => void }): Promise<{ rgb: Float64Array; highlight: RawHighlightDiagnostics }> {\n const v = prepareNativeRawDevelopment(input), plan = v.plan, raw = input.raw, layout = plan.frame.colorSamplingProfile.layout;\n if (layout.kind !== \"periodic-mosaic\") fail(\"Development requires a periodic CFA.\");\n const native = plan.exposure.geometry.nativeRaster, g = plan.exposure.resolvedGeometry, active = g.activeCapture.nativeRect;\n checkNativeRawIntegrity(raw, native.pixelWidth, layout.repeatWidthSites, layout.repeatHeightSites, 0, native.pixelHeight);\n const developer = createRawPixelDeveloper({ nativeWidth: native.pixelWidth, repeatWidth: layout.repeatWidthSites, repeatHeight: layout.repeatHeightSites,\n codes: raw.codes, blackLevels: raw.blackLevels, saturationFlags: raw.saturationFlags, whiteByPhase: raw.effectiveSaturationCodes }, v.phases, v.development, v.mirror);\n const width = v.raster.pixelWidth, height = v.raster.pixelHeight, rgb = new Float64Array(width * height * 3), row = new Float64Array(width * 3);\n const at = (x: number, y: number): { x: number; y: number } => {\n const q = transformOrientedRasterPointToNative({ point: { x: v.crop.x + x + 0.5, y: v.crop.y + y + 0.5 }, nativeRaster: g.activeCapture.raster, orientation: plan.exposure.geometry.orientation });\n return { x: Math.floor(q.x) + active.x, y: Math.floor(q.y) + active.y };\n };\n if (ahd) return developAhd(v, raw, layout.repeatWidthSites, layout.repeatHeightSites, width, height, at, afterRow, ahd);\n for (let y = 0; y < height; y++) {\n const first = at(0, y), second = width > 1 ? at(1, y) : first;\n developer.developRun(first.x, first.y, second.x - first.x, second.y - first.y, width, row);\n rgb.set(row, y * width * 3);\n await afterRow(y + 1, height);\n }\n const c = developer.counts;\n return { rgb, highlight: { mode: v.highlightMode, saturatedPixelCount: c.saturatedPixelCount, whiteBalanceClippedSampleCount: c.whiteBalanceClippedSampleCount,\n reconstructedPixelCount: c.reconstructedPixelCount } };\n}\n/**\n * AHD development (2.1): the same site normalization as the native development kernel (flagged or white-level sites\n * are 1, others (code − black)/(white − black)) on the whole native raster, demosaiced by `createAhdDemosaicTask`\n * (mirrored plane edges), then the native development's own colour operator (`developInto`: WB, highlight mode,\n * camera → XYZ → linear sRGB) per output pixel. The AHD homogeneity metric sees white-balanced colour: its\n * camera → XYZ matrix is the profile's matrix times the WB gains (the output values are not transformed by it).\n * The mosaic is stored in float32, as the AHD task requires.\n */\nasync function developAhd(v: ReturnType<typeof prepareNativeRawDevelopment>, raw: NativeRawOutput, repeatWidth: number, repeatHeight: number, width: number, height: number,\n at: (x: number, y: number) => { x: number; y: number }, afterRow: (completed: number, total: number) => Promise<void>,\n host: { yieldControl: () => Promise<void>; checkAbort: () => void; onDemosaicMs?: (milliseconds: number) => void }): Promise<{ rgb: Float64Array; highlight: RawHighlightDiagnostics }> {\n const native = v.plan.exposure.geometry.nativeRaster, W = native.pixelWidth, H = native.pixelHeight;\n const source: RawDevelopmentSource = { nativeWidth: W, repeatWidth, repeatHeight, codes: raw.codes, blackLevels: raw.blackLevels,\n saturationFlags: raw.saturationFlags, whiteByPhase: raw.effectiveSaturationCodes };\n const samples = new Float32Array(W * H), saturated = new Uint8Array(W * H);\n for (let y = 0; y < H; y++) for (let x = 0; x < W; x++) {\n samples[y * W + x] = normalizedRawSite(source, x, y);\n if (rawSiteSaturated(source, x, y)) saturated[y * W + x] = 1;\n }\n const intent = v.plan.exposure.whiteBalanceIntent, gains = intent ? [intent.channelGains.red, intent.channelGains.green, intent.channelGains.blue] : [1, 1, 1];\n const m = v.color.normalizedCameraChannelsToXyz;\n const cameraToXyz = [0, 1, 2].map((r) => [0, 1, 2].map((c) => m[r]![c]! * gains[c]!)) as unknown as ColorMatrix3x3;\n // A caller-raised pixel limit already bounds the raster, so its working memory is not capped again at the 1 GiB default.\n const task = createAhdDemosaicTask({ plane: { width: W, height: H, captureModeId: v.plan.frame.modeId, colorSamplingProfile: v.plan.frame.colorSamplingProfile, samples },\n channelRoles: { red: \"red\", green: \"green\", blue: \"blue\" }, cameraToXyz, ...(v.plan.maximumPixels === undefined ? {} : { maximumWorkingBytes: Number.MAX_SAFE_INTEGER }) }, { yieldControl: async () => { await host.yieldControl(); host.checkAbort(); } });\n const demosaicStarted = clockMs();\n await task.run();\n host.onDemosaicMs?.(clockMs() - demosaicStarted);\n const demosaiced = task.takeOutput().data, rgb = new Float64Array(width * height * 3);\n const counts = { saturatedPixelCount: 0, whiteBalanceClippedSampleCount: 0, reconstructedPixelCount: 0 };\n // #420: a pixel is clipped when a saturated site lies within AHD_VALUE_REACH of it, clipped to the raster. The sites within\n // that reach of each column are found once per row (`near`, a horizontal dilation of `saturated`), so a pixel reads one\n // column of 2·reach + 1 rows instead of the whole square; with no saturated site at all no pixel is clipped.\n let anySaturated = false;\n for (let k = 0; k < saturated.length && !anySaturated; k++) anySaturated = saturated[k] !== 0;\n const near = anySaturated ? new Uint8Array(W * H) : undefined;\n if (near) for (let y = 0; y < H; y++) {\n const row = y * W;\n for (let x = 0; x < W; x++) if (saturated[row + x] !== 0) near.fill(1, row + Math.max(0, x - AHD_VALUE_REACH), row + Math.min(W, x + AHD_VALUE_REACH + 1));\n }\n for (let y = 0; y < height; y++) {\n // The oriented-to-native map is affine in x with whole-site steps (as the bilinear path's developRun uses): two points give the row.\n const first = at(0, y), second = width > 1 ? at(1, y) : first, stepX = second.x - first.x, stepY = second.y - first.y;\n for (let x = 0, px = first.x, py = first.y; x < width; x++, px += stepX, py += stepY) {\n const i = py * W + px;\n let clipped = false;\n if (near) for (let sy = Math.max(0, py - AHD_VALUE_REACH), last = Math.min(H - 1, py + AHD_VALUE_REACH); sy <= last; sy++) {\n if (near[sy * W + px] !== 0) { clipped = true; break; }\n }\n if (clipped) counts.saturatedPixelCount++;\n v.development.developInto(demosaiced[3 * i]!, demosaiced[3 * i + 1]!, demosaiced[3 * i + 2]!, rgb, (y * width + x) * 3, counts);\n }\n await afterRow(y + 1, height);\n }\n return { rgb, highlight: { mode: v.highlightMode, saturatedPixelCount: counts.saturatedPixelCount, whiteBalanceClippedSampleCount: counts.whiteBalanceClippedSampleCount,\n reconstructedPixelCount: counts.reconstructedPixelCount } };\n}\n/** Linear sRGB/D65 → CIE XYZ (inverse of the development's XYZ → sRGB matrix) → linear target RGB/D65. */\nfunction linearSrgbToTarget(target: \"srgb\" | \"display-p3\" | \"rec2020\"): readonly (readonly number[])[] {\n return multiplyMatrices(resolveRgbColorSpace(target).value.xyzToRgb, resolveCaptureColorModel().cameraRgbToXyz as unknown as ColorMatrix3x3);\n}\n/** Knee of the `perceptual` gamut mapping: chroma below 90 % of the gamut-boundary chroma (at constant L*, h) is untouched. */\nconst PERCEPTUAL_GAMUT_KNEE_FRACTION = 0.9;\n/**\n * SDR encoding from linear sRGB/D65:\n * 1. Convert to the target primaries with a matrix.\n * 2. Either clip each component to [0, 1], or, with `mapping`, compress chroma while keeping CIELAB hue\n * and lightness (`prepareRgbGamutMapping`).\n * 3. Apply the target transfer function and round to the nearest code (ties round up).\n */\nfunction encodeSdrFromLinear(rgb: Float64Array, encoding: \"srgb\" | \"display-p3\" | \"rec2020\", bitDepth: 8 | 16, mapping?: PreparedRgbGamutMapping):\n { samples: Uint8Array | Uint16Array; diagnostics: SdrRenderingResult[\"diagnostics\"]; adjustedPixelCount: number; lightnessClippedPixelCount: number } {\n const m = linearSrgbToTarget(encoding), toXyz = resolveCaptureColorModel().cameraRgbToXyz, maximum = 2 ** bitDepth - 1;\n const transfer = encoding === \"rec2020\" ? evaluateBt709Oetf : evaluateSrgbEncoding;\n const samples = bitDepth === 8 ? new Uint8Array(rgb.length) : new Uint16Array(rgb.length);\n let low = 0, high = 0, adjusted = 0, lightnessClipped = 0;\n for (let i = 0; i < rgb.length; i += 3) {\n const r = rgb[i]!, g = rgb[i + 1]!, b = rgb[i + 2]!;\n if (mapping) {\n const xyz = [0, 1, 2].map((k) => toXyz[k]![0]! * r + toXyz[k]![1]! * g + toXyz[k]![2]! * b) as unknown as ColorVector3;\n const mapped = mapping.map(xyz);\n if (mapped.adjusted) adjusted++;\n if (mapped.lightnessClipped) lightnessClipped++;\n for (let k = 0; k < 3; k++) samples[i + k] = Math.floor(transfer(mapped.linearRgb[k]!) * maximum + 0.5);\n continue;\n }\n for (let k = 0; k < 3; k++) {\n const row = m[k]!;\n let value = row[0]! * r + row[1]! * g + row[2]! * b;\n if (value < 0) { value = 0; low++; } else if (value > 1) { value = 1; high++; }\n samples[i + k] = Math.floor(transfer(value) * maximum + 0.5);\n }\n }\n return { samples, adjustedPixelCount: adjusted, lightnessClippedPixelCount: lightnessClipped, diagnostics: { renderingNegativeSampleCount: low,\n renderingAboveReferenceSampleCount: high, toneChangedSampleCount: 0, gamutClippedLowSampleCount: low, gamutClippedHighSampleCount: high, captureSaturation: \"consumed-in-raw-development\" } };\n}\n\n/**\n * Simulates one still capture of a planar scene and returns the developed image, the packed RAW, the full\n * underlying request/plan, provenance and every assumption made. See docs/QUICK_START.md.\n */\nexport async function simulateCapture(options: SimulateCaptureOptions): Promise<SimulateCaptureResult> {\n return await runCapture(options, \"capture\") as SimulateCaptureResult;\n}\n\n/** One part of a whole-frame DNG (#391): a region render's packed RAW and where its native sites lie (`result.raw`, `result.region`). */\nexport interface SimulateCaptureDngPart {\n raw: Pick<NativeRawOutput, \"codes\" | \"blackLevels\" | \"digitalSaturationCodes\" | \"saturationFlags\" | \"effectiveSaturationCodes\">;\n region: { nativeRect: { x: number; y: number; width: number; height: number } };\n}\n\n/**\n * Writes the whole-frame DNG of `options` (`output.format: \"dng\"`, no `output.region`) from the packed RAW of region renders of\n * the same request (#391), so the RAW can render in parallel. A region render's native sites are the same sites as the whole\n * render's (each site's seeds come from its index in the whole raster), so the joined RAW is the whole render's RAW, and the\n * request is resolved and written exactly as `simulateCapture` writes its DNG: the bytes are the same. The parts must cover\n * every native site of the frame; where they overlap (each region carries the demosaic margin) their sites must agree. Region\n * renders of the request with any format serve (a region's own `output.format` does not change its RAW). A region cannot take\n * `output.whiteBalance: \"auto\"` or `output.dng`: render the parts with a fixed white balance (the RAW codes do not depend on the\n * white-balance intent) and pass the DNG's own options here, where auto white balance is measured over the joined frame.\n * @returns The DNG (its `bytes` are those of `SimulateCaptureResult.image.dng` for the same options), with its stored levels and identifiers.\n */\nexport async function serializeSimulatedCaptureDngFromParts(options: SimulateCaptureOptions, parts: readonly SimulateCaptureDngPart[]): Promise<NativeRawDng> {\n return await runCapture(options, \"dng-from-parts\", parts) as NativeRawDng;\n}\n\n/** The whole frame's packed RAW from region parts (see `serializeSimulatedCaptureDngFromParts`). */\nfunction joinNativeRawParts(value: unknown, plan: NativeRawOutput[\"plan\"], width: number, height: number): NativeRawOutput {\n if (!Array.isArray(value) || value.length === 0) throw new InvalidConfigurationError(\"serializeSimulatedCaptureDngFromParts needs at least one part.\");\n const parts = value as readonly SimulateCaptureDngPart[], count = width * height;\n const codes = new Uint16Array(count), blackLevels = new Uint16Array(count), digitalSaturationCodes = new Uint16Array(count), saturationFlags = new Uint8Array(count);\n const covered = new Uint8Array(count), white = new Uint16Array(4);\n const bad = (k: number, what: string): never => { throw new InvalidConfigurationError(\"DNG part \" + k + \": \" + what); };\n parts.forEach((part, k) => {\n const rect = part?.region?.nativeRect, raw = part?.raw;\n if (!rect || !raw) bad(k, \"needs raw and region.nativeRect (a region render's result).\");\n const { x, y, width: w, height: h } = rect!;\n if (![x, y, w, h].every(Number.isSafeInteger) || x < 0 || y < 0 || w < 1 || h < 1 || x + w > width || y + h > height) bad(k, \"its nativeRect is not inside the frame's native raster.\");\n const n = w * h;\n if (!(raw!.codes instanceof Uint16Array) || raw!.codes.length !== n || !(raw!.blackLevels instanceof Uint16Array) || raw!.blackLevels.length !== n ||\n !(raw!.digitalSaturationCodes instanceof Uint16Array) || raw!.digitalSaturationCodes.length !== n || !(raw!.saturationFlags instanceof Uint8Array) || raw!.saturationFlags.length !== n)\n bad(k, \"its RAW arrays do not match its nativeRect.\");\n const phases = raw!.effectiveSaturationCodes;\n if (!(phases instanceof Uint16Array) || phases.length !== 4) bad(k, \"needs four per-phase white levels.\");\n // Per-phase white levels are in the whole raster's CFA phases (0 for a phase the part has no site of); all parts agree.\n for (let phase = 0; phase < 4; phase++) {\n const code = phases[phase]!;\n if (code === 0) continue;\n if (white[phase] === 0) white[phase] = code; else if (white[phase] !== code) bad(k, \"its white level differs from another part's: not the same request.\");\n }\n for (let row = 0; row < h; row++) for (let column = 0; column < w; column++) {\n const from = row * w + column, to = (y + row) * width + x + column;\n if (covered[to]) {\n if (codes[to] !== raw!.codes[from] || blackLevels[to] !== raw!.blackLevels[from] || digitalSaturationCodes[to] !== raw!.digitalSaturationCodes[from] ||\n saturationFlags[to] !== raw!.saturationFlags[from]) bad(k, \"a site differs from another part's at the same place: not the same request.\");\n continue;\n }\n covered[to] = 1; codes[to] = raw!.codes[from]!; blackLevels[to] = raw!.blackLevels[from]!;\n digitalSaturationCodes[to] = raw!.digitalSaturationCodes[from]!; saturationFlags[to] = raw!.saturationFlags[from]!;\n }\n });\n if (covered.includes(0)) throw new InvalidConfigurationError(\"The DNG parts do not cover every native site of the frame.\");\n if (white.includes(0)) throw new InvalidConfigurationError(\"The DNG parts lack a white level for a CFA phase.\");\n return { plan, codes, blackLevels, digitalSaturationCodes, saturationFlags, effectiveSaturationCodes: white };\n}\n\n/**\n * The ideal reference of a capture request (2.3): the same scene, framing, chart size, output size, region and pixel\n * grid as `simulateCapture(options)` would use, rendered with no camera effects (no lens blur, diffraction, defocus,\n * distortion, vignetting, anti-aliasing filter, mosaic or demosaic, noise, dark signal or motion), at the capture's\n * own exposure and developed with its white balance, colour matrices, tone curve and encoding (the\n * `reference.exposure` assumption). Deterministic and cheap: no RAW is simulated. Formats srgb-8, srgb-16 and png.\n * The result is labelled `kind: \"ideal-reference\"`; it is not a capture.\n * @see docs/QUICK_START.md, \"Ideal reference\".\n */\nexport async function simulateIdealReference(options: SimulateCaptureOptions): Promise<IdealReferenceResult> {\n return await runCapture(options, \"ideal-reference\") as IdealReferenceResult;\n}\n\n/** Result of {@link simulateIdealReference}: an ideal reference image, not a capture (no RAW, plan or request). */\nexport interface IdealReferenceResult {\n kind: \"ideal-reference\";\n /** Human-readable label for a user interface. */\n label: string;\n facadeVersion: typeof SIMULATE_CAPTURE_FACADE_VERSION;\n engineApiVersion: string;\n image: { width: number; height: number; format: SimulateCaptureOutputFormat; samples: Uint8Array | Uint16Array; png?: Uint8Array; colorEncoding?: SimulateCaptureColorEncoding };\n /** The resolved exposure of the capture this reference matches. */\n exposure: { mode: SimulateCaptureExposureMode; settings: { fNumber: number; shutterSeconds: number; iso: number }; ev100: number;\n /** #516: as in the capture result. */\n isoControl: \"manual\" | \"automatic\"; autoIso?: SimulateCaptureAutoIsoReport };\n scene: SimulateCaptureResult[\"scene\"];\n region?: { x: number; y: number; width: number; height: number; frameWidth: number; frameHeight: number };\n diagnostics: { sampleCount: number; timingsMs: { reference: number; total: number } };\n provenance: { scientificStatus: \"approximation\"; cameraPresetId: string; cameraPresetVersion: string; evidence: readonly EvidenceProvenance[];\n composedContracts: readonly string[]; limitations: readonly string[] };\n /** The capture request's assumptions, then `reference.kind`, `reference.excludes`, `reference.exposure` and `reference.sampling`. */\n assumptions: readonly SimulateCaptureAssumption[];\n}\n\n/** Default stratified samples per axis of a display view (`view.samplesPerAxis`): 16 × 16 sampled real pixels per display pixel with detail, 4 × 4 where it is uniform. */\nexport const SIMULATE_DISPLAY_VIEW_DEFAULT_SAMPLES_PER_AXIS = 16;\n/** The display size and sampling of {@link simulateDisplayView}. */\nexport interface SimulateDisplayViewOptions {\n /** Display pixels, 1 to the capture's output width and height. */\n width: number;\n height: number;\n /** Stratified Monte Carlo samples per axis for each display pixel's expected value (1–32, default 8: 64 real pixels). */\n samplesPerAxis?: number;\n /** \"srgb-8\" (default) or \"srgb-16\". */\n format?: \"srgb-8\" | \"srgb-16\";\n /** Render only this rectangle of the display view, in display pixels; byte-identical to the same pixels of the whole view. */\n region?: { x: number; y: number; width: number; height: number };\n}\n/** Result of {@link simulateDisplayView}: the full-resolution capture resized for display, estimated; not a capture. */\nexport interface DisplayViewResult {\n kind: \"display-view\";\n /** Human-readable label for a user interface. */\n label: string;\n facadeVersion: typeof SIMULATE_CAPTURE_FACADE_VERSION;\n engineApiVersion: string;\n /** The display view (or its region): interleaved sRGB samples, row by row from the top-left. */\n image: { width: number; height: number; format: \"srgb-8\" | \"srgb-16\"; samples: Uint8Array | Uint16Array };\n /**\n * The view: display size, the capture frame it shows (output pixels), real pixels per display pixel along each axis,\n * the samples per axis and, with `view.region`, the rendered rectangle.\n */\n view: { width: number; height: number; frameWidth: number; frameHeight: number; scaleX: number; scaleY: number; samplesPerAxis: number;\n region?: { x: number; y: number; width: number; height: number } };\n /** The resolved exposure of the capture this view shows; `standardExposureDeviationStops` as in {@link SimulateCaptureResult}. */\n exposure: { mode: SimulateCaptureExposureMode; settings: { fNumber: number; shutterSeconds: number; iso: number }; ev100: number; standardExposureDeviationStops: number | null;\n /** #516: as in the capture result. */\n isoControl: \"manual\" | \"automatic\"; autoIso?: SimulateCaptureAutoIsoReport };\n scene: SimulateCaptureResult[\"scene\"];\n /**\n * Work done: real pixels sampled, real-site expectations evaluated, scene queries, display pixels sampled in full (detail) or with\n * a quarter of the samples per axis (uniform), display pixels whose value includes the AHD low-signal correction, and wall-clock\n * milliseconds (diagnostic only; never affects the samples).\n */\n diagnostics: { sampleCount: number; siteEvaluations: number; sceneLookups: number; detailPixelCount: number; uniformPixelCount: number; ahdCorrectedPixelCount: number;\n timingsMs: { view: number; total: number };\n /** #395: exact or fast, as requested and as run; 2.11 (#481): plus `execution`, where the render ran (see {@link DisplayViewFastReport}). */\n fast: DisplayViewFastReport };\n provenance: { scientificStatus: \"approximation\"; cameraPresetId: string; cameraPresetVersion: string; evidence: readonly EvidenceProvenance[];\n composedContracts: readonly string[]; limitations: readonly string[] };\n /** The capture request's assumptions, then `view.definition`, `view.estimation`, `view.noise`, `view.demosaic` and `view.source`. */\n assumptions: readonly SimulateCaptureAssumption[];\n}\n\n/** Internal: the resolved request state that the display view's renderer (simulate-display-view.ts) reads. */\nexport interface DisplayViewRunContext {\n ahd: boolean;\n fastReport: SimulateCaptureFastReport;\n antiAliasing: ParsedAntiAliasing | undefined;\n aspect: number;\n assume: (id: string, kind: SimulateCaptureAssumption[\"kind\"], value: unknown, explanation: string) => void;\n assumptions: SimulateCaptureAssumption[];\n axisChannelResponse: (caller: string) => { electronsPerRadiance: Record<Channel, Map<number, number>>; wavelengths: number[]; relativePerElectron: Record<Channel, number>; };\n boxSamples: number;\n buildProvider: (sceneIlluminant: ResolvedCaptureIlluminant, scale: number) => PlanarSceneRadianceProvider;\n callerScene: ResolvedCallerScene | undefined;\n chart: ResolvedChartScene | undefined;\n /** #491: the declared material-layers scene behind `callerScene`, when the request gave one. */\n materialLayers: ResolvedChartMaterialLayers | undefined;\n chartReport: { widthM: number; heightM: number; surroundReflectance: number; frameWidthFraction: number; frameHeightFraction: number; magnification: number; imageWidthMm: number; imageHeightMm: number; imageWidthPixels: number; imageHeightPixels: number; } | undefined;\n chartSize: { widthM: number; heightM: number; surroundReflectance: number; defaulted: (\"heightM\" | \"surroundReflectance\")[]; } | undefined;\n diffraction: DiffractionLimitedPsfProfile | undefined;\n /** `lens.defocus` (#492): the resolved geometric disc out of focus; undefined in focus or without the option. */\n defocus: ResolvedDefocusDisc | undefined;\n diffractionPsf: { kind: \"sampled-local\"; configuration: Pick<CalculateSensorPsfIrradianceQuadratureInput, \"psf\" | \"psfWavelengthBasis\" | \"spatialModel\">; } | undefined;\n fNumber: number;\n focalLengthMm: number;\n focusDistanceM: number;\n height: number;\n highlightMode: RawHighlightMode;\n illuminanceLux: number;\n illuminant: ResolvedCaptureIlluminant;\n illuminantOption: CaptureIlluminant;\n imagingArea: { widthMm: number; heightMm: number; };\n intentOf: (state: ResolvedWhiteBalanceState | null) => CaptureWhiteBalanceIntent | null;\n metresPerFrameUnit: number;\n noiseSeed: number;\n outputOptions: Record<string, unknown>;\n parsedView: ParsedDisplayView | undefined;\n pitch: number;\n preset: GenericEquipmentTierPreset;\n provider: PlanarSceneRadianceProvider;\n regimeByChannel: Record<\"red\" | \"green\" | \"blue\", { readoutProfile: ReadoutProfile; regimeId: string; }>;\n resolvedIso: number;\n /** #516: how the ISO was chosen, reported in the view's `exposure`. */\n isoReport: { isoControl: \"manual\" | \"automatic\"; autoIso?: SimulateCaptureAutoIsoReport };\n /** #515: the capture's `exposure.standardExposureDeviationStops`. */\n standardExposureDeviationStops: number | null;\n sceneOption: unknown;\n scenePreset: \"composite\" | \"uniform\" | \"patches\" | \"slanted-edge\" | \"siemens-star\" | \"step-wedge\" | \"grey-ramp\" | \"checkerboard\" | \"point-grid\" | \"dead-leaves\" | \"bar-groups\" | \"hyperbolic-wedge\" | \"zone-plate\" | \"slanted-squares\" | \"line-grid\" | \"fiducial\" | \"reflectance-function\" | \"radiance-function\" | \"material-function\";\n shutterSeconds: number;\n started: number;\n subjectDistanceM: number;\n toneCurve: SdrToneCurve;\n whiteBalanceOption: SimulateCaptureWhiteBalance;\n whiteBalanceState: ResolvedWhiteBalanceState | null;\n width: number;\n checkAbort: () => void;\n margin: number;\n mode: SimulateCaptureExposureMode;\n nativeHeight: number;\n nativeWidth: number;\n sourceSha256: string;\n yieldControl: () => Promise<void>;\n /** The Kelvin white balance request, which the view resolves with the portable functions. */\n kelvinWhiteBalanceInput: Parameters<typeof resolveColorTemperatureWhiteBalance>[0] | undefined;\n}\nexport interface ParsedDisplayView { width: number; height: number; samplesPerAxis: number; bitDepth: 8 | 16; format: \"srgb-8\" | \"srgb-16\"; region?: { x: number; y: number; width: number; height: number } }\n/** Internal: validates a display view against the capture's output size and fills its defaults. */\nexport function parseDisplayViewOption(value: unknown, frameWidth: number, frameHeight: number): ParsedDisplayView {\n if (value === undefined) fail(\"simulateDisplayView needs a view, for example { width: 384, height: 256 }.\");\n const v = allowKeys(value, \"view\", [\"width\", \"height\", \"samplesPerAxis\", \"format\", \"region\"]);\n const width = integerIn(v.width, \"view.width\", 1, frameWidth), height = integerIn(v.height, \"view.height\", 1, frameHeight);\n const samplesPerAxis = v.samplesPerAxis === undefined ? SIMULATE_DISPLAY_VIEW_DEFAULT_SAMPLES_PER_AXIS : integerIn(v.samplesPerAxis, \"view.samplesPerAxis\", 1, 32);\n const format = v.format === undefined ? \"srgb-8\" : v.format;\n if (format !== \"srgb-8\" && format !== \"srgb-16\") fail(\"view.format must be srgb-8 or srgb-16.\");\n let region: ParsedDisplayView[\"region\"];\n if (v.region !== undefined) {\n const r = allowKeys(v.region, \"view.region\", [\"x\", \"y\", \"width\", \"height\"]);\n const x = integerIn(r.x, \"view.region.x\", 0, width - 1), y = integerIn(r.y, \"view.region.y\", 0, height - 1);\n region = { x, y, width: integerIn(r.width, \"view.region.width\", 1, width - x), height: integerIn(r.height, \"view.region.height\", 1, height - y) };\n }\n return { width, height, samplesPerAxis, bitDepth: format === \"srgb-8\" ? 8 : 16, format: format as \"srgb-8\" | \"srgb-16\", ...(region ? { region } : {}) };\n}\n\n/**\n * `lens.defocus` (#492): resolves the geometric defocus disc at the resolved f-number on the site pitch and records it.\n * In focus (c = 0) no kernel exists and nothing else changes (undefined). The capture (step 2a) applies the disc as an\n * object-space convolution and the display view (step 2b) as a site kernel in its expected-signal tables, and both get it\n * back; the ideal reference, which has no camera effects, only records it.\n */\nfunction resolveDefocusOption(input: { run: \"capture\" | \"ideal-reference\" | \"display-view\" | \"dng-from-parts\"; assume: DisplayViewRunContext[\"assume\"];\n focalLengthMm: number; fNumber: number; focusDistanceM: number; subjectDistanceM: number; pitch: number; diffraction: boolean }): ResolvedDefocusDisc | undefined {\n const { run, assume, focalLengthMm, fNumber, focusDistanceM, subjectDistanceM, pitch } = input;\n const disc = resolveDefocusDisc({ focalLengthMm, aperture: fNumber, focusDistanceM, subjectDistanceM, pitchMicrometers: pitch });\n const size = disc.diameterMicrometers + \" µm (\" + disc.diameterSites + \" sites of \" + pitch + \" µm)\";\n let radius: number;\n try { radius = requireDefocusDiscKernelRadius(disc.diameterSites); } catch (error) { fail(\"lens.defocus: the blur circle is \" + size + \". \" + (error as Error).message); }\n const value = { model: \"geometric-disc\", scientificStatus: \"approximation\", diameterMicrometers: disc.diameterMicrometers, diameterSites: disc.diameterSites,\n kernelRadiusSites: disc.diameterSites === 0 ? null : radius, fNumber, focusDistanceM, subjectDistanceM, samplePitchMicrometers: pitch,\n defocusCircleModel: { id: \"thin-lens-defocus-circle\", version: \"1.1.0\" } };\n const model = \"Geometric defocus of the flat scene plane (an approximation): the thin-lens blur circle of an ideal uniform circular pupil, \" +\n \"c = f²·|s − d| / (N·d·(s − f)) (calculateDefocusCircle 1.1.0), as a uniform disc sampled on the site lattice (exact disc area in each site's cell). \" +\n \"No diffraction of the defocused wave, aberrations or pupil vignetting. \";\n if (disc.diameterSites === 0) {\n assume(\"lens.defocus\", \"model\", value, model + \"In focus (lens.focusDistanceM equals subjectDistanceM): the disc has zero diameter, so no defocus kernel is applied.\");\n return undefined;\n }\n if (run === \"ideal-reference\") {\n assume(\"lens.defocus\", \"model\", value, model + \"Resolved but not applied: the ideal reference has no camera effects.\");\n return undefined;\n }\n // The display view (#492, step 2b): a site kernel in its expected-signal tables (simulate-display-view.ts).\n if (run === \"display-view\") {\n assume(\"lens.defocus\", \"model\", { ...value, execution: \"expected-signal-site-kernel\", combinedWithDiffraction: input.diffraction }, model +\n \"Applied in the display view's expected-signal tables as a site kernel on the lattice\" + (input.diffraction ? \" (with lens.diffraction, each spectral node's \" +\n \"diffraction kernel convolved with the disc, a further approximation)\" : \"\") + \"; see the view.defocus assumption.\");\n return disc;\n }\n // The capture (#492, step 2a): an object-space convolution of the scene radiance on the site lattice.\n assume(\"lens.defocus\", \"model\", { ...value, execution: \"object-space-convolution\", combinedWithDiffraction: input.diffraction }, model +\n \"Applied as an object-space convolution: the scene radiance on the site lattice is convolved with the disc, the same kernel at every spectral node, \" +\n \"and each site query is answered with the result (for a flat scene and a still, distortion-free rectilinear camera every disc point a site sees is the scene point of another site). \" +\n (input.diffraction ? \"With lens.diffraction, each spectral node's diffraction kernel is convolved with the disc and applied as one kernel. That is a further approximation: \" +\n \"the defocused wave PSF of a circular pupil is not exactly the in-focus Airy pattern convolved with the geometric disc. \" : \"\") +\n \"The disc kernel is a sampling of the disc on the site lattice; lens.pupilSampling (ray-sampled, no diffraction) is the independent reference.\");\n return disc;\n}\n\n/** Internal: passed as the view of a \"display-view\" run to resolve the request without a view (`prepareDisplayView`, #387). */\nexport const DISPLAY_VIEW_WITHOUT_VIEW: unique symbol = Symbol(\"display view without view\");\n/**\n * Internal: the request path shared by {@link simulateCapture}, {@link simulateIdealReference} and the display view, whose renderer is\n * passed in; for a display view the renderer's value is returned (a result, or a prepared view with DISPLAY_VIEW_WITHOUT_VIEW).\n */\nexport async function runCapture(options: SimulateCaptureOptions, run: \"capture\" | \"ideal-reference\" | \"display-view\" | \"dng-from-parts\", viewOption?: unknown,\n renderView?: (context: DisplayViewRunContext) => Promise<unknown>):\n Promise<unknown> {\n const started = Date.now(), idealReference = run === \"ideal-reference\", displayView = run === \"display-view\";\n requireInputObject(options, \"simulateCapture options\");\n const top = allowKeys(options, \"simulateCapture options\", [\"camera\", \"lens\", \"exposure\", \"scene\", \"subjectDistanceM\", \"chartSize\", \"illuminant\",\n \"illuminanceLux\", \"output\", \"sensor\", \"motion\", \"fast\", \"signal\", \"onProgress\"]);\n const signal = top.signal as AbortSignal | undefined, onProgress = top.onProgress as SimulateCaptureOptions[\"onProgress\"];\n if (signal !== undefined && (typeof signal !== \"object\" || signal === null || typeof (signal as AbortSignal).aborted !== \"boolean\")) fail(\"signal must be an AbortSignal.\");\n if (onProgress !== undefined && typeof onProgress !== \"function\") fail(\"onProgress must be a function.\");\n const assumptions: SimulateCaptureAssumption[] = [];\n const assume = (id: string, kind: SimulateCaptureAssumption[\"kind\"], value: unknown, explanation: string): void => { assumptions.push({ id, kind, value, explanation }); };\n function pick<T>(record: Record<string, unknown>, key: string, path: string, fallback: T, explanation: string): T {\n if (record[key] !== undefined) return record[key] as T;\n assume(path, \"default\", fallback, explanation);\n return fallback;\n }\n const checkAbort = (): void => { if (signal?.aborted) fail(\"simulateCapture aborted.\"); };\n checkAbort();\n\n // Camera\n const cameraOption = pick<GenericEquipmentTier | GenericEquipmentTierPreset>(top, \"camera\", \"camera\", DEFAULTS.camera,\n \"Generic Photivra tier preset 2.0.0 (synthetic educational values, not a real camera).\");\n let preset: GenericEquipmentTierPreset;\n if (typeof cameraOption === \"string\") preset = GENERIC_TIER_ASSETS.find((p) => p.tier === cameraOption) ?? fail(\"Unknown camera tier.\");\n else preset = parseCallerCameraPreset(cameraOption);\n const body = preset.body, lens = preset.lens;\n\n // Lens\n const lensOptions = allowKeys(top.lens, \"lens\", [\"focalLengthMm\", \"fNumber\", \"focusDistanceM\", \"pupilSampling\", \"projection\", \"distortion\", \"vignetting\", \"psf\", \"diffraction\", \"prime\", \"defocus\"]);\n // Generic prime (2.3): resolved on the simulated frame's size, which the output and sensor sections validate again below.\n let prime: GenericPrimeLens | undefined;\n if (lensOptions.prime !== undefined) {\n if (lensOptions.focalLengthMm !== undefined) fail(\"lens.prime and lens.focalLengthMm cannot both be given: the prime sets the focal length.\");\n const o = (typeof top.output === \"object\" && top.output !== null ? top.output : {}) as Record<string, unknown>, sn = (typeof top.sensor === \"object\" && top.sensor !== null ? top.sensor : {}) as Record<string, unknown>;\n const frameW = positive(o.width ?? DEFAULTS.width, \"output.width\"), frameH = positive(o.height ?? DEFAULTS.height, \"output.height\"), framePitch = positive(sn.pixelPitchMicrometers ?? DEFAULTS.pixelPitchMicrometers, \"sensor.pixelPitchMicrometers\");\n if (typeof lensOptions.prime !== \"number\") fail(\"lens.prime must be a generic prime's full-frame-equivalent focal length in mm.\");\n prime = resolveGenericPrimeLens({ equivalentFocalLengthMm: lensOptions.prime as number, activeImagingArea: { widthMm: frameW * framePitch / 1000, heightMm: frameH * framePitch / 1000 } });\n assume(\"lens.prime\", \"model\", { lensId: prime.lensId, equivalentFocalLengthMm: prime.equivalentFocalLengthMm, focalLengthMm: prime.focalLengthMm, cropFactor35Mm: prime.cropFactor35Mm,\n widestFNumber: prime.widestFNumber, narrowestFNumber: prime.narrowestFNumber, minimumFocusDistanceM: prime.minimumFocusDistanceM },\n \"Generic prime (not a real product): focal length = equivalent ÷ the simulated frame's diagonal crop factor, f/\" + prime.widestFNumber + \"–f/\" + prime.narrowestFNumber +\n \", minimum focus max(0.10 m, f·(1 + 1/0.15)) (thin-lens approximation). It replaces the tier lens's focal length and f-number range; the tier lens's transmission is kept.\");\n }\n const lensExposure = prime ? { ...lens.exposure, profileId: \"photivra-\" + prime.lensId + \":exposure\",\n focalLengthMmRange: { ...lens.exposure.focalLengthMmRange, value: { minimum: prime.focalLengthMm, maximum: prime.focalLengthMm } },\n aperture: { ...lens.exposure.aperture, widestAvailableFNumber: { kind: \"constant\" as const, fNumber: { value: prime.widestFNumber, evidence: FACADE_EVIDENCE } },\n narrowestAvailableFNumber: { value: prime.narrowestFNumber, evidence: FACADE_EVIDENCE } } } as typeof lens.exposure : lens.exposure;\n const focalDefault = lensExposure.focalLengthMmRange.value.minimum;\n const focalLengthMm = prime ? prime.focalLengthMm :\n positive(pick(lensOptions, \"focalLengthMm\", \"lens.focalLengthMm\", focalDefault, \"The preset lens's focal length (the generic primes are 50 mm).\"), \"lens.focalLengthMm\");\n const capabilities = resolveGenericEquipmentExposureCapabilities({ bodyProfile: body.exposure, lensProfile: lensExposure, selectedFocalLengthMm: focalLengthMm });\n const subjectDistanceM = positive(pick(top, \"subjectDistanceM\", \"subjectDistanceM\", DEFAULTS.subjectDistanceM, \"Scene plane 5 m in front of the camera (the generic tiers' reference focus distance).\"), \"subjectDistanceM\");\n if (subjectDistanceM * 1000 <= focalLengthMm * 2) fail(\"subjectDistanceM must exceed twice the focal length.\");\n const focusDistanceM = positive(pick(lensOptions, \"focusDistanceM\", \"lens.focusDistanceM\", subjectDistanceM, \"Focused on the scene plane.\"), \"lens.focusDistanceM\");\n if (focusDistanceM * 1000 <= focalLengthMm) fail(\"lens.focusDistanceM must exceed the focal length.\");\n if (prime && (subjectDistanceM < prime.minimumFocusDistanceM || focusDistanceM < prime.minimumFocusDistanceM))\n fail(\"The \" + prime.lensId + \" focuses no closer than \" + prime.minimumFocusDistanceM + \" m (max(0.10 m, f·(1 + 1/0.15))); subjectDistanceM and lens.focusDistanceM must be at least that.\");\n let pupil: { radialSamples: number; angularSamples: number } | undefined;\n if (lensOptions.pupilSampling === undefined) assume(\"lens.pupilSampling\", \"default\", null, lensOptions.defocus === undefined ?\n \"No pupil sampling: each scene query follows the central (chief) ray, so defocus and depth of field are not rendered. Enable lens.pupilSampling for an ideal circular pupil.\" :\n \"No pupil sampling: each scene query follows the central (chief) ray; defocus of the scene plane is the lens.defocus option's (see the lens.defocus assumption).\");\n else {\n const p = allowKeys(lensOptions.pupilSampling, \"lens.pupilSampling\", [\"radialSamples\", \"angularSamples\"]);\n // The environment pupil contract admits 4..64 azimuthal midpoints and at most 256 rays.\n pupil = { radialSamples: integerIn(p.radialSamples, \"lens.pupilSampling.radialSamples\", 1, 16), angularSamples: integerIn(p.angularSamples, \"lens.pupilSampling.angularSamples\", 4, 64) };\n if (pupil.radialSamples * pupil.angularSamples > 256) fail(\"lens.pupilSampling needs at most 256 rays (radialSamples × angularSamples).\");\n }\n // 2.0 optics hooks: only what the environment site contract accepts.\n const projection: LensProjectionModel | undefined = lensOptions.projection === undefined ? undefined : parseLensProjectionModel(lensOptions.projection);\n let distortion: SimulateCaptureLensDistortion | undefined;\n if (lensOptions.distortion !== undefined) {\n const d = allowKeys(lensOptions.distortion, \"lens.distortion\", [\"kind\", \"profile\"]);\n if (d.kind !== \"radial\" && d.kind !== \"brown-conrady\") fail(\"lens.distortion.kind must be radial or brown-conrady.\");\n distortion = d as unknown as SimulateCaptureLensDistortion;\n }\n const lensFieldMapping: EnvironmentLensFieldMapping | undefined = projection === undefined && distortion === undefined ? undefined :\n { projectionModel: projection ?? \"rectilinear\", distortion: distortion ?? { kind: \"none\" }, radiometricAreaCorrection: \"inverse-distortion-jacobian\" };\n if (lensFieldMapping) {\n if (pupil) fail(\"lens.projection and lens.distortion cannot be combined with lens.pupilSampling: ideal pupil rays use the rectilinear, distortion-free projection.\");\n try { prepareEnvironmentLensFieldMapping(lensFieldMapping); } catch (error) { fail(\"Invalid lens projection or distortion: \" + (error as Error).message); }\n }\n let vignetting: IlluminationVignettingProfile | undefined;\n if (lensOptions.vignetting !== undefined) { requireInputObject(lensOptions.vignetting, \"lens.vignetting\"); vignetting = lensOptions.vignetting as IlluminationVignettingProfile; }\n let lensPsf: NonNullable<NonNullable<SimulateCaptureOptions[\"lens\"]>[\"psf\"]> | undefined;\n if (lensOptions.psf !== undefined) {\n const p = allowKeys(lensOptions.psf, \"lens.psf\", [\"kind\", \"configuration\"]);\n if (p.kind !== \"sampled-local\") fail(\"lens.psf.kind must be sampled-local.\");\n requireInputObject(p.configuration, \"lens.psf.configuration\");\n if (pupil) fail(\"lens.psf cannot be combined with lens.pupilSampling: geometric defocus would be counted twice.\");\n lensPsf = p as unknown as typeof lensPsf;\n }\n // Diffraction (2.1): validated here, built once the f-number is resolved.\n let diffractionRadiusOption: number | null | undefined, diffractionFast: boolean | undefined;\n if (lensOptions.diffraction !== undefined) {\n const d = lensOptions.diffraction;\n if (d === \"circular-aperture\") diffractionRadiusOption = null;\n else {\n const record = allowKeys(d, \"lens.diffraction\", [\"kind\", \"aperture\", \"kernelRadiusSamples\", \"fast\"]);\n // #395: the record names the model by `kind`; `aperture` is its deprecated alias (until 3.0.0).\n if (record.kind !== undefined && record.aperture !== undefined) fail(\"lens.diffraction takes kind or its deprecated alias aperture, not both.\");\n const model = record.kind !== undefined ? record.kind : record.aperture;\n if (model !== \"circular-aperture\") fail(\"lens.diffraction must be \\\"circular-aperture\\\" or { kind: \\\"circular-aperture\\\", kernelRadiusSamples, fast }.\");\n diffractionRadiusOption = record.kernelRadiusSamples === undefined ? null : integerIn(record.kernelRadiusSamples, \"lens.diffraction.kernelRadiusSamples\", 0, 32);\n diffractionFast = fastOverride(record, \"lens.diffraction\");\n }\n if (lensPsf) fail(\"lens.diffraction cannot be combined with lens.psf: diffraction would be counted twice.\");\n if (pupil) fail(\"lens.diffraction cannot be combined with lens.pupilSampling: the environment contract does not mix a sampled PSF with pupil rays.\");\n }\n // Defocus (#492): validated here, resolved once the f-number is.\n let defocusModel: \"geometric-disc\" | undefined;\n if (lensOptions.defocus !== undefined) {\n const record = allowKeys(lensOptions.defocus, \"lens.defocus\", [\"model\"]);\n if (record.model !== \"geometric-disc\") fail(\"lens.defocus.model must be \\\"geometric-disc\\\".\");\n if (pupil) fail(\"lens.defocus cannot be combined with lens.pupilSampling: the pupil rays already render defocus, so it would be counted twice.\");\n if (lensPsf) fail(\"lens.defocus cannot be combined with lens.psf: a caller PSF declares its own defocus, so it could be counted twice.\");\n defocusModel = \"geometric-disc\";\n }\n\n // Motion (2.0): constant camera rotation and the shutter type.\n const motionOptions = allowKeys(top.motion, \"motion\", [\"angularVelocityRadPerSec\", \"shutter\", \"rollingShutterSkewSeconds\"]);\n const angular = { pitch: 0, yaw: 0, roll: 0 };\n if (motionOptions.angularVelocityRadPerSec !== undefined) {\n const a = allowKeys(motionOptions.angularVelocityRadPerSec, \"motion.angularVelocityRadPerSec\", [\"pitch\", \"yaw\", \"roll\"]);\n for (const axis of [\"pitch\", \"yaw\", \"roll\"] as const) if (a[axis] !== undefined) {\n const value = a[axis];\n if (typeof value !== \"number\" || !Number.isFinite(value) || Math.abs(value) > 100) fail(\"motion.angularVelocityRadPerSec.\" + axis + \" must be a finite number within ±100 rad/s.\");\n angular[axis] = value as number;\n }\n }\n const rotating = angular.pitch !== 0 || angular.yaw !== 0 || angular.roll !== 0;\n const shutterKind = motionOptions.shutter === undefined ? \"global\" : motionOptions.shutter;\n if (shutterKind !== \"global\" && shutterKind !== \"rolling\") fail(\"motion.shutter must be global or rolling.\");\n if (motionOptions.rollingShutterSkewSeconds !== undefined && shutterKind !== \"rolling\") fail(\"motion.rollingShutterSkewSeconds needs motion.shutter \\\"rolling\\\".\");\n const rollingSkewOption = motionOptions.rollingShutterSkewSeconds === undefined ? undefined : positive(motionOptions.rollingShutterSkewSeconds, \"motion.rollingShutterSkewSeconds\");\n // Diffraction runs as an object-space convolution when every PSF tap's source is another site centre seen\n // through one linear map (still camera, rectilinear, no distortion or field throughput); otherwise per tap.\n const diffractionObjectSpace = diffractionRadiusOption !== undefined && !rotating && !lensFieldMapping && !vignetting;\n\n // Output and sensor\n const outputOptions = allowKeys(top.output, \"output\", [\"width\", \"height\", \"format\", \"toneCurve\", \"toneCurveParameters\", \"highlightMode\", \"whiteBalance\", \"jpegQuantizationStep\",\n \"colorEncoding\", \"bitDepth\", \"gamutMapping\", \"demosaic\", \"borderHandling\", \"dng\", \"maximumPixels\", \"region\", \"metadata\"]);\n // Opt-in large images: a caller-raised native pixel limit. Without it the 4094-pixel sides are unchanged.\n const raisedPixels = outputOptions.maximumPixels === undefined ? undefined : integerIn(outputOptions.maximumPixels, \"output.maximumPixels\", 1, NATIVE_RAW_LIMITS.ceilingPixels);\n const maximumSide = raisedPixels === undefined ? 4094 : NATIVE_RAW_LIMITS.maximumDimension;\n const width = integerIn(pick(outputOptions, \"width\", \"output.width\", DEFAULTS.width, \"64 × 64 output pixels.\"), \"output.width\", 1, maximumSide);\n const height = integerIn(pick(outputOptions, \"height\", \"output.height\", DEFAULTS.height, \"64 × 64 output pixels.\"), \"output.height\", 1, maximumSide);\n const format = pick<SimulateCaptureOutputFormat>(outputOptions, \"format\", \"output.format\", DEFAULTS.format, \"8-bit sRGB samples.\");\n if (![\"srgb-8\", \"srgb-16\", \"jpeg\", \"png\", \"dng\"].includes(format)) fail(\"output.format must be srgb-8, srgb-16, jpeg, png or dng.\");\n let dngCapturedAtUtc: string | undefined;\n if (format === \"dng\") {\n const d = allowKeys(outputOptions.dng, \"output.dng\", [\"capturedAtUtc\"]);\n dngCapturedAtUtc = d.capturedAtUtc as string | undefined;\n if (dngCapturedAtUtc === undefined) assume(\"output.dng.capturedAtUtc\", \"default\", null, \"No capture time: the DNG carries no DateTimeOriginal (the engine never invents a wall clock).\");\n } else if (outputOptions.dng !== undefined) fail(\"output.dng applies only to output.format \\\"dng\\\".\");\n if (run === \"dng-from-parts\" && format !== \"dng\") fail(\"serializeSimulatedCaptureDngFromParts needs output.format \\\"dng\\\".\");\n const textMetadata = parseOutputTextMetadata(outputOptions.metadata, \"output.metadata\");\n if (textMetadata && format !== \"jpeg\" && format !== \"png\" && format !== \"dng\") fail(\"output.metadata applies only to output.format \\\"jpeg\\\", \\\"png\\\" or \\\"dng\\\".\");\n const assumeTextMetadata = (layout: string): void => {\n if (textMetadata) assume(\"output.metadata\", \"model\", { fields: Object.keys(textMetadata), layout },\n \"The caller's text, written unchanged; the engine adds no text of its own (in the DNG the description follows the existing simulated-RAW statement). Without output.metadata the file is byte-identical to 2.3.\");\n };\n let colorEncoding: SimulateCaptureColorEncoding | undefined, pngBitDepth: 8 | 16 | undefined;\n if (format === \"png\") {\n colorEncoding = pick<SimulateCaptureColorEncoding>(outputOptions, \"colorEncoding\", \"output.colorEncoding\", \"srgb\",\n \"sRGB (W3C CSS Color 4 srgb) samples signalled with the PNG sRGB chunk (perceptual intent) and its prescribed gAMA/cHRM values.\");\n if (![\"srgb\", \"display-p3\", \"rec2020\"].includes(colorEncoding)) fail(\"output.colorEncoding must be srgb, display-p3 or rec2020.\");\n pngBitDepth = pick<8 | 16>(outputOptions, \"bitDepth\", \"output.bitDepth\", 8, \"8 bits per sample.\");\n if (pngBitDepth !== 8 && pngBitDepth !== 16) fail(\"output.bitDepth must be 8 or 16.\");\n } else if (outputOptions.colorEncoding !== undefined || outputOptions.bitDepth !== undefined) fail(\"output.colorEncoding and output.bitDepth apply only to output.format \\\"png\\\".\");\n let perceptual = false;\n if (format === \"png\") {\n const gamutMapping = pick<\"clip\" | \"perceptual\">(outputOptions, \"gamutMapping\", \"output.gamutMapping\", \"clip\", \"Out-of-gamut components are clipped to [0, 1] in the target space.\");\n if (gamutMapping !== \"clip\" && gamutMapping !== \"perceptual\") fail(\"output.gamutMapping must be clip or perceptual.\");\n perceptual = gamutMapping === \"perceptual\";\n } else if (outputOptions.gamutMapping !== undefined) fail(\"output.gamutMapping applies only to output.format \\\"png\\\".\");\n const wideGamut = colorEncoding !== undefined && colorEncoding !== \"srgb\";\n // The linear development path serves wide-gamut encodings and perceptual gamut mapping.\n const linearPath = wideGamut || perceptual;\n const toneCurve = pick<SdrToneCurve>(outputOptions, \"toneCurve\", \"output.toneCurve\", DEFAULTS.toneCurve, \"Identity tone curve: scene-linear values are clipped at display white, then sRGB-encoded.\");\n if (linearPath && toneCurve !== \"identity\") fail(\"output.toneCurve other than identity is available only for sRGB output; wide-gamut encodings are converted from the linear developed colour.\");\n const highlightMode = pick<RawHighlightMode>(outputOptions, \"highlightMode\", \"output.highlightMode\", DEFAULTS.highlightMode, \"Saturated RAW highlights are clipped to neutral.\");\n const whiteBalanceOption = pick<SimulateCaptureWhiteBalance>(outputOptions, \"whiteBalance\", \"output.whiteBalance\", DEFAULTS.whiteBalance,\n \"White balance measured from a perfect white diffuser under the scene illuminant (a custom/grey-card white balance).\");\n const jpegStep = format === \"jpeg\" ? integerIn(pick(outputOptions, \"jpegQuantizationStep\", \"output.jpegQuantizationStep\", DEFAULTS.jpegQuantizationStep,\n \"Constant JPEG quantization step 2 (not a manufacturer quality scale).\"), \"output.jpegQuantizationStep\", 1, 255) : undefined;\n if (format !== \"jpeg\" && outputOptions.jpegQuantizationStep !== undefined) fail(\"output.jpegQuantizationStep applies only to output.format \\\"jpeg\\\".\");\n const sensorOptions = allowKeys(top.sensor, \"sensor\", [\"pixelPitchMicrometers\", \"spectralStepNanometers\", \"temporalSampleCount\", \"noiseSeed\", \"antiAliasing\", \"pixelAperture\"]);\n const pitch = positive(pick(sensorOptions, \"pixelPitchMicrometers\", \"sensor.pixelPitchMicrometers\", DEFAULTS.pixelPitchMicrometers,\n \"6 µm pixels (about a 24 MP full-frame sensor). The simulated sensor is width × pitch wide, so small images are a central crop of a large sensor, not a downscaled full frame.\"), \"sensor.pixelPitchMicrometers\");\n if (pitch < 0.5 || pitch > SIMULATE_CAPTURE_PIXEL_PITCH_MAXIMUM_MICROMETERS) fail(\"sensor.pixelPitchMicrometers must be 0.5-\" + SIMULATE_CAPTURE_PIXEL_PITCH_MAXIMUM_MICROMETERS + \".\");\n const spectralStep = positive(pick(sensorOptions, \"spectralStepNanometers\", \"sensor.spectralStepNanometers\", DEFAULTS.spectralStepNanometers,\n \"Spectral midpoint quadrature over 380-780 nm with subintervals of at most 20 nm.\"), \"sensor.spectralStepNanometers\");\n if (spectralStep < 1 || spectralStep > 100) fail(\"sensor.spectralStepNanometers must be 1-100.\");\n const temporalSampleCount = integerIn(rotating ? pick(sensorOptions, \"temporalSampleCount\", \"sensor.temporalSampleCount\", ROTATING_TEMPORAL_SAMPLE_COUNT,\n \"Eight temporal midpoints across each site's exposure window sample the camera rotation (motion blur); raise it for long exposures or fast rotation.\") :\n pick(sensorOptions, \"temporalSampleCount\", \"sensor.temporalSampleCount\", DEFAULTS.temporalSampleCount,\n \"One temporal sample: the static scene and still camera make more samples unnecessary.\"), \"sensor.temporalSampleCount\", 1, 256);\n const noiseSeed = integerIn(pick(sensorOptions, \"noiseSeed\", \"sensor.noiseSeed\", DEFAULTS.noiseSeed, \"Fixed noise seed 1 (deterministic output).\"), \"sensor.noiseSeed\", 0, 0xffffffff);\n const antiAliasing = sensorOptions.antiAliasing === undefined ? undefined : parseAntiAliasing(sensorOptions.antiAliasing, pitch);\n const antiAliasingFast = antiAliasing ? fastOverride(sensorOptions.antiAliasing as Record<string, unknown>, \"sensor.antiAliasing\") : undefined;\n // Pixel aperture (2.3): N × N midpoint nodes over the square photosite; 1 = the default centre sample.\n let boxSamples = 1, boxFast: boolean | undefined;\n if (sensorOptions.pixelAperture !== undefined && sensorOptions.pixelAperture !== \"point\") {\n const a = sensorOptions.pixelAperture;\n if (a === \"box\") boxSamples = SIMULATE_CAPTURE_BOX_APERTURE_DEFAULT_SAMPLES;\n else {\n const record = allowKeys(a, \"sensor.pixelAperture\", [\"kind\", \"samplesPerAxis\", \"fast\"]);\n if (record.kind !== \"box\") fail(\"sensor.pixelAperture must be \\\"point\\\", \\\"box\\\" or { kind: \\\"box\\\", samplesPerAxis, fast }.\");\n boxFast = fastOverride(record, \"sensor.pixelAperture\");\n boxSamples = record.samplesPerAxis === undefined ? SIMULATE_CAPTURE_BOX_APERTURE_DEFAULT_SAMPLES : integerIn(record.samplesPerAxis, \"sensor.pixelAperture.samplesPerAxis\", 1, 16);\n }\n }\n const boxAperture = sensorOptions.pixelAperture !== undefined && sensorOptions.pixelAperture !== \"point\";\n // Display view: its own parameters, and the capture options it reproduces, checked before any scene work.\n const parsedView = displayView && viewOption !== DISPLAY_VIEW_WITHOUT_VIEW ? parseDisplayViewOption(viewOption, width, height) : undefined;\n if (displayView) {\n const unsupported = (option: string, reason: string): never => fail(\"simulateDisplayView does not support \" + option + \": \" + reason);\n if (pupil) unsupported(\"lens.pupilSampling\", \"pupil rays move each query off the site lattice the expected-signal tables use; lens.defocus renders the defocus of the scene plane on the lattice.\");\n if (lensFieldMapping) unsupported(\"lens.projection or lens.distortion\", \"the expected signal assumes the ideal rectilinear, distortion-free mapping of the site lattice.\");\n if (vignetting) unsupported(\"lens.vignetting\", \"the expected signal assumes the same radiance-to-irradiance factor at every site.\");\n if (lensPsf) unsupported(\"lens.psf\", \"only the engine-built diffraction kernels (lens.diffraction) are tabulated.\");\n if (rotating) unsupported(\"motion.angularVelocityRadPerSec\", \"camera rotation moves the queries off the site lattice.\");\n if (outputOptions.region !== undefined) unsupported(\"output.region\", \"pass the rectangle as view.region, in display pixels.\");\n if (outputOptions.whiteBalance === \"auto\") unsupported(\"output.whiteBalance \\\"auto\\\"\", \"the capture measures it from its noisy full-resolution RAW; use \\\"scene-illuminant\\\" or a fixed white balance.\");\n if (outputOptions.toneCurve !== undefined && outputOptions.toneCurve !== \"identity\" && outputOptions.toneCurve !== \"positive-reinhard-per-channel\")\n unsupported(\"output.toneCurve \" + String(outputOptions.toneCurve), \"luminance tone curves couple the channels; the view supports identity and positive-reinhard-per-channel.\");\n if (outputOptions.highlightMode === \"reconstruct\") unsupported(\"output.highlightMode \\\"reconstruct\\\"\", \"the view supports the per-channel highlight clip.\");\n }\n\n const colorSamplingProfile = { schemaVersion: \"0.1.0\" as const, profileId: IDS.cfa, evidence: FACADE_EVIDENCE, coordinateSystem: \"native-sensor-color-sampling-site-index\" as const,\n layout: { kind: \"periodic-mosaic\" as const, repeatWidthSites: 2, repeatHeightSites: 2, siteChannelIds: [\"red\", \"green\", \"green\", \"blue\"], anchor: \"native-sensor-top-left-site\" as const } };\n // Demosaic (2.0): built-in Bayer kernels and border handling. Omitted, the 1.0 bilinear kernels and a\n // one-site rendered border are used unchanged.\n // #395: the record form { kind, fast } names the same demosaic.\n let demosaicOption: SimulateCaptureDemosaic | undefined, demosaicFast: boolean | undefined;\n if (outputOptions.demosaic !== undefined && typeof outputOptions.demosaic === \"object\" && outputOptions.demosaic !== null) {\n const record = allowKeys(outputOptions.demosaic, \"output.demosaic\", [\"kind\", \"fast\"]);\n if (record.kind !== \"bilinear\" && record.kind !== \"ahd\") fail(\"output.demosaic must be bilinear or ahd, or { kind, fast }.\");\n demosaicOption = record.kind as SimulateCaptureDemosaic;\n demosaicFast = fastOverride(record, \"output.demosaic\");\n } else demosaicOption = outputOptions.demosaic as SimulateCaptureDemosaic | undefined;\n const borderOption = outputOptions.borderHandling as SimulateCaptureBorderHandling | undefined;\n if (demosaicOption !== undefined && demosaicOption !== \"bilinear\" && demosaicOption !== \"ahd\") fail(\"output.demosaic must be bilinear or ahd.\");\n const ahd = demosaicOption === \"ahd\";\n // #395: exact or fast per option. No option has a fast method yet, so each runs exact and reports false.\n if (top.fast !== undefined && typeof top.fast !== \"boolean\") fail(\"fast must be true or false.\");\n const fastTop = top.fast === true;\n const fastInUse: [SimulateCaptureFastOption, boolean, boolean | undefined][] = [[\"lens.diffraction\", diffractionRadiusOption !== undefined, diffractionFast],\n [\"sensor.antiAliasing\", antiAliasing !== undefined, antiAliasingFast], [\"sensor.pixelAperture.box\", boxAperture, boxFast], [\"output.demosaic.ahd\", ahd, demosaicFast]];\n const fastApplied: Partial<Record<SimulateCaptureFastOption, boolean>> = {};\n for (const [option, used] of fastInUse) if (used) fastApplied[option] = false;\n const fastReport: SimulateCaptureFastReport = Object.freeze({\n requested: fastTop || [diffractionFast, antiAliasingFast, boxFast, demosaicFast].some((value) => value === true),\n applied: Object.freeze(fastApplied), assurance: \"engine-reference\" as const });\n if (borderOption !== undefined && borderOption !== \"margin\" && borderOption !== \"mirror\") fail(\"output.borderHandling must be margin or mirror.\");\n const builtInDemosaic = demosaicOption === undefined ? undefined : createBuiltInBayerDemosaicProfiles({ kernel: \"bilinear\",\n captureModeId: IDS.mode, colorSamplingProfile, channelRoles: { red: \"red\", green: \"green\", blue: \"blue\" } }).value;\n const mirrorBorder = borderOption === \"mirror\";\n const margin = mirrorBorder ? 0 : ahd ? AHD_MARGIN : builtInDemosaic ? builtInDemosaic.kernelReachSites : MARGIN;\n if (mirrorBorder && (width < 2 || height < 2)) fail(\"output.borderHandling \\\"mirror\\\" needs an output of at least 2 × 2 pixels.\");\n if (ahd && mirrorBorder && (width < 3 || height < 3)) fail(\"output.demosaic \\\"ahd\\\" with mirror borders needs an output of at least 3 × 3 pixels.\");\n\n // Geometry: the demosaic border (if any) on each side; output crop is the active area.\n const nativeWidth = width + 2 * margin, nativeHeight = height + 2 * margin;\n // Region (2.3): a rectangle of the whole frame. Its native sites are the region plus the demosaic reach on each side\n // (clipped to the raster, where mirror borders apply exactly as in the whole render), with the origin rounded down to\n // the 2 × 2 CFA repeat so the region raster keeps the frame's CFA phase.\n let region: { x: number; y: number; width: number; height: number } | undefined, regionNative: typeof region;\n if (outputOptions.region !== undefined) {\n const r = allowKeys(outputOptions.region, \"output.region\", [\"x\", \"y\", \"width\", \"height\"]);\n const x = integerIn(r.x, \"output.region.x\", 0, width - 1), y = integerIn(r.y, \"output.region.y\", 0, height - 1);\n region = { x, y, width: integerIn(r.width, \"output.region.width\", 1, width - x), height: integerIn(r.height, \"output.region.height\", 1, height - y) };\n const reach = margin > 0 ? margin : ahd ? AHD_MARGIN : builtInDemosaic ? builtInDemosaic.kernelReachSites : MARGIN;\n let x0 = Math.max(0, region.x + margin - reach), y0 = Math.max(0, region.y + margin - reach);\n x0 -= x0 % 2; y0 -= y0 % 2;\n regionNative = { x: x0, y: y0, width: Math.min(nativeWidth, region.x + region.width + margin + reach) - x0, height: Math.min(nativeHeight, region.y + region.height + margin + reach) - y0 };\n }\n const outputWidth = region ? region.width : width, outputHeight = region ? region.height : height;\n if (region && regionNative) assume(\"output.region\", \"model\", { ...region, frameWidth: width, frameHeight: height, nativeRect: { ...regionNative } },\n \"Only this rectangle of the \" + width + \" × \" + height + \" frame is rendered. Framing, metering, exposure, diffraction kernels and every site's physics, noise seeds and exposure window (rolling-shutter row timing) are those of the whole frame (absolute native indices), \" +\n \"and the native rectangle includes the demosaic reach on each side (\" + (margin > 0 ? margin : \"mirror-border\") + \"), so the pixels are byte-identical to the same pixels of the whole render. \" +\n // 2.6: with lens.diffraction the convolution is limited to the region; the sentence of 2.3–2.5 is kept verbatim otherwise, so\n // region results without diffraction stay byte-identical to 2.5.0.\n (diffractionRadiusOption !== undefined ? \"With lens.diffraction the object-space convolution (when it applies) covers only the lattice the region's native sites query (plus the kernel radius), in bands of at most 32 native rows; its values are the whole render's.\" :\n \"With lens.diffraction the object-space convolution runs over whole-width bands of 32 native rows that the region touches.\"));\n if (raisedPixels !== undefined) {\n if (nativeWidth > NATIVE_RAW_LIMITS.maximumDimension || nativeHeight > NATIVE_RAW_LIMITS.maximumDimension || nativeWidth * nativeHeight > raisedPixels) {\n fail(\"output.maximumPixels (\" + raisedPixels + \") must cover the native sensor raster of \" + nativeWidth + \" × \" + nativeHeight +\n \" sites (the output plus the demosaic margin), at most \" + NATIVE_RAW_LIMITS.maximumDimension + \" per side.\");\n }\n // The display view allocates no full-resolution raster, so the AHD working limit does not apply to it.\n if (ahd && !displayView && (regionNative ? regionNative.width * regionNative.height : nativeWidth * nativeHeight) > PROCESSING_MAX_PIXELS) fail(\"output.demosaic \\\"ahd\\\" admits at most \" + PROCESSING_MAX_PIXELS + \" native sites.\");\n }\n const imagingArea = { widthMm: nativeWidth * pitch / 1000, heightMm: nativeHeight * pitch / 1000 };\n const geometry = { imagingArea, nativeRaster: { pixelWidth: nativeWidth, pixelHeight: nativeHeight }, orientation: \"landscape\" as const,\n activeCaptureRect: { x: margin, y: margin, width, height }, outputRaster: { pixelWidth: width, pixelHeight: height } };\n const resolvedGeometry = resolveCaptureGeometry(geometry).value;\n const imageDistanceMm = focalLengthMm * focusDistanceM * 1000 / (focusDistanceM * 1000 - focalLengthMm);\n const metresPerFrameUnit = (width * pitch / 2000) * subjectDistanceM / imageDistanceMm;\n const aspect = height / width;\n // Fixed-size chart (2.3): validated here, before any scene work.\n const chartSize = top.chartSize === undefined ? undefined : resolveChartSizeOption(top.chartSize, aspect);\n assume(\"scene.framing\", \"derived\", { framedWidthM: 2 * metresPerFrameUnit, framedHeightM: 2 * metresPerFrameUnit * aspect },\n chartSize ? \"The scene plane is perpendicular to the optical axis; the frame covers this much of it (thin lens, focused distance), and the chart has the physical size in scene.chartSize.\" :\n \"The scene plane is perpendicular to the optical axis and the chart is sized to fill the active frame exactly.\");\n let chartReport: NonNullable<SimulateCaptureResult[\"scene\"][\"chart\"]> | undefined;\n if (chartSize) {\n for (const key of chartSize.defaulted) assume(\"chartSize.\" + key, \"default\", chartSize[key], key === \"heightM\" ?\n \"The chart has the frame's shape: height = width × output height / output width.\" : \"An 18 % neutral grey plane surrounds the chart.\");\n const magnification = imageDistanceMm / (subjectDistanceM * 1000), framedWidthM = 2 * metresPerFrameUnit, framedHeightM = framedWidthM * aspect;\n chartReport = { widthM: chartSize.widthM, heightM: chartSize.heightM, surroundReflectance: chartSize.surroundReflectance,\n frameWidthFraction: chartSize.widthM / framedWidthM, frameHeightFraction: chartSize.heightM / framedHeightM, magnification,\n imageWidthMm: chartSize.widthM * 1000 * magnification, imageHeightMm: chartSize.heightM * 1000 * magnification,\n imageWidthPixels: chartSize.widthM * 1e6 * magnification / pitch, imageHeightPixels: chartSize.heightM * 1e6 * magnification / pitch };\n assume(\"scene.chartSize\", \"model\", chartReport,\n \"Fixed-size chart: the chart is widthM × heightM metres on the scene plane, centred on the optical axis, and the rest of the plane is a neutral Lambertian surround under the same light. \" +\n \"Its image size follows the facade's thin-lens framing: magnification m = v/d with the image distance v = f·s/(s − f) at the focus distance s and the subject distance d, so the frame spans \" +\n \"sensor width / m on the plane. frameWidthFraction and frameHeightFraction above 1 mean the chart is larger than the frame and cropped.\");\n }\n if (demosaicOption === undefined && borderOption === undefined) {\n assume(\"output.demosaic\", \"model\", \"bilinear-rggb\", \"Bilinear RGGB demosaic through explicit linear kernels; the native raster has a one-site border on each side so every output pixel has full support.\");\n } else {\n if (demosaicOption === undefined) assume(\"output.demosaic\", \"default\", \"bilinear-rggb\", \"The 1.0 facade's bilinear RGGB kernels (explicit linear neighbourhood weights).\");\n else if (ahd) assume(\"output.demosaic\", \"model\", { method: \"ahd-hirakawa-parks-2005\", dependenceReachSites: AHD_MARGIN },\n \"Adaptive homogeneity-directed demosaicing (createAhdDemosaicTask, after Hirakawa & Parks, IEEE TIP 14(3), 2005): directional green, red/blue from colour differences, and per pixel the more homogeneous of the horizontal and vertical candidates in CIELAB (white-balanced camera colour); the paper's iterative median step is not applied. Non-linear; the mosaic is normalized and white-level clipped as in the native development and stored in float32, and the native development's colour operator follows. request.development keeps the built-in bilinear kernels, which validate the development but are not used for these pixels.\");\n else assume(\"output.demosaic\", \"model\", { kernel: builtInDemosaic!.kernel, modelVersion: BUILT_IN_DEMOSAIC_VERSION, kernelReachSites: builtInDemosaic!.kernelReachSites },\n \"Built-in bilinear Bayer kernels (createBuiltInBayerDemosaicProfiles): nearest same-channel averages.\");\n if (borderOption === undefined) assume(\"output.borderHandling\", \"default\", \"margin\", \"The native raster adds the kernel reach (\" + margin + \" site(s)) on each side, so every output pixel is reconstructed from rendered sites.\");\n else assume(\"output.borderHandling\", \"model\", borderOption, mirrorBorder ?\n \"No rendered border: the native raster equals the output and reconstruction reads reflect-101 mirror images of the missing sites (CFA consistency validated), so edge pixels use mirrored rather than rendered neighbours.\" :\n \"The native raster adds the kernel reach (\" + margin + \" site(s)) on each side, so every output pixel is reconstructed from rendered sites.\");\n }\n\n // Radiance queries per native site: spectral subintervals × temporal midpoints × pupil rays × PSF taps.\n const psfTaps = lensPsf ? Math.max(1, ...((lensPsf.configuration.psf.profile.nodes ?? []) as readonly { kernel?: { widthSamples?: unknown; heightSamples?: unknown } }[])\n .map((node) => Number(node.kernel?.widthSamples) * Number(node.kernel?.heightSamples)).filter((taps) => Number.isSafeInteger(taps) && taps > 0)) : 1;\n const queriesPerSite = temporalSampleCount * (Math.ceil((FACADE_SPECTRAL_RANGE_NANOMETERS.maximum - FACADE_SPECTRAL_RANGE_NANOMETERS.minimum) / spectralStep) + 1) *\n (pupil ? pupil.radialSamples * pupil.angularSamples : 1) * psfTaps * (antiAliasing ? antiAliasing.components.length : 1) * boxSamples * boxSamples;\n\n // Scene and illuminant\n // The scene is the one required input: the facade never guesses what is being photographed.\n if (top.scene === undefined) fail(\"simulateCapture needs a scene, for example { preset: \\\"uniform\\\" } (an 18 % grey card) or { preset: \\\"slanted-edge\\\" }.\");\n const sceneOption = top.scene;\n requireInputObject(sceneOption, \"scene\");\n const illuminantOption = pick<CaptureIlluminant>(top, \"illuminant\", \"illuminant\", { kind: \"planckian\", temperatureKelvin: DEFAULTS.illuminantKelvin },\n \"Planckian (blackbody) 6500 K as a stand-in for daylight. CIE D65 is not bundled; pass its S0/S1/S2 basis as a daylight illuminant to use it.\");\n const illuminant = resolveCaptureIlluminant(illuminantOption);\n const illuminanceLux = positive(pick(top, \"illuminanceLux\", \"illuminanceLux\", SIMULATE_CAPTURE_DEFAULT_ILLUMINANCE_LUX,\n \"π·10·N²/(0.65·t·S·0.18) lux at f/8, 1/125 s, ISO 100 (CIPA DC-004 standard output sensitivity H = 10/S and camera equation H = 0.65·L·t/N²): an 18 % grey card then gets the reference exposure for the default settings. It does not follow the caller's exposure settings.\"), \"illuminanceLux\");\n const irradianceScale = calculateIlluminantIrradianceScale(illuminant.shape, illuminanceLux);\n let chart: ResolvedChartScene | undefined, callerScene: ResolvedCallerScene | undefined, materialLayers: ResolvedChartMaterialLayers | undefined;\n const sceneRecord = sceneOption as Record<string, unknown>;\n if (\"kind\" in sceneRecord) {\n // #491: a declared material-layers scene is its callerScene (the same validation, materials, digest and bytes as passing that scene);\n // the resolved layers are kept for the display view's GPU renderer.\n if (sceneRecord.kind === \"material-layers\") materialLayers = resolveChartMaterialLayers({ scene: sceneOption as ChartMaterialLayerScene, aspect: chartSize ? chartSize.heightM / chartSize.widthM : aspect });\n callerScene = requireCallerScene(materialLayers ? materialLayers.callerScene : sceneOption);\n } else {\n chart = resolveChartScene({ scene: sceneOption as ChartScene, aspect: chartSize ? chartSize.heightM / chartSize.widthM : aspect });\n // Composite charts (2.3) report nested defaults by dotted path, for example \"elements.2.parameters.cycles\".\n const parameterAt = (key: string): unknown => key in chart!.parameters ? chart!.parameters[key] :\n key.split(\".\").reduce<unknown>((value, part) => (value as Record<string, unknown> | undefined)?.[part], chart!.parameters);\n for (const key of chart.defaultedParameters) assume(\"scene.\" + key, \"default\", parameterAt(key), \"Chart default for \" + chart.preset + \".\");\n }\n const scenePreset = chart ? chart.preset : callerScene!.kind;\n // Caller spectra enter the digest as data (see spectrumDigestForm). Without caller spectra the description is unchanged,\n // so default captures keep their digests.\n const illuminantRecord = typeof illuminantOption === \"object\" ? illuminantOption as { kind?: unknown; basis?: { datasetId?: unknown } } : undefined;\n const illuminantSpectrum = illuminantRecord?.kind === \"spectrum\" ? { spectrum: spectrumDigestForm(illuminant.spectrum, illuminant.shape) } :\n illuminantRecord?.kind === \"daylight\" ? { basisDatasetId: illuminantRecord.basis?.datasetId, spectrum: spectrumDigestForm(illuminant.spectrum, illuminant.shape) } : undefined;\n const materialInputs = chart ? chartMaterialInputs(chart) : [];\n const sceneSpectra = chart ? chart.materials.flatMap((m, index) => m.kind !== \"spectrum\" ? [] : [{ material: index, spectrum: spectrumDigestForm(materialInputs[index], m.spectrum) }]) : [];\n // 2.7: a material scene's materials enter the digest as data (neutral reflectances, and caller spectra as above).\n const sceneMaterials = callerScene?.kind === \"material-function\" ? callerScene.materials.map((m, index) => (m.kind === \"neutral\" ? m.reflectance :\n spectrumDigestForm(callerScene.materialInputs[index], m.spectrum))) : undefined;\n const sceneDescription = { facadeVersion: SIMULATE_CAPTURE_FACADE_VERSION, scene: chart ? { preset: chart.preset, parameters: chart.parameters } :\n { kind: callerScene!.kind, sceneId: callerScene!.sceneId }, illuminant: illuminant.id, illuminanceLux, subjectDistanceM, framedWidthM: 2 * metresPerFrameUnit, aspect,\n ...(chartSize ? { chartSize: { widthM: chartSize.widthM, heightM: chartSize.heightM, surroundReflectance: chartSize.surroundReflectance } } : {}),\n ...(illuminantSpectrum === undefined ? {} : { illuminantSpectrum }), ...(sceneSpectra.length === 0 ? {} : { sceneSpectra }), ...(sceneMaterials ? { sceneMaterials } : {}) };\n if (callerScene?.kind === \"material-function\") assume(\"scene.digest\", \"model\", \"caller-function-not-hashed\", \"The source digest covers the caller's sceneId, its materials and the framing, not the body of the caller's materialAt function.\");\n else if (callerScene) assume(\"scene.digest\", \"model\", \"caller-function-not-hashed\", \"The source digest covers the caller's sceneId and the framing, not the body of the caller's evaluate function.\");\n const sourceSha256 = await sha256Hex(JSON.stringify(sceneDescription, (_key, value: unknown) => (typeof value === \"object\" && value !== null && \"evaluate\" in value ? \"caller-spectrum\" : value)));\n checkAbort();\n const buildProvider = (sceneIlluminant: ResolvedCaptureIlluminant, scale: number): PlanarSceneRadianceProvider => buildPlanarSceneRadianceProvider({ scene: chart ?? callerScene!,\n sceneId: IDS.scene, providerProfileId: IDS.provider, illuminant: sceneIlluminant, irradianceScale: scale, geometry: { distanceM: subjectDistanceM, metresPerFrameUnit,\n ...(chartSize ? { chart: { widthM: chartSize.widthM, heightM: chartSize.heightM, surroundReflectance: chartSize.surroundReflectance } } : {}) }, evidence: FACADE_EVIDENCE,\n limitations: Object.freeze([\"Planar Lambertian scene under uniform illumination; no shadows, inter-reflection, gloss or fluorescence.\"]) });\n const provider = buildProvider(illuminant, irradianceScale);\n // 2.6: a chart preset's evaluator is engine-built end to end (its results: the schema's exact keys, constant fields,\n // the request's identifiers, deep-frozen FACADE_EVIDENCE, UNCERTAINTY and limitations, and an engine-computed\n // radiance), so the native task may skip re-parsing the fixed parts. Caller scenes keep the full validation.\n // #394: a caller material scene's evaluator is engine-built in the same way (its radiance comes from the validated materials;\n // only materialAt, validated on every call, is the caller's).\n const materialEvaluator = chart !== undefined || callerScene?.kind === \"material-function\";\n if (materialEvaluator) markInternalSceneRadianceEvaluator(provider.evaluateRadiance);\n // #394: its results are materialRadiance(material at the queried point, wavelength), so the lean executor may tabulate them.\n const materialOfDirection = planarProviderMaterialOfDirection(provider);\n if (materialEvaluator && materialOfDirection && provider.materialRadiance) registerInternalRadianceAccess(provider.evaluateRadiance,\n { keyOfDirection: materialOfDirection, radianceOfKey: provider.materialRadiance, tabulated: true });\n assume(\"model.scene-radiometry\", \"model\", \"lambertian-plane\", \"Radiance = reflectance × irradiance / π on one plane; illuminance from K_m = 683 lm/W and the engine's analytic CIE 1931 ȳ fit.\");\n\n // Metering (CIPA DC-004 standard output sensitivity and camera equation) and exposure-mode resolution\n const exposureOptions = allowKeys(top.exposure, \"exposure\", [\"mode\", \"iso\", \"shutterSeconds\", \"compensationStops\", \"autoIso\"]);\n const mode = pick<SimulateCaptureExposureMode>(exposureOptions, \"mode\", \"exposure.mode\", \"manual\", \"Manual exposure.\");\n if (![\"manual\", \"aperture-priority\", \"shutter-priority\", \"program\"].includes(mode)) fail(\"Unknown exposure mode.\");\n const isoOption = pick<unknown>(exposureOptions, \"iso\", \"exposure.iso\", DEFAULTS.iso, \"ISO 100, the tiers' base ISO.\");\n // #516: \"auto\" resolves the ISO with the mode's Auto ISO resolver; NaN marks the ISO as not yet known.\n const automaticIso = isoOption === \"auto\";\n if (typeof isoOption === \"string\" && !automaticIso) fail('exposure.iso must be a positive finite number or \"auto\".');\n const iso = automaticIso ? NaN : positive(isoOption, \"exposure.iso\");\n if (exposureOptions.autoIso !== undefined && !(automaticIso && mode === \"aperture-priority\"))\n fail('exposure.autoIso applies only to exposure.mode \"aperture-priority\" with exposure.iso \"auto\"; omit it.');\n const compensation = exposureOptions.compensationStops === undefined ? DEFAULTS.compensationStops : exposureOptions.compensationStops;\n if (typeof compensation !== \"number\" || !Number.isFinite(compensation) || Math.abs(compensation) > 10) fail(\"exposure.compensationStops must be within ±10.\");\n if (exposureOptions.compensationStops === undefined) assume(\"exposure.compensationStops\", \"default\", 0, \"No exposure compensation.\");\n const reference = { aperture: DEFAULTS.fNumber, shutterSeconds: DEFAULTS.shutterSeconds, iso: DEFAULTS.iso };\n const referenceLuminance = sosReferenceLuminance(reference.aperture, reference.shutterSeconds, reference.iso);\n assume(\"exposure.referenceExposure\", \"model\", { ...reference, meteredLuminanceCdPerSquareMeter: referenceLuminance },\n \"Exposure anchor: f/8, 1/125 s, ISO 100 gives the CIPA DC-004 standard output sensitivity reference exposure H = 10/S = 0.1 lx·s for an average scene luminance of 10·N²/(0.65·t·S) ≈ 1230.77 cd/m² (camera equation H = 0.65·L·t/N²).\");\n const meterProfile = body.metering[0]!.profile, zones = 16, zoneSamples = [];\n let luminanceSum = 0;\n for (let j = 0; j < zones; j++) for (let i = 0; i < zones; i++) {\n const u = -1 + (i + 0.5) * 2 / zones, v = aspect - (j + 0.5) * 2 * aspect / zones;\n const luminance = luminanceOf((nm) => provider.radianceAt(u, v, nm));\n luminanceSum += luminance;\n zoneSamples.push({ sampleId: \"zone-\" + i + \"-\" + j, positionOrientedCaptureUv: { u: (i + 0.5) / zones, v: (j + 0.5) / zones },\n relativeLinearSignal: meterProfile.target.targetRelativeSignal * luminance / referenceLuminance, areaWeight: 1 });\n }\n const meteredLuminance = luminanceSum / (zones * zones);\n assume(\"exposure.metering\", \"model\", { policy: meterProfile.policy.kind, zones: zones * zones },\n \"The body's \" + meterProfile.policy.kind + \" meter reads scene luminance on a 16 × 16 zone grid, before the lens (no lens transmission, vignetting or flare).\");\n const meterResult = meterRelativeExposure({ profile: meterProfile, sampleSet: { measurementId: \"facade-meter\", sceneStateId: IDS.sceneState,\n inputDomain: \"relative-pre-exposure-linear-signal\", captureRegion: \"oriented-active-capture\", captureGeometry: resolvedGeometry,\n processingState: { exposureSettingsApplied: false, whiteBalanceApplied: false, toneMappingApplied: false, displayGammaApplied: false, sharpeningApplied: false },\n samples: zoneSamples } });\n let target = createExposureMeterTargetFromMeteringResult({ targetId: \"facade-target\", meterResult: meterResult.value });\n if (compensation !== 0) target = setExposureCompensationOnMeterTarget({ targetId: \"facade-target-ec\", baseTarget: target, exposureCompensationStops: compensation });\n let resolution: { status: string; resolvedSettings?: { aperture?: number; shutterSeconds?: number; iso?: number } };\n let fNumber: number, shutterSeconds: number;\n if (mode === \"manual\" || mode === \"aperture-priority\") {\n fNumber = positive(pick(lensOptions, \"fNumber\", \"lens.fNumber\", DEFAULTS.fNumber, \"f/8.\"), \"lens.fNumber\");\n if (prime && (fNumber < prime.widestFNumber || fNumber > prime.narrowestFNumber))\n fail(\"lens.fNumber \" + fNumber + \" is outside the \" + prime.lensId + \" range f/\" + prime.widestFNumber + \"–f/\" + prime.narrowestFNumber + \".\");\n } else {\n if (lensOptions.fNumber !== undefined) fail(\"lens.fNumber is resolved automatically in \" + mode + \" mode; omit it.\");\n fNumber = NaN;\n }\n if (mode === \"manual\" || mode === \"shutter-priority\") {\n shutterSeconds = positive(pick(exposureOptions, \"shutterSeconds\", \"exposure.shutterSeconds\", DEFAULTS.shutterSeconds, \"1/125 s.\"), \"exposure.shutterSeconds\");\n } else {\n if (exposureOptions.shutterSeconds !== undefined) fail(\"exposure.shutterSeconds is resolved automatically in \" + mode + \" mode; omit it.\");\n shutterSeconds = NaN;\n }\n // #516: the resolvers' Auto ISO policies; their baseline is the lowest selectable ISO in the body's Auto ISO range.\n const autoIsoBaseline: AutoIsoBaselinePolicy = { isoBaseline: \"minimum-selectable\", isoQuantizationPolicy: \"nearest-log2-lower-on-tie\" };\n let autoIsoAperturePriority: { slowestPreferredShutterSeconds: number; afterMaximumIso: SimulateCaptureAutoIsoAfterMaximum } | undefined;\n if (automaticIso) {\n if (capabilities.iso.autoIsoAvailability !== \"supported\")\n fail('exposure.iso \"auto\" needs a body with Auto ISO; this camera\\'s Auto ISO is ' + capabilities.iso.autoIsoAvailability + \".\");\n assume(\"exposure.autoIso\", \"model\", { minimum: capabilities.iso.autoIsoMinimum ?? capabilities.iso.minimum, maximum: capabilities.iso.autoIsoMaximum ?? capabilities.iso.maximum, ...autoIsoBaseline },\n \"Auto ISO: the engine's exposure-mode resolver chooses the ISO from the meter target, starting from the lowest selectable ISO in the body's Auto ISO range and \" +\n \"snapping to the nearest selectable ISO in log2 (the lower on a tie), held at the range's ends. A generic policy, not a manufacturer's Auto ISO.\");\n }\n if (automaticIso && mode === \"aperture-priority\") {\n const autoIsoOptions = allowKeys(exposureOptions.autoIso, \"exposure.autoIso\", [\"slowestPreferredShutterSeconds\", \"afterMaximumIso\"]);\n if (autoIsoOptions.slowestPreferredShutterSeconds === undefined)\n fail('exposure.autoIso.slowestPreferredShutterSeconds is required with exposure.mode \"aperture-priority\" and exposure.iso \"auto\": the slowest shutter, in seconds, before Auto ISO raises the ISO.');\n const slowestPreferredShutterSeconds = positive(autoIsoOptions.slowestPreferredShutterSeconds, \"exposure.autoIso.slowestPreferredShutterSeconds\");\n if (slowestPreferredShutterSeconds < capabilities.shutter.minimumSeconds || slowestPreferredShutterSeconds > capabilities.shutter.maximumSeconds)\n fail(\"exposure.autoIso.slowestPreferredShutterSeconds must be within the body's shutter range, \" + capabilities.shutter.minimumSeconds + \" s to \" + capabilities.shutter.maximumSeconds + \" s.\");\n const afterMaximumIso = pick<unknown>(autoIsoOptions, \"afterMaximumIso\", \"exposure.autoIso.afterMaximumIso\", \"allow-slower-shutter\",\n \"At the Auto ISO maximum, the shutter may get slower than the slowest preferred shutter to reach the meter target.\");\n if (afterMaximumIso !== \"allow-slower-shutter\" && afterMaximumIso !== \"hold-preferred-shutter\")\n fail('exposure.autoIso.afterMaximumIso must be \"allow-slower-shutter\" or \"hold-preferred-shutter\".');\n autoIsoAperturePriority = { slowestPreferredShutterSeconds, afterMaximumIso };\n }\n if (mode === \"manual\") {\n resolution = resolveManualExposureMode({ target, capabilities, referenceExposure: reference, manualAperture: fNumber, manualShutterSeconds: shutterSeconds,\n isoControl: automaticIso ? { kind: \"automatic\", quantizationPolicy: autoIsoBaseline.isoQuantizationPolicy } : { kind: \"manual\", iso } });\n } else if (autoIsoAperturePriority) {\n resolution = resolveAperturePriorityAutoIsoExposureMode({ target, capabilities, referenceExposure: reference, manualAperture: fNumber,\n policy: { kind: \"minimum-iso-until-slowest-preferred-shutter\", ...autoIsoBaseline, shutterSelectionPolicy: \"not-longer-than-target\", ...autoIsoAperturePriority } });\n } else if (mode === \"aperture-priority\") {\n resolution = resolveAperturePriorityExposureMode({ target, capabilities, referenceExposure: reference, manualAperture: fNumber, manualIso: iso,\n shutterQuantizationPolicy: \"nearest-log2-shorter-on-tie\" });\n } else if (mode === \"shutter-priority\") {\n resolution = resolveShutterPriorityExposureMode({ target, capabilities, referenceExposure: reference, manualShutterSeconds: shutterSeconds,\n isoControl: automaticIso ? { kind: \"automatic\", policy: { kind: \"minimum-iso-aperture-first\", apertureSelectionPolicy: \"not-wider-than-target\", ...autoIsoBaseline } } :\n { kind: \"manual\", iso, apertureQuantizationPolicy: \"nearest-log2-narrower-on-tie\" } });\n } else {\n assume(\"exposure.programLine\", \"model\", \"facade-generic-program-line\", \"Engine-authored generic program line (f/16 1/2000 s … f/8 1/125 s … f/4 1.024 s); not a manufacturer program.\");\n resolution = resolveProgramAutoExposureMode({ target, capabilities, referenceExposure: reference, programLine: defaultProgramLine(),\n isoControl: automaticIso ? { kind: \"automatic\", ...autoIsoBaseline } : { kind: \"manual\", iso } });\n }\n if (resolution.status !== \"resolved\" || !resolution.resolvedSettings) fail(\"Exposure could not be resolved (\" + resolution.status + \"); the scene may have no signal.\");\n fNumber = resolution.resolvedSettings.aperture ?? fNumber;\n shutterSeconds = resolution.resolvedSettings.shutterSeconds ?? shutterSeconds;\n const resolvedIso = resolution.resolvedSettings.iso ?? iso;\n if (!Number.isFinite(resolvedIso) || resolvedIso <= 0) fail(\"Exposure could not be resolved: the resolved ISO is not a positive finite number.\");\n const isoReport = automaticIso ? { isoControl: \"automatic\" as const, autoIso: autoIsoReport(resolution, capabilities.iso, autoIsoAperturePriority) } : { isoControl: \"manual\" as const };\n const exposureDeviationStops = standardExposureDeviationStops(fNumber, shutterSeconds, resolvedIso, meteredLuminance);\n const defocusDisc = defocusModel === undefined ? undefined :\n resolveDefocusOption({ run, assume, focalLengthMm, fNumber, focusDistanceM, subjectDistanceM, pitch, diffraction: diffractionRadiusOption !== undefined });\n // #492: the capture applies the disc as an object-space convolution, which needs every disc point a site sees to be another site's scene point.\n if (defocusDisc) {\n const reason = rotating ? \"camera rotation (motion.angularVelocityRadPerSec)\" : lensFieldMapping ? \"lens.projection or lens.distortion\" : vignetting ? \"lens.vignetting\" : undefined;\n if (reason !== undefined) fail(\"simulateCapture does not support lens.defocus out of focus with \" + reason + \": the defocus disc is applied as an object-space convolution \" +\n \"on the site lattice, and \" + reason + \" moves the scene points the sites see off that lattice. Set lens.focusDistanceM equal to subjectDistanceM, or omit one of the two options.\");\n }\n // #492: the disc on the site lattice (radius 0 for a disc inside one cell: the identity, still applied).\n const defocusKernel = defocusDisc && !displayView ? createDefocusDiscSiteKernel(defocusDisc.diameterSites) ?? undefined : undefined;\n // The display view's disc (#492, step 2b): its expected-signal tables apply it (simulate-display-view.ts).\n const displayViewDefocus = displayView ? defocusDisc : undefined;\n\n // Sensor readout for the ISO setting. Standard output sensitivity S = 10/H (CIPA DC-004 §3.2) is defined at the\n // output, independent of pixel size, while the collected charge is proportional to the sensitive-aperture area\n // (EMVA 1288 Release 4.0, Eq. 3). The tier's signal chain is anchored to the 6 µm aperture; at another area the\n // charge-domain readout scales with the area so the same H gives the same code. At 6 µm nothing is changed.\n const areaScale = pitch * pitch / ISO_REFERENCE_APERTURE_AREA_SQUARE_MICROMETERS;\n const regimeByChannel = {} as Record<Channel, { readoutProfile: ReadoutProfile; regimeId: string }>;\n for (const channel of CHANNELS) {\n const asset = body.readout.find((a) => a.profile.channelId === channel) ?? fail(\"Camera readout lacks channel \" + channel + \".\");\n const chain = resolveGenericIsoSignalChain({ profile: body.signalChain, isoCapability: body.iso, requestedIsoSetting: { kind: \"standard\", exposureIndex: resolvedIso },\n captureModeId: IDS.mode, readoutProfile: asset.profile });\n regimeByChannel[channel] = { readoutProfile: areaScale === 1 ? asset.profile : isoAreaScaledReadout(asset.profile, areaScale), regimeId: chain.readout.regime.regimeId };\n }\n const capacityRegimes = (areaScale === 1 ? body.readout[0]!.profile : isoAreaScaledReadout(body.readout[0]!.profile, areaScale)).regimes;\n const baseRegime = capacityRegimes[0]! as unknown as { preAdcSaturationElectronEquivalent: { value: number } };\n const capacityElectrons = Math.max(...capacityRegimes.map((r) => (r as unknown as { preAdcSaturationElectronEquivalent: { value: number } }).preAdcSaturationElectronEquivalent.value),\n baseRegime.preAdcSaturationElectronEquivalent.value);\n assume(\"sensor.capacityElectrons\", \"derived\", capacityElectrons, \"Physical charge capacity set to the body's largest declared pre-ADC saturation (its base-ISO saturation signal), so storage never clips before the declared readout white.\");\n if (areaScale !== 1) {\n assume(\"sensor.isoAreaNormalization\", \"model\", { referenceApertureAreaSquareMicrometers: ISO_REFERENCE_APERTURE_AREA_SQUARE_MICROMETERS,\n apertureAreaSquareMicrometers: pitch * pitch, areaScale },\n \"Approximation. The tier's ISO signal chain is declared for a 6 µm square aperture. Standard output sensitivity S = 10/H (CIPA DC-004-2020 §3.2) is defined at the output, \" +\n \"independent of pixel size, and the collected charge is proportional to the aperture area (EMVA 1288 Release 4.0, Eq. 3), so the system conversion gain (e⁻ per code) and the \" +\n \"pre-ADC saturation of every ISO regime are multiplied by area / 36 µm² = \" + areaScale + \". The same exposure gives the same output code at any pitch; per-pixel shot-noise SNR \" +\n \"falls with smaller pixels. Read noise and dark current stay per pixel in electrons. The charge capacity follows the scaled base-ISO saturation, so it is proportional to \" +\n \"the aperture area: a design consequence of holding the tier's ISO rating and highlight headroom fixed, not a measured full-well model (published sensor data grow less than \" +\n \"proportionally with area across technologies).\");\n }\n // Whole-frame views (2.5): a pitch above 100 µm is larger than any camera photosite, so the capture is a downsized view of a frame width × pitch wide.\n if (pitch > SIMULATE_CAPTURE_PHOTOSITE_PITCH_MAXIMUM_MICROMETERS) {\n assume(\"sensor.wholeFrameView\", \"model\", { pixelPitchMicrometers: pitch, frameWidthMm: width * pitch / 1000, frameHeightMm: height * pitch / 1000 },\n \"A pixel pitch above 100 µm is larger than any camera photosite, so each output pixel stands for a \" + pitch + \" µm square of a \" + width * pitch / 1000 + \" × \" + height * pitch / 1000 +\n \" mm frame: a downsized view of the whole frame, with the framing, crop factor, generic prime and minimum focus of that frame. Its signal is the charge of the whole square \" +\n \"(sensor.isoAreaNormalization), so its shot noise is that of all the real photosites in the square summed or averaged (Poisson counts add), and the image brightness is the \" +\n \"same as at any other pitch. Read noise and dark current are applied once per output pixel, not once per real photosite, so in deep shadows the noise is lower than a real \" +\n \"sensor's binned output. This is the noise of a binned, downsized view, not the real sensor's per-pixel noise. A point pixel aperture samples one point of each square; \" +\n \"use sensor.pixelAperture box (or sensor.antiAliasing) to average scene detail finer than the pitch.\");\n }\n assume(\"sensor.darkCurrent\", \"model\", { electronsPerSecond: DARK_CURRENT_ELECTRONS_PER_SECOND, temperatureC: OPERATING_TEMPERATURE_C },\n \"Synthetic uniform dark current of 1 e⁻/s per site at 20 °C (the tier presets declare none); dark shot noise follows from it.\");\n assume(\"sensor.spectralResponse\", \"model\", { kind: \"colorimetric-cmf-eqe\", peakScale: EQE_SCALE },\n \"Idealized colorimetric sensor: channel EQE = a·{x̄, ȳ, z̄}(λ)·555/λ (the engine's analytic CIE 1931 fit), so RAW channels are proportional to CIE XYZ (Luther–Ives) and the camera matrix is diagonal. Not a real camera's response; CMF air wavelengths are used as vacuum wavelengths (difference about 0.03 %).\");\n if (boxAperture) {\n assume(\"sensor.pixelAperture\", \"model\", { kind: \"box\", samplesPerAxis: boxSamples, fillFactor: 1 },\n \"Each site integrates the irradiance uniformly over its square photosite (fill factor 1; the environment's uniform geometric-aperture response) with a \" + boxSamples + \" × \" + boxSamples +\n \" midpoint rule (spatialSampleCountX/Y). The ideal box aperture of width p has the pixel MTF |sinc(f·p)| = |sin(πfp)/(πfp)|; the midpoint rule gives |sin(πfp)/(N·sin(πfp/N))| \" +\n \"instead, within 3 % of it below the Nyquist frequency 1/(2p) for N ≥ 4, with the same zeros at multiples of 1/p except at multiples of N/p, where scene detail still aliases. \" +\n \"No microlens, carrier diffusion or crosstalk. The scene queries are multiplied by \" + boxSamples * boxSamples + \".\");\n }\n if (!antiAliasing) assume(\"sensor.fillFactor\", \"model\", 1, \"Square sensitive aperture equal to the pixel pitch; no microlens or anti-aliasing filter.\");\n else {\n assume(\"sensor.fillFactor\", \"model\", 1, \"Square sensitive aperture equal to the pixel pitch; no microlens.\");\n assume(\"sensor.antiAliasing\", \"model\", { kind: antiAliasing.kind, ...(antiAliasing.axis ? { axis: antiAliasing.axis } : {}),\n ...(antiAliasing.separationSites === undefined ? {} : { separationSites: antiAliasing.separationSites, separationMicrometers: antiAliasing.separationSites * pitch }),\n components: antiAliasing.components },\n \"Optical low-pass (anti-aliasing) filter as a normalized point-splitting kernel in the sensor optical stack (resolveAntiAliasingSpatialKernel): every site integrates the light that would \" +\n \"otherwise land at its centre minus each offset, weighted. \" + (antiAliasing.kind === \"point-splitting\" ? \"Caller-declared components. \" :\n \"This is the ideal birefringent \" + (antiAliasing.kind === \"four-spot\" ? \"two-plate (crossed) splitter: four equal spots at (±d/2, ±d/2), MTF |cos(π·f_x·d)·cos(π·f_y·d)|\" :\n \"single-plate splitter: two equal spots at ±d/2 along the \" + antiAliasing.axis + \" axis, MTF |cos(π·f·d)|\") + \", d = \" + antiAliasing.separationSites + \" site(s); first zero at f = 1/(2d). \") +\n \"Approximations: the split is the same at every wavelength, field point and polarization (birefringence dispersion and the thickness-dependent displacement are not modelled), the spots are exact points with equal weights for unpolarized light, \" +\n \"and the filter's transmission, reflections and focus shift are not modelled. Not a measured filter; the tier presets declare none. The scene queries are multiplied by \" + antiAliasing.components.length + \".\");\n }\n // Shutter (2.0): the electronic rolling-shutter schedule derived from the body's rolling readout declaration.\n let rollingSchedule: ElectronicRollingShutterExposureSchedule | undefined;\n if (shutterKind === \"rolling\") {\n const declared = (body as { rollingReadoutTiming?: { profile: unknown } }).rollingReadoutTiming?.profile as Parameters<typeof resolveElectronicRollingShutterExposureSchedule>[0][\"readout\"] | undefined;\n if (!declared || declared.readoutMode !== \"rolling\") fail(\"motion.shutter \\\"rolling\\\" needs a camera body with a rolling readout timing declaration.\");\n const readout = rollingSkewOption === undefined ? declared : { ...declared, spatialSamplingSkewSeconds: { value: rollingSkewOption, unit: \"s\" as const, evidence: FACADE_EVIDENCE } };\n rollingSchedule = resolveElectronicRollingShutterExposureSchedule({ readout, linkageEvidence: FACADE_EVIDENCE,\n nominalExposureDurationSeconds: { value: shutterSeconds, unit: \"s\", evidence: FACADE_EVIDENCE } });\n assume(\"sensor.shutter\", \"model\", { kind: \"electronic-rolling\", modelId: rollingSchedule.modelId, modelVersion: rollingSchedule.modelVersion,\n lineScanSkewSeconds: rollingSchedule.lineScanSkewSeconds, scanDirection: readout.scanDirectionNative.value },\n \"Electronic rolling shutter (line reset/read linkage): a site at normalized scan position s integrates over [s·τ, s·τ + T]. \" +\n (rollingSkewOption === undefined ? \"τ is the body's declared full-frame data-readout skew, applied unchanged across the simulated frame (it is not scaled to the cropped sensor), so a small frame shows the skew of a full-sensor readout.\" :\n \"τ is the caller-declared skew across the simulated frame.\"));\n } else assume(\"sensor.shutter\", \"model\", \"global-electronic\", \"Global electronic shutter: every site integrates the same exposure window.\");\n if (rotating) assume(\"motion.angularVelocityRadPerSec\", \"model\", { ...angular },\n \"Constant camera angular velocity applied to every scene ray at each temporal midpoint of each site's exposure window (engine rotation convention, docs/SENSOR_ENVIRONMENT_QUERY.md); motion blur is the midpoint quadrature over sensor.temporalSampleCount samples.\");\n if (lensPsf) assume(\"lens.psf\", \"model\", { kind: \"sampled-local\" }, \"Caller-supplied sampled lens PSF redistributes irradiance through the environment PSF quadrature; its evidence and limits are the caller's.\");\n // With lens.diffraction the PSF is recorded as lens.diffraction once its kernels are built.\n else if (diffractionRadiusOption === undefined) assume(\"lens.psf\", \"model\", \"not-applied\", \"No lens PSF or diffraction blur is applied (point optics); the generic tiers' optical data are declared only at f/4.\");\n assume(\"lens.transmission\", \"model\", lens.matchedReference.transmission,\n \"The tier lens's spectrally flat transmission is used at every f-number and focus in the lens capability; the tier declares it only at its f/4, 5 m reference state.\");\n if (!vignetting && !lensFieldMapping) assume(\"lens.fieldThroughput\", \"model\", \"unity\", \"No vignetting, distortion, lateral colour or stray light.\");\n else {\n if (vignetting) assume(\"lens.vignetting\", \"model\", { kind: \"radial-illumination-vignetting\", profile: vignetting },\n \"Caller-declared radial relative illumination 1 + r2·ρ² + r4·ρ⁴ + r6·ρ⁶, applied once as environment field throughput at the physical sensor point before any PSF.\");\n else assume(\"lens.fieldThroughput\", \"model\", \"unity\", \"No vignetting, lateral colour or stray light.\");\n if (distortion) assume(\"lens.distortion\", \"model\", distortion,\n \"Caller-declared \" + distortion.kind + \" distortion: each sensor point is inverse-distorted before the scene-ray query and irradiance is multiplied exactly once by the area factor 1/det(J).\");\n }\n if (projection === undefined) assume(\"lens.projection\", \"default\", \"rectilinear\", \"Ideal rectilinear (pinhole) projection.\");\n else assume(\"lens.projection\", \"model\", projection, \"Ideal \" + projection + \" projection through the environment lens field mapping. At finite focus its scale is the thin-lens image distance (an approximation); the chart is still sized with the rectilinear thin-lens scale, so its edges move with the projection.\");\n\n // White balance\n let whiteBalanceState: ResolvedWhiteBalanceState | null = null, needsAuto = false, kelvinWhiteBalanceInput: Parameters<typeof resolveColorTemperatureWhiteBalance>[0] | undefined;\n if (whiteBalanceOption === \"none\") whiteBalanceState = null;\n else if (whiteBalanceOption === \"auto\") {\n if (region) fail(\"output.region cannot be combined with output.whiteBalance \\\"auto\\\": grey-world statistics of a region differ from the whole frame's.\");\n needsAuto = true;\n }\n else if (whiteBalanceOption === \"scene-illuminant\") whiteBalanceState = sceneIlluminantWhiteBalance(illuminant);\n else if (typeof whiteBalanceOption === \"object\" && whiteBalanceOption !== null && \"kelvin\" in whiteBalanceOption) {\n const wb = allowKeys(whiteBalanceOption, \"output.whiteBalance\", [\"kelvin\", \"tint\"]);\n const intent = createColorTemperatureWhiteBalanceIntent({ intentId: \"facade-wb-cct\", colorTemperatureKelvin: positive(wb.kelvin, \"output.whiteBalance.kelvin\"),\n tint: wb.tint === undefined ? 0 : wb.tint as number });\n const kelvinInput: Parameters<typeof resolveColorTemperatureWhiteBalance>[0] = { stateId: \"facade-wb-cct\", intent, whiteLocus: \"planckian\", tintInterpretation: \"duv-cie-1960-uv\",\n camera: { profileId: IDS.spectral, profileVersion: SIMULATE_CAPTURE_FACADE_VERSION, xyzToCameraRgb: XYZ_TO_CAMERA.map((r) => [...r]) as unknown as Parameters<typeof resolveColorTemperatureWhiteBalance>[0][\"camera\"][\"xyzToCameraRgb\"] } };\n whiteBalanceState = resolveColorTemperatureWhiteBalance(kelvinInput);\n kelvinWhiteBalanceInput = kelvinInput;\n } else if (typeof whiteBalanceOption === \"object\" && whiteBalanceOption !== null && \"channelGains\" in whiteBalanceOption) {\n allowKeys(whiteBalanceOption, \"output.whiteBalance\", [\"channelGains\"]);\n requireInputObject(whiteBalanceOption.channelGains, \"output.whiteBalance.channelGains\");\n allowKeys(whiteBalanceOption.channelGains, \"output.whiteBalance.channelGains\", [\"red\", \"green\", \"blue\"]);\n whiteBalanceState = resolveManualWhiteBalance({ stateId: \"facade-wb-manual\", channelGains: whiteBalanceOption.channelGains });\n } else fail(\"Unknown output.whiteBalance.\");\n const intentOf = (state: ResolvedWhiteBalanceState | null): CaptureWhiteBalanceIntent | null => (state ? createCaptureWhiteBalanceIntent({ state }) : null);\n\n const rendering: SdrRenderingProfile = { schemaVersion: \"0.1.0\", profileId: \"facade-sdr\", profileVersion: \"1\", renderingExposureEv: 0, toneCurve,\n ...(outputOptions.toneCurveParameters === undefined ? {} : { toneCurveParameters: outputOptions.toneCurveParameters as SdrToneCurveParameters }),\n gamutHandling: \"clip-components\", outputDynamicRange: \"sdr\", transferFunction: \"srgb\", bitDepth: format === \"srgb-16\" || (format === \"png\" && !wideGamut && pngBitDepth === 16) ? 16 : 8, rounding: \"nearest-ties-up\", dither: \"none\" };\n if (!linearPath) assume(\"output.rendering\", \"model\", { renderingExposureEv: 0, gamutHandling: \"clip-components\" },\n \"Developed linear sRGB/D65 with the RAW white level mapped to display white, no exposure push, out-of-gamut components clipped.\");\n else assume(\"output.rendering\", \"model\", { renderingExposureEv: 0, gamutHandling: \"clip-components-in-target-gamut\", sdrRendererUsed: false },\n \"The sRGB SDR renderer is not used: the linear development (RAW white level = relative 1.0, no exposure push) is converted to the target encoding; request.development.rendering is validated but only its exposure and tone curve (identity) apply.\");\n // Rendering choices are validated before any radiance work, so a bad tone curve fails fast.\n parseSdrRenderingProfile(rendering);\n if (highlightMode !== \"clip\" && highlightMode !== \"reconstruct\") fail(\"output.highlightMode must be clip or reconstruct.\");\n\n // Frame profiles\n const evidence = FACADE_EVIDENCE;\n const nativeRaster = { pixelWidth: nativeWidth, pixelHeight: nativeHeight };\n const captureModeProfile = { schemaVersion: \"0.1.0\" as const, modes: [{ modeId: IDS.mode, evidence, acquisition: { kind: \"single-frame\" as const },\n perFrameSampling: { kind: \"native-effective-raster\" as const }, reconstructionStages: [], processedImageRaster: { value: nativeRaster, evidence },\n dependencies: [\"color-sampling-model\"] }] } as unknown as NativeRawInput[\"captureModeProfile\"];\n const bindingProfile = { schemaVersion: \"0.1.0\" as const, bindingId: IDS.binding, colorSamplingProfileId: IDS.cfa, nativeRaster, evidence,\n relationship: { kind: \"regular-native-effective-sample-blocks\" as const, sitesPerNativeSampleX: 1, sitesPerNativeSampleY: 1, anchor: \"shared-native-top-left\" as const } };\n const exposureWindow = rollingSchedule ? createRollingShutterCaptureExposureSchedule(rollingSchedule) as unknown as {\n shutterMechanism: \"electronic\"; nominalExposureDurationSeconds: { value: number; unit: \"s\"; evidence: readonly EvidenceProvenance[] };\n opening: { kind: \"simultaneous\" }; closing: { kind: \"simultaneous\" } } :\n { shutterMechanism: \"electronic\" as const, nominalExposureDurationSeconds: { value: shutterSeconds, unit: \"s\" as const, evidence },\n opening: { kind: \"simultaneous\" as const }, closing: { kind: \"simultaneous\" as const } };\n const buildRawInput = (intent: CaptureWhiteBalanceIntent | null): NativeRawInput => buildRawInputFor(intent, geometry, captureModeProfile, bindingProfile, nativeWidth * nativeHeight);\n const buildRawInputFor = (intent: CaptureWhiteBalanceIntent | null, rasterGeometry: typeof geometry, modeProfile: NativeRawInput[\"captureModeProfile\"],\n binding: NativeRawInput[\"bindingProfile\"], sites: number): NativeRawInput => ({\n exposure: { captureId: IDS.capture, sceneStateId: IDS.sceneState, sceneTimeSeconds: 0, geometry: rasterGeometry,\n exposure: { focalLengthMm, aperture: fNumber, shutterSeconds, iso: resolvedIso }, focus: { kind: \"finite\", distanceM: focusDistanceM },\n noise: { seedUint32: noiseSeed, realizationId: \"facade-noise\", model: { ...SENSOR_RAW_PRODUCER_NOISE_MODEL } },\n source: { kind: \"scene-radiance-source\", artifactId: \"facade-scene-\" + scenePreset, sha256: sourceSha256, dynamicRangeHistory: \"no-loss-declared\" },\n whiteBalanceIntent: intent, adoptedWhiteXyz: null,\n models: [{ profile: { id: \"photivra-simulate-capture\", version: SIMULATE_CAPTURE_FACADE_VERSION }, scientificStatus: \"approximation\", publicEvidenceIds: [\"photivra:simulate-capture-facade\"] }] },\n frameId: IDS.frame, modeId: IDS.mode, captureModeProfile: modeProfile, colorSamplingProfile, bindingProfile: binding, exposureWindow,\n maximumOutputBytes: sites * 7, tileWidth, ...(raisedPixels === undefined ? {} : { maximumPixels: raisedPixels }) });\n const sceneBinding = { sceneStateId: IDS.sceneState, providerSceneId: IDS.scene, evidence };\n\n // Shared per-site environment pieces (identical objects for every site keep the native task's shared-state fast path).\n const range = { ...FACADE_SPECTRAL_RANGE_NANOMETERS };\n // EQE breakpoints coincide with the quadrature subintervals, so the quadrature is not split further.\n const eqeSpacing = (range.maximum - range.minimum) / Math.ceil((range.maximum - range.minimum) / spectralStep);\n const eqeSamples = (channel: Channel): { nm: number; value: number }[] => {\n const out: { nm: number; value: number }[] = [];\n for (let nm = range.minimum; nm <= range.maximum + 1e-9; nm += eqeSpacing) out.push({ nm, value: EQE_SCALE[channel] * estimateCie1931ColorMatchingFunctions(nm)[CMF_KEY[channel]] * 555 / nm });\n return out;\n };\n const operatingConditions = { temperatureC: 25, incidenceAngleDegreesFromNormal: 0, polarization: \"unpolarized\" as const };\n // One single-channel response profile per CFA channel keeps each site's response data small.\n const spectralResponseProfiles = Object.fromEntries(CHANNELS.map((only) => [only, { schemaVersion: \"0.1.0\" as const, profileId: IDS.spectral, colorSamplingProfileId: IDS.cfa, evidence,\n channels: [only].map((channelId) => ({ channelId, kind: \"effective-external-quantum-efficiency\" as const, responseScope: \"sensor-package-incident-effective-channel-response\" as const,\n scientificStatus: \"approximation\" as const, uncertainty: { kind: \"not-quantified\" as const, limitation: \"Idealized colorimetric response; not a measured sensor.\" },\n evidence, referenceConditions: operatingConditions, conditionDependence: \"not-modeled\" as const, externalQuantumEfficiency: sampled(eqeSamples(channelId)) })) }])) as Record<Channel, unknown>;\n const apertureArea = pitch * pitch;\n const samplingApertureProfile = { schemaVersion: \"0.1.0\" as const, profileId: IDS.sampling, colorSamplingProfileId: IDS.cfa, colorSamplingBindingId: IDS.binding, evidence,\n siteCenterLattice: { kind: \"regular-rectangular-site-center-lattice\" as const, coordinateSystem: \"native-sensor-physical\" as const, pitchXMicrometers: pitch, pitchYMicrometers: pitch,\n firstSiteCenterFromImagingAreaTopLeftMicrometers: { x: pitch / 2, y: pitch / 2 }, evidence },\n geometricSensitiveAperture: { kind: \"uniform-axis-aligned-rectangle\" as const, widthMicrometers: pitch, heightMicrometers: pitch, centerOffsetFromSiteCenterMicrometers: { x: 0, y: 0 }, evidence } };\n const stackId = antiAliasing ? IDS.stackAa : IDS.stack;\n const opticalStackProfile: SensorOpticalStackProfile = antiAliasing ? { schemaVersion: \"0.1.0\", profileId: stackId, evidence, effectiveAntiAliasingSpatialResponse: {\n kind: \"normalized-point-splitting-kernel\", evidence, coordinateSystem: \"native-sensor-physical\", scope: \"field-wavelength-polarization-invariant-approximation\",\n components: antiAliasing.components } } : { schemaVersion: \"0.1.0\" as const, profileId: IDS.stack, evidence, effectiveAntiAliasingSpatialResponse: { kind: \"absent\" as const, evidence } };\n const perChannel = Object.fromEntries(CHANNELS.map((channelId) => [channelId, {\n applicationProfile: { schemaVersion: \"0.1.0\" as const, profileId: \"facade-application-\" + channelId, spectralResponseProfileId: IDS.spectral, colorSamplingProfileId: IDS.cfa, channelId,\n samplingApertureProfileId: IDS.sampling, opticalStackProfileId: stackId, evidence, incidentAreaBasis: { kind: \"geometric-sensitive-aperture\" as const, areaSquareMicrometers: apertureArea },\n spatialResponseModel: { kind: \"uniform-over-geometric-sensitive-aperture\" as const, scientificStatus: \"approximation\" as const, evidence, limitation: \"Uniform response over the square aperture.\" },\n referenceConditionPolicy: { kind: \"exact-match-required\" as const } },\n operatingRangeProfile: { schemaVersion: \"0.1.0\" as const, profileId: \"facade-linearity-\" + channelId, responseApplicationProfileId: \"facade-application-\" + channelId,\n spectralResponseProfileId: IDS.spectral, colorSamplingProfileId: IDS.cfa, channelId, scientificStatus: \"approximation\" as const,\n uncertainty: { kind: \"not-quantified\" as const, limitation: \"Declared linear photo response for the idealized sensor.\" }, evidence,\n inputRange: { kind: \"wavelength-integrated-geometric-aperture-radiant-power\" as const, unit: \"W\" as const, minimumInclusive: 0, maximumInclusive: 1 },\n wavelengthApplicability: { wavelengthBasis: \"vacuum\" as const, minimumNanometers: range.minimum, maximumNanometers: range.maximum, containment: \"requested-range-must-be-contained\" as const },\n linearityCriterion: { maximumAbsoluteRelativeDeviation: 0.01 },\n spatialLinearityModel: { kind: \"linear-superposition-over-geometric-aperture\" as const, scientificStatus: \"approximation\" as const, evidence, limitation: \"Declared linear superposition.\" },\n spectralInputModel: { kind: \"per-spectral-bin\" as const, maximumBinWidthNanometers: Math.max(spectralStep, 20), scientificStatus: \"approximation\" as const, evidence, limitation: \"Declared per-bin linearity.\" },\n referenceConditions: operatingConditions, referenceConditionPolicy: { kind: \"exact-match-required\" as const } } }])) as Record<Channel, { applicationProfile: unknown; operatingRangeProfile: unknown }>;\n const sourcePlane = { value: \"sensor-package-incident\" as const, evidence };\n const localExposure = { bindingProfile, exposureWindowInput: { ...exposureWindow, nativeRaster } };\n const sceneBindings = {\n illuminationProfile: { schemaVersion: \"0.1.0\" as const, profileId: IDS.lights, sceneId: IDS.scene, evidence, sources: [{ sourceId: \"illuminant\", family: \"environment\" as const,\n enabled: true, geometry: { kind: \"environment\" as const }, magnitude: { kind: \"relative-linear-scale\" as const, scale: 1, scientificStatus: \"approximation\" as const,\n limitation: \"Absolute level is carried by the provider radiance (\" + illuminanceLux + \" lux).\" },\n spectrum: { kind: \"unresolved\" as const, limitation: \"Spectral radiance is supplied numerically by the provider (\" + illuminant.id + \").\" },\n temporalBehavior: { kind: \"time-invariant\" as const }, evidence }] },\n materialResponseProfile: { schemaVersion: \"0.1.0\" as const, profileId: IDS.materials, sceneId: IDS.scene, evidence, materials: [{ materialResponseId: \"facade-surface\", evidence,\n representation: { kind: \"spectral-wavelength-preserving-data\" as const, dataArtifact: { id: \"facade-scene-\" + scenePreset, checksumSha256: sourceSha256 },\n wavelengthBasis: \"vacuum\" as const, wavelengthRangeNanometers: range, scatteringModel: \"provider-defined-wavelength-preserving\" as const, scientificStatus: \"approximation\" as const,\n uncertainty: { kind: \"not-quantified\" as const, limitation: \"Analytic Lambertian reflectance.\" }, wavelengthChangingBehaviorModeled: false, emissionModeled: false } }],\n fluorescenceModeled: false, volumetricMaterialTransportModeled: false, polarizationModeled: false },\n providerProfile: { schemaVersion: \"0.1.0\" as const, profileId: IDS.provider, sceneId: IDS.scene, illuminationProfileId: IDS.lights, materialResponseProfileId: IDS.materials,\n outputQuantity: \"outgoing-spectral-radiance\" as const, outputUnit: \"W/m^2/sr/nm\" as const, scientificStatus: \"approximation\" as const,\n uncertainty: { kind: \"not-quantified\" as const, limitation: \"Analytic planar scene.\" },\n fidelity: { spectral: \"wavelength-resolved\" as const, material: \"spectral-data\" as const, visibility: \"resolved\" as const, directTransport: \"approximation\" as const, indirectTransport: \"not-modeled\" as const },\n wavelengthChangingTransportModeled: false, volumetricTransportModeled: false, polarizationModeled: false, evidence, limitations: [\"Engine-authored planar chart or caller scene function.\",\n ...(diffractionObjectSpace ? [\"Radiance is the scene radiance convolved with the lens diffraction PSF mapped onto the scene plane (object-space convolution, request.diffraction).\"] : []),\n ...(defocusKernel ? [\"Radiance is the scene radiance convolved with the geometric defocus disc mapped onto the scene plane (object-space convolution, lens.defocus).\"] : [])] } };\n const lensId = lensExposure.profileId;\n const opticsProfile = { schemaVersion: \"0.1.0\" as const, profileId: lensId + \":facade-transmission\", profileVersion: SIMULATE_CAPTURE_FACADE_VERSION, lensProfileId: lensId,\n scientificStatus: \"approximation\" as const, applicability: { focalLengthMm: { minimum: capabilities.selectedFocalLengthMm, maximum: capabilities.selectedFocalLengthMm },\n nominalFNumber: { minimum: capabilities.aperture.widestAvailableFNumber, maximum: capabilities.aperture.narrowestAvailableFNumber }, focus: { kind: \"any\" as const } },\n transmission: { kind: \"spectral-transmission\" as const, scientificStatus: \"approximation\" as const, wavelengthBasis: \"vacuum\" as const,\n samples: { value: [{ wavelengthNanometers: range.minimum, linearTransmissionFactor: lens.matchedReference.transmission },\n { wavelengthNanometers: range.maximum, linearTransmissionFactor: lens.matchedReference.transmission }], evidence: preset.evidence },\n uncertainty: { kind: \"not-quantified\" as const, limitation: \"Synthetic spectrally flat transmission from the tier preset.\" } },\n distortionAreaMappingOwnership: \"not-applied-by-bridge\" as const, psfRedistributionOwnership: \"downstream-normalized-energy-redistribution\" as const,\n sensorOpticalStackIncluded: false, strayLightIncluded: false, polarizationModeled: false, wavelengthChangingBehaviorModeled: false, volumetricScatteringModeled: false,\n evidence: preset.evidence, limitations: [...lens.limitations, \"Flat transmission applied across the lens capability by the capture facade.\"] };\n const optics = { profile: opticsProfile, focalLengthMm, nominalFNumber: fNumber,\n focus: { kind: \"ideal-symmetric-thin-lens\" as const, objectDistanceM: focusDistanceM, pupilMagnificationAssumption: \"unity\" as const } };\n const motion = { angularVelocityRadPerSec: angular, timeReference: \"first-opening-boundary-phase\" as const, environmentDirectionConvention: \"outgoing-radiance-toward-camera\" as const };\n const fieldThroughput = vignetting ? { kind: \"radial-illumination-vignetting\" as const, profile: vignetting, evidence,\n limitation: \"Caller-declared radial relative illumination applied by the capture facade; not a measured lens.\" } :\n { kind: \"unity\" as const, evidence, limitation: \"No vignetting or field throughput loss applied by the facade.\" };\n const spectralSamplingByChannel = Object.fromEntries(CHANNELS.map((channelId) => [channelId, { channelId, wavelengthBasis: \"vacuum\" as const, wavelengthRangeNanometers: range,\n maximumSubintervalWidthNanometers: spectralStep }])) as Record<Channel, unknown>;\n // Diffraction (2.1): Airy kernels at the resolved f-number on the site pitch, one per spectral node of the sensor quadrature.\n let diffraction: DiffractionLimitedPsfProfile | undefined, diffractionPsf: typeof lensPsf | undefined;\n // The spectral nodes of the sensor quadrature, over all channels, ascending.\n const quadratureWavelengths = (): number[] => [...new Set(CHANNELS.flatMap((channelId) => calculateSensorSpectralQuadrature({ ...(spectralSamplingByChannel[channelId] as { channelId: string;\n wavelengthBasis: \"vacuum\"; wavelengthRangeNanometers: { minimum: number; maximum: number }; maximumSubintervalWidthNanometers: number }), colorSamplingProfile,\n spectralResponseProfile: spectralResponseProfiles[channelId] as never }).value.nodes.map((node) => node.wavelengthNanometers)))].sort((a, b) => a - b);\n if (diffractionRadiusOption !== undefined) {\n const wavelengths = quadratureWavelengths();\n const lambdaN = wavelengths[wavelengths.length - 1]! / 1000 * fNumber * imageDistanceMm / focalLengthMm;\n // The environment resolves the PSF at each pre-filter source point, up to the largest split offset outside the imaging area.\n const aaReachMm = antiAliasing ? Math.max(...antiAliasing.components.map((c) => Math.max(Math.abs(c.offsetMicrometers.x), Math.abs(c.offsetMicrometers.y)))) / 1000 : 0;\n // The default reach is capped at the 32-site convolution limit; a capped window ends inside the third dark ring, and the\n // larger tail energy outside it is listed per wavelength like any other (2.2.1 states the cap in the explanation).\n const thirdRingSites = Math.max(1, Math.ceil(AIRY_THIRD_ZERO_PER_LAMBDA_N * lambdaN / pitch));\n const kernelRadiusSamples = diffractionRadiusOption ?? Math.min(32, thirdRingSites);\n const profileInput = { aperture: \"circular\" as const, focalLengthMm, apertureFNumber: fNumber, focus: { kind: \"finite\" as const, distanceM: focusDistanceM },\n wavelengthsNm: wavelengths, samplePitchMicrometers: pitch, kernelRadiusSamples, fieldHalfExtentMm: aaReachMm === 0 ? { x: imagingArea.widthMm / 2, y: imagingArea.heightMm / 2 } :\n { x: imagingArea.widthMm / 2 + aaReachMm, y: imagingArea.heightMm / 2 + aaReachMm },\n profileId: \"facade-diffraction-airy\" };\n // #449: a copy of the profile kept for this input; it equals createDiffractionLimitedPsfProfile(profileInput).value field by\n // field, so the registration below (keyed by profileInput) holds for it.\n diffraction = cachedDiffractionProfile(profileInput);\n diffractionPsf = { kind: \"sampled-local\", configuration: { psf: { profile: diffraction.profile, focalLengthMm, focus: { kind: \"finite\", distanceM: focusDistanceM },\n apertureFNumber: fNumber, signedDefocusImagePlaneMicrometers: 0 }, psfWavelengthBasis: { value: \"vacuum\", evidence },\n spatialModel: { kind: \"destination-local-shift-invariant-approximation\", evidence, limitation: \"Diffraction-limited Airy PSF, the same at every field point.\" } } };\n // Requests with the same profile input and PSF fields share their site diffraction kernels (optics/site-diffraction-kernel.ts).\n registerDiffractionPsfKey(diffractionPsf.configuration.psf, profileInput);\n assume(\"lens.diffraction\", \"model\", { model: diffraction.model, aperture: \"circular-aperture\", fNumber, workingFNumber: diffraction.workingFNumber,\n kernelRadiusSamples, samplePitchMicrometers: pitch, maximumTruncatedEnergyFraction: diffraction.maximumTruncatedEnergyFraction,\n truncatedEnergyByWavelength: diffraction.wavelengths.map((w) => ({ wavelengthNm: w.wavelengthNm, truncatedEnergyFraction: w.truncatedEnergyFraction })),\n execution: diffractionObjectSpace ? \"object-space-convolution\" : \"environment-psf-quadrature\" },\n \"Scalar Fraunhofer diffraction of an ideal, aberration-free circular pupil (Airy pattern, createDiffractionLimitedPsfProfile) at the resolved f-number, in focus, with D = f/N and the thin-lens image distance (working f-number N·v/f). \" +\n \"One kernel per spectral node, binned into site-sized cells over a \" + (2 * kernelRadiusSamples + 1) + \" × \" + (2 * kernelRadiusSamples + 1) + \" window\" +\n (diffractionRadiusOption !== null ? \"\" : thirdRingSites > 32 ? \" (capped at 32 sites; the third dark ring at the longest node needs \" + thirdRingSites + \")\" :\n \" (reaching the third dark ring at the longest node)\") + \"; the Airy tail energy outside it (listed per wavelength) is put back by unit-sum renormalization. \" +\n (diffractionObjectSpace ? \"Applied as an object-space convolution: the scene radiance on the site lattice is convolved once per spectral node (calculateIrradianceConvolution) and the provider answers each site query with it, so the site inputs declare no PSF; this equals the per-tap environment PSF quadrature for this still, distortion-free planar scene (request.diffraction.psf). \" :\n \"Applied through the environment PSF quadrature (one scene query per kernel tap), because camera rotation, a lens field mapping or vignetting moves the taps off the site lattice. \") +\n \"No defocus, aberration or pupil clipping; \" + (boxAperture ? \"the pixel aperture is integrated as declared by sensor.pixelAperture.\" : \"the sensor pixel aperture is still point-sampled at the site centre.\"));\n }\n // #492: each spectral node's kernel for lens.defocus out of focus: the disc, or with lens.diffraction (always on the object-space path here)\n // the node's diffraction kernel convolved with the disc, radius R_diffraction + R_defocus (built on first use, kept for the request).\n let defocusSiteKernels: { radius: number; wavelengthsNm: readonly number[]; at(wavelengthNm: number): Float64Array } | undefined;\n if (defocusKernel) {\n if (diffraction) {\n const diffractionRadius = diffraction.kernelRadiusSamples, combined = new Map<number, Float64Array>(), profileWavelengths = diffraction.profile.axes.wavelengthNm;\n const radius = diffractionRadius + defocusKernel.radius;\n // At most 32 + 64 = 96 sites (the two caps). Neither the expected-signal table nor the provider's own gather (diffraction-provider.ts)\n // uses the public 32-site limit of calculateIrradianceConvolution; the combination costs at most about 0.1 s per spectral node\n // (measured, docs/QUICK_START.md \"Optics\"), so no tighter limit applies.\n const psfConfiguration = diffractionPsf!.configuration.psf;\n defocusSiteKernels = { radius, wavelengthsNm: profileWavelengths, at(wavelengthNm: number): Float64Array {\n let kernel = combined.get(wavelengthNm);\n if (!kernel) {\n if (!profileWavelengths.includes(wavelengthNm)) fail(\"simulateCapture: a spectral node has no diffraction kernel.\");\n kernel = convolveSiteKernels(siteDiffractionKernel(psfConfiguration, wavelengthNm, pitch, diffractionRadius, \"simulateCapture: diffraction kernels must sample the site pitch exactly.\"),\n diffractionRadius, defocusKernel.weights, defocusKernel.radius);\n combined.set(wavelengthNm, kernel);\n }\n return kernel;\n } };\n } else defocusSiteKernels = { radius: defocusKernel.radius, wavelengthsNm: quadratureWavelengths(), at: (): Float64Array => defocusKernel.weights };\n }\n const psf = lensPsf ?? (diffractionObjectSpace ? { kind: \"not-applied\" as const, evidence,\n limitation: \"No environment PSF: lens diffraction is applied upstream by the scene provider as an object-space convolution (request.diffraction).\" } : undefined) ??\n diffractionPsf ?? (defocusSiteKernels ? { kind: \"not-applied\" as const, evidence,\n limitation: \"No environment PSF: lens defocus is applied upstream by the scene provider as an object-space convolution (lens.defocus).\" } : undefined) ??\n { kind: \"not-applied\" as const, evidence, limitation: \"No lens PSF (point optics).\" };\n const pupilRecord = pupil ? { kind: \"ideal-uniform-circular-pupil\" as const, radialSampleCount: pupil.radialSamples, angularSampleCount: pupil.angularSamples, evidence,\n limitation: \"Ideal uniform circular pupil; finite ray sampling, no convergence claim.\" } : undefined;\n const chargeSamplingProfile = { schemaVersion: \"0.1.0\" as const, profileId: IDS.chargeSampling, completenessProfileId: IDS.completeness, scientificStatus: \"approximation\" as const,\n photoShotNoiseModel: \"poisson\" as const, darkShotNoiseModel: \"poisson\" as const, additionalComponentPolicies: [], evidence, limitations: [\"Poisson photo and dark shot noise.\"] };\n const channelAt = (x: number, y: number): Channel => ([\"red\", \"green\", \"green\", \"blue\"] as const)[(y % 2) * 2 + (x % 2)]!;\n function siteInput(index: number): SimulateEnvironmentSensorRawFrameInput[\"sites\"][number] {\n if (!Number.isSafeInteger(index) || index < 0 || index >= nativeWidth * nativeHeight) fail(\"Native site index out of range.\");\n const x = index % nativeWidth, y = Math.floor(index / nativeWidth), channel = channelAt(x, y), site = { x, y }, c = perChannel[channel], r = regimeByChannel[channel];\n const environment = { temporalIntegrationId: IDS.frame + \":native:\" + index,\n sensor: { spatialSampling: { imagingArea, samplingApertureProfile, opticalStackProfile, site, spatialSampleCountX: boxSamples, spatialSampleCountY: boxSamples },\n spectralSampling: spectralSamplingByChannel[channel], colorSamplingProfile, spectralResponseProfile: spectralResponseProfiles[channel],\n responseApplication: { applicationProfile: c.applicationProfile, sourcePlane, operatingConditions }, operatingRangeProfile: c.operatingRangeProfile, localExposure },\n sceneBindings, optics, motion, temporalSampleCount, fieldThroughput, psf, ...(pupilRecord ? { pupil: pupilRecord } : {}), ...(lensFieldMapping ? { lensFieldMapping } : {}) };\n // The charge completeness profile must cover the site's own exposure window (shifted by s·τ under a rolling shutter).\n const window = rollingSchedule ? calculateCaptureExposureWindows({ ...exposureWindow, nativeRaster, samplePointsNative: [{ x: x + 0.5, y: y + 0.5 }] }).value.samples[0]! :\n { startOffsetSecondsFromOpeningReference: 0, endOffsetSecondsFromOpeningReference: shutterSeconds };\n return { environment, operatingTemperatureC: OPERATING_TEMPERATURE_C,\n darkCurrentProfile: { schemaVersion: \"0.1.0\", profileId: IDS.dark, colorSamplingProfileId: IDS.cfa, channelId: channel, scientificStatus: \"approximation\", evidence,\n uncertainty: { kind: \"not-quantified\", limitation: \"Synthetic dark current for the capture facade.\" }, chargeMeaning: \"pre-compensation-thermally-generated-electrons\",\n siteApplicability: { kind: \"exact-site\", site }, temperatureModel: { kind: \"fixed-reference-temperature\", referenceTemperatureC: OPERATING_TEMPERATURE_C,\n darkCurrentElectronsPerSecond: DARK_CURRENT_ELECTRONS_PER_SECOND }, darkCurrentCompensationIncluded: false, spatialDarkCurrentNonuniformityModeled: false },\n charge: { completenessProfile: { schemaVersion: \"0.1.0\", profileId: IDS.completeness, colorSamplingProfileId: IDS.cfa, channelId: channel, site, bindingId: IDS.binding,\n timeReference: \"first-opening-boundary-phase\", startOffsetSecondsFromOpeningReference: window.startOffsetSecondsFromOpeningReference,\n endOffsetSecondsFromOpeningReference: window.endOffsetSecondsFromOpeningReference,\n darkCurrentProfileId: IDS.dark, includedAdditionalComponentIds: [], coverageMeaning: \"all-material-stored-electron-contributors-accounted-for\",\n scientificStatus: \"approximation\", evidence, limitation: \"Photo and dark charge only.\" } },\n readout: { samplingProfile: chargeSamplingProfile, capacityProfile: { schemaVersion: \"0.1.0\", profileId: IDS.capacity, colorSamplingProfileId: IDS.cfa, channelId: channel,\n capacityMeaning: \"physical-charge-storage-capacity-electrons\", capacityElectrons, scientificStatus: \"approximation\",\n uncertainty: { kind: \"not-quantified\", limitation: \"Derived from the tier's declared saturation signal.\" }, evidence, siteApplicability: { kind: \"exact-site\", site },\n operatingState: { stateId: IDS.operatingState, evidence }, temperatureApplicability: { kind: \"exact-reference-temperature\", temperatureC: OPERATING_TEMPERATURE_C } },\n operatingStateId: IDS.operatingState, readoutProfile: r.readoutProfile, regimeId: r.regimeId } } as unknown as SimulateEnvironmentSensorRawFrameInput[\"sites\"][number];\n }\n const readTile = async (request: { captureId: string; frameId: string; x: number; y: number; width: number; height: number }): Promise<NativeEnvironmentRawTile> =>\n ({ ...request, sites: Array.from({ length: request.width }, (_, j) => siteInput(request.y * nativeWidth + request.x + j)) });\n const yieldControl = createHostYield().yieldControl;\n const perSite = queriesPerSite * (diffraction && psf === diffractionPsf ? (2 * diffraction.kernelRadiusSamples + 1) ** 2 : 1);\n let diffractionMs = 0, defocusMs = 0, demosaicMs: number | undefined, encodeMs: number | undefined;\n const diffractedProvider = (window: { x: number; y: number; width: number; height: number } | undefined): PlanarSceneRadianceProvider =>\n defocusSiteKernels ? createDiffractedPlanarProvider({ base: provider, siteKernels: defocusSiteKernels.at,\n wavelengthsNm: defocusSiteKernels.wavelengthsNm, kernelRadius: defocusSiteKernels.radius, nativeWidth, nativeHeight, outputWidth: width,\n sitePitchMicrometers: pitch, distanceM: subjectDistanceM, metresPerFrameUnit, onConvolution: (ms) => { defocusMs += ms; },\n ...(window ? { window } : {}),\n ...(antiAliasing || boxSamples > 1 ? { queryOffsetsSites: apertureNodeOffsets(boxSamples).flatMap((node) =>\n (antiAliasing ? antiAliasing.components : [{ offsetMicrometers: { x: 0, y: 0 } }]).map((c) => ({ x: node.x - c.offsetMicrometers.x / pitch, y: node.y - c.offsetMicrometers.y / pitch }))) } : {}) }) :\n diffraction && diffractionObjectSpace ? createDiffractedPlanarProvider({ base: provider, psf: diffractionPsf!.configuration.psf,\n wavelengthsNm: diffraction.profile.axes.wavelengthNm, kernelRadius: diffraction.kernelRadiusSamples, nativeWidth, nativeHeight, outputWidth: width,\n sitePitchMicrometers: pitch, distanceM: subjectDistanceM, metresPerFrameUnit, onConvolution: (ms) => { diffractionMs += ms; },\n // Region (2.6): convolve only the lattice the region's native sites query; the values are the whole render's.\n ...(window ? { window } : {}),\n // The environment queries each site at each aperture node minus each split offset (sites, +x right, +y down).\n ...(antiAliasing || boxSamples > 1 ? { queryOffsetsSites: apertureNodeOffsets(boxSamples).flatMap((node) =>\n (antiAliasing ? antiAliasing.components : [{ offsetMicrometers: { x: 0, y: 0 } }]).map((c) => ({ x: node.x - c.offsetMicrometers.x / pitch, y: node.y - c.offsetMicrometers.y / pitch }))) } : {}) }) : provider;\n // Built on first use: a capture that takes the tabulated path (#394 step 2) never queries it, and its kernels cost a setup.\n let rawProviderBuilt: PlanarSceneRadianceProvider | undefined;\n const rawProvider = (): PlanarSceneRadianceProvider => (rawProviderBuilt ??= diffractedProvider(regionNative));\n if (antiAliasing && perSite > 100_000) fail(\"sensor.antiAliasing with these options needs \" + perSite + \" scene queries per site; the environment admits at most 100000.\");\n const evaluations = nativeWidth * nativeHeight * perSite;\n // The native task admits at most 100 000 radiance queries per tile.\n const tileWidth = Math.max(1, Math.min(256, Math.floor(100_000 / perSite)));\n const environmentRaw: NativeEnvironmentRawInput = { raw: buildRawInput(intentOf(whiteBalanceState)), sceneBinding,\n maximumProviderEvaluations: Math.min(nativeRawMaximumProviderEvaluations(raisedPixels === undefined ? {} : { maximumPixels: raisedPixels }),\n Math.max(nativeWidth * nativeHeight, evaluations)) };\n\n // The facade's environment chain at a site next to the optical axis, shared by the ideal reference (2.3) and the display\n // view: expected electrons per unit spectral radiance per channel and node, and the normalized RAW signal per electron.\n function axisChannelResponse(caller: string): { electronsPerRadiance: Record<Channel, Map<number, number>>; wavelengths: number[]; relativePerElectron: Record<Channel, number> } {\n // 1. Electrons per unit spectral radiance at each spectral node, per channel: the facade's own environment chain at a\n // site next to the optical axis, with the ideal optics (no PSF, pupil, distortion, vignetting or motion). The signal\n // is linear in the radiance node values and, for this planar scene, the same at every site (paraxial π/(4N_w²)).\n const cx = Math.floor(nativeWidth / 2) & ~1, cy = Math.floor(nativeHeight / 2) & ~1;\n const channelSites: Record<Channel, number> = { red: cy * nativeWidth + cx, green: cy * nativeWidth + Math.min(cx + 1, nativeWidth - 1), blue: Math.min(cy + 1, nativeHeight - 1) * nativeWidth + Math.min(cx + 1, nativeWidth - 1) };\n const environments = {} as Record<Channel, Record<string, unknown>>;\n for (const channel of CHANNELS) {\n if (channelAt(channelSites[channel] % nativeWidth, Math.floor(channelSites[channel] / nativeWidth)) !== channel) fail(caller + \" needs at least a 2 × 2 native raster.\");\n const environment = { ...(siteInput(channelSites[channel]).environment as unknown as Record<string, unknown>) };\n environment.psf = { kind: \"not-applied\", evidence, limitation: \"Ideal reference: no lens PSF.\" };\n environment.fieldThroughput = { kind: \"unity\", evidence, limitation: \"Ideal reference: no vignetting.\" };\n environment.motion = { ...motion, angularVelocityRadPerSec: { pitch: 0, yaw: 0, roll: 0 } };\n environment.temporalSampleCount = 1;\n delete environment.pupil;\n delete environment.lensFieldMapping;\n delete environment.evaluateRadiance;\n delete environment.evaluateApertureRadiance;\n environments[channel] = environment;\n }\n // The responses are a function of these records without their scene bindings: the radiance is replaced at every node,\n // and the bindings (provider, illumination and material profiles) are only checked, never enter a number. So a chart,\n // illuminant or illuminance change keeps the entry (#443). A request split into region tiles builds the same records for\n // every tile. The entries are kept across calls (the last CHANNEL_RESPONSE_CACHE_SIZE).\n const key = JSON.stringify(CHANNELS.map((c) => ({ ...environments[c], sceneBindings: undefined })));\n const copy = (responses: Record<Channel, Map<number, number>>): Record<Channel, Map<number, number>> => Object.fromEntries(CHANNELS.map((c) => [c, new Map(responses[c])])) as Record<Channel, Map<number, number>>;\n const cached = channelResponseCache.get(key);\n let electronsPerRadiance: Record<Channel, Map<number, number>>;\n if (cached) {\n channelResponseCache.delete(key);\n channelResponseCache.set(key, cached);\n electronsPerRadiance = copy(cached);\n } else {\n electronsPerRadiance = {} as Record<Channel, Map<number, number>>;\n // One chain execution per channel, each node's electrons read from its own rate term (#443; exact, see channel-response.ts).\n // The records are built above for this call only, so they are planned as engine-owned data.\n for (const channel of CHANNELS) electronsPerRadiance[channel] = calculateChannelElectronsPerRadiance(environments[channel], (request) => provider.evaluateRadiance(request), caller);\n // Callers get their own maps; the cached ones are never handed out.\n channelResponseCache.set(key, copy(electronsPerRadiance));\n if (channelResponseCache.size > CHANNEL_RESPONSE_CACHE_SIZE) channelResponseCache.delete(channelResponseCache.keys().next().value!);\n }\n const wavelengths = [...new Set(CHANNELS.flatMap((c) => [...electronsPerRadiance[c].keys()]))].sort((a, b) => a - b);\n // 2. Electrons → normalized RAW signal: (code − black)/(white − black) = e·d/(G·(W − B)) for the linear readout\n // (conversion gain G e⁻/DN, digital gain d, black B, effective white W of the capture's readout regime).\n const relativePerElectron = {} as Record<Channel, number>;\n for (const channel of CHANNELS) {\n const { readoutProfile, regimeId } = regimeByChannel[channel];\n const regime = resolveSensorReadoutRegime({ profile: readoutProfile as Parameters<typeof resolveSensorReadoutRegime>[0][\"profile\"], regimeId }).regime;\n const gain = regime.systemConversionGainElectronsPerCode.value, digitalGain = regime.adc.digitalGain ?? 1, black = regime.adc.blackLevelCode;\n const white = calculateSiteEffectiveSaturationCode({ physicalChargeCapacityElectrons: capacityElectrons, preAdcSaturationElectronEquivalent: regime.preAdcSaturationElectronEquivalent.value,\n systemConversionGainElectronsPerCode: gain, blackLevelCode: black, digitalSaturationCode: regime.adc.digitalSaturationCode, adcMaximumCode: 2 ** regime.adc.bitDepth - 1, digitalGain },\n readoutProfile as Parameters<typeof calculateSiteEffectiveSaturationCode>[1], regimeId);\n relativePerElectron[channel] = digitalGain / (gain * (white - black));\n }\n return { electronsPerRadiance, wavelengths, relativePerElectron };\n }\n // Display view: the renderer that simulate-display-view.ts passes in reads this request's resolved state, so a bundle\n // that only captures does not contain the display view.\n if (displayView) return await renderView!({ ahd, fastReport, antiAliasing, aspect, assume, assumptions, axisChannelResponse, boxSamples, buildProvider, callerScene, chart, materialLayers, chartReport, chartSize, diffraction, defocus: displayViewDefocus, diffractionPsf, fNumber, focalLengthMm, focusDistanceM, height, highlightMode, illuminanceLux, illuminant, illuminantOption, imagingArea, intentOf, metresPerFrameUnit, noiseSeed, outputOptions, parsedView, pitch, preset, provider, regimeByChannel, resolvedIso, isoReport, standardExposureDeviationStops: exposureDeviationStops, sceneOption, scenePreset, shutterSeconds, started, subjectDistanceM, toneCurve, whiteBalanceOption, whiteBalanceState, width, checkAbort, margin, mode, nativeHeight, nativeWidth, sourceSha256, yieldControl, kelvinWhiteBalanceInput });\n // Ideal reference (2.3): the scene without camera effects, at the capture's own exposure, white balance and encoding.\n if (idealReference) {\n const referenceStarted = clockMs();\n if (format !== \"srgb-8\" && format !== \"srgb-16\" && format !== \"png\") fail(\"simulateIdealReference supports output.format srgb-8, srgb-16 and png: a reference has no RAW (dng) and should not carry JPEG compression artefacts.\");\n if (needsAuto) fail(\"simulateIdealReference cannot reproduce output.whiteBalance \\\"auto\\\": the capture measures it from its noisy RAW. Use \\\"scene-illuminant\\\" or a fixed white balance.\");\n const { electronsPerRadiance, wavelengths, relativePerElectron } = axisChannelResponse(\"simulateIdealReference\");\n // 3. Scene radiance per sample: chart materials once (and the fixed-size chart's surround), caller functions per sample.\n const signalOf = (radiance: (nm: number) => number): [number, number, number] => {\n const values = new Map(wavelengths.map((nm) => [nm, radiance(nm)]));\n return CHANNELS.map((c) => { let e = 0; for (const [nm, a] of electronsPerRadiance[c]) e += a * values.get(nm)!; return e * relativePerElectron[c]; }) as [number, number, number];\n };\n const materialCount = chart ? chart.materials.length : callerScene?.kind === \"material-function\" ? callerScene.materials.length : 0;\n const materialSignals = provider.chartMaterialAt ? Array.from({ length: materialCount + (chartSize ? 1 : 0) }, (_, m) => signalOf((nm) => provider.materialRadiance!(m, nm))) : undefined;\n // 4. Pixels: the native sites of the output (or region) pixels, each centre-sampled or box-integrated like the capture.\n const x0 = (region ? region.x : 0) + margin, y0 = (region ? region.y : 0) + margin, n = boxSamples, unit = 2 / width;\n const referenceIntent = intentOf(whiteBalanceState), referenceGains = referenceIntent ? [referenceIntent.channelGains.red, referenceIntent.channelGains.green, referenceIntent.channelGains.blue] : null;\n const development = prepareSensorColorDevelopment(CAMERA_TO_XYZ as unknown as Parameters<typeof prepareSensorColorDevelopment>[0],\n referenceGains, highlightMode);\n const rgb = new Float64Array(outputWidth * outputHeight * 3), counts = { whiteBalanceClippedSampleCount: 0, reconstructedPixelCount: 0 }, sum = [0, 0, 0];\n for (let py = 0; py < outputHeight; py++) {\n for (let px = 0; px < outputWidth; px++) {\n sum[0] = 0; sum[1] = 0; sum[2] = 0;\n for (let l = 0; l < n; l++) for (let k = 0; k < n; k++) {\n const u = (x0 + px + (k + 0.5) / n - nativeWidth / 2) * unit, v = -(y0 + py + (l + 0.5) / n - nativeHeight / 2) * unit;\n const s = materialSignals ? materialSignals[provider.chartMaterialAt!(u, v)]! : signalOf((nm) => provider.radianceAt(u, v, nm));\n sum[0] += s[0]; sum[1] += s[1]; sum[2] += s[2];\n }\n // Normalized RAW values saturate at the white level, as in development.\n const c = sum.map((value) => Math.min(1, Math.max(0, value / (n * n))));\n development.developInto(c[0]!, c[1]!, c[2]!, rgb, (py * outputWidth + px) * 3, counts);\n }\n if ((py & 15) === 15) { await yieldControl(); checkAbort(); }\n }\n let samples: Uint8Array | Uint16Array;\n if (!linearPath) {\n const maximum = 2 ** rendering.bitDepth - 1, tone = prepareSdrPixelTone(rendering), scratch = new Float64Array(3);\n samples = rendering.bitDepth === 8 ? new Uint8Array(rgb.length) : new Uint16Array(rgb.length);\n const sdrCounts: SdrPixelCounts = { negative: 0, above: 0, changed: 0, low: 0, high: 0, outOfGamut: false };\n for (let y = 0; y < outputHeight; y++) renderSdrRunInto(rgb, y * outputWidth * 3, outputWidth, rendering, tone, 2 ** rendering.renderingExposureEv, maximum, samples, y * outputWidth * 3, scratch, sdrCounts);\n } else {\n const mapping = perceptual ? prepareRgbGamutMapping({ colorSpace: colorEncoding!, method: \"cielab-hue-preserving-chroma-compression\", kneeFraction: PERCEPTUAL_GAMUT_KNEE_FRACTION }) : undefined;\n samples = encodeSdrFromLinear(rgb, colorEncoding!, pngBitDepth!, mapping).samples;\n }\n const encodedPng = format === \"png\" ? serializePngImage({ width: outputWidth, height: outputHeight, bitDepth: pngBitDepth!, samples, colourEncoding: pngColourEncoding(colorEncoding!),\n ...(raisedPixels === undefined || outputWidth * outputHeight <= PNG_ENCODER_LIMITS.maximumPixels ? {} : { maximumPixels: raisedPixels }) }) : undefined;\n const png = encodedPng && textMetadata ? addPngTextMetadata(encodedPng, textMetadata) : encodedPng;\n if (png) assumeTextMetadata(TEXT_METADATA_LAYOUT.png);\n const referenceMs = clockMs() - referenceStarted;\n assume(\"reference.kind\", \"model\", \"ideal-reference\",\n \"An ideal reference, not a capture: the same scene, framing, chart size, output size, region and pixel grid as the capture request, with no camera effects.\");\n assume(\"reference.excludes\", \"model\", [\"lens PSF, diffraction, defocus and pupil sampling\", \"projection and distortion (ideal rectilinear mapping)\", \"vignetting\", \"anti-aliasing filter\",\n \"colour filter mosaic and demosaicing (every pixel has all three channels)\", \"photon, dark and read noise\", \"dark signal\", \"ADC rounding and non-linearity\", \"camera motion and rolling shutter\"],\n \"None of these is applied; each pixel's channels come from the scene radiance at the pixel alone.\");\n assume(\"reference.exposure\", \"model\", { convention: \"exposure-matched\", fNumber, shutterSeconds, iso: resolvedIso, illuminanceLux,\n normalizedSignalPerElectron: { ...relativePerElectron } },\n \"Exposure-matched: each channel is the expected (noise-free) signal the capture's own sensor would record at the resolved exposure (f-number, shutter, ISO, illuminance and lens transmission; the facade's environment chain at the optical axis), \" +\n \"normalized like the RAW development ((code − black)/(white − black) = e·d/(G·(W − B)) for a linear readout), clipped at white, then developed with the capture's white balance, camera → XYZ → sRGB matrices, highlight mode, tone curve and encoding. \" +\n \"So a uniform patch renders at the capture's mean level, and differences from the capture are the camera effects plus noise. Chosen over a fixed reflectance → sRGB mapping because that would differ from the capture by the exposure, which is not a camera artefact.\");\n assume(\"reference.sampling\", \"model\", boxAperture ? { kind: \"box\", samplesPerAxis: n } : { kind: \"point\" },\n boxAperture ? \"Each pixel averages the scene over its square photosite with the same \" + n + \" × \" + n + \" midpoint rule as sensor.pixelAperture \\\"box\\\".\" :\n \"Each pixel samples the scene at its centre, like the capture's default point aperture; use sensor.pixelAperture \\\"box\\\" for photosite-averaged pixels.\");\n return Object.freeze({ kind: \"ideal-reference\" as const, label: \"Ideal reference (no camera effects); not a capture.\", facadeVersion: SIMULATE_CAPTURE_FACADE_VERSION, engineApiVersion: ENGINE_API_VERSION,\n image: { width: outputWidth, height: outputHeight, format, samples, ...(png ? { png, colorEncoding: colorEncoding! } : {}) },\n exposure: { mode, settings: { fNumber, shutterSeconds, iso: resolvedIso }, ev100: Math.log2(fNumber ** 2 / shutterSeconds), ...isoReport },\n scene: { sceneId: chart ? \"chart:\" + chart.preset : callerScene!.sceneId, preset: scenePreset, parameters: chart ? chart.parameters : {},\n illuminant: { id: illuminant.id, description: illuminant.description, illuminanceLux }, distanceM: subjectDistanceM,\n framedWidthM: 2 * metresPerFrameUnit, framedHeightM: 2 * metresPerFrameUnit * aspect, ...(chartReport ? { chart: chartReport } : {}), sourceSha256 },\n ...(region && regionNative ? { region: { ...region, frameWidth: width, frameHeight: height } } : {}),\n diagnostics: { sampleCount: outputWidth * outputHeight * n * n, timingsMs: { reference: referenceMs, total: Date.now() - started } },\n provenance: { scientificStatus: \"approximation\" as const, cameraPresetId: preset.presetId, cameraPresetVersion: preset.presetVersion, evidence: [...FACADE_EVIDENCE, ...preset.evidence],\n composedContracts: [\"calculateEnvironmentSensorPhotoSignal\", \"resolveSensorReadoutRegime\", \"calculateSiteEffectiveSaturationCode\", \"prepareSensorColorDevelopment\",\n ...(linearPath ? [\"resolveRgbColorSpace\", ...(perceptual ? [\"prepareRgbGamutMapping\"] : [])] : [\"SDR rendering kernel\"]), ...(png ? [\"serializePngImage\"] : [])],\n limitations: [\"Ideal reference of the planar scene at the capture's exposure: not a capture and not a measurement; it shows what the camera effects change, not an absolute colour truth.\"] },\n assumptions: Object.freeze(assumptions.map((a) => Object.freeze(a))) });\n }\n\n async function runTask<T extends { run(): Promise<void>; cancel(): void; dispose(): void; readonly state: string }>(task: T): Promise<void> {\n const onAbort = (): void => task.cancel();\n signal?.addEventListener(\"abort\", onAbort, { once: true });\n try { checkAbort(); await task.run(); checkAbort(); } catch (error) { task.dispose(); if (signal?.aborted) fail(\"simulateCapture aborted.\"); throw error; } finally { signal?.removeEventListener(\"abort\", onAbort); }\n }\n const rawStarted = Date.now();\n const plan = calculateNativeRawPlan(environmentRaw.raw);\n const progress = (stage: SimulateCaptureProgress[\"stage\"], total: number) => {\n let completed = 0;\n return (): void => { completed++; onProgress?.({ stage, completedTileCount: completed, totalTileCount: total }); };\n };\n const rawTick = progress(\"raw\", regionNative ? regionNative.height * Math.ceil(regionNative.width / tileWidth) : plan.tileCount);\n // #394: siteInput builds fresh site records per call and never changes them, so the native task plans them without a copy.\n const rawCallbacks = (): Parameters<typeof createNativeEnvironmentRawTask>[1] => ({ readTile: markInternalNativeTileReader(async (request: Parameters<typeof readTile>[0]): Promise<NativeEnvironmentRawTile> => { const tile = await readTile(request); rawTick(); return tile; }),\n evaluateRadiance: rawProvider().evaluateRadiance, ...(pupil ? { evaluateApertureRadiance: provider.evaluateApertureRadiance } : {}), yieldControl });\n // #394 step 2: an engine-built planar scene (chart preset or caller material scene; still, rectilinear, no distortion, vignetting,\n // pupil rays or caller PSF) takes its expected electrons from the tabulated signal, verified per CFA phase against the chain.\n const tabulatedScene = chart !== undefined || callerScene?.kind === \"material-function\";\n // #391: a DNG from region parts takes the whole frame's RAW from the parts instead of rendering it.\n if (run === \"dng-from-parts\" && regionNative) fail(\"serializeSimulatedCaptureDngFromParts writes the whole frame: the options take no output.region.\");\n const dngParts = run === \"dng-from-parts\" ? viewOption : undefined;\n let tabulated: Awaited<ReturnType<typeof renderTabulatedNativeRaw>>;\n if (dngParts === undefined && tabulatedScene && !pupil && !lensFieldMapping && !vignetting && !lensPsf && !rotating && (!diffraction || diffractionObjectSpace) && provider.chartMaterialAt && provider.materialRadiance) {\n const { electronsPerRadiance, wavelengths } = axisChannelResponse(\"simulateCapture\");\n const perNode = CHANNELS.map((c) => Float64Array.from(wavelengths, (nm) => electronsPerRadiance[c].get(nm) ?? 0)) as [Float64Array, Float64Array, Float64Array];\n const sceneMaterials = chart ? chart.materials : (callerScene as ResolvedCallerMaterialScene).materials, materialRadiance = provider.materialRadiance;\n const { signalInput: builtSignalInput } = buildExpectedSignalInput({ nativeWidth, nativeHeight, width, wavelengths, perNode, apertureNodes: apertureNodeOffsets(boxSamples), boxSamples, antiAliasing, pitch,\n diffraction: diffraction && !defocusSiteKernels ? { radius: diffraction.kernelRadiusSamples, psf: diffractionPsf!.configuration.psf, profileWavelengths: diffraction.profile.axes.wavelengthNm } : undefined,\n materials: { materialAt: provider.chartMaterialAt, whiteRadiance: (nm: number): number => irradianceScale * illuminant.shape.evaluate(nm) / Math.PI,\n list: [...sceneMaterials.map((m, index) => (m.kind === \"neutral\" ? { neutral: m.reflectance } : { radiance: (nm: number): number => materialRadiance(index, nm) })),\n ...(chartSize ? [{ neutral: chartSize.surroundReflectance }] : [])] },\n radianceAt: provider.radianceAt, imagingArea, focalLengthMm, focusDistanceM, subjectDistanceM, metresPerFrameUnit, caller: \"simulateCapture\" });\n // #492: with lens.defocus the table convolves the lattice radiance with each node's defocus (or combined) kernel, on the\n // lattice formula, exactly as the object-space provider does.\n let signalInput = builtSignalInput;\n if (defocusSiteKernels) {\n const lattice = { ...builtSignalInput };\n delete lattice.queryPoint;\n signalInput = { ...lattice, kernels: { radius: defocusSiteKernels.radius, perNode: wavelengths.map((nm) => defocusSiteKernels!.at(nm)) } };\n }\n // The verification reads only the region's top-left 2 × 2 block, so its diffraction convolves only that block's lattice; the\n // window never changes a value (see diffraction-provider.ts), so the chain it runs is the whole render's.\n const verificationProvider = diffractedProvider({ x: regionNative?.x ?? 0, y: regionNative?.y ?? 0, width: 2, height: 2 });\n tabulated = await renderTabulatedNativeRaw({ input: environmentRaw, region: regionNative, siteInput, evaluateRadiance: verificationProvider.evaluateRadiance,\n electrons: createDisplayViewExpectedSignal(signalInput), onTile: rawTick, tileWidth, yieldControl: () => yieldControl(), checkAbort });\n }\n let rawOutput: { raw: NativeRawOutput; providerEvaluationCount: number };\n if (dngParts !== undefined) rawOutput = { raw: joinNativeRawParts(dngParts, plan, nativeWidth, nativeHeight), providerEvaluationCount: 0 };\n else if (tabulated) {\n rawOutput = { raw: tabulated.raw, providerEvaluationCount: tabulated.providerEvaluationCount };\n // The verification's relative difference itself is not reported: it is a last-bits quantity, and captures use the JavaScript\n // engine's own Math functions, so it differs between engines while the results are the same.\n assume(\"raw.expectedSignal\", \"model\", { method: \"tabulated-expected-electrons\", verificationSites: 4, tolerance: TABULATED_RELATIVE_TOLERANCE },\n \"Each native site's expected photo electrons are the tabulated sum over the pixel-aperture nodes, anti-aliasing spots, diffraction taps and spectral nodes (the display view's expected signal), \" +\n \"the same quantity the environment chain computes for this still, rectilinear, distortion-free planar scene, formed in another order, so it can differ in the last bits. The sensor stage (dark charge, Poisson draws, \" +\n \"read noise, ADC) is the native one with each site's own seeds. One site of each CFA phase ran the full chain: its readout was reproduced bit for bit and its electrons agreed within the tolerance. \" +\n \"diagnostics.providerEvaluationCount counts those sites' evaluator calls and the table's scene lookups.\");\n }\n else {\n const rawTask: NativeEnvironmentRawTask = regionNative ? createNativeEnvironmentRawRegionTask(environmentRaw, regionNative, rawCallbacks()) :\n createNativeEnvironmentRawTask(environmentRaw, rawCallbacks());\n await runTask(rawTask);\n rawOutput = rawTask.takeOutput();\n }\n // Region (2.3): the region's sites, re-described by a plan of the region raster (active area = the region), for development.\n let developmentPlan = plan;\n if (region && regionNative) {\n const raster = { pixelWidth: regionNative.width, pixelHeight: regionNative.height };\n const regionGeometry = { imagingArea: { widthMm: raster.pixelWidth * pitch / 1000, heightMm: raster.pixelHeight * pitch / 1000 }, nativeRaster: raster, orientation: \"landscape\" as const,\n activeCaptureRect: { x: region.x + margin - regionNative.x, y: region.y + margin - regionNative.y, width: region.width, height: region.height },\n outputRaster: { pixelWidth: region.width, pixelHeight: region.height } };\n developmentPlan = calculateNativeRawPlan(buildRawInputFor(intentOf(whiteBalanceState), regionGeometry, { ...captureModeProfile, modes: captureModeProfile.modes.map((m) =>\n ({ ...m, processedImageRaster: { ...m.processedImageRaster, value: raster } })) } as NativeRawInput[\"captureModeProfile\"], { ...bindingProfile, nativeRaster: raster }, raster.pixelWidth * raster.pixelHeight));\n if (Array.from(rawOutput.raw.effectiveSaturationCodes).some((code) => code === 0)) fail(\"output.region needs every CFA phase in its native rectangle.\");\n rawOutput = { ...rawOutput, raw: { ...rawOutput.raw, plan: developmentPlan } };\n }\n const providerEvaluationCount = rawOutput.providerEvaluationCount;\n const rawMs = Date.now() - rawStarted, wbStarted = Date.now();\n let finalRawInput = environmentRaw;\n if (needsAuto) {\n // Grey-world AWB over pre-WB RAW: black-subtracted, white-normalized channel means of each 2×2 CFA block on a coarse grid.\n const raw = rawOutput.raw, step = Math.max(2, 2 * Math.floor(Math.sqrt(width * height / 4096) / 1)), samples = [];\n for (let y = margin - (margin % 2); y + 1 < nativeHeight; y += step) for (let x = margin - (margin % 2); x + 1 < nativeWidth; x += step) {\n const value = (dx: number, dy: number): number => { const i = (y + dy) * nativeWidth + x + dx; return (raw.codes[i]! - raw.blackLevels[i]!) / (raw.effectiveSaturationCodes[dy * 2 + dx]! - raw.blackLevels[i]!); };\n let clipped = false;\n for (const [dx, dy] of [[0, 0], [1, 0], [0, 1], [1, 1]]) if (raw.saturationFlags[(y + dy!) * nativeWidth + x + dx!]! !== 0) clipped = true;\n samples.push({ sampleId: \"block-\" + x + \"-\" + y, red: Math.max(1e-9, value(0, 0)), green: Math.max(1e-9, (value(1, 0) + value(0, 1)) / 2), blue: Math.max(1e-9, value(1, 1)), weight: 1, clipped });\n }\n const policy = body.whiteBalance.awbPolicies[0]!;\n assume(\"output.whiteBalance.auto\", \"model\", { policyId: policy.policyId, samples: samples.length },\n \"Grey-world AWB of the body's \" + policy.policyId + \" policy over 2×2 CFA block means of the pre-WB RAW; the RAW is then rendered again with that intent (the same radiance queries are repeated).\");\n whiteBalanceState = estimateAutoWhiteBalance({ stateId: \"facade-wb-auto\", profile: body.whiteBalance, policyId: policy.policyId,\n sampleSet: { imageStateId: \"facade-pre-wb-raw\", inputDomain: \"relative-pre-wb-camera-linear-rgb\", samples } });\n finalRawInput = { raw: buildRawInput(intentOf(whiteBalanceState)), sceneBinding, maximumProviderEvaluations: environmentRaw.maximumProviderEvaluations };\n const wbTick = progress(\"white-balance\", plan.tileCount);\n if (tabulated || dngParts !== undefined) {\n // #394: the RAW codes do not depend on the white-balance intent (it is development metadata), so the tabulated RAW is\n // kept with the plan of the measured intent instead of being rendered again.\n rawOutput = { ...rawOutput, raw: { ...rawOutput.raw, plan: calculateNativeRawPlan(finalRawInput.raw) } };\n for (let k = 0; k < plan.tileCount; k++) wbTick();\n } else {\n // A second lean RAW pass with the measured intent. It gives the same RAW as re-running the sensor stage on a\n // retained optical stage, and is faster: retaining the optical stage takes the first pass off the lean executor.\n const wbTask = createNativeEnvironmentRawTask(finalRawInput, {\n readTile: markInternalNativeTileReader(async (request: Parameters<typeof readTile>[0]): Promise<NativeEnvironmentRawTile> => { const tile = await readTile(request); wbTick(); return tile; }),\n evaluateRadiance: rawProvider().evaluateRadiance, ...(pupil ? { evaluateApertureRadiance: provider.evaluateApertureRadiance } : {}), yieldControl });\n await runTask(wbTask);\n rawOutput = wbTask.takeOutput();\n }\n }\n const wbMs = Date.now() - wbStarted, devStarted = Date.now();\n const colorProfile: ExportSensorColorProfile = { schemaVersion: \"0.1.0\", profileId: IDS.spectral, profileVersion: SIMULATE_CAPTURE_FACADE_VERSION, colorSamplingProfileId: IDS.cfa,\n channelIds: [\"red\", \"green\", \"blue\"], scientificStatus: \"approximation\", referenceIlluminant: \"D65\", normalizedCameraChannelsToXyz: CAMERA_TO_XYZ,\n evidence, limitations: [\"Diagonal camera→XYZ matrix of the idealized colorimetric (Luther–Ives) sensor; exact up to spectral quadrature.\"] };\n const phaseProfiles = builtInDemosaic ? builtInDemosaic.phaseProfiles : bilinearPhaseProfiles();\n const developmentWhiteBalance = whiteBalanceState ? \"apply-resolved-sensor-gains\" as const : \"not-required\" as const;\n\n\n // DNG (2.0): the packed native RAW itself, before development takes ownership of it.\n let dng: NativeRawDng | undefined;\n if (format === \"dng\") {\n const noise = Object.fromEntries(CHANNELS.map((channel) => {\n const resolved = resolveSensorReadoutRegime({ profile: regimeByChannel[channel].readoutProfile as Parameters<typeof resolveSensorReadoutRegime>[0][\"profile\"], regimeId: regimeByChannel[channel].regimeId });\n return [channel, { conversionGainElectronsPerCode: resolved.regime.systemConversionGainElectronsPerCode.value / (resolved.regime.adc.digitalGain ?? 1),\n readNoiseRmsElectrons: resolved.combinedReadNoiseRmsElectrons }];\n }));\n const dngStarted = clockMs();\n dng = await serializeNativeRawDng({ raw: rawOutput.raw, colorProfile, noise, ...(dngCapturedAtUtc === undefined ? {} : { capturedAtUtc: dngCapturedAtUtc }),\n ...(textMetadata ? { textMetadata } : {}) });\n encodeMs = clockMs() - dngStarted;\n assumeTextMetadata(TEXT_METADATA_LAYOUT.dng);\n checkAbort();\n assume(\"output.dng\", \"model\", { writer: \"serializeNativeRawDng\", schemaVersion: dng.schemaVersion, whiteLevel: dng.whiteLevel, blackLevels: dng.blackLevels,\n noiseProfile: dng.noiseProfile, unrepresentedSaturationFlagCount: dng.unrepresentedSaturationFlagCount },\n \"Lossless uncompressed 16-bit CFA DNG of exactly the packed native RAW codes: per-phase BlackLevel, WhiteLevel = smallest per-phase effective white, ActiveArea and DefaultCrop from the capture geometry, ColorMatrix1/ForwardMatrix1 from the facade's diagonal camera→XYZ profile (D65), AsShotNeutral from the white-balance intent, BaselineExposure 0, and NoiseProfile from each channel's readout regime (conversion gain ÷ digital gain, combined read noise; Poisson + Gaussian + quantization only). No linear master or developed image is declared; saturation flags below WhiteLevel are not representable and are counted.\");\n }\n if (dngParts !== undefined) return dng;\n\n // Development\n const development: Omit<NativeRawDevelopmentInput, \"raw\"> = { phaseProfiles, colorProfile,\n whiteBalance: developmentWhiteBalance, rendering, highlightMode, ...(mirrorBorder ? { borderHandling: \"mirror\" as const } : {}),\n maximumRetainedPayloadBytes: developmentPlan.outputBytes + outputWidth * outputHeight * 3 * (rendering.bitDepth / 8) };\n let developed: { raw: NativeRawOutput; integerSamples: Uint8Array | Uint16Array; highlight: RawHighlightDiagnostics; diagnostics: SdrRenderingResult[\"diagnostics\"] };\n let gamutMappingDiagnostics: { method: \"cielab-hue-preserving-chroma-compression\"; kneeFraction: number; adjustedPixelCount: number; lightnessClippedPixelCount: number } | undefined;\n if (ahd) {\n let lastYield = Date.now();\n const linear = await developLinearSrgb({ ...development, raw: rawOutput.raw }, async (completed, total) => {\n onProgress?.({ stage: \"development\", completedTileCount: completed, totalTileCount: total });\n if (Date.now() - lastYield >= 8) { await yieldControl(); checkAbort(); lastYield = Date.now(); }\n }, { yieldControl: () => yieldControl(), checkAbort, onDemosaicMs: (ms) => { demosaicMs = ms; } });\n if (!linearPath) {\n // The native development's SDR kernel, row by row, on the AHD-developed linear sRGB.\n const maximum = 2 ** rendering.bitDepth - 1, tone = prepareSdrPixelTone(rendering), scratch = new Float64Array(3);\n const codes = rendering.bitDepth === 8 ? new Uint8Array(outputWidth * outputHeight * 3) : new Uint16Array(outputWidth * outputHeight * 3);\n const counts: SdrPixelCounts = { negative: 0, above: 0, changed: 0, low: 0, high: 0, outOfGamut: false };\n for (let y = 0; y < outputHeight; y++) renderSdrRunInto(linear.rgb, y * outputWidth * 3, outputWidth, rendering, tone, 2 ** rendering.renderingExposureEv, maximum, codes, y * outputWidth * 3, scratch, counts);\n developed = { raw: rawOutput.raw, integerSamples: codes, highlight: linear.highlight, diagnostics: { renderingNegativeSampleCount: counts.negative,\n renderingAboveReferenceSampleCount: counts.above, toneChangedSampleCount: counts.changed, gamutClippedLowSampleCount: counts.low,\n gamutClippedHighSampleCount: counts.high, captureSaturation: \"consumed-in-raw-development\" } };\n } else {\n const mapping = perceptual ? prepareRgbGamutMapping({ colorSpace: colorEncoding!, method: \"cielab-hue-preserving-chroma-compression\", kneeFraction: PERCEPTUAL_GAMUT_KNEE_FRACTION }) : undefined;\n const encoded = encodeSdrFromLinear(linear.rgb, colorEncoding!, pngBitDepth!, mapping);\n developed = { raw: rawOutput.raw, integerSamples: encoded.samples, highlight: linear.highlight, diagnostics: encoded.diagnostics };\n if (mapping) gamutMappingDiagnostics = { method: \"cielab-hue-preserving-chroma-compression\", kneeFraction: PERCEPTUAL_GAMUT_KNEE_FRACTION,\n adjustedPixelCount: encoded.adjustedPixelCount, lightnessClippedPixelCount: encoded.lightnessClippedPixelCount };\n }\n } else if (!linearPath) {\n const devTask = createNativeRawDevelopmentTask({ ...development, raw: rawOutput.raw }, { yieldControl,\n onProgress: (p) => onProgress?.({ stage: \"development\", completedTileCount: p.completedTileCount, totalTileCount: p.totalTileCount }) });\n await runTask(devTask);\n developed = devTask.takeOutput();\n } else {\n // Wide gamut: the native development operator up to linear sRGB/D65 (unclipped), then XYZ → target primaries.\n let lastYield = Date.now();\n const linear = await developLinearSrgb({ ...development, raw: rawOutput.raw }, async (completed, total) => {\n onProgress?.({ stage: \"development\", completedTileCount: completed, totalTileCount: total });\n if (Date.now() - lastYield >= 8) { await yieldControl(); checkAbort(); lastYield = Date.now(); }\n });\n {\n const mapping = perceptual ? prepareRgbGamutMapping({ colorSpace: colorEncoding!, method: \"cielab-hue-preserving-chroma-compression\", kneeFraction: PERCEPTUAL_GAMUT_KNEE_FRACTION }) : undefined;\n const encoded = encodeSdrFromLinear(linear.rgb, colorEncoding!, pngBitDepth!, mapping);\n developed = { raw: rawOutput.raw, integerSamples: encoded.samples, highlight: linear.highlight, diagnostics: encoded.diagnostics };\n if (mapping) {\n gamutMappingDiagnostics = { method: \"cielab-hue-preserving-chroma-compression\", kneeFraction: PERCEPTUAL_GAMUT_KNEE_FRACTION,\n adjustedPixelCount: encoded.adjustedPixelCount, lightnessClippedPixelCount: encoded.lightnessClippedPixelCount };\n assume(\"output.gamutMapping\", \"model\", { method: \"cielab-hue-preserving-chroma-compression\", kneeFraction: PERCEPTUAL_GAMUT_KNEE_FRACTION, colorSpace: colorEncoding },\n \"prepareRgbGamutMapping: CIELAB L* and hue held, chroma above 90 % of the boundary chroma C_max(L*, h) compressed with a tanh knee so it never reaches C_max (Morovič 2008, §10). In-gamut colours below the knee are unchanged; saturated in-gamut colours above it are desaturated slightly. L* ≥ 100 (above the RAW white) maps to white. CIELAB hue is not perceptually constant for saturated blues, so they can shift toward purple.\");\n }\n assume(\"output.colorEncoding.conversion\", \"model\", { from: \"linear-srgb-d65 (unclipped)\", via: \"CIE XYZ\", to: colorEncoding, gamutHandling: perceptual ? \"cielab-hue-preserving-chroma-compression\" : \"clip-components\",\n transfer: colorEncoding === \"rec2020\" ? \"bt2020-oetf (= BT.709 OETF)\" : \"srgb (W3C CSS Color 4)\" },\n \"Developed with the native development operator (demosaic, per-site white-level clip, WB, highlight mode, diagonal camera→XYZ, XYZ→linear sRGB) but before any sRGB clipping, so colours outside sRGB are kept; converted to \" +\n colorEncoding + \" through XYZ (matrices from primaries and D65, as in W3C CSS Color 4), \" + (perceptual ? \"gamut-mapped perceptually (output.gamutMapping)\" : \"components clipped to [0, 1] in the target gamut\") +\n \", then encoded and rounded to nearest. RAW white maps to display white, as in the sRGB path.\");\n }\n }\n const devMs = Date.now() - devStarted, jpegStarted = Date.now();\n let jpeg: Uint8Array | undefined;\n if (format === \"jpeg\") {\n const samples = developed.integerSamples as Uint8Array;\n const jpegSha = await sha256Hex(Array.from(samples.subarray(0, Math.min(samples.length, 4096))).join(\",\") + \":\" + samples.length + \":\" + sourceSha256);\n const source = { captureId: IDS.capture, imageStateId: \"facade-developed\", artifactId: \"facade-developed-srgb8\", sha256: jpegSha, width: outputWidth, height: outputHeight, encoding: \"encoded-srgb-8-rgb\" as const };\n // The encoder reads every pixel once, in source tiles of at most 256 × 32 aligned to the crop origin.\n const reads = Math.ceil(outputHeight / 32) * Math.ceil(outputWidth / 256), jpegTick = progress(\"jpeg\", reads);\n const jpegTask = createPrintJpegTask({ source, crop: { x: 0, y: 0, width: outputWidth, height: outputHeight }, outputWidth, outputHeight, quantizationStep: jpegStep!,\n maximumEncodedBytes: Math.max(65536, outputWidth * outputHeight * 6), maximumProviderReads: reads,\n // The JPEG records its admission plan, so the raised limit is passed (and recorded) only when the image needs it.\n ...(raisedPixels === undefined || outputWidth * outputHeight <= PRINT_JPEG_LIMITS.maximumPixels ? {} : { maximumPixels: raisedPixels }) }, {\n readTile: async (request) => {\n jpegTick();\n const out = new Uint8Array(request.width * request.height * 3);\n for (let row = 0; row < request.height; row++) out.set(samples.subarray(((request.y + row) * outputWidth + request.x) * 3, ((request.y + row) * outputWidth + request.x + request.width) * 3), row * request.width * 3);\n return { ...request, samples: out };\n }, yieldControl });\n const jpegEncodeStarted = clockMs();\n await runTask(jpegTask);\n jpeg = jpegTask.takeOutput().bytes;\n if (textMetadata) jpeg = addJpegTextMetadata(jpeg, textMetadata);\n assumeTextMetadata(TEXT_METADATA_LAYOUT.jpeg);\n encodeMs = clockMs() - jpegEncodeStarted;\n assume(\"output.jpeg\", \"model\", { encoder: \"photivra-print-jpeg\", iccProfile: \"photivra-srgb\" }, \"Baseline JPEG from the existing print JPEG encoder with an embedded sRGB ICC profile; the source digest covers a sample prefix, length and scene digest.\");\n }\n const jpegMs = Date.now() - jpegStarted;\n let png: Uint8Array | undefined;\n if (format === \"png\") {\n const pngStarted = clockMs();\n png = serializePngImage({ width: outputWidth, height: outputHeight, bitDepth: pngBitDepth!, samples: developed.integerSamples, colourEncoding: pngColourEncoding(colorEncoding!),\n ...(raisedPixels === undefined || outputWidth * outputHeight <= PNG_ENCODER_LIMITS.maximumPixels ? {} : { maximumPixels: raisedPixels }) });\n if (textMetadata) png = addPngTextMetadata(png, textMetadata);\n assumeTextMetadata(TEXT_METADATA_LAYOUT.png);\n encodeMs = clockMs() - pngStarted;\n assume(\"output.png\", \"model\", { encoder: \"serializePngImage\", bitDepth: pngBitDepth, colourEncoding: pngColourEncoding(colorEncoding!) },\n \"Deterministic PNG (8/16-bit RGB, in-house zlib) with the colour encoding signalled in the file: the sRGB chunk for sRGB, otherwise a cICP chunk with ITU-T H.273 primaries/transfer code points. No mastering-display (mDCV) or content-light-level (cLLI) metadata is written.\");\n }\n\n const ranOptions = new Set<SimulateCaptureCostOption>([...(pupil ? [\"lens.pupilSampling\" as const] : []), ...(projection !== undefined ? [\"lens.projection\" as const] : []),\n ...(distortion ? [\"lens.distortion\" as const] : []), ...(vignetting ? [\"lens.vignetting\" as const] : []), ...(lensPsf ? [\"lens.psf\" as const] : []),\n ...(diffraction ? [\"lens.diffraction\" as const] : []), ...(defocusSiteKernels ? [\"lens.defocus\" as const] : []), ...(antiAliasing ? [\"sensor.antiAliasing\" as const] : []), ...(boxAperture ? [\"sensor.pixelAperture.box\" as const] : []),\n ...(temporalSampleCount > 1 ? [\"sensor.temporalSampleCount\" as const] : []), ...(rotating ? [\"motion.rotation\" as const] : []),\n ...(rollingSchedule ? [\"motion.shutter.rolling\" as const] : []), ...(mirrorBorder ? [\"output.borderHandling.mirror\" as const] : []), ...(region ? [\"output.region\" as const] : []),\n ...(needsAuto ? [\"output.whiteBalance.auto\" as const] : []), ...(ahd ? [\"output.demosaic.ahd\" as const] : []),\n ...(highlightMode === \"reconstruct\" ? [\"output.highlightMode.reconstruct\" as const] : []), ...(wideGamut ? [\"output.colorEncoding.wide-gamut\" as const] : []),\n ...(perceptual ? [\"output.gamutMapping.perceptual\" as const] : []), ...(format === \"jpeg\" || format === \"png\" || format === \"dng\" ? [\"output.format.\" + format as SimulateCaptureCostOption] : [])]);\n return Object.freeze({\n facadeVersion: SIMULATE_CAPTURE_FACADE_VERSION, engineApiVersion: ENGINE_API_VERSION,\n image: { width: outputWidth, height: outputHeight, format, samples: developed.integerSamples, ...(jpeg ? { jpeg } : {}), ...(png ? { png, colorEncoding: colorEncoding! } : {}), ...(dng ? { dng: dng.bytes } : {}) },\n raw: developed.raw, plan: developmentPlan,\n ...(region && regionNative ? { region: { ...region, frameWidth: width, frameHeight: height, nativeRect: { ...regionNative } } } : {}),\n request: { environmentRaw: finalRawInput, siteInput, development, whiteBalanceState,\n ...(diffraction ? { diffraction: { profile: diffraction, psf: diffractionPsf!, execution: diffractionObjectSpace ? \"object-space-convolution\" as const : \"environment-psf-quadrature\" as const } } : {}) },\n exposure: { mode, settings: { fNumber, shutterSeconds, iso: resolvedIso }, ev100: Math.log2(fNumber ** 2 / shutterSeconds), ...isoReport,\n meteredSceneLuminanceCdPerSquareMeter: meteredLuminance, standardExposureDeviationStops: exposureDeviationStops, resolution },\n scene: { sceneId: chart ? \"chart:\" + chart.preset : callerScene!.sceneId, preset: scenePreset, parameters: chart ? chart.parameters : {},\n illuminant: { id: illuminant.id, description: illuminant.description, illuminanceLux }, distanceM: subjectDistanceM,\n framedWidthM: 2 * metresPerFrameUnit, framedHeightM: 2 * metresPerFrameUnit * aspect, ...(chartReport ? { chart: chartReport } : {}), sourceSha256 },\n diagnostics: { providerEvaluationCount, highlight: developed.highlight, rendering: developed.diagnostics, ...(gamutMappingDiagnostics ? { gamutMapping: gamutMappingDiagnostics } : {}),\n timingsMs: { raw: rawMs, whiteBalance: wbMs, development: devMs, jpeg: jpegMs, total: Date.now() - started,\n ...(diffraction && diffractionObjectSpace && !defocusSiteKernels ? { diffraction: diffractionMs } : {}), ...(defocusSiteKernels ? { defocus: defocusMs } : {}), ...(demosaicMs === undefined ? {} : { demosaic: demosaicMs }),\n ...(encodeMs === undefined ? {} : { encode: encodeMs }) },\n options: Object.freeze(SIMULATE_CAPTURE_COST_OPTIONS.filter((option) => ranOptions.has(option))), fast: fastReport },\n provenance: { scientificStatus: \"approximation\" as const, cameraPresetId: preset.presetId, cameraPresetVersion: preset.presetVersion,\n evidence: [...FACADE_EVIDENCE, ...preset.evidence],\n composedContracts: [\"resolveGenericEquipmentExposureCapabilities\", \"meterRelativeExposure\", \"createExposureMeterTargetFromMeteringResult\",\n \"resolve\" + (mode === \"manual\" ? \"Manual\" : mode === \"aperture-priority\" ? \"AperturePriority\" : mode === \"shutter-priority\" ? \"ShutterPriority\" : \"ProgramAuto\") + \"ExposureMode\",\n ...(rollingSchedule ? [\"resolveElectronicRollingShutterExposureSchedule\", \"createRollingShutterCaptureExposureSchedule\"] : []),\n ...(diffraction ? [\"createDiffractionLimitedPsfProfile\", ...(diffractionObjectSpace ? [\"resolveLensPsfConvolutionKernels\", ...(defocusSiteKernels ? [] : [\"calculateIrradianceConvolution\"])] : [])] : []),\n ...(defocusSiteKernels ? [\"calculateDefocusCircle\", \"defocus disc site kernel (object-space convolution)\"] : []),\n ...(antiAliasing ? [\"resolveAntiAliasingSpatialKernel\"] : []), \"resolveGenericIsoSignalChain\", \"createNativeEnvironmentRawTask\", ...(needsAuto ? [\"estimateAutoWhiteBalance\"] : []),\n ...(builtInDemosaic ? [\"createBuiltInBayerDemosaicProfiles\"] : []), ...(ahd ? [\"createAhdDemosaicTask\"] : []),\n ...(ahd ? [\"native RAW development operator (colour, after AHD)\", ...(linearPath ? [\"resolveRgbColorSpace\", ...(perceptual ? [\"prepareRgbGamutMapping\"] : [])] : [\"SDR rendering kernel\"])] : linearPath ? [\"native RAW development operator (linear, pre-clip)\", \"resolveRgbColorSpace\", ...(perceptual ? [\"prepareRgbGamutMapping\"] : [])] : [\"createNativeRawDevelopmentTask\"]),\n ...(jpeg ? [\"createPrintJpegTask\"] : []), ...(png ? [\"serializePngImage\"] : []), ...(dng ? [\"resolveSensorReadoutRegime\", \"serializeNativeRawDng\"] : [])],\n limitations: [\"Educational approximation: synthetic tier sensor values, idealized colorimetric sensor, planar Lambertian scene and point optics; not a calibrated camera emulation.\",\n \"Not offered by the facade: atmospheric haze and polarizers (the scene-radiance provider contract declares no volumetric transport or polarization), flash, video, HDR brackets and processing operators; compose those APIs directly.\"] },\n assumptions: Object.freeze(assumptions.map((a) => Object.freeze(a)))\n });\n}\n\n/** Chart preset ids accepted by `simulateCapture({ scene: { preset } })`. */\nexport const SIMULATE_CAPTURE_CHART_PRESETS = CHART_SCENE_PRESETS;\n"]}
1
+ {"version":3,"file":"simulate-capture.js","sourceRoot":"","sources":["../../src/facade/simulate-capture.ts"],"names":[],"mappings":"AAAA,sCAAsC;AAEtC;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAEH,OAAO,EAAE,4BAA4B,EAAE,kCAAkC,EAAE,8BAA8B,EAAE,MAAM,wCAAwC,CAAC;AAC1J,OAAO,EAAE,yBAAyB,EAAE,MAAM,gCAAgC,CAAC;AAC3E,OAAO,EAAE,4BAA4B,EAAE,MAAM,uBAAuB,CAAC;AACrE,OAAO,EAAE,kBAAkB,EAAE,MAAM,8BAA8B,CAAC;AAClE,OAAO,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAExD,OAAO,EAAE,mBAAmB,EAA8D,MAAM,qCAAqC,CAAC;AACtI,OAAO,EAAE,uBAAuB,EAAE,MAAM,oBAAoB,CAAC;AAC7D,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,EAAE,2CAA2C,EAAqD,MAAM,uCAAuC,CAAC;AACvJ,OAAO,EAAE,4BAA4B,EAAE,MAAM,+BAA+B,CAAC;AAC7E,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAChE,OAAO,EAAE,2CAA2C,EAAE,oCAAoC,EAAE,MAAM,gCAAgC,CAAC;AACnI,OAAO,EAAE,yBAAyB,EAAE,mCAAmC,EAAE,0CAA0C,EAAE,kCAAkC,EACrJ,8BAA8B,EAAqF,MAAM,uCAAuC,CAAC;AACnK,OAAO,EAAE,6BAA6B,EAAE,6CAA6C,EAAE,MAAM,yCAAyC,CAAC;AACvI,OAAO,EAAE,+BAA+B,EAAmC,MAAM,6BAA6B,CAAC;AAC/G,OAAO,EAAE,sBAAsB,EAAE,MAAM,+BAA+B,CAAC;AACvE,OAAO,EAAE,qCAA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CAAC,EAAE,CAAC;gBAC7G,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,qDAAqD,EAAE,GAAG,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,sBAAsB,EAAE,GAAG,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,wBAAwB,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,sBAAsB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,oDAAoD,EAAE,sBAAsB,EAAE,GAAG,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,wBAAwB,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,gCAAgC,CAAC,CAAC;gBAClX,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,qBAAqB,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,mBAAmB,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,4BAA4B,EAAE,uBAAuB,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;YAC3J,WAAW,EAAE,CAAC,sKAAsK;gBAClL,uOAAuO,CAAC,EAAE;QAC9O,WAAW,EAAE,MAAM,CAAC,MAAM,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;KACrE,CAAC,CAAC;AACL,CAAC;AAED,6EAA6E;AAC7E,MAAM,CAAC,MAAM,8BAA8B,GAAG,mBAAmB,CAAC","sourcesContent":["// SPDX-License-Identifier: Apache-2.0\n\n/**\n * `simulateCapture()` is the easy starting point. It turns a small input into a complete native\n * environment RAW request: scene radiance → optics → spectral EQE (external quantum efficiency) →\n * charge → readout and ADC. That request then runs through the existing native RAW development task\n * and, optionally, the existing JPEG encoder.\n *\n * It adds no physics of its own. Every number comes from existing public contracts: generic tier\n * presets, exposure metering and mode resolution, colorimetry, native environment RAW, native RAW\n * development and print JPEG.\n *\n * Everything the facade decides for the caller is listed in `result.assumptions`: defaults, derived\n * values and fixed modelling choices. Nothing is hidden. The complete underlying request is returned\n * in `result.request`; get the per-site inputs with `request.siteInput(index)`.\n *\n * The 2.0 options are opt-in and only combine existing public contracts. If none is given, the\n * request, RAW, samples and JPEG are byte-identical to the 1.0 facade:\n * - output formats: `png` (`serializePngImage`; sRGB, or Display P3 / Rec. 2020 through the colorimetry\n * matrices and transfer functions) and `dng`\n * (`serializeNativeRawDng` of the packed native RAW; no linear master is declared);\n * - demosaic: `createBuiltInBayerDemosaicProfiles` (bilinear) and mirror borders;\n * - optics: the environment `lensFieldMapping` (projection, radial / Brown–Conrady distortion), radial\n * illumination vignetting as field throughput and a caller sampled lens PSF;\n * - motion: constant camera angular velocity and the electronic rolling-shutter exposure schedule.\n * The 2.1 options are opt-in in the same way: `lens.diffraction`, `output.demosaic: \"ahd\"` and\n * `sensor.antiAliasing` (a birefringent point-splitting low-pass filter in the sensor optical stack).\n * The 2.4 `output.metadata` adds the caller's text to JPEG, PNG and DNG files (see `src/output/text-metadata.ts`);\n * without it every encoded file is byte-identical to 2.3.\n * @see docs/QUICK_START.md\n */\n\nimport { markInternalNativeTileReader, markInternalSceneRadianceEvaluator, registerInternalRadianceAccess } from \"../core/internal-radiance-evaluator.js\";\nimport { InvalidConfigurationError } from \"../core/configuration-error.js\";\nimport { InvalidScientificResultError } from \"../core/validation.js\";\nimport { requireInputObject } from \"../core/record-validation.js\";\nimport { ENGINE_API_VERSION } from \"../core/version.js\";\nimport type { EvidenceProvenance } from \"../core/evidence-provenance.js\";\nimport { GENERIC_TIER_ASSETS, type GenericEquipmentTier, type GenericEquipmentTierPreset } from \"../equipment/generic-tier-assets.js\";\nimport { parseCallerCameraPreset } from \"./camera-preset.js\";\nimport { createHostYield } from \"./host-yield.js\";\nimport { resolveGenericEquipmentExposureCapabilities, type ResolvedGenericEquipmentExposureCapabilities } from \"../equipment/exposure-capabilities.js\";\nimport { resolveGenericIsoSignalChain } from \"../sensor/iso-signal-chain.js\";\nimport { meterRelativeExposure } from \"../exposure/metering.js\";\nimport { createExposureMeterTargetFromMeteringResult, setExposureCompensationOnMeterTarget } from \"../exposure/metering-target.js\";\nimport { resolveManualExposureMode, resolveAperturePriorityExposureMode, resolveAperturePriorityAutoIsoExposureMode, resolveShutterPriorityExposureMode,\n resolveProgramAutoExposureMode, type AutoIsoBaselinePolicy, type AutoIsoLimits, type ExposureResolutionConstraint } from \"../exposure/exposure-mode-resolver.js\";\nimport { estimateAutoIsoSlowestShutter, GENERIC_HANDHELD_ANGULAR_VELOCITY_RAD_PER_SEC } from \"../exposure/auto-iso-slowest-shutter.js\";\nimport { parseExposureProgramLineProfile, type ExposureProgramLineProfile } from \"../exposure/program-line.js\";\nimport { resolveCaptureGeometry } from \"../output/capture-geometry.js\";\nimport { estimateCie1931ColorMatchingFunctions, type PreparedColorimetricSpectrum } from \"../color/color-matching-functions.js\";\nimport { createColorTemperatureWhiteBalanceIntent, resolveColorTemperatureWhiteBalance, resolveCustomWhiteBalance,\n resolveManualWhiteBalance, estimateAutoWhiteBalance, type ResolvedWhiteBalanceState } from \"../color/white-balance.js\";\nimport { createCaptureWhiteBalanceIntent, type CaptureWhiteBalanceIntent } from \"../capture/simulated-capture.js\";\nimport { SENSOR_RAW_PRODUCER_NOISE_MODEL } from \"../capture/sensor-raw-producer.js\";\nimport { calculateNativeRawPlan, nativeRawMaximumProviderEvaluations, NATIVE_RAW_LIMITS, type NativeRawInput, type NativeRawOutput, type NativeRawPlan } from \"../capture/native-raw.js\";\nimport { renderTabulatedNativeRaw, TABULATED_RELATIVE_TOLERANCE } from \"../capture/native-environment-tabulated.js\";\nimport { createDisplayViewExpectedSignal } from \"./expected-signal.js\";\nimport type { DisplayViewFastReport } from \"./display-view-gpu.js\";\nimport { buildExpectedSignalInput } from \"./expected-signal-setup.js\";\nimport { createNativeEnvironmentRawTask, createNativeEnvironmentRawRegionTask, type NativeEnvironmentRawInput,\n type NativeEnvironmentRawTask, type NativeEnvironmentRawTile } from \"../capture/native-environment-raw.js\";\nimport { createNativeRawDevelopmentTask, type NativeRawDevelopmentInput, type RawHighlightDiagnostics } from \"../capture/native-raw-development.js\";\nimport type { RawFrameReconstructionPhaseProfile } from \"../capture/raw-frame-reconstruction.js\";\nimport type { ExportSensorColorProfile } from \"../capture/photographic-export.js\";\nimport { parseSdrRenderingProfile, type SdrRenderingProfile, type SdrToneCurve, type SdrToneCurveParameters, type SdrRenderingResult } from \"../output/sdr-rendering.js\";\nimport type { RawHighlightMode } from \"../color/sensor-color-development.js\";\nimport { createPrintJpegTask, PRINT_JPEG_LIMITS } from \"../output/print-jpeg.js\";\nimport type { SimulateEnvironmentSensorRawFrameInput } from \"../capture/environment-raw-producer.js\";\nimport { checkNativeRawIntegrity, prepareNativeRawDevelopment } from \"../capture/native-raw-development.js\";\nimport { createRawPixelDeveloper, normalizedRawSite, rawSiteSaturated, type RawDevelopmentSource } from \"../capture/raw-development-kernel.js\";\nimport { createAhdDemosaicTask } from \"../processing/demosaic.js\";\nimport { PROCESSING_MAX_PIXELS } from \"../processing/processing-task.js\";\nimport { renderSdrRunInto, type SdrPixelCounts } from \"../output/native-capture-sdr.js\";\nimport { prepareSdrPixelTone } from \"../output/sdr-rendering.js\";\nimport { BUILT_IN_BAYER_DEMOSAIC_MODEL_VERSION as BUILT_IN_DEMOSAIC_VERSION, createBuiltInBayerDemosaicProfiles } from \"../sensor/raw-reconstruction.js\";\nimport { transformOrientedRasterPointToNative } from \"../output/capture-geometry.js\";\nimport { resolveCaptureColorModel } from \"../color/capture-color.js\";\nimport { evaluateBt709Oetf, evaluateSrgbEncoding, resolveRgbColorSpace } from \"../color/rgb-color-spaces.js\";\nimport { serializePngImage, PNG_ENCODER_LIMITS, type PngColourEncoding } from \"../output/png-encoder.js\";\nimport { addJpegTextMetadata, addPngTextMetadata, parseOutputTextMetadata, type OutputTextMetadata } from \"../output/text-metadata.js\";\nimport { parseLensProjectionModel, type LensProjectionModel } from \"../camera/lens-projection.js\";\nimport { prepareEnvironmentLensFieldMapping, type EnvironmentLensFieldMapping } from \"../optics/sensor-environment-query.js\";\nimport type { RadialDistortionProfile } from \"../optics/radial-distortion.js\";\nimport type { BrownConradyDistortionProfile } from \"../optics/brown-conrady-distortion.js\";\nimport type { IlluminationVignettingProfile } from \"../optics/illumination-vignetting.js\";\nimport type { CalculateSensorPsfIrradianceQuadratureInput } from \"../optics/sensor-psf-quadrature.js\";\nimport type { CalculateEnvironmentSensorPhotoSignalInput } from \"../sensor/environment-photo-signal.js\";\nimport { createRollingShutterCaptureExposureSchedule, resolveElectronicRollingShutterExposureSchedule,\n type ElectronicRollingShutterExposureSchedule } from \"../sensor/readout-exposure-linkage.js\";\nimport { calculateCaptureExposureWindows } from \"../sensor/exposure-window.js\";\nimport { calculateSensorSpectralQuadrature } from \"../sensor/spectral-quadrature.js\";\nimport { createDiffractionLimitedPsfProfile, type DiffractionLimitedPsfProfile } from \"../optics/diffraction-psf-profile.js\";\nimport { registerDiffractionPsfKey, siteDiffractionKernel } from \"../optics/site-diffraction-kernel.js\";\nimport { convolveSiteKernels, createDefocusDiscSiteKernel, requireDefocusDiscKernelRadius, resolveDefocusDisc, type ResolvedDefocusDisc } from \"../optics/defocus-disc-kernel.js\";\nimport { createDiffractedPlanarProvider } from \"./diffraction-provider.js\";\nimport { resolveGenericPrimeLens, type GenericPrimeLens } from \"../equipment/generic-prime-lenses.js\";\nimport { calculateChannelElectronsPerRadiance } from \"./channel-response.js\";\nimport { calculateSiteEffectiveSaturationCode } from \"../capture/raw-white-level.js\";\nimport { prepareSensorColorDevelopment } from \"../color/sensor-color-development.js\";\nimport { resolveAntiAliasingSpatialKernel, type AntiAliasingPointSplitComponent, type SensorOpticalStackProfile } from \"../sensor/optical-stack.js\";\nimport { multiplyMatrices, type ColorMatrix3x3, type ColorVector3 } from \"../color/colorimetry-math.js\";\nimport { prepareRgbGamutMapping, type PreparedRgbGamutMapping } from \"../color/gamut-mapping.js\";\nimport { serializeNativeRawDng, type NativeRawDng } from \"../capture/native-raw-dng.js\";\nimport { parseSensorReadoutConversionProfile, resolveSensorReadoutRegime } from \"../sensor/raw-readout.js\";\nimport { resolveChartScene, chartMaterialInputs, CHART_SCENE_PRESETS, type ChartScene, type ResolvedChartScene } from \"./chart-scenes.js\";\nimport { resolveChartMaterialLayers, type ChartMaterialLayerScene, type ResolvedChartMaterialLayers } from \"./chart-material-layers.js\";\nimport { resolveCaptureIlluminant, calculateIlluminantIrradianceScale, buildPlanarSceneRadianceProvider, requireCallerScene, FACADE_SPECTRAL_RANGE_NANOMETERS,\n resolveChartSizeOption, type ChartSizeOption,\n PHOTOPIC_MAXIMUM_LUMINOUS_EFFICACY_LM_PER_W, type CaptureIlluminant, type CallerMaterialScene, type CallerRadianceScene, type CallerReflectanceScene, type ResolvedCallerScene,\n planarProviderMaterialOfDirection, type PlanarSceneRadianceProvider, type ResolvedCallerMaterialScene, type ResolvedCaptureIlluminant } from \"./scene-radiance.js\";\n\n/** Version of how the facade builds requests. It changes whenever the same input would build a different request. */\nexport const SIMULATE_CAPTURE_FACADE_VERSION = \"1.0.0\" as const;\n\nexport type SimulateCaptureExposureMode = \"manual\" | \"aperture-priority\" | \"shutter-priority\" | \"program\";\n/**\n * 2.14: what the meter reads. `scene-average` (the default): the body's 16 × 16-zone meter reads the scene's luminance.\n * `grey-card`: incident metering; every zone reads the luminance 0.18·E/π of an 18 % Lambertian grey card under the\n * request's illuminance E, so the automatic modes choose settings whose `greyCardDeviationStops` is 0 (up to their steps\n * and limits), whatever the scene's reflectances.\n */\nexport type SimulateCaptureMetering = \"scene-average\" | \"grey-card\";\nexport const SIMULATE_CAPTURE_METERING_MODES: readonly SimulateCaptureMetering[] = /* @__PURE__ */ Object.freeze([\"scene-average\", \"grey-card\"] as const);\n/**\n * #516: what aperture priority does with Auto ISO once the ISO reaches the body's Auto ISO maximum and the exposure is\n * still under the meter target: `\"allow-slower-shutter\"` lengthens the shutter past the slowest preferred shutter to reach\n * the target; `\"hold-preferred-shutter\"` keeps the preferred shutter and leaves the exposure under target.\n */\nexport type SimulateCaptureAutoIsoAfterMaximum = \"allow-slower-shutter\" | \"hold-preferred-shutter\";\n/**\n * #516: how Auto ISO chose the ISO (`exposure.iso: \"auto\"`), reported in the result's `exposure.autoIso`. The full\n * resolver output stays in the capture's `exposure.resolution`.\n */\nexport interface SimulateCaptureAutoIsoReport {\n /** The ISO the meter target asked for at the resolved aperture and shutter, before the Auto ISO range and the ISO grid. */\n idealIsoBeforeConstraints: number;\n /**\n * The body's Auto ISO range: its Auto ISO bounds, or its ISO range when it declares none (the tiers: ISO 100 to their\n * maximum). Without `limits` the ISO was chosen in this range.\n */\n autoIsoMinimum: number;\n autoIsoMaximum: number;\n /**\n * #505: present only with `exposure.autoIso.limits`: the photographer's Auto ISO range the ISO was chosen in, inside the\n * body's (`minimum` is the body's Auto ISO minimum when the option omits it).\n */\n limits?: { minimum: number; maximum: number };\n /** Whether the ISO was held at an end of the Auto ISO range. */\n clamped: false | \"minimum\" | \"maximum\";\n /**\n * The constraint that limited the resolved exposure: the resolver's `targetResidual.limitingConstraint`, for example\n * `\"iso-maximum\"` (the exposure stays under target at the body's Auto ISO maximum), `\"user-iso-maximum\"` (#505: at the\n * photographer's `limits.maximum`, below the body's), `\"iso-grid-quantization\"` (the nearest selectable ISO) or `\"none\"`\n * (on target).\n */\n limitingConstraint: ExposureResolutionConstraint;\n /** The resolver's residual, log2(target / achieved exposure), in stops: positive when the exposure is under the meter target, negative when over it. */\n residualStops: number;\n /**\n * Aperture priority, and program with a slowest preferred shutter (#504): the policy and slowest preferred shutter used,\n * and whether the slower-shutter fallback ran.\n */\n afterMaximumIso?: SimulateCaptureAutoIsoAfterMaximum;\n slowestPreferredShutterSeconds?: number;\n afterMaximumIsoFallbackUsed?: boolean;\n /** #504, program only: whether the program line's shutter was longer than the slowest preferred shutter and was held. */\n slowestPreferredShutterApplied?: boolean;\n /** #504: present only with `slowestPreferredShutterSeconds: \"auto\"`: how the engine derived it (`estimateAutoIsoSlowestShutter`). */\n automaticSlowestShutter?: SimulateCaptureAutomaticSlowestShutterReport;\n /** 2.14: present when `exposure.autoIso.isoSteps` is given: the ISO steps Auto ISO chose from. */\n isoSteps?: \"whole-stop\" | \"third-stop\";\n}\n/**\n * #504: the settings of `exposure.autoIso.slowestPreferredShutterSeconds: \"auto\"`. Every field is optional; the defaults are\n * labelled generic values, recorded as `default` assumptions.\n */\nexport interface SimulateCaptureAutomaticSlowestShutterOptions {\n /** The bias in whole stops, as cameras' Auto minimum-shutter settings offer: +1 one stop faster, −1 one stop slower; −2 to +2. Default 0. */\n fasterByStops?: number;\n /** The shake blur allowed, in sensor pixels of `sensor.pixelPitchMicrometers`. Default 1 (a generic pixel-level budget). */\n blurBudgetPixels?: number;\n /**\n * The hand's constant angular velocity, rad/s (signs as in `motion.angularVelocityRadPerSec`; only the magnitude matters).\n * Default `GENERIC_HANDHELD_ANGULAR_VELOCITY_RAD_PER_SEC`: 4.39 °/s on yaw, a cited generic value for a 100 g phone held in\n * two hands (Xiao et al., Proc. SPIE 7250, 2009), not a measurement of you or of this camera.\n */\n angularVelocityRadPerSec?: { yaw: number; pitch: number };\n /** Stabilization in equivalent stops (≥ 0, at most 10), scaling the motion by 2^−stops. Default 0: the tiers declare no stabilization. */\n stabilizationStopsEquivalent?: number;\n}\n/** #504: the automatic slowest preferred shutter in the Auto ISO report. */\nexport interface SimulateCaptureAutomaticSlowestShutterReport {\n /** The exposure time whose camera-shake blur equals the budget (`estimateCameraShakeBlur`), before the bias and the grid. */\n derivedShutterSeconds: number;\n fasterByStops: number;\n /** derivedShutterSeconds · 2^−fasterByStops. */\n biasedShutterSeconds: number;\n /** The slowest preferred shutter used: the biased time within the body's shutter range. */\n shutterSeconds: number;\n blurBudgetPixels: number;\n /** The shake blur at `shutterSeconds`, in pixels. */\n blurAtShutterPixels: number;\n angularVelocityRadPerSec: { yaw: number; pitch: number };\n stabilizationStopsEquivalent: number;\n}\nexport type SimulateCaptureOutputFormat = \"srgb-8\" | \"srgb-16\" | \"jpeg\" | \"png\" | \"dng\";\nexport type SimulateCaptureWhiteBalance =\n | \"scene-illuminant\"\n | \"auto\"\n | \"none\"\n | { kelvin: number; tint?: number }\n | { channelGains: { red: number; green: number; blue: number } };\n/**\n * PNG colour encoding. `srgb` is the developed sRGB output. The others take the developed linear\n * colour (camera → XYZ → linear sRGB/D65, unclipped) and convert it through CIE XYZ into the target\n * primaries:\n * - `display-p3`: Display P3 primaries (W3C CSS Color 4 `display-p3`; also SMPTE EG 432-1) with the\n * sRGB transfer function;\n * - `rec2020`: ITU-R BT.2020 primaries and OETF.\n * PQ and HLG (BT.2100) are not part of 2.0; see THIRD_PARTY.md.\n */\nexport type SimulateCaptureColorEncoding = \"srgb\" | \"display-p3\" | \"rec2020\";\n/**\n * Demosaic. `bilinear`: the built-in Bayer kernels (`createBuiltInBayerDemosaicProfiles`). `ahd` (2.1): adaptive\n * homogeneity-directed demosaicing (`createAhdDemosaicTask`, after Hirakawa & Parks 2005), a non-linear\n * edge-directed method that reduces zipper and false colour on sharp edges.\n */\nexport type SimulateCaptureDemosaic = \"bilinear\" | \"ahd\";\n/** `output.demosaic` as a record (#395): the demosaic and its `fast` override (see {@link SimulateCaptureOptions.fast}). */\nexport interface SimulateCaptureDemosaicRecord { kind: SimulateCaptureDemosaic; fast?: boolean }\n/**\n * `margin` renders extra native sites around the output, as far as the kernel reaches. `mirror` renders\n * exactly the output and reads mirrored (reflect-101) copies of the missing border sites. Mirroring is\n * checked to keep the CFA (colour filter array) pattern consistent.\n */\nexport type SimulateCaptureBorderHandling = \"margin\" | \"mirror\";\nexport type SimulateCaptureLensDistortion =\n | { kind: \"radial\"; profile: RadialDistortionProfile }\n | { kind: \"brown-conrady\"; profile: BrownConradyDistortionProfile };\n/**\n * Diffraction model (2.1): the shorthand or a record with an explicit kernel radius in sites and (#395) a `fast` override\n * (see {@link SimulateCaptureOptions.fast}). The record names the model by `kind`; `aperture`, its name before #395, is still\n * accepted as a deprecated alias until 3.0.0, and giving both is an error.\n */\nexport type SimulateCaptureLensDiffraction =\n | \"circular-aperture\"\n | { kind: \"circular-aperture\"; kernelRadiusSamples?: number; fast?: boolean }\n | {\n /** @deprecated Since #395: use `kind`. Accepted until 3.0.0. */\n aperture: \"circular-aperture\"; kernelRadiusSamples?: number; fast?: boolean;\n };\n/**\n * Optical anti-aliasing (low-pass) filter (2.1), modelled as birefringent point splitting: each image point is\n * split into equally bright copies (the engine's `normalized-point-splitting-kernel` optical-stack response).\n * - `four-spot`: two crossed birefringent plates; copies at (±d/2, ±d/2), weight 1/4 each, MTF |cos(π·f_x·d)·cos(π·f_y·d)|.\n * - `two-spot`: one plate splitting along `axis`; copies at ±d/2, weight 1/2 each, MTF |cos(π·f·d)|.\n * - `point-splitting`: the engine contract itself, offsets in micrometres (+x right, +y down) and positive weights\n * summing to 1 (at most 16 components, each within 4 sites).\n * d = `separationSites` × pixel pitch, 0 < separationSites ≤ 4, default 1 (first MTF zero at the sensor's Nyquist\n * frequency 1/(2·pitch)).\n */\nexport type SimulateCaptureSensorAntiAliasing =\n | { kind: \"four-spot\"; separationSites?: number; fast?: boolean }\n | { kind: \"two-spot\"; axis: \"horizontal\" | \"vertical\"; separationSites?: number; fast?: boolean }\n | { kind: \"point-splitting\"; components: readonly AntiAliasingPointSplitComponent[]; fast?: boolean };\n/** Pixel aperture (2.3): centre sampling, or the square photosite integrated with an N × N midpoint rule; `fast` (#395) overrides the top-level flag. */\nexport type SimulateCapturePixelAperture = \"point\" | \"box\" | { kind: \"box\"; samplesPerAxis?: number; fast?: boolean };\n/** Default midpoint samples per axis of `sensor.pixelAperture: \"box\"`. */\nexport const SIMULATE_CAPTURE_BOX_APERTURE_DEFAULT_SAMPLES = 4;\nexport interface SimulateCaptureMotion {\n /** Constant camera angular velocity, rad/s, in the engine's pitch/yaw/roll convention. Missing axes are 0. */\n angularVelocityRadPerSec?: { pitch?: number; yaw?: number; roll?: number };\n /** Default \"global\". `rolling` derives the exposure schedule from the body's rolling readout declaration. */\n shutter?: \"global\" | \"rolling\";\n /** Rolling shutter only: time from the first to the last line over the simulated frame, in s. Default: the body's declared readout skew. */\n rollingShutterSkewSeconds?: number;\n}\n\nexport interface SimulateCaptureOptions {\n /** Generic tier preset id or a full preset record (for example a modified copy of a catalog entry). Default \"professional\". */\n camera?: GenericEquipmentTier | GenericEquipmentTierPreset;\n lens?: {\n /** Must lie in the lens capability (the generic primes are 50 mm). Default: the lens's shortest focal length. */\n focalLengthMm?: number;\n /**\n * Opt-in (2.3): a lens of the generic prime family by its full-frame-equivalent focal length\n * (`GENERIC_PRIME_EQUIVALENT_FOCAL_LENGTHS_MM`). Its physical focal length is the equivalent ÷ the diagonal crop\n * factor of the simulated frame (output width × height × pixel pitch); it replaces the tier lens's focal length and\n * f-number range (the tier lens's transmission is kept). An f-number outside the prime's range, or a subject or\n * focus distance below its minimum focus distance, is rejected. Not combinable with `focalLengthMm`.\n */\n prime?: number;\n /** Aperture for manual and aperture-priority modes. Default 8. */\n fNumber?: number;\n /** Focus distance in metres. Default: the subject distance. */\n focusDistanceM?: number;\n /** Opt-in ideal circular-pupil ray sampling (defocus/depth of field). Default off (central ray only). */\n pupilSampling?: { radialSamples: number; angularSamples: number };\n /** Ideal lens projection (`LENS_PROJECTION_MODELS`). Default \"rectilinear\". Not combinable with pupilSampling. */\n projection?: LensProjectionModel;\n /** Caller-declared radial or Brown–Conrady distortion profile. Default none. Not combinable with pupilSampling. */\n distortion?: SimulateCaptureLensDistortion;\n /** Caller-declared radial relative-illumination (vignetting) profile, applied as environment field throughput. */\n vignetting?: IlluminationVignettingProfile;\n /**\n * Caller sampled lens PSF, passed unchanged to the environment contract. Its focal length, f-number and\n * focus must equal the resolved capture settings exactly. Not combinable with pupilSampling.\n */\n psf?: Extract<CalculateEnvironmentSensorPhotoSignalInput[\"psf\"], { kind: \"sampled-local\" }>;\n /**\n * Opt-in (2.1) diffraction blur of an ideal, aberration-free, in-focus lens with a circular pupil at the\n * capture's resolved f-number: the engine builds the Airy kernels (`createDiffractionLimitedPsfProfile`)\n * on the site pitch. `kernelRadiusSamples` (0–32) sets the kernel window; default: the third dark ring at\n * the longest spectral node, capped at 32 sites. Not combinable with `psf` or `pupilSampling`. Default off.\n */\n diffraction?: SimulateCaptureLensDiffraction;\n /**\n * Opt-in (#492): defocus of the flat scene plane when `focusDistanceM` differs from the subject distance, as a\n * geometric disc (`model: \"geometric-disc\"`): the thin-lens blur circle of an ideal uniform circular pupil\n * (`calculateDefocusCircle`), an approximation. The blur diameter is recorded in the `lens.defocus` assumption.\n * `simulateCapture` renders the blur as an object-space convolution of the scene radiance on the site lattice and\n * `simulateDisplayView` as a site kernel in its expected signal; with `diffraction` each spectral node's diffraction\n * kernel is convolved with the disc (a further approximation). In focus the result is that of the same request\n * without the option, plus the assumption.\n * Not combinable with `pupilSampling` or `psf`. Default off.\n */\n defocus?: { model: \"geometric-disc\" };\n };\n exposure?: {\n /** Default \"manual\". */\n mode?: SimulateCaptureExposureMode;\n /**\n * Default 100. #516: `\"auto\"` lets the body's Auto ISO choose the ISO from the meter target, within its Auto ISO range\n * (the tiers: ISO 100 to their maximum), in every mode: manual keeps the aperture and shutter; aperture priority keeps the\n * aperture and follows `autoIso`; shutter priority picks the aperture at the lowest Auto ISO (no wider than the target\n * needs, so at most the widest) and raises the ISO for the rest; program picks the program line at the lowest Auto ISO and\n * raises the ISO beyond the line's end. The result reports the ISO in `exposure.settings.iso` and how it was chosen in\n * `exposure.autoIso`.\n */\n iso?: number | \"auto\";\n /**\n * Auto ISO settings, with `iso: \"auto\"` only.\n *\n * - `slowestPreferredShutterSeconds` and `afterMaximumIso` (#516): aperture priority, where the slowest shutter is\n * required, and (#504) program, where it is optional. The shutter gets as long as `slowestPreferredShutterSeconds`\n * (seconds, within the body's shutter range) at the lowest Auto ISO; beyond it the ISO rises; at the Auto ISO maximum\n * `afterMaximumIso` decides (default `\"allow-slower-shutter\"`; in program the shutter then never gets longer than the\n * program line's own). Without it, program follows its line as before.\n * - `slowestPreferredShutterSeconds: \"auto\"` (#504): the engine derives it from the focal length, the pixel pitch and a\n * hand-shake profile with `estimateAutoIsoSlowestShutter` (the camera-shake model, not the 1/focal-length rule of\n * thumb); `automaticSlowestShutter` sets the bias, the blur budget, the shake and the stabilization.\n * - `limits` (#505): every mode. The photographer's Auto ISO range `{ maximum, minimum? }`, a choice kept apart from\n * the body's Auto ISO capability: both are selectable ISOs inside the body's Auto ISO range, `minimum` at most\n * `maximum` (default: the body's minimum). Outside the body's range or off its ISO grid the request fails; the\n * engine never clips a limit. When the ISO stops at a limit strictly inside the body's range, the report's\n * `limitingConstraint` is `\"user-iso-maximum\"` or `\"user-iso-minimum\"`.\n * - `isoSteps` (2.14): `\"whole-stop\"` (default) lets Auto ISO choose only the whole-stop ISOs of the body's grid\n * (100, 200, 400 …), as before the generic bodies gained third-stop settings (preset 2.1.0); `\"third-stop\"` lets it\n * choose every setting (100, 125, 160 …). Manual ISO always takes any setting of the grid. Limits must lie on the\n * grid Auto ISO uses.\n */\n autoIso?: { slowestPreferredShutterSeconds?: number | \"auto\"; afterMaximumIso?: SimulateCaptureAutoIsoAfterMaximum; limits?: AutoIsoLimits;\n automaticSlowestShutter?: SimulateCaptureAutomaticSlowestShutterOptions; isoSteps?: \"whole-stop\" | \"third-stop\" };\n /** Shutter for manual and shutter-priority modes. Default 1/125 s. */\n shutterSeconds?: number;\n /** Exposure compensation applied to the meter target, in stops. Default 0. */\n compensationStops?: number;\n /**\n * 2.14: `\"scene-average\"` (default) or `\"grey-card\"` (incident metering, see {@link SimulateCaptureMetering}). Manual\n * exposure does not use the meter's reading, so the setting changes only the automatic modes and Auto ISO.\n */\n metering?: SimulateCaptureMetering;\n };\n /**\n * Required: an engine chart (for example `{ preset: \"uniform\" }`, an 18 % grey card), a declared `material-layers` scene (#491:\n * a chart under shape-mask layers, as `resolveChartMaterialLayers` takes it; the capture is that of its `callerScene`, byte for\n * byte, and the display view can render it on the GPU), or a caller reflectance, radiance or material function.\n */\n scene: ChartScene | ChartMaterialLayerScene | CallerReflectanceScene | CallerRadianceScene | CallerMaterialScene;\n /** Distance from the camera to the scene plane in metres. Default 5. */\n subjectDistanceM?: number;\n /**\n * Opt-in (2.3) fixed-size chart: place the scene at this physical size on the plane at the subject distance,\n * centred on the optical axis, instead of sizing it to fill the frame. Outside it the plane is a neutral surround\n * (default 18 %). Chart presets are resolved in the chart's own frame (aspect heightM / widthM); caller functions\n * are called only on the chart and receive chart-local `chartU`, `chartV`. `result.scene.chart` reports the\n * framed width, the fraction of the frame the chart covers and the thin-lens magnification.\n */\n chartSize?: ChartSizeOption;\n /** Default: Planckian 6500 K (a blackbody stand-in for daylight; CIE D65 is not bundled). */\n illuminant?: CaptureIlluminant;\n /** Illuminance on the scene plane, lux. Default about 21 481 lux (see `SIMULATE_CAPTURE_DEFAULT_ILLUMINANCE_LUX` and the assumptions). */\n illuminanceLux?: number;\n output?: {\n /** Output pixels; the native sensor raster adds a one-site demosaic border on each side. Defaults 64 × 64. */\n width?: number;\n height?: number;\n /** Default \"srgb-8\". */\n format?: SimulateCaptureOutputFormat;\n /** Default \"identity\". */\n toneCurve?: SdrToneCurve;\n /** Required by the luminance tone curves (see `SdrToneCurveParameters`). The facade does not make one up. */\n toneCurveParameters?: SdrToneCurveParameters;\n /** Default \"clip\". */\n highlightMode?: RawHighlightMode;\n /** Default \"scene-illuminant\". */\n whiteBalance?: SimulateCaptureWhiteBalance;\n /** JPEG constant quantization step 1-255 (not a manufacturer 'quality'). Default 2. */\n jpegQuantizationStep?: number;\n /** PNG only. Default \"srgb\". */\n colorEncoding?: SimulateCaptureColorEncoding;\n /** PNG only: 8 or 16 bits per sample. Default 8. */\n bitDepth?: 8 | 16;\n /**\n * PNG SDR encodings only. Default \"clip\" (per-component clip to the target gamut). \"perceptual\" maps\n * through `prepareRgbGamutMapping`: constant CIELAB L* and hue, chroma above 90 % of the boundary compressed.\n */\n gamutMapping?: \"clip\" | \"perceptual\";\n /** Default: the 1.0 facade's bilinear RGGB kernels. The record form (#395) adds a `fast` override. */\n demosaic?: SimulateCaptureDemosaic | SimulateCaptureDemosaicRecord;\n /** Default \"margin\". */\n borderHandling?: SimulateCaptureBorderHandling;\n /** DNG only: optional capture-event time (YYYY-MM-DDTHH:mm:ss.sssZ); without it no date tags are written. */\n dng?: { capturedAtUtc?: string };\n /**\n * Opt-in (2.4) text written into the file for formats \"jpeg\", \"png\" and \"dng\": the caller's description,\n * software, copyright and comment, unchanged (JPEG XMP + COM, PNG tEXt/iTXt, DNG TIFF tags + XMP; see the\n * quick start). Each field is 1–2048 UTF-8 bytes with no control characters except line feed. Default: none.\n */\n metadata?: OutputTextMetadata;\n /**\n * Opt-in large images: the most native sensor sites (the output plus the demosaic margin on each side) the\n * capture may allocate, an integer up to `NATIVE_RAW_LIMITS.ceilingPixels` (2^27). With it, `width` and\n * `height` may each reach 16 384 sites including the margin; without it they stay at most 4094. Time and\n * memory grow with the pixel count (see \"Large images\" in the quick start); browsers may fail at large sizes.\n */\n maximumPixels?: number;\n /**\n * Opt-in (2.3) region rendering: render only this rectangle, in output-pixel coordinates of the whole frame\n * `width` × `height` (x right, y down from its top-left). The pixels are byte-identical to the same pixels of\n * the whole render: framing, metering, exposure, noise seeds (absolute native site indices), rolling-shutter row\n * timing, diffraction and demosaic all use the whole frame. Use it to tile a large frame across workers or to\n * render a 100 % crop. `result.image` is the region; `result.region` reports it. Not combinable with\n * `whiteBalance: \"auto\"`, whose statistics would come from the region only. From 2.6 the diffraction convolution\n * covers only the region plus the kernel and filter reach, so a small region of a large frame costs about as much\n * as a capture of the region's size.\n */\n region?: { x: number; y: number; width: number; height: number };\n };\n /** Camera motion and shutter type. Default: still camera, global electronic shutter. */\n motion?: SimulateCaptureMotion;\n sensor?: {\n /**\n * Pixel pitch in micrometres, 0.5–1000. Default 6. The simulated sensor is output width × pitch wide. 2.5: above 100 µm the\n * capture is a downsized view of a whole frame (for example 36 mm / 48 pixels = 750 µm), recorded in the assumption\n * `sensor.wholeFrameView`: brightness is unchanged and the noise is that of a binned view, not of the real sensor's pixels.\n */\n pixelPitchMicrometers?: number;\n /** Maximum spectral quadrature subinterval in nm. Default 20. */\n spectralStepNanometers?: number;\n /** Temporal midpoint samples across the exposure. Default 1. */\n temporalSampleCount?: number;\n /** Noise seed (uint32). Default 1. */\n noiseSeed?: number;\n /**\n * Opt-in (2.1) optical anti-aliasing filter (birefringent point splitting, `SimulateCaptureSensorAntiAliasing`).\n * Multiplies the scene queries by the number of split points. Default off (the tiers declare no filter).\n */\n antiAliasing?: SimulateCaptureSensorAntiAliasing;\n /**\n * Opt-in (2.3) pixel aperture. `\"point\"` (default): each site samples the irradiance at its centre.\n * `\"box\"`: each site integrates the irradiance over its whole square photosite (fill factor 1) with an\n * N × N midpoint rule, N = `samplesPerAxis` (1–16, default 4), so detail finer than a pixel averages out as\n * on a real sensor (pixel MTF |sinc(f·p)|) instead of aliasing. Multiplies the scene queries by N².\n */\n pixelAperture?: SimulateCapturePixelAperture;\n };\n /**\n * Exact or fast (#395). `false` or omitted: every option runs its exact method, the engine reference. `true`: each option\n * listed in {@link SIMULATE_CAPTURE_FAST_OPTIONS} runs its fast method where it has one, a measured, bounded approximation of\n * the exact one; an option without a fast method runs exact. An option's own record `fast` overrides this for that option\n * only. `diagnostics.fast` reports what was requested and what ran. No option has a fast method yet, so every result is exact.\n */\n fast?: boolean;\n /** Aborting cancels the running task; the promise rejects with a domain error and returns no partial image. */\n signal?: AbortSignal;\n /** Called after each committed RAW, development or JPEG tile. Cannot change output. */\n onProgress?: (progress: SimulateCaptureProgress) => void;\n}\n\n/**\n * Options reported in `diagnostics.options` (2.1), in this order, when they ran: the ones that change how much work\n * a capture does. `motion.rotation` is a non-zero angular velocity; `sensor.temporalSampleCount` a count above 1.\n */\nexport const SIMULATE_CAPTURE_COST_OPTIONS = /* @__PURE__ */ Object.freeze([\"lens.pupilSampling\", \"lens.projection\", \"lens.distortion\", \"lens.vignetting\", \"lens.psf\",\n \"lens.diffraction\", \"lens.defocus\", \"sensor.antiAliasing\", \"sensor.pixelAperture.box\", \"sensor.temporalSampleCount\", \"motion.rotation\", \"motion.shutter.rolling\", \"output.borderHandling.mirror\", \"output.region\",\n \"output.whiteBalance.auto\", \"output.demosaic.ahd\", \"output.highlightMode.reconstruct\", \"output.colorEncoding.wide-gamut\", \"output.gamutMapping.perceptual\",\n \"output.format.jpeg\", \"output.format.png\", \"output.format.dng\"] as const);\nexport type SimulateCaptureCostOption = typeof SIMULATE_CAPTURE_COST_OPTIONS[number];\n\n/**\n * The options that take the exact-or-fast flag (#395), in the path style of {@link SIMULATE_CAPTURE_COST_OPTIONS}: each accepts\n * the record form with `fast` and is reported in `diagnostics.fast.applied` when it runs. Every one of them takes the flag,\n * whether or not it has a fast method yet; one without runs exact and reports `false`.\n */\nexport const SIMULATE_CAPTURE_FAST_OPTIONS = /* @__PURE__ */ Object.freeze([\"lens.diffraction\", \"sensor.antiAliasing\", \"sensor.pixelAperture.box\", \"output.demosaic.ahd\"] as const);\nexport type SimulateCaptureFastOption = typeof SIMULATE_CAPTURE_FAST_OPTIONS[number];\n\n/** `diagnostics.fast` of a capture or display view (#395): what was asked for and what ran. */\nexport interface SimulateCaptureFastReport {\n /** True when `fast: true` was given at the top level or in any option's record. */\n requested: boolean;\n /** Each fast-capable option that ran, in {@link SIMULATE_CAPTURE_FAST_OPTIONS} order: true where its fast method ran. */\n applied: Readonly<Partial<Record<SimulateCaptureFastOption, boolean>>>;\n /** `engine-reference` when every option ran exact; `approximation-with-a-priori-bound` when any fast method ran (the WebGPU execution record's values). */\n assurance: \"engine-reference\" | \"approximation-with-a-priori-bound\";\n}\n\nexport interface SimulateCaptureProgress {\n stage: \"raw\" | \"white-balance\" | \"development\" | \"jpeg\";\n completedTileCount: number;\n totalTileCount: number;\n}\n\n/** One decision the facade made: a default, a derived value or a fixed modelling choice. */\nexport interface SimulateCaptureAssumption {\n /** Dotted option path or modelling topic, for example \"exposure.shutterSeconds\" or \"model.lens-psf\". */\n id: string;\n kind: \"default\" | \"derived\" | \"model\";\n value: unknown;\n explanation: string;\n}\n\nexport interface SimulateCaptureResult {\n facadeVersion: typeof SIMULATE_CAPTURE_FACADE_VERSION;\n engineApiVersion: string;\n image: {\n width: number;\n height: number;\n format: SimulateCaptureOutputFormat;\n /** Interleaved RGB, row by row from the top-left. sRGB-encoded (W3C CSS Color 4 sRGB; also IEC 61966-2-1) unless `colorEncoding` says otherwise. */\n samples: Uint8Array | Uint16Array;\n /** Baseline JPEG bytes when format is \"jpeg\". */\n jpeg?: Uint8Array;\n /** PNG file bytes when format is \"png\". */\n png?: Uint8Array;\n /** Encoding of `samples` and `png` when format is \"png\". */\n colorEncoding?: SimulateCaptureColorEncoding;\n /** Lossless uncompressed CFA DNG of the packed RAW when format is \"dng\" (`serializeNativeRawDng`); `samples` are then sRGB 8-bit. */\n dng?: Uint8Array;\n };\n /**\n * Packed native RAW (codes, black levels, saturation flags) as produced by the native environment RAW task. With\n * `output.region` (2.3): the region's native sites only, with `plan` describing that raster (its active area is the\n * region); `request.environmentRaw` and `request.siteInput` stay those of the whole frame.\n */\n raw: NativeRawOutput;\n plan: NativeRawPlan;\n /**\n * 2.3, present with `output.region`: the rendered rectangle in output pixels of the whole `frameWidth` × `frameHeight`\n * frame, and the native sites rendered for it (`nativeRect`, in the whole frame's native raster: the region, the\n * demosaic reach on each side clipped to the raster, and its origin rounded down to the 2 × 2 CFA repeat).\n */\n region?: { x: number; y: number; width: number; height: number; frameWidth: number; frameHeight: number; nativeRect: { x: number; y: number; width: number; height: number } };\n /** The complete underlying request. */\n request: {\n environmentRaw: NativeEnvironmentRawInput;\n /** Rebuilds the exact physical site input the provider supplied for a native row-major index. */\n siteInput(nativeIndex: number): SimulateEnvironmentSensorRawFrameInput[\"sites\"][number];\n development: Omit<NativeRawDevelopmentInput, \"raw\">;\n whiteBalanceState: ResolvedWhiteBalanceState | null;\n /**\n * Present with lens.diffraction (2.1): the engine-built Airy profile, the equivalent environment sampled PSF\n * selection, and how it was applied. With `object-space-convolution` the site inputs declare no PSF and the\n * provider answers with the PSF-convolved radiance; putting `psf` into each site input and using the plain\n * scene provider gives the same expected signal (to float rounding) through the per-tap environment quadrature.\n */\n diffraction?: { profile: DiffractionLimitedPsfProfile; psf: Extract<CalculateEnvironmentSensorPhotoSignalInput[\"psf\"], { kind: \"sampled-local\" }>;\n execution: \"object-space-convolution\" | \"environment-psf-quadrature\" };\n };\n exposure: {\n mode: SimulateCaptureExposureMode;\n settings: { fNumber: number; shutterSeconds: number; iso: number };\n /** Exposure value at ISO 100 of the settings, log2(N²/t). */\n ev100: number;\n /** #516: `\"automatic\"` when the request asked for `iso: \"auto\"`, else `\"manual\"`. */\n isoControl: \"manual\" | \"automatic\";\n /** #516: present with `iso: \"auto\"`: how Auto ISO chose `settings.iso` and what limited it. */\n autoIso?: SimulateCaptureAutoIsoReport;\n /** 2.14: the metering the exposure used (`exposure.metering`; `\"scene-average\"` when omitted). */\n metering: SimulateCaptureMetering;\n /** The scene's average luminance on the meter's zones, cd/m², with either metering. */\n meteredSceneLuminanceCdPerSquareMeter: number;\n /**\n * #515: deviation, in stops, of the exposure used from the CIPA DC-004-2020 standard exposure for the metered luminance L:\n * log2(N²/t) − log2(0.65·L·S/10). Positive is darker than the standard exposure (under), negative brighter (over). In an\n * automatic mode it is the compensation with the opposite sign plus any step or limit the resolver hit. Finite, or null when\n * the metered luminance is 0 (a black scene has no standard exposure).\n */\n standardExposureDeviationStops: number | null;\n /**\n * The illuminance, lux, at which the settings used give the standard exposure: E·L_ref(N, t, S)/L = E·2^Δ, with E the\n * request's `illuminanceLux`. Exact for a reflective scene (a chart, a reflectance function or a material scene), whose\n * metered luminance is proportional to E. Null for a black scene (L = 0) and for a radiance-function scene, whose\n * radiance does not depend on the illuminance. It may exceed the 1e7 lux that `illuminanceLux` accepts.\n */\n standardExposureIlluminanceLux: number | null;\n /**\n * 2.14: deviation, in stops, of the exposure used from the CIPA DC-004-2020 standard exposure of an 18 % Lambertian grey\n * card under the request's illuminance E (incident metering: the light falling on the scene, as a grey card or a\n * hand-held incident meter reads it): log2(L_ref(N, t, S) / (0.18·E/π)), with L_ref = 10·N²/(0.65·t·S). Same sign as\n * `standardExposureDeviationStops` (positive is darker, under). It does not depend on the scene's reflectances; with the\n * default settings and illuminance it is exactly 0. The exposure modes still meter the scene (`meteredSceneLuminanceCdPerSquareMeter`);\n * this only reports where the settings used sit against the grey card. Null for a radiance-function scene, whose radiance\n * does not depend on the illuminance.\n */\n greyCardDeviationStops: number | null;\n /** Full output of the existing exposure-mode resolver. */\n resolution: unknown;\n };\n scene: {\n sceneId: string;\n preset: string;\n parameters: Readonly<Record<string, unknown>>;\n illuminant: { id: string; description: string; illuminanceLux: number };\n distanceM: number;\n /** Physical size of the framed scene plane, metres. */\n framedWidthM: number;\n framedHeightM: number;\n /**\n * 2.3, present with `chartSize`: the chart's physical size and surround, the fraction of the frame width and\n * height it covers (above 1 when it is larger than the frame and cropped), the thin-lens magnification\n * v/d (image distance over subject distance, the scale the facade's framing uses) and the chart's size on the\n * sensor in millimetres and output pixels.\n */\n chart?: { widthM: number; heightM: number; surroundReflectance: number; frameWidthFraction: number; frameHeightFraction: number;\n magnification: number; imageWidthMm: number; imageHeightMm: number; imageWidthPixels: number; imageHeightPixels: number };\n /**\n * SHA-256 of the canonical scene description, recorded as the capture source digest. Caller spectra (a\n * `spectrum` or `daylight` illuminant, chart reflectance spectra) are part of the description: tabulated\n * data exactly, function spectra sampled at 1 nm over 380-780 nm, plus the daylight basis datasetId.\n * The body of a caller scene's evaluate function is not hashed.\n */\n sourceSha256: string;\n };\n diagnostics: {\n providerEvaluationCount: number;\n highlight: RawHighlightDiagnostics;\n rendering: SdrRenderingResult[\"diagnostics\"];\n /** Present with output.gamutMapping \"perceptual\": pixels whose chroma or lightness the mapping changed. */\n gamutMapping?: { method: \"cielab-hue-preserving-chroma-compression\"; kneeFraction: number; adjustedPixelCount: number; lightnessClippedPixelCount: number };\n /**\n * Wall-clock milliseconds per stage. `raw`, `whiteBalance` (the second RAW pass of auto white balance), `development`\n * (includes DNG writing), `jpeg` and `total` are whole milliseconds (`Date.now()`). Since 2.1, where a stage ran:\n * `diffraction` (the object-space convolution of `lens.diffraction`; part of `raw` and `whiteBalance`), `demosaic`\n * (the AHD demosaic; part of `development`) and `encode` (PNG, JPEG or DNG serialization), with sub-millisecond\n * resolution where the host has `performance.now()`. Timings vary from run to run and never enter any digest or output byte.\n * #492: `defocus`, the object-space convolution of `lens.defocus` out of focus (with `lens.diffraction` the combined\n * kernel's convolution, reported here instead of under `diffraction`).\n */\n timingsMs: { raw: number; whiteBalance: number; development: number; jpeg: number; total: number; diffraction?: number; defocus?: number; demosaic?: number; encode?: number };\n /**\n * 2.1: the opt-in options that changed the work of this run, in a fixed order (see `SIMULATE_CAPTURE_COST_OPTIONS`).\n * Empty for a capture with every default. With `timingsMs` it lets an application measure each option's cost on\n * the user's device.\n */\n options: readonly SimulateCaptureCostOption[];\n /** #395: exact or fast, as requested and as run (see {@link SimulateCaptureFastReport}). */\n fast: SimulateCaptureFastReport;\n };\n provenance: {\n scientificStatus: \"approximation\";\n cameraPresetId: string;\n cameraPresetVersion: string;\n evidence: readonly EvidenceProvenance[];\n /** Existing engine contracts the facade composed, in execution order. */\n composedContracts: readonly string[];\n limitations: readonly string[];\n };\n assumptions: readonly SimulateCaptureAssumption[];\n}\n\nexport const FACADE_EVIDENCE: readonly EvidenceProvenance[] = /* @__PURE__ */ Object.freeze([/* @__PURE__ */ Object.freeze({ sourceOrigin: \"photivra\" as const,\n sourceReference: \"photivra:simulate-capture-facade\", reuseStatus: \"photivra-owned\" as const })]);\nconst DEFAULTS = /* @__PURE__ */ Object.freeze({ camera: \"professional\" as const, fNumber: 8, shutterSeconds: 1 / 125, iso: 100, compensationStops: 0,\n subjectDistanceM: 5, width: 64, height: 64, format: \"srgb-8\" as const, toneCurve: \"identity\" as const, highlightMode: \"clip\" as const,\n whiteBalance: \"scene-illuminant\" as const, jpegQuantizationStep: 2, pixelPitchMicrometers: 6, spectralStepNanometers: 20,\n temporalSampleCount: 1, noiseSeed: 1, illuminantKelvin: 6500 });\n/** Standard output sensitivity S = 10 / H (CIPA DC-004-2020 §3.2): the reference exposure in lx·s is 10 / S. */\nconst SOS_REFERENCE_EXPOSURE_NUMERATOR_LUX_SECONDS = 10;\n/** Camera equation H = 0.65·L·t/N² (CIPA DC-004-2020 §5.5 (4); 0.65 = τ·π/4 with τ = 0.828, Explanation 4). */\nconst CAMERA_EQUATION_CONSTANT = 0.65;\n/** Neutral reference reflectance: DC-004 ties the SOS reference level to an 18 % grey (Explanation 1 and 2.2). */\nconst GREY_CARD_REFLECTANCE = 0.18;\n/** Scene luminance (cd/m²) whose focal-plane exposure 0.65·L·t/N² equals the SOS reference exposure 10/S. */\nfunction sosReferenceLuminance(fNumber: number, shutterSeconds: number, iso: number): number {\n return SOS_REFERENCE_EXPOSURE_NUMERATOR_LUX_SECONDS * fNumber ** 2 / (CAMERA_EQUATION_CONSTANT * shutterSeconds * iso);\n}\n/**\n * #515: deviation, in stops, of the exposure the settings give from the CIPA DC-004-2020 standard exposure for the metered\n * luminance L: Δ = log2(N²/t) − log2(0.65·L·S/10) = log2(L_ref(N, t, S) / L), with L_ref the luminance that the settings\n * expose at H = 10/S (S = 10/H, §3.2; H = 0.65·L·t/N², §5.5 (4)). Positive is darker than the standard exposure (under).\n * A scene with no metered luminance (L = 0, which manual mode still captures) has no standard exposure: null, never ±Infinity.\n */\nfunction standardExposureDeviationStops(fNumber: number, shutterSeconds: number, iso: number, meteredLuminance: number): number | null {\n if (!(meteredLuminance > 0)) return null;\n const deviation = Math.log2(sosReferenceLuminance(fNumber, shutterSeconds, iso) / meteredLuminance);\n if (!Number.isFinite(deviation)) throw new InvalidScientificResultError(\"exposure.standardExposureDeviationStops is not finite (metered scene luminance \" +\n meteredLuminance + \" cd/m²).\");\n return deviation;\n}\n/**\n * The illuminance at which the settings give the standard exposure, E·L_ref/L (= E·2^Δ). A reflective scene's radiance is\n * reflectance × k(E)·S(λ)/π with k linear in E (calculateIlluminantIrradianceScale), so the metered L is proportional to E\n * and re-metering at this illuminance gives Δ = 0 up to rounding. A radiance-function scene ignores E, and a black scene\n * has no standard exposure: null.\n */\nfunction standardExposureIlluminanceLux(fNumber: number, shutterSeconds: number, iso: number, meteredLuminance: number, illuminanceLux: number,\n radianceScalesWithIlluminance: boolean): number | null {\n if (!radianceScalesWithIlluminance || !(meteredLuminance > 0)) return null;\n const lux = illuminanceLux * sosReferenceLuminance(fNumber, shutterSeconds, iso) / meteredLuminance;\n if (!Number.isFinite(lux)) throw new InvalidScientificResultError(\"exposure.standardExposureIlluminanceLux is not finite (metered scene luminance \" +\n meteredLuminance + \" cd/m²).\");\n return lux;\n}\n/**\n * 2.14: deviation, in stops, of the settings from the standard exposure of an 18 % Lambertian grey card under illuminance E:\n * Δ_grey = log2(L_ref(N, t, S) / (0.18·E/π)), computed as log2((π·L_ref/0.18) / E) so that at the default settings the\n * numerator is SIMULATE_CAPTURE_DEFAULT_ILLUMINANCE_LUX in the same operations, and the default request gives exactly 0.\n * The grey card's luminance L = ρ·E/π is that of a Lambertian reflector (luminance = illuminance × reflectance / π).\n */\nfunction greyCardDeviationStops(fNumber: number, shutterSeconds: number, iso: number, illuminanceLux: number): number {\n const deviation = Math.log2(Math.PI * sosReferenceLuminance(fNumber, shutterSeconds, iso) / GREY_CARD_REFLECTANCE / illuminanceLux);\n if (!Number.isFinite(deviation)) throw new InvalidScientificResultError(\"exposure.greyCardDeviationStops is not finite (illuminance \" + illuminanceLux + \" lux).\");\n return deviation;\n}\n/**\n * Default illuminance, lux: an 18 % Lambertian grey card (L = 0.18·E/π) then gets exactly the CIPA DC-004 standard\n * output sensitivity reference exposure H = 10/S at f/8, 1/125 s, ISO 100:\n * E = π·10·N²/(0.65·t·S·0.18) = π·80 000/11.7 ≈ 21 480.98 lux.\n */\nexport const SIMULATE_CAPTURE_DEFAULT_ILLUMINANCE_LUX = Math.PI * sosReferenceLuminance(DEFAULTS.fNumber, DEFAULTS.shutterSeconds, DEFAULTS.iso) /\n GREY_CARD_REFLECTANCE;\n/**\n * Sensitive-aperture area (µm²) at which the tier's ISO signal chain applies unchanged: the default 6 µm square\n * aperture with fill factor 1. At other areas the facade scales the electron-domain readout values by\n * area / this reference, so the same focal-plane exposure H gives the same output code (see `isoAreaScaledReadout`).\n */\n/** 2.5: the largest accepted pixel pitch, µm (44 mm ÷ 48 pixels ≈ 917 µm, a whole full-frame or larger sensor at a small output). */\nconst SIMULATE_CAPTURE_PIXEL_PITCH_MAXIMUM_MICROMETERS = 1000;\n/** Pitches above this, µm, are larger than any camera photosite: the capture is a downsized whole-frame view (assumption sensor.wholeFrameView). */\nconst SIMULATE_CAPTURE_PHOTOSITE_PITCH_MAXIMUM_MICROMETERS = 100;\nconst ISO_REFERENCE_APERTURE_AREA_SQUARE_MICROMETERS = DEFAULTS.pixelPitchMicrometers * DEFAULTS.pixelPitchMicrometers;\n/** Demosaic border, native sites per side. */\nconst MARGIN = 1;\n/**\n * AHD border, native sites per side: an AHD output pixel depends on sites up to 5 away (directional green ±2,\n * colour differences ±1 of it, the homogeneity's 4-neighbours and its 3 × 3 sum), so a 5-site rendered margin keeps\n * every output pixel off the plane's mirrored edge.\n */\nconst AHD_MARGIN = 5;\n/** Sites whose values enter an AHD output pixel (interpolation reach), for the saturated-pixel count. */\nconst AHD_VALUE_REACH = 3;\n\n/** Anti-aliasing filter limits: split points, and the largest offset in sites (bounds the scene work and the convolution margin). */\nconst AA_MAXIMUM_COMPONENTS = 16;\nconst AA_MAXIMUM_OFFSET_SITES = 4;\n/** Channel responses kept across calls (`axisChannelResponse`): one entry per distinct sensor, exposure and optics state. */\nconst CHANNEL_RESPONSE_CACHE_SIZE = 8;\nconst channelResponseCache = new Map<string, Record<\"red\" | \"green\" | \"blue\", Map<number, number>>>();\n/**\n * #449: diffraction profiles kept across calls, by the JSON of their `createDiffractionLimitedPsfProfile` input (the last\n * DIFFRACTION_PROFILE_CACHE_SIZE, most recently used last). Every region part and detail tile of one request builds the same\n * input. The kept record is private: each call gets its own copy, as mutable as a newly built one, so a caller's change\n * never reaches another call. The copy is made of plain records and arrays (plainDataCopy): the kernel set-up structured-clones\n * the profile once per spectral node, and in a CPU profile of the 96 × 64 Quality tile that clone took about twice as long\n * (24 instead of 12 ms per call) on a deep-frozen record or on a structuredClone copy as on a newly built record or this copy.\n */\nconst DIFFRACTION_PROFILE_CACHE_SIZE = 8;\nconst diffractionProfileCache = new Map<string, DiffractionLimitedPsfProfile>();\n/** A copy of plain data (records, arrays, primitives; typed arrays are sliced), built from ordinary literals. */\nfunction plainDataCopy<T>(value: T): T {\n if (Array.isArray(value)) return value.map(plainDataCopy) as T;\n if (ArrayBuffer.isView(value)) return (value as unknown as { slice(): T }).slice();\n if (value === null || typeof value !== \"object\") return value;\n const copy: Record<string, unknown> = {};\n for (const key of Object.keys(value)) copy[key] = plainDataCopy((value as Record<string, unknown>)[key]);\n return copy as T;\n}\n/** The profile of `input` (a pure function of the input record): a copy of the kept one when the same input was built before. */\nfunction cachedDiffractionProfile(input: Parameters<typeof createDiffractionLimitedPsfProfile>[0]): DiffractionLimitedPsfProfile {\n const key = JSON.stringify(input);\n let kept = diffractionProfileCache.get(key);\n if (kept) diffractionProfileCache.delete(key);\n else kept = createDiffractionLimitedPsfProfile(input).value;\n diffractionProfileCache.set(key, kept);\n if (diffractionProfileCache.size > DIFFRACTION_PROFILE_CACHE_SIZE) diffractionProfileCache.delete(diffractionProfileCache.keys().next().value!);\n // The same fields in the same order as the built record, frozen at the top level like it; `model` is the frozen constant.\n return Object.freeze({ ...kept, profile: plainDataCopy(kept.profile), wavelengths: plainDataCopy(kept.wavelengths), quadrature: plainDataCopy(kept.quadrature) });\n}\n/** Default birefringent separation in sites: the two-spot MTF |cos(π·f·d)| then has its first zero at Nyquist, f = 1/(2·pitch). */\nconst AA_DEFAULT_SEPARATION_SITES = 1;\ninterface ParsedAntiAliasing { kind: SimulateCaptureSensorAntiAliasing[\"kind\"]; separationSites?: number; axis?: \"horizontal\" | \"vertical\";\n components: AntiAliasingPointSplitComponent[] }\n/** #395: the `fast` override of an option record (undefined when absent), which must be a Boolean. */\nfunction fastOverride(record: Record<string, unknown>, path: string): boolean | undefined {\n const value = record.fast;\n if (value !== undefined && typeof value !== \"boolean\") fail(path + \".fast must be true or false.\");\n return value as boolean | undefined;\n}\n/** Parses `sensor.antiAliasing` into engine point-splitting components (offsets in µm, +x right, +y down). */\nfunction parseAntiAliasing(value: unknown, pitch: number): ParsedAntiAliasing {\n requireInputObject(value, \"sensor.antiAliasing\");\n const kind = (value as { kind?: unknown }).kind;\n const separation = (record: Record<string, unknown>): number => {\n if (record.separationSites === undefined) return AA_DEFAULT_SEPARATION_SITES;\n const d = positive(record.separationSites, \"sensor.antiAliasing.separationSites\");\n if (d > AA_MAXIMUM_OFFSET_SITES) fail(\"sensor.antiAliasing.separationSites must be greater than 0 and at most \" + AA_MAXIMUM_OFFSET_SITES + \".\");\n return d;\n };\n if (kind === \"four-spot\") {\n const record = allowKeys(value, \"sensor.antiAliasing\", [\"kind\", \"separationSites\", \"fast\"]), d = separation(record), h = d * pitch / 2;\n return { kind, separationSites: d, components: [[-h, -h], [h, -h], [-h, h], [h, h]].map(([x, y]) => ({ offsetMicrometers: { x: x!, y: y! }, normalizedWeight: 0.25 })) };\n }\n if (kind === \"two-spot\") {\n const record = allowKeys(value, \"sensor.antiAliasing\", [\"kind\", \"axis\", \"separationSites\", \"fast\"]), d = separation(record), h = d * pitch / 2;\n if (record.axis !== \"horizontal\" && record.axis !== \"vertical\") fail(\"sensor.antiAliasing.axis must be horizontal or vertical.\");\n const axis = record.axis as \"horizontal\" | \"vertical\";\n return { kind, axis, separationSites: d, components: [-h, h].map((o) => ({ offsetMicrometers: axis === \"horizontal\" ? { x: o, y: 0 } : { x: 0, y: o }, normalizedWeight: 0.5 })) };\n }\n if (kind === \"point-splitting\") {\n const record = allowKeys(value, \"sensor.antiAliasing\", [\"kind\", \"components\", \"fast\"]);\n if (!Array.isArray(record.components) || record.components.length === 0 || record.components.length > AA_MAXIMUM_COMPONENTS) {\n fail(\"sensor.antiAliasing.components must be an array of 1 to \" + AA_MAXIMUM_COMPONENTS + \" components.\");\n }\n // The engine's optical-stack parser checks shape, finiteness, positive weights and the unit sum (1e-12).\n const kernel = resolveAntiAliasingSpatialKernel({ schemaVersion: \"0.1.0\", profileId: \"facade-aa-check\", evidence: FACADE_EVIDENCE,\n effectiveAntiAliasingSpatialResponse: { kind: \"normalized-point-splitting-kernel\", evidence: FACADE_EVIDENCE, coordinateSystem: \"native-sensor-physical\",\n scope: \"field-wavelength-polarization-invariant-approximation\", components: record.components as AntiAliasingPointSplitComponent[] } });\n for (const c of kernel.components) if (Math.max(Math.abs(c.offsetMicrometers.x), Math.abs(c.offsetMicrometers.y)) > AA_MAXIMUM_OFFSET_SITES * pitch) {\n fail(\"sensor.antiAliasing.components offsets must lie within \" + AA_MAXIMUM_OFFSET_SITES + \" sites (\" + AA_MAXIMUM_OFFSET_SITES * pitch + \" µm) of the site centre.\");\n }\n return { kind, components: kernel.components.map((c) => ({ offsetMicrometers: { ...c.offsetMicrometers }, normalizedWeight: c.normalizedWeight })) };\n }\n return fail(\"sensor.antiAliasing.kind must be four-spot, two-spot or point-splitting.\");\n}\n\n/** Midpoint nodes of an N × N rule over a square photosite, as offsets from its centre in sites (+x right, +y down). */\nexport function apertureNodeOffsets(n: number): { x: number; y: number }[] {\n const out: { x: number; y: number }[] = [];\n for (let j = 0; j < n; j++) for (let i = 0; i < n; i++) out.push({ x: (i + 0.5) / n - 0.5, y: (j + 0.5) / n - 0.5 });\n return out;\n}\n/** Third dark ring of the Airy pattern in units of λ·N_w (j₁,₃/π, j₁,₃ = 10.1734681351): the default diffraction kernel reach. */\nconst AIRY_THIRD_ZERO_PER_LAMBDA_N = 10.173468135062722 / Math.PI;\n/** Default temporal midpoints when the camera rotates (2.0 motion option). */\nconst ROTATING_TEMPORAL_SAMPLE_COUNT = 8;\nconst IDS = /* @__PURE__ */ Object.freeze({ frame: \"facade-frame\", mode: \"native-still\", cfa: \"photivra-generic-bayer\", binding: \"facade-native-cfa\",\n sceneState: \"facade-scene-state\", scene: \"facade-scene\", provider: \"facade-provider\", lights: \"facade-lights\", materials: \"facade-materials\",\n capture: \"facade-capture\", spectral: \"facade-colorimetric-eqe\", sampling: \"facade-sampling\", stack: \"facade-no-aa\", stackAa: \"facade-aa\",\n stationarity: \"facade-stationarity\", operatingState: \"facade-operating-state\", dark: \"facade-dark\", completeness: \"facade-completeness\",\n chargeSampling: \"facade-charge-sampling\", capacity: \"facade-capacity\" });\nexport const CHANNELS = [\"red\", \"green\", \"blue\"] as const;\ntype Channel = typeof CHANNELS[number];\n/**\n * Synthetic colorimetric sensor: channel EQE(λ) = a·cmf(λ)·(555 nm/λ), with cmf = x̄, ȳ, z̄. The λ factor turns\n * the energy-weighted CMF (colour-matching function) into a photon-counting response. So channel counts are\n * proportional to CIE XYZ (the Luther–Ives condition holds, up to quadrature error), and the camera→XYZ\n * matrix is diagonal.\n */\nconst EQE_SCALE: Readonly<Record<Channel, number>> = /* @__PURE__ */ Object.freeze({ red: 0.5, green: 0.5, blue: 0.25 });\nconst CMF_KEY: Readonly<Record<Channel, \"x\" | \"y\" | \"z\">> = /* @__PURE__ */ Object.freeze({ red: \"x\", green: \"y\", blue: \"z\" });\nexport const CAMERA_TO_XYZ: readonly (readonly number[])[] = Object.freeze([[EQE_SCALE.green / EQE_SCALE.red, 0, 0], [0, 1, 0], [0, 0, EQE_SCALE.green / EQE_SCALE.blue]].map((r) => Object.freeze(r)));\nconst XYZ_TO_CAMERA = [[EQE_SCALE.red / EQE_SCALE.green, 0, 0], [0, 1, 0], [0, 0, EQE_SCALE.blue / EQE_SCALE.green]] as const;\n/** Synthetic dark current per site at the operating temperature, e⁻/s. */\nexport const DARK_CURRENT_ELECTRONS_PER_SECOND = 1;\nconst OPERATING_TEMPERATURE_C = 20;\n\nexport function fail(message: string): never { throw new InvalidConfigurationError(message); }\n/** Where `output.metadata` goes in each file format (reported in the `output.metadata` assumption). */\nconst TEXT_METADATA_LAYOUT = /* @__PURE__ */ Object.freeze({\n jpeg: \"XMP packet in APP1 (dc:description, xmp:CreatorTool, dc:rights, exif:UserComment), plus a COM segment holding the comment\",\n png: \"One tEXt (printable Latin-1) or iTXt (UTF-8) chunk per field, keywords Description, Software, Copyright, Comment, before the first IDAT\",\n dng: \"ImageDescription (statement, then the description) and Copyright when printable ASCII; an XMP packet in tag 700 with every field\"\n});\ntype ReadoutProfile = GenericEquipmentTierPreset[\"body\"][\"readout\"][number][\"profile\"];\n/**\n * The readout profile with every regime's charge-domain transfer scaled by `areaScale`: system conversion gain\n * (e⁻ per code) and pre-ADC saturation (e⁻ equivalent) are multiplied by it, so codes per unit focal-plane exposure\n * stay those of the reference aperture. Read noise stays in electrons per pixel; codes, black level, ADC and digital\n * gain are unchanged. The result is re-checked by the readout parser.\n */\nfunction isoAreaScaledReadout(profile: ReadoutProfile, areaScale: number): ReadoutProfile {\n return parseSensorReadoutConversionProfile({ ...profile, regimes: profile.regimes.map((regime) => ({ ...regime,\n systemConversionGainElectronsPerCode: { ...regime.systemConversionGainElectronsPerCode, value: regime.systemConversionGainElectronsPerCode.value * areaScale },\n preAdcSaturationElectronEquivalent: { ...regime.preAdcSaturationElectronEquivalent, value: regime.preAdcSaturationElectronEquivalent.value * areaScale } })) });\n}\n/** Diagnostic clock for the 2.1 stage timings: `performance.now()` where the host has it. Never affects output. */\nexport function clockMs(): number { return globalThis.performance?.now() ?? Date.now(); }\nfunction positive(value: unknown, name: string): number {\n if (typeof value !== \"number\" || !Number.isFinite(value) || value <= 0) fail(name + \" must be a positive finite number.\");\n return value as number;\n}\nfunction integerIn(value: unknown, name: string, minimum: number, maximum: number): number {\n if (typeof value !== \"number\" || !Number.isSafeInteger(value) || value < minimum || value > maximum) fail(name + \" must be an integer from \" + minimum + \" to \" + maximum + \".\");\n return value as number;\n}\nexport function allowKeys(value: unknown, name: string, keys: readonly string[]): Record<string, unknown> {\n if (value === undefined) return {};\n requireInputObject(value, name);\n for (const key of Object.keys(value as object)) if (!keys.includes(key)) fail(\"Unknown \" + name + \" field: \" + key + \".\");\n return value as Record<string, unknown>;\n}\nfunction sampled(values: readonly { nm: number; value: number }[]): { wavelengthUnit: \"nm\"; wavelengthBasis: \"vacuum\"; interpolation: \"piecewise-linear\";\n outsideRangeBehavior: \"fail-closed\"; evidence: readonly EvidenceProvenance[]; samples: { wavelengthNanometers: number; value: number }[] } {\n return { wavelengthUnit: \"nm\", wavelengthBasis: \"vacuum\", interpolation: \"piecewise-linear\", outsideRangeBehavior: \"fail-closed\", evidence: FACADE_EVIDENCE,\n samples: values.map((s) => ({ wavelengthNanometers: s.nm, value: s.value })) };\n}\nasync function sha256Hex(text: string): Promise<string> {\n const subtle = globalThis.crypto?.subtle;\n if (!subtle) fail(\"simulateCapture needs crypto.subtle (a secure browser context or Node 22+) to digest the scene description.\");\n const bytes = new Uint8Array(await subtle.digest(\"SHA-256\", new TextEncoder().encode(text)));\n return Array.from(bytes, (b) => b.toString(16).padStart(2, \"0\")).join(\"\");\n}\n/**\n * The form in which a caller spectrum enters the scene digest. Tabulated data is hashed exactly as its\n * (wavelength, value) pairs. A function spectrum has no data to hash, so it is sampled at the facade's\n * 1 nm integer nodes over 380-780 nm (the grid the facade also uses to normalize illuminance).\n */\nfunction spectrumDigestForm(raw: unknown, prepared: PreparedColorimetricSpectrum): unknown {\n const record = raw as { kind?: unknown; samples?: readonly { wavelengthNanometers: number; value: number }[] };\n if (record.kind === \"tabulated\" && Array.isArray(record.samples)) {\n return { kind: \"tabulated\", samples: record.samples.map((sample) => [sample.wavelengthNanometers, sample.value]) };\n }\n const values: number[] = [];\n for (let nm = FACADE_SPECTRAL_RANGE_NANOMETERS.minimum; nm <= FACADE_SPECTRAL_RANGE_NANOMETERS.maximum; nm++) values.push(prepared.evaluate(nm));\n return { kind: \"function-sampled-1nm\", rangeNanometers: [FACADE_SPECTRAL_RANGE_NANOMETERS.minimum, FACADE_SPECTRAL_RANGE_NANOMETERS.maximum], values };\n}\n/**\n * #449: the CIE 1931 ȳ values at luminanceOf's 5 nm nodes, evaluated once (estimateCie1931ColorMatchingFunctions is a pure\n * function of the wavelength, so each entry is the value the loop would compute).\n */\nlet luminanceCmfY: Float64Array | undefined;\nfunction luminanceNodesY(): Float64Array {\n if (luminanceCmfY) return luminanceCmfY;\n const values: number[] = [];\n for (let nm = FACADE_SPECTRAL_RANGE_NANOMETERS.minimum; nm <= FACADE_SPECTRAL_RANGE_NANOMETERS.maximum; nm += 5) values.push(estimateCie1931ColorMatchingFunctions(nm).y);\n return (luminanceCmfY = Float64Array.from(values));\n}\nfunction luminanceOf(radiance: (nm: number) => number): number {\n const cmfY = luminanceNodesY();\n let sum = 0;\n for (let nm = FACADE_SPECTRAL_RANGE_NANOMETERS.minimum, i = 0; nm <= FACADE_SPECTRAL_RANGE_NANOMETERS.maximum; nm += 5, i++) {\n const w = nm === FACADE_SPECTRAL_RANGE_NANOMETERS.minimum || nm === FACADE_SPECTRAL_RANGE_NANOMETERS.maximum ? 2.5 : 5;\n sum += w * radiance(nm) * cmfY[i]!;\n }\n return PHOTOPIC_MAXIMUM_LUMINOUS_EFFICACY_LM_PER_W * sum;\n}\n/**\n * 2.14: the capabilities with the ISO grid cut to its whole stops (ISO 100·2^k, as the 2.0.0 tier bodies list them), for\n * Auto ISO's default `isoSteps: \"whole-stop\"`. A whole-stop grid is returned unchanged, so 2.0.0 records resolve as before.\n */\nfunction wholeStopIsoCapabilities(capabilities: ResolvedGenericEquipmentExposureCapabilities): ResolvedGenericEquipmentExposureCapabilities {\n const grid = capabilities.iso.settingGrid;\n if (grid.kind !== \"discrete-values\") return capabilities;\n const whole = grid.values.filter((iso) => Number.isInteger(Math.log2(iso / 100)));\n if (whole.length === grid.values.length || whole.length === 0) return capabilities;\n return { ...capabilities, iso: { ...capabilities.iso, settingGrid: { kind: \"discrete-values\", values: Object.freeze(whole) } } };\n}\n/** The white balance measured from a perfect white diffuser under the scene illuminant (\"scene-illuminant\"). */\nexport function sceneIlluminantWhiteBalance(illuminant: ResolvedCaptureIlluminant): ResolvedWhiteBalanceState {\n const xyz = illuminantXyz(illuminant), camera = XYZ_TO_CAMERA.map((row) => row[0] * xyz[0] + row[1] * xyz[1] + row[2] * xyz[2]);\n return resolveCustomWhiteBalance({ stateId: \"facade-wb-scene-illuminant\", sampleSet: { imageStateId: \"facade-white-diffuser\",\n inputDomain: \"relative-pre-wb-camera-linear-rgb\", samples: [{ sampleId: \"white\", red: camera[0]!, green: camera[1]!, blue: camera[2]!, weight: 1, clipped: false }] } });\n}\nfunction illuminantXyz(illuminant: ResolvedCaptureIlluminant): [number, number, number] {\n let x = 0, y = 0, z = 0;\n for (let nm = FACADE_SPECTRAL_RANGE_NANOMETERS.minimum; nm <= FACADE_SPECTRAL_RANGE_NANOMETERS.maximum; nm++) {\n const s = illuminant.shape.evaluate(nm), c = estimateCie1931ColorMatchingFunctions(nm);\n x += s * c.x; y += s * c.y; z += s * c.z;\n }\n return [x / y, 1, z / y];\n}\n/** Bilinear RGGB demosaic as explicit linear neighbourhood kernels (weights sum to one per output channel). */\nexport function bilinearPhaseProfiles(): RawFrameReconstructionPhaseProfile[] {\n const cross = [[1, 0], [-1, 0], [0, 1], [0, -1]], diagonal = [[1, 1], [1, -1], [-1, 1], [-1, -1]], horizontal = [[1, 0], [-1, 0]], vertical = [[0, 1], [0, -1]];\n type Contribution = { offsetX: number; offsetY: number; sourceChannelId: Channel; weight: number };\n const average = (offsets: number[][], channel: Channel): Contribution[] => offsets.map(([x, y]) => ({ offsetX: x!, offsetY: y!, sourceChannelId: channel, weight: 1 / offsets.length }));\n const self = (channel: Channel): Contribution[] => [{ offsetX: 0, offsetY: 0, sourceChannelId: channel, weight: 1 }];\n const kernels: Record<string, Record<Channel, ReturnType<typeof self>>> = {\n \"0,0\": { red: self(\"red\"), green: average(cross, \"green\"), blue: average(diagonal, \"blue\") },\n \"1,0\": { red: average(horizontal, \"red\"), green: self(\"green\"), blue: average(vertical, \"blue\") },\n \"0,1\": { red: average(vertical, \"red\"), green: self(\"green\"), blue: average(horizontal, \"blue\") },\n \"1,1\": { red: average(diagonal, \"red\"), green: average(cross, \"green\"), blue: self(\"blue\") }\n };\n return [[0, 0], [1, 0], [0, 1], [1, 1]].map(([px, py], index) => ({ phaseX: px!, phaseY: py!, profile: { schemaVersion: \"0.1.0\" as const,\n profileId: \"facade-bilinear-phase-\" + index, profileVersion: \"1\", captureModeId: IDS.mode, colorSamplingProfileId: IDS.cfa,\n scientificStatus: \"approximation\" as const, method: \"explicit-linear-native-neighborhood\" as const,\n normalization: \"weights-sum-to-one-per-output-channel\" as const, negativeBlackSubtractedValuesAllowed: true,\n kernels: CHANNELS.map((c) => ({ outputChannelId: c, contributions: kernels[px + \",\" + py]![c] })), evidence: FACADE_EVIDENCE,\n limitations: [\"Bilinear interpolation of the RGGB mosaic; no edge-directed demosaic, false-colour suppression or calibration.\"] } })) as unknown as RawFrameReconstructionPhaseProfile[];\n}\n/**\n * #516: the result's Auto ISO report, read from a resolved Auto ISO resolution (every mode's resolved Auto ISO branch carries\n * `idealIsoBeforeConstraints`, `isoResolution` and a resolved `targetResidual`; aperture priority adds its fallback flag).\n */\nfunction autoIsoReport(resolution: unknown, iso: ResolvedGenericEquipmentExposureCapabilities[\"iso\"],\n shutterPolicy: { slowestPreferredShutterSeconds: number; afterMaximumIso: SimulateCaptureAutoIsoAfterMaximum } | undefined,\n limits: { minimum: number; maximum: number } | undefined, automatic: SimulateCaptureAutomaticSlowestShutterReport | undefined,\n isoSteps?: \"whole-stop\" | \"third-stop\"): SimulateCaptureAutoIsoReport {\n const r = resolution as { idealIsoBeforeConstraints?: unknown; isoResolution?: { clamped?: unknown }; afterMaximumIsoFallbackUsed?: unknown;\n slowestPreferredShutter?: { applied?: unknown; afterMaximumIsoFallbackUsed?: unknown };\n targetResidual?: { status?: unknown; limitingConstraint?: unknown; residualStops?: unknown } };\n // Program reports its hold under slowestPreferredShutter (#504); aperture priority at the top level.\n const program = r.slowestPreferredShutter;\n const ideal = r.idealIsoBeforeConstraints, residual = r.targetResidual?.residualStops, clamped = r.isoResolution?.clamped;\n if (typeof ideal !== \"number\" || !Number.isFinite(ideal) || typeof residual !== \"number\" || !Number.isFinite(residual) || r.targetResidual?.status !== \"resolved\" ||\n (clamped !== false && clamped !== \"minimum\" && clamped !== \"maximum\"))\n throw new InvalidScientificResultError(\"Auto ISO resolution did not report a finite ideal ISO and residual.\");\n // The resolvers' Auto ISO range: the body's Auto ISO bounds, else its ISO range.\n return { idealIsoBeforeConstraints: ideal, autoIsoMinimum: iso.autoIsoMinimum ?? iso.minimum, autoIsoMaximum: iso.autoIsoMaximum ?? iso.maximum, clamped,\n ...(limits ? { limits: { ...limits } } : {}), limitingConstraint: r.targetResidual.limitingConstraint as ExposureResolutionConstraint, residualStops: residual,\n ...(shutterPolicy ? { ...shutterPolicy, afterMaximumIsoFallbackUsed: (program ? program.afterMaximumIsoFallbackUsed : r.afterMaximumIsoFallbackUsed) === true } : {}),\n ...(program ? { slowestPreferredShutterApplied: program.applied === true } : {}),\n ...(automatic ? { automaticSlowestShutter: automatic } : {}), ...(isoSteps ? { isoSteps } : {}) };\n}\n/**\n * #505: `exposure.autoIso.limits`, the photographer's Auto ISO range. Both limits are selectable ISOs inside the body's\n * Auto ISO range, `minimum` at most `maximum`; anything else fails (the resolvers check the same, but an option defect\n * is a configuration error here). `minimum` defaults to the body's Auto ISO minimum.\n */\nfunction parseAutoIsoLimitsOption(value: unknown, iso: ResolvedGenericEquipmentExposureCapabilities[\"iso\"]): { minimum: number; maximum: number } {\n const record = allowKeys(value, \"exposure.autoIso.limits\", [\"maximum\", \"minimum\"]);\n if (record.maximum === undefined) fail(\"exposure.autoIso.limits.maximum is required: the highest ISO Auto ISO may choose.\");\n const bodyMinimum = iso.autoIsoMinimum ?? iso.minimum, bodyMaximum = iso.autoIsoMaximum ?? iso.maximum;\n const limit = (field: \"maximum\" | \"minimum\"): number => {\n const v = positive(record[field], \"exposure.autoIso.limits.\" + field);\n if (v < bodyMinimum || v > bodyMaximum)\n fail(\"exposure.autoIso.limits.\" + field + \" (ISO \" + v + \") must be within the body's Auto ISO range, ISO \" + bodyMinimum + \" to \" + bodyMaximum + \".\");\n if (iso.settingGrid.kind === \"discrete-values\" && !iso.settingGrid.values.includes(v))\n fail(\"exposure.autoIso.limits.\" + field + \" (ISO \" + v + \") must be a selectable ISO of the body: \" + iso.settingGrid.values.join(\", \") + \".\");\n return v;\n };\n const maximum = limit(\"maximum\"), minimum = record.minimum === undefined ? bodyMinimum : limit(\"minimum\");\n if (minimum > maximum) fail(\"exposure.autoIso.limits.minimum (ISO \" + minimum + \") must not exceed exposure.autoIso.limits.maximum (ISO \" + maximum + \").\");\n return { minimum, maximum };\n}\n/**\n * #504: `exposure.autoIso.slowestPreferredShutterSeconds: \"auto\"`: the slowest preferred shutter from the camera-shake model\n * (`estimateAutoIsoSlowestShutter`) for this lens, focus and pixel pitch, within the body's shutter range. Option defects are\n * configuration errors; the defaults are recorded as `default` assumptions and the derivation as a `model` assumption.\n */\nfunction resolveAutomaticSlowestShutterOption(value: unknown, context: { focalLengthMm: number; focusDistanceM: number; pitch: number;\n shutter: ResolvedGenericEquipmentExposureCapabilities[\"shutter\"];\n assume: (id: string, kind: SimulateCaptureAssumption[\"kind\"], value: unknown, explanation: string) => void;\n pick: <T>(record: Record<string, unknown>, key: string, path: string, fallback: T, explanation: string) => T }): SimulateCaptureAutomaticSlowestShutterReport {\n const path = \"exposure.autoIso.automaticSlowestShutter\";\n const record = allowKeys(value, path, [\"fasterByStops\", \"blurBudgetPixels\", \"angularVelocityRadPerSec\", \"stabilizationStopsEquivalent\"]);\n const fasterByStops = context.pick<unknown>(record, \"fasterByStops\", path + \".fasterByStops\", 0, \"No bias: the derived slowest shutter is used as is.\");\n if (typeof fasterByStops !== \"number\" || !Number.isInteger(fasterByStops) || Math.abs(fasterByStops) > 2) fail(path + \".fasterByStops must be a whole number of stops from -2 to +2.\");\n const blurBudgetPixels = positive(context.pick<unknown>(record, \"blurBudgetPixels\", path + \".blurBudgetPixels\", 1,\n \"A generic pixel-level blur budget: the shake trace during the exposure may be one pixel long. A choice, not a measured threshold.\"), path + \".blurBudgetPixels\");\n const angularOption = context.pick<unknown>(record, \"angularVelocityRadPerSec\", path + \".angularVelocityRadPerSec\", { ...GENERIC_HANDHELD_ANGULAR_VELOCITY_RAD_PER_SEC },\n \"Generic hand shake: 4.39 °/s (0.0766 rad/s) on yaw, the linear camera-motion rate Xiao, Farrell, Catrysse and Wandell (Proc. SPIE 7250, 2009) use for an average user \" +\n \"holding a 100 g mobile handset with two hands. A labelled generic default, not a measurement of this photographer or camera.\");\n const angular = allowKeys(angularOption, path + \".angularVelocityRadPerSec\", [\"yaw\", \"pitch\"]);\n for (const axis of [\"yaw\", \"pitch\"]) {\n const v = angular[axis];\n if (typeof v !== \"number\" || !Number.isFinite(v) || Math.abs(v) > 100) fail(path + \".angularVelocityRadPerSec.\" + axis + \" must be a finite number within ±100 rad/s.\");\n }\n const angularVelocityRadPerSec = { yaw: angular.yaw as number, pitch: angular.pitch as number };\n if (angularVelocityRadPerSec.yaw === 0 && angularVelocityRadPerSec.pitch === 0)\n fail(path + \".angularVelocityRadPerSec must be non-zero on at least one axis: without shake no slowest shutter follows.\");\n const stabilizationStopsEquivalent = context.pick<unknown>(record, \"stabilizationStopsEquivalent\", path + \".stabilizationStopsEquivalent\", 0,\n \"No stabilization: the generic tiers declare none.\");\n if (typeof stabilizationStopsEquivalent !== \"number\" || !Number.isFinite(stabilizationStopsEquivalent) || stabilizationStopsEquivalent < 0 || stabilizationStopsEquivalent > 10)\n fail(path + \".stabilizationStopsEquivalent must be a number of stops from 0 to 10.\");\n let estimate;\n try {\n estimate = estimateAutoIsoSlowestShutter({ focalLengthMm: context.focalLengthMm, focusDistanceM: context.focusDistanceM, angularVelocityRadPerSec,\n stabilizationStopsEquivalent, blurBudget: { kind: \"pixels\", pixels: blurBudgetPixels, pixelPitchMicrometers: context.pitch }, fasterByStops,\n shutterCapability: context.shutter }).value;\n } catch (error) {\n fail(path + \": \" + (error instanceof Error ? error.message : String(error)));\n }\n const report: SimulateCaptureAutomaticSlowestShutterReport = { derivedShutterSeconds: estimate.derivedShutterSeconds, fasterByStops,\n biasedShutterSeconds: estimate.biasedShutterSeconds, shutterSeconds: estimate.shutterSeconds, blurBudgetPixels, blurAtShutterPixels: estimate.blurAtShutterPixels!,\n angularVelocityRadPerSec, stabilizationStopsEquivalent };\n context.assume(\"exposure.autoIso.automaticSlowestShutter\", \"model\", { ...report, angularVelocityRadPerSec: { ...angularVelocityRadPerSec },\n focalLengthMm: context.focalLengthMm, focusDistanceM: context.focusDistanceM, pixelPitchMicrometers: context.pitch },\n \"Automatic slowest shutter (#504): the exposure time at which estimateCameraShakeBlur()'s on-axis blur (constant angular velocity, thin-lens projection at the focus \" +\n \"distance, stabilization as 2^-stops) equals the blur budget, times 2^-fasterByStops, held within the body's shutter range. An approximation; the 1/focal-length \" +\n \"reciprocal rule is a rule of thumb and is not used.\");\n return report;\n}\nfunction defaultProgramLine(): ExposureProgramLineProfile {\n // Generic educational program line written for the engine, relative to the f/8, 1/125 s reference. For less light\n // it first opens the aperture toward f/4, then lengthens the shutter. For more light it first closes toward\n // f/16, then shortens the shutter.\n return parseExposureProgramLineProfile({ schemaVersion: \"0.1.0\", profileId: \"facade-generic-program-line\", profileVersion: \"1.0.0\",\n scientificStatus: \"approximation\", policyKind: \"generic-program-line\", interpolation: \"log2-aperture-shutter\", evidence: FACADE_EVIDENCE,\n limitations: [\"Generic educational program line authored for the capture facade; not any manufacturer's program.\"],\n nodes: [\n { nodeId: \"minus-6\", opticalExposureStopsFromReference: -6, aperture: 16, shutterSeconds: 1 / 2000 },\n { nodeId: \"minus-2\", opticalExposureStopsFromReference: -2, aperture: 16, shutterSeconds: 1 / 125 },\n { nodeId: \"zero\", opticalExposureStopsFromReference: 0, aperture: 8, shutterSeconds: 1 / 125 },\n { nodeId: \"plus-2\", opticalExposureStopsFromReference: 2, aperture: 4, shutterSeconds: 1 / 125 },\n { nodeId: \"plus-9\", opticalExposureStopsFromReference: 9, aperture: 4, shutterSeconds: 128 / 125 }\n ] });\n}\n\n/** PNG colour signalling: the sRGB chunk for sRGB, ITU-T H.273 code points through cICP otherwise. */\nfunction pngColourEncoding(encoding: SimulateCaptureColorEncoding): PngColourEncoding {\n if (encoding === \"srgb\") return { kind: \"srgb\", renderingIntent: \"perceptual\" };\n if (encoding === \"display-p3\") return { kind: \"cicp\", primaries: \"display-p3\", transfer: \"srgb\", fullRange: true };\n return { kind: \"cicp\", primaries: \"bt2020\", transfer: \"bt709\", fullRange: true };\n}\n/**\n * Develops the packed RAW to unclipped linear sRGB/D65, using the exact operator inside\n * `createNativeRawDevelopmentTask`. Validation, demosaic kernels, border handling, per-site white-level\n * clipping, white balance, highlight mode and the camera→XYZ→linear-sRGB matrices are all the same. It\n * stops before tone mapping, gamut clipping and quantization. It reads the RAW without taking ownership.\n */\nasync function developLinearSrgb(input: NativeRawDevelopmentInput, afterRow: (completed: number, total: number) => Promise<void>,\n ahd?: { yieldControl: () => Promise<void>; checkAbort: () => void; onDemosaicMs?: (milliseconds: number) => void }): Promise<{ rgb: Float64Array; highlight: RawHighlightDiagnostics }> {\n const v = prepareNativeRawDevelopment(input), plan = v.plan, raw = input.raw, layout = plan.frame.colorSamplingProfile.layout;\n if (layout.kind !== \"periodic-mosaic\") fail(\"Development requires a periodic CFA.\");\n const native = plan.exposure.geometry.nativeRaster, g = plan.exposure.resolvedGeometry, active = g.activeCapture.nativeRect;\n checkNativeRawIntegrity(raw, native.pixelWidth, layout.repeatWidthSites, layout.repeatHeightSites, 0, native.pixelHeight);\n const developer = createRawPixelDeveloper({ nativeWidth: native.pixelWidth, repeatWidth: layout.repeatWidthSites, repeatHeight: layout.repeatHeightSites,\n codes: raw.codes, blackLevels: raw.blackLevels, saturationFlags: raw.saturationFlags, whiteByPhase: raw.effectiveSaturationCodes }, v.phases, v.development, v.mirror);\n const width = v.raster.pixelWidth, height = v.raster.pixelHeight, rgb = new Float64Array(width * height * 3), row = new Float64Array(width * 3);\n const at = (x: number, y: number): { x: number; y: number } => {\n const q = transformOrientedRasterPointToNative({ point: { x: v.crop.x + x + 0.5, y: v.crop.y + y + 0.5 }, nativeRaster: g.activeCapture.raster, orientation: plan.exposure.geometry.orientation });\n return { x: Math.floor(q.x) + active.x, y: Math.floor(q.y) + active.y };\n };\n if (ahd) return developAhd(v, raw, layout.repeatWidthSites, layout.repeatHeightSites, width, height, at, afterRow, ahd);\n for (let y = 0; y < height; y++) {\n const first = at(0, y), second = width > 1 ? at(1, y) : first;\n developer.developRun(first.x, first.y, second.x - first.x, second.y - first.y, width, row);\n rgb.set(row, y * width * 3);\n await afterRow(y + 1, height);\n }\n const c = developer.counts;\n return { rgb, highlight: { mode: v.highlightMode, saturatedPixelCount: c.saturatedPixelCount, whiteBalanceClippedSampleCount: c.whiteBalanceClippedSampleCount,\n reconstructedPixelCount: c.reconstructedPixelCount } };\n}\n/**\n * AHD development (2.1): the same site normalization as the native development kernel (flagged or white-level sites\n * are 1, others (code − black)/(white − black)) on the whole native raster, demosaiced by `createAhdDemosaicTask`\n * (mirrored plane edges), then the native development's own colour operator (`developInto`: WB, highlight mode,\n * camera → XYZ → linear sRGB) per output pixel. The AHD homogeneity metric sees white-balanced colour: its\n * camera → XYZ matrix is the profile's matrix times the WB gains (the output values are not transformed by it).\n * The mosaic is stored in float32, as the AHD task requires.\n */\nasync function developAhd(v: ReturnType<typeof prepareNativeRawDevelopment>, raw: NativeRawOutput, repeatWidth: number, repeatHeight: number, width: number, height: number,\n at: (x: number, y: number) => { x: number; y: number }, afterRow: (completed: number, total: number) => Promise<void>,\n host: { yieldControl: () => Promise<void>; checkAbort: () => void; onDemosaicMs?: (milliseconds: number) => void }): Promise<{ rgb: Float64Array; highlight: RawHighlightDiagnostics }> {\n const native = v.plan.exposure.geometry.nativeRaster, W = native.pixelWidth, H = native.pixelHeight;\n const source: RawDevelopmentSource = { nativeWidth: W, repeatWidth, repeatHeight, codes: raw.codes, blackLevels: raw.blackLevels,\n saturationFlags: raw.saturationFlags, whiteByPhase: raw.effectiveSaturationCodes };\n const samples = new Float32Array(W * H), saturated = new Uint8Array(W * H);\n for (let y = 0; y < H; y++) for (let x = 0; x < W; x++) {\n samples[y * W + x] = normalizedRawSite(source, x, y);\n if (rawSiteSaturated(source, x, y)) saturated[y * W + x] = 1;\n }\n const intent = v.plan.exposure.whiteBalanceIntent, gains = intent ? [intent.channelGains.red, intent.channelGains.green, intent.channelGains.blue] : [1, 1, 1];\n const m = v.color.normalizedCameraChannelsToXyz;\n const cameraToXyz = [0, 1, 2].map((r) => [0, 1, 2].map((c) => m[r]![c]! * gains[c]!)) as unknown as ColorMatrix3x3;\n // A caller-raised pixel limit already bounds the raster, so its working memory is not capped again at the 1 GiB default.\n const task = createAhdDemosaicTask({ plane: { width: W, height: H, captureModeId: v.plan.frame.modeId, colorSamplingProfile: v.plan.frame.colorSamplingProfile, samples },\n channelRoles: { red: \"red\", green: \"green\", blue: \"blue\" }, cameraToXyz, ...(v.plan.maximumPixels === undefined ? {} : { maximumWorkingBytes: Number.MAX_SAFE_INTEGER }) }, { yieldControl: async () => { await host.yieldControl(); host.checkAbort(); } });\n const demosaicStarted = clockMs();\n await task.run();\n host.onDemosaicMs?.(clockMs() - demosaicStarted);\n const demosaiced = task.takeOutput().data, rgb = new Float64Array(width * height * 3);\n const counts = { saturatedPixelCount: 0, whiteBalanceClippedSampleCount: 0, reconstructedPixelCount: 0 };\n // #420: a pixel is clipped when a saturated site lies within AHD_VALUE_REACH of it, clipped to the raster. The sites within\n // that reach of each column are found once per row (`near`, a horizontal dilation of `saturated`), so a pixel reads one\n // column of 2·reach + 1 rows instead of the whole square; with no saturated site at all no pixel is clipped.\n let anySaturated = false;\n for (let k = 0; k < saturated.length && !anySaturated; k++) anySaturated = saturated[k] !== 0;\n const near = anySaturated ? new Uint8Array(W * H) : undefined;\n if (near) for (let y = 0; y < H; y++) {\n const row = y * W;\n for (let x = 0; x < W; x++) if (saturated[row + x] !== 0) near.fill(1, row + Math.max(0, x - AHD_VALUE_REACH), row + Math.min(W, x + AHD_VALUE_REACH + 1));\n }\n for (let y = 0; y < height; y++) {\n // The oriented-to-native map is affine in x with whole-site steps (as the bilinear path's developRun uses): two points give the row.\n const first = at(0, y), second = width > 1 ? at(1, y) : first, stepX = second.x - first.x, stepY = second.y - first.y;\n for (let x = 0, px = first.x, py = first.y; x < width; x++, px += stepX, py += stepY) {\n const i = py * W + px;\n let clipped = false;\n if (near) for (let sy = Math.max(0, py - AHD_VALUE_REACH), last = Math.min(H - 1, py + AHD_VALUE_REACH); sy <= last; sy++) {\n if (near[sy * W + px] !== 0) { clipped = true; break; }\n }\n if (clipped) counts.saturatedPixelCount++;\n v.development.developInto(demosaiced[3 * i]!, demosaiced[3 * i + 1]!, demosaiced[3 * i + 2]!, rgb, (y * width + x) * 3, counts);\n }\n await afterRow(y + 1, height);\n }\n return { rgb, highlight: { mode: v.highlightMode, saturatedPixelCount: counts.saturatedPixelCount, whiteBalanceClippedSampleCount: counts.whiteBalanceClippedSampleCount,\n reconstructedPixelCount: counts.reconstructedPixelCount } };\n}\n/** Linear sRGB/D65 → CIE XYZ (inverse of the development's XYZ → sRGB matrix) → linear target RGB/D65. */\nfunction linearSrgbToTarget(target: \"srgb\" | \"display-p3\" | \"rec2020\"): readonly (readonly number[])[] {\n return multiplyMatrices(resolveRgbColorSpace(target).value.xyzToRgb, resolveCaptureColorModel().cameraRgbToXyz as unknown as ColorMatrix3x3);\n}\n/** Knee of the `perceptual` gamut mapping: chroma below 90 % of the gamut-boundary chroma (at constant L*, h) is untouched. */\nconst PERCEPTUAL_GAMUT_KNEE_FRACTION = 0.9;\n/**\n * SDR encoding from linear sRGB/D65:\n * 1. Convert to the target primaries with a matrix.\n * 2. Either clip each component to [0, 1], or, with `mapping`, compress chroma while keeping CIELAB hue\n * and lightness (`prepareRgbGamutMapping`).\n * 3. Apply the target transfer function and round to the nearest code (ties round up).\n */\nfunction encodeSdrFromLinear(rgb: Float64Array, encoding: \"srgb\" | \"display-p3\" | \"rec2020\", bitDepth: 8 | 16, mapping?: PreparedRgbGamutMapping):\n { samples: Uint8Array | Uint16Array; diagnostics: SdrRenderingResult[\"diagnostics\"]; adjustedPixelCount: number; lightnessClippedPixelCount: number } {\n const m = linearSrgbToTarget(encoding), toXyz = resolveCaptureColorModel().cameraRgbToXyz, maximum = 2 ** bitDepth - 1;\n const transfer = encoding === \"rec2020\" ? evaluateBt709Oetf : evaluateSrgbEncoding;\n const samples = bitDepth === 8 ? new Uint8Array(rgb.length) : new Uint16Array(rgb.length);\n let low = 0, high = 0, adjusted = 0, lightnessClipped = 0;\n for (let i = 0; i < rgb.length; i += 3) {\n const r = rgb[i]!, g = rgb[i + 1]!, b = rgb[i + 2]!;\n if (mapping) {\n const xyz = [0, 1, 2].map((k) => toXyz[k]![0]! * r + toXyz[k]![1]! * g + toXyz[k]![2]! * b) as unknown as ColorVector3;\n const mapped = mapping.map(xyz);\n if (mapped.adjusted) adjusted++;\n if (mapped.lightnessClipped) lightnessClipped++;\n for (let k = 0; k < 3; k++) samples[i + k] = Math.floor(transfer(mapped.linearRgb[k]!) * maximum + 0.5);\n continue;\n }\n for (let k = 0; k < 3; k++) {\n const row = m[k]!;\n let value = row[0]! * r + row[1]! * g + row[2]! * b;\n if (value < 0) { value = 0; low++; } else if (value > 1) { value = 1; high++; }\n samples[i + k] = Math.floor(transfer(value) * maximum + 0.5);\n }\n }\n return { samples, adjustedPixelCount: adjusted, lightnessClippedPixelCount: lightnessClipped, diagnostics: { renderingNegativeSampleCount: low,\n renderingAboveReferenceSampleCount: high, toneChangedSampleCount: 0, gamutClippedLowSampleCount: low, gamutClippedHighSampleCount: high, captureSaturation: \"consumed-in-raw-development\" } };\n}\n\n/**\n * Simulates one still capture of a planar scene and returns the developed image, the packed RAW, the full\n * underlying request/plan, provenance and every assumption made. See docs/QUICK_START.md.\n */\nexport async function simulateCapture(options: SimulateCaptureOptions): Promise<SimulateCaptureResult> {\n return await runCapture(options, \"capture\") as SimulateCaptureResult;\n}\n\n/** One part of a whole-frame DNG (#391): a region render's packed RAW and where its native sites lie (`result.raw`, `result.region`). */\nexport interface SimulateCaptureDngPart {\n raw: Pick<NativeRawOutput, \"codes\" | \"blackLevels\" | \"digitalSaturationCodes\" | \"saturationFlags\" | \"effectiveSaturationCodes\">;\n region: { nativeRect: { x: number; y: number; width: number; height: number } };\n}\n\n/**\n * Writes the whole-frame DNG of `options` (`output.format: \"dng\"`, no `output.region`) from the packed RAW of region renders of\n * the same request (#391), so the RAW can render in parallel. A region render's native sites are the same sites as the whole\n * render's (each site's seeds come from its index in the whole raster), so the joined RAW is the whole render's RAW, and the\n * request is resolved and written exactly as `simulateCapture` writes its DNG: the bytes are the same. The parts must cover\n * every native site of the frame; where they overlap (each region carries the demosaic margin) their sites must agree. Region\n * renders of the request with any format serve (a region's own `output.format` does not change its RAW). A region cannot take\n * `output.whiteBalance: \"auto\"` or `output.dng`: render the parts with a fixed white balance (the RAW codes do not depend on the\n * white-balance intent) and pass the DNG's own options here, where auto white balance is measured over the joined frame.\n * @returns The DNG (its `bytes` are those of `SimulateCaptureResult.image.dng` for the same options), with its stored levels and identifiers.\n */\nexport async function serializeSimulatedCaptureDngFromParts(options: SimulateCaptureOptions, parts: readonly SimulateCaptureDngPart[]): Promise<NativeRawDng> {\n return await runCapture(options, \"dng-from-parts\", parts) as NativeRawDng;\n}\n\n/** The whole frame's packed RAW from region parts (see `serializeSimulatedCaptureDngFromParts`). */\nfunction joinNativeRawParts(value: unknown, plan: NativeRawOutput[\"plan\"], width: number, height: number): NativeRawOutput {\n if (!Array.isArray(value) || value.length === 0) throw new InvalidConfigurationError(\"serializeSimulatedCaptureDngFromParts needs at least one part.\");\n const parts = value as readonly SimulateCaptureDngPart[], count = width * height;\n const codes = new Uint16Array(count), blackLevels = new Uint16Array(count), digitalSaturationCodes = new Uint16Array(count), saturationFlags = new Uint8Array(count);\n const covered = new Uint8Array(count), white = new Uint16Array(4);\n const bad = (k: number, what: string): never => { throw new InvalidConfigurationError(\"DNG part \" + k + \": \" + what); };\n parts.forEach((part, k) => {\n const rect = part?.region?.nativeRect, raw = part?.raw;\n if (!rect || !raw) bad(k, \"needs raw and region.nativeRect (a region render's result).\");\n const { x, y, width: w, height: h } = rect!;\n if (![x, y, w, h].every(Number.isSafeInteger) || x < 0 || y < 0 || w < 1 || h < 1 || x + w > width || y + h > height) bad(k, \"its nativeRect is not inside the frame's native raster.\");\n const n = w * h;\n if (!(raw!.codes instanceof Uint16Array) || raw!.codes.length !== n || !(raw!.blackLevels instanceof Uint16Array) || raw!.blackLevels.length !== n ||\n !(raw!.digitalSaturationCodes instanceof Uint16Array) || raw!.digitalSaturationCodes.length !== n || !(raw!.saturationFlags instanceof Uint8Array) || raw!.saturationFlags.length !== n)\n bad(k, \"its RAW arrays do not match its nativeRect.\");\n const phases = raw!.effectiveSaturationCodes;\n if (!(phases instanceof Uint16Array) || phases.length !== 4) bad(k, \"needs four per-phase white levels.\");\n // Per-phase white levels are in the whole raster's CFA phases (0 for a phase the part has no site of); all parts agree.\n for (let phase = 0; phase < 4; phase++) {\n const code = phases[phase]!;\n if (code === 0) continue;\n if (white[phase] === 0) white[phase] = code; else if (white[phase] !== code) bad(k, \"its white level differs from another part's: not the same request.\");\n }\n for (let row = 0; row < h; row++) for (let column = 0; column < w; column++) {\n const from = row * w + column, to = (y + row) * width + x + column;\n if (covered[to]) {\n if (codes[to] !== raw!.codes[from] || blackLevels[to] !== raw!.blackLevels[from] || digitalSaturationCodes[to] !== raw!.digitalSaturationCodes[from] ||\n saturationFlags[to] !== raw!.saturationFlags[from]) bad(k, \"a site differs from another part's at the same place: not the same request.\");\n continue;\n }\n covered[to] = 1; codes[to] = raw!.codes[from]!; blackLevels[to] = raw!.blackLevels[from]!;\n digitalSaturationCodes[to] = raw!.digitalSaturationCodes[from]!; saturationFlags[to] = raw!.saturationFlags[from]!;\n }\n });\n if (covered.includes(0)) throw new InvalidConfigurationError(\"The DNG parts do not cover every native site of the frame.\");\n if (white.includes(0)) throw new InvalidConfigurationError(\"The DNG parts lack a white level for a CFA phase.\");\n return { plan, codes, blackLevels, digitalSaturationCodes, saturationFlags, effectiveSaturationCodes: white };\n}\n\n/**\n * The ideal reference of a capture request (2.3): the same scene, framing, chart size, output size, region and pixel\n * grid as `simulateCapture(options)` would use, rendered with no camera effects (no lens blur, diffraction, defocus,\n * distortion, vignetting, anti-aliasing filter, mosaic or demosaic, noise, dark signal or motion), at the capture's\n * own exposure and developed with its white balance, colour matrices, tone curve and encoding (the\n * `reference.exposure` assumption). Deterministic and cheap: no RAW is simulated. Formats srgb-8, srgb-16 and png.\n * The result is labelled `kind: \"ideal-reference\"`; it is not a capture.\n * @see docs/QUICK_START.md, \"Ideal reference\".\n */\nexport async function simulateIdealReference(options: SimulateCaptureOptions): Promise<IdealReferenceResult> {\n return await runCapture(options, \"ideal-reference\") as IdealReferenceResult;\n}\n\n/** Result of {@link simulateIdealReference}: an ideal reference image, not a capture (no RAW, plan or request). */\nexport interface IdealReferenceResult {\n kind: \"ideal-reference\";\n /** Human-readable label for a user interface. */\n label: string;\n facadeVersion: typeof SIMULATE_CAPTURE_FACADE_VERSION;\n engineApiVersion: string;\n image: { width: number; height: number; format: SimulateCaptureOutputFormat; samples: Uint8Array | Uint16Array; png?: Uint8Array; colorEncoding?: SimulateCaptureColorEncoding };\n /** The resolved exposure of the capture this reference matches. */\n exposure: { mode: SimulateCaptureExposureMode; settings: { fNumber: number; shutterSeconds: number; iso: number }; ev100: number;\n /** #516: as in the capture result. */\n isoControl: \"manual\" | \"automatic\"; autoIso?: SimulateCaptureAutoIsoReport };\n scene: SimulateCaptureResult[\"scene\"];\n region?: { x: number; y: number; width: number; height: number; frameWidth: number; frameHeight: number };\n diagnostics: { sampleCount: number; timingsMs: { reference: number; total: number } };\n provenance: { scientificStatus: \"approximation\"; cameraPresetId: string; cameraPresetVersion: string; evidence: readonly EvidenceProvenance[];\n composedContracts: readonly string[]; limitations: readonly string[] };\n /** The capture request's assumptions, then `reference.kind`, `reference.excludes`, `reference.exposure` and `reference.sampling`. */\n assumptions: readonly SimulateCaptureAssumption[];\n}\n\n/** Default stratified samples per axis of a display view (`view.samplesPerAxis`): 16 × 16 sampled real pixels per display pixel with detail, 4 × 4 where it is uniform. */\nexport const SIMULATE_DISPLAY_VIEW_DEFAULT_SAMPLES_PER_AXIS = 16;\n/** The display size and sampling of {@link simulateDisplayView}. */\nexport interface SimulateDisplayViewOptions {\n /** Display pixels, 1 to the capture's output width and height. */\n width: number;\n height: number;\n /** Stratified Monte Carlo samples per axis for each display pixel's expected value (1–32, default 8: 64 real pixels). */\n samplesPerAxis?: number;\n /** \"srgb-8\" (default) or \"srgb-16\". */\n format?: \"srgb-8\" | \"srgb-16\";\n /** Render only this rectangle of the display view, in display pixels; byte-identical to the same pixels of the whole view. */\n region?: { x: number; y: number; width: number; height: number };\n}\n/** Result of {@link simulateDisplayView}: the full-resolution capture resized for display, estimated; not a capture. */\nexport interface DisplayViewResult {\n kind: \"display-view\";\n /** Human-readable label for a user interface. */\n label: string;\n facadeVersion: typeof SIMULATE_CAPTURE_FACADE_VERSION;\n engineApiVersion: string;\n /** The display view (or its region): interleaved sRGB samples, row by row from the top-left. */\n image: { width: number; height: number; format: \"srgb-8\" | \"srgb-16\"; samples: Uint8Array | Uint16Array };\n /**\n * The view: display size, the capture frame it shows (output pixels), real pixels per display pixel along each axis,\n * the samples per axis and, with `view.region`, the rendered rectangle.\n */\n view: { width: number; height: number; frameWidth: number; frameHeight: number; scaleX: number; scaleY: number; samplesPerAxis: number;\n region?: { x: number; y: number; width: number; height: number } };\n /**\n * The resolved exposure of the capture this view shows; `standardExposureDeviationStops`, `standardExposureIlluminanceLux`\n * and `greyCardDeviationStops` as in {@link SimulateCaptureResult}.\n */\n exposure: { mode: SimulateCaptureExposureMode; settings: { fNumber: number; shutterSeconds: number; iso: number }; ev100: number; standardExposureDeviationStops: number | null;\n /** As in the capture result. */\n standardExposureIlluminanceLux: number | null;\n /** 2.14: as in the capture result. */\n greyCardDeviationStops: number | null;\n /** 2.14: as in the capture result. */\n metering: SimulateCaptureMetering;\n /** #516: as in the capture result. */\n isoControl: \"manual\" | \"automatic\"; autoIso?: SimulateCaptureAutoIsoReport };\n scene: SimulateCaptureResult[\"scene\"];\n /**\n * Work done: real pixels sampled, real-site expectations evaluated, scene queries, display pixels sampled in full (detail) or with\n * a quarter of the samples per axis (uniform), display pixels whose value includes the AHD low-signal correction, and wall-clock\n * milliseconds (diagnostic only; never affects the samples).\n */\n diagnostics: { sampleCount: number; siteEvaluations: number; sceneLookups: number; detailPixelCount: number; uniformPixelCount: number; ahdCorrectedPixelCount: number;\n timingsMs: { view: number; total: number };\n /** #395: exact or fast, as requested and as run; 2.11 (#481): plus `execution`, where the render ran (see {@link DisplayViewFastReport}). */\n fast: DisplayViewFastReport };\n provenance: { scientificStatus: \"approximation\"; cameraPresetId: string; cameraPresetVersion: string; evidence: readonly EvidenceProvenance[];\n composedContracts: readonly string[]; limitations: readonly string[] };\n /** The capture request's assumptions, then `view.definition`, `view.estimation`, `view.noise`, `view.demosaic` and `view.source`. */\n assumptions: readonly SimulateCaptureAssumption[];\n}\n\n/** Internal: the resolved request state that the display view's renderer (simulate-display-view.ts) reads. */\nexport interface DisplayViewRunContext {\n ahd: boolean;\n fastReport: SimulateCaptureFastReport;\n antiAliasing: ParsedAntiAliasing | undefined;\n aspect: number;\n assume: (id: string, kind: SimulateCaptureAssumption[\"kind\"], value: unknown, explanation: string) => void;\n assumptions: SimulateCaptureAssumption[];\n axisChannelResponse: (caller: string) => { electronsPerRadiance: Record<Channel, Map<number, number>>; wavelengths: number[]; relativePerElectron: Record<Channel, number>; };\n boxSamples: number;\n buildProvider: (sceneIlluminant: ResolvedCaptureIlluminant, scale: number) => PlanarSceneRadianceProvider;\n callerScene: ResolvedCallerScene | undefined;\n chart: ResolvedChartScene | undefined;\n /** #491: the declared material-layers scene behind `callerScene`, when the request gave one. */\n materialLayers: ResolvedChartMaterialLayers | undefined;\n chartReport: { widthM: number; heightM: number; surroundReflectance: number; frameWidthFraction: number; frameHeightFraction: number; magnification: number; imageWidthMm: number; imageHeightMm: number; imageWidthPixels: number; imageHeightPixels: number; } | undefined;\n chartSize: { widthM: number; heightM: number; surroundReflectance: number; defaulted: (\"heightM\" | \"surroundReflectance\")[]; } | undefined;\n diffraction: DiffractionLimitedPsfProfile | undefined;\n /** `lens.defocus` (#492): the resolved geometric disc out of focus; undefined in focus or without the option. */\n defocus: ResolvedDefocusDisc | undefined;\n diffractionPsf: { kind: \"sampled-local\"; configuration: Pick<CalculateSensorPsfIrradianceQuadratureInput, \"psf\" | \"psfWavelengthBasis\" | \"spatialModel\">; } | undefined;\n fNumber: number;\n focalLengthMm: number;\n focusDistanceM: number;\n height: number;\n highlightMode: RawHighlightMode;\n illuminanceLux: number;\n illuminant: ResolvedCaptureIlluminant;\n illuminantOption: CaptureIlluminant;\n imagingArea: { widthMm: number; heightMm: number; };\n intentOf: (state: ResolvedWhiteBalanceState | null) => CaptureWhiteBalanceIntent | null;\n metresPerFrameUnit: number;\n noiseSeed: number;\n outputOptions: Record<string, unknown>;\n parsedView: ParsedDisplayView | undefined;\n pitch: number;\n preset: GenericEquipmentTierPreset;\n provider: PlanarSceneRadianceProvider;\n regimeByChannel: Record<\"red\" | \"green\" | \"blue\", { readoutProfile: ReadoutProfile; regimeId: string; }>;\n resolvedIso: number;\n /** #516: how the ISO was chosen, reported in the view's `exposure`. */\n isoReport: { isoControl: \"manual\" | \"automatic\"; autoIso?: SimulateCaptureAutoIsoReport };\n /** #515: the capture's `exposure.standardExposureDeviationStops`. */\n standardExposureDeviationStops: number | null;\n /** The capture's `exposure.standardExposureIlluminanceLux`. */\n standardExposureIlluminanceLux: number | null;\n /** 2.14: the capture's `exposure.greyCardDeviationStops`. */\n greyCardDeviationStops: number | null;\n /** 2.14: the capture's `exposure.metering`. */\n metering: SimulateCaptureMetering;\n sceneOption: unknown;\n scenePreset: \"composite\" | \"uniform\" | \"patches\" | \"slanted-edge\" | \"siemens-star\" | \"step-wedge\" | \"grey-ramp\" | \"checkerboard\" | \"point-grid\" | \"dead-leaves\" | \"bar-groups\" | \"hyperbolic-wedge\" | \"zone-plate\" | \"slanted-squares\" | \"line-grid\" | \"fiducial\" | \"color-patches\" | \"reflectance-function\" | \"radiance-function\" | \"material-function\";\n shutterSeconds: number;\n started: number;\n subjectDistanceM: number;\n toneCurve: SdrToneCurve;\n whiteBalanceOption: SimulateCaptureWhiteBalance;\n whiteBalanceState: ResolvedWhiteBalanceState | null;\n width: number;\n checkAbort: () => void;\n margin: number;\n mode: SimulateCaptureExposureMode;\n nativeHeight: number;\n nativeWidth: number;\n sourceSha256: string;\n yieldControl: () => Promise<void>;\n /** The Kelvin white balance request, which the view resolves with the portable functions. */\n kelvinWhiteBalanceInput: Parameters<typeof resolveColorTemperatureWhiteBalance>[0] | undefined;\n}\nexport interface ParsedDisplayView { width: number; height: number; samplesPerAxis: number; bitDepth: 8 | 16; format: \"srgb-8\" | \"srgb-16\"; region?: { x: number; y: number; width: number; height: number } }\n/** Internal: validates a display view against the capture's output size and fills its defaults. */\nexport function parseDisplayViewOption(value: unknown, frameWidth: number, frameHeight: number): ParsedDisplayView {\n if (value === undefined) fail(\"simulateDisplayView needs a view, for example { width: 384, height: 256 }.\");\n const v = allowKeys(value, \"view\", [\"width\", \"height\", \"samplesPerAxis\", \"format\", \"region\"]);\n const width = integerIn(v.width, \"view.width\", 1, frameWidth), height = integerIn(v.height, \"view.height\", 1, frameHeight);\n const samplesPerAxis = v.samplesPerAxis === undefined ? SIMULATE_DISPLAY_VIEW_DEFAULT_SAMPLES_PER_AXIS : integerIn(v.samplesPerAxis, \"view.samplesPerAxis\", 1, 32);\n const format = v.format === undefined ? \"srgb-8\" : v.format;\n if (format !== \"srgb-8\" && format !== \"srgb-16\") fail(\"view.format must be srgb-8 or srgb-16.\");\n let region: ParsedDisplayView[\"region\"];\n if (v.region !== undefined) {\n const r = allowKeys(v.region, \"view.region\", [\"x\", \"y\", \"width\", \"height\"]);\n const x = integerIn(r.x, \"view.region.x\", 0, width - 1), y = integerIn(r.y, \"view.region.y\", 0, height - 1);\n region = { x, y, width: integerIn(r.width, \"view.region.width\", 1, width - x), height: integerIn(r.height, \"view.region.height\", 1, height - y) };\n }\n return { width, height, samplesPerAxis, bitDepth: format === \"srgb-8\" ? 8 : 16, format: format as \"srgb-8\" | \"srgb-16\", ...(region ? { region } : {}) };\n}\n\n/**\n * `lens.defocus` (#492): resolves the geometric defocus disc at the resolved f-number on the site pitch and records it.\n * In focus (c = 0) no kernel exists and nothing else changes (undefined). The capture (step 2a) applies the disc as an\n * object-space convolution and the display view (step 2b) as a site kernel in its expected-signal tables, and both get it\n * back; the ideal reference, which has no camera effects, only records it.\n */\nfunction resolveDefocusOption(input: { run: \"capture\" | \"ideal-reference\" | \"display-view\" | \"dng-from-parts\"; assume: DisplayViewRunContext[\"assume\"];\n focalLengthMm: number; fNumber: number; focusDistanceM: number; subjectDistanceM: number; pitch: number; diffraction: boolean }): ResolvedDefocusDisc | undefined {\n const { run, assume, focalLengthMm, fNumber, focusDistanceM, subjectDistanceM, pitch } = input;\n const disc = resolveDefocusDisc({ focalLengthMm, aperture: fNumber, focusDistanceM, subjectDistanceM, pitchMicrometers: pitch });\n const size = disc.diameterMicrometers + \" µm (\" + disc.diameterSites + \" sites of \" + pitch + \" µm)\";\n let radius: number;\n try { radius = requireDefocusDiscKernelRadius(disc.diameterSites); } catch (error) { fail(\"lens.defocus: the blur circle is \" + size + \". \" + (error as Error).message); }\n const value = { model: \"geometric-disc\", scientificStatus: \"approximation\", diameterMicrometers: disc.diameterMicrometers, diameterSites: disc.diameterSites,\n kernelRadiusSites: disc.diameterSites === 0 ? null : radius, fNumber, focusDistanceM, subjectDistanceM, samplePitchMicrometers: pitch,\n defocusCircleModel: { id: \"thin-lens-defocus-circle\", version: \"1.1.0\" } };\n const model = \"Geometric defocus of the flat scene plane (an approximation): the thin-lens blur circle of an ideal uniform circular pupil, \" +\n \"c = f²·|s − d| / (N·d·(s − f)) (calculateDefocusCircle 1.1.0), as a uniform disc sampled on the site lattice (exact disc area in each site's cell). \" +\n \"No diffraction of the defocused wave, aberrations or pupil vignetting. \";\n if (disc.diameterSites === 0) {\n assume(\"lens.defocus\", \"model\", value, model + \"In focus (lens.focusDistanceM equals subjectDistanceM): the disc has zero diameter, so no defocus kernel is applied.\");\n return undefined;\n }\n if (run === \"ideal-reference\") {\n assume(\"lens.defocus\", \"model\", value, model + \"Resolved but not applied: the ideal reference has no camera effects.\");\n return undefined;\n }\n // The display view (#492, step 2b): a site kernel in its expected-signal tables (simulate-display-view.ts).\n if (run === \"display-view\") {\n assume(\"lens.defocus\", \"model\", { ...value, execution: \"expected-signal-site-kernel\", combinedWithDiffraction: input.diffraction }, model +\n \"Applied in the display view's expected-signal tables as a site kernel on the lattice\" + (input.diffraction ? \" (with lens.diffraction, each spectral node's \" +\n \"diffraction kernel convolved with the disc, a further approximation)\" : \"\") + \"; see the view.defocus assumption.\");\n return disc;\n }\n // The capture (#492, step 2a): an object-space convolution of the scene radiance on the site lattice.\n assume(\"lens.defocus\", \"model\", { ...value, execution: \"object-space-convolution\", combinedWithDiffraction: input.diffraction }, model +\n \"Applied as an object-space convolution: the scene radiance on the site lattice is convolved with the disc, the same kernel at every spectral node, \" +\n \"and each site query is answered with the result (for a flat scene and a still, distortion-free rectilinear camera every disc point a site sees is the scene point of another site). \" +\n (input.diffraction ? \"With lens.diffraction, each spectral node's diffraction kernel is convolved with the disc and applied as one kernel. That is a further approximation: \" +\n \"the defocused wave PSF of a circular pupil is not exactly the in-focus Airy pattern convolved with the geometric disc. \" : \"\") +\n \"The disc kernel is a sampling of the disc on the site lattice; lens.pupilSampling (ray-sampled, no diffraction) is the independent reference.\");\n return disc;\n}\n\n/** Internal: passed as the view of a \"display-view\" run to resolve the request without a view (`prepareDisplayView`, #387). */\nexport const DISPLAY_VIEW_WITHOUT_VIEW: unique symbol = Symbol(\"display view without view\");\n/**\n * Internal: the request path shared by {@link simulateCapture}, {@link simulateIdealReference} and the display view, whose renderer is\n * passed in; for a display view the renderer's value is returned (a result, or a prepared view with DISPLAY_VIEW_WITHOUT_VIEW).\n */\nexport async function runCapture(options: SimulateCaptureOptions, run: \"capture\" | \"ideal-reference\" | \"display-view\" | \"dng-from-parts\", viewOption?: unknown,\n renderView?: (context: DisplayViewRunContext) => Promise<unknown>):\n Promise<unknown> {\n const started = Date.now(), idealReference = run === \"ideal-reference\", displayView = run === \"display-view\";\n requireInputObject(options, \"simulateCapture options\");\n const top = allowKeys(options, \"simulateCapture options\", [\"camera\", \"lens\", \"exposure\", \"scene\", \"subjectDistanceM\", \"chartSize\", \"illuminant\",\n \"illuminanceLux\", \"output\", \"sensor\", \"motion\", \"fast\", \"signal\", \"onProgress\"]);\n const signal = top.signal as AbortSignal | undefined, onProgress = top.onProgress as SimulateCaptureOptions[\"onProgress\"];\n if (signal !== undefined && (typeof signal !== \"object\" || signal === null || typeof (signal as AbortSignal).aborted !== \"boolean\")) fail(\"signal must be an AbortSignal.\");\n if (onProgress !== undefined && typeof onProgress !== \"function\") fail(\"onProgress must be a function.\");\n const assumptions: SimulateCaptureAssumption[] = [];\n const assume = (id: string, kind: SimulateCaptureAssumption[\"kind\"], value: unknown, explanation: string): void => { assumptions.push({ id, kind, value, explanation }); };\n function pick<T>(record: Record<string, unknown>, key: string, path: string, fallback: T, explanation: string): T {\n if (record[key] !== undefined) return record[key] as T;\n assume(path, \"default\", fallback, explanation);\n return fallback;\n }\n const checkAbort = (): void => { if (signal?.aborted) fail(\"simulateCapture aborted.\"); };\n checkAbort();\n\n // Camera\n const cameraOption = pick<GenericEquipmentTier | GenericEquipmentTierPreset>(top, \"camera\", \"camera\", DEFAULTS.camera,\n \"Generic Photivra tier preset 2.0.0 (synthetic educational values, not a real camera).\");\n let preset: GenericEquipmentTierPreset;\n if (typeof cameraOption === \"string\") preset = GENERIC_TIER_ASSETS.find((p) => p.tier === cameraOption) ?? fail(\"Unknown camera tier.\");\n else preset = parseCallerCameraPreset(cameraOption);\n const body = preset.body, lens = preset.lens;\n\n // Lens\n const lensOptions = allowKeys(top.lens, \"lens\", [\"focalLengthMm\", \"fNumber\", \"focusDistanceM\", \"pupilSampling\", \"projection\", \"distortion\", \"vignetting\", \"psf\", \"diffraction\", \"prime\", \"defocus\"]);\n // Generic prime (2.3): resolved on the simulated frame's size, which the output and sensor sections validate again below.\n let prime: GenericPrimeLens | undefined;\n if (lensOptions.prime !== undefined) {\n if (lensOptions.focalLengthMm !== undefined) fail(\"lens.prime and lens.focalLengthMm cannot both be given: the prime sets the focal length.\");\n const o = (typeof top.output === \"object\" && top.output !== null ? top.output : {}) as Record<string, unknown>, sn = (typeof top.sensor === \"object\" && top.sensor !== null ? top.sensor : {}) as Record<string, unknown>;\n const frameW = positive(o.width ?? DEFAULTS.width, \"output.width\"), frameH = positive(o.height ?? DEFAULTS.height, \"output.height\"), framePitch = positive(sn.pixelPitchMicrometers ?? DEFAULTS.pixelPitchMicrometers, \"sensor.pixelPitchMicrometers\");\n if (typeof lensOptions.prime !== \"number\") fail(\"lens.prime must be a generic prime's full-frame-equivalent focal length in mm.\");\n prime = resolveGenericPrimeLens({ equivalentFocalLengthMm: lensOptions.prime as number, activeImagingArea: { widthMm: frameW * framePitch / 1000, heightMm: frameH * framePitch / 1000 } });\n assume(\"lens.prime\", \"model\", { lensId: prime.lensId, equivalentFocalLengthMm: prime.equivalentFocalLengthMm, focalLengthMm: prime.focalLengthMm, cropFactor35Mm: prime.cropFactor35Mm,\n widestFNumber: prime.widestFNumber, narrowestFNumber: prime.narrowestFNumber, minimumFocusDistanceM: prime.minimumFocusDistanceM },\n \"Generic prime (not a real product): focal length = equivalent ÷ the simulated frame's diagonal crop factor, f/\" + prime.widestFNumber + \"–f/\" + prime.narrowestFNumber +\n \", minimum focus max(0.10 m, f·(1 + 1/0.15)) (thin-lens approximation). It replaces the tier lens's focal length and f-number range; the tier lens's transmission is kept.\");\n }\n const lensExposure = prime ? { ...lens.exposure, profileId: \"photivra-\" + prime.lensId + \":exposure\",\n focalLengthMmRange: { ...lens.exposure.focalLengthMmRange, value: { minimum: prime.focalLengthMm, maximum: prime.focalLengthMm } },\n aperture: { ...lens.exposure.aperture, widestAvailableFNumber: { kind: \"constant\" as const, fNumber: { value: prime.widestFNumber, evidence: FACADE_EVIDENCE } },\n narrowestAvailableFNumber: { value: prime.narrowestFNumber, evidence: FACADE_EVIDENCE } } } as typeof lens.exposure : lens.exposure;\n const focalDefault = lensExposure.focalLengthMmRange.value.minimum;\n const focalLengthMm = prime ? prime.focalLengthMm :\n positive(pick(lensOptions, \"focalLengthMm\", \"lens.focalLengthMm\", focalDefault, \"The preset lens's focal length (the generic primes are 50 mm).\"), \"lens.focalLengthMm\");\n const capabilities = resolveGenericEquipmentExposureCapabilities({ bodyProfile: body.exposure, lensProfile: lensExposure, selectedFocalLengthMm: focalLengthMm });\n const subjectDistanceM = positive(pick(top, \"subjectDistanceM\", \"subjectDistanceM\", DEFAULTS.subjectDistanceM, \"Scene plane 5 m in front of the camera (the generic tiers' reference focus distance).\"), \"subjectDistanceM\");\n if (subjectDistanceM * 1000 <= focalLengthMm * 2) fail(\"subjectDistanceM must exceed twice the focal length.\");\n const focusDistanceM = positive(pick(lensOptions, \"focusDistanceM\", \"lens.focusDistanceM\", subjectDistanceM, \"Focused on the scene plane.\"), \"lens.focusDistanceM\");\n if (focusDistanceM * 1000 <= focalLengthMm) fail(\"lens.focusDistanceM must exceed the focal length.\");\n if (prime && (subjectDistanceM < prime.minimumFocusDistanceM || focusDistanceM < prime.minimumFocusDistanceM))\n fail(\"The \" + prime.lensId + \" focuses no closer than \" + prime.minimumFocusDistanceM + \" m (max(0.10 m, f·(1 + 1/0.15))); subjectDistanceM and lens.focusDistanceM must be at least that.\");\n let pupil: { radialSamples: number; angularSamples: number } | undefined;\n if (lensOptions.pupilSampling === undefined) assume(\"lens.pupilSampling\", \"default\", null, lensOptions.defocus === undefined ?\n \"No pupil sampling: each scene query follows the central (chief) ray, so defocus and depth of field are not rendered. Enable lens.pupilSampling for an ideal circular pupil.\" :\n \"No pupil sampling: each scene query follows the central (chief) ray; defocus of the scene plane is the lens.defocus option's (see the lens.defocus assumption).\");\n else {\n const p = allowKeys(lensOptions.pupilSampling, \"lens.pupilSampling\", [\"radialSamples\", \"angularSamples\"]);\n // The environment pupil contract admits 4..64 azimuthal midpoints and at most 256 rays.\n pupil = { radialSamples: integerIn(p.radialSamples, \"lens.pupilSampling.radialSamples\", 1, 16), angularSamples: integerIn(p.angularSamples, \"lens.pupilSampling.angularSamples\", 4, 64) };\n if (pupil.radialSamples * pupil.angularSamples > 256) fail(\"lens.pupilSampling needs at most 256 rays (radialSamples × angularSamples).\");\n }\n // 2.0 optics hooks: only what the environment site contract accepts.\n const projection: LensProjectionModel | undefined = lensOptions.projection === undefined ? undefined : parseLensProjectionModel(lensOptions.projection);\n let distortion: SimulateCaptureLensDistortion | undefined;\n if (lensOptions.distortion !== undefined) {\n const d = allowKeys(lensOptions.distortion, \"lens.distortion\", [\"kind\", \"profile\"]);\n if (d.kind !== \"radial\" && d.kind !== \"brown-conrady\") fail(\"lens.distortion.kind must be radial or brown-conrady.\");\n distortion = d as unknown as SimulateCaptureLensDistortion;\n }\n const lensFieldMapping: EnvironmentLensFieldMapping | undefined = projection === undefined && distortion === undefined ? undefined :\n { projectionModel: projection ?? \"rectilinear\", distortion: distortion ?? { kind: \"none\" }, radiometricAreaCorrection: \"inverse-distortion-jacobian\" };\n if (lensFieldMapping) {\n if (pupil) fail(\"lens.projection and lens.distortion cannot be combined with lens.pupilSampling: ideal pupil rays use the rectilinear, distortion-free projection.\");\n try { prepareEnvironmentLensFieldMapping(lensFieldMapping); } catch (error) { fail(\"Invalid lens projection or distortion: \" + (error as Error).message); }\n }\n let vignetting: IlluminationVignettingProfile | undefined;\n if (lensOptions.vignetting !== undefined) { requireInputObject(lensOptions.vignetting, \"lens.vignetting\"); vignetting = lensOptions.vignetting as IlluminationVignettingProfile; }\n let lensPsf: NonNullable<NonNullable<SimulateCaptureOptions[\"lens\"]>[\"psf\"]> | undefined;\n if (lensOptions.psf !== undefined) {\n const p = allowKeys(lensOptions.psf, \"lens.psf\", [\"kind\", \"configuration\"]);\n if (p.kind !== \"sampled-local\") fail(\"lens.psf.kind must be sampled-local.\");\n requireInputObject(p.configuration, \"lens.psf.configuration\");\n if (pupil) fail(\"lens.psf cannot be combined with lens.pupilSampling: geometric defocus would be counted twice.\");\n lensPsf = p as unknown as typeof lensPsf;\n }\n // Diffraction (2.1): validated here, built once the f-number is resolved.\n let diffractionRadiusOption: number | null | undefined, diffractionFast: boolean | undefined;\n if (lensOptions.diffraction !== undefined) {\n const d = lensOptions.diffraction;\n if (d === \"circular-aperture\") diffractionRadiusOption = null;\n else {\n const record = allowKeys(d, \"lens.diffraction\", [\"kind\", \"aperture\", \"kernelRadiusSamples\", \"fast\"]);\n // #395: the record names the model by `kind`; `aperture` is its deprecated alias (until 3.0.0).\n if (record.kind !== undefined && record.aperture !== undefined) fail(\"lens.diffraction takes kind or its deprecated alias aperture, not both.\");\n const model = record.kind !== undefined ? record.kind : record.aperture;\n if (model !== \"circular-aperture\") fail(\"lens.diffraction must be \\\"circular-aperture\\\" or { kind: \\\"circular-aperture\\\", kernelRadiusSamples, fast }.\");\n diffractionRadiusOption = record.kernelRadiusSamples === undefined ? null : integerIn(record.kernelRadiusSamples, \"lens.diffraction.kernelRadiusSamples\", 0, 32);\n diffractionFast = fastOverride(record, \"lens.diffraction\");\n }\n if (lensPsf) fail(\"lens.diffraction cannot be combined with lens.psf: diffraction would be counted twice.\");\n if (pupil) fail(\"lens.diffraction cannot be combined with lens.pupilSampling: the environment contract does not mix a sampled PSF with pupil rays.\");\n }\n // Defocus (#492): validated here, resolved once the f-number is.\n let defocusModel: \"geometric-disc\" | undefined;\n if (lensOptions.defocus !== undefined) {\n const record = allowKeys(lensOptions.defocus, \"lens.defocus\", [\"model\"]);\n if (record.model !== \"geometric-disc\") fail(\"lens.defocus.model must be \\\"geometric-disc\\\".\");\n if (pupil) fail(\"lens.defocus cannot be combined with lens.pupilSampling: the pupil rays already render defocus, so it would be counted twice.\");\n if (lensPsf) fail(\"lens.defocus cannot be combined with lens.psf: a caller PSF declares its own defocus, so it could be counted twice.\");\n defocusModel = \"geometric-disc\";\n }\n\n // Motion (2.0): constant camera rotation and the shutter type.\n const motionOptions = allowKeys(top.motion, \"motion\", [\"angularVelocityRadPerSec\", \"shutter\", \"rollingShutterSkewSeconds\"]);\n const angular = { pitch: 0, yaw: 0, roll: 0 };\n if (motionOptions.angularVelocityRadPerSec !== undefined) {\n const a = allowKeys(motionOptions.angularVelocityRadPerSec, \"motion.angularVelocityRadPerSec\", [\"pitch\", \"yaw\", \"roll\"]);\n for (const axis of [\"pitch\", \"yaw\", \"roll\"] as const) if (a[axis] !== undefined) {\n const value = a[axis];\n if (typeof value !== \"number\" || !Number.isFinite(value) || Math.abs(value) > 100) fail(\"motion.angularVelocityRadPerSec.\" + axis + \" must be a finite number within ±100 rad/s.\");\n angular[axis] = value as number;\n }\n }\n const rotating = angular.pitch !== 0 || angular.yaw !== 0 || angular.roll !== 0;\n const shutterKind = motionOptions.shutter === undefined ? \"global\" : motionOptions.shutter;\n if (shutterKind !== \"global\" && shutterKind !== \"rolling\") fail(\"motion.shutter must be global or rolling.\");\n if (motionOptions.rollingShutterSkewSeconds !== undefined && shutterKind !== \"rolling\") fail(\"motion.rollingShutterSkewSeconds needs motion.shutter \\\"rolling\\\".\");\n const rollingSkewOption = motionOptions.rollingShutterSkewSeconds === undefined ? undefined : positive(motionOptions.rollingShutterSkewSeconds, \"motion.rollingShutterSkewSeconds\");\n // Diffraction runs as an object-space convolution when every PSF tap's source is another site centre seen\n // through one linear map (still camera, rectilinear, no distortion or field throughput); otherwise per tap.\n const diffractionObjectSpace = diffractionRadiusOption !== undefined && !rotating && !lensFieldMapping && !vignetting;\n\n // Output and sensor\n const outputOptions = allowKeys(top.output, \"output\", [\"width\", \"height\", \"format\", \"toneCurve\", \"toneCurveParameters\", \"highlightMode\", \"whiteBalance\", \"jpegQuantizationStep\",\n \"colorEncoding\", \"bitDepth\", \"gamutMapping\", \"demosaic\", \"borderHandling\", \"dng\", \"maximumPixels\", \"region\", \"metadata\"]);\n // Opt-in large images: a caller-raised native pixel limit. Without it the 4094-pixel sides are unchanged.\n const raisedPixels = outputOptions.maximumPixels === undefined ? undefined : integerIn(outputOptions.maximumPixels, \"output.maximumPixels\", 1, NATIVE_RAW_LIMITS.ceilingPixels);\n const maximumSide = raisedPixels === undefined ? 4094 : NATIVE_RAW_LIMITS.maximumDimension;\n const width = integerIn(pick(outputOptions, \"width\", \"output.width\", DEFAULTS.width, \"64 × 64 output pixels.\"), \"output.width\", 1, maximumSide);\n const height = integerIn(pick(outputOptions, \"height\", \"output.height\", DEFAULTS.height, \"64 × 64 output pixels.\"), \"output.height\", 1, maximumSide);\n const format = pick<SimulateCaptureOutputFormat>(outputOptions, \"format\", \"output.format\", DEFAULTS.format, \"8-bit sRGB samples.\");\n if (![\"srgb-8\", \"srgb-16\", \"jpeg\", \"png\", \"dng\"].includes(format)) fail(\"output.format must be srgb-8, srgb-16, jpeg, png or dng.\");\n let dngCapturedAtUtc: string | undefined;\n if (format === \"dng\") {\n const d = allowKeys(outputOptions.dng, \"output.dng\", [\"capturedAtUtc\"]);\n dngCapturedAtUtc = d.capturedAtUtc as string | undefined;\n if (dngCapturedAtUtc === undefined) assume(\"output.dng.capturedAtUtc\", \"default\", null, \"No capture time: the DNG carries no DateTimeOriginal (the engine never invents a wall clock).\");\n } else if (outputOptions.dng !== undefined) fail(\"output.dng applies only to output.format \\\"dng\\\".\");\n if (run === \"dng-from-parts\" && format !== \"dng\") fail(\"serializeSimulatedCaptureDngFromParts needs output.format \\\"dng\\\".\");\n const textMetadata = parseOutputTextMetadata(outputOptions.metadata, \"output.metadata\");\n if (textMetadata && format !== \"jpeg\" && format !== \"png\" && format !== \"dng\") fail(\"output.metadata applies only to output.format \\\"jpeg\\\", \\\"png\\\" or \\\"dng\\\".\");\n const assumeTextMetadata = (layout: string): void => {\n if (textMetadata) assume(\"output.metadata\", \"model\", { fields: Object.keys(textMetadata), layout },\n \"The caller's text, written unchanged; the engine adds no text of its own (in the DNG the description follows the existing simulated-RAW statement). Without output.metadata the file is byte-identical to 2.3.\");\n };\n let colorEncoding: SimulateCaptureColorEncoding | undefined, pngBitDepth: 8 | 16 | undefined;\n if (format === \"png\") {\n colorEncoding = pick<SimulateCaptureColorEncoding>(outputOptions, \"colorEncoding\", \"output.colorEncoding\", \"srgb\",\n \"sRGB (W3C CSS Color 4 srgb) samples signalled with the PNG sRGB chunk (perceptual intent) and its prescribed gAMA/cHRM values.\");\n if (![\"srgb\", \"display-p3\", \"rec2020\"].includes(colorEncoding)) fail(\"output.colorEncoding must be srgb, display-p3 or rec2020.\");\n pngBitDepth = pick<8 | 16>(outputOptions, \"bitDepth\", \"output.bitDepth\", 8, \"8 bits per sample.\");\n if (pngBitDepth !== 8 && pngBitDepth !== 16) fail(\"output.bitDepth must be 8 or 16.\");\n } else if (outputOptions.colorEncoding !== undefined || outputOptions.bitDepth !== undefined) fail(\"output.colorEncoding and output.bitDepth apply only to output.format \\\"png\\\".\");\n let perceptual = false;\n if (format === \"png\") {\n const gamutMapping = pick<\"clip\" | \"perceptual\">(outputOptions, \"gamutMapping\", \"output.gamutMapping\", \"clip\", \"Out-of-gamut components are clipped to [0, 1] in the target space.\");\n if (gamutMapping !== \"clip\" && gamutMapping !== \"perceptual\") fail(\"output.gamutMapping must be clip or perceptual.\");\n perceptual = gamutMapping === \"perceptual\";\n } else if (outputOptions.gamutMapping !== undefined) fail(\"output.gamutMapping applies only to output.format \\\"png\\\".\");\n const wideGamut = colorEncoding !== undefined && colorEncoding !== \"srgb\";\n // The linear development path serves wide-gamut encodings and perceptual gamut mapping.\n const linearPath = wideGamut || perceptual;\n const toneCurve = pick<SdrToneCurve>(outputOptions, \"toneCurve\", \"output.toneCurve\", DEFAULTS.toneCurve, \"Identity tone curve: scene-linear values are clipped at display white, then sRGB-encoded.\");\n if (linearPath && toneCurve !== \"identity\") fail(\"output.toneCurve other than identity is available only for sRGB output; wide-gamut encodings are converted from the linear developed colour.\");\n const highlightMode = pick<RawHighlightMode>(outputOptions, \"highlightMode\", \"output.highlightMode\", DEFAULTS.highlightMode, \"Saturated RAW highlights are clipped to neutral.\");\n const whiteBalanceOption = pick<SimulateCaptureWhiteBalance>(outputOptions, \"whiteBalance\", \"output.whiteBalance\", DEFAULTS.whiteBalance,\n \"White balance measured from a perfect white diffuser under the scene illuminant (a custom/grey-card white balance).\");\n const jpegStep = format === \"jpeg\" ? integerIn(pick(outputOptions, \"jpegQuantizationStep\", \"output.jpegQuantizationStep\", DEFAULTS.jpegQuantizationStep,\n \"Constant JPEG quantization step 2 (not a manufacturer quality scale).\"), \"output.jpegQuantizationStep\", 1, 255) : undefined;\n if (format !== \"jpeg\" && outputOptions.jpegQuantizationStep !== undefined) fail(\"output.jpegQuantizationStep applies only to output.format \\\"jpeg\\\".\");\n const sensorOptions = allowKeys(top.sensor, \"sensor\", [\"pixelPitchMicrometers\", \"spectralStepNanometers\", \"temporalSampleCount\", \"noiseSeed\", \"antiAliasing\", \"pixelAperture\"]);\n const pitch = positive(pick(sensorOptions, \"pixelPitchMicrometers\", \"sensor.pixelPitchMicrometers\", DEFAULTS.pixelPitchMicrometers,\n \"6 µm pixels (about a 24 MP full-frame sensor). The simulated sensor is width × pitch wide, so small images are a central crop of a large sensor, not a downscaled full frame.\"), \"sensor.pixelPitchMicrometers\");\n if (pitch < 0.5 || pitch > SIMULATE_CAPTURE_PIXEL_PITCH_MAXIMUM_MICROMETERS) fail(\"sensor.pixelPitchMicrometers must be 0.5-\" + SIMULATE_CAPTURE_PIXEL_PITCH_MAXIMUM_MICROMETERS + \".\");\n const spectralStep = positive(pick(sensorOptions, \"spectralStepNanometers\", \"sensor.spectralStepNanometers\", DEFAULTS.spectralStepNanometers,\n \"Spectral midpoint quadrature over 380-780 nm with subintervals of at most 20 nm.\"), \"sensor.spectralStepNanometers\");\n if (spectralStep < 1 || spectralStep > 100) fail(\"sensor.spectralStepNanometers must be 1-100.\");\n const temporalSampleCount = integerIn(rotating ? pick(sensorOptions, \"temporalSampleCount\", \"sensor.temporalSampleCount\", ROTATING_TEMPORAL_SAMPLE_COUNT,\n \"Eight temporal midpoints across each site's exposure window sample the camera rotation (motion blur); raise it for long exposures or fast rotation.\") :\n pick(sensorOptions, \"temporalSampleCount\", \"sensor.temporalSampleCount\", DEFAULTS.temporalSampleCount,\n \"One temporal sample: the static scene and still camera make more samples unnecessary.\"), \"sensor.temporalSampleCount\", 1, 256);\n const noiseSeed = integerIn(pick(sensorOptions, \"noiseSeed\", \"sensor.noiseSeed\", DEFAULTS.noiseSeed, \"Fixed noise seed 1 (deterministic output).\"), \"sensor.noiseSeed\", 0, 0xffffffff);\n const antiAliasing = sensorOptions.antiAliasing === undefined ? undefined : parseAntiAliasing(sensorOptions.antiAliasing, pitch);\n const antiAliasingFast = antiAliasing ? fastOverride(sensorOptions.antiAliasing as Record<string, unknown>, \"sensor.antiAliasing\") : undefined;\n // Pixel aperture (2.3): N × N midpoint nodes over the square photosite; 1 = the default centre sample.\n let boxSamples = 1, boxFast: boolean | undefined;\n if (sensorOptions.pixelAperture !== undefined && sensorOptions.pixelAperture !== \"point\") {\n const a = sensorOptions.pixelAperture;\n if (a === \"box\") boxSamples = SIMULATE_CAPTURE_BOX_APERTURE_DEFAULT_SAMPLES;\n else {\n const record = allowKeys(a, \"sensor.pixelAperture\", [\"kind\", \"samplesPerAxis\", \"fast\"]);\n if (record.kind !== \"box\") fail(\"sensor.pixelAperture must be \\\"point\\\", \\\"box\\\" or { kind: \\\"box\\\", samplesPerAxis, fast }.\");\n boxFast = fastOverride(record, \"sensor.pixelAperture\");\n boxSamples = record.samplesPerAxis === undefined ? SIMULATE_CAPTURE_BOX_APERTURE_DEFAULT_SAMPLES : integerIn(record.samplesPerAxis, \"sensor.pixelAperture.samplesPerAxis\", 1, 16);\n }\n }\n const boxAperture = sensorOptions.pixelAperture !== undefined && sensorOptions.pixelAperture !== \"point\";\n // Display view: its own parameters, and the capture options it reproduces, checked before any scene work.\n const parsedView = displayView && viewOption !== DISPLAY_VIEW_WITHOUT_VIEW ? parseDisplayViewOption(viewOption, width, height) : undefined;\n if (displayView) {\n const unsupported = (option: string, reason: string): never => fail(\"simulateDisplayView does not support \" + option + \": \" + reason);\n if (pupil) unsupported(\"lens.pupilSampling\", \"pupil rays move each query off the site lattice the expected-signal tables use; lens.defocus renders the defocus of the scene plane on the lattice.\");\n if (lensFieldMapping) unsupported(\"lens.projection or lens.distortion\", \"the expected signal assumes the ideal rectilinear, distortion-free mapping of the site lattice.\");\n if (vignetting) unsupported(\"lens.vignetting\", \"the expected signal assumes the same radiance-to-irradiance factor at every site.\");\n if (lensPsf) unsupported(\"lens.psf\", \"only the engine-built diffraction kernels (lens.diffraction) are tabulated.\");\n if (rotating) unsupported(\"motion.angularVelocityRadPerSec\", \"camera rotation moves the queries off the site lattice.\");\n if (outputOptions.region !== undefined) unsupported(\"output.region\", \"pass the rectangle as view.region, in display pixels.\");\n if (outputOptions.whiteBalance === \"auto\") unsupported(\"output.whiteBalance \\\"auto\\\"\", \"the capture measures it from its noisy full-resolution RAW; use \\\"scene-illuminant\\\" or a fixed white balance.\");\n if (outputOptions.toneCurve !== undefined && outputOptions.toneCurve !== \"identity\" && outputOptions.toneCurve !== \"positive-reinhard-per-channel\")\n unsupported(\"output.toneCurve \" + String(outputOptions.toneCurve), \"luminance tone curves couple the channels; the view supports identity and positive-reinhard-per-channel.\");\n if (outputOptions.highlightMode === \"reconstruct\") unsupported(\"output.highlightMode \\\"reconstruct\\\"\", \"the view supports the per-channel highlight clip.\");\n }\n\n const colorSamplingProfile = { schemaVersion: \"0.1.0\" as const, profileId: IDS.cfa, evidence: FACADE_EVIDENCE, coordinateSystem: \"native-sensor-color-sampling-site-index\" as const,\n layout: { kind: \"periodic-mosaic\" as const, repeatWidthSites: 2, repeatHeightSites: 2, siteChannelIds: [\"red\", \"green\", \"green\", \"blue\"], anchor: \"native-sensor-top-left-site\" as const } };\n // Demosaic (2.0): built-in Bayer kernels and border handling. Omitted, the 1.0 bilinear kernels and a\n // one-site rendered border are used unchanged.\n // #395: the record form { kind, fast } names the same demosaic.\n let demosaicOption: SimulateCaptureDemosaic | undefined, demosaicFast: boolean | undefined;\n if (outputOptions.demosaic !== undefined && typeof outputOptions.demosaic === \"object\" && outputOptions.demosaic !== null) {\n const record = allowKeys(outputOptions.demosaic, \"output.demosaic\", [\"kind\", \"fast\"]);\n if (record.kind !== \"bilinear\" && record.kind !== \"ahd\") fail(\"output.demosaic must be bilinear or ahd, or { kind, fast }.\");\n demosaicOption = record.kind as SimulateCaptureDemosaic;\n demosaicFast = fastOverride(record, \"output.demosaic\");\n } else demosaicOption = outputOptions.demosaic as SimulateCaptureDemosaic | undefined;\n const borderOption = outputOptions.borderHandling as SimulateCaptureBorderHandling | undefined;\n if (demosaicOption !== undefined && demosaicOption !== \"bilinear\" && demosaicOption !== \"ahd\") fail(\"output.demosaic must be bilinear or ahd.\");\n const ahd = demosaicOption === \"ahd\";\n // #395: exact or fast per option. No option has a fast method yet, so each runs exact and reports false.\n if (top.fast !== undefined && typeof top.fast !== \"boolean\") fail(\"fast must be true or false.\");\n const fastTop = top.fast === true;\n const fastInUse: [SimulateCaptureFastOption, boolean, boolean | undefined][] = [[\"lens.diffraction\", diffractionRadiusOption !== undefined, diffractionFast],\n [\"sensor.antiAliasing\", antiAliasing !== undefined, antiAliasingFast], [\"sensor.pixelAperture.box\", boxAperture, boxFast], [\"output.demosaic.ahd\", ahd, demosaicFast]];\n const fastApplied: Partial<Record<SimulateCaptureFastOption, boolean>> = {};\n for (const [option, used] of fastInUse) if (used) fastApplied[option] = false;\n const fastReport: SimulateCaptureFastReport = Object.freeze({\n requested: fastTop || [diffractionFast, antiAliasingFast, boxFast, demosaicFast].some((value) => value === true),\n applied: Object.freeze(fastApplied), assurance: \"engine-reference\" as const });\n if (borderOption !== undefined && borderOption !== \"margin\" && borderOption !== \"mirror\") fail(\"output.borderHandling must be margin or mirror.\");\n const builtInDemosaic = demosaicOption === undefined ? undefined : createBuiltInBayerDemosaicProfiles({ kernel: \"bilinear\",\n captureModeId: IDS.mode, colorSamplingProfile, channelRoles: { red: \"red\", green: \"green\", blue: \"blue\" } }).value;\n const mirrorBorder = borderOption === \"mirror\";\n const margin = mirrorBorder ? 0 : ahd ? AHD_MARGIN : builtInDemosaic ? builtInDemosaic.kernelReachSites : MARGIN;\n if (mirrorBorder && (width < 2 || height < 2)) fail(\"output.borderHandling \\\"mirror\\\" needs an output of at least 2 × 2 pixels.\");\n if (ahd && mirrorBorder && (width < 3 || height < 3)) fail(\"output.demosaic \\\"ahd\\\" with mirror borders needs an output of at least 3 × 3 pixels.\");\n\n // Geometry: the demosaic border (if any) on each side; output crop is the active area.\n const nativeWidth = width + 2 * margin, nativeHeight = height + 2 * margin;\n // Region (2.3): a rectangle of the whole frame. Its native sites are the region plus the demosaic reach on each side\n // (clipped to the raster, where mirror borders apply exactly as in the whole render), with the origin rounded down to\n // the 2 × 2 CFA repeat so the region raster keeps the frame's CFA phase.\n let region: { x: number; y: number; width: number; height: number } | undefined, regionNative: typeof region;\n if (outputOptions.region !== undefined) {\n const r = allowKeys(outputOptions.region, \"output.region\", [\"x\", \"y\", \"width\", \"height\"]);\n const x = integerIn(r.x, \"output.region.x\", 0, width - 1), y = integerIn(r.y, \"output.region.y\", 0, height - 1);\n region = { x, y, width: integerIn(r.width, \"output.region.width\", 1, width - x), height: integerIn(r.height, \"output.region.height\", 1, height - y) };\n const reach = margin > 0 ? margin : ahd ? AHD_MARGIN : builtInDemosaic ? builtInDemosaic.kernelReachSites : MARGIN;\n let x0 = Math.max(0, region.x + margin - reach), y0 = Math.max(0, region.y + margin - reach);\n x0 -= x0 % 2; y0 -= y0 % 2;\n regionNative = { x: x0, y: y0, width: Math.min(nativeWidth, region.x + region.width + margin + reach) - x0, height: Math.min(nativeHeight, region.y + region.height + margin + reach) - y0 };\n }\n const outputWidth = region ? region.width : width, outputHeight = region ? region.height : height;\n if (region && regionNative) assume(\"output.region\", \"model\", { ...region, frameWidth: width, frameHeight: height, nativeRect: { ...regionNative } },\n \"Only this rectangle of the \" + width + \" × \" + height + \" frame is rendered. Framing, metering, exposure, diffraction kernels and every site's physics, noise seeds and exposure window (rolling-shutter row timing) are those of the whole frame (absolute native indices), \" +\n \"and the native rectangle includes the demosaic reach on each side (\" + (margin > 0 ? margin : \"mirror-border\") + \"), so the pixels are byte-identical to the same pixels of the whole render. \" +\n // 2.6: with lens.diffraction the convolution is limited to the region; the sentence of 2.3–2.5 is kept verbatim otherwise, so\n // region results without diffraction stay byte-identical to 2.5.0.\n (diffractionRadiusOption !== undefined ? \"With lens.diffraction the object-space convolution (when it applies) covers only the lattice the region's native sites query (plus the kernel radius), in bands of at most 32 native rows; its values are the whole render's.\" :\n \"With lens.diffraction the object-space convolution runs over whole-width bands of 32 native rows that the region touches.\"));\n if (raisedPixels !== undefined) {\n if (nativeWidth > NATIVE_RAW_LIMITS.maximumDimension || nativeHeight > NATIVE_RAW_LIMITS.maximumDimension || nativeWidth * nativeHeight > raisedPixels) {\n fail(\"output.maximumPixels (\" + raisedPixels + \") must cover the native sensor raster of \" + nativeWidth + \" × \" + nativeHeight +\n \" sites (the output plus the demosaic margin), at most \" + NATIVE_RAW_LIMITS.maximumDimension + \" per side.\");\n }\n // The display view allocates no full-resolution raster, so the AHD working limit does not apply to it.\n if (ahd && !displayView && (regionNative ? regionNative.width * regionNative.height : nativeWidth * nativeHeight) > PROCESSING_MAX_PIXELS) fail(\"output.demosaic \\\"ahd\\\" admits at most \" + PROCESSING_MAX_PIXELS + \" native sites.\");\n }\n const imagingArea = { widthMm: nativeWidth * pitch / 1000, heightMm: nativeHeight * pitch / 1000 };\n const geometry = { imagingArea, nativeRaster: { pixelWidth: nativeWidth, pixelHeight: nativeHeight }, orientation: \"landscape\" as const,\n activeCaptureRect: { x: margin, y: margin, width, height }, outputRaster: { pixelWidth: width, pixelHeight: height } };\n const resolvedGeometry = resolveCaptureGeometry(geometry).value;\n const imageDistanceMm = focalLengthMm * focusDistanceM * 1000 / (focusDistanceM * 1000 - focalLengthMm);\n const metresPerFrameUnit = (width * pitch / 2000) * subjectDistanceM / imageDistanceMm;\n const aspect = height / width;\n // Fixed-size chart (2.3): validated here, before any scene work.\n const chartSize = top.chartSize === undefined ? undefined : resolveChartSizeOption(top.chartSize, aspect);\n assume(\"scene.framing\", \"derived\", { framedWidthM: 2 * metresPerFrameUnit, framedHeightM: 2 * metresPerFrameUnit * aspect },\n chartSize ? \"The scene plane is perpendicular to the optical axis; the frame covers this much of it (thin lens, focused distance), and the chart has the physical size in scene.chartSize.\" :\n \"The scene plane is perpendicular to the optical axis and the chart is sized to fill the active frame exactly.\");\n let chartReport: NonNullable<SimulateCaptureResult[\"scene\"][\"chart\"]> | undefined;\n if (chartSize) {\n for (const key of chartSize.defaulted) assume(\"chartSize.\" + key, \"default\", chartSize[key], key === \"heightM\" ?\n \"The chart has the frame's shape: height = width × output height / output width.\" : \"An 18 % neutral grey plane surrounds the chart.\");\n const magnification = imageDistanceMm / (subjectDistanceM * 1000), framedWidthM = 2 * metresPerFrameUnit, framedHeightM = framedWidthM * aspect;\n chartReport = { widthM: chartSize.widthM, heightM: chartSize.heightM, surroundReflectance: chartSize.surroundReflectance,\n frameWidthFraction: chartSize.widthM / framedWidthM, frameHeightFraction: chartSize.heightM / framedHeightM, magnification,\n imageWidthMm: chartSize.widthM * 1000 * magnification, imageHeightMm: chartSize.heightM * 1000 * magnification,\n imageWidthPixels: chartSize.widthM * 1e6 * magnification / pitch, imageHeightPixels: chartSize.heightM * 1e6 * magnification / pitch };\n assume(\"scene.chartSize\", \"model\", chartReport,\n \"Fixed-size chart: the chart is widthM × heightM metres on the scene plane, centred on the optical axis, and the rest of the plane is a neutral Lambertian surround under the same light. \" +\n \"Its image size follows the facade's thin-lens framing: magnification m = v/d with the image distance v = f·s/(s − f) at the focus distance s and the subject distance d, so the frame spans \" +\n \"sensor width / m on the plane. frameWidthFraction and frameHeightFraction above 1 mean the chart is larger than the frame and cropped.\");\n }\n if (demosaicOption === undefined && borderOption === undefined) {\n assume(\"output.demosaic\", \"model\", \"bilinear-rggb\", \"Bilinear RGGB demosaic through explicit linear kernels; the native raster has a one-site border on each side so every output pixel has full support.\");\n } else {\n if (demosaicOption === undefined) assume(\"output.demosaic\", \"default\", \"bilinear-rggb\", \"The 1.0 facade's bilinear RGGB kernels (explicit linear neighbourhood weights).\");\n else if (ahd) assume(\"output.demosaic\", \"model\", { method: \"ahd-hirakawa-parks-2005\", dependenceReachSites: AHD_MARGIN },\n \"Adaptive homogeneity-directed demosaicing (createAhdDemosaicTask, after Hirakawa & Parks, IEEE TIP 14(3), 2005): directional green, red/blue from colour differences, and per pixel the more homogeneous of the horizontal and vertical candidates in CIELAB (white-balanced camera colour); the paper's iterative median step is not applied. Non-linear; the mosaic is normalized and white-level clipped as in the native development and stored in float32, and the native development's colour operator follows. request.development keeps the built-in bilinear kernels, which validate the development but are not used for these pixels.\");\n else assume(\"output.demosaic\", \"model\", { kernel: builtInDemosaic!.kernel, modelVersion: BUILT_IN_DEMOSAIC_VERSION, kernelReachSites: builtInDemosaic!.kernelReachSites },\n \"Built-in bilinear Bayer kernels (createBuiltInBayerDemosaicProfiles): nearest same-channel averages.\");\n if (borderOption === undefined) assume(\"output.borderHandling\", \"default\", \"margin\", \"The native raster adds the kernel reach (\" + margin + \" site(s)) on each side, so every output pixel is reconstructed from rendered sites.\");\n else assume(\"output.borderHandling\", \"model\", borderOption, mirrorBorder ?\n \"No rendered border: the native raster equals the output and reconstruction reads reflect-101 mirror images of the missing sites (CFA consistency validated), so edge pixels use mirrored rather than rendered neighbours.\" :\n \"The native raster adds the kernel reach (\" + margin + \" site(s)) on each side, so every output pixel is reconstructed from rendered sites.\");\n }\n\n // Radiance queries per native site: spectral subintervals × temporal midpoints × pupil rays × PSF taps.\n const psfTaps = lensPsf ? Math.max(1, ...((lensPsf.configuration.psf.profile.nodes ?? []) as readonly { kernel?: { widthSamples?: unknown; heightSamples?: unknown } }[])\n .map((node) => Number(node.kernel?.widthSamples) * Number(node.kernel?.heightSamples)).filter((taps) => Number.isSafeInteger(taps) && taps > 0)) : 1;\n const queriesPerSite = temporalSampleCount * (Math.ceil((FACADE_SPECTRAL_RANGE_NANOMETERS.maximum - FACADE_SPECTRAL_RANGE_NANOMETERS.minimum) / spectralStep) + 1) *\n (pupil ? pupil.radialSamples * pupil.angularSamples : 1) * psfTaps * (antiAliasing ? antiAliasing.components.length : 1) * boxSamples * boxSamples;\n\n // Scene and illuminant\n // The scene is the one required input: the facade never guesses what is being photographed.\n if (top.scene === undefined) fail(\"simulateCapture needs a scene, for example { preset: \\\"uniform\\\" } (an 18 % grey card) or { preset: \\\"slanted-edge\\\" }.\");\n const sceneOption = top.scene;\n requireInputObject(sceneOption, \"scene\");\n const illuminantOption = pick<CaptureIlluminant>(top, \"illuminant\", \"illuminant\", { kind: \"planckian\", temperatureKelvin: DEFAULTS.illuminantKelvin },\n \"Planckian (blackbody) 6500 K as a stand-in for daylight. CIE D65 is not bundled; pass its S0/S1/S2 basis as a daylight illuminant to use it.\");\n const illuminant = resolveCaptureIlluminant(illuminantOption);\n const illuminanceLux = positive(pick(top, \"illuminanceLux\", \"illuminanceLux\", SIMULATE_CAPTURE_DEFAULT_ILLUMINANCE_LUX,\n \"π·10·N²/(0.65·t·S·0.18) lux at f/8, 1/125 s, ISO 100 (CIPA DC-004 standard output sensitivity H = 10/S and camera equation H = 0.65·L·t/N²): an 18 % grey card then gets the reference exposure for the default settings. It does not follow the caller's exposure settings.\"), \"illuminanceLux\");\n const irradianceScale = calculateIlluminantIrradianceScale(illuminant.shape, illuminanceLux);\n let chart: ResolvedChartScene | undefined, callerScene: ResolvedCallerScene | undefined, materialLayers: ResolvedChartMaterialLayers | undefined;\n const sceneRecord = sceneOption as Record<string, unknown>;\n if (\"kind\" in sceneRecord) {\n // #491: a declared material-layers scene is its callerScene (the same validation, materials, digest and bytes as passing that scene);\n // the resolved layers are kept for the display view's GPU renderer.\n if (sceneRecord.kind === \"material-layers\") materialLayers = resolveChartMaterialLayers({ scene: sceneOption as ChartMaterialLayerScene, aspect: chartSize ? chartSize.heightM / chartSize.widthM : aspect });\n callerScene = requireCallerScene(materialLayers ? materialLayers.callerScene : sceneOption);\n } else {\n chart = resolveChartScene({ scene: sceneOption as ChartScene, aspect: chartSize ? chartSize.heightM / chartSize.widthM : aspect });\n // Composite charts (2.3) report nested defaults by dotted path, for example \"elements.2.parameters.cycles\".\n const parameterAt = (key: string): unknown => key in chart!.parameters ? chart!.parameters[key] :\n key.split(\".\").reduce<unknown>((value, part) => (value as Record<string, unknown> | undefined)?.[part], chart!.parameters);\n for (const key of chart.defaultedParameters) assume(\"scene.\" + key, \"default\", parameterAt(key), \"Chart default for \" + chart.preset + \".\");\n }\n const scenePreset = chart ? chart.preset : callerScene!.kind;\n // Caller spectra enter the digest as data (see spectrumDigestForm). Without caller spectra the description is unchanged,\n // so default captures keep their digests.\n const illuminantRecord = typeof illuminantOption === \"object\" ? illuminantOption as { kind?: unknown; basis?: { datasetId?: unknown } } : undefined;\n const illuminantSpectrum = illuminantRecord?.kind === \"spectrum\" ? { spectrum: spectrumDigestForm(illuminant.spectrum, illuminant.shape) } :\n illuminantRecord?.kind === \"daylight\" ? { basisDatasetId: illuminantRecord.basis?.datasetId, spectrum: spectrumDigestForm(illuminant.spectrum, illuminant.shape) } : undefined;\n const materialInputs = chart ? chartMaterialInputs(chart) : [];\n const sceneSpectra = chart ? chart.materials.flatMap((m, index) => m.kind !== \"spectrum\" ? [] : [{ material: index, spectrum: spectrumDigestForm(materialInputs[index], m.spectrum) }]) : [];\n // 2.7: a material scene's materials enter the digest as data (neutral reflectances, and caller spectra as above).\n const sceneMaterials = callerScene?.kind === \"material-function\" ? callerScene.materials.map((m, index) => (m.kind === \"neutral\" ? m.reflectance :\n spectrumDigestForm(callerScene.materialInputs[index], m.spectrum))) : undefined;\n const sceneDescription = { facadeVersion: SIMULATE_CAPTURE_FACADE_VERSION, scene: chart ? { preset: chart.preset, parameters: chart.parameters } :\n { kind: callerScene!.kind, sceneId: callerScene!.sceneId }, illuminant: illuminant.id, illuminanceLux, subjectDistanceM, framedWidthM: 2 * metresPerFrameUnit, aspect,\n ...(chartSize ? { chartSize: { widthM: chartSize.widthM, heightM: chartSize.heightM, surroundReflectance: chartSize.surroundReflectance } } : {}),\n ...(illuminantSpectrum === undefined ? {} : { illuminantSpectrum }), ...(sceneSpectra.length === 0 ? {} : { sceneSpectra }), ...(sceneMaterials ? { sceneMaterials } : {}) };\n if (callerScene?.kind === \"material-function\") assume(\"scene.digest\", \"model\", \"caller-function-not-hashed\", \"The source digest covers the caller's sceneId, its materials and the framing, not the body of the caller's materialAt function.\");\n else if (callerScene) assume(\"scene.digest\", \"model\", \"caller-function-not-hashed\", \"The source digest covers the caller's sceneId and the framing, not the body of the caller's evaluate function.\");\n const sourceSha256 = await sha256Hex(JSON.stringify(sceneDescription, (_key, value: unknown) => (typeof value === \"object\" && value !== null && \"evaluate\" in value ? \"caller-spectrum\" : value)));\n checkAbort();\n const buildProvider = (sceneIlluminant: ResolvedCaptureIlluminant, scale: number): PlanarSceneRadianceProvider => buildPlanarSceneRadianceProvider({ scene: chart ?? callerScene!,\n sceneId: IDS.scene, providerProfileId: IDS.provider, illuminant: sceneIlluminant, irradianceScale: scale, geometry: { distanceM: subjectDistanceM, metresPerFrameUnit,\n ...(chartSize ? { chart: { widthM: chartSize.widthM, heightM: chartSize.heightM, surroundReflectance: chartSize.surroundReflectance } } : {}) }, evidence: FACADE_EVIDENCE,\n limitations: Object.freeze([\"Planar Lambertian scene under uniform illumination; no shadows, inter-reflection, gloss or fluorescence.\"]) });\n const provider = buildProvider(illuminant, irradianceScale);\n // 2.6: a chart preset's evaluator is engine-built end to end (its results: the schema's exact keys, constant fields,\n // the request's identifiers, deep-frozen FACADE_EVIDENCE, UNCERTAINTY and limitations, and an engine-computed\n // radiance), so the native task may skip re-parsing the fixed parts. Caller scenes keep the full validation.\n // #394: a caller material scene's evaluator is engine-built in the same way (its radiance comes from the validated materials;\n // only materialAt, validated on every call, is the caller's).\n const materialEvaluator = chart !== undefined || callerScene?.kind === \"material-function\";\n if (materialEvaluator) markInternalSceneRadianceEvaluator(provider.evaluateRadiance);\n // #394: its results are materialRadiance(material at the queried point, wavelength), so the lean executor may tabulate them.\n const materialOfDirection = planarProviderMaterialOfDirection(provider);\n if (materialEvaluator && materialOfDirection && provider.materialRadiance) registerInternalRadianceAccess(provider.evaluateRadiance,\n { keyOfDirection: materialOfDirection, radianceOfKey: provider.materialRadiance, tabulated: true });\n assume(\"model.scene-radiometry\", \"model\", \"lambertian-plane\", \"Radiance = reflectance × irradiance / π on one plane; illuminance from K_m = 683 lm/W and the engine's analytic CIE 1931 ȳ fit.\");\n\n // Metering (CIPA DC-004 standard output sensitivity and camera equation) and exposure-mode resolution\n const exposureOptions = allowKeys(top.exposure, \"exposure\", [\"mode\", \"iso\", \"shutterSeconds\", \"compensationStops\", \"autoIso\", \"metering\"]);\n // 2.14: no default assumption when omitted, so 2.13 requests keep their assumptions; the result reports `exposure.metering`.\n const metering: SimulateCaptureMetering = exposureOptions.metering === undefined ? \"scene-average\" : exposureOptions.metering as SimulateCaptureMetering;\n if (!(SIMULATE_CAPTURE_METERING_MODES as readonly unknown[]).includes(metering)) fail('exposure.metering must be \"scene-average\" or \"grey-card\".');\n const mode = pick<SimulateCaptureExposureMode>(exposureOptions, \"mode\", \"exposure.mode\", \"manual\", \"Manual exposure.\");\n if (![\"manual\", \"aperture-priority\", \"shutter-priority\", \"program\"].includes(mode)) fail(\"Unknown exposure mode.\");\n const isoOption = pick<unknown>(exposureOptions, \"iso\", \"exposure.iso\", DEFAULTS.iso, \"ISO 100, the tiers' base ISO.\");\n // #516: \"auto\" resolves the ISO with the mode's Auto ISO resolver; NaN marks the ISO as not yet known.\n const automaticIso = isoOption === \"auto\";\n if (typeof isoOption === \"string\" && !automaticIso) fail('exposure.iso must be a positive finite number or \"auto\".');\n const iso = automaticIso ? NaN : positive(isoOption, \"exposure.iso\");\n if (exposureOptions.autoIso !== undefined && !automaticIso) fail('exposure.autoIso applies only with exposure.iso \"auto\"; omit it.');\n const compensation = exposureOptions.compensationStops === undefined ? DEFAULTS.compensationStops : exposureOptions.compensationStops;\n if (typeof compensation !== \"number\" || !Number.isFinite(compensation) || Math.abs(compensation) > 10) fail(\"exposure.compensationStops must be within ±10.\");\n if (exposureOptions.compensationStops === undefined) assume(\"exposure.compensationStops\", \"default\", 0, \"No exposure compensation.\");\n const reference = { aperture: DEFAULTS.fNumber, shutterSeconds: DEFAULTS.shutterSeconds, iso: DEFAULTS.iso };\n const referenceLuminance = sosReferenceLuminance(reference.aperture, reference.shutterSeconds, reference.iso);\n assume(\"exposure.referenceExposure\", \"model\", { ...reference, meteredLuminanceCdPerSquareMeter: referenceLuminance },\n \"Exposure anchor: f/8, 1/125 s, ISO 100 gives the CIPA DC-004 standard output sensitivity reference exposure H = 10/S = 0.1 lx·s for an average scene luminance of 10·N²/(0.65·t·S) ≈ 1230.77 cd/m² (camera equation H = 0.65·L·t/N²).\");\n const meterProfile = body.metering[0]!.profile, zones = 16, zoneSamples = [];\n let luminanceSum = 0;\n for (let j = 0; j < zones; j++) for (let i = 0; i < zones; i++) {\n const u = -1 + (i + 0.5) * 2 / zones, v = aspect - (j + 0.5) * 2 * aspect / zones;\n const luminance = luminanceOf((nm) => provider.radianceAt(u, v, nm));\n luminanceSum += luminance;\n zoneSamples.push({ sampleId: \"zone-\" + i + \"-\" + j, positionOrientedCaptureUv: { u: (i + 0.5) / zones, v: (j + 0.5) / zones },\n relativeLinearSignal: meterProfile.target.targetRelativeSignal * luminance / referenceLuminance, areaWeight: 1 });\n }\n const meteredLuminance = luminanceSum / (zones * zones);\n assume(\"exposure.metering\", \"model\", { policy: meterProfile.policy.kind, zones: zones * zones },\n \"The body's \" + meterProfile.policy.kind + \" meter reads scene luminance on a 16 × 16 zone grid, before the lens (no lens transmission, vignetting or flare).\");\n if (metering === \"grey-card\") {\n // 2.14: incident metering. Every zone reads the 18 % Lambertian grey card under the request's illuminance, L = 0.18·E/π.\n if (callerScene?.kind === \"radiance-function\") fail('exposure.metering \"grey-card\" needs a scene lit by the illuminance; a radiance-function scene ignores illuminanceLux.');\n const cardLuminance = GREY_CARD_REFLECTANCE * illuminanceLux / Math.PI;\n for (const sample of zoneSamples) sample.relativeLinearSignal = meterProfile.target.targetRelativeSignal * cardLuminance / referenceLuminance;\n assume(\"exposure.meteringSource\", \"model\", { metering, greyCardReflectance: GREY_CARD_REFLECTANCE, luminanceCdPerSquareMeter: cardLuminance },\n \"Grey-card (incident) metering: every meter zone reads an 18 % Lambertian grey card under the scene illuminance, L = 0.18·E/π, instead of the scene.\");\n }\n const meterResult = meterRelativeExposure({ profile: meterProfile, sampleSet: { measurementId: \"facade-meter\", sceneStateId: IDS.sceneState,\n inputDomain: \"relative-pre-exposure-linear-signal\", captureRegion: \"oriented-active-capture\", captureGeometry: resolvedGeometry,\n processingState: { exposureSettingsApplied: false, whiteBalanceApplied: false, toneMappingApplied: false, displayGammaApplied: false, sharpeningApplied: false },\n samples: zoneSamples } });\n let target = createExposureMeterTargetFromMeteringResult({ targetId: \"facade-target\", meterResult: meterResult.value });\n if (compensation !== 0) target = setExposureCompensationOnMeterTarget({ targetId: \"facade-target-ec\", baseTarget: target, exposureCompensationStops: compensation });\n let resolution: { status: string; resolvedSettings?: { aperture?: number; shutterSeconds?: number; iso?: number } };\n let fNumber: number, shutterSeconds: number;\n if (mode === \"manual\" || mode === \"aperture-priority\") {\n fNumber = positive(pick(lensOptions, \"fNumber\", \"lens.fNumber\", DEFAULTS.fNumber, \"f/8.\"), \"lens.fNumber\");\n if (prime && (fNumber < prime.widestFNumber || fNumber > prime.narrowestFNumber))\n fail(\"lens.fNumber \" + fNumber + \" is outside the \" + prime.lensId + \" range f/\" + prime.widestFNumber + \"–f/\" + prime.narrowestFNumber + \".\");\n } else {\n if (lensOptions.fNumber !== undefined) fail(\"lens.fNumber is resolved automatically in \" + mode + \" mode; omit it.\");\n fNumber = NaN;\n }\n if (mode === \"manual\" || mode === \"shutter-priority\") {\n shutterSeconds = positive(pick(exposureOptions, \"shutterSeconds\", \"exposure.shutterSeconds\", DEFAULTS.shutterSeconds, \"1/125 s.\"), \"exposure.shutterSeconds\");\n } else {\n if (exposureOptions.shutterSeconds !== undefined) fail(\"exposure.shutterSeconds is resolved automatically in \" + mode + \" mode; omit it.\");\n shutterSeconds = NaN;\n }\n // #516: the resolvers' Auto ISO policies; their baseline is the lowest selectable ISO in the body's Auto ISO range.\n const autoIsoBaseline: AutoIsoBaselinePolicy = { isoBaseline: \"minimum-selectable\", isoQuantizationPolicy: \"nearest-log2-lower-on-tie\" };\n let autoIsoAperturePriority: { slowestPreferredShutterSeconds: number; afterMaximumIso: SimulateCaptureAutoIsoAfterMaximum } | undefined;\n // #505: the photographer's Auto ISO limits, validated against the body's Auto ISO range; absent unless given.\n let autoIsoOptions: Record<string, unknown> = {};\n let autoIsoLimits: { minimum: number; maximum: number } | undefined;\n // #504: the slowest preferred shutter (aperture priority; optional in program) and, with \"auto\", how it was derived.\n let autoIsoShutterPolicy: { slowestPreferredShutterSeconds: number; afterMaximumIso: SimulateCaptureAutoIsoAfterMaximum } | undefined;\n let automaticSlowestShutter: SimulateCaptureAutomaticSlowestShutterReport | undefined;\n // 2.14: the capabilities the exposure-mode resolvers see; with Auto ISO in whole stops, the ISO grid's whole stops only.\n let resolverCapabilities = capabilities, autoIsoIsoSteps: \"whole-stop\" | \"third-stop\" = \"whole-stop\";\n if (automaticIso) {\n if (capabilities.iso.autoIsoAvailability !== \"supported\")\n fail('exposure.iso \"auto\" needs a body with Auto ISO; this camera\\'s Auto ISO is ' + capabilities.iso.autoIsoAvailability + \".\");\n autoIsoOptions = allowKeys(exposureOptions.autoIso, \"exposure.autoIso\", [\"slowestPreferredShutterSeconds\", \"afterMaximumIso\", \"limits\", \"automaticSlowestShutter\", \"isoSteps\"]);\n // 2.14: Auto ISO steps in whole stops unless asked for thirds, so its choices are those of 2.13 on the third-stop bodies.\n if (autoIsoOptions.isoSteps !== undefined && autoIsoOptions.isoSteps !== \"whole-stop\" && autoIsoOptions.isoSteps !== \"third-stop\")\n fail('exposure.autoIso.isoSteps must be \"whole-stop\" or \"third-stop\".');\n if (autoIsoOptions.isoSteps === \"third-stop\") autoIsoIsoSteps = \"third-stop\";\n if (autoIsoIsoSteps === \"whole-stop\") resolverCapabilities = wholeStopIsoCapabilities(capabilities);\n if (mode !== \"aperture-priority\" && mode !== \"program\") for (const key of [\"slowestPreferredShutterSeconds\", \"afterMaximumIso\", \"automaticSlowestShutter\"])\n if (autoIsoOptions[key] !== undefined) fail(\"exposure.autoIso.\" + key + ' applies only to exposure.mode \"aperture-priority\" or \"program\"; omit it.');\n if (autoIsoOptions.limits !== undefined) autoIsoLimits = parseAutoIsoLimitsOption(autoIsoOptions.limits, resolverCapabilities.iso);\n assume(\"exposure.autoIso\", \"model\", { minimum: capabilities.iso.autoIsoMinimum ?? capabilities.iso.minimum, maximum: capabilities.iso.autoIsoMaximum ?? capabilities.iso.maximum,\n ...(autoIsoLimits ? { limits: { ...autoIsoLimits } } : {}), ...autoIsoBaseline },\n \"Auto ISO: the engine's exposure-mode resolver chooses the ISO from the meter target, starting from the lowest selectable ISO in the body's Auto ISO range and \" +\n \"snapping to the nearest selectable ISO in log2 (the lower on a tie), held at the range's ends. A generic policy, not a manufacturer's Auto ISO.\" +\n (autoIsoLimits ? \" The photographer's limits (exposure.autoIso.limits, #505) narrow that range to ISO \" + autoIsoLimits.minimum + \" to \" + autoIsoLimits.maximum + \".\" : \"\"));\n }\n if (automaticIso && mode === \"program\" && autoIsoOptions.slowestPreferredShutterSeconds === undefined) {\n for (const key of [\"afterMaximumIso\", \"automaticSlowestShutter\"]) if (autoIsoOptions[key] !== undefined)\n fail(\"exposure.autoIso.\" + key + ' in program needs exposure.autoIso.slowestPreferredShutterSeconds; omit it or set the slowest shutter.');\n }\n if (automaticIso && (mode === \"aperture-priority\" || (mode === \"program\" && autoIsoOptions.slowestPreferredShutterSeconds !== undefined))) {\n if (autoIsoOptions.slowestPreferredShutterSeconds === undefined)\n fail('exposure.autoIso.slowestPreferredShutterSeconds is required with exposure.mode \"aperture-priority\" and exposure.iso \"auto\": the slowest shutter, in seconds, before Auto ISO raises the ISO, or \"auto\".');\n if (autoIsoOptions.automaticSlowestShutter !== undefined && autoIsoOptions.slowestPreferredShutterSeconds !== \"auto\")\n fail('exposure.autoIso.automaticSlowestShutter applies only with exposure.autoIso.slowestPreferredShutterSeconds \"auto\"; omit it.');\n let slowestPreferredShutterSeconds: number;\n if (autoIsoOptions.slowestPreferredShutterSeconds === \"auto\") {\n automaticSlowestShutter = resolveAutomaticSlowestShutterOption(autoIsoOptions.automaticSlowestShutter, { focalLengthMm, focusDistanceM, pitch,\n shutter: capabilities.shutter, assume, pick });\n slowestPreferredShutterSeconds = automaticSlowestShutter.shutterSeconds;\n } else {\n if (typeof autoIsoOptions.slowestPreferredShutterSeconds === \"string\")\n fail('exposure.autoIso.slowestPreferredShutterSeconds must be a positive number of seconds or \"auto\".');\n slowestPreferredShutterSeconds = positive(autoIsoOptions.slowestPreferredShutterSeconds, \"exposure.autoIso.slowestPreferredShutterSeconds\");\n if (slowestPreferredShutterSeconds < capabilities.shutter.minimumSeconds || slowestPreferredShutterSeconds > capabilities.shutter.maximumSeconds)\n fail(\"exposure.autoIso.slowestPreferredShutterSeconds must be within the body's shutter range, \" + capabilities.shutter.minimumSeconds + \" s to \" + capabilities.shutter.maximumSeconds + \" s.\");\n }\n const afterMaximumIso = pick<unknown>(autoIsoOptions, \"afterMaximumIso\", \"exposure.autoIso.afterMaximumIso\", \"allow-slower-shutter\",\n \"At the Auto ISO maximum, the shutter may get slower than the slowest preferred shutter to reach the meter target.\");\n if (afterMaximumIso !== \"allow-slower-shutter\" && afterMaximumIso !== \"hold-preferred-shutter\")\n fail('exposure.autoIso.afterMaximumIso must be \"allow-slower-shutter\" or \"hold-preferred-shutter\".');\n autoIsoShutterPolicy = { slowestPreferredShutterSeconds, afterMaximumIso };\n if (mode === \"aperture-priority\") autoIsoAperturePriority = autoIsoShutterPolicy;\n }\n const limitsPolicy = autoIsoLimits ? { autoIsoLimits: { ...autoIsoLimits } } : {};\n if (mode === \"manual\") {\n resolution = resolveManualExposureMode({ target, capabilities: resolverCapabilities, referenceExposure: reference, manualAperture: fNumber, manualShutterSeconds: shutterSeconds,\n isoControl: automaticIso ? { kind: \"automatic\", quantizationPolicy: autoIsoBaseline.isoQuantizationPolicy, ...limitsPolicy } : { kind: \"manual\", iso } });\n } else if (autoIsoAperturePriority) {\n resolution = resolveAperturePriorityAutoIsoExposureMode({ target, capabilities: resolverCapabilities, referenceExposure: reference, manualAperture: fNumber,\n policy: { kind: \"minimum-iso-until-slowest-preferred-shutter\", ...autoIsoBaseline, shutterSelectionPolicy: \"not-longer-than-target\", ...autoIsoAperturePriority, ...limitsPolicy } });\n } else if (mode === \"aperture-priority\") {\n resolution = resolveAperturePriorityExposureMode({ target, capabilities: resolverCapabilities, referenceExposure: reference, manualAperture: fNumber, manualIso: iso,\n shutterQuantizationPolicy: \"nearest-log2-shorter-on-tie\" });\n } else if (mode === \"shutter-priority\") {\n resolution = resolveShutterPriorityExposureMode({ target, capabilities: resolverCapabilities, referenceExposure: reference, manualShutterSeconds: shutterSeconds,\n isoControl: automaticIso ? { kind: \"automatic\", policy: { kind: \"minimum-iso-aperture-first\", apertureSelectionPolicy: \"not-wider-than-target\", ...autoIsoBaseline, ...limitsPolicy } } :\n { kind: \"manual\", iso, apertureQuantizationPolicy: \"nearest-log2-narrower-on-tie\" } });\n } else {\n assume(\"exposure.programLine\", \"model\", \"facade-generic-program-line\", \"Engine-authored generic program line (f/16 1/2000 s … f/8 1/125 s … f/4 1.024 s); not a manufacturer program.\");\n resolution = resolveProgramAutoExposureMode({ target, capabilities: resolverCapabilities, referenceExposure: reference, programLine: defaultProgramLine(),\n isoControl: automaticIso ? { kind: \"automatic\", ...autoIsoBaseline, ...limitsPolicy, ...(autoIsoShutterPolicy ? { slowestPreferredShutter: { ...autoIsoShutterPolicy } } : {}) } :\n { kind: \"manual\", iso } });\n }\n if (resolution.status !== \"resolved\" || !resolution.resolvedSettings) fail(\"Exposure could not be resolved (\" + resolution.status + \"); the scene may have no signal.\");\n fNumber = resolution.resolvedSettings.aperture ?? fNumber;\n shutterSeconds = resolution.resolvedSettings.shutterSeconds ?? shutterSeconds;\n const resolvedIso = resolution.resolvedSettings.iso ?? iso;\n if (!Number.isFinite(resolvedIso) || resolvedIso <= 0) fail(\"Exposure could not be resolved: the resolved ISO is not a positive finite number.\");\n const isoReport = automaticIso ? { isoControl: \"automatic\" as const, autoIso: autoIsoReport(resolution, resolverCapabilities.iso, autoIsoShutterPolicy, autoIsoLimits, automaticSlowestShutter,\n autoIsoOptions.isoSteps === undefined ? undefined : autoIsoIsoSteps) } : { isoControl: \"manual\" as const };\n const exposureDeviationStops = standardExposureDeviationStops(fNumber, shutterSeconds, resolvedIso, meteredLuminance);\n const exposureIlluminanceLux = standardExposureIlluminanceLux(fNumber, shutterSeconds, resolvedIso, meteredLuminance, illuminanceLux,\n callerScene?.kind !== \"radiance-function\");\n const exposureGreyCardDeviationStops = callerScene?.kind === \"radiance-function\" ? null : greyCardDeviationStops(fNumber, shutterSeconds, resolvedIso, illuminanceLux);\n const defocusDisc = defocusModel === undefined ? undefined :\n resolveDefocusOption({ run, assume, focalLengthMm, fNumber, focusDistanceM, subjectDistanceM, pitch, diffraction: diffractionRadiusOption !== undefined });\n // #492: the capture applies the disc as an object-space convolution, which needs every disc point a site sees to be another site's scene point.\n if (defocusDisc) {\n const reason = rotating ? \"camera rotation (motion.angularVelocityRadPerSec)\" : lensFieldMapping ? \"lens.projection or lens.distortion\" : vignetting ? \"lens.vignetting\" : undefined;\n if (reason !== undefined) fail(\"simulateCapture does not support lens.defocus out of focus with \" + reason + \": the defocus disc is applied as an object-space convolution \" +\n \"on the site lattice, and \" + reason + \" moves the scene points the sites see off that lattice. Set lens.focusDistanceM equal to subjectDistanceM, or omit one of the two options.\");\n }\n // #492: the disc on the site lattice (radius 0 for a disc inside one cell: the identity, still applied).\n const defocusKernel = defocusDisc && !displayView ? createDefocusDiscSiteKernel(defocusDisc.diameterSites) ?? undefined : undefined;\n // The display view's disc (#492, step 2b): its expected-signal tables apply it (simulate-display-view.ts).\n const displayViewDefocus = displayView ? defocusDisc : undefined;\n\n // Sensor readout for the ISO setting. Standard output sensitivity S = 10/H (CIPA DC-004 §3.2) is defined at the\n // output, independent of pixel size, while the collected charge is proportional to the sensitive-aperture area\n // (EMVA 1288 Release 4.0, Eq. 3). The tier's signal chain is anchored to the 6 µm aperture; at another area the\n // charge-domain readout scales with the area so the same H gives the same code. At 6 µm nothing is changed.\n const areaScale = pitch * pitch / ISO_REFERENCE_APERTURE_AREA_SQUARE_MICROMETERS;\n const regimeByChannel = {} as Record<Channel, { readoutProfile: ReadoutProfile; regimeId: string }>;\n for (const channel of CHANNELS) {\n const asset = body.readout.find((a) => a.profile.channelId === channel) ?? fail(\"Camera readout lacks channel \" + channel + \".\");\n const chain = resolveGenericIsoSignalChain({ profile: body.signalChain, isoCapability: body.iso, requestedIsoSetting: { kind: \"standard\", exposureIndex: resolvedIso },\n captureModeId: IDS.mode, readoutProfile: asset.profile });\n regimeByChannel[channel] = { readoutProfile: areaScale === 1 ? asset.profile : isoAreaScaledReadout(asset.profile, areaScale), regimeId: chain.readout.regime.regimeId };\n }\n const capacityRegimes = (areaScale === 1 ? body.readout[0]!.profile : isoAreaScaledReadout(body.readout[0]!.profile, areaScale)).regimes;\n const baseRegime = capacityRegimes[0]! as unknown as { preAdcSaturationElectronEquivalent: { value: number } };\n const capacityElectrons = Math.max(...capacityRegimes.map((r) => (r as unknown as { preAdcSaturationElectronEquivalent: { value: number } }).preAdcSaturationElectronEquivalent.value),\n baseRegime.preAdcSaturationElectronEquivalent.value);\n assume(\"sensor.capacityElectrons\", \"derived\", capacityElectrons, \"Physical charge capacity set to the body's largest declared pre-ADC saturation (its base-ISO saturation signal), so storage never clips before the declared readout white.\");\n if (areaScale !== 1) {\n assume(\"sensor.isoAreaNormalization\", \"model\", { referenceApertureAreaSquareMicrometers: ISO_REFERENCE_APERTURE_AREA_SQUARE_MICROMETERS,\n apertureAreaSquareMicrometers: pitch * pitch, areaScale },\n \"Approximation. The tier's ISO signal chain is declared for a 6 µm square aperture. Standard output sensitivity S = 10/H (CIPA DC-004-2020 §3.2) is defined at the output, \" +\n \"independent of pixel size, and the collected charge is proportional to the aperture area (EMVA 1288 Release 4.0, Eq. 3), so the system conversion gain (e⁻ per code) and the \" +\n \"pre-ADC saturation of every ISO regime are multiplied by area / 36 µm² = \" + areaScale + \". The same exposure gives the same output code at any pitch; per-pixel shot-noise SNR \" +\n \"falls with smaller pixels. Read noise and dark current stay per pixel in electrons. The charge capacity follows the scaled base-ISO saturation, so it is proportional to \" +\n \"the aperture area: a design consequence of holding the tier's ISO rating and highlight headroom fixed, not a measured full-well model (published sensor data grow less than \" +\n \"proportionally with area across technologies).\");\n }\n // Whole-frame views (2.5): a pitch above 100 µm is larger than any camera photosite, so the capture is a downsized view of a frame width × pitch wide.\n if (pitch > SIMULATE_CAPTURE_PHOTOSITE_PITCH_MAXIMUM_MICROMETERS) {\n assume(\"sensor.wholeFrameView\", \"model\", { pixelPitchMicrometers: pitch, frameWidthMm: width * pitch / 1000, frameHeightMm: height * pitch / 1000 },\n \"A pixel pitch above 100 µm is larger than any camera photosite, so each output pixel stands for a \" + pitch + \" µm square of a \" + width * pitch / 1000 + \" × \" + height * pitch / 1000 +\n \" mm frame: a downsized view of the whole frame, with the framing, crop factor, generic prime and minimum focus of that frame. Its signal is the charge of the whole square \" +\n \"(sensor.isoAreaNormalization), so its shot noise is that of all the real photosites in the square summed or averaged (Poisson counts add), and the image brightness is the \" +\n \"same as at any other pitch. Read noise and dark current are applied once per output pixel, not once per real photosite, so in deep shadows the noise is lower than a real \" +\n \"sensor's binned output. This is the noise of a binned, downsized view, not the real sensor's per-pixel noise. A point pixel aperture samples one point of each square; \" +\n \"use sensor.pixelAperture box (or sensor.antiAliasing) to average scene detail finer than the pitch.\");\n }\n assume(\"sensor.darkCurrent\", \"model\", { electronsPerSecond: DARK_CURRENT_ELECTRONS_PER_SECOND, temperatureC: OPERATING_TEMPERATURE_C },\n \"Synthetic uniform dark current of 1 e⁻/s per site at 20 °C (the tier presets declare none); dark shot noise follows from it.\");\n assume(\"sensor.spectralResponse\", \"model\", { kind: \"colorimetric-cmf-eqe\", peakScale: EQE_SCALE },\n \"Idealized colorimetric sensor: channel EQE = a·{x̄, ȳ, z̄}(λ)·555/λ (the engine's analytic CIE 1931 fit), so RAW channels are proportional to CIE XYZ (Luther–Ives) and the camera matrix is diagonal. Not a real camera's response; CMF air wavelengths are used as vacuum wavelengths (difference about 0.03 %).\");\n if (boxAperture) {\n assume(\"sensor.pixelAperture\", \"model\", { kind: \"box\", samplesPerAxis: boxSamples, fillFactor: 1 },\n \"Each site integrates the irradiance uniformly over its square photosite (fill factor 1; the environment's uniform geometric-aperture response) with a \" + boxSamples + \" × \" + boxSamples +\n \" midpoint rule (spatialSampleCountX/Y). The ideal box aperture of width p has the pixel MTF |sinc(f·p)| = |sin(πfp)/(πfp)|; the midpoint rule gives |sin(πfp)/(N·sin(πfp/N))| \" +\n \"instead, within 3 % of it below the Nyquist frequency 1/(2p) for N ≥ 4, with the same zeros at multiples of 1/p except at multiples of N/p, where scene detail still aliases. \" +\n \"No microlens, carrier diffusion or crosstalk. The scene queries are multiplied by \" + boxSamples * boxSamples + \".\");\n }\n if (!antiAliasing) assume(\"sensor.fillFactor\", \"model\", 1, \"Square sensitive aperture equal to the pixel pitch; no microlens or anti-aliasing filter.\");\n else {\n assume(\"sensor.fillFactor\", \"model\", 1, \"Square sensitive aperture equal to the pixel pitch; no microlens.\");\n assume(\"sensor.antiAliasing\", \"model\", { kind: antiAliasing.kind, ...(antiAliasing.axis ? { axis: antiAliasing.axis } : {}),\n ...(antiAliasing.separationSites === undefined ? {} : { separationSites: antiAliasing.separationSites, separationMicrometers: antiAliasing.separationSites * pitch }),\n components: antiAliasing.components },\n \"Optical low-pass (anti-aliasing) filter as a normalized point-splitting kernel in the sensor optical stack (resolveAntiAliasingSpatialKernel): every site integrates the light that would \" +\n \"otherwise land at its centre minus each offset, weighted. \" + (antiAliasing.kind === \"point-splitting\" ? \"Caller-declared components. \" :\n \"This is the ideal birefringent \" + (antiAliasing.kind === \"four-spot\" ? \"two-plate (crossed) splitter: four equal spots at (±d/2, ±d/2), MTF |cos(π·f_x·d)·cos(π·f_y·d)|\" :\n \"single-plate splitter: two equal spots at ±d/2 along the \" + antiAliasing.axis + \" axis, MTF |cos(π·f·d)|\") + \", d = \" + antiAliasing.separationSites + \" site(s); first zero at f = 1/(2d). \") +\n \"Approximations: the split is the same at every wavelength, field point and polarization (birefringence dispersion and the thickness-dependent displacement are not modelled), the spots are exact points with equal weights for unpolarized light, \" +\n \"and the filter's transmission, reflections and focus shift are not modelled. Not a measured filter; the tier presets declare none. The scene queries are multiplied by \" + antiAliasing.components.length + \".\");\n }\n // Shutter (2.0): the electronic rolling-shutter schedule derived from the body's rolling readout declaration.\n let rollingSchedule: ElectronicRollingShutterExposureSchedule | undefined;\n if (shutterKind === \"rolling\") {\n const declared = (body as { rollingReadoutTiming?: { profile: unknown } }).rollingReadoutTiming?.profile as Parameters<typeof resolveElectronicRollingShutterExposureSchedule>[0][\"readout\"] | undefined;\n if (!declared || declared.readoutMode !== \"rolling\") fail(\"motion.shutter \\\"rolling\\\" needs a camera body with a rolling readout timing declaration.\");\n const readout = rollingSkewOption === undefined ? declared : { ...declared, spatialSamplingSkewSeconds: { value: rollingSkewOption, unit: \"s\" as const, evidence: FACADE_EVIDENCE } };\n rollingSchedule = resolveElectronicRollingShutterExposureSchedule({ readout, linkageEvidence: FACADE_EVIDENCE,\n nominalExposureDurationSeconds: { value: shutterSeconds, unit: \"s\", evidence: FACADE_EVIDENCE } });\n assume(\"sensor.shutter\", \"model\", { kind: \"electronic-rolling\", modelId: rollingSchedule.modelId, modelVersion: rollingSchedule.modelVersion,\n lineScanSkewSeconds: rollingSchedule.lineScanSkewSeconds, scanDirection: readout.scanDirectionNative.value },\n \"Electronic rolling shutter (line reset/read linkage): a site at normalized scan position s integrates over [s·τ, s·τ + T]. \" +\n (rollingSkewOption === undefined ? \"τ is the body's declared full-frame data-readout skew, applied unchanged across the simulated frame (it is not scaled to the cropped sensor), so a small frame shows the skew of a full-sensor readout.\" :\n \"τ is the caller-declared skew across the simulated frame.\"));\n } else assume(\"sensor.shutter\", \"model\", \"global-electronic\", \"Global electronic shutter: every site integrates the same exposure window.\");\n if (rotating) assume(\"motion.angularVelocityRadPerSec\", \"model\", { ...angular },\n \"Constant camera angular velocity applied to every scene ray at each temporal midpoint of each site's exposure window (engine rotation convention, docs/SENSOR_ENVIRONMENT_QUERY.md); motion blur is the midpoint quadrature over sensor.temporalSampleCount samples.\");\n if (lensPsf) assume(\"lens.psf\", \"model\", { kind: \"sampled-local\" }, \"Caller-supplied sampled lens PSF redistributes irradiance through the environment PSF quadrature; its evidence and limits are the caller's.\");\n // With lens.diffraction the PSF is recorded as lens.diffraction once its kernels are built.\n else if (diffractionRadiusOption === undefined) assume(\"lens.psf\", \"model\", \"not-applied\", \"No lens PSF or diffraction blur is applied (point optics); the generic tiers' optical data are declared only at f/4.\");\n assume(\"lens.transmission\", \"model\", lens.matchedReference.transmission,\n \"The tier lens's spectrally flat transmission is used at every f-number and focus in the lens capability; the tier declares it only at its f/4, 5 m reference state.\");\n if (!vignetting && !lensFieldMapping) assume(\"lens.fieldThroughput\", \"model\", \"unity\", \"No vignetting, distortion, lateral colour or stray light.\");\n else {\n if (vignetting) assume(\"lens.vignetting\", \"model\", { kind: \"radial-illumination-vignetting\", profile: vignetting },\n \"Caller-declared radial relative illumination 1 + r2·ρ² + r4·ρ⁴ + r6·ρ⁶, applied once as environment field throughput at the physical sensor point before any PSF.\");\n else assume(\"lens.fieldThroughput\", \"model\", \"unity\", \"No vignetting, lateral colour or stray light.\");\n if (distortion) assume(\"lens.distortion\", \"model\", distortion,\n \"Caller-declared \" + distortion.kind + \" distortion: each sensor point is inverse-distorted before the scene-ray query and irradiance is multiplied exactly once by the area factor 1/det(J).\");\n }\n if (projection === undefined) assume(\"lens.projection\", \"default\", \"rectilinear\", \"Ideal rectilinear (pinhole) projection.\");\n else assume(\"lens.projection\", \"model\", projection, \"Ideal \" + projection + \" projection through the environment lens field mapping. At finite focus its scale is the thin-lens image distance (an approximation); the chart is still sized with the rectilinear thin-lens scale, so its edges move with the projection.\");\n\n // White balance\n let whiteBalanceState: ResolvedWhiteBalanceState | null = null, needsAuto = false, kelvinWhiteBalanceInput: Parameters<typeof resolveColorTemperatureWhiteBalance>[0] | undefined;\n if (whiteBalanceOption === \"none\") whiteBalanceState = null;\n else if (whiteBalanceOption === \"auto\") {\n if (region) fail(\"output.region cannot be combined with output.whiteBalance \\\"auto\\\": grey-world statistics of a region differ from the whole frame's.\");\n needsAuto = true;\n }\n else if (whiteBalanceOption === \"scene-illuminant\") whiteBalanceState = sceneIlluminantWhiteBalance(illuminant);\n else if (typeof whiteBalanceOption === \"object\" && whiteBalanceOption !== null && \"kelvin\" in whiteBalanceOption) {\n const wb = allowKeys(whiteBalanceOption, \"output.whiteBalance\", [\"kelvin\", \"tint\"]);\n const intent = createColorTemperatureWhiteBalanceIntent({ intentId: \"facade-wb-cct\", colorTemperatureKelvin: positive(wb.kelvin, \"output.whiteBalance.kelvin\"),\n tint: wb.tint === undefined ? 0 : wb.tint as number });\n const kelvinInput: Parameters<typeof resolveColorTemperatureWhiteBalance>[0] = { stateId: \"facade-wb-cct\", intent, whiteLocus: \"planckian\", tintInterpretation: \"duv-cie-1960-uv\",\n camera: { profileId: IDS.spectral, profileVersion: SIMULATE_CAPTURE_FACADE_VERSION, xyzToCameraRgb: XYZ_TO_CAMERA.map((r) => [...r]) as unknown as Parameters<typeof resolveColorTemperatureWhiteBalance>[0][\"camera\"][\"xyzToCameraRgb\"] } };\n whiteBalanceState = resolveColorTemperatureWhiteBalance(kelvinInput);\n kelvinWhiteBalanceInput = kelvinInput;\n } else if (typeof whiteBalanceOption === \"object\" && whiteBalanceOption !== null && \"channelGains\" in whiteBalanceOption) {\n allowKeys(whiteBalanceOption, \"output.whiteBalance\", [\"channelGains\"]);\n requireInputObject(whiteBalanceOption.channelGains, \"output.whiteBalance.channelGains\");\n allowKeys(whiteBalanceOption.channelGains, \"output.whiteBalance.channelGains\", [\"red\", \"green\", \"blue\"]);\n whiteBalanceState = resolveManualWhiteBalance({ stateId: \"facade-wb-manual\", channelGains: whiteBalanceOption.channelGains });\n } else fail(\"Unknown output.whiteBalance.\");\n const intentOf = (state: ResolvedWhiteBalanceState | null): CaptureWhiteBalanceIntent | null => (state ? createCaptureWhiteBalanceIntent({ state }) : null);\n\n const rendering: SdrRenderingProfile = { schemaVersion: \"0.1.0\", profileId: \"facade-sdr\", profileVersion: \"1\", renderingExposureEv: 0, toneCurve,\n ...(outputOptions.toneCurveParameters === undefined ? {} : { toneCurveParameters: outputOptions.toneCurveParameters as SdrToneCurveParameters }),\n gamutHandling: \"clip-components\", outputDynamicRange: \"sdr\", transferFunction: \"srgb\", bitDepth: format === \"srgb-16\" || (format === \"png\" && !wideGamut && pngBitDepth === 16) ? 16 : 8, rounding: \"nearest-ties-up\", dither: \"none\" };\n if (!linearPath) assume(\"output.rendering\", \"model\", { renderingExposureEv: 0, gamutHandling: \"clip-components\" },\n \"Developed linear sRGB/D65 with the RAW white level mapped to display white, no exposure push, out-of-gamut components clipped.\");\n else assume(\"output.rendering\", \"model\", { renderingExposureEv: 0, gamutHandling: \"clip-components-in-target-gamut\", sdrRendererUsed: false },\n \"The sRGB SDR renderer is not used: the linear development (RAW white level = relative 1.0, no exposure push) is converted to the target encoding; request.development.rendering is validated but only its exposure and tone curve (identity) apply.\");\n // Rendering choices are validated before any radiance work, so a bad tone curve fails fast.\n parseSdrRenderingProfile(rendering);\n if (highlightMode !== \"clip\" && highlightMode !== \"reconstruct\") fail(\"output.highlightMode must be clip or reconstruct.\");\n\n // Frame profiles\n const evidence = FACADE_EVIDENCE;\n const nativeRaster = { pixelWidth: nativeWidth, pixelHeight: nativeHeight };\n const captureModeProfile = { schemaVersion: \"0.1.0\" as const, modes: [{ modeId: IDS.mode, evidence, acquisition: { kind: \"single-frame\" as const },\n perFrameSampling: { kind: \"native-effective-raster\" as const }, reconstructionStages: [], processedImageRaster: { value: nativeRaster, evidence },\n dependencies: [\"color-sampling-model\"] }] } as unknown as NativeRawInput[\"captureModeProfile\"];\n const bindingProfile = { schemaVersion: \"0.1.0\" as const, bindingId: IDS.binding, colorSamplingProfileId: IDS.cfa, nativeRaster, evidence,\n relationship: { kind: \"regular-native-effective-sample-blocks\" as const, sitesPerNativeSampleX: 1, sitesPerNativeSampleY: 1, anchor: \"shared-native-top-left\" as const } };\n const exposureWindow = rollingSchedule ? createRollingShutterCaptureExposureSchedule(rollingSchedule) as unknown as {\n shutterMechanism: \"electronic\"; nominalExposureDurationSeconds: { value: number; unit: \"s\"; evidence: readonly EvidenceProvenance[] };\n opening: { kind: \"simultaneous\" }; closing: { kind: \"simultaneous\" } } :\n { shutterMechanism: \"electronic\" as const, nominalExposureDurationSeconds: { value: shutterSeconds, unit: \"s\" as const, evidence },\n opening: { kind: \"simultaneous\" as const }, closing: { kind: \"simultaneous\" as const } };\n const buildRawInput = (intent: CaptureWhiteBalanceIntent | null): NativeRawInput => buildRawInputFor(intent, geometry, captureModeProfile, bindingProfile, nativeWidth * nativeHeight);\n const buildRawInputFor = (intent: CaptureWhiteBalanceIntent | null, rasterGeometry: typeof geometry, modeProfile: NativeRawInput[\"captureModeProfile\"],\n binding: NativeRawInput[\"bindingProfile\"], sites: number): NativeRawInput => ({\n exposure: { captureId: IDS.capture, sceneStateId: IDS.sceneState, sceneTimeSeconds: 0, geometry: rasterGeometry,\n exposure: { focalLengthMm, aperture: fNumber, shutterSeconds, iso: resolvedIso }, focus: { kind: \"finite\", distanceM: focusDistanceM },\n noise: { seedUint32: noiseSeed, realizationId: \"facade-noise\", model: { ...SENSOR_RAW_PRODUCER_NOISE_MODEL } },\n source: { kind: \"scene-radiance-source\", artifactId: \"facade-scene-\" + scenePreset, sha256: sourceSha256, dynamicRangeHistory: \"no-loss-declared\" },\n whiteBalanceIntent: intent, adoptedWhiteXyz: null,\n models: [{ profile: { id: \"photivra-simulate-capture\", version: SIMULATE_CAPTURE_FACADE_VERSION }, scientificStatus: \"approximation\", publicEvidenceIds: [\"photivra:simulate-capture-facade\"] }] },\n frameId: IDS.frame, modeId: IDS.mode, captureModeProfile: modeProfile, colorSamplingProfile, bindingProfile: binding, exposureWindow,\n maximumOutputBytes: sites * 7, tileWidth, ...(raisedPixels === undefined ? {} : { maximumPixels: raisedPixels }) });\n const sceneBinding = { sceneStateId: IDS.sceneState, providerSceneId: IDS.scene, evidence };\n\n // Shared per-site environment pieces (identical objects for every site keep the native task's shared-state fast path).\n const range = { ...FACADE_SPECTRAL_RANGE_NANOMETERS };\n // EQE breakpoints coincide with the quadrature subintervals, so the quadrature is not split further.\n const eqeSpacing = (range.maximum - range.minimum) / Math.ceil((range.maximum - range.minimum) / spectralStep);\n const eqeSamples = (channel: Channel): { nm: number; value: number }[] => {\n const out: { nm: number; value: number }[] = [];\n for (let nm = range.minimum; nm <= range.maximum + 1e-9; nm += eqeSpacing) out.push({ nm, value: EQE_SCALE[channel] * estimateCie1931ColorMatchingFunctions(nm)[CMF_KEY[channel]] * 555 / nm });\n return out;\n };\n const operatingConditions = { temperatureC: 25, incidenceAngleDegreesFromNormal: 0, polarization: \"unpolarized\" as const };\n // One single-channel response profile per CFA channel keeps each site's response data small.\n const spectralResponseProfiles = Object.fromEntries(CHANNELS.map((only) => [only, { schemaVersion: \"0.1.0\" as const, profileId: IDS.spectral, colorSamplingProfileId: IDS.cfa, evidence,\n channels: [only].map((channelId) => ({ channelId, kind: \"effective-external-quantum-efficiency\" as const, responseScope: \"sensor-package-incident-effective-channel-response\" as const,\n scientificStatus: \"approximation\" as const, uncertainty: { kind: \"not-quantified\" as const, limitation: \"Idealized colorimetric response; not a measured sensor.\" },\n evidence, referenceConditions: operatingConditions, conditionDependence: \"not-modeled\" as const, externalQuantumEfficiency: sampled(eqeSamples(channelId)) })) }])) as Record<Channel, unknown>;\n const apertureArea = pitch * pitch;\n const samplingApertureProfile = { schemaVersion: \"0.1.0\" as const, profileId: IDS.sampling, colorSamplingProfileId: IDS.cfa, colorSamplingBindingId: IDS.binding, evidence,\n siteCenterLattice: { kind: \"regular-rectangular-site-center-lattice\" as const, coordinateSystem: \"native-sensor-physical\" as const, pitchXMicrometers: pitch, pitchYMicrometers: pitch,\n firstSiteCenterFromImagingAreaTopLeftMicrometers: { x: pitch / 2, y: pitch / 2 }, evidence },\n geometricSensitiveAperture: { kind: \"uniform-axis-aligned-rectangle\" as const, widthMicrometers: pitch, heightMicrometers: pitch, centerOffsetFromSiteCenterMicrometers: { x: 0, y: 0 }, evidence } };\n const stackId = antiAliasing ? IDS.stackAa : IDS.stack;\n const opticalStackProfile: SensorOpticalStackProfile = antiAliasing ? { schemaVersion: \"0.1.0\", profileId: stackId, evidence, effectiveAntiAliasingSpatialResponse: {\n kind: \"normalized-point-splitting-kernel\", evidence, coordinateSystem: \"native-sensor-physical\", scope: \"field-wavelength-polarization-invariant-approximation\",\n components: antiAliasing.components } } : { schemaVersion: \"0.1.0\" as const, profileId: IDS.stack, evidence, effectiveAntiAliasingSpatialResponse: { kind: \"absent\" as const, evidence } };\n const perChannel = Object.fromEntries(CHANNELS.map((channelId) => [channelId, {\n applicationProfile: { schemaVersion: \"0.1.0\" as const, profileId: \"facade-application-\" + channelId, spectralResponseProfileId: IDS.spectral, colorSamplingProfileId: IDS.cfa, channelId,\n samplingApertureProfileId: IDS.sampling, opticalStackProfileId: stackId, evidence, incidentAreaBasis: { kind: \"geometric-sensitive-aperture\" as const, areaSquareMicrometers: apertureArea },\n spatialResponseModel: { kind: \"uniform-over-geometric-sensitive-aperture\" as const, scientificStatus: \"approximation\" as const, evidence, limitation: \"Uniform response over the square aperture.\" },\n referenceConditionPolicy: { kind: \"exact-match-required\" as const } },\n operatingRangeProfile: { schemaVersion: \"0.1.0\" as const, profileId: \"facade-linearity-\" + channelId, responseApplicationProfileId: \"facade-application-\" + channelId,\n spectralResponseProfileId: IDS.spectral, colorSamplingProfileId: IDS.cfa, channelId, scientificStatus: \"approximation\" as const,\n uncertainty: { kind: \"not-quantified\" as const, limitation: \"Declared linear photo response for the idealized sensor.\" }, evidence,\n inputRange: { kind: \"wavelength-integrated-geometric-aperture-radiant-power\" as const, unit: \"W\" as const, minimumInclusive: 0, maximumInclusive: 1 },\n wavelengthApplicability: { wavelengthBasis: \"vacuum\" as const, minimumNanometers: range.minimum, maximumNanometers: range.maximum, containment: \"requested-range-must-be-contained\" as const },\n linearityCriterion: { maximumAbsoluteRelativeDeviation: 0.01 },\n spatialLinearityModel: { kind: \"linear-superposition-over-geometric-aperture\" as const, scientificStatus: \"approximation\" as const, evidence, limitation: \"Declared linear superposition.\" },\n spectralInputModel: { kind: \"per-spectral-bin\" as const, maximumBinWidthNanometers: Math.max(spectralStep, 20), scientificStatus: \"approximation\" as const, evidence, limitation: \"Declared per-bin linearity.\" },\n referenceConditions: operatingConditions, referenceConditionPolicy: { kind: \"exact-match-required\" as const } } }])) as Record<Channel, { applicationProfile: unknown; operatingRangeProfile: unknown }>;\n const sourcePlane = { value: \"sensor-package-incident\" as const, evidence };\n const localExposure = { bindingProfile, exposureWindowInput: { ...exposureWindow, nativeRaster } };\n const sceneBindings = {\n illuminationProfile: { schemaVersion: \"0.1.0\" as const, profileId: IDS.lights, sceneId: IDS.scene, evidence, sources: [{ sourceId: \"illuminant\", family: \"environment\" as const,\n enabled: true, geometry: { kind: \"environment\" as const }, magnitude: { kind: \"relative-linear-scale\" as const, scale: 1, scientificStatus: \"approximation\" as const,\n limitation: \"Absolute level is carried by the provider radiance (\" + illuminanceLux + \" lux).\" },\n spectrum: { kind: \"unresolved\" as const, limitation: \"Spectral radiance is supplied numerically by the provider (\" + illuminant.id + \").\" },\n temporalBehavior: { kind: \"time-invariant\" as const }, evidence }] },\n materialResponseProfile: { schemaVersion: \"0.1.0\" as const, profileId: IDS.materials, sceneId: IDS.scene, evidence, materials: [{ materialResponseId: \"facade-surface\", evidence,\n representation: { kind: \"spectral-wavelength-preserving-data\" as const, dataArtifact: { id: \"facade-scene-\" + scenePreset, checksumSha256: sourceSha256 },\n wavelengthBasis: \"vacuum\" as const, wavelengthRangeNanometers: range, scatteringModel: \"provider-defined-wavelength-preserving\" as const, scientificStatus: \"approximation\" as const,\n uncertainty: { kind: \"not-quantified\" as const, limitation: \"Analytic Lambertian reflectance.\" }, wavelengthChangingBehaviorModeled: false, emissionModeled: false } }],\n fluorescenceModeled: false, volumetricMaterialTransportModeled: false, polarizationModeled: false },\n providerProfile: { schemaVersion: \"0.1.0\" as const, profileId: IDS.provider, sceneId: IDS.scene, illuminationProfileId: IDS.lights, materialResponseProfileId: IDS.materials,\n outputQuantity: \"outgoing-spectral-radiance\" as const, outputUnit: \"W/m^2/sr/nm\" as const, scientificStatus: \"approximation\" as const,\n uncertainty: { kind: \"not-quantified\" as const, limitation: \"Analytic planar scene.\" },\n fidelity: { spectral: \"wavelength-resolved\" as const, material: \"spectral-data\" as const, visibility: \"resolved\" as const, directTransport: \"approximation\" as const, indirectTransport: \"not-modeled\" as const },\n wavelengthChangingTransportModeled: false, volumetricTransportModeled: false, polarizationModeled: false, evidence, limitations: [\"Engine-authored planar chart or caller scene function.\",\n ...(diffractionObjectSpace ? [\"Radiance is the scene radiance convolved with the lens diffraction PSF mapped onto the scene plane (object-space convolution, request.diffraction).\"] : []),\n ...(defocusKernel ? [\"Radiance is the scene radiance convolved with the geometric defocus disc mapped onto the scene plane (object-space convolution, lens.defocus).\"] : [])] } };\n const lensId = lensExposure.profileId;\n const opticsProfile = { schemaVersion: \"0.1.0\" as const, profileId: lensId + \":facade-transmission\", profileVersion: SIMULATE_CAPTURE_FACADE_VERSION, lensProfileId: lensId,\n scientificStatus: \"approximation\" as const, applicability: { focalLengthMm: { minimum: capabilities.selectedFocalLengthMm, maximum: capabilities.selectedFocalLengthMm },\n nominalFNumber: { minimum: capabilities.aperture.widestAvailableFNumber, maximum: capabilities.aperture.narrowestAvailableFNumber }, focus: { kind: \"any\" as const } },\n transmission: { kind: \"spectral-transmission\" as const, scientificStatus: \"approximation\" as const, wavelengthBasis: \"vacuum\" as const,\n samples: { value: [{ wavelengthNanometers: range.minimum, linearTransmissionFactor: lens.matchedReference.transmission },\n { wavelengthNanometers: range.maximum, linearTransmissionFactor: lens.matchedReference.transmission }], evidence: preset.evidence },\n uncertainty: { kind: \"not-quantified\" as const, limitation: \"Synthetic spectrally flat transmission from the tier preset.\" } },\n distortionAreaMappingOwnership: \"not-applied-by-bridge\" as const, psfRedistributionOwnership: \"downstream-normalized-energy-redistribution\" as const,\n sensorOpticalStackIncluded: false, strayLightIncluded: false, polarizationModeled: false, wavelengthChangingBehaviorModeled: false, volumetricScatteringModeled: false,\n evidence: preset.evidence, limitations: [...lens.limitations, \"Flat transmission applied across the lens capability by the capture facade.\"] };\n const optics = { profile: opticsProfile, focalLengthMm, nominalFNumber: fNumber,\n focus: { kind: \"ideal-symmetric-thin-lens\" as const, objectDistanceM: focusDistanceM, pupilMagnificationAssumption: \"unity\" as const } };\n const motion = { angularVelocityRadPerSec: angular, timeReference: \"first-opening-boundary-phase\" as const, environmentDirectionConvention: \"outgoing-radiance-toward-camera\" as const };\n const fieldThroughput = vignetting ? { kind: \"radial-illumination-vignetting\" as const, profile: vignetting, evidence,\n limitation: \"Caller-declared radial relative illumination applied by the capture facade; not a measured lens.\" } :\n { kind: \"unity\" as const, evidence, limitation: \"No vignetting or field throughput loss applied by the facade.\" };\n const spectralSamplingByChannel = Object.fromEntries(CHANNELS.map((channelId) => [channelId, { channelId, wavelengthBasis: \"vacuum\" as const, wavelengthRangeNanometers: range,\n maximumSubintervalWidthNanometers: spectralStep }])) as Record<Channel, unknown>;\n // Diffraction (2.1): Airy kernels at the resolved f-number on the site pitch, one per spectral node of the sensor quadrature.\n let diffraction: DiffractionLimitedPsfProfile | undefined, diffractionPsf: typeof lensPsf | undefined;\n // The spectral nodes of the sensor quadrature, over all channels, ascending.\n const quadratureWavelengths = (): number[] => [...new Set(CHANNELS.flatMap((channelId) => calculateSensorSpectralQuadrature({ ...(spectralSamplingByChannel[channelId] as { channelId: string;\n wavelengthBasis: \"vacuum\"; wavelengthRangeNanometers: { minimum: number; maximum: number }; maximumSubintervalWidthNanometers: number }), colorSamplingProfile,\n spectralResponseProfile: spectralResponseProfiles[channelId] as never }).value.nodes.map((node) => node.wavelengthNanometers)))].sort((a, b) => a - b);\n if (diffractionRadiusOption !== undefined) {\n const wavelengths = quadratureWavelengths();\n const lambdaN = wavelengths[wavelengths.length - 1]! / 1000 * fNumber * imageDistanceMm / focalLengthMm;\n // The environment resolves the PSF at each pre-filter source point, up to the largest split offset outside the imaging area.\n const aaReachMm = antiAliasing ? Math.max(...antiAliasing.components.map((c) => Math.max(Math.abs(c.offsetMicrometers.x), Math.abs(c.offsetMicrometers.y)))) / 1000 : 0;\n // The default reach is capped at the 32-site convolution limit; a capped window ends inside the third dark ring, and the\n // larger tail energy outside it is listed per wavelength like any other (2.2.1 states the cap in the explanation).\n const thirdRingSites = Math.max(1, Math.ceil(AIRY_THIRD_ZERO_PER_LAMBDA_N * lambdaN / pitch));\n const kernelRadiusSamples = diffractionRadiusOption ?? Math.min(32, thirdRingSites);\n const profileInput = { aperture: \"circular\" as const, focalLengthMm, apertureFNumber: fNumber, focus: { kind: \"finite\" as const, distanceM: focusDistanceM },\n wavelengthsNm: wavelengths, samplePitchMicrometers: pitch, kernelRadiusSamples, fieldHalfExtentMm: aaReachMm === 0 ? { x: imagingArea.widthMm / 2, y: imagingArea.heightMm / 2 } :\n { x: imagingArea.widthMm / 2 + aaReachMm, y: imagingArea.heightMm / 2 + aaReachMm },\n profileId: \"facade-diffraction-airy\" };\n // #449: a copy of the profile kept for this input; it equals createDiffractionLimitedPsfProfile(profileInput).value field by\n // field, so the registration below (keyed by profileInput) holds for it.\n diffraction = cachedDiffractionProfile(profileInput);\n diffractionPsf = { kind: \"sampled-local\", configuration: { psf: { profile: diffraction.profile, focalLengthMm, focus: { kind: \"finite\", distanceM: focusDistanceM },\n apertureFNumber: fNumber, signedDefocusImagePlaneMicrometers: 0 }, psfWavelengthBasis: { value: \"vacuum\", evidence },\n spatialModel: { kind: \"destination-local-shift-invariant-approximation\", evidence, limitation: \"Diffraction-limited Airy PSF, the same at every field point.\" } } };\n // Requests with the same profile input and PSF fields share their site diffraction kernels (optics/site-diffraction-kernel.ts).\n registerDiffractionPsfKey(diffractionPsf.configuration.psf, profileInput);\n assume(\"lens.diffraction\", \"model\", { model: diffraction.model, aperture: \"circular-aperture\", fNumber, workingFNumber: diffraction.workingFNumber,\n kernelRadiusSamples, samplePitchMicrometers: pitch, maximumTruncatedEnergyFraction: diffraction.maximumTruncatedEnergyFraction,\n truncatedEnergyByWavelength: diffraction.wavelengths.map((w) => ({ wavelengthNm: w.wavelengthNm, truncatedEnergyFraction: w.truncatedEnergyFraction })),\n execution: diffractionObjectSpace ? \"object-space-convolution\" : \"environment-psf-quadrature\" },\n \"Scalar Fraunhofer diffraction of an ideal, aberration-free circular pupil (Airy pattern, createDiffractionLimitedPsfProfile) at the resolved f-number, in focus, with D = f/N and the thin-lens image distance (working f-number N·v/f). \" +\n \"One kernel per spectral node, binned into site-sized cells over a \" + (2 * kernelRadiusSamples + 1) + \" × \" + (2 * kernelRadiusSamples + 1) + \" window\" +\n (diffractionRadiusOption !== null ? \"\" : thirdRingSites > 32 ? \" (capped at 32 sites; the third dark ring at the longest node needs \" + thirdRingSites + \")\" :\n \" (reaching the third dark ring at the longest node)\") + \"; the Airy tail energy outside it (listed per wavelength) is put back by unit-sum renormalization. \" +\n (diffractionObjectSpace ? \"Applied as an object-space convolution: the scene radiance on the site lattice is convolved once per spectral node (calculateIrradianceConvolution) and the provider answers each site query with it, so the site inputs declare no PSF; this equals the per-tap environment PSF quadrature for this still, distortion-free planar scene (request.diffraction.psf). \" :\n \"Applied through the environment PSF quadrature (one scene query per kernel tap), because camera rotation, a lens field mapping or vignetting moves the taps off the site lattice. \") +\n \"No defocus, aberration or pupil clipping; \" + (boxAperture ? \"the pixel aperture is integrated as declared by sensor.pixelAperture.\" : \"the sensor pixel aperture is still point-sampled at the site centre.\"));\n }\n // #492: each spectral node's kernel for lens.defocus out of focus: the disc, or with lens.diffraction (always on the object-space path here)\n // the node's diffraction kernel convolved with the disc, radius R_diffraction + R_defocus (built on first use, kept for the request).\n let defocusSiteKernels: { radius: number; wavelengthsNm: readonly number[]; at(wavelengthNm: number): Float64Array } | undefined;\n if (defocusKernel) {\n if (diffraction) {\n const diffractionRadius = diffraction.kernelRadiusSamples, combined = new Map<number, Float64Array>(), profileWavelengths = diffraction.profile.axes.wavelengthNm;\n const radius = diffractionRadius + defocusKernel.radius;\n // At most 32 + 64 = 96 sites (the two caps). Neither the expected-signal table nor the provider's own gather (diffraction-provider.ts)\n // uses the public 32-site limit of calculateIrradianceConvolution; the combination costs at most about 0.1 s per spectral node\n // (measured, docs/QUICK_START.md \"Optics\"), so no tighter limit applies.\n const psfConfiguration = diffractionPsf!.configuration.psf;\n defocusSiteKernels = { radius, wavelengthsNm: profileWavelengths, at(wavelengthNm: number): Float64Array {\n let kernel = combined.get(wavelengthNm);\n if (!kernel) {\n if (!profileWavelengths.includes(wavelengthNm)) fail(\"simulateCapture: a spectral node has no diffraction kernel.\");\n kernel = convolveSiteKernels(siteDiffractionKernel(psfConfiguration, wavelengthNm, pitch, diffractionRadius, \"simulateCapture: diffraction kernels must sample the site pitch exactly.\"),\n diffractionRadius, defocusKernel.weights, defocusKernel.radius);\n combined.set(wavelengthNm, kernel);\n }\n return kernel;\n } };\n } else defocusSiteKernels = { radius: defocusKernel.radius, wavelengthsNm: quadratureWavelengths(), at: (): Float64Array => defocusKernel.weights };\n }\n const psf = lensPsf ?? (diffractionObjectSpace ? { kind: \"not-applied\" as const, evidence,\n limitation: \"No environment PSF: lens diffraction is applied upstream by the scene provider as an object-space convolution (request.diffraction).\" } : undefined) ??\n diffractionPsf ?? (defocusSiteKernels ? { kind: \"not-applied\" as const, evidence,\n limitation: \"No environment PSF: lens defocus is applied upstream by the scene provider as an object-space convolution (lens.defocus).\" } : undefined) ??\n { kind: \"not-applied\" as const, evidence, limitation: \"No lens PSF (point optics).\" };\n const pupilRecord = pupil ? { kind: \"ideal-uniform-circular-pupil\" as const, radialSampleCount: pupil.radialSamples, angularSampleCount: pupil.angularSamples, evidence,\n limitation: \"Ideal uniform circular pupil; finite ray sampling, no convergence claim.\" } : undefined;\n const chargeSamplingProfile = { schemaVersion: \"0.1.0\" as const, profileId: IDS.chargeSampling, completenessProfileId: IDS.completeness, scientificStatus: \"approximation\" as const,\n photoShotNoiseModel: \"poisson\" as const, darkShotNoiseModel: \"poisson\" as const, additionalComponentPolicies: [], evidence, limitations: [\"Poisson photo and dark shot noise.\"] };\n const channelAt = (x: number, y: number): Channel => ([\"red\", \"green\", \"green\", \"blue\"] as const)[(y % 2) * 2 + (x % 2)]!;\n function siteInput(index: number): SimulateEnvironmentSensorRawFrameInput[\"sites\"][number] {\n if (!Number.isSafeInteger(index) || index < 0 || index >= nativeWidth * nativeHeight) fail(\"Native site index out of range.\");\n const x = index % nativeWidth, y = Math.floor(index / nativeWidth), channel = channelAt(x, y), site = { x, y }, c = perChannel[channel], r = regimeByChannel[channel];\n const environment = { temporalIntegrationId: IDS.frame + \":native:\" + index,\n sensor: { spatialSampling: { imagingArea, samplingApertureProfile, opticalStackProfile, site, spatialSampleCountX: boxSamples, spatialSampleCountY: boxSamples },\n spectralSampling: spectralSamplingByChannel[channel], colorSamplingProfile, spectralResponseProfile: spectralResponseProfiles[channel],\n responseApplication: { applicationProfile: c.applicationProfile, sourcePlane, operatingConditions }, operatingRangeProfile: c.operatingRangeProfile, localExposure },\n sceneBindings, optics, motion, temporalSampleCount, fieldThroughput, psf, ...(pupilRecord ? { pupil: pupilRecord } : {}), ...(lensFieldMapping ? { lensFieldMapping } : {}) };\n // The charge completeness profile must cover the site's own exposure window (shifted by s·τ under a rolling shutter).\n const window = rollingSchedule ? calculateCaptureExposureWindows({ ...exposureWindow, nativeRaster, samplePointsNative: [{ x: x + 0.5, y: y + 0.5 }] }).value.samples[0]! :\n { startOffsetSecondsFromOpeningReference: 0, endOffsetSecondsFromOpeningReference: shutterSeconds };\n return { environment, operatingTemperatureC: OPERATING_TEMPERATURE_C,\n darkCurrentProfile: { schemaVersion: \"0.1.0\", profileId: IDS.dark, colorSamplingProfileId: IDS.cfa, channelId: channel, scientificStatus: \"approximation\", evidence,\n uncertainty: { kind: \"not-quantified\", limitation: \"Synthetic dark current for the capture facade.\" }, chargeMeaning: \"pre-compensation-thermally-generated-electrons\",\n siteApplicability: { kind: \"exact-site\", site }, temperatureModel: { kind: \"fixed-reference-temperature\", referenceTemperatureC: OPERATING_TEMPERATURE_C,\n darkCurrentElectronsPerSecond: DARK_CURRENT_ELECTRONS_PER_SECOND }, darkCurrentCompensationIncluded: false, spatialDarkCurrentNonuniformityModeled: false },\n charge: { completenessProfile: { schemaVersion: \"0.1.0\", profileId: IDS.completeness, colorSamplingProfileId: IDS.cfa, channelId: channel, site, bindingId: IDS.binding,\n timeReference: \"first-opening-boundary-phase\", startOffsetSecondsFromOpeningReference: window.startOffsetSecondsFromOpeningReference,\n endOffsetSecondsFromOpeningReference: window.endOffsetSecondsFromOpeningReference,\n darkCurrentProfileId: IDS.dark, includedAdditionalComponentIds: [], coverageMeaning: \"all-material-stored-electron-contributors-accounted-for\",\n scientificStatus: \"approximation\", evidence, limitation: \"Photo and dark charge only.\" } },\n readout: { samplingProfile: chargeSamplingProfile, capacityProfile: { schemaVersion: \"0.1.0\", profileId: IDS.capacity, colorSamplingProfileId: IDS.cfa, channelId: channel,\n capacityMeaning: \"physical-charge-storage-capacity-electrons\", capacityElectrons, scientificStatus: \"approximation\",\n uncertainty: { kind: \"not-quantified\", limitation: \"Derived from the tier's declared saturation signal.\" }, evidence, siteApplicability: { kind: \"exact-site\", site },\n operatingState: { stateId: IDS.operatingState, evidence }, temperatureApplicability: { kind: \"exact-reference-temperature\", temperatureC: OPERATING_TEMPERATURE_C } },\n operatingStateId: IDS.operatingState, readoutProfile: r.readoutProfile, regimeId: r.regimeId } } as unknown as SimulateEnvironmentSensorRawFrameInput[\"sites\"][number];\n }\n const readTile = async (request: { captureId: string; frameId: string; x: number; y: number; width: number; height: number }): Promise<NativeEnvironmentRawTile> =>\n ({ ...request, sites: Array.from({ length: request.width }, (_, j) => siteInput(request.y * nativeWidth + request.x + j)) });\n const yieldControl = createHostYield().yieldControl;\n const perSite = queriesPerSite * (diffraction && psf === diffractionPsf ? (2 * diffraction.kernelRadiusSamples + 1) ** 2 : 1);\n let diffractionMs = 0, defocusMs = 0, demosaicMs: number | undefined, encodeMs: number | undefined;\n const diffractedProvider = (window: { x: number; y: number; width: number; height: number } | undefined): PlanarSceneRadianceProvider =>\n defocusSiteKernels ? createDiffractedPlanarProvider({ base: provider, siteKernels: defocusSiteKernels.at,\n wavelengthsNm: defocusSiteKernels.wavelengthsNm, kernelRadius: defocusSiteKernels.radius, nativeWidth, nativeHeight, outputWidth: width,\n sitePitchMicrometers: pitch, distanceM: subjectDistanceM, metresPerFrameUnit, onConvolution: (ms) => { defocusMs += ms; },\n ...(window ? { window } : {}),\n ...(antiAliasing || boxSamples > 1 ? { queryOffsetsSites: apertureNodeOffsets(boxSamples).flatMap((node) =>\n (antiAliasing ? antiAliasing.components : [{ offsetMicrometers: { x: 0, y: 0 } }]).map((c) => ({ x: node.x - c.offsetMicrometers.x / pitch, y: node.y - c.offsetMicrometers.y / pitch }))) } : {}) }) :\n diffraction && diffractionObjectSpace ? createDiffractedPlanarProvider({ base: provider, psf: diffractionPsf!.configuration.psf,\n wavelengthsNm: diffraction.profile.axes.wavelengthNm, kernelRadius: diffraction.kernelRadiusSamples, nativeWidth, nativeHeight, outputWidth: width,\n sitePitchMicrometers: pitch, distanceM: subjectDistanceM, metresPerFrameUnit, onConvolution: (ms) => { diffractionMs += ms; },\n // Region (2.6): convolve only the lattice the region's native sites query; the values are the whole render's.\n ...(window ? { window } : {}),\n // The environment queries each site at each aperture node minus each split offset (sites, +x right, +y down).\n ...(antiAliasing || boxSamples > 1 ? { queryOffsetsSites: apertureNodeOffsets(boxSamples).flatMap((node) =>\n (antiAliasing ? antiAliasing.components : [{ offsetMicrometers: { x: 0, y: 0 } }]).map((c) => ({ x: node.x - c.offsetMicrometers.x / pitch, y: node.y - c.offsetMicrometers.y / pitch }))) } : {}) }) : provider;\n // Built on first use: a capture that takes the tabulated path (#394 step 2) never queries it, and its kernels cost a setup.\n let rawProviderBuilt: PlanarSceneRadianceProvider | undefined;\n const rawProvider = (): PlanarSceneRadianceProvider => (rawProviderBuilt ??= diffractedProvider(regionNative));\n if (antiAliasing && perSite > 100_000) fail(\"sensor.antiAliasing with these options needs \" + perSite + \" scene queries per site; the environment admits at most 100000.\");\n const evaluations = nativeWidth * nativeHeight * perSite;\n // The native task admits at most 100 000 radiance queries per tile.\n const tileWidth = Math.max(1, Math.min(256, Math.floor(100_000 / perSite)));\n const environmentRaw: NativeEnvironmentRawInput = { raw: buildRawInput(intentOf(whiteBalanceState)), sceneBinding,\n maximumProviderEvaluations: Math.min(nativeRawMaximumProviderEvaluations(raisedPixels === undefined ? {} : { maximumPixels: raisedPixels }),\n Math.max(nativeWidth * nativeHeight, evaluations)) };\n\n // The facade's environment chain at a site next to the optical axis, shared by the ideal reference (2.3) and the display\n // view: expected electrons per unit spectral radiance per channel and node, and the normalized RAW signal per electron.\n function axisChannelResponse(caller: string): { electronsPerRadiance: Record<Channel, Map<number, number>>; wavelengths: number[]; relativePerElectron: Record<Channel, number> } {\n // 1. Electrons per unit spectral radiance at each spectral node, per channel: the facade's own environment chain at a\n // site next to the optical axis, with the ideal optics (no PSF, pupil, distortion, vignetting or motion). The signal\n // is linear in the radiance node values and, for this planar scene, the same at every site (paraxial π/(4N_w²)).\n const cx = Math.floor(nativeWidth / 2) & ~1, cy = Math.floor(nativeHeight / 2) & ~1;\n const channelSites: Record<Channel, number> = { red: cy * nativeWidth + cx, green: cy * nativeWidth + Math.min(cx + 1, nativeWidth - 1), blue: Math.min(cy + 1, nativeHeight - 1) * nativeWidth + Math.min(cx + 1, nativeWidth - 1) };\n const environments = {} as Record<Channel, Record<string, unknown>>;\n for (const channel of CHANNELS) {\n if (channelAt(channelSites[channel] % nativeWidth, Math.floor(channelSites[channel] / nativeWidth)) !== channel) fail(caller + \" needs at least a 2 × 2 native raster.\");\n const environment = { ...(siteInput(channelSites[channel]).environment as unknown as Record<string, unknown>) };\n environment.psf = { kind: \"not-applied\", evidence, limitation: \"Ideal reference: no lens PSF.\" };\n environment.fieldThroughput = { kind: \"unity\", evidence, limitation: \"Ideal reference: no vignetting.\" };\n environment.motion = { ...motion, angularVelocityRadPerSec: { pitch: 0, yaw: 0, roll: 0 } };\n environment.temporalSampleCount = 1;\n delete environment.pupil;\n delete environment.lensFieldMapping;\n delete environment.evaluateRadiance;\n delete environment.evaluateApertureRadiance;\n environments[channel] = environment;\n }\n // The responses are a function of these records without their scene bindings: the radiance is replaced at every node,\n // and the bindings (provider, illumination and material profiles) are only checked, never enter a number. So a chart,\n // illuminant or illuminance change keeps the entry (#443). A request split into region tiles builds the same records for\n // every tile. The entries are kept across calls (the last CHANNEL_RESPONSE_CACHE_SIZE).\n const key = JSON.stringify(CHANNELS.map((c) => ({ ...environments[c], sceneBindings: undefined })));\n const copy = (responses: Record<Channel, Map<number, number>>): Record<Channel, Map<number, number>> => Object.fromEntries(CHANNELS.map((c) => [c, new Map(responses[c])])) as Record<Channel, Map<number, number>>;\n const cached = channelResponseCache.get(key);\n let electronsPerRadiance: Record<Channel, Map<number, number>>;\n if (cached) {\n channelResponseCache.delete(key);\n channelResponseCache.set(key, cached);\n electronsPerRadiance = copy(cached);\n } else {\n electronsPerRadiance = {} as Record<Channel, Map<number, number>>;\n // One chain execution per channel, each node's electrons read from its own rate term (#443; exact, see channel-response.ts).\n // The records are built above for this call only, so they are planned as engine-owned data.\n for (const channel of CHANNELS) electronsPerRadiance[channel] = calculateChannelElectronsPerRadiance(environments[channel], (request) => provider.evaluateRadiance(request), caller);\n // Callers get their own maps; the cached ones are never handed out.\n channelResponseCache.set(key, copy(electronsPerRadiance));\n if (channelResponseCache.size > CHANNEL_RESPONSE_CACHE_SIZE) channelResponseCache.delete(channelResponseCache.keys().next().value!);\n }\n const wavelengths = [...new Set(CHANNELS.flatMap((c) => [...electronsPerRadiance[c].keys()]))].sort((a, b) => a - b);\n // 2. Electrons → normalized RAW signal: (code − black)/(white − black) = e·d/(G·(W − B)) for the linear readout\n // (conversion gain G e⁻/DN, digital gain d, black B, effective white W of the capture's readout regime).\n const relativePerElectron = {} as Record<Channel, number>;\n for (const channel of CHANNELS) {\n const { readoutProfile, regimeId } = regimeByChannel[channel];\n const regime = resolveSensorReadoutRegime({ profile: readoutProfile as Parameters<typeof resolveSensorReadoutRegime>[0][\"profile\"], regimeId }).regime;\n const gain = regime.systemConversionGainElectronsPerCode.value, digitalGain = regime.adc.digitalGain ?? 1, black = regime.adc.blackLevelCode;\n const white = calculateSiteEffectiveSaturationCode({ physicalChargeCapacityElectrons: capacityElectrons, preAdcSaturationElectronEquivalent: regime.preAdcSaturationElectronEquivalent.value,\n systemConversionGainElectronsPerCode: gain, blackLevelCode: black, digitalSaturationCode: regime.adc.digitalSaturationCode, adcMaximumCode: 2 ** regime.adc.bitDepth - 1, digitalGain },\n readoutProfile as Parameters<typeof calculateSiteEffectiveSaturationCode>[1], regimeId);\n relativePerElectron[channel] = digitalGain / (gain * (white - black));\n }\n return { electronsPerRadiance, wavelengths, relativePerElectron };\n }\n // Display view: the renderer that simulate-display-view.ts passes in reads this request's resolved state, so a bundle\n // that only captures does not contain the display view.\n if (displayView) return await renderView!({ ahd, fastReport, antiAliasing, aspect, assume, assumptions, axisChannelResponse, boxSamples, buildProvider, callerScene, chart, materialLayers, chartReport, chartSize, diffraction, defocus: displayViewDefocus, diffractionPsf, fNumber, focalLengthMm, focusDistanceM, height, highlightMode, illuminanceLux, illuminant, illuminantOption, imagingArea, intentOf, metresPerFrameUnit, noiseSeed, outputOptions, parsedView, pitch, preset, provider, regimeByChannel, resolvedIso, isoReport, standardExposureDeviationStops: exposureDeviationStops, standardExposureIlluminanceLux: exposureIlluminanceLux, greyCardDeviationStops: exposureGreyCardDeviationStops, metering, sceneOption, scenePreset, shutterSeconds, started, subjectDistanceM, toneCurve, whiteBalanceOption, whiteBalanceState, width, checkAbort, margin, mode, nativeHeight, nativeWidth, sourceSha256, yieldControl, kelvinWhiteBalanceInput });\n // Ideal reference (2.3): the scene without camera effects, at the capture's own exposure, white balance and encoding.\n if (idealReference) {\n const referenceStarted = clockMs();\n if (format !== \"srgb-8\" && format !== \"srgb-16\" && format !== \"png\") fail(\"simulateIdealReference supports output.format srgb-8, srgb-16 and png: a reference has no RAW (dng) and should not carry JPEG compression artefacts.\");\n if (needsAuto) fail(\"simulateIdealReference cannot reproduce output.whiteBalance \\\"auto\\\": the capture measures it from its noisy RAW. Use \\\"scene-illuminant\\\" or a fixed white balance.\");\n const { electronsPerRadiance, wavelengths, relativePerElectron } = axisChannelResponse(\"simulateIdealReference\");\n // 3. Scene radiance per sample: chart materials once (and the fixed-size chart's surround), caller functions per sample.\n const signalOf = (radiance: (nm: number) => number): [number, number, number] => {\n const values = new Map(wavelengths.map((nm) => [nm, radiance(nm)]));\n return CHANNELS.map((c) => { let e = 0; for (const [nm, a] of electronsPerRadiance[c]) e += a * values.get(nm)!; return e * relativePerElectron[c]; }) as [number, number, number];\n };\n const materialCount = chart ? chart.materials.length : callerScene?.kind === \"material-function\" ? callerScene.materials.length : 0;\n const materialSignals = provider.chartMaterialAt ? Array.from({ length: materialCount + (chartSize ? 1 : 0) }, (_, m) => signalOf((nm) => provider.materialRadiance!(m, nm))) : undefined;\n // 4. Pixels: the native sites of the output (or region) pixels, each centre-sampled or box-integrated like the capture.\n const x0 = (region ? region.x : 0) + margin, y0 = (region ? region.y : 0) + margin, n = boxSamples, unit = 2 / width;\n const referenceIntent = intentOf(whiteBalanceState), referenceGains = referenceIntent ? [referenceIntent.channelGains.red, referenceIntent.channelGains.green, referenceIntent.channelGains.blue] : null;\n const development = prepareSensorColorDevelopment(CAMERA_TO_XYZ as unknown as Parameters<typeof prepareSensorColorDevelopment>[0],\n referenceGains, highlightMode);\n const rgb = new Float64Array(outputWidth * outputHeight * 3), counts = { whiteBalanceClippedSampleCount: 0, reconstructedPixelCount: 0 }, sum = [0, 0, 0];\n for (let py = 0; py < outputHeight; py++) {\n for (let px = 0; px < outputWidth; px++) {\n sum[0] = 0; sum[1] = 0; sum[2] = 0;\n for (let l = 0; l < n; l++) for (let k = 0; k < n; k++) {\n const u = (x0 + px + (k + 0.5) / n - nativeWidth / 2) * unit, v = -(y0 + py + (l + 0.5) / n - nativeHeight / 2) * unit;\n const s = materialSignals ? materialSignals[provider.chartMaterialAt!(u, v)]! : signalOf((nm) => provider.radianceAt(u, v, nm));\n sum[0] += s[0]; sum[1] += s[1]; sum[2] += s[2];\n }\n // Normalized RAW values saturate at the white level, as in development.\n const c = sum.map((value) => Math.min(1, Math.max(0, value / (n * n))));\n development.developInto(c[0]!, c[1]!, c[2]!, rgb, (py * outputWidth + px) * 3, counts);\n }\n if ((py & 15) === 15) { await yieldControl(); checkAbort(); }\n }\n let samples: Uint8Array | Uint16Array;\n if (!linearPath) {\n const maximum = 2 ** rendering.bitDepth - 1, tone = prepareSdrPixelTone(rendering), scratch = new Float64Array(3);\n samples = rendering.bitDepth === 8 ? new Uint8Array(rgb.length) : new Uint16Array(rgb.length);\n const sdrCounts: SdrPixelCounts = { negative: 0, above: 0, changed: 0, low: 0, high: 0, outOfGamut: false };\n for (let y = 0; y < outputHeight; y++) renderSdrRunInto(rgb, y * outputWidth * 3, outputWidth, rendering, tone, 2 ** rendering.renderingExposureEv, maximum, samples, y * outputWidth * 3, scratch, sdrCounts);\n } else {\n const mapping = perceptual ? prepareRgbGamutMapping({ colorSpace: colorEncoding!, method: \"cielab-hue-preserving-chroma-compression\", kneeFraction: PERCEPTUAL_GAMUT_KNEE_FRACTION }) : undefined;\n samples = encodeSdrFromLinear(rgb, colorEncoding!, pngBitDepth!, mapping).samples;\n }\n const encodedPng = format === \"png\" ? serializePngImage({ width: outputWidth, height: outputHeight, bitDepth: pngBitDepth!, samples, colourEncoding: pngColourEncoding(colorEncoding!),\n ...(raisedPixels === undefined || outputWidth * outputHeight <= PNG_ENCODER_LIMITS.maximumPixels ? {} : { maximumPixels: raisedPixels }) }) : undefined;\n const png = encodedPng && textMetadata ? addPngTextMetadata(encodedPng, textMetadata) : encodedPng;\n if (png) assumeTextMetadata(TEXT_METADATA_LAYOUT.png);\n const referenceMs = clockMs() - referenceStarted;\n assume(\"reference.kind\", \"model\", \"ideal-reference\",\n \"An ideal reference, not a capture: the same scene, framing, chart size, output size, region and pixel grid as the capture request, with no camera effects.\");\n assume(\"reference.excludes\", \"model\", [\"lens PSF, diffraction, defocus and pupil sampling\", \"projection and distortion (ideal rectilinear mapping)\", \"vignetting\", \"anti-aliasing filter\",\n \"colour filter mosaic and demosaicing (every pixel has all three channels)\", \"photon, dark and read noise\", \"dark signal\", \"ADC rounding and non-linearity\", \"camera motion and rolling shutter\"],\n \"None of these is applied; each pixel's channels come from the scene radiance at the pixel alone.\");\n assume(\"reference.exposure\", \"model\", { convention: \"exposure-matched\", fNumber, shutterSeconds, iso: resolvedIso, illuminanceLux,\n normalizedSignalPerElectron: { ...relativePerElectron } },\n \"Exposure-matched: each channel is the expected (noise-free) signal the capture's own sensor would record at the resolved exposure (f-number, shutter, ISO, illuminance and lens transmission; the facade's environment chain at the optical axis), \" +\n \"normalized like the RAW development ((code − black)/(white − black) = e·d/(G·(W − B)) for a linear readout), clipped at white, then developed with the capture's white balance, camera → XYZ → sRGB matrices, highlight mode, tone curve and encoding. \" +\n \"So a uniform patch renders at the capture's mean level, and differences from the capture are the camera effects plus noise. Chosen over a fixed reflectance → sRGB mapping because that would differ from the capture by the exposure, which is not a camera artefact.\");\n assume(\"reference.sampling\", \"model\", boxAperture ? { kind: \"box\", samplesPerAxis: n } : { kind: \"point\" },\n boxAperture ? \"Each pixel averages the scene over its square photosite with the same \" + n + \" × \" + n + \" midpoint rule as sensor.pixelAperture \\\"box\\\".\" :\n \"Each pixel samples the scene at its centre, like the capture's default point aperture; use sensor.pixelAperture \\\"box\\\" for photosite-averaged pixels.\");\n return Object.freeze({ kind: \"ideal-reference\" as const, label: \"Ideal reference (no camera effects); not a capture.\", facadeVersion: SIMULATE_CAPTURE_FACADE_VERSION, engineApiVersion: ENGINE_API_VERSION,\n image: { width: outputWidth, height: outputHeight, format, samples, ...(png ? { png, colorEncoding: colorEncoding! } : {}) },\n exposure: { mode, settings: { fNumber, shutterSeconds, iso: resolvedIso }, ev100: Math.log2(fNumber ** 2 / shutterSeconds), ...isoReport },\n scene: { sceneId: chart ? \"chart:\" + chart.preset : callerScene!.sceneId, preset: scenePreset, parameters: chart ? chart.parameters : {},\n illuminant: { id: illuminant.id, description: illuminant.description, illuminanceLux }, distanceM: subjectDistanceM,\n framedWidthM: 2 * metresPerFrameUnit, framedHeightM: 2 * metresPerFrameUnit * aspect, ...(chartReport ? { chart: chartReport } : {}), sourceSha256 },\n ...(region && regionNative ? { region: { ...region, frameWidth: width, frameHeight: height } } : {}),\n diagnostics: { sampleCount: outputWidth * outputHeight * n * n, timingsMs: { reference: referenceMs, total: Date.now() - started } },\n provenance: { scientificStatus: \"approximation\" as const, cameraPresetId: preset.presetId, cameraPresetVersion: preset.presetVersion, evidence: [...FACADE_EVIDENCE, ...preset.evidence],\n composedContracts: [\"calculateEnvironmentSensorPhotoSignal\", \"resolveSensorReadoutRegime\", \"calculateSiteEffectiveSaturationCode\", \"prepareSensorColorDevelopment\",\n ...(linearPath ? [\"resolveRgbColorSpace\", ...(perceptual ? [\"prepareRgbGamutMapping\"] : [])] : [\"SDR rendering kernel\"]), ...(png ? [\"serializePngImage\"] : [])],\n limitations: [\"Ideal reference of the planar scene at the capture's exposure: not a capture and not a measurement; it shows what the camera effects change, not an absolute colour truth.\"] },\n assumptions: Object.freeze(assumptions.map((a) => Object.freeze(a))) });\n }\n\n async function runTask<T extends { run(): Promise<void>; cancel(): void; dispose(): void; readonly state: string }>(task: T): Promise<void> {\n const onAbort = (): void => task.cancel();\n signal?.addEventListener(\"abort\", onAbort, { once: true });\n try { checkAbort(); await task.run(); checkAbort(); } catch (error) { task.dispose(); if (signal?.aborted) fail(\"simulateCapture aborted.\"); throw error; } finally { signal?.removeEventListener(\"abort\", onAbort); }\n }\n const rawStarted = Date.now();\n const plan = calculateNativeRawPlan(environmentRaw.raw);\n const progress = (stage: SimulateCaptureProgress[\"stage\"], total: number) => {\n let completed = 0;\n return (): void => { completed++; onProgress?.({ stage, completedTileCount: completed, totalTileCount: total }); };\n };\n const rawTick = progress(\"raw\", regionNative ? regionNative.height * Math.ceil(regionNative.width / tileWidth) : plan.tileCount);\n // #394: siteInput builds fresh site records per call and never changes them, so the native task plans them without a copy.\n const rawCallbacks = (): Parameters<typeof createNativeEnvironmentRawTask>[1] => ({ readTile: markInternalNativeTileReader(async (request: Parameters<typeof readTile>[0]): Promise<NativeEnvironmentRawTile> => { const tile = await readTile(request); rawTick(); return tile; }),\n evaluateRadiance: rawProvider().evaluateRadiance, ...(pupil ? { evaluateApertureRadiance: provider.evaluateApertureRadiance } : {}), yieldControl });\n // #394 step 2: an engine-built planar scene (chart preset or caller material scene; still, rectilinear, no distortion, vignetting,\n // pupil rays or caller PSF) takes its expected electrons from the tabulated signal, verified per CFA phase against the chain.\n const tabulatedScene = chart !== undefined || callerScene?.kind === \"material-function\";\n // #391: a DNG from region parts takes the whole frame's RAW from the parts instead of rendering it.\n if (run === \"dng-from-parts\" && regionNative) fail(\"serializeSimulatedCaptureDngFromParts writes the whole frame: the options take no output.region.\");\n const dngParts = run === \"dng-from-parts\" ? viewOption : undefined;\n let tabulated: Awaited<ReturnType<typeof renderTabulatedNativeRaw>>;\n if (dngParts === undefined && tabulatedScene && !pupil && !lensFieldMapping && !vignetting && !lensPsf && !rotating && (!diffraction || diffractionObjectSpace) && provider.chartMaterialAt && provider.materialRadiance) {\n const { electronsPerRadiance, wavelengths } = axisChannelResponse(\"simulateCapture\");\n const perNode = CHANNELS.map((c) => Float64Array.from(wavelengths, (nm) => electronsPerRadiance[c].get(nm) ?? 0)) as [Float64Array, Float64Array, Float64Array];\n const sceneMaterials = chart ? chart.materials : (callerScene as ResolvedCallerMaterialScene).materials, materialRadiance = provider.materialRadiance;\n const { signalInput: builtSignalInput } = buildExpectedSignalInput({ nativeWidth, nativeHeight, width, wavelengths, perNode, apertureNodes: apertureNodeOffsets(boxSamples), boxSamples, antiAliasing, pitch,\n diffraction: diffraction && !defocusSiteKernels ? { radius: diffraction.kernelRadiusSamples, psf: diffractionPsf!.configuration.psf, profileWavelengths: diffraction.profile.axes.wavelengthNm } : undefined,\n materials: { materialAt: provider.chartMaterialAt, whiteRadiance: (nm: number): number => irradianceScale * illuminant.shape.evaluate(nm) / Math.PI,\n list: [...sceneMaterials.map((m, index) => (m.kind === \"neutral\" ? { neutral: m.reflectance } : { radiance: (nm: number): number => materialRadiance(index, nm) })),\n ...(chartSize ? [{ neutral: chartSize.surroundReflectance }] : [])] },\n radianceAt: provider.radianceAt, imagingArea, focalLengthMm, focusDistanceM, subjectDistanceM, metresPerFrameUnit, caller: \"simulateCapture\" });\n // #492: with lens.defocus the table convolves the lattice radiance with each node's defocus (or combined) kernel, on the\n // lattice formula, exactly as the object-space provider does.\n let signalInput = builtSignalInput;\n if (defocusSiteKernels) {\n const lattice = { ...builtSignalInput };\n delete lattice.queryPoint;\n signalInput = { ...lattice, kernels: { radius: defocusSiteKernels.radius, perNode: wavelengths.map((nm) => defocusSiteKernels!.at(nm)) } };\n }\n // The verification reads only the region's top-left 2 × 2 block, so its diffraction convolves only that block's lattice; the\n // window never changes a value (see diffraction-provider.ts), so the chain it runs is the whole render's.\n const verificationProvider = diffractedProvider({ x: regionNative?.x ?? 0, y: regionNative?.y ?? 0, width: 2, height: 2 });\n tabulated = await renderTabulatedNativeRaw({ input: environmentRaw, region: regionNative, siteInput, evaluateRadiance: verificationProvider.evaluateRadiance,\n electrons: createDisplayViewExpectedSignal(signalInput), onTile: rawTick, tileWidth, yieldControl: () => yieldControl(), checkAbort });\n }\n let rawOutput: { raw: NativeRawOutput; providerEvaluationCount: number };\n if (dngParts !== undefined) rawOutput = { raw: joinNativeRawParts(dngParts, plan, nativeWidth, nativeHeight), providerEvaluationCount: 0 };\n else if (tabulated) {\n rawOutput = { raw: tabulated.raw, providerEvaluationCount: tabulated.providerEvaluationCount };\n // The verification's relative difference itself is not reported: it is a last-bits quantity, and captures use the JavaScript\n // engine's own Math functions, so it differs between engines while the results are the same.\n assume(\"raw.expectedSignal\", \"model\", { method: \"tabulated-expected-electrons\", verificationSites: 4, tolerance: TABULATED_RELATIVE_TOLERANCE },\n \"Each native site's expected photo electrons are the tabulated sum over the pixel-aperture nodes, anti-aliasing spots, diffraction taps and spectral nodes (the display view's expected signal), \" +\n \"the same quantity the environment chain computes for this still, rectilinear, distortion-free planar scene, formed in another order, so it can differ in the last bits. The sensor stage (dark charge, Poisson draws, \" +\n \"read noise, ADC) is the native one with each site's own seeds. One site of each CFA phase ran the full chain: its readout was reproduced bit for bit and its electrons agreed within the tolerance. \" +\n \"diagnostics.providerEvaluationCount counts those sites' evaluator calls and the table's scene lookups.\");\n }\n else {\n const rawTask: NativeEnvironmentRawTask = regionNative ? createNativeEnvironmentRawRegionTask(environmentRaw, regionNative, rawCallbacks()) :\n createNativeEnvironmentRawTask(environmentRaw, rawCallbacks());\n await runTask(rawTask);\n rawOutput = rawTask.takeOutput();\n }\n // Region (2.3): the region's sites, re-described by a plan of the region raster (active area = the region), for development.\n let developmentPlan = plan;\n if (region && regionNative) {\n const raster = { pixelWidth: regionNative.width, pixelHeight: regionNative.height };\n const regionGeometry = { imagingArea: { widthMm: raster.pixelWidth * pitch / 1000, heightMm: raster.pixelHeight * pitch / 1000 }, nativeRaster: raster, orientation: \"landscape\" as const,\n activeCaptureRect: { x: region.x + margin - regionNative.x, y: region.y + margin - regionNative.y, width: region.width, height: region.height },\n outputRaster: { pixelWidth: region.width, pixelHeight: region.height } };\n developmentPlan = calculateNativeRawPlan(buildRawInputFor(intentOf(whiteBalanceState), regionGeometry, { ...captureModeProfile, modes: captureModeProfile.modes.map((m) =>\n ({ ...m, processedImageRaster: { ...m.processedImageRaster, value: raster } })) } as NativeRawInput[\"captureModeProfile\"], { ...bindingProfile, nativeRaster: raster }, raster.pixelWidth * raster.pixelHeight));\n if (Array.from(rawOutput.raw.effectiveSaturationCodes).some((code) => code === 0)) fail(\"output.region needs every CFA phase in its native rectangle.\");\n rawOutput = { ...rawOutput, raw: { ...rawOutput.raw, plan: developmentPlan } };\n }\n const providerEvaluationCount = rawOutput.providerEvaluationCount;\n const rawMs = Date.now() - rawStarted, wbStarted = Date.now();\n let finalRawInput = environmentRaw;\n if (needsAuto) {\n // Grey-world AWB over pre-WB RAW: black-subtracted, white-normalized channel means of each 2×2 CFA block on a coarse grid.\n const raw = rawOutput.raw, step = Math.max(2, 2 * Math.floor(Math.sqrt(width * height / 4096) / 1)), samples = [];\n for (let y = margin - (margin % 2); y + 1 < nativeHeight; y += step) for (let x = margin - (margin % 2); x + 1 < nativeWidth; x += step) {\n const value = (dx: number, dy: number): number => { const i = (y + dy) * nativeWidth + x + dx; return (raw.codes[i]! - raw.blackLevels[i]!) / (raw.effectiveSaturationCodes[dy * 2 + dx]! - raw.blackLevels[i]!); };\n let clipped = false;\n for (const [dx, dy] of [[0, 0], [1, 0], [0, 1], [1, 1]]) if (raw.saturationFlags[(y + dy!) * nativeWidth + x + dx!]! !== 0) clipped = true;\n samples.push({ sampleId: \"block-\" + x + \"-\" + y, red: Math.max(1e-9, value(0, 0)), green: Math.max(1e-9, (value(1, 0) + value(0, 1)) / 2), blue: Math.max(1e-9, value(1, 1)), weight: 1, clipped });\n }\n const policy = body.whiteBalance.awbPolicies[0]!;\n assume(\"output.whiteBalance.auto\", \"model\", { policyId: policy.policyId, samples: samples.length },\n \"Grey-world AWB of the body's \" + policy.policyId + \" policy over 2×2 CFA block means of the pre-WB RAW; the RAW is then rendered again with that intent (the same radiance queries are repeated).\");\n whiteBalanceState = estimateAutoWhiteBalance({ stateId: \"facade-wb-auto\", profile: body.whiteBalance, policyId: policy.policyId,\n sampleSet: { imageStateId: \"facade-pre-wb-raw\", inputDomain: \"relative-pre-wb-camera-linear-rgb\", samples } });\n finalRawInput = { raw: buildRawInput(intentOf(whiteBalanceState)), sceneBinding, maximumProviderEvaluations: environmentRaw.maximumProviderEvaluations };\n const wbTick = progress(\"white-balance\", plan.tileCount);\n if (tabulated || dngParts !== undefined) {\n // #394: the RAW codes do not depend on the white-balance intent (it is development metadata), so the tabulated RAW is\n // kept with the plan of the measured intent instead of being rendered again.\n rawOutput = { ...rawOutput, raw: { ...rawOutput.raw, plan: calculateNativeRawPlan(finalRawInput.raw) } };\n for (let k = 0; k < plan.tileCount; k++) wbTick();\n } else {\n // A second lean RAW pass with the measured intent. It gives the same RAW as re-running the sensor stage on a\n // retained optical stage, and is faster: retaining the optical stage takes the first pass off the lean executor.\n const wbTask = createNativeEnvironmentRawTask(finalRawInput, {\n readTile: markInternalNativeTileReader(async (request: Parameters<typeof readTile>[0]): Promise<NativeEnvironmentRawTile> => { const tile = await readTile(request); wbTick(); return tile; }),\n evaluateRadiance: rawProvider().evaluateRadiance, ...(pupil ? { evaluateApertureRadiance: provider.evaluateApertureRadiance } : {}), yieldControl });\n await runTask(wbTask);\n rawOutput = wbTask.takeOutput();\n }\n }\n const wbMs = Date.now() - wbStarted, devStarted = Date.now();\n const colorProfile: ExportSensorColorProfile = { schemaVersion: \"0.1.0\", profileId: IDS.spectral, profileVersion: SIMULATE_CAPTURE_FACADE_VERSION, colorSamplingProfileId: IDS.cfa,\n channelIds: [\"red\", \"green\", \"blue\"], scientificStatus: \"approximation\", referenceIlluminant: \"D65\", normalizedCameraChannelsToXyz: CAMERA_TO_XYZ,\n evidence, limitations: [\"Diagonal camera→XYZ matrix of the idealized colorimetric (Luther–Ives) sensor; exact up to spectral quadrature.\"] };\n const phaseProfiles = builtInDemosaic ? builtInDemosaic.phaseProfiles : bilinearPhaseProfiles();\n const developmentWhiteBalance = whiteBalanceState ? \"apply-resolved-sensor-gains\" as const : \"not-required\" as const;\n\n\n // DNG (2.0): the packed native RAW itself, before development takes ownership of it.\n let dng: NativeRawDng | undefined;\n if (format === \"dng\") {\n const noise = Object.fromEntries(CHANNELS.map((channel) => {\n const resolved = resolveSensorReadoutRegime({ profile: regimeByChannel[channel].readoutProfile as Parameters<typeof resolveSensorReadoutRegime>[0][\"profile\"], regimeId: regimeByChannel[channel].regimeId });\n return [channel, { conversionGainElectronsPerCode: resolved.regime.systemConversionGainElectronsPerCode.value / (resolved.regime.adc.digitalGain ?? 1),\n readNoiseRmsElectrons: resolved.combinedReadNoiseRmsElectrons }];\n }));\n const dngStarted = clockMs();\n dng = await serializeNativeRawDng({ raw: rawOutput.raw, colorProfile, noise, ...(dngCapturedAtUtc === undefined ? {} : { capturedAtUtc: dngCapturedAtUtc }),\n ...(textMetadata ? { textMetadata } : {}) });\n encodeMs = clockMs() - dngStarted;\n assumeTextMetadata(TEXT_METADATA_LAYOUT.dng);\n checkAbort();\n assume(\"output.dng\", \"model\", { writer: \"serializeNativeRawDng\", schemaVersion: dng.schemaVersion, whiteLevel: dng.whiteLevel, blackLevels: dng.blackLevels,\n noiseProfile: dng.noiseProfile, unrepresentedSaturationFlagCount: dng.unrepresentedSaturationFlagCount },\n \"Lossless uncompressed 16-bit CFA DNG of exactly the packed native RAW codes: per-phase BlackLevel, WhiteLevel = smallest per-phase effective white, ActiveArea and DefaultCrop from the capture geometry, ColorMatrix1/ForwardMatrix1 from the facade's diagonal camera→XYZ profile (D65), AsShotNeutral from the white-balance intent, BaselineExposure 0, and NoiseProfile from each channel's readout regime (conversion gain ÷ digital gain, combined read noise; Poisson + Gaussian + quantization only). No linear master or developed image is declared; saturation flags below WhiteLevel are not representable and are counted.\");\n }\n if (dngParts !== undefined) return dng;\n\n // Development\n const development: Omit<NativeRawDevelopmentInput, \"raw\"> = { phaseProfiles, colorProfile,\n whiteBalance: developmentWhiteBalance, rendering, highlightMode, ...(mirrorBorder ? { borderHandling: \"mirror\" as const } : {}),\n maximumRetainedPayloadBytes: developmentPlan.outputBytes + outputWidth * outputHeight * 3 * (rendering.bitDepth / 8) };\n let developed: { raw: NativeRawOutput; integerSamples: Uint8Array | Uint16Array; highlight: RawHighlightDiagnostics; diagnostics: SdrRenderingResult[\"diagnostics\"] };\n let gamutMappingDiagnostics: { method: \"cielab-hue-preserving-chroma-compression\"; kneeFraction: number; adjustedPixelCount: number; lightnessClippedPixelCount: number } | undefined;\n if (ahd) {\n let lastYield = Date.now();\n const linear = await developLinearSrgb({ ...development, raw: rawOutput.raw }, async (completed, total) => {\n onProgress?.({ stage: \"development\", completedTileCount: completed, totalTileCount: total });\n if (Date.now() - lastYield >= 8) { await yieldControl(); checkAbort(); lastYield = Date.now(); }\n }, { yieldControl: () => yieldControl(), checkAbort, onDemosaicMs: (ms) => { demosaicMs = ms; } });\n if (!linearPath) {\n // The native development's SDR kernel, row by row, on the AHD-developed linear sRGB.\n const maximum = 2 ** rendering.bitDepth - 1, tone = prepareSdrPixelTone(rendering), scratch = new Float64Array(3);\n const codes = rendering.bitDepth === 8 ? new Uint8Array(outputWidth * outputHeight * 3) : new Uint16Array(outputWidth * outputHeight * 3);\n const counts: SdrPixelCounts = { negative: 0, above: 0, changed: 0, low: 0, high: 0, outOfGamut: false };\n for (let y = 0; y < outputHeight; y++) renderSdrRunInto(linear.rgb, y * outputWidth * 3, outputWidth, rendering, tone, 2 ** rendering.renderingExposureEv, maximum, codes, y * outputWidth * 3, scratch, counts);\n developed = { raw: rawOutput.raw, integerSamples: codes, highlight: linear.highlight, diagnostics: { renderingNegativeSampleCount: counts.negative,\n renderingAboveReferenceSampleCount: counts.above, toneChangedSampleCount: counts.changed, gamutClippedLowSampleCount: counts.low,\n gamutClippedHighSampleCount: counts.high, captureSaturation: \"consumed-in-raw-development\" } };\n } else {\n const mapping = perceptual ? prepareRgbGamutMapping({ colorSpace: colorEncoding!, method: \"cielab-hue-preserving-chroma-compression\", kneeFraction: PERCEPTUAL_GAMUT_KNEE_FRACTION }) : undefined;\n const encoded = encodeSdrFromLinear(linear.rgb, colorEncoding!, pngBitDepth!, mapping);\n developed = { raw: rawOutput.raw, integerSamples: encoded.samples, highlight: linear.highlight, diagnostics: encoded.diagnostics };\n if (mapping) gamutMappingDiagnostics = { method: \"cielab-hue-preserving-chroma-compression\", kneeFraction: PERCEPTUAL_GAMUT_KNEE_FRACTION,\n adjustedPixelCount: encoded.adjustedPixelCount, lightnessClippedPixelCount: encoded.lightnessClippedPixelCount };\n }\n } else if (!linearPath) {\n const devTask = createNativeRawDevelopmentTask({ ...development, raw: rawOutput.raw }, { yieldControl,\n onProgress: (p) => onProgress?.({ stage: \"development\", completedTileCount: p.completedTileCount, totalTileCount: p.totalTileCount }) });\n await runTask(devTask);\n developed = devTask.takeOutput();\n } else {\n // Wide gamut: the native development operator up to linear sRGB/D65 (unclipped), then XYZ → target primaries.\n let lastYield = Date.now();\n const linear = await developLinearSrgb({ ...development, raw: rawOutput.raw }, async (completed, total) => {\n onProgress?.({ stage: \"development\", completedTileCount: completed, totalTileCount: total });\n if (Date.now() - lastYield >= 8) { await yieldControl(); checkAbort(); lastYield = Date.now(); }\n });\n {\n const mapping = perceptual ? prepareRgbGamutMapping({ colorSpace: colorEncoding!, method: \"cielab-hue-preserving-chroma-compression\", kneeFraction: PERCEPTUAL_GAMUT_KNEE_FRACTION }) : undefined;\n const encoded = encodeSdrFromLinear(linear.rgb, colorEncoding!, pngBitDepth!, mapping);\n developed = { raw: rawOutput.raw, integerSamples: encoded.samples, highlight: linear.highlight, diagnostics: encoded.diagnostics };\n if (mapping) {\n gamutMappingDiagnostics = { method: \"cielab-hue-preserving-chroma-compression\", kneeFraction: PERCEPTUAL_GAMUT_KNEE_FRACTION,\n adjustedPixelCount: encoded.adjustedPixelCount, lightnessClippedPixelCount: encoded.lightnessClippedPixelCount };\n assume(\"output.gamutMapping\", \"model\", { method: \"cielab-hue-preserving-chroma-compression\", kneeFraction: PERCEPTUAL_GAMUT_KNEE_FRACTION, colorSpace: colorEncoding },\n \"prepareRgbGamutMapping: CIELAB L* and hue held, chroma above 90 % of the boundary chroma C_max(L*, h) compressed with a tanh knee so it never reaches C_max (Morovič 2008, §10). In-gamut colours below the knee are unchanged; saturated in-gamut colours above it are desaturated slightly. L* ≥ 100 (above the RAW white) maps to white. CIELAB hue is not perceptually constant for saturated blues, so they can shift toward purple.\");\n }\n assume(\"output.colorEncoding.conversion\", \"model\", { from: \"linear-srgb-d65 (unclipped)\", via: \"CIE XYZ\", to: colorEncoding, gamutHandling: perceptual ? \"cielab-hue-preserving-chroma-compression\" : \"clip-components\",\n transfer: colorEncoding === \"rec2020\" ? \"bt2020-oetf (= BT.709 OETF)\" : \"srgb (W3C CSS Color 4)\" },\n \"Developed with the native development operator (demosaic, per-site white-level clip, WB, highlight mode, diagonal camera→XYZ, XYZ→linear sRGB) but before any sRGB clipping, so colours outside sRGB are kept; converted to \" +\n colorEncoding + \" through XYZ (matrices from primaries and D65, as in W3C CSS Color 4), \" + (perceptual ? \"gamut-mapped perceptually (output.gamutMapping)\" : \"components clipped to [0, 1] in the target gamut\") +\n \", then encoded and rounded to nearest. RAW white maps to display white, as in the sRGB path.\");\n }\n }\n const devMs = Date.now() - devStarted, jpegStarted = Date.now();\n let jpeg: Uint8Array | undefined;\n if (format === \"jpeg\") {\n const samples = developed.integerSamples as Uint8Array;\n const jpegSha = await sha256Hex(Array.from(samples.subarray(0, Math.min(samples.length, 4096))).join(\",\") + \":\" + samples.length + \":\" + sourceSha256);\n const source = { captureId: IDS.capture, imageStateId: \"facade-developed\", artifactId: \"facade-developed-srgb8\", sha256: jpegSha, width: outputWidth, height: outputHeight, encoding: \"encoded-srgb-8-rgb\" as const };\n // The encoder reads every pixel once, in source tiles of at most 256 × 32 aligned to the crop origin.\n const reads = Math.ceil(outputHeight / 32) * Math.ceil(outputWidth / 256), jpegTick = progress(\"jpeg\", reads);\n const jpegTask = createPrintJpegTask({ source, crop: { x: 0, y: 0, width: outputWidth, height: outputHeight }, outputWidth, outputHeight, quantizationStep: jpegStep!,\n maximumEncodedBytes: Math.max(65536, outputWidth * outputHeight * 6), maximumProviderReads: reads,\n // The JPEG records its admission plan, so the raised limit is passed (and recorded) only when the image needs it.\n ...(raisedPixels === undefined || outputWidth * outputHeight <= PRINT_JPEG_LIMITS.maximumPixels ? {} : { maximumPixels: raisedPixels }) }, {\n readTile: async (request) => {\n jpegTick();\n const out = new Uint8Array(request.width * request.height * 3);\n for (let row = 0; row < request.height; row++) out.set(samples.subarray(((request.y + row) * outputWidth + request.x) * 3, ((request.y + row) * outputWidth + request.x + request.width) * 3), row * request.width * 3);\n return { ...request, samples: out };\n }, yieldControl });\n const jpegEncodeStarted = clockMs();\n await runTask(jpegTask);\n jpeg = jpegTask.takeOutput().bytes;\n if (textMetadata) jpeg = addJpegTextMetadata(jpeg, textMetadata);\n assumeTextMetadata(TEXT_METADATA_LAYOUT.jpeg);\n encodeMs = clockMs() - jpegEncodeStarted;\n assume(\"output.jpeg\", \"model\", { encoder: \"photivra-print-jpeg\", iccProfile: \"photivra-srgb\" }, \"Baseline JPEG from the existing print JPEG encoder with an embedded sRGB ICC profile; the source digest covers a sample prefix, length and scene digest.\");\n }\n const jpegMs = Date.now() - jpegStarted;\n let png: Uint8Array | undefined;\n if (format === \"png\") {\n const pngStarted = clockMs();\n png = serializePngImage({ width: outputWidth, height: outputHeight, bitDepth: pngBitDepth!, samples: developed.integerSamples, colourEncoding: pngColourEncoding(colorEncoding!),\n ...(raisedPixels === undefined || outputWidth * outputHeight <= PNG_ENCODER_LIMITS.maximumPixels ? {} : { maximumPixels: raisedPixels }) });\n if (textMetadata) png = addPngTextMetadata(png, textMetadata);\n assumeTextMetadata(TEXT_METADATA_LAYOUT.png);\n encodeMs = clockMs() - pngStarted;\n assume(\"output.png\", \"model\", { encoder: \"serializePngImage\", bitDepth: pngBitDepth, colourEncoding: pngColourEncoding(colorEncoding!) },\n \"Deterministic PNG (8/16-bit RGB, in-house zlib) with the colour encoding signalled in the file: the sRGB chunk for sRGB, otherwise a cICP chunk with ITU-T H.273 primaries/transfer code points. No mastering-display (mDCV) or content-light-level (cLLI) metadata is written.\");\n }\n\n const ranOptions = new Set<SimulateCaptureCostOption>([...(pupil ? [\"lens.pupilSampling\" as const] : []), ...(projection !== undefined ? [\"lens.projection\" as const] : []),\n ...(distortion ? [\"lens.distortion\" as const] : []), ...(vignetting ? [\"lens.vignetting\" as const] : []), ...(lensPsf ? [\"lens.psf\" as const] : []),\n ...(diffraction ? [\"lens.diffraction\" as const] : []), ...(defocusSiteKernels ? [\"lens.defocus\" as const] : []), ...(antiAliasing ? [\"sensor.antiAliasing\" as const] : []), ...(boxAperture ? [\"sensor.pixelAperture.box\" as const] : []),\n ...(temporalSampleCount > 1 ? [\"sensor.temporalSampleCount\" as const] : []), ...(rotating ? [\"motion.rotation\" as const] : []),\n ...(rollingSchedule ? [\"motion.shutter.rolling\" as const] : []), ...(mirrorBorder ? [\"output.borderHandling.mirror\" as const] : []), ...(region ? [\"output.region\" as const] : []),\n ...(needsAuto ? [\"output.whiteBalance.auto\" as const] : []), ...(ahd ? [\"output.demosaic.ahd\" as const] : []),\n ...(highlightMode === \"reconstruct\" ? [\"output.highlightMode.reconstruct\" as const] : []), ...(wideGamut ? [\"output.colorEncoding.wide-gamut\" as const] : []),\n ...(perceptual ? [\"output.gamutMapping.perceptual\" as const] : []), ...(format === \"jpeg\" || format === \"png\" || format === \"dng\" ? [\"output.format.\" + format as SimulateCaptureCostOption] : [])]);\n return Object.freeze({\n facadeVersion: SIMULATE_CAPTURE_FACADE_VERSION, engineApiVersion: ENGINE_API_VERSION,\n image: { width: outputWidth, height: outputHeight, format, samples: developed.integerSamples, ...(jpeg ? { jpeg } : {}), ...(png ? { png, colorEncoding: colorEncoding! } : {}), ...(dng ? { dng: dng.bytes } : {}) },\n raw: developed.raw, plan: developmentPlan,\n ...(region && regionNative ? { region: { ...region, frameWidth: width, frameHeight: height, nativeRect: { ...regionNative } } } : {}),\n request: { environmentRaw: finalRawInput, siteInput, development, whiteBalanceState,\n ...(diffraction ? { diffraction: { profile: diffraction, psf: diffractionPsf!, execution: diffractionObjectSpace ? \"object-space-convolution\" as const : \"environment-psf-quadrature\" as const } } : {}) },\n exposure: { mode, settings: { fNumber, shutterSeconds, iso: resolvedIso }, ev100: Math.log2(fNumber ** 2 / shutterSeconds), ...isoReport,\n metering, meteredSceneLuminanceCdPerSquareMeter: meteredLuminance, standardExposureDeviationStops: exposureDeviationStops,\n standardExposureIlluminanceLux: exposureIlluminanceLux, greyCardDeviationStops: exposureGreyCardDeviationStops, resolution },\n scene: { sceneId: chart ? \"chart:\" + chart.preset : callerScene!.sceneId, preset: scenePreset, parameters: chart ? chart.parameters : {},\n illuminant: { id: illuminant.id, description: illuminant.description, illuminanceLux }, distanceM: subjectDistanceM,\n framedWidthM: 2 * metresPerFrameUnit, framedHeightM: 2 * metresPerFrameUnit * aspect, ...(chartReport ? { chart: chartReport } : {}), sourceSha256 },\n diagnostics: { providerEvaluationCount, highlight: developed.highlight, rendering: developed.diagnostics, ...(gamutMappingDiagnostics ? { gamutMapping: gamutMappingDiagnostics } : {}),\n timingsMs: { raw: rawMs, whiteBalance: wbMs, development: devMs, jpeg: jpegMs, total: Date.now() - started,\n ...(diffraction && diffractionObjectSpace && !defocusSiteKernels ? { diffraction: diffractionMs } : {}), ...(defocusSiteKernels ? { defocus: defocusMs } : {}), ...(demosaicMs === undefined ? {} : { demosaic: demosaicMs }),\n ...(encodeMs === undefined ? {} : { encode: encodeMs }) },\n options: Object.freeze(SIMULATE_CAPTURE_COST_OPTIONS.filter((option) => ranOptions.has(option))), fast: fastReport },\n provenance: { scientificStatus: \"approximation\" as const, cameraPresetId: preset.presetId, cameraPresetVersion: preset.presetVersion,\n evidence: [...FACADE_EVIDENCE, ...preset.evidence],\n composedContracts: [\"resolveGenericEquipmentExposureCapabilities\", \"meterRelativeExposure\", \"createExposureMeterTargetFromMeteringResult\",\n \"resolve\" + (mode === \"manual\" ? \"Manual\" : mode === \"aperture-priority\" ? \"AperturePriority\" : mode === \"shutter-priority\" ? \"ShutterPriority\" : \"ProgramAuto\") + \"ExposureMode\",\n ...(rollingSchedule ? [\"resolveElectronicRollingShutterExposureSchedule\", \"createRollingShutterCaptureExposureSchedule\"] : []),\n ...(diffraction ? [\"createDiffractionLimitedPsfProfile\", ...(diffractionObjectSpace ? [\"resolveLensPsfConvolutionKernels\", ...(defocusSiteKernels ? [] : [\"calculateIrradianceConvolution\"])] : [])] : []),\n ...(defocusSiteKernels ? [\"calculateDefocusCircle\", \"defocus disc site kernel (object-space convolution)\"] : []),\n ...(antiAliasing ? [\"resolveAntiAliasingSpatialKernel\"] : []), \"resolveGenericIsoSignalChain\", \"createNativeEnvironmentRawTask\", ...(needsAuto ? [\"estimateAutoWhiteBalance\"] : []),\n ...(builtInDemosaic ? [\"createBuiltInBayerDemosaicProfiles\"] : []), ...(ahd ? [\"createAhdDemosaicTask\"] : []),\n ...(ahd ? [\"native RAW development operator (colour, after AHD)\", ...(linearPath ? [\"resolveRgbColorSpace\", ...(perceptual ? [\"prepareRgbGamutMapping\"] : [])] : [\"SDR rendering kernel\"])] : linearPath ? [\"native RAW development operator (linear, pre-clip)\", \"resolveRgbColorSpace\", ...(perceptual ? [\"prepareRgbGamutMapping\"] : [])] : [\"createNativeRawDevelopmentTask\"]),\n ...(jpeg ? [\"createPrintJpegTask\"] : []), ...(png ? [\"serializePngImage\"] : []), ...(dng ? [\"resolveSensorReadoutRegime\", \"serializeNativeRawDng\"] : [])],\n limitations: [\"Educational approximation: synthetic tier sensor values, idealized colorimetric sensor, planar Lambertian scene and point optics; not a calibrated camera emulation.\",\n \"Not offered by the facade: atmospheric haze and polarizers (the scene-radiance provider contract declares no volumetric transport or polarization), flash, video, HDR brackets and processing operators; compose those APIs directly.\"] },\n assumptions: Object.freeze(assumptions.map((a) => Object.freeze(a)))\n });\n}\n\n/** Chart preset ids accepted by `simulateCapture({ scene: { preset } })`. */\nexport const SIMULATE_CAPTURE_CHART_PRESETS = CHART_SCENE_PRESETS;\n"]}