idmission-web-sdk 2.1.73 → 2.1.74
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.
- package/dist/components/id_capture/IdCapture.d.ts +1 -0
- package/dist/components/id_capture/IdCaptureStateProvider.d.ts +1 -0
- package/dist/lib/locales/es/translation.d.ts +1 -0
- package/dist/lib/locales/index.d.ts +1 -0
- package/dist/lib/models/DocumentDetection.d.ts +5 -0
- package/dist/sdk2.cjs.development.js +87 -39
- package/dist/sdk2.cjs.development.js.map +1 -1
- package/dist/sdk2.cjs.production.js +1 -1
- package/dist/sdk2.cjs.production.js.map +1 -1
- package/dist/sdk2.esm.js +87 -39
- package/dist/sdk2.esm.js.map +1 -1
- package/dist/sdk2.umd.development.js +87 -39
- package/dist/sdk2.umd.development.js.map +1 -1
- package/dist/sdk2.umd.production.js +1 -1
- package/dist/sdk2.umd.production.js.map +1 -1
- package/dist/version.d.ts +1 -1
- package/package.json +1 -1
package/dist/sdk2.esm.js
CHANGED
|
@@ -204,7 +204,7 @@ typeof SuppressedError === "function" ? SuppressedError : function (error, suppr
|
|
|
204
204
|
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
205
205
|
};
|
|
206
206
|
|
|
207
|
-
var webSdkVersion = '2.1.
|
|
207
|
+
var webSdkVersion = '2.1.74';
|
|
208
208
|
|
|
209
209
|
function getPlatform() {
|
|
210
210
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
@@ -5409,7 +5409,8 @@ var defaultDocumentDetectionModelLoadTimeoutMs = 45000;
|
|
|
5409
5409
|
var defaultDocumentDetectionThresholds = {
|
|
5410
5410
|
idCardFront: 0.6,
|
|
5411
5411
|
idCardBack: 0.6,
|
|
5412
|
-
passport: 0.4
|
|
5412
|
+
passport: 0.4,
|
|
5413
|
+
stability: 0.9
|
|
5413
5414
|
};
|
|
5414
5415
|
var documentTypeDisplayNames = {
|
|
5415
5416
|
idCardFront: 'ID card front',
|
|
@@ -5551,6 +5552,13 @@ function makeDocumentDetectorPrediction(detector, frame) {
|
|
|
5551
5552
|
});
|
|
5552
5553
|
});
|
|
5553
5554
|
}
|
|
5555
|
+
var lastNBoxes = [];
|
|
5556
|
+
var lastDetectionAt = 0;
|
|
5557
|
+
var lastDetectionTime = 0;
|
|
5558
|
+
function setLastDetectionAt(time) {
|
|
5559
|
+
lastDetectionTime = time - lastDetectionAt;
|
|
5560
|
+
lastDetectionAt = time;
|
|
5561
|
+
}
|
|
5554
5562
|
var defaultDocumentDetectionBoundaries = {
|
|
5555
5563
|
top: 20,
|
|
5556
5564
|
bottom: 20,
|
|
@@ -5558,7 +5566,7 @@ var defaultDocumentDetectionBoundaries = {
|
|
|
5558
5566
|
right: 20
|
|
5559
5567
|
};
|
|
5560
5568
|
function processDocumentDetectorPrediction(prediction, thresholds, boundaries) {
|
|
5561
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
|
5569
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
|
|
5562
5570
|
if (boundaries === void 0) {
|
|
5563
5571
|
boundaries = defaultDocumentDetectionBoundaries;
|
|
5564
5572
|
}
|
|
@@ -5614,11 +5622,11 @@ function processDocumentDetectorPrediction(prediction, thresholds, boundaries) {
|
|
|
5614
5622
|
var boundaryLeft = (_j = boundaries.left) !== null && _j !== void 0 ? _j : 20;
|
|
5615
5623
|
var boundaryRight = (_k = boundaries.right) !== null && _k !== void 0 ? _k : 20;
|
|
5616
5624
|
var boundaryBottom = (_l = boundaries.bottom) !== null && _l !== void 0 ? _l : 20;
|
|
5617
|
-
var
|
|
5618
|
-
xMin =
|
|
5619
|
-
yMin =
|
|
5620
|
-
width =
|
|
5621
|
-
height =
|
|
5625
|
+
var _o = bestDocument.box,
|
|
5626
|
+
xMin = _o.xMin,
|
|
5627
|
+
yMin = _o.yMin,
|
|
5628
|
+
width = _o.width,
|
|
5629
|
+
height = _o.height;
|
|
5622
5630
|
documentInBounds = yMin > boundaryTop &&
|
|
5623
5631
|
// Is it valid top edge of ID detected?
|
|
5624
5632
|
yMin + height + boundaryBottom < frameHeight && (
|
|
@@ -5627,12 +5635,23 @@ function processDocumentDetectorPrediction(prediction, thresholds, boundaries) {
|
|
|
5627
5635
|
// If either the left side visible or if not, right edge of ID should be more than 80% of width.
|
|
5628
5636
|
xMin + width + boundaryRight < frameWidth; // Valid right edge if it's less than video width.
|
|
5629
5637
|
}
|
|
5638
|
+
var documentIsStable = false;
|
|
5630
5639
|
var documentTooClose = false;
|
|
5631
5640
|
if (bestDocument) {
|
|
5632
|
-
var
|
|
5633
|
-
docWidth =
|
|
5634
|
-
docHeight =
|
|
5641
|
+
var _p = [bestDocument.box.width / frameWidth, bestDocument.box.height / frameHeight],
|
|
5642
|
+
docWidth = _p[0],
|
|
5643
|
+
docHeight = _p[1];
|
|
5635
5644
|
documentTooClose = docWidth > 0.85 || docHeight > 0.85;
|
|
5645
|
+
if (detectionThresholdMet) {
|
|
5646
|
+
var threshold_1 = (_m = thresholds.stability) !== null && _m !== void 0 ? _m : defaultDocumentDetectionThresholds.stability;
|
|
5647
|
+
var framesNeeded = Math.ceil(Math.min(1000 / lastDetectionTime, 12));
|
|
5648
|
+
lastNBoxes = __spreadArray([bestDocument.box], lastNBoxes, true).slice(0, framesNeeded);
|
|
5649
|
+
documentIsStable = lastNBoxes.length >= framesNeeded && !createPairs(lastNBoxes).some(function (_a) {
|
|
5650
|
+
var a = _a[0],
|
|
5651
|
+
b = _a[1];
|
|
5652
|
+
return calculateIoU(a, b) < threshold_1;
|
|
5653
|
+
});
|
|
5654
|
+
}
|
|
5636
5655
|
}
|
|
5637
5656
|
return {
|
|
5638
5657
|
detectedObjects: detectedObjects,
|
|
@@ -5649,6 +5668,7 @@ function processDocumentDetectorPrediction(prediction, thresholds, boundaries) {
|
|
|
5649
5668
|
bestDocument: bestDocument,
|
|
5650
5669
|
documentInBounds: documentInBounds,
|
|
5651
5670
|
documentTooClose: documentTooClose,
|
|
5671
|
+
documentIsStable: documentIsStable,
|
|
5652
5672
|
frameWidth: frameWidth,
|
|
5653
5673
|
frameHeight: frameHeight,
|
|
5654
5674
|
allZero: allZero
|
|
@@ -5668,6 +5688,27 @@ function applyNonMaxSuppression(detectedObjects) {
|
|
|
5668
5688
|
return !!obj;
|
|
5669
5689
|
});
|
|
5670
5690
|
}
|
|
5691
|
+
function createPairs(arr) {
|
|
5692
|
+
var pairs = [];
|
|
5693
|
+
for (var i = 0; i < arr.length - 1; i++) {
|
|
5694
|
+
pairs.push([arr[i], arr[i + 1]]);
|
|
5695
|
+
}
|
|
5696
|
+
return pairs;
|
|
5697
|
+
}
|
|
5698
|
+
function calculateIoU(boxA, boxB) {
|
|
5699
|
+
var xA = Math.max(boxA.xMin, boxB.xMin);
|
|
5700
|
+
var yA = Math.max(boxA.yMin, boxB.yMin);
|
|
5701
|
+
var xB = Math.min(boxA.xMax, boxB.xMax);
|
|
5702
|
+
var yB = Math.min(boxA.yMax, boxB.yMax);
|
|
5703
|
+
var intersectWidth = Math.max(0, xB - xA);
|
|
5704
|
+
var intersectHeight = Math.max(0, yB - yA);
|
|
5705
|
+
var intersectionArea = intersectWidth * intersectHeight;
|
|
5706
|
+
var boxAArea = (boxA.xMax - boxA.xMin) * (boxA.yMax - boxA.yMin);
|
|
5707
|
+
var boxBArea = (boxB.xMax - boxB.xMin) * (boxB.yMax - boxB.yMin);
|
|
5708
|
+
var unionArea = boxAArea + boxBArea - intersectionArea;
|
|
5709
|
+
if (unionArea === 0) return 0;
|
|
5710
|
+
return intersectionArea / unionArea;
|
|
5711
|
+
}
|
|
5671
5712
|
|
|
5672
5713
|
function useFrameLoop(fn, _a) {
|
|
5673
5714
|
var _b = _a.throttleMs,
|
|
@@ -5685,16 +5726,20 @@ function useFrameLoop(fn, _a) {
|
|
|
5685
5726
|
var currentLoopId = loopId.current;
|
|
5686
5727
|
function renderPrediction() {
|
|
5687
5728
|
return __awaiter(this, void 0, void 0, function () {
|
|
5729
|
+
var start, took, amountToThrottle;
|
|
5688
5730
|
return __generator(this, function (_a) {
|
|
5689
5731
|
switch (_a.label) {
|
|
5690
5732
|
case 0:
|
|
5691
5733
|
if (currentLoopId !== loopId.current) return [2 /*return*/];
|
|
5734
|
+
start = new Date().getTime();
|
|
5692
5735
|
return [4 /*yield*/, fn(frameId.current)];
|
|
5693
5736
|
case 1:
|
|
5694
5737
|
_a.sent();
|
|
5738
|
+
took = new Date().getTime() - start;
|
|
5739
|
+
amountToThrottle = Math.max((throttleMs !== null && throttleMs !== void 0 ? throttleMs : 0) - took, 0);
|
|
5695
5740
|
timer = setTimeout(function () {
|
|
5696
5741
|
frameId.current = requestAnimationFrame(renderPrediction);
|
|
5697
|
-
},
|
|
5742
|
+
}, amountToThrottle);
|
|
5698
5743
|
return [2 /*return*/];
|
|
5699
5744
|
}
|
|
5700
5745
|
});
|
|
@@ -5760,29 +5805,27 @@ function DocumentDetectionModelProvider(_a) {
|
|
|
5760
5805
|
var _b = _a.autoStart,
|
|
5761
5806
|
autoStart = _b === void 0 ? true : _b,
|
|
5762
5807
|
children = _a.children,
|
|
5763
|
-
|
|
5764
|
-
|
|
5765
|
-
|
|
5766
|
-
|
|
5767
|
-
|
|
5768
|
-
|
|
5769
|
-
|
|
5808
|
+
_c = _a.throttleMs,
|
|
5809
|
+
throttleMs = _c === void 0 ? 16 : _c,
|
|
5810
|
+
_d = _a.documentDetectionModelPath,
|
|
5811
|
+
documentDetectionModelPath = _d === void 0 ? defaultDocumentDetectorModelPath : _d,
|
|
5812
|
+
_e = _a.documentDetectionModelScoreThreshold,
|
|
5813
|
+
documentDetectionModelScoreThreshold = _e === void 0 ? defaultDocumentDetectionScoreThreshold : _e,
|
|
5814
|
+
_f = _a.documentDetectionModelLoadTimeoutMs,
|
|
5815
|
+
documentDetectionModelLoadTimeoutMs = _f === void 0 ? defaultDocumentDetectionModelLoadTimeoutMs : _f,
|
|
5770
5816
|
onDocumentDetectionModelError = _a.onDocumentDetectionModelError;
|
|
5771
|
-
var
|
|
5772
|
-
videoRef =
|
|
5773
|
-
videoLoaded =
|
|
5774
|
-
cameraReady =
|
|
5817
|
+
var _g = useContext(CameraStateContext),
|
|
5818
|
+
videoRef = _g.videoRef,
|
|
5819
|
+
videoLoaded = _g.videoLoaded,
|
|
5820
|
+
cameraReady = _g.cameraReady;
|
|
5775
5821
|
var lastPredictionCanvas = useRef(null);
|
|
5776
5822
|
var onPredictionHandler = useRef();
|
|
5777
|
-
var
|
|
5778
|
-
documentDetectionThresholds =
|
|
5779
|
-
setDocumentDetectionThresholds =
|
|
5780
|
-
var
|
|
5781
|
-
documentDetectionBoundaries =
|
|
5782
|
-
setDocumentDetectionBoundaries =
|
|
5783
|
-
var _j = useState(0),
|
|
5784
|
-
detectionTime = _j[0],
|
|
5785
|
-
setDetectionTime = _j[1];
|
|
5823
|
+
var _h = useState({}),
|
|
5824
|
+
documentDetectionThresholds = _h[0],
|
|
5825
|
+
setDocumentDetectionThresholds = _h[1];
|
|
5826
|
+
var _j = useState(defaultDocumentDetectionBoundaries),
|
|
5827
|
+
documentDetectionBoundaries = _j[0],
|
|
5828
|
+
setDocumentDetectionBoundaries = _j[1];
|
|
5786
5829
|
var _k = useState(0),
|
|
5787
5830
|
timesAllZero = _k[0],
|
|
5788
5831
|
setTimesAllZero = _k[1];
|
|
@@ -5824,7 +5867,7 @@ function DocumentDetectionModelProvider(_a) {
|
|
|
5824
5867
|
if (!prediction) return [3 /*break*/, 3];
|
|
5825
5868
|
processedPrediction = processDocumentDetectorPrediction(prediction, documentDetectionThresholds, documentDetectionBoundaries);
|
|
5826
5869
|
processedPrediction.frameId = frameId;
|
|
5827
|
-
|
|
5870
|
+
setLastDetectionAt(new Date().getTime());
|
|
5828
5871
|
debug(processedPrediction);
|
|
5829
5872
|
if (processedPrediction.allZero) setTimesAllZero(function (n) {
|
|
5830
5873
|
return n + 1;
|
|
@@ -5867,7 +5910,7 @@ function DocumentDetectionModelProvider(_a) {
|
|
|
5867
5910
|
documentDetectionModelError: modelError,
|
|
5868
5911
|
documentDetectionModelDownloadProgress: modelDownloadProgress,
|
|
5869
5912
|
onDocumentDetected: onDocumentDetected,
|
|
5870
|
-
detectionTime:
|
|
5913
|
+
detectionTime: lastDetectionTime,
|
|
5871
5914
|
documentDetectionThresholds: documentDetectionThresholds,
|
|
5872
5915
|
setDocumentDetectionThresholds: setDocumentDetectionThresholds,
|
|
5873
5916
|
documentDetectionBoundaries: documentDetectionBoundaries,
|
|
@@ -5875,7 +5918,7 @@ function DocumentDetectionModelProvider(_a) {
|
|
|
5875
5918
|
documentDetectionLastPredictionCanvas: lastPredictionCanvas,
|
|
5876
5919
|
clearDocumentDetectionLastPredictionCanvas: clearDocumentDetectionLastPredictionCanvas
|
|
5877
5920
|
};
|
|
5878
|
-
}, [start, stop, ready, modelError, modelDownloadProgress, onDocumentDetected,
|
|
5921
|
+
}, [start, stop, ready, modelError, modelDownloadProgress, onDocumentDetected, documentDetectionThresholds, documentDetectionBoundaries, clearDocumentDetectionLastPredictionCanvas]);
|
|
5879
5922
|
return /*#__PURE__*/React.createElement(DocumentDetectionModelContext.Provider, {
|
|
5880
5923
|
value: value
|
|
5881
5924
|
}, /*#__PURE__*/React.createElement(InvisibleCanvas, {
|
|
@@ -6213,6 +6256,7 @@ var initialState$4 = {
|
|
|
6213
6256
|
detectionThresholdMet: false,
|
|
6214
6257
|
documentInBounds: false,
|
|
6215
6258
|
documentTooClose: false,
|
|
6259
|
+
documentIsStable: false,
|
|
6216
6260
|
flipRequired: false,
|
|
6217
6261
|
backDetectedFirst: false,
|
|
6218
6262
|
idCardDetectedButNotAllowed: false,
|
|
@@ -6331,6 +6375,7 @@ var _reducer = function reducer(state, action) {
|
|
|
6331
6375
|
bestDocument = _d.bestDocument,
|
|
6332
6376
|
documentInBounds = _d.documentInBounds,
|
|
6333
6377
|
documentTooClose = _d.documentTooClose,
|
|
6378
|
+
documentIsStable = _d.documentIsStable,
|
|
6334
6379
|
focusScore = _d.focusScore,
|
|
6335
6380
|
focusThresholdMet = _d.focusThresholdMet,
|
|
6336
6381
|
frameWidth = _d.frameWidth,
|
|
@@ -6352,7 +6397,7 @@ var _reducer = function reducer(state, action) {
|
|
|
6352
6397
|
if (state.captureState === 'capturing' && (flipRequired || backDetectedFirst)) {
|
|
6353
6398
|
wrongDocumentTypePredictions += 1;
|
|
6354
6399
|
}
|
|
6355
|
-
var isGoodFrame = detectionThresholdMet && documentInBounds && !documentTooClose && !flipRequired && !backDetectedFirst && focusThresholdMet;
|
|
6400
|
+
var isGoodFrame = detectionThresholdMet && documentInBounds && !documentTooClose && !flipRequired && !backDetectedFirst && focusThresholdMet && documentIsStable;
|
|
6356
6401
|
var goodFramesCount = state.goodFramesCount;
|
|
6357
6402
|
if (isGoodFrame) {
|
|
6358
6403
|
goodFramesCount += 1;
|
|
@@ -6387,6 +6432,7 @@ var _reducer = function reducer(state, action) {
|
|
|
6387
6432
|
detectionThresholdMet: detectionThresholdMet,
|
|
6388
6433
|
documentInBounds: documentInBounds,
|
|
6389
6434
|
documentTooClose: documentTooClose,
|
|
6435
|
+
documentIsStable: documentIsStable,
|
|
6390
6436
|
flipRequired: flipRequired,
|
|
6391
6437
|
backDetectedFirst: backDetectedFirst,
|
|
6392
6438
|
idCardDetectedButNotAllowed: idCardDetectedButNotAllowed,
|
|
@@ -6806,6 +6852,7 @@ var esTranslation = {
|
|
|
6806
6852
|
'Document not detected': 'No se ha detectado el documento',
|
|
6807
6853
|
'Document is not centered': 'Documento no centrado',
|
|
6808
6854
|
'Document too close, please back up': 'Documento muy cerca, favor de alejarse',
|
|
6855
|
+
'Please hold your ID document steady': 'Por favor, mantenga firme su documento de identidad',
|
|
6809
6856
|
'Document out of focus – try improving the lighting': 'Documento no enfocado - hay que tratar de mejorar la iluminación',
|
|
6810
6857
|
'ID card front detected - please flip your ID card': 'Anverso de ID detectado, por favor voltea tu identificación',
|
|
6811
6858
|
'ID card back detected - please flip your ID card': 'Reverso de ID detectado, por favor voltea tu identificación',
|
|
@@ -7127,7 +7174,8 @@ var IdCapture = function IdCapture(_a) {
|
|
|
7127
7174
|
guidanceTooCloseText: 'Document too close, please back up',
|
|
7128
7175
|
guidanceNotDetectedText: 'Document not detected',
|
|
7129
7176
|
guidanceIdCardNotAllowedText: 'ID card detected, please scan a passport instead',
|
|
7130
|
-
guidancePassportNotAllowedText: 'Passport detected, please scan an ID card instead'
|
|
7177
|
+
guidancePassportNotAllowedText: 'Passport detected, please scan an ID card instead',
|
|
7178
|
+
guidanceNotStableText: 'Please hold your ID document steady'
|
|
7131
7179
|
});
|
|
7132
7180
|
var debugScalingDetails = useDebugScalingDetails({
|
|
7133
7181
|
enabled: debugMode,
|
|
@@ -7138,7 +7186,7 @@ var IdCapture = function IdCapture(_a) {
|
|
|
7138
7186
|
});
|
|
7139
7187
|
var satisfied = state.isGoodFrame;
|
|
7140
7188
|
if (typeof guidanceSatisfied === 'boolean') satisfied = guidanceSatisfied;
|
|
7141
|
-
guidanceMessage || (guidanceMessage = satisfied ? verbiage.guidanceSatisfiedText : !state.detectionThresholdMet ? verbiage.guidanceNotDetectedText : state.backDetectedFirst ? verbiage.guidanceBackDetectedFirstText : state.flipRequired ? verbiage.guidancePleaseFlipText : state.idCardDetectedButNotAllowed ? verbiage.guidanceIdCardNotAllowedText : state.passportDetectedButNotAllowed ? verbiage.guidancePassportNotAllowedText : !state.documentInBounds ? verbiage.guidanceNotCenteredText : state.documentTooClose ? verbiage.guidanceTooCloseText : !state.focusThresholdMet ? verbiage.guidanceTooBlurryText : '');
|
|
7189
|
+
guidanceMessage || (guidanceMessage = satisfied ? verbiage.guidanceSatisfiedText : !state.detectionThresholdMet ? verbiage.guidanceNotDetectedText : state.backDetectedFirst ? verbiage.guidanceBackDetectedFirstText : state.flipRequired ? verbiage.guidancePleaseFlipText : state.idCardDetectedButNotAllowed ? verbiage.guidanceIdCardNotAllowedText : state.passportDetectedButNotAllowed ? verbiage.guidancePassportNotAllowedText : !state.documentInBounds ? verbiage.guidanceNotCenteredText : state.documentTooClose ? verbiage.guidanceTooCloseText : !state.focusThresholdMet ? verbiage.guidanceTooBlurryText : !state.documentIsStable ? verbiage.guidanceNotStableText : '');
|
|
7142
7190
|
return /*#__PURE__*/React__default.createElement(PageContainer, {
|
|
7143
7191
|
ref: ref,
|
|
7144
7192
|
className: "flex ".concat((_h = classNames.container) !== null && _h !== void 0 ? _h : '')
|
|
@@ -7163,7 +7211,7 @@ var IdCapture = function IdCapture(_a) {
|
|
|
7163
7211
|
scaling: debugScalingDetails,
|
|
7164
7212
|
flipX: !((_a = cameraRef.current) === null || _a === void 0 ? void 0 : _a.isRearFacing)
|
|
7165
7213
|
});
|
|
7166
|
-
}))), debugMode && ( /*#__PURE__*/React__default.createElement(DebugStatsPane, null, cameraRef.current ? ( /*#__PURE__*/React__default.createElement(React__default.Fragment, null, "\u2705 Camera: ", cameraRef.current.label, " (", cameraRef.current.width, "x", cameraRef.current.height, ")")) : '❌ Camera not ready', /*#__PURE__*/React__default.createElement("br", null), state.frameCaptureRate > 0.75 ? '✅' : '👎', " Frame Rate:", ' ', Math.round((state.frameCaptureRate + Number.EPSILON) * 1000) / 1000, ' ', "fps (", detectionTime, "ms doc detect, ", focusPredictionTime, "ms focus)", /*#__PURE__*/React__default.createElement("br", null), modelsReady ? ( /*#__PURE__*/React__default.createElement(React__default.Fragment, null, state.detectionThresholdMet ? '✅' : '❌', " Detected Document Type: ", state.detectedDocumentType, /*#__PURE__*/React__default.createElement("br", null), state.idCardFrontDetectionThresholdMet ? '✅' : '❌', " ID Card Front Score: ", state.idCardFrontDetectionScore.toFixed(3), /*#__PURE__*/React__default.createElement("br", null), state.idCardBackDetectionThresholdMet ? '✅' : '❌', " ID Card Back Score: ", state.idCardBackDetectionScore.toFixed(3), /*#__PURE__*/React__default.createElement("br", null), state.passportDetectionThresholdMet ? '✅' : '❌', " Passport Score: ", state.passportDetectionScore.toFixed(3), /*#__PURE__*/React__default.createElement("br", null), state.focusThresholdMet ? '✅' : '❌', " Focus Score:", ' ', state.focusScore.toFixed(3), /*#__PURE__*/React__default.createElement("br", null), state.documentInBounds ? '✅' : '❌', " Document In Bounds", /*#__PURE__*/React__default.createElement("br", null), state.goodFramesThresholdMet ? '✅' : '❌', " Good Frame Count:", ' ', state.goodFramesCount, "/", state.goodFramesThreshold)) : ( /*#__PURE__*/React__default.createElement(React__default.Fragment, null, "\u274C Models not ready")))));
|
|
7214
|
+
}))), debugMode && ( /*#__PURE__*/React__default.createElement(DebugStatsPane, null, cameraRef.current ? ( /*#__PURE__*/React__default.createElement(React__default.Fragment, null, "\u2705 Camera: ", cameraRef.current.label, " (", cameraRef.current.width, "x", cameraRef.current.height, ")")) : '❌ Camera not ready', /*#__PURE__*/React__default.createElement("br", null), state.frameCaptureRate > 0.75 ? '✅' : '👎', " Frame Rate:", ' ', Math.round((state.frameCaptureRate + Number.EPSILON) * 1000) / 1000, ' ', "fps (", detectionTime, "ms doc detect, ", focusPredictionTime, "ms focus)", /*#__PURE__*/React__default.createElement("br", null), modelsReady ? ( /*#__PURE__*/React__default.createElement(React__default.Fragment, null, state.detectionThresholdMet ? '✅' : '❌', " Detected Document Type: ", state.detectedDocumentType, /*#__PURE__*/React__default.createElement("br", null), state.idCardFrontDetectionThresholdMet ? '✅' : '❌', " ID Card Front Score: ", state.idCardFrontDetectionScore.toFixed(3), /*#__PURE__*/React__default.createElement("br", null), state.idCardBackDetectionThresholdMet ? '✅' : '❌', " ID Card Back Score: ", state.idCardBackDetectionScore.toFixed(3), /*#__PURE__*/React__default.createElement("br", null), state.passportDetectionThresholdMet ? '✅' : '❌', " Passport Score: ", state.passportDetectionScore.toFixed(3), /*#__PURE__*/React__default.createElement("br", null), state.focusThresholdMet ? '✅' : '❌', " Focus Score:", ' ', state.focusScore.toFixed(3), /*#__PURE__*/React__default.createElement("br", null), state.documentInBounds ? '✅' : '❌', " Document In Bounds", /*#__PURE__*/React__default.createElement("br", null), state.documentIsStable ? '✅' : '❌', " Document Is Stable", /*#__PURE__*/React__default.createElement("br", null), state.goodFramesThresholdMet ? '✅' : '❌', " Good Frame Count:", ' ', state.goodFramesCount, "/", state.goodFramesThreshold)) : ( /*#__PURE__*/React__default.createElement(React__default.Fragment, null, "\u274C Models not ready")))));
|
|
7167
7215
|
};
|
|
7168
7216
|
var timeSince = function timeSince(t) {
|
|
7169
7217
|
if (!t) return 0;
|