@photivra/engine 2.16.0 → 2.18.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 (107) hide show
  1. package/CHANGELOG.md +104 -1
  2. package/CITATION.cff +1 -1
  3. package/README.md +6 -6
  4. package/SECURITY.md +1 -1
  5. package/THIRD_PARTY.md +24 -0
  6. package/dist/camera/lens-projection.d.ts +5 -0
  7. package/dist/camera/lens-projection.js +10 -0
  8. package/dist/camera/lens-projection.js.map +1 -1
  9. package/dist/camera/sensor-equivalence.d.ts +156 -0
  10. package/dist/camera/sensor-equivalence.js +208 -0
  11. package/dist/camera/sensor-equivalence.js.map +1 -0
  12. package/dist/capture/native-environment-tabulated.d.ts +5 -0
  13. package/dist/capture/native-environment-tabulated.js +1 -1
  14. package/dist/capture/native-environment-tabulated.js.map +1 -1
  15. package/dist/core/version.d.ts +1 -1
  16. package/dist/core/version.js +1 -1
  17. package/dist/core/version.js.map +1 -1
  18. package/dist/equipment/generic-lens-catalogue.d.ts +227 -0
  19. package/dist/equipment/generic-lens-catalogue.js +243 -0
  20. package/dist/equipment/generic-lens-catalogue.js.map +1 -0
  21. package/dist/equipment/ideal-lens.d.ts +25 -0
  22. package/dist/equipment/ideal-lens.js +21 -0
  23. package/dist/equipment/ideal-lens.js.map +1 -0
  24. package/dist/facade/catalogue-lens-signal.d.ts +94 -0
  25. package/dist/facade/catalogue-lens-signal.js +362 -0
  26. package/dist/facade/catalogue-lens-signal.js.map +1 -0
  27. package/dist/facade/defocus-bokeh-zones.d.ts +33 -0
  28. package/dist/facade/defocus-bokeh-zones.js +53 -0
  29. package/dist/facade/defocus-bokeh-zones.js.map +1 -0
  30. package/dist/facade/defocus-image-space-provider.d.ts +9 -0
  31. package/dist/facade/defocus-image-space-provider.js +101 -9
  32. package/dist/facade/defocus-image-space-provider.js.map +1 -1
  33. package/dist/facade/diffraction-provider.d.ts +29 -0
  34. package/dist/facade/diffraction-provider.js +117 -11
  35. package/dist/facade/diffraction-provider.js.map +1 -1
  36. package/dist/facade/display-view-gpu-session.js +4 -0
  37. package/dist/facade/display-view-gpu-session.js.map +1 -1
  38. package/dist/facade/display-view-gpu.d.ts +10 -0
  39. package/dist/facade/display-view-gpu.js.map +1 -1
  40. package/dist/facade/display-view-lens-signal.d.ts +61 -0
  41. package/dist/facade/display-view-lens-signal.js +502 -0
  42. package/dist/facade/display-view-lens-signal.js.map +1 -0
  43. package/dist/facade/expected-signal-setup.d.ts +15 -0
  44. package/dist/facade/expected-signal-setup.js +19 -2
  45. package/dist/facade/expected-signal-setup.js.map +1 -1
  46. package/dist/facade/expected-signal.d.ts +13 -0
  47. package/dist/facade/expected-signal.js +155 -1
  48. package/dist/facade/expected-signal.js.map +1 -1
  49. package/dist/facade/generic-lens-capture.d.ts +7 -0
  50. package/dist/facade/generic-lens-capture.js +9 -0
  51. package/dist/facade/generic-lens-capture.js.map +1 -0
  52. package/dist/facade/large-defocus-lattice.d.ts +39 -0
  53. package/dist/facade/large-defocus-lattice.js +64 -0
  54. package/dist/facade/large-defocus-lattice.js.map +1 -0
  55. package/dist/facade/scene-radiance.d.ts +5 -0
  56. package/dist/facade/scene-radiance.js +5 -2
  57. package/dist/facade/scene-radiance.js.map +1 -1
  58. package/dist/facade/simulate-capture.d.ts +67 -7
  59. package/dist/facade/simulate-capture.js +400 -64
  60. package/dist/facade/simulate-capture.js.map +1 -1
  61. package/dist/facade/simulate-display-view.js +23 -17
  62. package/dist/facade/simulate-display-view.js.map +1 -1
  63. package/dist/gpu/display-view-quality-gpu.d.ts +0 -9
  64. package/dist/gpu/display-view-quality-gpu.js +6 -0
  65. package/dist/gpu/display-view-quality-gpu.js.map +1 -1
  66. package/dist/gpu/display-view-speed-gpu.js +2 -0
  67. package/dist/gpu/display-view-speed-gpu.js.map +1 -1
  68. package/dist/index.d.ts +6 -1
  69. package/dist/index.js +5 -0
  70. package/dist/index.js.map +1 -1
  71. package/dist/optics/defocus-bokeh-kernel.d.ts +207 -0
  72. package/dist/optics/defocus-bokeh-kernel.js +380 -0
  73. package/dist/optics/defocus-bokeh-kernel.js.map +1 -0
  74. package/dist/optics/defocus-disc-kernel.d.ts +41 -19
  75. package/dist/optics/defocus-disc-kernel.js +44 -23
  76. package/dist/optics/defocus-disc-kernel.js.map +1 -1
  77. package/dist/optics/generic-lens-psf.d.ts +68 -0
  78. package/dist/optics/generic-lens-psf.js +337 -0
  79. package/dist/optics/generic-lens-psf.js.map +1 -0
  80. package/dist/optics/illumination-vignetting.d.ts +6 -0
  81. package/dist/optics/illumination-vignetting.js +24 -7
  82. package/dist/optics/illumination-vignetting.js.map +1 -1
  83. package/dist/optics/sensor-environment-query.d.ts +6 -0
  84. package/dist/optics/sensor-environment-query.js +13 -6
  85. package/dist/optics/sensor-environment-query.js.map +1 -1
  86. package/dist/optics/site-kernel-runs.d.ts +77 -0
  87. package/dist/optics/site-kernel-runs.js +200 -0
  88. package/dist/optics/site-kernel-runs.js.map +1 -0
  89. package/dist/output/generic-lens-corrections.d.ts +24 -0
  90. package/dist/output/generic-lens-corrections.js +51 -0
  91. package/dist/output/generic-lens-corrections.js.map +1 -0
  92. package/docs/AGENT_GUIDE.md +4 -0
  93. package/docs/API_REFERENCE.md +77 -1
  94. package/docs/QUICK_START.md +305 -17
  95. package/docs/USAGE.md +98 -5
  96. package/docs/api/camera-sensor-equivalence.md +209 -0
  97. package/docs/api/core-version.md +1 -1
  98. package/docs/api/equipment-generic-lens-catalogue.md +281 -0
  99. package/docs/api/equipment-ideal-lens.md +26 -0
  100. package/docs/api/exports.json +202 -2
  101. package/docs/api/facade-simulate-capture.md +48 -4
  102. package/docs/api/optics-defocus-bokeh-kernel.md +145 -0
  103. package/docs/api/optics-defocus-disc-kernel.md +22 -15
  104. package/docs/api/optics-sensor-environment-query.md +6 -0
  105. package/docs/api/output-generic-lens-corrections.md +39 -0
  106. package/llms.txt +3 -0
  107. package/package.json +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"simulate-capture.js","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G,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, NATIVE_RAW_DEVELOPMENT_EXPOSURE_RANGE_STOPS, 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 { calculateDefocusFieldVariation, createDefocusImageSpaceProvider, prepareDefocusImageSpaceGeometry, type DefocusFieldVariation } from \"./defocus-image-space-provider.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 { applyDiffractionCorrection, defaultDiffractionCorrectionRadiusPixels, designDiffractionCorrectionFilter, parseDiffractionCorrectionSettings,\n parseUnsharpMaskSettings, renderSdrWithUnsharpMask, DEVELOPMENT_DETAIL_MODEL_VERSION, type DiffractionCorrectionSettings,\n type UnsharpMaskSettings } from \"../processing/development-detail.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;\n/**\n * `output.sharpening` (#552): unsharp mask y = x + amount·(x − G_σ∗x) where |x − G_σ∗x| ≥ threshold (GIMP and ImageMagick\n * unsharp mask), per channel on sRGB-encoded values in [0, 1], then clipped to [0, 1]. Every field is optional.\n */\nexport interface SimulateCaptureSharpening {\n /** Gaussian standard deviation σ in output pixels, (0, 8]; the kernel reaches ⌈3σ⌉. Default 1. */\n radiusPixels?: number;\n /** Gain on the detail signal, (0, 5]. Default 0.5. */\n amount?: number;\n /** Detail smaller than this (encoded units, [0, 1]) is left unchanged. Default 0 (every difference is sharpened). */\n threshold?: number;\n}\n/**\n * `output.diffractionCorrection` (#552): the Wiener–Tikhonov gain G(s) = min(maximumGain, H(s)(1 + α)/(H(s)² + α)) on the circular-pupil\n * OTF H at s = f/f_c, f_c = 1/(λ·N_w), as a (2R + 1)² FIR per channel. Every field is optional.\n */\nexport interface SimulateCaptureDiffractionCorrection {\n /** Design wavelength in nm, 380–780, used for all three channels. Default 550. */\n wavelengthNm?: number;\n /** α, an assumed noise-to-signal power ratio, 1e-4–1. Larger is safer and restores less. Default 0.01. */\n regularization?: number;\n /** Upper bound on the gain at any frequency, 1–10 (it bounds the noise amplification). Default 4. */\n maximumGain?: number;\n /** FIR radius R in pixels, 1–16. Default: the Airy pattern's third dark ring at the design wavelength, within 1–16. */\n kernelRadiusPixels?: number;\n}\n/** `diagnostics.detail` (#552): what the development detail stages did. Present only when one ran. */\nexport interface SimulateCaptureDetailDiagnostics {\n diffractionCorrection?: {\n /** Corrected linear samples below 0 (ringing below black; clipped later by gamut handling) and above the RAW white level 1. */\n negativeSampleCount: number;\n aboveWhiteSampleCount: number;\n /** The diffraction cut-off p/(λ·N_w) in cycles per pixel (Nyquist is 0.5); nothing beyond it is recovered. */\n cutoffCyclesPerPixel: number;\n /** Measured largest |response| of the filter, and largest |response| beyond the cut-off (null when the Nyquist square is inside it). */\n responsePeakGain: number;\n responseMaximumBeyondCutoff: number | null;\n };\n sharpening?: {\n /** Half-width ⌈3σ⌉ of the Gaussian in pixels. */\n kernelRadiusPixels: number;\n /** Samples changed by the mask, and samples left alone because their detail was under the threshold. */\n sharpenedSampleCount: number;\n thresholdHeldSampleCount: number;\n /** Sharpened samples clipped at 0 or 1. */\n clippedLowSampleCount: number;\n clippedHighSampleCount: number;\n /** Largest increase and decrease amount·detail before clipping, in encoded units: the halo strength. */\n maximumIncrease: number;\n maximumDecrease: number;\n };\n}\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 /**\n * Opt-in (#556) development exposure push in stops, −2 to +5 (`NATIVE_RAW_DEVELOPMENT_EXPOSURE_RANGE_STOPS`); default 0.\n * A linear gain 2^stops on the RAW after black subtraction and white normalization, before demosaic, white balance,\n * the highlight mode, colour, the tone curve and encoding, like a raw editor's exposure slider (\"brighten in development\").\n * A site pushed to or past white clips there and counts as saturated (`highlightMode: \"reconstruct\"` rolls it off);\n * raised shadows keep their real noise and ADC quantization. The RAW codes, `result.raw` and a DNG are not changed;\n * the developed samples (`image.samples`, also with format \"dng\"), JPEG, PNG, the ideal reference and the display view\n * honour it. Reported in the assumption `output.exposureCompensationStops`. 0 or omitted: byte-identical to before.\n */\n exposureCompensationStops?: number;\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 * Opt-in (#552) diffraction correction: a bounded, regularized deconvolution of the developed linear colour with the\n * diffraction OTF of the ideal circular pupil at the capture's working f-number (see {@link SimulateCaptureDiffractionCorrection}).\n * It runs after demosaic, colour and white balance and before the tone curve. Frequencies beyond the diffraction cut-off\n * 1/(λ·N_w) never reached the sensor and stay lost: the correction's design gain there is 0. Needs `lens.diffraction`.\n * Not combinable with `region`. The DNG's RAW codes are not changed. Default off.\n */\n diffractionCorrection?: SimulateCaptureDiffractionCorrection;\n /**\n * Opt-in (#552) unsharp mask (see {@link SimulateCaptureSharpening}) on the sRGB-encoded values after the tone curve and gamut\n * handling, before quantization. It raises edge contrast and creates halos; it adds no optical detail. sRGB output only\n * (not the wide-gamut or perceptual PNG paths); not combinable with `region`. The DNG's RAW codes are not changed. Default off.\n */\n sharpening?: SimulateCaptureSharpening;\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.diffractionCorrection\", \"output.sharpening\", \"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\" | \"image-space-convolution\" };\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 /** #552: present with output.diffractionCorrection or output.sharpening. */\n detail?: SimulateCaptureDetailDiagnostics;\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 before 2.15.0, once per request since), and in a CPU profile of the 96 × 64 Quality tile\n * that clone took about twice as long (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 * 2.15.0: profiles may hold up to 400 wavelengths (a 1 nm spectral step), so the cache also keeps at most\n * DIFFRACTION_PROFILE_CACHE_KERNEL_VALUES kernel values in all (wavelengths × (2R + 1)², summed), the most it could hold before\n * (8 profiles of 64 wavelengths at radius 32); the newest profile is always kept.\n */\nconst DIFFRACTION_PROFILE_CACHE_SIZE = 8;\nconst DIFFRACTION_PROFILE_CACHE_KERNEL_VALUES = 8 * 64 * 65 * 65;\nconst kernelValuesOf = (profile: DiffractionLimitedPsfProfile): number => profile.wavelengths.length * (2 * profile.kernelRadiusSamples + 1) ** 2;\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 let kernelValues = 0;\n for (const profile of diffractionProfileCache.values()) kernelValues += kernelValuesOf(profile);\n while (diffractionProfileCache.size > 1 && (diffractionProfileCache.size > DIFFRACTION_PROFILE_CACHE_SIZE || kernelValues > DIFFRACTION_PROFILE_CACHE_KERNEL_VALUES)) {\n const oldest = diffractionProfileCache.keys().next().value!;\n kernelValues -= kernelValuesOf(diffractionProfileCache.get(oldest)!);\n diffractionProfileCache.delete(oldest);\n }\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,\n ...(v.exposureGain === 1 ? {} : { exposureGain: v.exposureGain }) }, 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, ...(v.exposureGain === 1 ? {} : { exposureGain: v.exposureGain }) };\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 16: 256 real pixels where the display pixel has detail). */\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 /** #533: the saturated (clipped highlight) pixels of the real capture in the rendered region, as an expected value (see {@link DisplayViewHighlightDiagnostics}). */\n highlight: DisplayViewHighlightDiagnostics };\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/**\n * #533: the display view's highlight count. `simulateCapture` reports `diagnostics.highlight.saturatedPixelCount`, the\n * output pixels with at least one clipped contributing RAW site (a site flagged saturated or at the white level) counted on its\n * one noise sample (`sensor.noiseSeed`). The display view renders no RAW, so it reports that count's expected value over the\n * noise: Σ_j w_j·P_j over the real output pixels j of the rendered region, w_j the part of pixel j inside the region (1 inside,\n * a fraction at a region edge that cuts a real pixel) and P_j the probability, under the view's own site model (each site's\n * normalized value normal with its exact expected electrons, shot, dark, read and ADC noise, as the expected value uses), that at\n * least one site pixel j's demosaic reads is at or above the white level, the sites' noises independent. It is estimated as the\n * view's expected value is (`view.estimation`: exact over every real pixel, or the stratified samples), so it is not an integer.\n *\n * - Where every contributing site is far from white (more than 8.5 noise standard deviations either side) P_j is exactly 0 or 1,\n * and the expected count equals the capture's count of the same pixels exactly (they then have no noise to differ by).\n * - Regions are additive: the counts of regions that tile the view sum to the whole view's count (up to floating-point summation\n * order), each display pixel's share being the same in every region that renders it.\n * - With the bilinear demosaic the sites are the capture's own contributing sites. With AHD the capture counts every site within\n * 3 sites of the pixel (its interpolation reach, clipped to the raster); the view counts the 25–29 of those 49 that its AHD\n * candidates read, so its count can be lower where a clipped area ends in a corner or a speck 2–3 sites away diagonally\n * (an approximation; along a straight clipped edge the two agree).\n * - It never changes a sample of the view. On the GPU (`prepareDisplayView` with `gpu`) it is the CPU reference's value: the\n * kernel decides P_j only where it is certainly 0 or 1 and the host computes every other pixel's share with the reference.\n */\nexport interface DisplayViewHighlightDiagnostics {\n /** Expected number of saturated real output pixels in the rendered region (a non-negative real number; see above). */\n saturatedPixelCount: number;\n /** The statistic: always \"expected-value\" (the capture's own count is one noise sample of it). */\n statistic: \"expected-value\";\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 /** #556: the development exposure gain 2^output.exposureCompensationStops (1 without a push). */\n exposureGain: number;\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;\n imageSpace?: (disc: ResolvedDefocusDisc) => { options: readonly string[]; fieldVariation: DefocusFieldVariation } }): 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 // #548: with a lens field mapping, vignetting or camera rotation the capture applies the disc in image space, on the sensor's site lattice.\n if (input.imageSpace) {\n const { options, fieldVariation } = input.imageSpace(disc), v = fieldVariation, bounds: string[] = [];\n if (v.rotationMaximumDiameterChangeSites !== null) bounds.push(\"camera rotation: pitch or yaw tilts the scene plane in the rotated camera, so the disc of a scene point's \" +\n \"axial depth there differs from the disc used by at most \" + formatBound(v.rotationMaximumDiameterChangeSites) + \" sites over the rendered instants (0 for roll alone)\");\n if (v.distortionMaximumLocalScaleDeviation !== null) bounds.push(\"distortion: its local scale departs from 1 by at most \" + formatBound(v.distortionMaximumLocalScaleDeviation) +\n \" (fraction), the relative disc-size difference to a model that blurs the undistorted image and then distorts it\");\n if (v.projectionMaximumDiameterChangeSites !== null) bounds.push(\"non-rectilinear projection: the disc of the distance along each scene point's ray, instead of its axial depth, \" +\n \"differs by at most \" + formatBound(v.projectionMaximumDiameterChangeSites) + \" sites (a real lens of that projection may lie anywhere between the two)\");\n assume(\"lens.defocus\", \"model\", { ...value, execution: \"image-space-convolution\", combinedWithDiffraction: input.diffraction, imageSpaceOptions: [...options],\n fieldVariation: { ...fieldVariation } }, model +\n \"Applied as an image-space convolution (#548, with \" + options.join(\", \") + \"): for each spectral node (and, with camera rotation, each temporal midpoint, in that instant's camera frame) \" +\n \"the sensor-plane irradiance before any PSF, through the lens field mapping and the field throughput, is formed on the site lattice of the sensor and convolved with the disc, \" +\n \"the disc of the same diameter at every field point, centred on each point's chief ray. This is the environment PSF quadrature with the disc as a sampled PSF, summed in another order \" +\n \"(a test checks it to 1e-12 per site). Vignetting is applied at each scene point before the disc spreads its light (field throughput, as for any PSF); the disc does not take the \" +\n \"cat's-eye shape of mechanical vignetting. \" + (input.diffraction ? \"With lens.diffraction, each spectral node's diffraction kernel is convolved with the disc and applied as one \" +\n \"image-space kernel, a further approximation (the defocused wave PSF is not exactly the Airy pattern convolved with the disc). \" : \"\") +\n (bounds.length > 0 ? \"Field-variation bounds of the constant disc, on a \" + v.gridPointsPerSide + \" × \" + v.gridPointsPerSide + \" grid over the frame: \" + bounds.join(\"; \") + \". \" : \"\") +\n \"The disc kernel is a sampling of the disc on the site lattice, as on the object-space path.\");\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/** A field-variation bound for an explanation: 3 significant digits (the assumption value keeps the full number). */\nfunction formatBound(value: number): string {\n return value === 0 ? \"0\" : String(Number(value.toPrecision(3)));\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\", \"exposureCompensationStops\", \"whiteBalance\", \"jpegQuantizationStep\",\n \"colorEncoding\", \"bitDepth\", \"gamutMapping\", \"demosaic\", \"borderHandling\", \"dng\", \"maximumPixels\", \"region\", \"metadata\", \"diffractionCorrection\", \"sharpening\"]);\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 // #556: development exposure push, a gain on the normalized RAW before white balance. Opt-in: no assumption when omitted.\n let exposureCompensationStops = 0;\n if (outputOptions.exposureCompensationStops !== undefined) {\n const stops = outputOptions.exposureCompensationStops, range = NATIVE_RAW_DEVELOPMENT_EXPOSURE_RANGE_STOPS;\n if (typeof stops !== \"number\" || !Number.isFinite(stops) || stops < range.minimum || stops > range.maximum) fail(\"output.exposureCompensationStops must be a finite number from -2 to +5.\");\n exposureCompensationStops = stops;\n assume(\"output.exposureCompensationStops\", \"model\", { stops, gain: 2 ** stops, appliedTo: \"black-subtracted white-normalized RAW, before demosaic and white balance\",\n dng: format === \"dng\" ? \"unmodified RAW (the push is a development setting)\" : null },\n \"Development exposure push: each site's (code − black)/(white − black) is multiplied by 2^stops = \" + 2 ** stops + \" before demosaic, white balance, the highlight mode, colour, the tone curve and encoding, \" +\n \"like a raw editor's exposure slider. It is not a capture exposure: no photons are added, so raised shadows show the RAW's real shot, read and dark noise and its ADC quantization steps, scaled by the gain. \" +\n \"A site pushed to or past white clips at white and counts as saturated (highlightMode \\\"reconstruct\\\" rolls it off). The RAW codes are unchanged\" + (format === \"dng\" ? \", and the DNG holds the unmodified RAW.\" : \".\"));\n }\n const exposureGain = exposureCompensationStops === 0 ? 1 : 2 ** exposureCompensationStops;\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 // The environment queries each site at each aperture node minus each anti-aliasing split offset (sites, +x right, +y down).\n const 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 // 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 if (outputOptions.diffractionCorrection !== undefined || outputOptions.sharpening !== undefined)\n unsupported(\"output.diffractionCorrection or output.sharpening\", \"the development detail stages filter the whole developed capture image.\");\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 // Development detail (#552): opt-in sharpening and diffraction correction, validated before any scene work.\n let sharpening: UnsharpMaskSettings | undefined, diffractionCorrectionOption: (Omit<DiffractionCorrectionSettings, \"kernelRadiusPixels\"> & { kernelRadiusPixels?: number }) | undefined;\n if (outputOptions.diffractionCorrection !== undefined || outputOptions.sharpening !== undefined) {\n if (idealReference) fail(\"simulateIdealReference does not take output.diffractionCorrection or output.sharpening: a reference has no camera development.\");\n if (region) fail(\"output.diffractionCorrection and output.sharpening are not combinable with output.region: they filter across the whole developed image, so a region's edge pixels would differ from the whole render.\");\n }\n if (outputOptions.diffractionCorrection !== undefined) {\n if (diffractionRadiusOption === undefined) fail(\"output.diffractionCorrection needs lens.diffraction: it inverts the diffraction blur that option simulates.\");\n const o = allowKeys(outputOptions.diffractionCorrection, \"output.diffractionCorrection\", [\"wavelengthNm\", \"regularization\", \"maximumGain\", \"kernelRadiusPixels\"]);\n const parsed = parseDiffractionCorrectionSettings({\n wavelengthNm: pick(o, \"wavelengthNm\", \"output.diffractionCorrection.wavelengthNm\", 550, \"Design wavelength 550 nm, near the photopic peak, for all three channels: the real blur is polychromatic, and longer wavelengths have a lower cut-off than the one used here.\"),\n regularization: pick(o, \"regularization\", \"output.diffractionCorrection.regularization\", 0.01, \"Regularization α = 0.01: an assumed noise-to-signal power ratio of 1 %, a first-party choice, not a measurement of this capture's noise.\"),\n maximumGain: pick(o, \"maximumGain\", \"output.diffractionCorrection.maximumGain\", 4, \"Gain bound 4: no frequency is amplified more than 4×, which bounds the noise gain.\"),\n kernelRadiusPixels: o.kernelRadiusPixels === undefined ? 1 : o.kernelRadiusPixels as number }, \"output.diffractionCorrection\");\n diffractionCorrectionOption = { wavelengthNm: parsed.wavelengthNm, regularization: parsed.regularization, maximumGain: parsed.maximumGain,\n ...(o.kernelRadiusPixels === undefined ? {} : { kernelRadiusPixels: parsed.kernelRadiusPixels }) };\n }\n if (outputOptions.sharpening !== undefined) {\n if (linearPath) fail(\"output.sharpening runs on the sRGB SDR path only, not with a wide-gamut output.colorEncoding or output.gamutMapping \\\"perceptual\\\".\");\n const o = allowKeys(outputOptions.sharpening, \"output.sharpening\", [\"radiusPixels\", \"amount\", \"threshold\"]);\n sharpening = parseUnsharpMaskSettings({\n radiusPixels: pick(o, \"radiusPixels\", \"output.sharpening.radiusPixels\", 1, \"Unsharp-mask Gaussian σ = 1 output pixel (kernel reach 3 pixels).\"),\n amount: pick(o, \"amount\", \"output.sharpening.amount\", 0.5, \"Unsharp-mask amount 0.5: half the detail signal is added back.\"),\n threshold: pick(o, \"threshold\", \"output.sharpening.threshold\", 0, \"Unsharp-mask threshold 0: every difference is sharpened, including noise.\") }, \"output.sharpening\");\n }\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 // #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 // #548: a lens field mapping, vignetting or camera rotation breaks that, so the capture then applies the disc in image space, on the sensor's\n // site lattice (defocus-image-space-provider.ts). The display view refuses those options in any focus (above).\n const imageSpaceOptions = [...(lensFieldMapping ? [lensOptions.distortion !== undefined ? (lensOptions.projection !== undefined ? \"lens.projection, lens.distortion\" : \"lens.distortion\") : \"lens.projection\"] : []),\n ...(vignetting ? [\"lens.vignetting\"] : []), ...(rotating ? [\"camera rotation\"] : [])];\n const defocusGeometry = defocusModel !== undefined && !displayView && imageSpaceOptions.length > 0 ? prepareDefocusImageSpaceGeometry({ focalLengthMm, focusDistanceM,\n angularVelocityRadPerSec: angular, ...(lensFieldMapping ? { lensMapping: prepareEnvironmentLensFieldMapping(lensFieldMapping) } : {}), ...(vignetting ? { vignetting } : {}) }) : undefined;\n const defocusDisc = defocusModel === undefined ? undefined :\n resolveDefocusOption({ run, assume, focalLengthMm, fNumber, focusDistanceM, subjectDistanceM, pitch, diffraction: diffractionRadiusOption !== undefined,\n ...(defocusGeometry ? { imageSpace: (disc: ResolvedDefocusDisc): { options: readonly string[]; fieldVariation: DefocusFieldVariation } => {\n // Rotation with a rolling shutter: each row's instants differ, so one instant's image on the lattice would mix rows exposed at other times.\n if (rotating && shutterKind === \"rolling\") fail(\"simulateCapture does not support lens.defocus out of focus with camera rotation and motion.shutter \\\"rolling\\\": the disc is applied \" +\n \"to each temporal midpoint's image on the sensor lattice, and under a rolling shutter every row has its own instants, so each row would need its own image of the rows the disc \" +\n \"reaches (about 2R + 1 rows per row, R the kernel radius). Use motion.shutter \\\"global\\\", set lens.focusDistanceM equal to subjectDistanceM, or omit one of the options.\");\n const temporalMidpointsSeconds = rotating ? Array.from({ length: temporalSampleCount }, (_, i) => (i + 0.5) * (shutterSeconds / temporalSampleCount)) : [];\n return { options: imageSpaceOptions, fieldVariation: calculateDefocusFieldVariation({ geometry: defocusGeometry, ...(lensFieldMapping ? { lensMapping: prepareEnvironmentLensFieldMapping(lensFieldMapping) } : {}),\n focalLengthMm, fNumber, focusDistanceM, subjectDistanceM, pitchMicrometers: pitch, nativeWidth, nativeHeight, angularVelocityRadPerSec: angular, temporalMidpointsSeconds,\n diameterSites: disc.diameterSites, discAt: (distanceM) => resolveDefocusDisc({ focalLengthMm, aperture: fNumber, focusDistanceM, subjectDistanceM: distanceM, pitchMicrometers: pitch }).diameterSites }) };\n } } : {}) });\n const defocusImageSpace = defocusDisc !== undefined && defocusGeometry !== undefined;\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 exposureGain === 1 ? \"Developed linear sRGB/D65 with the RAW white level mapped to display white, no exposure push, out-of-gamut components clipped.\" :\n \"Developed linear sRGB/D65 with the RAW white level mapped to display white, no further exposure push after development (output.exposureCompensationStops acts on the RAW), 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, \" + (exposureGain === 1 ? \"no exposure push\" : \"after the development exposure push on the RAW\") + \") 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 ? [defocusImageSpace ? \"Radiance is the sensor-plane irradiance before any PSF convolved with the geometric defocus disc on the sensor's site lattice, divided by \" +\n \"the queried point's field factor (image-space convolution, lens.defocus).\" : \"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\" : defocusImageSpace ? \"image-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 defocusImageSpace ? \"Applied with lens.defocus as one image-space kernel per spectral node (the diffraction kernel convolved with the disc) on the sensor's site lattice (#548; see the lens.defocus assumption), \" +\n \"the same sum as the environment PSF quadrature with that kernel. \" :\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 the node's diffraction kernel convolved\n // with the disc, radius R_diffraction + R_defocus (built on first use, kept for the request). Object space, or image space (#548).\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 // #548: in image space the kernel reaches its radius (plus the anti-aliasing and pixel-aperture offsets) beyond the frame, so the lens\n // field mapping and the vignetting profile must cover the frame's corners plus that reach.\n if (defocusSiteKernels && defocusGeometry && defocusImageSpace) {\n const reach = defocusSiteKernels.radius + Math.max(0, ...queryOffsetsSites.map((o) => Math.ceil(Math.max(Math.abs(o.x), Math.abs(o.y)) - 1e-6))) + 0.5;\n const xMm = (nativeWidth / 2 + reach) * pitch / 1000, yMm = (nativeHeight / 2 + reach) * pitch / 1000;\n for (const [x, y] of [[-xMm, -yMm], [xMm, -yMm], [-xMm, yMm], [xMm, yMm]] as const) {\n try { defocusGeometry.lookOf(x, y, 0); } catch (error) {\n fail(\"lens.defocus out of focus with \" + imageSpaceOptions.join(\", \") + \" reads the scene through the lens up to \" + defocusSiteKernels.radius + \" sites beyond the frame (the \" +\n (diffraction ? \"kernel radius of the diffraction kernel convolved with the disc\" : \"disc's kernel radius\") + \"), and at the frame's corner plus that reach (\" +\n Math.hypot(x, y).toFixed(3) + \" mm from the axis) \" + (error as Error).message + \" Extend the profile's range, or bring the focus closer to the subject.\");\n }\n }\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 (defocusSiteKernels && defocusImageSpace ? { kind: \"not-applied\" as const, evidence, limitation: \"No environment PSF: lens defocus\" + (diffraction ? \" (with lens.diffraction)\" : \"\") +\n \" is applied upstream by the scene provider as an image-space convolution on the sensor's site lattice (lens.defocus).\" } : 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 // #548: the disc (or diffraction ⊛ disc) in image space, on the sensor's site lattice, through the mapping, field throughput and rotation.\n defocusSiteKernels && defocusGeometry && defocusImageSpace ? createDefocusImageSpaceProvider({ base: provider, geometry: defocusGeometry, siteKernels: defocusSiteKernels.at,\n wavelengthsNm: defocusSiteKernels.wavelengthsNm, kernelRadius: defocusSiteKernels.radius, nativeWidth, nativeHeight, sitePitchMicrometers: pitch, distanceM: subjectDistanceM,\n metresPerFrameUnit, queryOffsetsSites, timesPerBand: temporalSampleCount, onConvolution: (ms) => { defocusMs += ms; }, ...(window ? { window } : {}) }) :\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, exposureGain, 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 // #556: the development exposure push multiplies the normalized RAW before the white clip.\n const c = exposureGain === 1 ? sum.map((value) => Math.min(1, Math.max(0, value / (n * n)))) : sum.map((value) => Math.min(1, Math.max(0, value / (n * n) * exposureGain)));\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 ...(exposureCompensationStops === 0 ? {} : { exposureCompensationStops }),\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 // Development detail (#552): diffraction correction on the developed linear colour, then the unsharp mask between the sRGB\n // transfer and quantization. Both need the whole developed image, so a request with either develops through developLinearSrgb\n // (the native development's own operator); without them every path below is unchanged.\n const detailRequested = sharpening !== undefined || diffractionCorrectionOption !== undefined;\n const detailDiagnostics: SimulateCaptureDetailDiagnostics = {};\n let diffractionFilter: ReturnType<typeof designDiffractionCorrectionFilter> | undefined;\n if (diffractionCorrectionOption) {\n const workingFNumber = fNumber * imageDistanceMm / focalLengthMm;\n const settings: DiffractionCorrectionSettings = { ...diffractionCorrectionOption, kernelRadiusPixels: diffractionCorrectionOption.kernelRadiusPixels ??\n defaultDiffractionCorrectionRadiusPixels(workingFNumber, diffractionCorrectionOption.wavelengthNm, pitch) };\n if (diffractionCorrectionOption.kernelRadiusPixels === undefined) assume(\"output.diffractionCorrection.kernelRadiusPixels\", \"default\", settings.kernelRadiusPixels,\n \"FIR radius: the Airy pattern's third dark ring (3.2383·λ·N_w) at the design wavelength, in pixels, rounded up, within 1–16.\");\n diffractionFilter = designDiffractionCorrectionFilter({ workingFNumber, pixelPitchMicrometers: pitch, settings });\n assume(\"output.diffractionCorrection\", \"model\", { model: \"development-detail\", modelVersion: DEVELOPMENT_DETAIL_MODEL_VERSION, method: \"bounded-wiener-tikhonov-fir\",\n stage: \"linear colour after demosaic, colour and white balance; before the tone curve\", fNumber, workingFNumber, ...settings, pixelPitchMicrometers: pitch,\n cutoffCyclesPerPixel: diffractionFilter.cutoffCyclesPerPixel, nyquistCyclesPerPixel: 0.5, nyquistAreaBeyondCutoffFraction: diffractionFilter.nyquistAreaBeyondCutoffFraction,\n designPeakGain: diffractionFilter.designPeakGain, responsePeakGain: diffractionFilter.responsePeakGain, responseMaximumBeyondCutoff: diffractionFilter.responseMaximumBeyondCutoff,\n edgeHandling: \"clamp\", recoversBeyondCutoff: false },\n \"Deconvolution with the known diffraction OTF of an ideal, aberration-free circular pupil at the capture's working f-number N_w = N·v/f, H(s) = (2/π)(acos s − s√(1 − s²)), s = f/f_c, f_c = 1/(λ·N_w) \" +\n \"(MIT OpenCourseWare 2.71, lectures 21–22). Gain G = min(maximumGain, H(1 + α)/(H² + α)) (Wiener deconvolution with a constant noise-to-signal ratio α, as in scikit-image's Wiener–Hunt filter), \" +\n \"sampled, inverse transformed and truncated to a raised-cosine (2R + 1)² FIR with unit DC gain, applied to each linear channel with clamped edges. \" +\n \"The OTF is exactly zero beyond f_c: that detail never reached the sensor, and no correction restores it. The design gain there is 0; responseMaximumBeyondCutoff is the truncated FIR's leakage, which passes only noise and aliasing. \" +\n \"Below f_c the gain is bounded, so attenuated detail is only partly restored and noise is amplified by up to the measured responsePeakGain. \" +\n \"Not inverted: the pixel aperture, optical anti-aliasing filter, demosaic blur, defocus and aberrations. One design wavelength for all channels (the simulated blur is polychromatic).\");\n }\n const correctLinear = (rgb: Float64Array): Float64Array => {\n if (!diffractionFilter) return rgb;\n const corrected = applyDiffractionCorrection(rgb, outputWidth, outputHeight, diffractionFilter);\n detailDiagnostics.diffractionCorrection = { ...corrected.diagnostics, cutoffCyclesPerPixel: diffractionFilter.cutoffCyclesPerPixel,\n responsePeakGain: diffractionFilter.responsePeakGain, responseMaximumBeyondCutoff: diffractionFilter.responseMaximumBeyondCutoff };\n return corrected.samples;\n };\n if (sharpening) assume(\"output.sharpening\", \"model\", { model: \"development-detail\", modelVersion: DEVELOPMENT_DETAIL_MODEL_VERSION, method: \"unsharp-mask\", ...sharpening,\n kernelRadiusPixels: Math.ceil(3 * sharpening.radiusPixels), domain: \"srgb-encoded\", stage: \"after the tone curve, gamut handling and sRGB transfer; before quantization\", edgeHandling: \"clamp\" },\n \"Unsharp mask y = x + amount·(x − G_σ∗x) where |x − G_σ∗x| ≥ threshold (the GIMP and ImageMagick unsharp mask: radius, amount, threshold), per channel on the sRGB-encoded values in [0, 1], \" +\n \"separable Gaussian truncated at ⌈3σ⌉ with clamped edges, then clipped to [0, 1] and rounded. It raises contrast at edges and creates halos (overshoot and undershoot; see diagnostics.detail.sharpening) \" +\n \"and sharpens noise above the threshold. It adds no optical detail.\");\n if (detailRequested) assume(\"output.developmentOrder\", \"model\", [...(exposureGain === 1 ? [] : [\"development exposure push (RAW)\"]), \"demosaic\", \"colour and white balance\", ...(diffractionCorrectionOption ? [\"diffraction correction (linear)\"] : []),\n \"rendering exposure and tone curve\", \"gamut handling\", \"transfer function\", ...(sharpening ? [\"unsharp mask\"] : []), \"quantization\"],\n \"Development detail order: the deconvolution acts on linear light, where the blur is a convolution; the unsharp mask acts on the encoded values just before quantization.\" +\n (exposureGain === 1 ? \"\" : \" A development exposure push (output.exposureCompensationStops) scales the black-subtracted, white-normalized RAW first, so pushed sites clip at white before the deconvolution sees them.\"));\n if (ahd || (detailRequested && !linearPath)) {\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 }, ahd ? { yieldControl: (): Promise<void> => yieldControl(), checkAbort, onDemosaicMs: (ms: number): void => { demosaicMs = ms; } } : undefined);\n const rgb = correctLinear(linear.rgb);\n if (!linearPath && sharpening) {\n const rendered = renderSdrWithUnsharpMask(rgb, outputWidth, outputHeight, rendering, sharpening);\n detailDiagnostics.sharpening = rendered.sharpening;\n developed = { raw: rawOutput.raw, integerSamples: rendered.codes, highlight: linear.highlight, diagnostics: { renderingNegativeSampleCount: rendered.counts.negative,\n renderingAboveReferenceSampleCount: rendered.counts.above, toneChangedSampleCount: rendered.counts.changed, gamutClippedLowSampleCount: rendered.counts.low,\n gamutClippedHighSampleCount: rendered.counts.high, captureSaturation: \"consumed-in-raw-development\" } };\n } else 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(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(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(correctLinear(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] : []), ...(diffractionFilter ? [\"output.diffractionCorrection\" as const] : []),\n ...(sharpening ? [\"output.sharpening\" as const] : []), ...(format === \"jpeg\" || format === \"png\" || format === \"dng\" ? [\"output.format.\" + format as SimulateCaptureCostOption] : [])]);\n // #552: the detail stages' contracts, in execution order inside the development.\n const detailContracts = diffractionFilter ? [\"designDiffractionCorrectionFilter\", \"applyDiffractionCorrection\"] : [], sdrContract = sharpening ? \"renderSdrWithUnsharpMask\" : \"SDR rendering kernel\";\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 :\n defocusImageSpace ? \"image-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 ...(detailRequested ? { detail: Object.freeze(detailDiagnostics) } : {}),\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\", defocusImageSpace ? \"defocus disc site kernel (image-space convolution)\" : \"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)\", ...detailContracts, ...(linearPath ? [\"resolveRgbColorSpace\", ...(perceptual ? [\"prepareRgbGamutMapping\"] : [])] : [sdrContract])] :\n linearPath ? [\"native RAW development operator (linear, pre-clip)\", ...detailContracts, \"resolveRgbColorSpace\", ...(perceptual ? [\"prepareRgbGamutMapping\"] : [])] :\n detailRequested ? [\"native RAW development operator (linear, pre-clip)\", ...detailContracts, sdrContract] : [\"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,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UAAU,CAAC,CAAC,CAAC,CAAC,wBAAwB,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC;oBACpM,UAAU,CAAC,CAAC,CAAC,CAAC,oDAAoD,EAAE,GAAG,eAAe,EAAE,sBAAsB,EAAE,GAAG,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,wBAAwB,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;wBACpK,eAAe,CAAC,CAAC,CAAC,CAAC,oDAAoD,EAAE,GAAG,eAAe,EAAE,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC,gCAAgC,CAAC,CAAC;gBACjJ,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, type DisplayViewExpectedSignal, type DisplayViewExpectedSignalInput } from \"./expected-signal.js\";\nimport type { DisplayViewFastReport } from \"./display-view-gpu.js\";\nimport type { DisplayViewLensPsf } from \"./display-view-lens-signal.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, NATIVE_RAW_DEVELOPMENT_EXPOSURE_RANGE_STOPS, 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, defocusDiscKernelRadius, defocusDiscLimitMessage, requireDefocusDiscKernelRadius, resolveDefocusDisc, type DefocusDiscSiteKernel, type ResolvedDefocusDisc } from \"../optics/defocus-disc-kernel.js\";\nimport { calculateDefocusFieldVariation, createDefocusImageSpaceProvider, prepareDefocusImageSpaceGeometry, type DefocusFieldVariation } from \"./defocus-image-space-provider.js\";\nimport { createDiffractedPlanarProvider } from \"./diffraction-provider.js\";\nimport type { LargeDefocusKernel } from \"./large-defocus-lattice.js\";\nimport { DEFOCUS_DIRECT_KERNEL_MAXIMUM_RADIUS_SITES, siteKernelRuns } from \"../optics/site-kernel-runs.js\";\nimport { createDefocusBokehSiteKernel, resolveDefocusBokehOptions, type DefocusBokehOptions, type DefocusBokehSiteKernel, type ResolvedDefocusBokehOptions } from \"../optics/defocus-bokeh-kernel.js\";\nimport { planDefocusBokehZones, type DefocusBokehZonePlan } from \"./defocus-bokeh-zones.js\";\nimport { resolveGenericPrimeLens, type GenericPrimeLens } from \"../equipment/generic-prime-lenses.js\";\nimport { IDEAL_LENS_LIMITS } from \"../equipment/ideal-lens.js\";\nimport type { ResolvedGenericLens } from \"../equipment/generic-lens-catalogue.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 { applyDiffractionCorrection, defaultDiffractionCorrectionRadiusPixels, designDiffractionCorrectionFilter, parseDiffractionCorrectionSettings,\n parseUnsharpMaskSettings, renderSdrWithUnsharpMask, DEVELOPMENT_DETAIL_MODEL_VERSION, type DiffractionCorrectionSettings,\n type UnsharpMaskSettings } from \"../processing/development-detail.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/** `lens.catalogue` as a record (#568): the lens id as `kind` and the `fast` override (see {@link SimulateCaptureOptions.fast}). */\nexport interface SimulateCaptureLensCatalogueRecord { kind: string; fast?: boolean }\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;\n/**\n * `output.sharpening` (#552): unsharp mask y = x + amount·(x − G_σ∗x) where |x − G_σ∗x| ≥ threshold (GIMP and ImageMagick\n * unsharp mask), per channel on sRGB-encoded values in [0, 1], then clipped to [0, 1]. Every field is optional.\n */\nexport interface SimulateCaptureSharpening {\n /** Gaussian standard deviation σ in output pixels, (0, 8]; the kernel reaches ⌈3σ⌉. Default 1. */\n radiusPixels?: number;\n /** Gain on the detail signal, (0, 5]. Default 0.5. */\n amount?: number;\n /** Detail smaller than this (encoded units, [0, 1]) is left unchanged. Default 0 (every difference is sharpened). */\n threshold?: number;\n}\n/**\n * `output.diffractionCorrection` (#552): the Wiener–Tikhonov gain G(s) = min(maximumGain, H(s)(1 + α)/(H(s)² + α)) on the circular-pupil\n * OTF H at s = f/f_c, f_c = 1/(λ·N_w), as a (2R + 1)² FIR per channel. Every field is optional.\n */\nexport interface SimulateCaptureDiffractionCorrection {\n /** Design wavelength in nm, 380–780, used for all three channels. Default 550. */\n wavelengthNm?: number;\n /** α, an assumed noise-to-signal power ratio, 1e-4–1. Larger is safer and restores less. Default 0.01. */\n regularization?: number;\n /** Upper bound on the gain at any frequency, 1–10 (it bounds the noise amplification). Default 4. */\n maximumGain?: number;\n /** FIR radius R in pixels, 1–16. Default: the Airy pattern's third dark ring at the design wavelength, within 1–16. */\n kernelRadiusPixels?: number;\n}\n/** `diagnostics.detail` (#552): what the development detail stages did. Present only when one ran. */\nexport interface SimulateCaptureDetailDiagnostics {\n diffractionCorrection?: {\n /** Corrected linear samples below 0 (ringing below black; clipped later by gamut handling) and above the RAW white level 1. */\n negativeSampleCount: number;\n aboveWhiteSampleCount: number;\n /** The diffraction cut-off p/(λ·N_w) in cycles per pixel (Nyquist is 0.5); nothing beyond it is recovered. */\n cutoffCyclesPerPixel: number;\n /** Measured largest |response| of the filter, and largest |response| beyond the cut-off (null when the Nyquist square is inside it). */\n responsePeakGain: number;\n responseMaximumBeyondCutoff: number | null;\n };\n sharpening?: {\n /** Half-width ⌈3σ⌉ of the Gaussian in pixels. */\n kernelRadiusPixels: number;\n /** Samples changed by the mask, and samples left alone because their detail was under the threshold. */\n sharpenedSampleCount: number;\n thresholdHeldSampleCount: number;\n /** Sharpened samples clipped at 0 or 1. */\n clippedLowSampleCount: number;\n clippedHighSampleCount: number;\n /** Largest increase and decrease amount·detail before clipping, in encoded units: the halo strength. */\n maximumIncrease: number;\n maximumDecrease: number;\n };\n}\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 /**\n * Opt-in (#576): an ideal lens, an aberration-free thin lens of this physical focal length (1–4000 mm) on whatever sensor the\n * frame is (output width × height × pixel pitch; no crop-factor scaling), at any `fNumber` from f/0.5 to f/128\n * (`IDEAL_LENS_LIMITS`; beyond them the request is refused). It replaces the tier lens's focal length and f-number range (the\n * transmission is kept); shutter priority and program may choose any aperture in that range. Recorded in the `lens.ideal`\n * assumption. Its blur is that of `defocus`, `diffraction` and `vignetting`, the same models as with `prime`. It focuses at any\n * distance beyond the focal length (no minimum focus distance; `subjectDistanceM` must be at least twice the focal length, as for\n * every lens). Works in `simulateCapture` and the display view. Not combinable with `prime`, `catalogue` or `focalLengthMm`.\n * Optional `widestFNumber` and `narrowestFNumber` (within `IDEAL_LENS_LIMITS`, widest ≤ narrowest; each defaults to its bound)\n * narrow the range: `fNumber` must lie in it, and shutter priority and program choose apertures only in it. Default off.\n */\n ideal?: { focalLengthMm: number; widestFNumber?: number; narrowestFNumber?: number };\n /**\n * Opt-in (#549): a lens of the generic lens catalogue by id (`GENERIC_LENS_IDS`, for example \"pv-50-1.2-pro\" or \"pv-50-1.8\";\n * docs/LENS_CATALOGUE.md). Like `prime`, its focal length is the full-frame equivalent ÷ the simulated frame's diagonal crop\n * factor and it replaces the tier lens's focal length and f-number range (the transmission is kept). The capture renders the\n * lens's character, all labelled approximations: its PSF (diffraction with the lens's Seidel aberrations, axial and lateral\n * colour, at the resolved f-number and focus) through the environment PSF quadrature, its radial distortion, its vignetting\n * and, for the fisheyes, the equisolid projection. Flare, focus breathing and bokeh shape are not rendered. Not combinable\n * with `prime`, `focalLengthMm`, `projection`, `distortion`, `vignetting`, `psf`, `diffraction` or `pupilSampling` (the\n * lens sets them); `defocus` convolves the disc into the lens's PSF. The display view renders it with the PSF taken per field zone (#569; docs/DISPLAY_VIEW.md). Default off.\n * #568: the record form `{ kind: <lens id>, fast }` overrides the top-level `fast` flag for this option; the fast method\n * blends the PSF between exactly resolved kernels on a field grid and tabulates each site's expected signal\n * (docs/LENS_CATALOGUE.md, \"Fast method\").\n */\n catalogue?: string | SimulateCaptureLensCatalogueRecord;\n /**\n * Opt-in (#549), with `catalogue` only: a seeded autofocus error (`simulateGenericLensFocusError`). The focus distance becomes\n * the sampled one for (seed, shotIndex), reported in the `lens.focusScatter` assumption; it is visible with `defocus`. Default off.\n */\n focusScatter?: { seed: number; shotIndex?: 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 * Bokeh character (#553), each part off by default (without them the disc is unchanged, byte for byte): `blades` (a\n * polygonal or rounded-blade opening), `sphericalAberration` (primary W040: soft-edged blur on one side of the focus\n * plane, bright-rimmed on the other) and `catsEye` (mechanical vignetting clipping the pupil by field position; the\n * capture only, not with `diffraction`). See `calculateDefocusBokehKernel` and docs/QUICK_START.md, \"Bokeh character\".\n */\n defocus?: { model: \"geometric-disc\" } & DefocusBokehOptions;\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 /**\n * Opt-in (#556) development exposure push in stops, −2 to +5 (`NATIVE_RAW_DEVELOPMENT_EXPOSURE_RANGE_STOPS`); default 0.\n * A linear gain 2^stops on the RAW after black subtraction and white normalization, before demosaic, white balance,\n * the highlight mode, colour, the tone curve and encoding, like a raw editor's exposure slider (\"brighten in development\").\n * A site pushed to or past white clips there and counts as saturated (`highlightMode: \"reconstruct\"` rolls it off);\n * raised shadows keep their real noise and ADC quantization. The RAW codes, `result.raw` and a DNG are not changed;\n * the developed samples (`image.samples`, also with format \"dng\"), JPEG, PNG, the ideal reference and the display view\n * honour it. Reported in the assumption `output.exposureCompensationStops`. 0 or omitted: byte-identical to before.\n */\n exposureCompensationStops?: number;\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 * Opt-in (#552) diffraction correction: a bounded, regularized deconvolution of the developed linear colour with the\n * diffraction OTF of the ideal circular pupil at the capture's working f-number (see {@link SimulateCaptureDiffractionCorrection}).\n * It runs after demosaic, colour and white balance and before the tone curve. Frequencies beyond the diffraction cut-off\n * 1/(λ·N_w) never reached the sensor and stay lost: the correction's design gain there is 0. Needs `lens.diffraction`.\n * Not combinable with `region`. The DNG's RAW codes are not changed. Default off.\n */\n diffractionCorrection?: SimulateCaptureDiffractionCorrection;\n /**\n * Opt-in (#552) unsharp mask (see {@link SimulateCaptureSharpening}) on the sRGB-encoded values after the tone curve and gamut\n * handling, before quantization. It raises edge contrast and creates halos; it adds no optical detail. sRGB output only\n * (not the wide-gamut or perceptual PNG paths); not combinable with `region`. The DNG's RAW codes are not changed. Default off.\n */\n sharpening?: SimulateCaptureSharpening;\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. `lens.catalogue` has a fast method (#568); the other options run 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\", \"lens.catalogue\", \"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.diffractionCorrection\", \"output.sharpening\", \"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\", \"lens.catalogue\", \"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\" | \"image-space-convolution\" };\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 /** #552: present with output.diffractionCorrection or output.sharpening. */\n detail?: SimulateCaptureDetailDiagnostics;\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 before 2.15.0, once per request since), and in a CPU profile of the 96 × 64 Quality tile\n * that clone took about twice as long (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 * 2.15.0: profiles may hold up to 400 wavelengths (a 1 nm spectral step), so the cache also keeps at most\n * DIFFRACTION_PROFILE_CACHE_KERNEL_VALUES kernel values in all (wavelengths × (2R + 1)², summed), the most it could hold before\n * (8 profiles of 64 wavelengths at radius 32); the newest profile is always kept.\n */\nconst DIFFRACTION_PROFILE_CACHE_SIZE = 8;\nconst DIFFRACTION_PROFILE_CACHE_KERNEL_VALUES = 8 * 64 * 65 * 65;\nconst kernelValuesOf = (profile: DiffractionLimitedPsfProfile): number => profile.wavelengths.length * (2 * profile.kernelRadiusSamples + 1) ** 2;\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 let kernelValues = 0;\n for (const profile of diffractionProfileCache.values()) kernelValues += kernelValuesOf(profile);\n while (diffractionProfileCache.size > 1 && (diffractionProfileCache.size > DIFFRACTION_PROFILE_CACHE_SIZE || kernelValues > DIFFRACTION_PROFILE_CACHE_KERNEL_VALUES)) {\n const oldest = diffractionProfileCache.keys().next().value!;\n kernelValues -= kernelValuesOf(diffractionProfileCache.get(oldest)!);\n diffractionProfileCache.delete(oldest);\n }\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,\n ...(v.exposureGain === 1 ? {} : { exposureGain: v.exposureGain }) }, 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, ...(v.exposureGain === 1 ? {} : { exposureGain: v.exposureGain }) };\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 16: 256 real pixels where the display pixel has detail). */\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 /** #533: the saturated (clipped highlight) pixels of the real capture in the rendered region, as an expected value (see {@link DisplayViewHighlightDiagnostics}). */\n highlight: DisplayViewHighlightDiagnostics };\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/**\n * #533: the display view's highlight count. `simulateCapture` reports `diagnostics.highlight.saturatedPixelCount`, the\n * output pixels with at least one clipped contributing RAW site (a site flagged saturated or at the white level) counted on its\n * one noise sample (`sensor.noiseSeed`). The display view renders no RAW, so it reports that count's expected value over the\n * noise: Σ_j w_j·P_j over the real output pixels j of the rendered region, w_j the part of pixel j inside the region (1 inside,\n * a fraction at a region edge that cuts a real pixel) and P_j the probability, under the view's own site model (each site's\n * normalized value normal with its exact expected electrons, shot, dark, read and ADC noise, as the expected value uses), that at\n * least one site pixel j's demosaic reads is at or above the white level, the sites' noises independent. It is estimated as the\n * view's expected value is (`view.estimation`: exact over every real pixel, or the stratified samples), so it is not an integer.\n *\n * - Where every contributing site is far from white (more than 8.5 noise standard deviations either side) P_j is exactly 0 or 1,\n * and the expected count equals the capture's count of the same pixels exactly (they then have no noise to differ by).\n * - Regions are additive: the counts of regions that tile the view sum to the whole view's count (up to floating-point summation\n * order), each display pixel's share being the same in every region that renders it.\n * - With the bilinear demosaic the sites are the capture's own contributing sites. With AHD the capture counts every site within\n * 3 sites of the pixel (its interpolation reach, clipped to the raster); the view counts the 25–29 of those 49 that its AHD\n * candidates read, so its count can be lower where a clipped area ends in a corner or a speck 2–3 sites away diagonally\n * (an approximation; along a straight clipped edge the two agree).\n * - It never changes a sample of the view. On the GPU (`prepareDisplayView` with `gpu`) it is the CPU reference's value: the\n * kernel decides P_j only where it is certainly 0 or 1 and the host computes every other pixel's share with the reference.\n */\nexport interface DisplayViewHighlightDiagnostics {\n /** Expected number of saturated real output pixels in the rendered region (a non-negative real number; see above). */\n saturatedPixelCount: number;\n /** The statistic: always \"expected-value\" (the capture's own count is one noise sample of it). */\n statistic: \"expected-value\";\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. #553: with bokeh options, the shaped kernel. */\n defocus: (ResolvedDefocusDisc & { siteKernel?: DefocusDiscSiteKernel }) | undefined;\n /**\n * #563: with `lens.projection`, `lens.distortion`, `lens.vignetting` or camera rotation, the factory of the view's expected signal\n * through the lens (display-view-lens-signal.ts, loaded on demand); undefined without them (the rectilinear expected signal).\n */\n lens?: ((input: DisplayViewExpectedSignalInput, spanColumns?: number) => DisplayViewExpectedSignal) | undefined;\n /** #569: with `lens.catalogue`, the field-dependent PSF the lens signal reads (createDisplayViewLensPsf, display-view-lens-signal.ts); its axis kernels set the expected signal's lattice. */\n lensPsf?: DisplayViewLensPsf | 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 /** #556: the development exposure gain 2^output.exposureCompensationStops (1 without a push). */\n exposureGain: number;\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;\n imageSpace?: (disc: ResolvedDefocusDisc) => { options: readonly string[]; fieldVariation: DefocusFieldVariation };\n /** #553: the bokeh options as given, and (out of focus, where the kernel is applied) the shaped kernel's record and explanation. */\n bokehOptions?: ResolvedDefocusBokehOptions; bokeh?: (disc: ResolvedDefocusDisc) => { value: Record<string, unknown>; explanation: string } }): ResolvedDefocusDisc | undefined {\n const { run, assume, focalLengthMm, fNumber, focusDistanceM, subjectDistanceM, pitch } = input;\n const disc = resolveDefocusDisc({ focalLengthMm, aperture: fNumber, focusDistanceM, subjectDistanceM, pitchMicrometers: pitch });\n let radius: number;\n try { radius = requireDefocusDiscKernelRadius(disc.diameterSites); } catch { fail(\"lens.defocus: \" + defocusDiscLimitMessage(disc.diameterSites, disc.diameterMicrometers)); }\n let value: Record<string, unknown> = { 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 let 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 // #553: the bokeh options. Out of focus, where a kernel is applied, the shaped kernel replaces the disc and its record joins the value.\n let kernelRadius = radius;\n if (input.bokehOptions) {\n value = { ...value, bokeh: { options: input.bokehOptions } };\n if (disc.diameterSites > 0 && run !== \"ideal-reference\" && input.bokeh) {\n const shaped = input.bokeh(disc);\n value = { ...value, bokeh: shaped.value };\n model += shaped.explanation;\n kernelRadius = shaped.value.kernelRadiusSites as number;\n }\n }\n // #564: above the direct radius the kernel (the disc, or the shaped kernel of #553) is convolved by runs; the field is absent below it,\n // so those records are unchanged.\n if (kernelRadius > DEFOCUS_DIRECT_KERNEL_MAXIMUM_RADIUS_SITES) {\n value = { ...value, convolution: \"runs\" };\n model += \"The kernel radius is above 64 sites, so the kernel is convolved by runs (#564): each kernel row's run of equal weights is a difference of two prefix sums, \" +\n \"the other cells (the edge) are read one by one, and with lens.diffraction each node's diffraction kernel is applied after the defocus kernel. \" +\n \"That is the same sum as the direct convolution, regrouped (exact up to rounding, not an approximation). \";\n }\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); with a lens field mapping,\n // vignetting or rotation (#563) applied in image space as in the capture, so it records the capture's assumption below.\n if (run === \"display-view\" && !input.imageSpace) {\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 // #548: with a lens field mapping, vignetting or camera rotation the capture applies the disc in image space, on the sensor's site lattice.\n if (input.imageSpace) {\n const { options, fieldVariation } = input.imageSpace(disc), v = fieldVariation, bounds: string[] = [];\n if (v.rotationMaximumDiameterChangeSites !== null) bounds.push(\"camera rotation: pitch or yaw tilts the scene plane in the rotated camera, so the disc of a scene point's \" +\n \"axial depth there differs from the disc used by at most \" + formatBound(v.rotationMaximumDiameterChangeSites) + \" sites over the rendered instants (0 for roll alone)\");\n if (v.distortionMaximumLocalScaleDeviation !== null) bounds.push(\"distortion: its local scale departs from 1 by at most \" + formatBound(v.distortionMaximumLocalScaleDeviation) +\n \" (fraction), the relative disc-size difference to a model that blurs the undistorted image and then distorts it\");\n if (v.projectionMaximumDiameterChangeSites !== null) bounds.push(\"non-rectilinear projection: the disc of the distance along each scene point's ray, instead of its axial depth, \" +\n \"differs by at most \" + formatBound(v.projectionMaximumDiameterChangeSites) + \" sites (a real lens of that projection may lie anywhere between the two)\");\n assume(\"lens.defocus\", \"model\", { ...value, execution: \"image-space-convolution\", combinedWithDiffraction: input.diffraction, imageSpaceOptions: [...options],\n fieldVariation: { ...fieldVariation } }, model +\n \"Applied as an image-space convolution (#548, with \" + options.join(\", \") + \"): for each spectral node (and, with camera rotation, each temporal midpoint, in that instant's camera frame) \" +\n \"the sensor-plane irradiance before any PSF, through the lens field mapping and the field throughput, is formed on the site lattice of the sensor and convolved with the disc, \" +\n \"the disc of the same diameter at every field point, centred on each point's chief ray. This is the environment PSF quadrature with the disc as a sampled PSF, summed in another order \" +\n \"(a test checks it to 1e-12 per site). Vignetting is applied at each scene point before the disc spreads its light (field throughput, as for any PSF); the disc does not take the \" +\n \"cat's-eye shape of mechanical vignetting. \" + (input.diffraction ? \"With lens.diffraction, each spectral node's diffraction kernel is convolved with the disc and applied as one \" +\n \"image-space kernel, a further approximation (the defocused wave PSF is not exactly the Airy pattern convolved with the disc). \" : \"\") +\n (bounds.length > 0 ? \"Field-variation bounds of the constant disc, on a \" + v.gridPointsPerSide + \" × \" + v.gridPointsPerSide + \" grid over the frame: \" + bounds.join(\"; \") + \". \" : \"\") +\n \"The disc kernel is a sampling of the disc on the site lattice, as on the object-space path.\");\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/** A field-variation bound for an explanation: 3 significant digits (the assumption value keeps the full number). */\nfunction formatBound(value: number): string {\n return value === 0 ? \"0\" : String(Number(value.toPrecision(3)));\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 \"catalogue\", \"focusScatter\", \"ideal\"]);\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 // The simulated frame in mm (output width × height × pixel pitch), validated again below.\n const frameMm = (): { widthMm: number; heightMm: number } => {\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 return { widthMm: frameW * framePitch / 1000, heightMm: frameH * framePitch / 1000 };\n };\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 activeImagingArea = frameMm();\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 });\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 // Ideal lens (#576): a physical focal length on any frame, every f-number within IDEAL_LENS_LIMITS.\n let ideal: { id: string; name: string; focalLengthMm: number; widestFNumber: number; narrowestFNumber: number } | undefined;\n if (lensOptions.ideal !== undefined) {\n for (const key of [\"prime\", \"catalogue\", \"focalLengthMm\"]) if (lensOptions[key] !== undefined) fail(\"lens.ideal cannot be combined with lens.\" + key + \".\");\n const io = allowKeys(lensOptions.ideal, \"lens.ideal\", [\"focalLengthMm\", \"widestFNumber\", \"narrowestFNumber\"]), f = io.focalLengthMm, { focalLengthMm: b, fNumber: n } = IDEAL_LENS_LIMITS;\n if (!(typeof f === \"number\" && f >= b.minimum && f <= b.maximum)) fail(\"lens.ideal.focalLengthMm must be \" + b.minimum + \"–\" + b.maximum + \" mm (IDEAL_LENS_LIMITS).\");\n // #576 (owner, 2026-11-09): an optional f-number range within IDEAL_LENS_LIMITS, for the automatic exposure modes; default the whole range.\n const ranged = io.widestFNumber !== undefined || io.narrowestFNumber !== undefined, lo = io.widestFNumber === undefined ? n.minimum : io.widestFNumber, hi = io.narrowestFNumber === undefined ? n.maximum : io.narrowestFNumber;\n if (!(typeof lo === \"number\" && typeof hi === \"number\" && lo >= n.minimum && hi <= n.maximum && lo <= hi))\n fail(\"lens.ideal.widestFNumber and narrowestFNumber must be f-numbers in f/\" + n.minimum + \"–f/\" + n.maximum + \" (IDEAL_LENS_LIMITS), the widest no larger than the narrowest.\");\n const lensId = \"ideal-\" + f + \"mm\";\n ideal = { id: lensId, name: lensId, focalLengthMm: f as number, widestFNumber: lo as number, narrowestFNumber: hi as number };\n assume(\"lens.ideal\", \"model\", { lensId, focalLengthMm: f, ...(ranged ? { widestFNumber: lo, narrowestFNumber: hi } : {}) }, \"Ideal thin lens without aberrations (not a real product) at this physical focal length\" +\n (ranged ? \", f/\" + lo + \"–f/\" + hi : \"\") + \"; the tier lens's transmission is kept.\");\n }\n // Generic lens catalogue (#549): resolved on the simulated frame like the prime; its character is built once the f-number is known.\n let catalogue: ResolvedGenericLens | undefined, catalogueFrame: { widthMm: number; heightMm: number } | undefined;\n let lensKit: typeof import(\"./generic-lens-capture.js\") | undefined;\n // #568: the shorthand id or the record { kind: <id>, fast }.\n let catalogueId: string | undefined, catalogueFast: boolean | undefined;\n if (lensOptions.catalogue !== undefined && typeof lensOptions.catalogue === \"object\" && lensOptions.catalogue !== null) {\n const record = allowKeys(lensOptions.catalogue, \"lens.catalogue\", [\"kind\", \"fast\"]);\n if (typeof record.kind !== \"string\") fail(\"lens.catalogue.kind must be a catalogue lens id (GENERIC_LENS_IDS).\");\n catalogueId = record.kind; catalogueFast = fastOverride(record, \"lens.catalogue\");\n } else if (lensOptions.catalogue !== undefined) catalogueId = lensOptions.catalogue as string;\n if (lensOptions.catalogue !== undefined) {\n for (const key of [\"prime\", \"focalLengthMm\", \"projection\", \"distortion\", \"vignetting\", \"psf\", \"diffraction\", \"pupilSampling\"])\n if (lensOptions[key] !== undefined) fail(\"lens.catalogue cannot be combined with lens.\" + key + \": the catalogue lens sets its own focal length, projection, distortion, vignetting and PSF (with diffraction).\");\n catalogueFrame = frameMm();\n lensKit = await import(\"./generic-lens-capture.js\");\n catalogue = lensKit.resolveGenericLens({ lensId: catalogueId as string, activeImagingArea: catalogueFrame });\n assume(\"lens.catalogue\", \"model\", { lensId: catalogue.lensId, name: catalogue.name, set: catalogue.set, kind: catalogue.kind, equivalentFocalLengthMm: catalogue.equivalentFocalLengthMm,\n focalLengthMm: catalogue.focalLengthMm, cropFactor35Mm: catalogue.cropFactor35Mm, widestFNumber: catalogue.widestFNumber, narrowestFNumber: catalogue.narrowestFNumber,\n minimumFocusDistanceM: catalogue.minimumFocusDistanceM, maximumMagnification: catalogue.maximumMagnification, projection: catalogue.projection, fisheyeImage: catalogue.fisheyeImage },\n \"Generic catalogue lens \" + catalogue.name + \" (#549; Photivra's own design, not a real product): focal length = equivalent ÷ the simulated frame's diagonal crop factor, f/\" +\n catalogue.widestFNumber + \"–f/\" + catalogue.narrowestFNumber + \", minimum focus max(0.10 m, f·(1 + 1/\" + catalogue.maximumMagnification + \")) (thin lens). Its character is a labelled \" +\n \"approximation (the lens.catalogue.character assumption). It replaces the tier lens's focal length and f-number range; the tier lens's transmission is kept.\");\n } else if (lensOptions.focusScatter !== undefined) fail(\"lens.focusScatter needs lens.catalogue: the focus scatter is a catalogue lens's own.\");\n const lensRange = prime ? { id: prime.lensId, name: prime.lensId, focalLengthMm: prime.focalLengthMm, widestFNumber: prime.widestFNumber, narrowestFNumber: prime.narrowestFNumber } :\n catalogue ? { id: catalogue.lensId, name: catalogue.name, focalLengthMm: catalogue.focalLengthMm, widestFNumber: catalogue.widestFNumber, narrowestFNumber: catalogue.narrowestFNumber } : ideal;\n const lensExposure = lensRange ? { ...lens.exposure, profileId: \"photivra-\" + lensRange.id + \":exposure\",\n focalLengthMmRange: { ...lens.exposure.focalLengthMmRange, value: { minimum: lensRange.focalLengthMm, maximum: lensRange.focalLengthMm } },\n aperture: { ...lens.exposure.aperture, widestAvailableFNumber: { kind: \"constant\" as const, fNumber: { value: lensRange.widestFNumber, evidence: FACADE_EVIDENCE } },\n narrowestAvailableFNumber: { value: lensRange.narrowestFNumber, evidence: FACADE_EVIDENCE } } } as typeof lens.exposure : lens.exposure;\n const focalDefault = lensExposure.focalLengthMmRange.value.minimum;\n const focalLengthMm = lensRange ? lensRange.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 // #569: twice the focal length itself is admitted (magnification 1, the catalogue Macro's close focus f·(1 + 1/1)).\n if (subjectDistanceM * 1000 < focalLengthMm * 2) fail(\"subjectDistanceM must be at least twice the focal length.\");\n let 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 if (catalogue && (subjectDistanceM < catalogue.minimumFocusDistanceM || focusDistanceM < catalogue.minimumFocusDistanceM))\n fail(\"The \" + catalogue.name + \" focuses no closer than \" + catalogue.minimumFocusDistanceM + \" m (max(0.10 m, f·(1 + 1/\" + catalogue.maximumMagnification +\n \"))); 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 ? (catalogue && catalogue.projection !== \"rectilinear\" ? catalogue.projection : undefined) :\n 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 // #549: a catalogue lens's distortion (and the fisheyes' projection) is set once its field reach is known (below); the mapping\n // stands in for it in the combination checks until then.\n if (catalogue) distortion = { kind: \"radial\", profile: lensKit!.genericLensDistortionProfile(catalogue.character.distortion.corner, catalogue.halfDiagonalMm) };\n let 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, defocusBokeh: ResolvedDefocusBokehOptions | undefined;\n if (lensOptions.defocus !== undefined) {\n const record = allowKeys(lensOptions.defocus, \"lens.defocus\", [\"model\", \"blades\", \"sphericalAberration\", \"catsEye\"]);\n if (record.model !== \"geometric-disc\") fail(\"lens.defocus.model must be \\\"geometric-disc\\\".\");\n // #553: the bokeh options; none given keeps the disc of #492 (byte-identical requests).\n if (record.blades !== undefined || record.sphericalAberration !== undefined || record.catsEye !== undefined) {\n const bokeh: Record<string, unknown> = { ...record };\n delete bokeh.model;\n try { defocusBokeh = resolveDefocusBokehOptions(bokeh, \"lens.defocus\"); } catch (error) { fail((error as Error).message); }\n if (defocusBokeh.catsEye && diffractionRadiusOption !== undefined) fail(\"lens.defocus.catsEye cannot be combined with lens.diffraction: the cat's eye varies over the field, \" +\n \"so each field zone would need its own diffraction kernel convolved with its clipped pupil at every spectral node. Omit one of the options.\");\n }\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 // #549: with a catalogue lens the disc is convolved into the lens's PSF (below), not applied by the lens.defocus paths. The bokeh\n // options (#553) shape the lens.defocus kernel only, so they are refused rather than dropped (a follow-up for a later release).\n if (catalogue && defocusBokeh) fail(\"lens.defocus.blades, sphericalAberration and catsEye cannot be combined with lens.catalogue: the catalogue lens \" +\n \"folds a plain disc into its own PSF. Omit the bokeh options, or use lens.focalLengthMm instead of the catalogue lens.\");\n if (!catalogue) 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\", \"exposureCompensationStops\", \"whiteBalance\", \"jpegQuantizationStep\",\n \"colorEncoding\", \"bitDepth\", \"gamutMapping\", \"demosaic\", \"borderHandling\", \"dng\", \"maximumPixels\", \"region\", \"metadata\", \"diffractionCorrection\", \"sharpening\"]);\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 // #556: development exposure push, a gain on the normalized RAW before white balance. Opt-in: no assumption when omitted.\n let exposureCompensationStops = 0;\n if (outputOptions.exposureCompensationStops !== undefined) {\n const stops = outputOptions.exposureCompensationStops, range = NATIVE_RAW_DEVELOPMENT_EXPOSURE_RANGE_STOPS;\n if (typeof stops !== \"number\" || !Number.isFinite(stops) || stops < range.minimum || stops > range.maximum) fail(\"output.exposureCompensationStops must be a finite number from -2 to +5.\");\n exposureCompensationStops = stops;\n assume(\"output.exposureCompensationStops\", \"model\", { stops, gain: 2 ** stops, appliedTo: \"black-subtracted white-normalized RAW, before demosaic and white balance\",\n dng: format === \"dng\" ? \"unmodified RAW (the push is a development setting)\" : null },\n \"Development exposure push: each site's (code − black)/(white − black) is multiplied by 2^stops = \" + 2 ** stops + \" before demosaic, white balance, the highlight mode, colour, the tone curve and encoding, \" +\n \"like a raw editor's exposure slider. It is not a capture exposure: no photons are added, so raised shadows show the RAW's real shot, read and dark noise and its ADC quantization steps, scaled by the gain. \" +\n \"A site pushed to or past white clips at white and counts as saturated (highlightMode \\\"reconstruct\\\" rolls it off). The RAW codes are unchanged\" + (format === \"dng\" ? \", and the DNG holds the unmodified RAW.\" : \".\"));\n }\n const exposureGain = exposureCompensationStops === 0 ? 1 : 2 ** exposureCompensationStops;\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 // The environment queries each site at each aperture node minus each anti-aliasing split offset (sites, +x right, +y down).\n const 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 // 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 (lensPsf) unsupported(\"lens.psf\", \"only the engine-built diffraction kernels (lens.diffraction) are tabulated.\");\n // #563: projection, distortion, vignetting and rotation are supported (display-view-lens-signal.ts), except rotation under a rolling shutter.\n if (rotating && shutterKind === \"rolling\") unsupported(\"camera rotation with motion.shutter \\\"rolling\\\"\", \"every row has its own instants, so the view's \" +\n \"scene points of one instant would mix rows exposed at other times; use motion.shutter \\\"global\\\" for the view.\");\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 if (outputOptions.diffractionCorrection !== undefined || outputOptions.sharpening !== undefined)\n unsupported(\"output.diffractionCorrection or output.sharpening\", \"the development detail stages filter the whole developed capture image.\");\n if (defocusBokeh?.catsEye) unsupported(\"lens.defocus.catsEye\", \"the expected-signal tables hold one kernel per spectral node, and the cat's eye varies over the field; \" +\n \"simulateCapture renders it. lens.defocus.blades and lens.defocus.sphericalAberration are supported.\");\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. Only lens.catalogue has a fast method (#568); it reports true below when it ran.\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 [\"lens.catalogue\", catalogue !== undefined, catalogueFast],\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 // #568: the catalogue's fast method, when requested (its record's flag, else the top-level one); whether it runs is decided with the RAW path.\n const catalogueFastRequested = catalogue !== undefined && (catalogueFast ?? fastTop);\n let fastReport: SimulateCaptureFastReport = Object.freeze({\n requested: fastTop || [diffractionFast, catalogueFast, 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 // Development detail (#552): opt-in sharpening and diffraction correction, validated before any scene work.\n let sharpening: UnsharpMaskSettings | undefined, diffractionCorrectionOption: (Omit<DiffractionCorrectionSettings, \"kernelRadiusPixels\"> & { kernelRadiusPixels?: number }) | undefined;\n if (outputOptions.diffractionCorrection !== undefined || outputOptions.sharpening !== undefined) {\n if (idealReference) fail(\"simulateIdealReference does not take output.diffractionCorrection or output.sharpening: a reference has no camera development.\");\n if (region) fail(\"output.diffractionCorrection and output.sharpening are not combinable with output.region: they filter across the whole developed image, so a region's edge pixels would differ from the whole render.\");\n }\n if (outputOptions.diffractionCorrection !== undefined) {\n if (diffractionRadiusOption === undefined) fail(\"output.diffractionCorrection needs lens.diffraction: it inverts the diffraction blur that option simulates.\");\n const o = allowKeys(outputOptions.diffractionCorrection, \"output.diffractionCorrection\", [\"wavelengthNm\", \"regularization\", \"maximumGain\", \"kernelRadiusPixels\"]);\n const parsed = parseDiffractionCorrectionSettings({\n wavelengthNm: pick(o, \"wavelengthNm\", \"output.diffractionCorrection.wavelengthNm\", 550, \"Design wavelength 550 nm, near the photopic peak, for all three channels: the real blur is polychromatic, and longer wavelengths have a lower cut-off than the one used here.\"),\n regularization: pick(o, \"regularization\", \"output.diffractionCorrection.regularization\", 0.01, \"Regularization α = 0.01: an assumed noise-to-signal power ratio of 1 %, a first-party choice, not a measurement of this capture's noise.\"),\n maximumGain: pick(o, \"maximumGain\", \"output.diffractionCorrection.maximumGain\", 4, \"Gain bound 4: no frequency is amplified more than 4×, which bounds the noise gain.\"),\n kernelRadiusPixels: o.kernelRadiusPixels === undefined ? 1 : o.kernelRadiusPixels as number }, \"output.diffractionCorrection\");\n diffractionCorrectionOption = { wavelengthNm: parsed.wavelengthNm, regularization: parsed.regularization, maximumGain: parsed.maximumGain,\n ...(o.kernelRadiusPixels === undefined ? {} : { kernelRadiusPixels: parsed.kernelRadiusPixels }) };\n }\n if (outputOptions.sharpening !== undefined) {\n if (linearPath) fail(\"output.sharpening runs on the sRGB SDR path only, not with a wide-gamut output.colorEncoding or output.gamutMapping \\\"perceptual\\\".\");\n const o = allowKeys(outputOptions.sharpening, \"output.sharpening\", [\"radiusPixels\", \"amount\", \"threshold\"]);\n sharpening = parseUnsharpMaskSettings({\n radiusPixels: pick(o, \"radiusPixels\", \"output.sharpening.radiusPixels\", 1, \"Unsharp-mask Gaussian σ = 1 output pixel (kernel reach 3 pixels).\"),\n amount: pick(o, \"amount\", \"output.sharpening.amount\", 0.5, \"Unsharp-mask amount 0.5: half the detail signal is added back.\"),\n threshold: pick(o, \"threshold\", \"output.sharpening.threshold\", 0, \"Unsharp-mask threshold 0: every difference is sharpened, including noise.\") }, \"output.sharpening\");\n }\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 ...(catalogue?.kind === \"fisheye\" ? { zeroBeyondHorizon: true as const } : {}) });\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 // #569: a lens whose range excludes f/8 (the catalogue's PV 800 9, f/9–f/32; an ideal lens with a narrowed range) takes the same reference\n // exposure at the aperture of its range nearest f/8, N0 with t = 1/125 s × (N0/8)², which has the same N²/t and so the same reference\n // luminance; every other request keeps f/8, 1/125 s.\n const referenceAperture = lensRange ? Math.min(lensRange.narrowestFNumber, Math.max(lensRange.widestFNumber, DEFAULTS.fNumber)) : DEFAULTS.fNumber;\n const reference = { aperture: referenceAperture, shutterSeconds: referenceAperture === DEFAULTS.fNumber ? DEFAULTS.shutterSeconds :\n DEFAULTS.shutterSeconds * (referenceAperture / DEFAULTS.fNumber) ** 2, 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 (referenceAperture === DEFAULTS.fNumber ? \".\" : \"; the lens excludes f/8: the same N²/t at f/\" + referenceAperture + \".\"));\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 const checkFNumber = (): void => {\n if (lensRange && (fNumber < lensRange.widestFNumber || fNumber > lensRange.narrowestFNumber))\n fail(\"lens.fNumber \" + fNumber + \" is outside the \" + lensRange.name + \" range f/\" + lensRange.widestFNumber + \"–f/\" + lensRange.narrowestFNumber + \".\");\n };\n if (mode === \"manual\" || mode === \"aperture-priority\") {\n fNumber = positive(pick(lensOptions, \"fNumber\", \"lens.fNumber\", DEFAULTS.fNumber, \"f/8.\"), \"lens.fNumber\");\n checkFNumber();\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 // #549: the catalogue lens's character at the resolved f-number and focus: focus scatter, the defocus disc folded into its PSF, then\n // its distortion and vignetting profiles over the field the PSF and the queries reach, and its PSF profile.\n let catalogueTaps: number | undefined, catalogueDefocusApplied = false, catalogueKernelRadius = 0;\n if (catalogue && lensKit) {\n const { GENERIC_LENS_EVIDENCE, genericLensDistortionProfile, genericLensVignettingProfile, resolveGenericLens, simulateGenericLensFocusError, createGenericLensPsfProfile,\n genericLensPsfKernelRadius, GENERIC_LENS_PSF_MAXIMUM_COMBINED_RADIUS_SITES } = lensKit;\n checkFNumber();\n if (lensOptions.focusScatter !== undefined) {\n const scatterOptions = allowKeys(lensOptions.focusScatter, \"lens.focusScatter\", [\"seed\", \"shotIndex\"]);\n const sample = simulateGenericLensFocusError({ lensId: catalogue.lensId, activeImagingArea: catalogueFrame!, fNumber, focusDistanceM, seed: scatterOptions.seed as number,\n ...(scatterOptions.shotIndex === undefined ? {} : { shotIndex: scatterOptions.shotIndex as number }) });\n assume(\"lens.focusScatter\", \"model\", { ...sample },\n \"Seeded autofocus error (an approximation of focus consistency): image-side error z·σ·2Nc with z a standard normal draw from the seed and shot index, σ = \" + sample.depthOfFocusFraction +\n \" of the depth of focus 2·N·c (c = the frame diagonal / 1500), read back through the thin lens. The focus distance \" + sample.intendedFocusDistanceM + \" m becomes \" + sample.focusDistanceM + \" m\" +\n (lensOptions.defocus === undefined ? \"; without lens.defocus the capture renders no defocus, so the image does not change.\" : \".\"));\n focusDistanceM = sample.focusDistanceM;\n }\n const character = resolveGenericLens({ lensId: catalogue.lensId, activeImagingArea: catalogueFrame!, fNumber, focusDistanceM });\n let extraKernel: { weights: Float64Array; radius: number } | undefined;\n if (lensOptions.defocus !== undefined) {\n const disc = resolveDefocusDisc({ focalLengthMm, aperture: fNumber, focusDistanceM, subjectDistanceM, pitchMicrometers: pitch });\n let discRadius: number;\n try { discRadius = requireDefocusDiscKernelRadius(disc.diameterSites); } catch { fail(\"lens.defocus: \" + defocusDiscLimitMessage(disc.diameterSites, disc.diameterMicrometers)); }\n const kernel = run === \"ideal-reference\" ? null : createDefocusDiscSiteKernel(disc.diameterSites);\n if (kernel) { extraKernel = { weights: kernel.weights, radius: kernel.radius }; catalogueDefocusApplied = true; }\n assume(\"lens.defocus\", \"model\", { model: \"geometric-disc\", scientificStatus: \"approximation\", diameterMicrometers: disc.diameterMicrometers, diameterSites: disc.diameterSites,\n kernelRadiusSites: disc.diameterSites === 0 ? null : discRadius, fNumber, focusDistanceM, subjectDistanceM, samplePitchMicrometers: pitch,\n defocusCircleModel: { id: \"thin-lens-defocus-circle\", version: \"1.1.0\" }, execution: \"catalogue-lens-psf\" },\n \"Geometric defocus of the flat scene plane (an approximation): the thin-lens blur circle c = f²·|s − d| / (N·d·(s − f)) (calculateDefocusCircle 1.1.0) as a uniform disc sampled on the site lattice. \" +\n (disc.diameterSites === 0 ? \"In focus: no disc is applied.\" : run === \"ideal-reference\" ? \"Resolved but not applied: the ideal reference has no camera effects.\" :\n \"With the catalogue lens the disc is convolved into every node of the lens's PSF (a further approximation: the defocused aberrated wave PSF is not exactly the in-focus PSF convolved with the disc) and applied through the environment PSF quadrature.\"));\n }\n // An upper bound of the PSF's radius (the built window may be narrower): the field reach below uses it.\n const kernelRadius = genericLensPsfKernelRadius({ lens: character, focusDistanceM, sitePitchMicrometers: pitch }) + (extraKernel ? extraKernel.radius : 0);\n // The field the PSF taps and the site queries reach: the native raster plus the kernel radius and the query offsets.\n const queryReach = Math.max(0, ...queryOffsetsSites.map((q) => Math.max(Math.abs(q.x), Math.abs(q.y))));\n const reachMm = (kernelRadius + queryReach + 1) * pitch / 1000;\n const frameHalfMm = { x: nativeWidth * pitch / 2000, y: nativeHeight * pitch / 2000 }, extentMm = { x: frameHalfMm.x + reachMm, y: frameHalfMm.y + reachMm };\n const reachRadius = Math.hypot(extentMm.x, extentMm.y) / catalogue.halfDiagonalMm;\n const b = 1 - 2 ** (-character.character.vignetting.cornerStops / 2);\n if (!(b * reachRadius * reachRadius < 0.98))\n fail(\"lens.catalogue: the \" + catalogue.name + \"'s vignetting E(ρ) = (1 − bρ²)² is defined inside ρ < \" + (1 / Math.sqrt(b)).toFixed(3) + \" of the frame's half-diagonal, and this frame's PSF reach goes to ρ = \" +\n reachRadius.toFixed(3) + \". Use a larger output (or smaller pixels' fewer sites of reach): the reach is \" + (kernelRadius + queryReach + 1) + \" sites beyond the frame.\");\n vignetting = genericLensVignettingProfile(character.character.vignetting.cornerStops, catalogue.halfDiagonalMm, reachRadius);\n const corner = character.character.distortion.corner;\n distortion = { kind: \"radial\", profile: genericLensDistortionProfile(corner, catalogue.halfDiagonalMm, corner < 0 ? reachRadius / (1 + corner * reachRadius * reachRadius) * 1.01 : reachRadius) };\n lensFieldMapping = { projectionModel: projection ?? \"rectilinear\", distortion, radiometricAreaCorrection: \"inverse-distortion-jacobian\",\n ...(catalogue.kind === \"fisheye\" ? { outsideImageCircle: \"backward-ray\" as const } : {}) };\n try { prepareEnvironmentLensFieldMapping(lensFieldMapping); } catch (error) { fail(\"lens.catalogue: the \" + catalogue.name + \"'s distortion over this frame's reach: \" + (error as Error).message); }\n const c = character.character;\n let psfReport: Record<string, unknown> | null = null;\n if (run !== \"ideal-reference\") {\n const built = createGenericLensPsfProfile({ lens: character, focusDistanceM, sitePitchMicrometers: pitch, fieldHalfExtentMm: extentMm, frameHalfMm, evidence: GENERIC_LENS_EVIDENCE,\n ...(extraKernel ? { extraKernel } : {}) });\n lensPsf = { kind: \"sampled-local\", configuration: { psf: { profile: built.profile, focalLengthMm, focus: { kind: \"finite\", distanceM: focusDistanceM }, apertureFNumber: fNumber,\n signedDefocusImagePlaneMicrometers: 0 }, psfWavelengthBasis: { value: \"vacuum\", evidence: GENERIC_LENS_EVIDENCE },\n spatialModel: { kind: \"destination-local-shift-invariant-approximation\", evidence: GENERIC_LENS_EVIDENCE,\n limitation: \"Catalogue lens PSF: a 5 × 5 field grid × 5 wavelengths, interpolated with centroid alignment; each site's PSF is that of its own field point.\" } } } as typeof lensPsf;\n if (built.kernelRadiusSites > GENERIC_LENS_PSF_MAXIMUM_COMBINED_RADIUS_SITES)\n fail(\"lens.catalogue with lens.defocus needs a PSF of radius \" + built.kernelRadiusSites + \" sites (the lens's \" + built.aberrationKernelRadiusSites + \" plus the disc's \" +\n (built.kernelRadiusSites - built.aberrationKernelRadiusSites) + \"), over the limit of \" + GENERIC_LENS_PSF_MAXIMUM_COMBINED_RADIUS_SITES + \" (\" + (2 * built.kernelRadiusSites + 1) ** 2 +\n \" scene queries per site and spectral node through the environment quadrature). Bring the focus closer to the subject, stop down, or use larger pixels.\");\n catalogueTaps = (2 * built.kernelRadiusSites + 1) ** 2; catalogueKernelRadius = built.kernelRadiusSites;\n psfReport = { aberrationKernelRadiusSites: built.aberrationKernelRadiusSites, kernelRadiusSites: built.kernelRadiusSites, maximumTruncatedEnergyFraction: built.maximumTruncatedEnergyFraction,\n fieldNodesMm: { x: built.fieldXmm, y: built.fieldYmm }, wavelengthNodesNm: built.wavelengthsNm, transformSize: built.transformSize, maximumPhaseStepWaves: built.maximumPhaseStepWaves };\n }\n assume(\"lens.catalogue.character\", \"model\", { lensId: catalogue.lensId, fNumber, focusDistanceM, magnification: c.magnification, closeFocusGain: c.closeFocusGain, pupilScale: c.pupilScale,\n aberrationsWaves550: { ...c.aberrations }, lateralColor: { ...c.lateralColor }, distortionCorner: c.distortion.corner, vignettingCornerStops: c.vignetting.cornerStops,\n notRendered: { strayLight: { ...c.strayLight }, breathing: { ...c.breathing }, focusScatterDepthOfFocusFraction: c.focusScatterDepthOfFocusFraction, bokeh: \"disc (#553)\" },\n psf: psfReport, profiles: { vignetting, distortion: distortion.profile, maximumNormalizedRadius: reachRadius } },\n \"The catalogue lens's character, a labelled approximation of a generic lens (docs/LENS_CATALOGUE.md): Seidel wave aberrations at the frame corner (spherical, balanced by defocus; coma; astigmatism; field curvature), \" +\n \"scaled from the widest aperture by the pupil ratio a = N0/N (a⁴, a³, a², a²) and by the close-focus factor; axial colour as a defocus and lateral colour as a radial shift, both with the normalised Cauchy dispersion. \" +\n (run === \"ideal-reference\" ? \"Not applied: the ideal reference has no camera effects. \" :\n \"Rendered as a sampled PSF (scalar Fraunhofer diffraction of the aberrated circular pupil, integrated over each site cell, on a 5 × 5 field grid × 5 wavelengths with centroid-aligned interpolation) \" +\n \"through the environment PSF quadrature (one scene query per kernel tap), with the lens's radial distortion (r_d = r·(1 + k1ρ²)) and relative illumination (E = (1 − bρ²)²) as lens field mapping and field throughput\" +\n (catalogue.kind === \"fisheye\" ? \", and the equisolid projection; directions at or beyond 90° see no scene (zero radiance), so a circular fisheye's image ends at its 180° circle\" : \"\") + \". \") +\n \"Flare, focus breathing and bokeh shape are reported, not rendered; ρ is normalised to the frame's half-diagonal, so the lens is scaled to the simulated frame like lens.prime.\");\n }\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 // #548: a lens field mapping, vignetting or camera rotation breaks that, so the capture then applies the disc in image space, on the sensor's\n // site lattice (defocus-image-space-provider.ts). #563: the display view reads the same geometry in any focus (display-view-lens-signal.ts).\n const imageSpaceOptions = [...(lensFieldMapping ? [lensOptions.distortion !== undefined ? (lensOptions.projection !== undefined ? \"lens.projection, lens.distortion\" : \"lens.distortion\") : \"lens.projection\"] : []),\n ...(vignetting ? [\"lens.vignetting\"] : []), ...(rotating ? [\"camera rotation\"] : [])];\n const lensGeometry = (defocusModel !== undefined || displayView) && imageSpaceOptions.length > 0 ? prepareDefocusImageSpaceGeometry({ focalLengthMm, focusDistanceM,\n angularVelocityRadPerSec: angular, ...(lensFieldMapping ? { lensMapping: prepareEnvironmentLensFieldMapping(lensFieldMapping) } : {}), ...(vignetting ? { vignetting } : {}) }) : undefined;\n const defocusGeometry = defocusModel !== undefined ? lensGeometry : undefined;\n // #553: the shaped kernel (on axis) and, with a cat's eye, its field zones; built when the disc is resolved out of focus.\n let bokehAxisKernel: DefocusBokehSiteKernel | undefined, bokehZones: DefocusBokehZonePlan | undefined;\n const bokehSummary = defocusBokeh === undefined ? undefined : (disc: ResolvedDefocusDisc): { value: Record<string, unknown>; explanation: string } => {\n const options = defocusBokeh!, side = subjectDistanceM > focusDistanceM ? 1 : -1;\n const build = (field?: { x: number; y: number }): DefocusBokehSiteKernel => {\n try {\n return createDefocusBokehSiteKernel({ diameterSites: disc.diameterSites, side, fNumber, focalLengthMm, pitchMicrometers: pitch, options, ...(field ? { field } : {}) });\n } catch (error) { const message = (error as Error).message; fail(message.startsWith(\"lens.defocus\") ? message : \"lens.defocus: \" + message); }\n };\n const axis = build();\n bokehAxisKernel = axis;\n // The run convolution above 64 sites (#564) takes one kernel for the whole frame; the cat's eye needs one per field zone.\n if (options.catsEye && !displayView && axis.radius > DEFOCUS_DIRECT_KERNEL_MAXIMUM_RADIUS_SITES)\n fail(\"lens.defocus.catsEye: the blur needs a kernel radius of \" + axis.radius + \" sites; with a cat's eye the limit is \" + DEFOCUS_DIRECT_KERNEL_MAXIMUM_RADIUS_SITES +\n \" sites (129 across). Reduce the defocus or omit catsEye.\");\n if (options.catsEye && !displayView) {\n // The field tangent of a native point (sites from the top-left corner), in output-image axes (+Y up): through the lens\n // mapping in image space (#548; at the exposure start, so camera rotation does not move the field), else the planar lattice's.\n const g = 2 / width, mmPerSite = pitch / 1000;\n const fieldOf = defocusGeometry ? (x: number, y: number): { x: number; y: number } => {\n const look = defocusGeometry.lookOf((x - nativeWidth / 2) * mmPerSite, (y - nativeHeight / 2) * mmPerSite, 0);\n return { x: look.x / look.z, y: look.y / look.z };\n } : (x: number, y: number): { x: number; y: number } => ({ x: (x - nativeWidth / 2) * g * metresPerFrameUnit / subjectDistanceM, y: -(y - nativeHeight / 2) * g * metresPerFrameUnit / subjectDistanceM });\n bokehZones = planDefocusBokehZones({ options, nativeWidth, nativeHeight, radius: axis.radius, fNumber, focalLengthMm, fieldOf, kernelAt: build });\n if (!(bokehZones.minimumOpenAreaRatio > 0)) fail(\"lens.defocus.catsEye: the clipping apertures close the pupil in part of the frame; reduce shiftPerTanFieldMm or enlarge radiusMm.\");\n }\n const zones = bokehZones;\n return { value: { options, side: side === 1 ? \"behind-focus\" : \"in-front-of-focus\", kernelRadiusSites: axis.radius, method: axis.method, raySamples: axis.raySamples,\n sphericalAberrationSites: axis.sphericalAberrationSites, axisOpenAreaRatio: axis.openAreaRatio,\n ...(zones ? { catsEye: { execution: \"piecewise-constant-field-zones\", zoneSizeSites: zones.zones.size, columns: zones.zones.columns, rows: zones.zones.rows,\n minimumOpenAreaRatio: zones.minimumOpenAreaRatio, largestAdjacentOpenAreaRatioChange: zones.largestAdjacentOpenAreaRatioChange, lightLossApplied: false } } : {}) },\n explanation: \"The kernel is shaped by the lens instead (#553, bokeh character; calculateDefocusBokehKernel): the projected open pupil \" +\n (options.blades ? \"(\" + options.blades.count + \" blades\" + (options.blades.curvature > 0 ? \", curvature \" + options.blades.curvature : \"\") +\n (options.blades.circularAtOrBelowFNumber !== null ? \", circular at or below f/\" + options.blades.circularAtOrBelowFNumber : \"\") + \", scaled to the disc's area) \" : \"(a circle) \") +\n \"of a point \" + (side === 1 ? \"behind\" : \"in front of\") + \" the focus plane\" + (side === 1 ? \"\" : \" (the pupil turned through 180°: the rays have not crossed yet)\") +\n (options.sphericalAberration ? \", with primary spherical aberration W040 \" + options.sphericalAberration.w040Micrometers + \" µm at f/\" + options.sphericalAberration.atFNumber +\n \" (\" + axis.sphericalAberrationSites + \" sites at the marginal ray here; ray map (σc/2 + bρ²)·P, rays binned per site cell)\" : \" (exact polygon area in each site's cell)\") +\n (zones ? \". Cat's eye: the pupil is clipped by \" + options.catsEye!.apertures.length + \" aperture(s) shifted by field position (calculateMechanicalVignetting's model), applied as \" +\n zones.zones.columns + \" × \" + zones.zones.rows + \" field zones of \" + zones.zones.size + \" sites, each with its centre's kernel (a piecewise-constant approximation; \" +\n \"the open-area ratio falls to \" + formatBound(zones.minimumOpenAreaRatio) + \" and changes by at most \" + formatBound(zones.largestAdjacentOpenAreaRatioChange) +\n \" between neighbouring zones). The kernel has unit sum: the light the clip removes is not applied; declare it with lens.vignetting\" : \"\") +\n \". A geometric approximation: no diffraction, onion rings, higher-order or field-dependent aberrations; the same kernel at every wavelength. \"\n };\n };\n const defocusDisc = defocusModel === undefined ? undefined :\n resolveDefocusOption({ run, assume, focalLengthMm, fNumber, focusDistanceM, subjectDistanceM, pitch, diffraction: diffractionRadiusOption !== undefined,\n ...(defocusBokeh ? { bokehOptions: defocusBokeh, bokeh: bokehSummary! } : {}),\n ...(defocusGeometry ? { imageSpace: (disc: ResolvedDefocusDisc): { options: readonly string[]; fieldVariation: DefocusFieldVariation } => {\n // Rotation with a rolling shutter: each row's instants differ, so one instant's image on the lattice would mix rows exposed at other times.\n if (rotating && shutterKind === \"rolling\") fail(\"simulateCapture does not support lens.defocus out of focus with camera rotation and motion.shutter \\\"rolling\\\": the disc is applied \" +\n \"to each temporal midpoint's image on the sensor lattice, and under a rolling shutter every row has its own instants, so each row would need its own image of the rows the disc \" +\n \"reaches (about 2R + 1 rows per row, R the kernel radius). Use motion.shutter \\\"global\\\", set lens.focusDistanceM equal to subjectDistanceM, or omit one of the options.\");\n const temporalMidpointsSeconds = rotating ? Array.from({ length: temporalSampleCount }, (_, i) => (i + 0.5) * (shutterSeconds / temporalSampleCount)) : [];\n return { options: imageSpaceOptions, fieldVariation: calculateDefocusFieldVariation({ geometry: defocusGeometry, ...(lensFieldMapping ? { lensMapping: prepareEnvironmentLensFieldMapping(lensFieldMapping) } : {}),\n focalLengthMm, fNumber, focusDistanceM, subjectDistanceM, pitchMicrometers: pitch, nativeWidth, nativeHeight, angularVelocityRadPerSec: angular, temporalMidpointsSeconds,\n diameterSites: disc.diameterSites, discAt: (distanceM) => resolveDefocusDisc({ focalLengthMm, aperture: fNumber, focusDistanceM, subjectDistanceM: distanceM, pitchMicrometers: pitch }).diameterSites }) };\n } } : {}) });\n const defocusImageSpace = defocusDisc !== undefined && defocusGeometry !== undefined;\n // #492: the disc on the site lattice (radius 0 for a disc inside one cell: the identity, still applied).\n // #553: the shaped kernel replaces the disc (with a cat's eye, the axis kernel; the zones replace it in the gather).\n const defocusKernel = defocusDisc && !displayView ? bokehAxisKernel ?? createDefocusDiscSiteKernel(defocusDisc.diameterSites) ?? undefined : undefined;\n // The display view's disc (#492, step 2b): its expected-signal tables apply it (simulate-display-view.ts); #553: or the shaped kernel.\n const displayViewDefocus = displayView ? (defocusDisc && bokehAxisKernel ? { ...defocusDisc, siteKernel: bokehAxisKernel } : 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 (catalogue) assume(\"lens.psf\", \"model\", lensPsf ? { kind: \"sampled-local\", source: \"lens.catalogue\" } : \"not-applied\", lensPsf ?\n \"The catalogue lens's engine-built sampled PSF (see lens.catalogue.character) redistributes irradiance through the environment PSF quadrature.\" : \"No lens PSF: the ideal reference has no camera effects.\");\n else 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 (catalogue ? \"The catalogue lens's\" : \"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 (catalogue ? \"The catalogue lens's \" : \"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 exposureGain === 1 ? \"Developed linear sRGB/D65 with the RAW white level mapped to display white, no exposure push, out-of-gamut components clipped.\" :\n \"Developed linear sRGB/D65 with the RAW white level mapped to display white, no further exposure push after development (output.exposureCompensationStops acts on the RAW), 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, \" + (exposureGain === 1 ? \"no exposure push\" : \"after the development exposure push on the RAW\") + \") 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 ? [defocusImageSpace ? \"Radiance is the sensor-plane irradiance before any PSF convolved with the geometric defocus disc on the sensor's site lattice, divided by \" +\n \"the queried point's field factor (image-space convolution, lens.defocus).\" : \"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\" : defocusImageSpace ? \"image-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 defocusImageSpace ? \"Applied with lens.defocus as one image-space kernel per spectral node (the diffraction kernel convolved with the disc) on the sensor's site lattice (#548; see the lens.defocus assumption), \" +\n \"the same sum as the environment PSF quadrature with that kernel. \" :\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 the node's diffraction kernel convolved\n // with the disc, radius R_diffraction + R_defocus (built on first use, kept for the request). Object space, or image space (#548).\n let defocusSiteKernels: { radius: number; wavelengthsNm: readonly number[]; at(wavelengthNm: number): Float64Array; large?: LargeDefocusKernel } | undefined;\n if (defocusKernel && defocusKernel.radius > DEFOCUS_DIRECT_KERNEL_MAXIMUM_RADIUS_SITES) {\n // #564: above the direct radius the disc is convolved by runs (site-kernel-runs.ts) and each node's diffraction kernel applied\n // after it, instead of one combined kernel per node: the same sums regrouped. `at` is never read on this path.\n const runs = siteKernelRuns(defocusKernel.weights, defocusKernel.radius), diffractionRadius = diffraction ? diffraction.kernelRadiusSamples : 0;\n const psfConfiguration = diffraction ? diffractionPsf!.configuration.psf : undefined, profileWavelengths = diffraction ? diffraction.profile.axes.wavelengthNm : quadratureWavelengths();\n const diffractionKernels = new Map<number, Float64Array>();\n defocusSiteKernels = { radius: diffractionRadius + defocusKernel.radius, wavelengthsNm: profileWavelengths, at: (): Float64Array => fail(\"simulateCapture: the large defocus kernel has no combined kernels.\"),\n large: { runs, ...(diffraction ? { diffraction: { radius: diffractionRadius, kernelAt(wavelengthNm: number): Float64Array {\n let kernel = diffractionKernels.get(wavelengthNm);\n if (!kernel) {\n if (!profileWavelengths.includes(wavelengthNm)) fail(\"simulateCapture: a spectral node has no diffraction kernel.\");\n kernel = siteDiffractionKernel(psfConfiguration!, wavelengthNm, pitch, diffractionRadius, \"simulateCapture: diffraction kernels must sample the site pitch exactly.\");\n diffractionKernels.set(wavelengthNm, kernel);\n }\n return kernel;\n } } } : {}) } };\n } else 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 // #548: in image space the kernel reaches its radius (plus the anti-aliasing and pixel-aperture offsets) beyond the frame, so the lens\n // field mapping and the vignetting profile must cover the frame's corners plus that reach.\n if (defocusSiteKernels && defocusGeometry && defocusImageSpace) {\n const reach = defocusSiteKernels.radius + Math.max(0, ...queryOffsetsSites.map((o) => Math.ceil(Math.max(Math.abs(o.x), Math.abs(o.y)) - 1e-6))) + 0.5;\n const xMm = (nativeWidth / 2 + reach) * pitch / 1000, yMm = (nativeHeight / 2 + reach) * pitch / 1000;\n for (const [x, y] of [[-xMm, -yMm], [xMm, -yMm], [-xMm, yMm], [xMm, yMm]] as const) {\n try { defocusGeometry.lookOf(x, y, 0); } catch (error) {\n fail(\"lens.defocus out of focus with \" + imageSpaceOptions.join(\", \") + \" reads the scene through the lens up to \" + defocusSiteKernels.radius + \" sites beyond the frame (the \" +\n (diffraction ? \"kernel radius of the diffraction kernel convolved with the disc\" : \"disc's kernel radius\") + \"), and at the frame's corner plus that reach (\" +\n Math.hypot(x, y).toFixed(3) + \" mm from the axis) \" + (error as Error).message + \" Extend the profile's range, or bring the focus closer to the subject.\");\n }\n }\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 (defocusSiteKernels && defocusImageSpace ? { kind: \"not-applied\" as const, evidence, limitation: \"No environment PSF: lens defocus\" + (diffraction ? \" (with lens.diffraction)\" : \"\") +\n \" is applied upstream by the scene provider as an image-space convolution on the sensor's site lattice (lens.defocus).\" } : 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 : catalogueTaps ?? 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 // #548: the disc (or diffraction ⊛ disc) in image space, on the sensor's site lattice, through the mapping, field throughput and rotation.\n defocusSiteKernels && defocusGeometry && defocusImageSpace ? createDefocusImageSpaceProvider({ base: provider, geometry: defocusGeometry, siteKernels: defocusSiteKernels.at,\n ...(defocusSiteKernels.large ? { largeKernel: defocusSiteKernels.large } : {}),\n wavelengthsNm: defocusSiteKernels.wavelengthsNm, kernelRadius: defocusSiteKernels.radius, nativeWidth, nativeHeight, sitePitchMicrometers: pitch, distanceM: subjectDistanceM,\n metresPerFrameUnit, queryOffsetsSites, timesPerBand: temporalSampleCount, onConvolution: (ms) => { defocusMs += ms; }, ...(window ? { window } : {}),\n ...(bokehZones ? { fieldZones: bokehZones.zones } : {}) }) :\n defocusSiteKernels ? createDiffractedPlanarProvider({ base: provider, siteKernels: defocusSiteKernels.at, ...(defocusSiteKernels.large ? { largeKernel: defocusSiteKernels.large } : {}),\n wavelengthsNm: defocusSiteKernels.wavelengthsNm, kernelRadius: defocusSiteKernels.radius, nativeWidth, nativeHeight, outputWidth: width,\n sitePitchMicrometers: pitch, distanceM: subjectDistanceM, metresPerFrameUnit, onConvolution: (ms) => { defocusMs += ms; },\n ...(window ? { window } : {}), ...(bokehZones ? { fieldZones: bokehZones.zones } : {}),\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 // #563: the view's expected signal through the lens, from the capture's own geometry (#548), checked to cover its farthest source point: the outer\n // site centre plus the kernel radius and the largest query offset.\n // #569: a catalogue lens's field-dependent PSF, read per field zone by the lens signal (display-view-lens-signal.ts, loaded on demand).\n const viewLensKit = displayView && lensGeometry ? await import(\"./display-view-lens-signal.js\") : undefined;\n const displayViewLensPsf = viewLensKit && catalogue && lensPsf ?\n viewLensKit.createDisplayViewLensPsf(lensPsf.configuration.psf as Parameters<typeof viewLensKit.createDisplayViewLensPsf>[0], catalogueKernelRadius, nativeWidth, nativeHeight, pitch) : undefined;\n if (displayViewLensPsf) assume(\"view.lensPsf\", \"model\", { method: \"piecewise-constant-field-zones\", zoneSites: displayViewLensPsf.zoneSites, kernelRadiusSites: catalogueKernelRadius, scientificStatus: \"approximation\" },\n \"Each site takes the lens PSF at its field zone's centre, where the capture resolves it at each query point (docs/DISPLAY_VIEW.md, \\\"Catalogue lenses\\\").\");\n const lensSignal = viewLensKit ? viewLensKit.prepareDisplayViewLensSignal({ geometry: lensGeometry!,\n times: rotating ? Array.from({ length: temporalSampleCount }, (_, i) => (i + 0.5) * (shutterSeconds / temporalSampleCount)) : [0], distanceM: subjectDistanceM, metresPerFrameUnit,\n pitch, imagingArea, boxSamples, spots: antiAliasing ? antiAliasing.components : [{ offsetMicrometers: { x: 0, y: 0 } }], psf: displayViewLensPsf, zeroBeyondHorizon: catalogue?.kind === \"fisheye\" }, nativeWidth, nativeHeight,\n (diffraction ? diffraction.kernelRadiusSamples : 0) + (displayViewDefocus ? (bokehAxisKernel?.radius ?? defocusDiscKernelRadius(displayViewDefocus.diameterSites)) : 0) + catalogueKernelRadius +\n Math.max(0, ...queryOffsetsSites.map((o) => Math.max(Math.abs(o.x), Math.abs(o.y)))) - 0.5, catalogue ? \"lens.catalogue\" : imageSpaceOptions.join(\", \")) : undefined;\n if (displayView) return await renderView!({ lens: lensSignal, lensPsf: displayViewLensPsf, ahd, fastReport, antiAliasing, aspect, assume, assumptions, axisChannelResponse, boxSamples, buildProvider, callerScene, chart, materialLayers, chartReport, chartSize, diffraction, defocus: displayViewDefocus, diffractionPsf, fNumber, focalLengthMm, focusDistanceM, height, highlightMode, exposureGain, 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 // #556: the development exposure push multiplies the normalized RAW before the white clip.\n const c = exposureGain === 1 ? sum.map((value) => Math.min(1, Math.max(0, value / (n * n)))) : sum.map((value) => Math.min(1, Math.max(0, value / (n * n) * exposureGain)));\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 // #568: lens.catalogue's fast method: tabulated expected electrons with the PSF blended over a field grid (catalogue-lens-signal.ts), for a\n // still camera, site-centre queries and a chart or material scene; verified per CFA phase against the exact chain within its tolerance.\n let catalogueFastRun: { columns: number; rows: number; resolved: number; verificationRelativeDifference: number } | undefined;\n const catalogueFastEligible = catalogueFastRequested && catalogueTaps !== undefined && lensKit !== undefined && lensPsf !== undefined && dngParts === undefined && tabulatedScene &&\n !pupil && !rotating && boxSamples === 1 && !antiAliasing && distortion?.kind === \"radial\" && provider.chartMaterialAt !== undefined && provider.materialRadiance !== undefined;\n // The tabulated paths' channel response per spectral node and material tables (the fast catalogue path and the expected-signal path).\n const tabulatedTables = (): { wavelengths: number[]; perNode: [Float64Array, Float64Array, Float64Array]; materials: NonNullable<Parameters<typeof buildExpectedSignalInput>[0][\"materials\"]> } => {\n const { electronsPerRadiance, wavelengths } = axisChannelResponse(\"simulateCapture\");\n const sceneMaterials = chart ? chart.materials : (callerScene as ResolvedCallerMaterialScene).materials, materialRadiance = provider.materialRadiance!;\n return { wavelengths, perNode: CHANNELS.map((c) => Float64Array.from(wavelengths, (nm) => electronsPerRadiance[c].get(nm) ?? 0)) as [Float64Array, Float64Array, Float64Array],\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 };\n if (catalogueFastEligible) {\n const { wavelengths, perNode, materials } = tabulatedTables();\n const { signalInput } = buildExpectedSignalInput({ nativeWidth, nativeHeight, width, wavelengths, perNode, apertureNodes: apertureNodeOffsets(1), boxSamples: 1, antiAliasing: undefined, pitch,\n materials, radianceAt: provider.radianceAt, imagingArea, focalLengthMm, focusDistanceM, subjectDistanceM, metresPerFrameUnit, caller: \"simulateCapture\" });\n const radial = (distortion as Extract<SimulateCaptureLensDistortion, { kind: \"radial\" }>).profile;\n const signal = lensKit!.createCatalogueLensSignal({ nativeWidth, nativeHeight, pitch, psf: lensPsf!.configuration.psf, wavelengthsNm: wavelengths, electronsPerRadiance: perNode,\n scene: signalInput.scene as Extract<typeof signalInput.scene, { kind: \"materials\" }>, channelAt: signalInput.channelAt,\n distortion: { normalizationRadiusMm: radial.normalizationRadiusMm, coefficients: { k1: radial.coefficients.k1, k2: radial.coefficients.k2 ?? 0, k3: radial.coefficients.k3 ?? 0 } },\n ...(vignetting ? { vignetting } : {}), projection: projection === \"fisheye-equisolid-angle\" ? projection : \"rectilinear\", outsideImageCircleSeesNothing: catalogue!.kind === \"fisheye\",\n focalLengthMm, focusDistanceM, distanceM: subjectDistanceM, metresPerFrameUnit });\n tabulated = await renderTabulatedNativeRaw({ input: environmentRaw, region: regionNative, siteInput, evaluateRadiance: rawProvider().evaluateRadiance,\n electrons: signal, relativeTolerance: lensKit!.CATALOGUE_FAST_VERIFICATION_TOLERANCE, onTile: rawTick, tileWidth, yieldControl: () => yieldControl(), checkAbort });\n if (tabulated) catalogueFastRun = { ...signal.grid, verificationRelativeDifference: tabulated.verificationRelativeDifference };\n }\n // #553: a cat's eye varies the kernel over the field, which the expected-signal tables (one kernel per node) do not take.\n else if (dngParts === undefined && tabulatedScene && !pupil && !lensFieldMapping && !vignetting && !lensPsf && !rotating && !bokehZones && (!diffraction || diffractionObjectSpace) && provider.chartMaterialAt && provider.materialRadiance) {\n const { wavelengths, perNode, materials: tabulatedMaterials } = tabulatedTables();\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: tabulatedMaterials, 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?.large) {\n // #564: the in-focus signal on the lattice formula (diffraction kernels, or a unit tap per node), then the disc by runs.\n signalInput = buildExpectedSignalInput({ nativeWidth, nativeHeight, width, wavelengths, perNode, apertureNodes: apertureNodeOffsets(boxSamples), boxSamples, antiAliasing, pitch,\n diffraction: diffraction ? { radius: diffraction.kernelRadiusSamples, psf: diffractionPsf!.configuration.psf, profileWavelengths: diffraction.profile.axes.wavelengthNm } : undefined,\n largeDefocus: defocusSiteKernels.large.runs, materials: tabulatedMaterials,\n radianceAt: provider.radianceAt, imagingArea, focalLengthMm, focusDistanceM, subjectDistanceM, metresPerFrameUnit, caller: \"simulateCapture\" }).signalInput;\n } else 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 && catalogueFastRun) {\n rawOutput = { raw: tabulated.raw, providerEvaluationCount: tabulated.providerEvaluationCount };\n fastApplied[\"lens.catalogue\"] = true;\n fastReport = Object.freeze({ ...fastReport, applied: Object.freeze({ ...fastApplied }), assurance: \"approximation-with-a-priori-bound\" as const });\n for (const a of lensKit!.catalogueFastAssumptions(catalogueFastRun)) assume(a.id, \"model\", a.value, a.explanation);\n }\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 ...(exposureCompensationStops === 0 ? {} : { exposureCompensationStops }),\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 // Development detail (#552): diffraction correction on the developed linear colour, then the unsharp mask between the sRGB\n // transfer and quantization. Both need the whole developed image, so a request with either develops through developLinearSrgb\n // (the native development's own operator); without them every path below is unchanged.\n const detailRequested = sharpening !== undefined || diffractionCorrectionOption !== undefined;\n const detailDiagnostics: SimulateCaptureDetailDiagnostics = {};\n let diffractionFilter: ReturnType<typeof designDiffractionCorrectionFilter> | undefined;\n if (diffractionCorrectionOption) {\n const workingFNumber = fNumber * imageDistanceMm / focalLengthMm;\n const settings: DiffractionCorrectionSettings = { ...diffractionCorrectionOption, kernelRadiusPixels: diffractionCorrectionOption.kernelRadiusPixels ??\n defaultDiffractionCorrectionRadiusPixels(workingFNumber, diffractionCorrectionOption.wavelengthNm, pitch) };\n if (diffractionCorrectionOption.kernelRadiusPixels === undefined) assume(\"output.diffractionCorrection.kernelRadiusPixels\", \"default\", settings.kernelRadiusPixels,\n \"FIR radius: the Airy pattern's third dark ring (3.2383·λ·N_w) at the design wavelength, in pixels, rounded up, within 1–16.\");\n diffractionFilter = designDiffractionCorrectionFilter({ workingFNumber, pixelPitchMicrometers: pitch, settings });\n assume(\"output.diffractionCorrection\", \"model\", { model: \"development-detail\", modelVersion: DEVELOPMENT_DETAIL_MODEL_VERSION, method: \"bounded-wiener-tikhonov-fir\",\n stage: \"linear colour after demosaic, colour and white balance; before the tone curve\", fNumber, workingFNumber, ...settings, pixelPitchMicrometers: pitch,\n cutoffCyclesPerPixel: diffractionFilter.cutoffCyclesPerPixel, nyquistCyclesPerPixel: 0.5, nyquistAreaBeyondCutoffFraction: diffractionFilter.nyquistAreaBeyondCutoffFraction,\n designPeakGain: diffractionFilter.designPeakGain, responsePeakGain: diffractionFilter.responsePeakGain, responseMaximumBeyondCutoff: diffractionFilter.responseMaximumBeyondCutoff,\n edgeHandling: \"clamp\", recoversBeyondCutoff: false },\n \"Deconvolution with the known diffraction OTF of an ideal, aberration-free circular pupil at the capture's working f-number N_w = N·v/f, H(s) = (2/π)(acos s − s√(1 − s²)), s = f/f_c, f_c = 1/(λ·N_w) \" +\n \"(MIT OpenCourseWare 2.71, lectures 21–22). Gain G = min(maximumGain, H(1 + α)/(H² + α)) (Wiener deconvolution with a constant noise-to-signal ratio α, as in scikit-image's Wiener–Hunt filter), \" +\n \"sampled, inverse transformed and truncated to a raised-cosine (2R + 1)² FIR with unit DC gain, applied to each linear channel with clamped edges. \" +\n \"The OTF is exactly zero beyond f_c: that detail never reached the sensor, and no correction restores it. The design gain there is 0; responseMaximumBeyondCutoff is the truncated FIR's leakage, which passes only noise and aliasing. \" +\n \"Below f_c the gain is bounded, so attenuated detail is only partly restored and noise is amplified by up to the measured responsePeakGain. \" +\n \"Not inverted: the pixel aperture, optical anti-aliasing filter, demosaic blur, defocus and aberrations. One design wavelength for all channels (the simulated blur is polychromatic).\");\n }\n const correctLinear = (rgb: Float64Array): Float64Array => {\n if (!diffractionFilter) return rgb;\n const corrected = applyDiffractionCorrection(rgb, outputWidth, outputHeight, diffractionFilter);\n detailDiagnostics.diffractionCorrection = { ...corrected.diagnostics, cutoffCyclesPerPixel: diffractionFilter.cutoffCyclesPerPixel,\n responsePeakGain: diffractionFilter.responsePeakGain, responseMaximumBeyondCutoff: diffractionFilter.responseMaximumBeyondCutoff };\n return corrected.samples;\n };\n if (sharpening) assume(\"output.sharpening\", \"model\", { model: \"development-detail\", modelVersion: DEVELOPMENT_DETAIL_MODEL_VERSION, method: \"unsharp-mask\", ...sharpening,\n kernelRadiusPixels: Math.ceil(3 * sharpening.radiusPixels), domain: \"srgb-encoded\", stage: \"after the tone curve, gamut handling and sRGB transfer; before quantization\", edgeHandling: \"clamp\" },\n \"Unsharp mask y = x + amount·(x − G_σ∗x) where |x − G_σ∗x| ≥ threshold (the GIMP and ImageMagick unsharp mask: radius, amount, threshold), per channel on the sRGB-encoded values in [0, 1], \" +\n \"separable Gaussian truncated at ⌈3σ⌉ with clamped edges, then clipped to [0, 1] and rounded. It raises contrast at edges and creates halos (overshoot and undershoot; see diagnostics.detail.sharpening) \" +\n \"and sharpens noise above the threshold. It adds no optical detail.\");\n if (detailRequested) assume(\"output.developmentOrder\", \"model\", [...(exposureGain === 1 ? [] : [\"development exposure push (RAW)\"]), \"demosaic\", \"colour and white balance\", ...(diffractionCorrectionOption ? [\"diffraction correction (linear)\"] : []),\n \"rendering exposure and tone curve\", \"gamut handling\", \"transfer function\", ...(sharpening ? [\"unsharp mask\"] : []), \"quantization\"],\n \"Development detail order: the deconvolution acts on linear light, where the blur is a convolution; the unsharp mask acts on the encoded values just before quantization.\" +\n (exposureGain === 1 ? \"\" : \" A development exposure push (output.exposureCompensationStops) scales the black-subtracted, white-normalized RAW first, so pushed sites clip at white before the deconvolution sees them.\"));\n if (ahd || (detailRequested && !linearPath)) {\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 }, ahd ? { yieldControl: (): Promise<void> => yieldControl(), checkAbort, onDemosaicMs: (ms: number): void => { demosaicMs = ms; } } : undefined);\n const rgb = correctLinear(linear.rgb);\n if (!linearPath && sharpening) {\n const rendered = renderSdrWithUnsharpMask(rgb, outputWidth, outputHeight, rendering, sharpening);\n detailDiagnostics.sharpening = rendered.sharpening;\n developed = { raw: rawOutput.raw, integerSamples: rendered.codes, highlight: linear.highlight, diagnostics: { renderingNegativeSampleCount: rendered.counts.negative,\n renderingAboveReferenceSampleCount: rendered.counts.above, toneChangedSampleCount: rendered.counts.changed, gamutClippedLowSampleCount: rendered.counts.low,\n gamutClippedHighSampleCount: rendered.counts.high, captureSaturation: \"consumed-in-raw-development\" } };\n } else 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(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(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(correctLinear(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 ...(catalogue ? [\"lens.catalogue\" as const] : []),\n ...(diffraction ? [\"lens.diffraction\" as const] : []), ...(defocusSiteKernels || catalogueDefocusApplied ? [\"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] : []), ...(diffractionFilter ? [\"output.diffractionCorrection\" as const] : []),\n ...(sharpening ? [\"output.sharpening\" as const] : []), ...(format === \"jpeg\" || format === \"png\" || format === \"dng\" ? [\"output.format.\" + format as SimulateCaptureCostOption] : [])]);\n // #552: the detail stages' contracts, in execution order inside the development.\n const detailContracts = diffractionFilter ? [\"designDiffractionCorrectionFilter\", \"applyDiffractionCorrection\"] : [], sdrContract = sharpening ? \"renderSdrWithUnsharpMask\" : \"SDR rendering kernel\";\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 :\n defocusImageSpace ? \"image-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 ...(detailRequested ? { detail: Object.freeze(detailDiagnostics) } : {}),\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\", defocusImageSpace ? \"defocus disc site kernel (image-space convolution)\" : \"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)\", ...detailContracts, ...(linearPath ? [\"resolveRgbColorSpace\", ...(perceptual ? [\"prepareRgbGamutMapping\"] : [])] : [sdrContract])] :\n linearPath ? [\"native RAW development operator (linear, pre-clip)\", ...detailContracts, \"resolveRgbColorSpace\", ...(perceptual ? [\"prepareRgbGamutMapping\"] : [])] :\n detailRequested ? [\"native RAW development operator (linear, pre-clip)\", ...detailContracts, sdrContract] : [\"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"]}