@incodetech/core 0.0.0-dev-20260820-e7c67ad4 → 0.0.0-dev-20260821-af317971

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 (134) hide show
  1. package/dist/{BrowserDiagnosticsCryptoProvider-pKKLCGRk.esm.js → BrowserDiagnosticsCryptoProvider-C0MCKC1X.esm.js} +1 -1
  2. package/dist/{addressSearch-DQyrvDQj.esm.js → addressSearch-D1XpBdUS.esm.js} +1 -1
  3. package/dist/ae-signature.esm.js +1 -1
  4. package/dist/antifraud.esm.js +2 -2
  5. package/dist/{antifraudManager-BMZvuxv0.esm.js → antifraudManager-CQFNgSPt.esm.js} +2 -2
  6. package/dist/{antifraudStateMachine-r4VxSBS4.esm.js → antifraudStateMachine-Bf_JVNwn.esm.js} +2 -2
  7. package/dist/{apiError-DyXOc0Ha.esm.js → apiError-DINhZF1k.esm.js} +1 -1
  8. package/dist/authentication.esm.js +2 -2
  9. package/dist/{authenticationManager-C_DUIrb5.esm.js → authenticationManager-Ckwq7pZi.esm.js} +3 -3
  10. package/dist/{authenticationStateMachine-N-u23M0G.esm.js → authenticationStateMachine-CScvURND.esm.js} +4 -4
  11. package/dist/certificate-issuance.esm.js +2 -2
  12. package/dist/{certificateIssuanceManager-buCaNcxx.esm.js → certificateIssuanceManager-DFTukqtI.esm.js} +2 -2
  13. package/dist/{certificateIssuanceStateMachine-COd7_l2T.esm.js → certificateIssuanceStateMachine-D_R92TYu.esm.js} +2 -2
  14. package/dist/consent.d.ts +1 -1
  15. package/dist/consent.esm.js +2 -2
  16. package/dist/{consentManager-uhDPdU6i.d.ts → consentManager-BhYFeKiG.d.ts} +8 -8
  17. package/dist/{consentManager-DyBXdkFn.esm.js → consentManager-BxjpLZAG.esm.js} +2 -2
  18. package/dist/{consentStateMachine-WD-S-Yhs.esm.js → consentStateMachine-D9D4ON8Z.esm.js} +2 -2
  19. package/dist/cross-document-data-match.esm.js +1 -1
  20. package/dist/{crossDocumentDataMatchManager-pNkutndd.esm.js → crossDocumentDataMatchManager-CGT0V6RV.esm.js} +2 -2
  21. package/dist/curp-validation.esm.js +2 -2
  22. package/dist/{curpValidationManager-DEesnLee.esm.js → curpValidationManager-6Nmkn5u1.esm.js} +2 -2
  23. package/dist/{curpValidationStateMachine-9KwnqeoB.esm.js → curpValidationStateMachine-Ds7KMacK.esm.js} +2 -2
  24. package/dist/custom-fields.esm.js +1 -1
  25. package/dist/custom-watchlist.esm.js +2 -2
  26. package/dist/{customFieldsManager-Dgy3Hi0q.esm.js → customFieldsManager-BjTF6dRi.esm.js} +2 -2
  27. package/dist/{customWatchlistManager-BlJTcPKK.esm.js → customWatchlistManager-SFTkKkcs.esm.js} +2 -2
  28. package/dist/{customWatchlistStateMachine-B_ey3TFj.esm.js → customWatchlistStateMachine-YWSgKLbF.esm.js} +2 -2
  29. package/dist/{deepsightLoader-CJ-pplPZ.esm.js → deepsightLoader-B97yrkGH.esm.js} +3 -3
  30. package/dist/document-capture.esm.js +2 -2
  31. package/dist/{documentCaptureManager-C1UC1WYh.esm.js → documentCaptureManager-CV-B3ttS.esm.js} +2 -2
  32. package/dist/{documentCaptureStateMachine-CBHmgyM7.esm.js → documentCaptureStateMachine-DyNnjqKZ.esm.js} +2 -2
  33. package/dist/dynamic-forms.esm.js +2 -2
  34. package/dist/{dynamicFormsManager-DZmrn3Gs.esm.js → dynamicFormsManager-DhL8CAti.esm.js} +2 -2
  35. package/dist/{dynamicFormsStateMachine-DJGGCw-_.esm.js → dynamicFormsStateMachine-C58R6XYG.esm.js} +3 -3
  36. package/dist/ekyb.esm.js +3 -3
  37. package/dist/{ekybManager-DvNzYUtw.esm.js → ekybManager-DhFCnPQH.esm.js} +2 -2
  38. package/dist/{ekybStateMachine-C4F-25c-.esm.js → ekybStateMachine-DLGDsiyt.esm.js} +4 -4
  39. package/dist/ekyc.esm.js +2 -2
  40. package/dist/{ekycManager-CasdX1Ou.esm.js → ekycManager-DgT48ky6.esm.js} +2 -2
  41. package/dist/{ekycStateMachine-DHvksnrr.esm.js → ekycStateMachine-CQwqiR-R.esm.js} +3 -3
  42. package/dist/electronic-signature.esm.js +1 -1
  43. package/dist/{electronicSignatureManager-B8ewPeEV.esm.js → electronicSignatureManager-BNR6fi3d.esm.js} +3 -3
  44. package/dist/email.esm.js +2 -2
  45. package/dist/{emailManager-NLzaP12q.esm.js → emailManager-BY0jeYwR.esm.js} +2 -2
  46. package/dist/{emailStateMachine-Bm894MHB.esm.js → emailStateMachine-Crw8QVmc.esm.js} +2 -2
  47. package/dist/extensibility.d.ts +5 -5
  48. package/dist/extensibility.esm.js +34 -34
  49. package/dist/face-match.esm.js +2 -2
  50. package/dist/{faceCaptureManagerFactory-BltEV2Xt.esm.js → faceCaptureManagerFactory-BfuYyPH6.esm.js} +2 -2
  51. package/dist/{faceCaptureSetup-BGG17dLI.esm.js → faceCaptureSetup-DVMnvRbV.esm.js} +4 -4
  52. package/dist/{faceMatchManager-DEVhhdf4.esm.js → faceMatchManager-Ri4UbNz0.esm.js} +2 -2
  53. package/dist/{faceMatchStateMachine-CJiO2yLO.esm.js → faceMatchStateMachine-20DdZ3jg.esm.js} +2 -2
  54. package/dist/{feature-management-ZXt938Hq.esm.js → feature-management-DBuXnUWY.esm.js} +1 -1
  55. package/dist/feature-management.esm.js +1 -1
  56. package/dist/field-comparison.esm.js +1 -1
  57. package/dist/{fieldComparisonManager-BRYsIi34.esm.js → fieldComparisonManager-Cg6kPQQx.esm.js} +2 -2
  58. package/dist/fiscal-qr.esm.js +1 -1
  59. package/dist/{fiscalQrManager-7UH-ZMea.esm.js → fiscalQrManager-C_mDF2xK.esm.js} +2 -2
  60. package/dist/flow.d.ts +1 -1
  61. package/dist/flow.esm.js +5 -5
  62. package/dist/{flowCompletionService-BGairB36.esm.js → flowCompletionService-DthD-ObU.esm.js} +1 -1
  63. package/dist/{flowServices-DifI1jyA.esm.js → flowServices-BARG219v.esm.js} +4 -4
  64. package/dist/geolocation.esm.js +2 -2
  65. package/dist/{geolocationManager-BnB4QqVU.esm.js → geolocationManager-CHxv2c-F.esm.js} +2 -2
  66. package/dist/{geolocationStateMachine-CfI-8eaD.esm.js → geolocationStateMachine-C9dzQ0YZ.esm.js} +3 -3
  67. package/dist/government-validation.esm.js +2 -2
  68. package/dist/{governmentValidationManager-DnVUyppQ.esm.js → governmentValidationManager-CQBcGMBa.esm.js} +2 -2
  69. package/dist/{governmentValidationStateMachine-CNzJ5UQb.esm.js → governmentValidationStateMachine-DgxxQTbM.esm.js} +2 -2
  70. package/dist/home.esm.js +1 -1
  71. package/dist/id-ocr.esm.js +2 -2
  72. package/dist/id-selfie-flow.esm.js +8 -8
  73. package/dist/id-verification.esm.js +2 -2
  74. package/dist/id.d.ts +2 -2
  75. package/dist/id.esm.js +5 -5
  76. package/dist/{idCaptureManager-DQEUuleg.d.ts → idCaptureManager-DR0ra4Us.d.ts} +20 -10
  77. package/dist/{idCaptureManager-5p43Mmyv.esm.js → idCaptureManager-Ji6vFlsJ.esm.js} +12 -16
  78. package/dist/{idCaptureServices-D5TXcSQQ.esm.js → idCaptureServices-0lE7kEdA.esm.js} +143 -17
  79. package/dist/{idCaptureStateMachine-DF1WRVP9.esm.js → idCaptureStateMachine-DG7t_39B.esm.js} +445 -54
  80. package/dist/{idOcrManager-D_2k-6Vv.esm.js → idOcrManager-BIQYQXXj.esm.js} +2 -2
  81. package/dist/{idOcrStateMachine-Bq_e3l4E.esm.js → idOcrStateMachine-cSxzHpHt.esm.js} +2 -2
  82. package/dist/{idVerificationManager-DdlrWSSB.esm.js → idVerificationManager-JpV_SAsl.esm.js} +2 -2
  83. package/dist/{idVerificationStateMachine-GEQWUPU2.esm.js → idVerificationStateMachine-nPeUNyFq.esm.js} +2 -2
  84. package/dist/identity-reuse.d.ts +1 -1
  85. package/dist/identity-reuse.esm.js +2 -2
  86. package/dist/{identityReuseManager-CzLZNgdh.esm.js → identityReuseManager-kNCg9AbD.esm.js} +2 -2
  87. package/dist/{identityReuseManager-BFDI7iFK.d.ts → identityReuseManager-v2TH5g7e.d.ts} +4 -4
  88. package/dist/{identityReuseStateMachine-AubRPhIi.esm.js → identityReuseStateMachine-DyulxDjP.esm.js} +2 -2
  89. package/dist/index.esm.js +1 -1
  90. package/dist/mandatory-consent.d.ts +1 -1
  91. package/dist/mandatory-consent.esm.js +2 -2
  92. package/dist/{mandatoryConsentManager-CEIkNukS.esm.js → mandatoryConsentManager-B4Niyg_u.esm.js} +2 -2
  93. package/dist/{mandatoryConsentManager-DvR2XzUH.d.ts → mandatoryConsentManager-CaTcQLK6.d.ts} +4 -4
  94. package/dist/{mandatoryConsentStateMachine-zroQGzwb.esm.js → mandatoryConsentStateMachine-B4-1u-L8.esm.js} +2 -2
  95. package/dist/{onDeviceFaceResults-BeHb0Zet.esm.js → onDeviceFaceResults-BqLGnM8A.esm.js} +3 -3
  96. package/dist/personhood.esm.js +5 -5
  97. package/dist/phone.esm.js +2 -2
  98. package/dist/{phoneManager-B_03mKyi.esm.js → phoneManager-FsJ0W2Ei.esm.js} +2 -2
  99. package/dist/{phoneStateMachine-E1fUUcNM.esm.js → phoneStateMachine-Ba0wKHyX.esm.js} +2 -2
  100. package/dist/qe-signature.esm.js +1 -1
  101. package/dist/{recordingService-DKb3A23J.esm.js → recordingService-BNUTYip6.esm.js} +1 -1
  102. package/dist/redirect-to-mobile.esm.js +2 -2
  103. package/dist/{redirectToMobileManager-Bgo6eqri.esm.js → redirectToMobileManager-y4VQB11M.esm.js} +3 -3
  104. package/dist/{redirectToMobileStateMachine-C9SYCJcH.esm.js → redirectToMobileStateMachine-Cyv2x0PP.esm.js} +2 -2
  105. package/dist/{runChildModule-DsFARqqY.esm.js → runChildModule-CyrA4IkE.esm.js} +3 -3
  106. package/dist/{sdkVersion-C5UD9rLq.esm.js → sdkVersion-C2N5d9MD.esm.js} +1 -1
  107. package/dist/selfie.esm.js +6 -6
  108. package/dist/{selfieManager-B-wIgrPB.esm.js → selfieManager-CCl2CgNV.esm.js} +3 -3
  109. package/dist/{selfieStateMachine-DXwqWYTH.esm.js → selfieStateMachine-OD6m5Pnh.esm.js} +4 -4
  110. package/dist/{session-khwoLlR8.esm.js → session-CK-eOrL7.esm.js} +4 -4
  111. package/dist/session.esm.js +4 -4
  112. package/dist/{sessionInitializer-BVjQZWxu.esm.js → sessionInitializer-CVrazqxw.esm.js} +4 -4
  113. package/dist/{setup-CSYGLqEQ.esm.js → setup-Cl3qY4N6.esm.js} +5 -5
  114. package/dist/signature.esm.js +2 -2
  115. package/dist/{signatureManager-DoACIR02.esm.js → signatureManager-Ca43yhwk.esm.js} +2 -2
  116. package/dist/{signatureStateMachine-Cf73DGWO.esm.js → signatureStateMachine-K1LMRrxG.esm.js} +2 -2
  117. package/dist/trueSight-ClQ2RLmN.esm.js +1 -0
  118. package/dist/{trueSightService-cimVc012.esm.js → trueSightService-CTM6xlHG.esm.js} +2 -2
  119. package/dist/trust-graph.esm.js +1 -1
  120. package/dist/{types-B_PW_0Wq2.d.ts → types-DQtm9Esn2.d.ts} +69 -13
  121. package/dist/video-selfie.esm.js +5 -5
  122. package/dist/{videoSelfieCameraWarmer-fvzaTVJ4.esm.js → videoSelfieCameraWarmer-DVzRMMaV.esm.js} +2 -2
  123. package/dist/wasm.esm.js +1 -1
  124. package/dist/watchlist-for-business.esm.js +2 -2
  125. package/dist/watchlist.esm.js +2 -2
  126. package/dist/{watchlistForBusinessManager-Bo08PkKo.esm.js → watchlistForBusinessManager-MEWKeR3h.esm.js} +2 -2
  127. package/dist/{watchlistForBusinessStateMachine-BAg1B4HF.esm.js → watchlistForBusinessStateMachine-Dszp35m2.esm.js} +2 -2
  128. package/dist/{watchlistManager-CPBZnFYj.esm.js → watchlistManager-LoNZH9qm.esm.js} +2 -2
  129. package/dist/{watchlistStateMachine-Bl7Wy9Cm.esm.js → watchlistStateMachine-DIKQDoUT.esm.js} +2 -2
  130. package/dist/workflow.esm.js +36 -36
  131. package/dist/{xstate-actors.esm-CtI5S0f4.esm.js → xstate-actors.esm-BXeQ-Ucz.esm.js} +1 -1
  132. package/dist/{xstate.esm-Cf4e0Cfd.esm.js → xstate.esm-BuFLFuzz.esm.js} +1 -1
  133. package/package.json +1 -1
  134. package/dist/trueSight-DZJ12lrB.esm.js +0 -1
@@ -1,14 +1,14 @@
1
- import { i as numberParam, n as defineExperimentParams, t as booleanParam, u as resolveExperimentOnce } from "./feature-management-ZXt938Hq.esm.js";
1
+ import { i as numberParam, n as defineExperimentParams, t as booleanParam, u as resolveExperimentOnce } from "./feature-management-DBuXnUWY.esm.js";
2
2
  import { t as api } from "./api-Bx3gKW_y.esm.js";
3
3
  import { t as endpoints } from "./endpoints-CCzL3XD_.esm.js";
4
4
  import { i as isDesktop } from "./platform-Q4r1nvWX.esm.js";
5
- import { r as assign, t as setup } from "./xstate.esm-Cf4e0Cfd.esm.js";
6
- import { n as fromPromise } from "./xstate-actors.esm-CtI5S0f4.esm.js";
5
+ import { i as assign, t as setup } from "./xstate.esm-BuFLFuzz.esm.js";
6
+ import { n as fromPromise } from "./xstate-actors.esm-BXeQ-Ucz.esm.js";
7
7
  import { s as queryCameraPermission } from "./permissionServices-Dgtg_4Lv.esm.js";
8
- import { h as stopRecording$1, m as startRecording, p as createRecordingSession } from "./onDeviceFaceResults-BeHb0Zet.esm.js";
8
+ import { h as stopRecording$1, m as startRecording, p as createRecordingSession } from "./onDeviceFaceResults-BqLGnM8A.esm.js";
9
9
  import { a as isBackFacingTrack, n as getBackCameraStream } from "./backCameraStream-D30zZBEZ.esm.js";
10
10
  import { t as getDeviceClass } from "./getDeviceClass-Sh0zhEv7.esm.js";
11
- import { n as preloadOpenViduProvider } from "./recordingService-DKb3A23J.esm.js";
11
+ import { n as preloadOpenViduProvider } from "./recordingService-BNUTYip6.esm.js";
12
12
  import { n as DEFAULT_ID_CAPTURE_THRESHOLDS, r as IdCaptureProvider } from "./idCaptureDefaults-Dowxd3J3.esm.js";
13
13
  //#region src/internal/camera/cameraServices.ts
14
14
  function createCameraServices(camera) {
@@ -194,25 +194,149 @@ async function getIdCameraStream(deviceId) {
194
194
  //#endregion
195
195
  //#region src/modules/id/idCaptureExperiments.ts
196
196
  /**
197
+ * IDC-05 splits the WASM frames-aggregation window into a silent live half
198
+ * (`framesAggregationIntervalMs`, "Taking photo…") and an optimizing half
199
+ * (`resultPreviewDwellMs`, "Successfully captured" / "Optimizing your capture…")
200
+ * during which detection keeps running, so the frame that finally uploads is
201
+ * the best across both halves. WASM receives their sum. iOS uses 1500 + 1500
202
+ * (`IDCaptureExp05Timing`).
203
+ *
204
+ * The two param names below are the **Statsig payload keys**, deliberately kept
205
+ * as originally configured; everything downstream of
206
+ * `resolveCaptureOptimizingTreatment` speaks of the optimizing phase instead
207
+ * (`captureWindowMs` / `optimizingDwellMs`). Renaming a key here renames what
208
+ * the console must send, and a payload still using the old spelling would
209
+ * silently fall back to these code defaults.
210
+ *
211
+ * The split is NOT pinned to a fixed total. The only ceiling is the session's
212
+ * autocapture budget, applied in `resolveCaptureOptimizingTreatment`: a
213
+ * payload whose halves exceed it is halved to fit rather than rejected, and a
214
+ * session whose budget cannot fit a meaningful split runs the countdown arm.
215
+ * Note this means the console payload decides total capture duration — a
216
+ * treatment payload that leaves `framesAggregationIntervalMs` at its 3000
217
+ * default produces a 4500ms window against the 5s default budget, i.e. longer
218
+ * than the countdown arm's 3000ms. Set both halves explicitly.
219
+ */
220
+ const MAX_OPTIMIZING_DWELL_MS = 2500;
221
+ const DEFAULT_OPTIMIZING_DWELL_MS = 1500;
222
+ /**
223
+ * How long the machine waits for WASM's commit *after* the optimizing phase has
224
+ * had its full dwell, before treating the window as abandoned
225
+ * (`optimizingGrace`, `idCaptureStateMachine.ts`).
226
+ *
227
+ * The phase is expected to last exactly one dwell: it starts at
228
+ * `T0 + captureWindowMs` and WASM closes its aggregation window with
229
+ * `onCapture` at `T0 + captureWindowMs + optimizingDwellMs`. This grace covers
230
+ * the case where that `onCapture` never arrives — aggregation aborting
231
+ * mid-phase because the document left the frame, so the window the frozen still
232
+ * belongs to is simply abandoned.
233
+ *
234
+ * Sized to be unreachable on a healthy phase: WASM's frame loop and the JS
235
+ * boundary timer both jitter, and a late boundary only *delays* the phase, which
236
+ * delays this grace with it — so the only way to overrun a full second past the
237
+ * dwell is that no commit is coming.
238
+ */
239
+ const OPTIMIZING_WATCHDOG_MARGIN_MS = 1e3;
240
+ /**
197
241
  * IDC-05 — resolved by core because `framesAggregationIntervalMs` feeds
198
242
  * `setThresholds` before detection can run.
243
+ *
244
+ * `framesAggregationIntervalMs` carries no upper bound here because it means
245
+ * two different things depending on the arm: the WHOLE aggregation window in
246
+ * the countdown arm, only the pre-boundary half in the treatment arm. Bounding it
247
+ * for one would break the other, so the arm-aware handling lives in
248
+ * `resolveCaptureOptimizingTreatment`. Its code default stays at the
249
+ * canonical 3000 so an unallocated session keeps shipped control behavior.
199
250
  */
200
- const CAPTURE_RESULT_PREVIEW = {
251
+ const CAPTURE_OPTIMIZING = {
201
252
  storeParam: "idcExp05ShowResult",
202
253
  ...defineExperimentParams({
203
254
  showCaptureResultPreview: booleanParam(false),
204
- framesAggregationIntervalMs: numberParam(DEFAULT_ID_CAPTURE_THRESHOLDS.framesAggregationInterval)
255
+ framesAggregationIntervalMs: numberParam(DEFAULT_ID_CAPTURE_THRESHOLDS.framesAggregationInterval, { min: 0 }),
256
+ resultPreviewDwellMs: numberParam(DEFAULT_OPTIMIZING_DWELL_MS, {
257
+ min: 0,
258
+ max: MAX_OPTIMIZING_DWELL_MS
259
+ })
205
260
  })
206
261
  };
207
262
  //#endregion
208
263
  //#region src/modules/id/idCaptureThresholds.ts
209
- function resolveCaptureResultPreviewTreatment(config) {
210
- if (config.supportsCaptureResultPreview !== true) return void 0;
211
- const { params } = resolveExperimentOnce(CAPTURE_RESULT_PREVIEW);
212
- return {
213
- mode: params.showCaptureResultPreview ? "result-preview" : "countdown",
264
+ /**
265
+ * WASM restarts its manual-capture timer at first ID *detection* but only opens
266
+ * the frames-aggregation window at the first *good-quality* frame, and never
267
+ * stops that timer once aggregation begins. If it fires mid-window it captures
268
+ * early (`CapturingManager.cpp`, the `isLookingForBestFrame` branch of the
269
+ * `manualCaptureTimer` interval callback), which would truncate the
270
+ * optimizing half.
271
+ */
272
+ const AUTOCAPTURE_SAFETY_MARGIN_MS = 500;
273
+ /**
274
+ * Smallest autocapture budget that can still carry a meaningful IDC-05 split.
275
+ *
276
+ * An over-budget payload is halved to fit (below), so the budget alone decides
277
+ * how short each half can get. At 3000ms each half is 1500ms — the iOS timing
278
+ * and the shortest pre-boundary window that reliably yields a best frame. Below
279
+ * that the session runs the countdown arm instead: a 1000ms/1000ms split would
280
+ * reveal a frame WASM has barely had time to score.
281
+ *
282
+ * Budget is `autocaptureTimeout - AUTOCAPTURE_SAFETY_MARGIN_MS`, so this floor
283
+ * means an effective `autocaptureTimeout` of at least 3500ms.
284
+ */
285
+ const MIN_EXPERIMENT_AUTOCAPTURE_BUDGET_MS = 3e3;
286
+ /**
287
+ * The autocapture window WASM will be given, derived the same way whether the
288
+ * caller is building thresholds or checking whether a split window fits inside
289
+ * it. Shared so the two can't drift.
290
+ */
291
+ function resolveAutocaptureTimeout(config) {
292
+ return config.thresholds?.autocaptureTimeout ?? (config.autoCaptureTimeout ?? 5) * 1e3;
293
+ }
294
+ /**
295
+ * Resolves the IDC-05 arm and, for the treatment, the two halves of the capture
296
+ * window. Precedence:
297
+ *
298
+ * 1. An explicit `config.thresholds.framesAggregationInterval` (host/headless
299
+ * override) opts the session OUT of the treatment: the host has deliberately
300
+ * pinned the capture window, and splitting it against that intent is worse
301
+ * than not running the experiment on that traffic.
302
+ * 2. Countdown arm (or unallocated) → the experiment's interval straight
303
+ * through, unchanged from before this split existed.
304
+ * 3. Treatment arm, budget too small for a viable split → countdown arm on the
305
+ * CANONICAL window (not the payload's, see below).
306
+ * 4. Treatment arm → the payload's two halves, each halved to `budget / 2` if
307
+ * their sum would overrun the autocapture budget. Deliberately no contract
308
+ * on the total and no rejection path: an out-of-range payload is fitted, not
309
+ * refused, so no session logs a warning or silently runs mis-timed.
310
+ */
311
+ function resolveCaptureOptimizingTreatment(config) {
312
+ if (config.supportsOptimizingStatus !== true) return void 0;
313
+ const { params } = resolveExperimentOnce(CAPTURE_OPTIMIZING);
314
+ const hostInterval = config.thresholds?.framesAggregationInterval;
315
+ if (hostInterval !== void 0) return {
316
+ mode: "countdown",
317
+ framesAggregationInterval: hostInterval
318
+ };
319
+ const budget = resolveAutocaptureTimeout(config) - AUTOCAPTURE_SAFETY_MARGIN_MS;
320
+ if (!params.showCaptureResultPreview) return {
321
+ mode: "countdown",
214
322
  framesAggregationInterval: params.framesAggregationIntervalMs
215
323
  };
324
+ if (budget < MIN_EXPERIMENT_AUTOCAPTURE_BUDGET_MS) return {
325
+ mode: "countdown",
326
+ framesAggregationInterval: DEFAULT_ID_CAPTURE_THRESHOLDS.framesAggregationInterval
327
+ };
328
+ let captureWindowMs = params.framesAggregationIntervalMs;
329
+ let optimizingDwellMs = params.resultPreviewDwellMs;
330
+ if (captureWindowMs + optimizingDwellMs > budget) {
331
+ captureWindowMs = Math.floor(budget / 2);
332
+ optimizingDwellMs = captureWindowMs;
333
+ }
334
+ return {
335
+ mode: "optimizing",
336
+ framesAggregationInterval: captureWindowMs + optimizingDwellMs,
337
+ captureWindowMs,
338
+ optimizingDwellMs
339
+ };
216
340
  }
217
341
  /**
218
342
  * Single source of truth for the WASM ID-capture thresholds passed to
@@ -221,9 +345,11 @@ function resolveCaptureResultPreviewTreatment(config) {
221
345
  * 3000ms) — with precedence:
222
346
  *
223
347
  * 1. An explicit `config.thresholds.framesAggregationInterval` (host/headless
224
- * override) always wins — including when allocated to the treatment arm,
225
- * which then runs the treatment UI on the host's aggregation window.
226
- * 2. Otherwise, the IDC-05 experiment's `framesAggregationInterval`.
348
+ * override) always wins. Such a session never runs the IDC-05 treatment
349
+ * (see `resolveCaptureOptimizingTreatment`), so the override is the whole
350
+ * window, undivided.
351
+ * 2. Otherwise, the IDC-05-resolved interval — the summed split window in the
352
+ * treatment arm, the plain interval in the countdown arm.
227
353
  * 3. Otherwise, the canonical default.
228
354
  *
229
355
  * `idDetectedTimeout`/`autocaptureTimeout` are derived here too (from
@@ -244,7 +370,7 @@ function resolveIdCaptureThresholds(config, experimentInterval) {
244
370
  ...config.thresholds,
245
371
  framesAggregationInterval: config.thresholds?.framesAggregationInterval ?? experimentInterval ?? DEFAULT_ID_CAPTURE_THRESHOLDS.framesAggregationInterval,
246
372
  idDetectedTimeout: config.thresholds?.idDetectedTimeout ?? (config.deviceIdleTimeout ?? 10) * 1e3,
247
- autocaptureTimeout: config.thresholds?.autocaptureTimeout ?? (config.autoCaptureTimeout ?? 5) * 1e3
373
+ autocaptureTimeout: resolveAutocaptureTimeout(config)
248
374
  };
249
375
  }
250
376
  //#endregion
@@ -575,4 +701,4 @@ async function addBarcode(params) {
575
701
  return res.data;
576
702
  }
577
703
  //#endregion
578
- export { processId as a, stopStream as c, validateUploadResponse as d, ID_ERROR_CODES as f, getIdCameraStream as g, CAPTURE_RESULT_PREVIEW as h, preloadIdRecordingProvider as i, uploadIdImage as l, resolveIdCaptureThresholds as m, barcodeToBase64 as n, startRecordingSession as o, resolveCaptureResultPreviewTreatment as p, initializeIdCapture as r, stopRecording as s, addBarcode as t, uploadManualIdFile as u };
704
+ export { getIdCameraStream as _, processId as a, stopStream as c, validateUploadResponse as d, ID_ERROR_CODES as f, OPTIMIZING_WATCHDOG_MARGIN_MS as g, CAPTURE_OPTIMIZING as h, preloadIdRecordingProvider as i, uploadIdImage as l, resolveIdCaptureThresholds as m, barcodeToBase64 as n, startRecordingSession as o, resolveCaptureOptimizingTreatment as p, initializeIdCapture as r, stopRecording as s, addBarcode as t, uploadManualIdFile as u };