@idmission/websdk-core 0.2.0-rc.2 → 0.5.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 (209) hide show
  1. package/README.md +27 -1
  2. package/dist/attestation/clientAttestation.d.ts +5 -0
  3. package/dist/attestation/clientAttestation.d.ts.map +1 -1
  4. package/dist/attestation/clientAttestation.js +4 -4
  5. package/dist/attestation/collectClientAttestation.d.ts +3 -1
  6. package/dist/attestation/collectClientAttestation.d.ts.map +1 -1
  7. package/dist/attestation/collectClientAttestation.js +4 -3
  8. package/dist/camera/acquireCamera.d.ts +5 -0
  9. package/dist/camera/acquireCamera.d.ts.map +1 -1
  10. package/dist/camera/acquireCamera.js +25 -5
  11. package/dist/captureProgress/actor.d.ts +30 -0
  12. package/dist/captureProgress/actor.d.ts.map +1 -0
  13. package/dist/captureProgress/actor.js +754 -0
  14. package/dist/captureProgress/encoder.d.ts +7 -0
  15. package/dist/captureProgress/encoder.d.ts.map +1 -0
  16. package/dist/captureProgress/encoder.js +195 -0
  17. package/dist/captureProgress/index.d.ts +4 -0
  18. package/dist/captureProgress/index.d.ts.map +1 -0
  19. package/dist/captureProgress/index.js +45 -0
  20. package/dist/captureProgress/internal.d.ts +3 -0
  21. package/dist/captureProgress/internal.d.ts.map +1 -0
  22. package/dist/captureProgress/internal.js +1 -0
  23. package/dist/captureProgress/protocol.d.ts +224 -0
  24. package/dist/captureProgress/protocol.d.ts.map +1 -0
  25. package/dist/captureProgress/protocol.js +106 -0
  26. package/dist/captureProgress/recorder.d.ts +32 -0
  27. package/dist/captureProgress/recorder.d.ts.map +1 -0
  28. package/dist/captureProgress/recorder.js +554 -0
  29. package/dist/captureProgress/transport.d.ts +33 -0
  30. package/dist/captureProgress/transport.d.ts.map +1 -0
  31. package/dist/captureProgress/transport.js +109 -0
  32. package/dist/captureProgress/types.d.ts +35 -0
  33. package/dist/captureProgress/types.d.ts.map +1 -0
  34. package/dist/captureProgress/types.js +27 -0
  35. package/dist/client/IdmissionClient.d.ts +8 -1
  36. package/dist/client/IdmissionClient.d.ts.map +1 -1
  37. package/dist/client/IdmissionClient.js +96 -27
  38. package/dist/client/approval.d.ts +15 -0
  39. package/dist/client/approval.d.ts.map +1 -0
  40. package/dist/client/approval.js +19 -0
  41. package/dist/client/artifacts.d.ts +2 -0
  42. package/dist/client/artifacts.d.ts.map +1 -1
  43. package/dist/client/documentFileMetadata.d.ts +13 -0
  44. package/dist/client/documentFileMetadata.d.ts.map +1 -0
  45. package/dist/client/documentFileMetadata.js +51 -0
  46. package/dist/client/index.d.ts +3 -0
  47. package/dist/client/index.d.ts.map +1 -1
  48. package/dist/client/index.js +2 -0
  49. package/dist/client/payload.d.ts +3 -0
  50. package/dist/client/payload.d.ts.map +1 -1
  51. package/dist/client/payload.js +3 -1
  52. package/dist/client/submissionMetadata.d.ts +4 -1
  53. package/dist/client/submissionMetadata.d.ts.map +1 -1
  54. package/dist/client/submissionMetadata.js +13 -8
  55. package/dist/client/types.d.ts +8 -0
  56. package/dist/client/types.d.ts.map +1 -1
  57. package/dist/client/validateSession.d.ts +2 -0
  58. package/dist/client/validateSession.d.ts.map +1 -1
  59. package/dist/client/validateSession.js +53 -24
  60. package/dist/documentCapture/autoCaptureEngine.d.ts +106 -0
  61. package/dist/documentCapture/autoCaptureEngine.d.ts.map +1 -0
  62. package/dist/documentCapture/autoCaptureEngine.js +475 -0
  63. package/dist/documentCapture/autoCaptureGeometry.d.ts +514 -0
  64. package/dist/documentCapture/autoCaptureGeometry.d.ts.map +1 -0
  65. package/dist/documentCapture/autoCaptureGeometry.js +475 -0
  66. package/dist/documentCapture/autoCaptureGuidance.d.ts +61 -0
  67. package/dist/documentCapture/autoCaptureGuidance.d.ts.map +1 -0
  68. package/dist/documentCapture/autoCaptureGuidance.js +73 -0
  69. package/dist/documentCapture/autoCaptureMetadata.d.ts +193 -0
  70. package/dist/documentCapture/autoCaptureMetadata.d.ts.map +1 -0
  71. package/dist/documentCapture/autoCaptureMetadata.js +200 -0
  72. package/dist/documentCapture/autoCaptureOptions.d.ts +211 -0
  73. package/dist/documentCapture/autoCaptureOptions.d.ts.map +1 -0
  74. package/dist/documentCapture/autoCaptureOptions.js +177 -0
  75. package/dist/documentCapture/autoCaptureShutter.d.ts +162 -0
  76. package/dist/documentCapture/autoCaptureShutter.d.ts.map +1 -0
  77. package/dist/documentCapture/autoCaptureShutter.js +183 -0
  78. package/dist/documentCapture/controller.d.ts +38 -1
  79. package/dist/documentCapture/controller.d.ts.map +1 -1
  80. package/dist/documentCapture/controller.js +620 -40
  81. package/dist/documentCapture/index.d.ts +8 -2
  82. package/dist/documentCapture/index.d.ts.map +1 -1
  83. package/dist/documentCapture/index.js +6 -0
  84. package/dist/documentCapture/reducer.d.ts +26 -1
  85. package/dist/documentCapture/reducer.d.ts.map +1 -1
  86. package/dist/documentCapture/reducer.js +43 -0
  87. package/dist/documentCapture/state.d.ts +118 -0
  88. package/dist/documentCapture/state.d.ts.map +1 -1
  89. package/dist/documentCapture/state.js +24 -0
  90. package/dist/idCapture/controller.d.ts +24 -1
  91. package/dist/idCapture/controller.d.ts.map +1 -1
  92. package/dist/idCapture/controller.js +111 -13
  93. package/dist/idCapture/index.d.ts +1 -1
  94. package/dist/idCapture/index.d.ts.map +1 -1
  95. package/dist/idCapture/index.js +12 -1
  96. package/dist/idCapture/pipeline.d.ts +30 -0
  97. package/dist/idCapture/pipeline.d.ts.map +1 -1
  98. package/dist/idCapture/pipeline.js +33 -10
  99. package/dist/idCapture/state.d.ts +1 -3
  100. package/dist/idCapture/state.d.ts.map +1 -1
  101. package/dist/idCapture/submit.d.ts.map +1 -1
  102. package/dist/idCapture/submit.js +35 -1
  103. package/dist/idCapture/types.d.ts +2 -0
  104. package/dist/idCapture/types.d.ts.map +1 -1
  105. package/dist/index.d.ts +2 -0
  106. package/dist/index.d.ts.map +1 -1
  107. package/dist/index.js +1 -0
  108. package/dist/liveness/challengeGeometry.d.ts +48 -17
  109. package/dist/liveness/challengeGeometry.d.ts.map +1 -1
  110. package/dist/liveness/challengeGeometry.js +101 -54
  111. package/dist/models/DocumentDetection.d.ts +29 -1
  112. package/dist/models/DocumentDetection.d.ts.map +1 -1
  113. package/dist/models/DocumentDetection.js +75 -7
  114. package/dist/models/defaults/DocumentDetectorLiteRT.d.ts +2 -2
  115. package/dist/models/defaults/DocumentDetectorLiteRT.d.ts.map +1 -1
  116. package/dist/models/defaults/DocumentDetectorLiteRT.js +27 -2
  117. package/dist/models/defaults/HandLandmarkLiteRT.d.ts +3 -0
  118. package/dist/models/defaults/HandLandmarkLiteRT.d.ts.map +1 -0
  119. package/dist/models/defaults/HandLandmarkLiteRT.js +5 -0
  120. package/dist/models/defaults/IrisLandmarkLiteRT.d.ts +3 -0
  121. package/dist/models/defaults/IrisLandmarkLiteRT.d.ts.map +1 -0
  122. package/dist/models/defaults/IrisLandmarkLiteRT.js +5 -0
  123. package/dist/models/defaults/PalmDetectionLiteRT.d.ts +3 -0
  124. package/dist/models/defaults/PalmDetectionLiteRT.d.ts.map +1 -0
  125. package/dist/models/defaults/PalmDetectionLiteRT.js +5 -0
  126. package/dist/models/defaults/PoaDocumentDetectorLiteRT.d.ts +3 -0
  127. package/dist/models/defaults/PoaDocumentDetectorLiteRT.d.ts.map +1 -0
  128. package/dist/models/defaults/PoaDocumentDetectorLiteRT.js +19 -0
  129. package/dist/models/defaults/index.d.ts +13 -1
  130. package/dist/models/defaults/index.d.ts.map +1 -1
  131. package/dist/models/defaults/index.js +16 -0
  132. package/dist/models/preloadModels.d.ts +24 -16
  133. package/dist/models/preloadModels.d.ts.map +1 -1
  134. package/dist/models/preloadModels.js +33 -3
  135. package/dist/models/providers/litert/FaceLandmarker.d.ts +8 -1
  136. package/dist/models/providers/litert/FaceLandmarker.d.ts.map +1 -1
  137. package/dist/models/providers/litert/FaceLandmarker.js +95 -3
  138. package/dist/models/providers/litert/HandOverFaceDetector.d.ts +27 -0
  139. package/dist/models/providers/litert/HandOverFaceDetector.d.ts.map +1 -0
  140. package/dist/models/providers/litert/HandOverFaceDetector.js +162 -0
  141. package/dist/models/providers/litert/blazeFacePrePost.js +4 -2
  142. package/dist/models/providers/litert/docDetectPrePost.d.ts.map +1 -1
  143. package/dist/models/providers/litert/docDetectPrePost.js +20 -3
  144. package/dist/models/providers/litert/handLandmarkPrePost.d.ts +20 -0
  145. package/dist/models/providers/litert/handLandmarkPrePost.d.ts.map +1 -0
  146. package/dist/models/providers/litert/handLandmarkPrePost.js +72 -0
  147. package/dist/models/providers/litert/handOverFace.d.ts +44 -0
  148. package/dist/models/providers/litert/handOverFace.d.ts.map +1 -0
  149. package/dist/models/providers/litert/handOverFace.js +139 -0
  150. package/dist/models/providers/litert/irisPrePost.d.ts +38 -0
  151. package/dist/models/providers/litert/irisPrePost.d.ts.map +1 -0
  152. package/dist/models/providers/litert/irisPrePost.js +101 -0
  153. package/dist/models/providers/litert/palmPrePost.d.ts +55 -0
  154. package/dist/models/providers/litert/palmPrePost.d.ts.map +1 -0
  155. package/dist/models/providers/litert/palmPrePost.js +151 -0
  156. package/dist/sdkVersions.d.ts +18 -0
  157. package/dist/sdkVersions.d.ts.map +1 -0
  158. package/dist/sdkVersions.js +8 -0
  159. package/dist/selfieCapture/captureQuality.d.ts +43 -0
  160. package/dist/selfieCapture/captureQuality.d.ts.map +1 -0
  161. package/dist/selfieCapture/captureQuality.js +87 -0
  162. package/dist/selfieCapture/challengeRunner.d.ts +9 -2
  163. package/dist/selfieCapture/challengeRunner.d.ts.map +1 -1
  164. package/dist/selfieCapture/challengeRunner.js +2 -5
  165. package/dist/selfieCapture/controller.d.ts +62 -1
  166. package/dist/selfieCapture/controller.d.ts.map +1 -1
  167. package/dist/selfieCapture/controller.js +470 -105
  168. package/dist/selfieCapture/faceTracking.d.ts +69 -1
  169. package/dist/selfieCapture/faceTracking.d.ts.map +1 -1
  170. package/dist/selfieCapture/faceTracking.js +134 -6
  171. package/dist/selfieCapture/guidance.d.ts +64 -0
  172. package/dist/selfieCapture/guidance.d.ts.map +1 -1
  173. package/dist/selfieCapture/guidance.js +74 -0
  174. package/dist/selfieCapture/index.d.ts +4 -3
  175. package/dist/selfieCapture/index.d.ts.map +1 -1
  176. package/dist/selfieCapture/index.js +2 -2
  177. package/dist/selfieCapture/livenessMachine.d.ts +2 -0
  178. package/dist/selfieCapture/livenessMachine.d.ts.map +1 -1
  179. package/dist/selfieCapture/livenessMachine.js +8 -0
  180. package/dist/selfieCapture/pipeline.d.ts +8 -0
  181. package/dist/selfieCapture/pipeline.d.ts.map +1 -1
  182. package/dist/selfieCapture/pipeline.js +2 -2
  183. package/dist/selfieCapture/reducer.d.ts +7 -0
  184. package/dist/selfieCapture/reducer.d.ts.map +1 -1
  185. package/dist/selfieCapture/reducer.js +45 -4
  186. package/dist/selfieCapture/state.d.ts +6 -0
  187. package/dist/selfieCapture/state.d.ts.map +1 -1
  188. package/dist/selfieCapture/state.js +1 -0
  189. package/dist/signature/frameDecode.d.ts.map +1 -1
  190. package/dist/signature/frameDecode.js +29 -0
  191. package/dist/signature/metadata.d.ts +10 -1
  192. package/dist/signature/metadata.d.ts.map +1 -1
  193. package/dist/signature/quality.d.ts +14 -6
  194. package/dist/signature/quality.d.ts.map +1 -1
  195. package/dist/signature/quality.js +13 -4
  196. package/dist/signatureCapture/controller.d.ts +2 -1
  197. package/dist/signatureCapture/controller.d.ts.map +1 -1
  198. package/dist/signatureCapture/controller.js +118 -23
  199. package/dist/signatureCapture/pipeline.d.ts +14 -2
  200. package/dist/signatureCapture/pipeline.d.ts.map +1 -1
  201. package/dist/signatureCapture/pipeline.js +36 -8
  202. package/dist/signatureCapture/state.d.ts +15 -0
  203. package/dist/signatureCapture/state.d.ts.map +1 -1
  204. package/dist/version.d.ts +1 -1
  205. package/dist/version.d.ts.map +1 -1
  206. package/dist/version.js +1 -1
  207. package/dist/videoIdCapture/controller.d.ts.map +1 -1
  208. package/dist/videoIdCapture/controller.js +64 -3
  209. package/package.json +10 -2
@@ -0,0 +1,193 @@
1
+ import type { AutoCaptureDiagnostics } from './autoCaptureGeometry';
2
+ import type { DocumentCaptureMode } from './state';
3
+ /**
4
+ * Why auto-capture was or was not the thing that fired.
5
+ *
6
+ * A separate field rather than more `captureMode` members: `captureMode` is an
7
+ * existing wire enum the ID side shares, and widening it changes meaning for a
8
+ * flow that is not moving. These are the situations that would all otherwise
9
+ * collapse into `'Manual'`.
10
+ *
11
+ * `disabled:lateFlag` is the one worth insisting on. `autoCapture` is
12
+ * mount-time-only, so a capture screen that mounts before the host's flags land
13
+ * has auto-capture off for that applicant's entire session — and if that race
14
+ * cannot be SEEN IN THE FIELD, a misconfigured flags gate reads as "the flag is
15
+ * off and the ramp is fine."
16
+ */
17
+ export type AutoCaptureStatus =
18
+ /** The loop ran and was allowed to fire. */
19
+ 'engaged'
20
+ /** No `autoCapture` bag on this document. */
21
+ | 'disabled:unconfigured'
22
+ /** The host's feature flag was off. */
23
+ | 'disabled:flag'
24
+ /** A per-session escape (e.g. `?autoCapture=0`) turned it off. */
25
+ | 'disabled:param'
26
+ /** The bag arrived AFTER mount and was therefore ignored. */
27
+ | 'disabled:lateFlag'
28
+ /** The detector failed to load, so the screen fell back to a manual shutter. */
29
+ | 'disabled:modelLoadFailed'
30
+ /** The escape budget ran out and the applicant took the shutter. */
31
+ | 'timedOutToManual';
32
+ /**
33
+ * The accumulated reading for one capture attempt.
34
+ *
35
+ * A SIBLING of `AutoCaptureDiagnostics`, not the same type, because they differ
36
+ * on a real axis: the diagnostics bag is INSTANTANEOUS — what the engine
37
+ * believes on this frame, for someone watching glass — and this is ACCUMULATED,
38
+ * `best*` being maxima across the attempt, which is what a soak median is
39
+ * computed over. One source, two projections. Sharing one type would force
40
+ * either the live bag to carry running maxima it has no use for, or this to
41
+ * report whatever the last frame happened to say.
42
+ *
43
+ * It also deliberately DROPS `CaptureAttemptMetadata`'s `bestMaxGlareScore`,
44
+ * `bestMaxHologramScore`, `bestBarcodeScore`, `barcodeBoundingBox` and
45
+ * `livenessScore`. Reusing that type verbatim would put five permanently-
46
+ * undefined fields on every POA record and invite a reader to conclude that an
47
+ * absent `bestMaxGlareScore` means "no glare".
48
+ */
49
+ export type DocumentCaptureAttemptMetadata = {
50
+ /** Schema marker: a live backend reader already exists for `filemetadata`. */
51
+ v: 1;
52
+ captureMode: DocumentCaptureMode;
53
+ autoCaptureStatus: AutoCaptureStatus;
54
+ /**
55
+ * Attempts made for this document, including the discarded ones.
56
+ *
57
+ * Carried EXPLICITLY because `upload()` only ever runs on the accepted frame,
58
+ * so channel A sees exactly one attempt where channel B sees every one. Mean
59
+ * attempts-per-capture comes free on the ID side from its array-per-capture
60
+ * shape and here does not exist. Without this, the upload channel silently
61
+ * reports every capture as first-try — worse than reporting nothing, because
62
+ * it looks like a valid measurement.
63
+ */
64
+ attemptCount: number;
65
+ /** ms from the loop starting to the shutter firing. */
66
+ captureTime: number | null;
67
+ /** ms the whole document took, including retries. */
68
+ operationTime: number | null;
69
+ /** Frames the engine actually ran. 0 on a manual or upload record. */
70
+ framesObserved: number;
71
+ /** Maxima across the attempt. Null when the engine never ran. */
72
+ bestDetectionScore: number | null;
73
+ bestFocusScore: number | null;
74
+ /** Detection scores of the discarded attempts, oldest first. */
75
+ discardedDetectionScores: number[];
76
+ /**
77
+ * The accepted frame's box, in fractions of the GUIDE RECT — the box the
78
+ * applicant was asked to fill — like `framing`. Not the submitted image,
79
+ * which is the whole camera frame: a sheet that spilled past the guide reads
80
+ * below 0 or above 1 here while being entirely inside the picture.
81
+ */
82
+ boundingBox: {
83
+ xMin: number;
84
+ yMin: number;
85
+ xMax: number;
86
+ yMax: number;
87
+ } | null;
88
+ /**
89
+ * Framing at the accepted frame, measured against the GUIDE RECT — the box
90
+ * the applicant was asked to fill — not the submitted image. Margins are
91
+ * READINGS, not verdicts — #343 deleted the margin gate — and are carried so
92
+ * a later question about which axis bound is answerable without a new SDK
93
+ * release. A negative margin means the sheet spilled past the guide, which
94
+ * the full-frame image still contains.
95
+ */
96
+ framing: {
97
+ fill: number;
98
+ fillWidth: number;
99
+ fillHeight: number;
100
+ leftMargin: number;
101
+ rightMargin: number;
102
+ topMargin: number;
103
+ bottomMargin: number;
104
+ } | null;
105
+ /** The window in force when the shutter fired. */
106
+ fillWindow: {
107
+ fillMin: number;
108
+ fillMax: number;
109
+ } | null;
110
+ };
111
+ /** Running totals, folded one frame at a time. */
112
+ export type AttemptAccumulator = {
113
+ framesObserved: number;
114
+ bestDetectionScore: number | null;
115
+ bestFocusScore: number | null;
116
+ lastFrame: AutoCaptureDiagnostics | null;
117
+ startedAt: number | null;
118
+ attemptCount: number;
119
+ discardedDetectionScores: number[];
120
+ };
121
+ export declare function createAttemptAccumulator(): AttemptAccumulator;
122
+ /**
123
+ * Fold one frame in.
124
+ *
125
+ * `bestFocusScore` is SCOPED TO FRAMES THAT PASSED THE FILL WINDOW rather than
126
+ * being a session-wide running max, and that divergence from `idCapture` is
127
+ * required: focus and fill are orthogonal, so being the sharpest frame is no
128
+ * evidence of being a framed one, and a session-wide max would report a sharp
129
+ * reading taken from a framing the gate rejected.
130
+ */
131
+ export declare function accumulateFrame(accumulator: AttemptAccumulator, frame: AutoCaptureDiagnostics): AttemptAccumulator;
132
+ /**
133
+ * A retry starts a new attempt against the same document.
134
+ *
135
+ * The discarded attempt's detection score is kept — it is the cheapest possible
136
+ * answer to "was the loop struggling, or was the applicant?" — while the frame
137
+ * maxima reset, because they describe the attempt that produced the artifact.
138
+ */
139
+ export declare function retryAttempt(accumulator: AttemptAccumulator): AttemptAccumulator;
140
+ export type BuildAttemptMetadataOptions = {
141
+ captureMode: DocumentCaptureMode;
142
+ autoCaptureStatus: AutoCaptureStatus;
143
+ /** ms the document has been open, including retries. */
144
+ operationTime?: number | null;
145
+ /**
146
+ * The frame the submitted artifact was actually taken from.
147
+ *
148
+ * REQUIRED for an auto-capture, and the reason is a contract: `boundingBox`
149
+ * and `framing` claim to describe the accepted artifact. Falling back to the
150
+ * accumulator's last frame only holds while the shutter fires ON the frame
151
+ * it captures, which stopped being true when the burst window landed — the
152
+ * window deliberately runs through unsatisfied frames, so the last frame
153
+ * seen can be a blurred, cropped or empty one that the applicant never
154
+ * submitted. Filing that box against a sharp banked image is a measurement
155
+ * that looks valid and is not.
156
+ */
157
+ acceptedFrame?: AutoCaptureDiagnostics | null;
158
+ };
159
+ /**
160
+ * Project the accumulator into the wire record.
161
+ *
162
+ * ALWAYS EMITTED, including for the control arm and for gallery uploads — see
163
+ * `emitsForEveryCapture` below. The auto-capture-specific fields go ABSENT
164
+ * (null), never zeroed: a zeroed `bestDetectionScore` reads as "the detector
165
+ * saw nothing", which is a different and false claim from "no detector ran".
166
+ */
167
+ export declare function buildAttemptMetadata(accumulator: AttemptAccumulator | null, options: BuildAttemptMetadataOptions): DocumentCaptureAttemptMetadata;
168
+ /**
169
+ * The budget rule, enforced rather than documented.
170
+ *
171
+ * Uploads go to tusd, whose S3 store copies the ENTIRE tus metadata map into
172
+ * the object's user-defined metadata, which S3 caps at 2 KB total — and tus
173
+ * base64-encodes each value first (~1.33x), against a budget shared with
174
+ * `filetype`, `contentType`, `fingerprint`, `capturedAt`, `jobid` and `taskid`.
175
+ *
176
+ * Two constraints follow, both binding:
177
+ *
178
+ * - tusd REPLACES EVERY NON-ASCII CHARACTER WITH `?` in that copy. JSON of
179
+ * numbers and enums is pure ASCII, so a scalar spine is safe — but no
180
+ * human-readable string may ever ride here, which matters given the
181
+ * guidance strings ship in Spanish and `es` is what AMEX renders.
182
+ * - There is a second, UNCAPPED `.info` copy. The cap and the mangling apply
183
+ * to the convenient copy, not the only copy.
184
+ *
185
+ * `payload.ts`'s escape hatch — "the full analysis still reaches the submission
186
+ * body untouched" — DOES NOT EXIST HERE. With no submission body, the trimmed
187
+ * upload copy is the only wire copy, which is why channel B is not optional.
188
+ *
189
+ * This exists to stop exactly one thing: the ~300-frame diagnostics ring buffer.
190
+ */
191
+ export declare const FILE_METADATA_BUDGET_BYTES = 600;
192
+ export declare function toFileMetadata(metadata: DocumentCaptureAttemptMetadata): string;
193
+ //# sourceMappingURL=autoCaptureMetadata.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"autoCaptureMetadata.d.ts","sourceRoot":"","sources":["../../src/documentCapture/autoCaptureMetadata.ts"],"names":[],"mappings":"AAuBA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,uBAAuB,CAAA;AACnE,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAA;AAElD;;;;;;;;;;;;;GAaG;AACH,MAAM,MAAM,iBAAiB;AAC3B,4CAA4C;AAC1C,SAAS;AACX,6CAA6C;GAC3C,uBAAuB;AACzB,uCAAuC;GACrC,eAAe;AACjB,kEAAkE;GAChE,gBAAgB;AAClB,6DAA6D;GAC3D,mBAAmB;AACrB,gFAAgF;GAC9E,0BAA0B;AAC5B,oEAAoE;GAClE,kBAAkB,CAAA;AAEtB;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,MAAM,8BAA8B,GAAG;IAC3C,8EAA8E;IAC9E,CAAC,EAAE,CAAC,CAAA;IACJ,WAAW,EAAE,mBAAmB,CAAA;IAChC,iBAAiB,EAAE,iBAAiB,CAAA;IACpC;;;;;;;;;OASG;IACH,YAAY,EAAE,MAAM,CAAA;IACpB,uDAAuD;IACvD,WAAW,EAAE,MAAM,GAAG,IAAI,CAAA;IAC1B,qDAAqD;IACrD,aAAa,EAAE,MAAM,GAAG,IAAI,CAAA;IAC5B,sEAAsE;IACtE,cAAc,EAAE,MAAM,CAAA;IACtB,iEAAiE;IACjE,kBAAkB,EAAE,MAAM,GAAG,IAAI,CAAA;IACjC,cAAc,EAAE,MAAM,GAAG,IAAI,CAAA;IAC7B,gEAAgE;IAChE,wBAAwB,EAAE,MAAM,EAAE,CAAA;IAClC;;;;;OAKG;IACH,WAAW,EAAE;QACX,IAAI,EAAE,MAAM,CAAA;QACZ,IAAI,EAAE,MAAM,CAAA;QACZ,IAAI,EAAE,MAAM,CAAA;QACZ,IAAI,EAAE,MAAM,CAA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AA;CAC9C,CAAA;AAED;;;;;;;GAOG;AACH,wBAAgB,oBAAoB,CAClC,WAAW,EAAE,kBAAkB,GAAG,IAAI,EACtC,OAAO,EAAE,2BAA2B,GACnC,8BAA8B,CAiDhC;AA8BD;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,eAAO,MAAM,0BAA0B,MAAM,CAAA;AAK7C,wBAAgB,cAAc,CAC5B,QAAQ,EAAE,8BAA8B,GACvC,MAAM,CAcR"}
@@ -0,0 +1,200 @@
1
+ // What a POA capture attempt reports about itself (#377).
2
+ //
3
+ // `documentCapture` has NO SUBMISSION — `collectArtifacts` returns `{}` because
4
+ // sdk2 runs this flow at `SubmissionAction.NONE` and the uploaded ids reach the
5
+ // integrator through `onComplete`, never `/submit`. So nothing here requires a
6
+ // backend contract change, and there is no `captureAttempts.documents` key to
7
+ // design. Two channels exist instead, and both are already load-bearing
8
+ // elsewhere:
9
+ //
10
+ // A. `DocumentMetadata.filemetadata` on the existing tus upload. A PROVEN
11
+ // channel: the backend signature-video trimmer already derives its clip
12
+ // window from this field on another document type, and dropping one entry
13
+ // from it once silently disabled trimming.
14
+ // B. A field on core's `CapturedDocument` result, which rides the façade's
15
+ // `toLegacyCapturedDocument` spread through to the 2.x `onCaptured` for
16
+ // free — where a third callback argument would be dropped on the floor by
17
+ // compat's wrapper.
18
+ //
19
+ // Channel B closes the ramp gate (host-side aggregation, `distinctId = jobId`
20
+ // already wired). Channel A is the durable per-artifact record that makes a
21
+ // backend ground-truth join POSSIBLE LATER without a second SDK release.
22
+ export function createAttemptAccumulator() {
23
+ return {
24
+ framesObserved: 0,
25
+ bestDetectionScore: null,
26
+ bestFocusScore: null,
27
+ lastFrame: null,
28
+ startedAt: null,
29
+ attemptCount: 1,
30
+ discardedDetectionScores: [],
31
+ };
32
+ }
33
+ /**
34
+ * Fold one frame in.
35
+ *
36
+ * `bestFocusScore` is SCOPED TO FRAMES THAT PASSED THE FILL WINDOW rather than
37
+ * being a session-wide running max, and that divergence from `idCapture` is
38
+ * required: focus and fill are orthogonal, so being the sharpest frame is no
39
+ * evidence of being a framed one, and a session-wide max would report a sharp
40
+ * reading taken from a framing the gate rejected.
41
+ */
42
+ export function accumulateFrame(accumulator, frame) {
43
+ const inBand = !frame.fillWindow.tooClose && !frame.fillWindow.tooFar;
44
+ const focus = inBand && frame.focus ? frame.focus.score : null;
45
+ return {
46
+ ...accumulator,
47
+ framesObserved: accumulator.framesObserved + 1,
48
+ startedAt: accumulator.startedAt ?? frame.timeRunning,
49
+ bestDetectionScore: maxOrNull(accumulator.bestDetectionScore, frame.target?.score ?? null),
50
+ bestFocusScore: maxOrNull(accumulator.bestFocusScore, focus),
51
+ lastFrame: frame,
52
+ };
53
+ }
54
+ /**
55
+ * A retry starts a new attempt against the same document.
56
+ *
57
+ * The discarded attempt's detection score is kept — it is the cheapest possible
58
+ * answer to "was the loop struggling, or was the applicant?" — while the frame
59
+ * maxima reset, because they describe the attempt that produced the artifact.
60
+ */
61
+ export function retryAttempt(accumulator) {
62
+ const discarded = accumulator.bestDetectionScore;
63
+ return {
64
+ ...createAttemptAccumulator(),
65
+ attemptCount: accumulator.attemptCount + 1,
66
+ discardedDetectionScores: discarded === null
67
+ ? accumulator.discardedDetectionScores
68
+ : [...accumulator.discardedDetectionScores, round3(discarded)],
69
+ };
70
+ }
71
+ function maxOrNull(a, b) {
72
+ if (a === null)
73
+ return b;
74
+ if (b === null)
75
+ return a;
76
+ return Math.max(a, b);
77
+ }
78
+ /** Four decimals: two would round the whole framing decision away. */
79
+ function round4(value) {
80
+ return Math.round(value * 10000) / 10000;
81
+ }
82
+ function round3(value) {
83
+ return Math.round(value * 1000) / 1000;
84
+ }
85
+ /**
86
+ * Project the accumulator into the wire record.
87
+ *
88
+ * ALWAYS EMITTED, including for the control arm and for gallery uploads — see
89
+ * `emitsForEveryCapture` below. The auto-capture-specific fields go ABSENT
90
+ * (null), never zeroed: a zeroed `bestDetectionScore` reads as "the detector
91
+ * saw nothing", which is a different and false claim from "no detector ran".
92
+ */
93
+ export function buildAttemptMetadata(accumulator, options) {
94
+ // The banked frame when there is one; the last frame seen otherwise, which
95
+ // is right for a manual capture (there is no banked pair) and for the
96
+ // control arm (there are no frames at all).
97
+ const frame = options.acceptedFrame ?? accumulator?.lastFrame ?? null;
98
+ const framing = frame?.framing ?? null;
99
+ const box = frame?.target?.box ?? null;
100
+ return {
101
+ v: 1,
102
+ captureMode: options.captureMode,
103
+ autoCaptureStatus: options.autoCaptureStatus,
104
+ attemptCount: accumulator?.attemptCount ?? 1,
105
+ captureTime: accumulator && frame && accumulator.startedAt !== null
106
+ ? Math.round(frame.timeRunning - accumulator.startedAt)
107
+ : null,
108
+ operationTime: options.operationTime ?? null,
109
+ framesObserved: accumulator?.framesObserved ?? 0,
110
+ bestDetectionScore: accumulator?.bestDetectionScore === null ||
111
+ accumulator?.bestDetectionScore === undefined
112
+ ? null
113
+ : round3(accumulator.bestDetectionScore),
114
+ bestFocusScore: accumulator?.bestFocusScore === null ||
115
+ accumulator?.bestFocusScore === undefined
116
+ ? null
117
+ : round3(accumulator.bestFocusScore),
118
+ discardedDetectionScores: accumulator?.discardedDetectionScores ?? [],
119
+ boundingBox: box ? normalizeBox(box, frame) : null,
120
+ framing: framing
121
+ ? {
122
+ fill: round4(framing.fill),
123
+ fillWidth: round4(framing.fillWidth),
124
+ fillHeight: round4(framing.fillHeight),
125
+ leftMargin: round4(framing.leftMargin),
126
+ rightMargin: round4(framing.rightMargin),
127
+ topMargin: round4(framing.topMargin),
128
+ bottomMargin: round4(framing.bottomMargin),
129
+ }
130
+ : null,
131
+ fillWindow: frame
132
+ ? {
133
+ fillMin: frame.fillWindow.fillMin,
134
+ fillMax: frame.fillWindow.fillMax,
135
+ }
136
+ : null,
137
+ };
138
+ }
139
+ /**
140
+ * Fractions of the GUIDE RECT.
141
+ *
142
+ * Chosen while captures were cropped to the guide rect, so that the box
143
+ * described the image the backend received. The crop is gone — the saved image
144
+ * is the whole frame — but the field keeps its reference frame: it is public,
145
+ * it reaches every capture callback and the backend's `filemetadata` reader,
146
+ * and changing what an existing number is measured against is a silent break
147
+ * for anyone already reading it. It now pairs with `framing` as the gate's view
148
+ * of the sheet rather than as coordinates into the picture.
149
+ */
150
+ function normalizeBox(box, frame) {
151
+ const rect = frame?.guideRect;
152
+ const width = rect?.width || frame?.frameWidth || 1;
153
+ const height = rect?.height || frame?.frameHeight || 1;
154
+ const originX = rect?.x ?? 0;
155
+ const originY = rect?.y ?? 0;
156
+ return {
157
+ xMin: round4((box.xMin - originX) / width),
158
+ yMin: round4((box.yMin - originY) / height),
159
+ xMax: round4((box.xMax - originX) / width),
160
+ yMax: round4((box.yMax - originY) / height),
161
+ };
162
+ }
163
+ /**
164
+ * The budget rule, enforced rather than documented.
165
+ *
166
+ * Uploads go to tusd, whose S3 store copies the ENTIRE tus metadata map into
167
+ * the object's user-defined metadata, which S3 caps at 2 KB total — and tus
168
+ * base64-encodes each value first (~1.33x), against a budget shared with
169
+ * `filetype`, `contentType`, `fingerprint`, `capturedAt`, `jobid` and `taskid`.
170
+ *
171
+ * Two constraints follow, both binding:
172
+ *
173
+ * - tusd REPLACES EVERY NON-ASCII CHARACTER WITH `?` in that copy. JSON of
174
+ * numbers and enums is pure ASCII, so a scalar spine is safe — but no
175
+ * human-readable string may ever ride here, which matters given the
176
+ * guidance strings ship in Spanish and `es` is what AMEX renders.
177
+ * - There is a second, UNCAPPED `.info` copy. The cap and the mangling apply
178
+ * to the convenient copy, not the only copy.
179
+ *
180
+ * `payload.ts`'s escape hatch — "the full analysis still reaches the submission
181
+ * body untouched" — DOES NOT EXIST HERE. With no submission body, the trimmed
182
+ * upload copy is the only wire copy, which is why channel B is not optional.
183
+ *
184
+ * This exists to stop exactly one thing: the ~300-frame diagnostics ring buffer.
185
+ */
186
+ export const FILE_METADATA_BUDGET_BYTES = 600;
187
+ /** How many discarded scores fit before the spine risks the budget. */
188
+ const MAX_DISCARDED_SCORES = 8;
189
+ export function toFileMetadata(metadata) {
190
+ const trimmed = {
191
+ ...metadata,
192
+ discardedDetectionScores: metadata.discardedDetectionScores.slice(0, MAX_DISCARDED_SCORES),
193
+ };
194
+ const json = JSON.stringify(trimmed);
195
+ if (json.length <= FILE_METADATA_BUDGET_BYTES)
196
+ return json;
197
+ // Drop the optional collection before the scalar spine. Nothing below this
198
+ // point is unbounded, so one fallback is enough.
199
+ return JSON.stringify({ ...trimmed, discardedDetectionScores: [] });
200
+ }
@@ -0,0 +1,211 @@
1
+ import type { DocumentDetectorRuntime } from '../models/DocumentDetection';
2
+ /**
3
+ * The four numeric gates, all required.
4
+ *
5
+ * Callers override a subset through `DocumentAutoCaptureOptions['thresholds']`,
6
+ * which is a `Partial` of this — so the resolved form and the override form are
7
+ * the same shape and cannot drift apart.
8
+ *
9
+ * Every value here is an OPERATING POINT, not a separator. The distributions
10
+ * they sit between touch: complete sheets max 0.996 against a held crop's min
11
+ * 0.994; readable framings min 0.710 against too-far max 0.721. What makes them
12
+ * defensible is the replay simulation over four real recordings, not any
13
+ * separation in the data (#380).
14
+ */
15
+ export type DocumentAutoCaptureThresholds = {
16
+ /** Lower edge of #343's two-sided `fill` window — below it, "move closer". */
17
+ fillMin: number;
18
+ /** Upper edge — the anti-crop gate that IS the AMEX failure. "Move back." */
19
+ fillMax: number;
20
+ /** Minimum pairwise IoU across the stability window. NOT a score gate. */
21
+ stability: number;
22
+ /** Focus floor, already resolved for the platform branch in force. */
23
+ focus: number;
24
+ };
25
+ /**
26
+ * Per-document auto-capture options.
27
+ *
28
+ * PRESENCE is the opt-in: `autoCapture: {}` runs the loop with every default in
29
+ * force, and omitting it leaves today's manual shutter untouched. There is
30
+ * deliberately no `enabled?: boolean` member — that member is the cascade trap
31
+ * in its purest form (`item.autoCapture?.enabled ?? config.autoCapture?.enabled
32
+ * ?? true`) and would have been this repo's fifth incident.
33
+ *
34
+ * Adding members later is additive and non-breaking, so nothing is reserved
35
+ * here against future use.
36
+ */
37
+ export type DocumentAutoCaptureOptions = {
38
+ /** Labels framing may be measured on, in priority order. */
39
+ targetLabels?: readonly string[];
40
+ /** Confidence floor a box must clear before geometry is taken from it. */
41
+ minScore?: number;
42
+ /** Length of both the IoU window and the `fill` window, in frames. */
43
+ stabilityFrames?: number;
44
+ /** ms of sustained gate failure before the manual shutter is offered. 0 disables. */
45
+ manualFallbackAfterMs?: number;
46
+ /**
47
+ * ms to keep looking for a sharper frame once the gates are satisfied.
48
+ * 0 fires on the first satisfied frame, which is the pre-burst behaviour.
49
+ */
50
+ burstWindowMs?: number;
51
+ /**
52
+ * ms to keep looking for a sharper frame after the applicant TAPS. 0 saves
53
+ * the frame the tap landed on, which is the pre-burst behaviour.
54
+ */
55
+ manualBurstWindowMs?: number;
56
+ thresholds?: Partial<DocumentAutoCaptureThresholds>;
57
+ };
58
+ /** Environment the resolver cannot read for itself. */
59
+ export type AutoCaptureEnvironment = {
60
+ /** Which branch of `POA_FOCUS_THRESHOLDS` applies. */
61
+ onMobile?: boolean;
62
+ /** What the integrator asked for on `DocumentCaptureControllerConfig`. */
63
+ documentDetectorRuntime?: DocumentDetectorRuntime;
64
+ };
65
+ /** `DocumentAutoCaptureOptions` with every value decided. */
66
+ export type ResolvedAutoCapture = {
67
+ targetLabels: readonly string[];
68
+ minScore: number;
69
+ stabilityFrames: number;
70
+ manualFallbackAfterMs: number;
71
+ burstWindowMs: number;
72
+ manualBurstWindowMs: number;
73
+ thresholds: DocumentAutoCaptureThresholds;
74
+ /** Which focus branch produced `thresholds.focus`. Reported, not inferred. */
75
+ focusBranch: 'desktop' | 'mobile';
76
+ /** Pinned; see `resolveDocumentDetectorRuntime`. */
77
+ documentDetectorRuntime: DocumentDetectorRuntime;
78
+ };
79
+ /** Frames the IoU window holds before a stability verdict is possible. */
80
+ export declare const DEFAULT_STABILITY_FRAMES = 12;
81
+ /**
82
+ * Minimum pairwise IoU across the stability window.
83
+ *
84
+ * Seeded from `defaultDocumentDetectionThresholds.stability.singlePage` and
85
+ * left there by #380: stability resolves in ~690 ms of not moving, so it is
86
+ * rarely the binding gate.
87
+ */
88
+ export declare const DEFAULT_STABILITY_IOU = 0.5;
89
+ /**
90
+ * ms of sustained gate failure before the manual shutter is offered (#345).
91
+ *
92
+ * RAISED FROM 8000 ON FIELD EVIDENCE. The 8 s value was inherited from
93
+ * `idCapture`'s `allowOverrideWrongDocumentTypeAfterMs`, tuned for the
94
+ * wrong-document-type case, with no POA number behind it — and its own note
95
+ * predicted this outcome:
96
+ *
97
+ * > The hard recording first-captures at 11.5 s, so on hard-but-recoverable
98
+ * > framings the dialog will be offered BEFORE the loop succeeds. That is
99
+ * > harmless by construction — the loop stays armed until the applicant
100
+ * > accepts — but the dialog will be common, and nobody has watched a real
101
+ * > applicant react to it.
102
+ *
103
+ * Someone has now watched, and it pops while the loop is still converging.
104
+ * "Harmless by construction" was true of the CAPTURE and false of the
105
+ * experience: being offered a way out mid-attempt reads as the SDK giving up.
106
+ *
107
+ * 30 s clears the 11.5 s hard-recording first-capture with room, so the offer
108
+ * arrives after the loop has plainly failed rather than during its slowest
109
+ * success. Still an operating point rather than a measurement — what would
110
+ * move it is a distribution of real time-to-capture, not another guess.
111
+ */
112
+ export declare const DEFAULT_MANUAL_FALLBACK_AFTER_MS = 30000;
113
+ /**
114
+ * Camera width worth requesting for auto-capture, as a RECOMMENDATION.
115
+ *
116
+ * An A4 page filling the portrait guide on the default 1920-wide 16:9 stream
117
+ * spans about 764x1080 pixels, so it lands near 90 DPI — 6pt print about two
118
+ * pixels tall. That is a sampling limit, not blur, and no focus threshold
119
+ * recovers it. The same page on 2560 is about 1018x1440.
120
+ *
121
+ * NOT APPLIED AUTOMATICALLY, and that is the finding rather than an oversight.
122
+ * It was, briefly, and it made captures materially harder to land: the loop
123
+ * draws every frame at the stream's size, so a bigger frame costs more per
124
+ * frame, and both the stability and fill windows are twelve FRAMES — a slower
125
+ * loop stretches the hold-still the applicant has to sustain. Some devices
126
+ * also answer a larger width with a lower-frame-rate capture mode, which
127
+ * compounds it.
128
+ *
129
+ * So this is a number to pass deliberately, per integration, after watching
130
+ * `frameRate` on the tuning overlay:
131
+ *
132
+ * <DocumentCapture camera={{ maxVideoWidth: AUTO_CAPTURE_VIDEO_WIDTH }} … />
133
+ *
134
+ * Re-landing it as a default needs a frame-rate measurement across the target
135
+ * device range, not another guess.
136
+ */
137
+ export declare const AUTO_CAPTURE_VIDEO_WIDTH = 2560;
138
+ /**
139
+ * ms to keep looking for a sharper frame after the gates first go green.
140
+ *
141
+ * WHY THIS EXISTS. Two of the three gates are windowed and slow-moving — fill
142
+ * is a 12-frame mean and stability is a 12-frame IoU — so they ratchet into
143
+ * satisfaction and stay there. Focus is the only single-frame gate. Firing on
144
+ * the first satisfied frame therefore fires the instant FOCUS first crosses
145
+ * its threshold, and that threshold is deliberately permissive: #380 lowered
146
+ * it to 0.5 because 0.6 was rejecting 4.8% of live frames.
147
+ *
148
+ * A first-crossing rule on a noisy signal is biased toward the threshold by
149
+ * construction — it catches marginal upward excursions. So the shutter was
150
+ * systematically capturing near the floor on exactly the holds where focus was
151
+ * the binding gate, which is the motion blur this addresses.
152
+ *
153
+ * Expressed in MILLISECONDS and converted through the measured frame rate,
154
+ * like `manualFallbackAfterMs`, so the pause is the same length of time on a
155
+ * fast phone and a slow one. A fixed frame count would be 200 ms at 30 fps and
156
+ * 750 ms at 8 fps — the device that can least afford the wait would wait
157
+ * longest.
158
+ *
159
+ * 300 ms is #383's `mean of 6` translated into time: six frames at the ~20 fps
160
+ * this loop runs at. It is an operating point, not a measurement.
161
+ */
162
+ export declare const DEFAULT_BURST_WINDOW_MS = 300;
163
+ /**
164
+ * The same idea pointed at the applicant's tap, and longer on purpose.
165
+ *
166
+ * Pressing a phone's screen moves the phone. The frame the tap lands on is
167
+ * therefore among the WORST frames available — the finger has already made
168
+ * contact and the transient has not damped — so saving it is sampling the
169
+ * blur rather than avoiding it. This is the one complaint about hand-held
170
+ * manual capture that no amount of guidance can fix, because the guidance is
171
+ * correct right up until the moment the applicant acts on it.
172
+ *
173
+ * The window opens AT the tap and never reaches backwards. Frames from before
174
+ * it are sharper still, and deliberately out of scope: the tap is the
175
+ * applicant's intent expressed at a moment of their choosing, and submitting
176
+ * pixels from before it would be a different photo than the one they took.
177
+ * What the window buys is the settle on the far side.
178
+ *
179
+ * Longer than `burstWindowMs` because it has different work to do. That one
180
+ * picks the best of frames the gates have already certified; this one has to
181
+ * OUTLIVE a physical transient, and a window that ends inside the jostle has
182
+ * only jostled frames to choose between. 400 ms covers the damping on a
183
+ * hand-held phone with room on either side. It is an operating point, not a
184
+ * measurement — if it reads as lag, this is the number to turn down.
185
+ */
186
+ export declare const DEFAULT_MANUAL_BURST_WINDOW_MS = 400;
187
+ /**
188
+ * Pin the document detector to the runtime that can actually run the POA
189
+ * artifact.
190
+ *
191
+ * The artifact's input tensor is uint8, and the mediapipe provider cannot load
192
+ * a raw `.tflite` at all — so `'mediapipe'` is downgraded with a warning rather
193
+ * than left to fail at the first frame, where it reads as a broken camera.
194
+ *
195
+ * The WebGPU half of this hazard is already closed one layer down:
196
+ * `providers/litert/DocumentDetection.ts` forces the `'wasm'` accelerator
197
+ * unconditionally, because LiteRT.js's WebGPU backend cannot allocate uint8
198
+ * tensor buffers and throws at the first `model.run()`. No knob on this surface
199
+ * can reach WebGPU, which is also why the Adreno/Snapdragon WebGPU hazard is
200
+ * moot here — it returns only if a future export drops uint8.
201
+ */
202
+ export declare function resolveDocumentDetectorRuntime(requested: DocumentDetectorRuntime | undefined): DocumentDetectorRuntime;
203
+ /**
204
+ * Turn an all-optional `autoCapture` bag into a total one.
205
+ *
206
+ * Both parameters are `| undefined` and the return type has no optional
207
+ * members, which is the whole point: there is exactly one `??` per value, in
208
+ * one file, against one constant.
209
+ */
210
+ export declare function resolveAutoCapture(options: DocumentAutoCaptureOptions | undefined, environment: AutoCaptureEnvironment | undefined): ResolvedAutoCapture;
211
+ //# sourceMappingURL=autoCaptureOptions.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"autoCaptureOptions.d.ts","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