@jaak.ai/stamps 2.1.0-dev.9 → 2.1.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 (57) hide show
  1. package/dist/cjs/app-globals-V2Kpy_OQ.js +8 -0
  2. package/dist/cjs/app-globals-V2Kpy_OQ.js.map +1 -0
  3. package/dist/cjs/{index-BfhtOB0D.js → index-Ga0t6BMe.js} +176 -119
  4. package/dist/cjs/index-Ga0t6BMe.js.map +1 -0
  5. package/dist/cjs/jaak-stamps-webcomponent.cjs.js +5 -4
  6. package/dist/cjs/jaak-stamps-webcomponent.cjs.js.map +1 -1
  7. package/dist/cjs/jaak-stamps.cjs.entry.js +144 -416
  8. package/dist/cjs/jaak-stamps.cjs.entry.js.map +1 -1
  9. package/dist/cjs/jaak-stamps.entry.cjs.js.map +1 -1
  10. package/dist/cjs/loader.cjs.js +4 -3
  11. package/dist/cjs/loader.cjs.js.map +1 -1
  12. package/dist/collection/collection-manifest.json +1 -1
  13. package/dist/collection/components/my-component/my-component.css +1 -1
  14. package/dist/collection/components/my-component/my-component.js +53 -300
  15. package/dist/collection/components/my-component/my-component.js.map +1 -1
  16. package/dist/collection/services/CameraService.js +84 -2
  17. package/dist/collection/services/CameraService.js.map +1 -1
  18. package/dist/collection/services/DetectionService.js +7 -148
  19. package/dist/collection/services/DetectionService.js.map +1 -1
  20. package/dist/collection/services/interfaces/IDetectionService.js.map +1 -1
  21. package/dist/components/index.js +165 -113
  22. package/dist/components/index.js.map +1 -1
  23. package/dist/components/jaak-stamps.js +145 -419
  24. package/dist/components/jaak-stamps.js.map +1 -1
  25. package/dist/esm/app-globals-DQuL1Twl.js +6 -0
  26. package/dist/esm/app-globals-DQuL1Twl.js.map +1 -0
  27. package/dist/esm/{index-BP1Q4KOg.js → index-Drbzcuq-.js} +177 -119
  28. package/dist/esm/index-Drbzcuq-.js.map +1 -0
  29. package/dist/esm/jaak-stamps-webcomponent.js +5 -4
  30. package/dist/esm/jaak-stamps-webcomponent.js.map +1 -1
  31. package/dist/esm/jaak-stamps.entry.js +144 -416
  32. package/dist/esm/jaak-stamps.entry.js.map +1 -1
  33. package/dist/esm/loader.js +4 -3
  34. package/dist/esm/loader.js.map +1 -1
  35. package/dist/jaak-stamps-webcomponent/jaak-stamps-webcomponent.esm.js +1 -1
  36. package/dist/jaak-stamps-webcomponent/jaak-stamps-webcomponent.esm.js.map +1 -1
  37. package/dist/jaak-stamps-webcomponent/jaak-stamps.entry.esm.js.map +1 -1
  38. package/dist/jaak-stamps-webcomponent/loader.esm.js.map +1 -1
  39. package/dist/jaak-stamps-webcomponent/p-DQuL1Twl.js +2 -0
  40. package/dist/jaak-stamps-webcomponent/p-DQuL1Twl.js.map +1 -0
  41. package/dist/jaak-stamps-webcomponent/p-Drbzcuq-.js +3 -0
  42. package/dist/jaak-stamps-webcomponent/p-Drbzcuq-.js.map +1 -0
  43. package/dist/jaak-stamps-webcomponent/p-c06e5d7b.entry.js +2 -0
  44. package/dist/jaak-stamps-webcomponent/p-c06e5d7b.entry.js.map +1 -0
  45. package/dist/types/components/my-component/my-component.d.ts +1 -27
  46. package/dist/types/components.d.ts +1 -3
  47. package/dist/types/services/CameraService.d.ts +1 -0
  48. package/dist/types/services/DetectionService.d.ts +1 -9
  49. package/dist/types/services/interfaces/IDetectionService.d.ts +0 -6
  50. package/dist/types/stencil-public-runtime.d.ts +12 -5
  51. package/package.json +3 -1
  52. package/dist/cjs/index-BfhtOB0D.js.map +0 -1
  53. package/dist/esm/index-BP1Q4KOg.js.map +0 -1
  54. package/dist/jaak-stamps-webcomponent/p-BP1Q4KOg.js +0 -3
  55. package/dist/jaak-stamps-webcomponent/p-BP1Q4KOg.js.map +0 -1
  56. package/dist/jaak-stamps-webcomponent/p-c115e01a.entry.js +0 -2
  57. package/dist/jaak-stamps-webcomponent/p-c115e01a.entry.js.map +0 -1
@@ -1,11 +1,12 @@
1
1
  'use strict';
2
2
 
3
- var index = require('./index-BfhtOB0D.js');
3
+ var index = require('./index-Ga0t6BMe.js');
4
+ var appGlobals = require('./app-globals-V2Kpy_OQ.js');
4
5
 
5
6
  const defineCustomElements = async (win, options) => {
6
7
  if (typeof window === 'undefined') return undefined;
7
- await index.globalScripts();
8
- return index.bootstrapLazy([["jaak-stamps.cjs",[[1,"jaak-stamps",{"debug":[4],"alignmentTolerance":[2,"alignment-tolerance"],"maskSize":[2,"mask-size"],"cropMargin":[2,"crop-margin"],"useDocumentClassification":[4,"use-document-classification"],"useDocumentDetector":[4,"use-document-detector"],"preferredCamera":[1,"preferred-camera"],"captureDelay":[2,"capture-delay"],"enableBackDocumentTimer":[4,"enable-back-document-timer"],"backDocumentTimerDuration":[2,"back-document-timer-duration"],"detectionBoxes":[32],"sideAlignment":[32],"isMaskReady":[32],"shouldMirrorVideo":[32],"showCameraSelector":[32],"isSwitchingCamera":[32],"hasDocumentDetected":[32],"cameraInfoWithAutofocus":[32],"currentStatus":[32],"performanceData":[32],"backDocumentTimerRemaining":[32],"showManualCaptureButton":[32],"performanceDegradedMode":[32],"showPerformanceMessage":[32],"captureStateVersion":[32],"processingButton":[32],"getCapturedImages":[64],"isProcessCompleted":[64],"startCapture":[64],"stopCapture":[64],"resetCapture":[64],"skipBackCapture":[64],"getStatus":[64],"preloadModel":[64],"getCameraInfo":[64],"setPreferredCamera":[64],"setCaptureDelay":[64],"getCaptureDelay":[64],"getResourceReport":[64],"forceResourceCleanup":[64]}]]]], options);
8
+ await appGlobals.globalScripts();
9
+ return index.bootstrapLazy([["jaak-stamps.cjs",[[257,"jaak-stamps",{"debug":[4],"alignmentTolerance":[2,"alignment-tolerance"],"maskSize":[2,"mask-size"],"cropMargin":[2,"crop-margin"],"useDocumentClassification":[4,"use-document-classification"],"useDocumentDetector":[4,"use-document-detector"],"preferredCamera":[1,"preferred-camera"],"captureDelay":[2,"capture-delay"],"enableBackDocumentTimer":[4,"enable-back-document-timer"],"backDocumentTimerDuration":[2,"back-document-timer-duration"],"detectionBoxes":[32],"sideAlignment":[32],"isMaskReady":[32],"shouldMirrorVideo":[32],"showCameraSelector":[32],"isSwitchingCamera":[32],"hasDocumentDetected":[32],"cameraInfoWithAutofocus":[32],"currentStatus":[32],"performanceData":[32],"backDocumentTimerRemaining":[32],"showManualCaptureButton":[32],"performanceDegradedMode":[32],"showPerformanceMessage":[32],"captureStateVersion":[32],"processingButton":[32],"getCapturedImages":[64],"isProcessCompleted":[64],"startCapture":[64],"stopCapture":[64],"resetCapture":[64],"skipBackCapture":[64],"getStatus":[64],"preloadModel":[64],"getCameraInfo":[64],"setPreferredCamera":[64],"setCaptureDelay":[64],"getCaptureDelay":[64]}]]]], options);
9
10
  };
10
11
 
11
12
  exports.setNonce = index.setNonce;
@@ -1 +1 @@
1
- {"version":3,"file":"loader.cjs.js","sources":["@lazy-external-entrypoint?app-data=conditional"],"sourcesContent":["export { setNonce } from '@stencil/core';\nimport { bootstrapLazy } from '@stencil/core';\nimport { globalScripts } from '@stencil/core/internal/app-globals';\nexport const defineCustomElements = async (win, options) => {\n if (typeof window === 'undefined') return undefined;\n await globalScripts();\n return bootstrapLazy([/*!__STENCIL_LAZY_DATA__*/], options);\n};\n"],"names":["globalScripts","bootstrapLazy"],"mappings":";;;;AAGY,MAAC,oBAAoB,GAAG,OAAO,GAAG,EAAE,OAAO,KAAK;AAC5D,EAAE,IAAI,OAAO,MAAM,KAAK,WAAW,EAAE,OAAO,SAAS;AACrD,EAAE,MAAMA,mBAAa,EAAE;AACvB,EAAE,OAAOC,mBAAa,CAAC,4BAA4B,EAAE,OAAO,CAAC;AAC7D;;;;;"}
1
+ {"version":3,"file":"loader.cjs.js","sources":["@lazy-external-entrypoint?app-data=conditional"],"sourcesContent":["export { setNonce } from '@stencil/core';\nimport { bootstrapLazy } from '@stencil/core';\nimport { globalScripts } from '@stencil/core/internal/app-globals';\nexport const defineCustomElements = async (win, options) => {\n if (typeof window === 'undefined') return undefined;\n await globalScripts();\n return bootstrapLazy([/*!__STENCIL_LAZY_DATA__*/], options);\n};\n"],"names":["globalScripts","bootstrapLazy"],"mappings":";;;;;AAGY,MAAC,oBAAoB,GAAG,OAAO,GAAG,EAAE,OAAO,KAAK;AAC5D,EAAE,IAAI,OAAO,MAAM,KAAK,WAAW,EAAE,OAAO,SAAS;AACrD,EAAE,MAAMA,wBAAa,EAAE;AACvB,EAAE,OAAOC,mBAAa,CAAC,4BAA4B,EAAE,OAAO,CAAC;AAC7D;;;;;"}
@@ -4,7 +4,7 @@
4
4
  ],
5
5
  "compiler": {
6
6
  "name": "@stencil/core",
7
- "version": "4.33.1",
7
+ "version": "4.36.3",
8
8
  "typescriptVersion": "5.5.4"
9
9
  },
10
10
  "collections": [],
@@ -439,7 +439,7 @@ video {
439
439
  border-top: none;
440
440
  border-left: none;
441
441
  transform: rotate(45deg);
442
- animation: drawCheck 0.4s ease-out 0.2s both;
442
+ /* animation: drawCheck 0.4s ease-out 0.2s both; */ /* Deshabilitado - check aparece completo */
443
443
  }
444
444
 
445
445
  .success-text {
@@ -71,6 +71,7 @@ export class JaakStamps {
71
71
  alignmentStartTime;
72
72
  alignmentTimer;
73
73
  backDocumentTimer;
74
+ orientationTimer;
74
75
  // Performance monitoring
75
76
  performanceMetrics = {
76
77
  fps: 0,
@@ -174,7 +175,7 @@ export class JaakStamps {
174
175
  if (!window.ort) {
175
176
  this.updateStatus('Preparando herramientas...', 'Configurando funciones de captura', 'initializing');
176
177
  const script = document.createElement('script');
177
- script.src = 'https://cdn.jsdelivr.net/npm/onnxruntime-web/dist/ort.min.js';
178
+ script.src = 'https://cdn.jsdelivr.net/npm/onnxruntime-web@1.23.0/dist/ort.min.js';
178
179
  document.head.appendChild(script);
179
180
  await new Promise((resolve) => {
180
181
  script.onload = () => {
@@ -255,6 +256,18 @@ export class JaakStamps {
255
256
  });
256
257
  resizeObserver.observe(this.detectionContainer.parentElement);
257
258
  }
259
+ // Handle mobile device orientation changes
260
+ window.addEventListener('orientationchange', () => {
261
+ // Clear any existing orientation timer
262
+ if (this.orientationTimer) {
263
+ clearTimeout(this.orientationTimer);
264
+ }
265
+ // Add delay to ensure video dimensions are updated after rotation
266
+ this.orientationTimer = window.setTimeout(() => {
267
+ this.handleResize();
268
+ this.orientationTimer = undefined;
269
+ }, 300);
270
+ });
258
271
  }
259
272
  handleResize() {
260
273
  if (this.detectionContainer) {
@@ -411,13 +424,7 @@ export class JaakStamps {
411
424
  }
412
425
  try {
413
426
  this.exitSession();
414
- // Aggressive cleanup when stopping capture
415
- const cleanupResult = await this.aggressiveResourceCleanup();
416
- return {
417
- success: true,
418
- resourcesFreed: cleanupResult.freed,
419
- cleanupErrors: cleanupResult.errors
420
- };
427
+ return { success: true };
421
428
  }
422
429
  catch (error) {
423
430
  return { success: false, error: error.message };
@@ -642,65 +649,11 @@ export class JaakStamps {
642
649
  // Always allow getting capture delay, even during initialization
643
650
  return this.captureDelay;
644
651
  }
645
- async getResourceReport() {
646
- // Public method to get resource usage report
647
- return this.getResourceReportInternal();
648
- }
649
- async forceResourceCleanup() {
650
- // Public method to force aggressive resource cleanup
651
- const readyCheck = this.isComponentReady();
652
- if (!readyCheck.ready) {
653
- return { success: false, error: readyCheck.message };
654
- }
655
- try {
656
- const cleanupResult = await this.aggressiveResourceCleanup();
657
- return {
658
- success: true,
659
- resourcesFreed: cleanupResult.freed,
660
- errors: cleanupResult.errors,
661
- timestamp: new Date().toISOString()
662
- };
663
- }
664
- catch (error) {
665
- return { success: false, error: error.message };
666
- }
667
- }
668
652
  // Memory and device capability detection
669
653
  checkDeviceCapabilities() {
670
654
  const deviceMemory = navigator.deviceMemory;
671
- const hardwareConcurrency = navigator.hardwareConcurrency || 1;
672
- const isLowEndDevice = hardwareConcurrency <= 2;
673
- const isMobile = /Android|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent);
674
- const isSafari = /Safari/.test(navigator.userAgent) && !/Chrome/.test(navigator.userAgent);
675
- // Si tenemos info de memoria del dispositivo
676
- if (deviceMemory && deviceMemory < 4) {
677
- return {
678
- canUseML: false,
679
- reason: `Memoria del dispositivo (${deviceMemory}GB) insuficiente para detección automática. Modo manual activado para mejor rendimiento.`,
680
- memoryMB: deviceMemory * 1024
681
- };
682
- }
683
- // Dispositivos móviles de gama baja
684
- if (isMobile && isLowEndDevice) {
685
- return {
686
- canUseML: false,
687
- reason: 'Dispositivo móvil optimizado detectado. Modo manual activado para mejor rendimiento y duración de batería.',
688
- memoryMB: null
689
- };
690
- }
691
- // Safari moderno soporta WASM, solo bloquearlo en versiones muy antiguas
692
- if (isSafari) {
693
- const safariMatch = navigator.userAgent.match(/Version\/(\d+)/);
694
- const safariVersion = safariMatch ? parseInt(safariMatch[1]) : 0;
695
- // Solo bloquear Safari muy antiguo (< version 14)
696
- if (safariVersion > 0 && safariVersion < 14) {
697
- return {
698
- canUseML: false,
699
- reason: 'Safari antiguo detectado. Modo manual activado por compatibilidad.',
700
- memoryMB: null
701
- };
702
- }
703
- }
655
+ // Siempre intentar usar ML, independientemente del dispositivo
656
+ // Las restricciones anteriores no eran confiables
704
657
  return {
705
658
  canUseML: true,
706
659
  reason: 'Dispositivo compatible con detección automática.',
@@ -826,6 +779,12 @@ export class JaakStamps {
826
779
  this.videoRef.onloadedmetadata = async () => {
827
780
  await this.videoRef.play();
828
781
  this.stateManager.updateCaptureState({ isVideoActive: true });
782
+ // Recalculate mask dimensions when new camera stream loads
783
+ if (this.detectionContainer) {
784
+ const container = this.detectionContainer.parentElement;
785
+ const rect = container.getBoundingClientRect();
786
+ this.updateMaskDimensions(rect);
787
+ }
829
788
  resolve();
830
789
  };
831
790
  });
@@ -997,6 +956,10 @@ export class JaakStamps {
997
956
  clearTimeout(this.alignmentTimer);
998
957
  this.alignmentTimer = undefined;
999
958
  }
959
+ if (this.orientationTimer) {
960
+ clearTimeout(this.orientationTimer);
961
+ this.orientationTimer = undefined;
962
+ }
1000
963
  // Liberar recursos de ONNX al limpiar el componente
1001
964
  this.releaseOnnxResources();
1002
965
  if (this.performanceUpdateInterval) {
@@ -1005,182 +968,11 @@ export class JaakStamps {
1005
968
  }
1006
969
  // Clear canvas pool
1007
970
  this.canvasPool = [];
1008
- // Clean DOM references and memory leaks
1009
- this.cleanupDOMReferences();
1010
971
  this.detectionBoxes = [];
1011
972
  this.alignmentStartTime = undefined;
1012
973
  this.hasDocumentDetected = false;
1013
974
  this.serviceContainer?.cleanup();
1014
975
  }
1015
- // AGGRESSIVE RESOURCE CLEANUP METHODS
1016
- // Clean DOM references and memory leaks
1017
- cleanupDOMReferences() {
1018
- // Remove event listeners that could maintain references
1019
- if (this.videoRef) {
1020
- // Remove common event listeners (if any were added)
1021
- this.videoRef.srcObject = null;
1022
- this.videoRef = undefined;
1023
- }
1024
- // Clean detection container
1025
- if (this.detectionContainer) {
1026
- this.detectionContainer = undefined;
1027
- }
1028
- // Clean references to images in the DOM and revoke blob URLs
1029
- const images = this.el.shadowRoot?.querySelectorAll('img');
1030
- images?.forEach(img => {
1031
- if (img.src.startsWith('blob:')) {
1032
- URL.revokeObjectURL(img.src);
1033
- }
1034
- img.src = '';
1035
- });
1036
- }
1037
- // Clear browser cache and storage
1038
- async clearBrowserCache() {
1039
- try {
1040
- // 1. Clear Service Worker cache if exists
1041
- if ('serviceWorker' in navigator) {
1042
- const registrations = await navigator.serviceWorker.getRegistrations();
1043
- await Promise.all(registrations.map(registration => registration.unregister()));
1044
- }
1045
- // 2. Clear Cache API specific to the component
1046
- const cacheNames = await caches.keys();
1047
- const componentCaches = cacheNames.filter(name => name.includes('jaak') || name.includes('stamps'));
1048
- await Promise.all(componentCaches.map(cacheName => caches.delete(cacheName)));
1049
- // 3. Force garbage collection if available (only in dev)
1050
- if (this.debug && window.gc) {
1051
- window.gc();
1052
- }
1053
- }
1054
- catch (error) {
1055
- console.warn('Error clearing browser cache:', error);
1056
- }
1057
- }
1058
- // Clear local storage specific to the component
1059
- async clearLocalStorage() {
1060
- try {
1061
- // Clear localStorage specific to the component
1062
- const keysToRemove = [];
1063
- for (let i = 0; i < localStorage.length; i++) {
1064
- const key = localStorage.key(i);
1065
- if (key && (key.includes('jaak') || key.includes('onnx') || key.includes('stamps'))) {
1066
- keysToRemove.push(key);
1067
- }
1068
- }
1069
- keysToRemove.forEach(key => localStorage.removeItem(key));
1070
- // Clear sessionStorage
1071
- const sessionKeysToRemove = [];
1072
- for (let i = 0; i < sessionStorage.length; i++) {
1073
- const key = sessionStorage.key(i);
1074
- if (key && (key.includes('jaak') || key.includes('onnx'))) {
1075
- sessionKeysToRemove.push(key);
1076
- }
1077
- }
1078
- sessionKeysToRemove.forEach(key => sessionStorage.removeItem(key));
1079
- }
1080
- catch (error) {
1081
- console.warn('Error clearing local storage:', error);
1082
- }
1083
- }
1084
- // Aggressive resource cleanup combining all strategies
1085
- async aggressiveResourceCleanup() {
1086
- const freed = [];
1087
- const errors = [];
1088
- try {
1089
- // 1. Release ONNX resources
1090
- this.releaseOnnxResources();
1091
- freed.push('ONNX models');
1092
- // 2. Clear model cache in detection service
1093
- if (this.detectionService) {
1094
- await this.detectionService.clearModelCache();
1095
- freed.push('Model cache');
1096
- }
1097
- // 3. Clear browser cache
1098
- await this.clearBrowserCache();
1099
- freed.push('Browser cache');
1100
- // 4. Clear local storage
1101
- await this.clearLocalStorage();
1102
- freed.push('Local storage');
1103
- // 5. Clean DOM references
1104
- this.cleanupDOMReferences();
1105
- freed.push('DOM references');
1106
- // 6. Optimize canvas pools
1107
- if (this.detectionService) {
1108
- this.detectionService.optimizeCanvasPool(0);
1109
- freed.push('Canvas pools');
1110
- }
1111
- // 7. Clear component canvas pool
1112
- this.canvasPool = [];
1113
- freed.push('Component canvas pool');
1114
- // 8. Force garbage collection (if available)
1115
- if (this.debug && window.gc) {
1116
- window.gc();
1117
- freed.push('Garbage collection');
1118
- }
1119
- }
1120
- catch (error) {
1121
- errors.push(error.message);
1122
- }
1123
- return { freed, errors };
1124
- }
1125
- // Progressive resource release after front capture
1126
- async onFrontCaptureComplete() {
1127
- try {
1128
- // Release classification model if not needed for back
1129
- if (this.detectionService && !this.useDocumentClassification) {
1130
- await this.detectionService.releaseMobileNetResources();
1131
- }
1132
- // Optimize canvas pool to minimum needed for back capture
1133
- if (this.detectionService) {
1134
- this.detectionService.optimizeCanvasPool(1);
1135
- }
1136
- // Reduce component canvas pool
1137
- while (this.canvasPool.length > 1) {
1138
- const canvas = this.canvasPool.pop();
1139
- if (canvas) {
1140
- const ctx = canvas.getContext('2d');
1141
- if (ctx) {
1142
- ctx.clearRect(0, 0, canvas.width, canvas.height);
1143
- }
1144
- }
1145
- }
1146
- if (this.debug) {
1147
- console.log('🧹 Progressive cleanup after front capture completed');
1148
- }
1149
- }
1150
- catch (error) {
1151
- console.warn('Error in progressive cleanup:', error);
1152
- }
1153
- }
1154
- // Resource reporting for debugging
1155
- getResourceReportInternal() {
1156
- const report = {
1157
- timestamp: new Date().toISOString(),
1158
- component: {
1159
- hasVideoStream: !!this.videoStream,
1160
- hasAnimationFrame: !!this.animationId,
1161
- canvasPoolSize: this.canvasPool.length,
1162
- detectionBoxesCount: this.detectionBoxes.length,
1163
- performanceMonitorActive: !!this.performanceUpdateInterval
1164
- }
1165
- };
1166
- // Add detection service stats if available
1167
- if (this.detectionService) {
1168
- report.detectionService = {
1169
- isModelLoaded: this.detectionService.isModelLoaded(),
1170
- canvasPoolStats: this.detectionService.getPoolStats()
1171
- };
1172
- }
1173
- // Add memory info if available
1174
- if ('memory' in performance) {
1175
- const memInfo = performance.memory;
1176
- report.memory = {
1177
- usedJSHeapSize: Math.round(memInfo.usedJSHeapSize / 1048576), // MB
1178
- totalJSHeapSize: Math.round(memInfo.totalJSHeapSize / 1048576), // MB
1179
- jsHeapSizeLimit: Math.round(memInfo.jsHeapSizeLimit / 1048576) // MB
1180
- };
1181
- }
1182
- return report;
1183
- }
1184
976
  render() {
1185
977
  const captureState = this.stateManager?.getCaptureState() || {
1186
978
  isVideoActive: false,
@@ -1191,7 +983,7 @@ export class JaakStamps {
1191
983
  isCapturing: false
1192
984
  };
1193
985
  const cameraInfo = this.cameraInfoWithAutofocus;
1194
- return (h("div", { key: 'd32941c10b3b7193b2113691dae712a80315b430', class: "detector-container" }, h("div", { key: '7704c993cb9e6e3d29edf6b0adfe341dc1cc8e04', class: "video-container" }, h("video", { key: '2d0d46f1973c86e91f9fe9ede0aa938326c6071f', ref: el => this.videoRef = el, autoplay: true, muted: true, playsinline: true, class: this.shouldMirrorVideo ? 'mirror' : '', style: { display: captureState.isVideoActive ? 'block' : 'none' } }), h("div", { key: '9d62ea5221271a18938a9f80535ec7d960745ddb', ref: el => this.detectionContainer = el, class: `detection-overlay ${this.shouldMirrorVideo ? 'mirror' : ''}` }, this.debug && this.detectionBoxes.map((box, index) => (h("div", { key: index, class: "detection-box", style: {
986
+ return (h("div", { key: 'f9cbca2fd6b8548a29ace7fcb972b53f402f61af', class: "detector-container" }, h("div", { key: '4f3cac734eb6bfd44a8de644eadca17e7893e11a', class: "video-container" }, h("video", { key: '5e15a38c989a72d5274281272d41ba064447ca6f', ref: el => this.videoRef = el, autoplay: true, muted: true, playsinline: true, class: this.shouldMirrorVideo ? 'mirror' : '', style: { display: captureState.isVideoActive ? 'block' : 'none' } }), h("div", { key: '38c8ad8b691db60e9b5a2a8b641fe6febbeacfca', ref: el => this.detectionContainer = el, class: `detection-overlay ${this.shouldMirrorVideo ? 'mirror' : ''}` }, this.debug && this.detectionBoxes.map((box, index) => (h("div", { key: index, class: "detection-box", style: {
1195
987
  position: 'absolute',
1196
988
  left: `${box.x}px`,
1197
989
  top: `${box.y}px`,
@@ -1200,9 +992,9 @@ export class JaakStamps {
1200
992
  border: '2px solid #32406C',
1201
993
  pointerEvents: 'none',
1202
994
  boxSizing: 'border-box'
1203
- } })))), this.isMaskReady && (h("div", { key: '38ebb5be5c55a184644411f06fe20221bdbdf693', class: "overlay-mask" }, h("div", { key: '6200c59e7a1212267e7335e1495cf9d9db2bca62', class: "card-outline" }, h("div", { key: 'c5321d2b5c09734cbca69fc8bb7849eef465a0ce', class: "side side-top" }), h("div", { key: 'd73b5afcb6781307460b8827c491673ebbfc40ef', class: "side side-right" }), h("div", { key: '787dfa0792c5a00f8a83feaa423ca22092e0a8bf', class: "side side-bottom" }), h("div", { key: '50736a6b9c7c8847d1dabaa22464e26f284da11e', class: "side side-left" })), !captureState.showFlipAnimation && !captureState.showSuccessAnimation && (h("div", { key: 'ec8cc90cd589e4f713becb57b6787ce4f57318d4', class: `guide-text ${this.showPerformanceMessage ? 'performance-warning-text' : ''}` }, this.getGuideText(captureState.step))), captureState.step === 'back' && !captureState.showFlipAnimation && !captureState.showSuccessAnimation && (h("div", { key: 'd9d391c02855ac754607cbf77c119153d1f6e56f', class: "back-capture-section" }, h("div", { key: 'a3ebe694f74958b7910fc355a66cbf1394fb5a2a', class: "back-capture-buttons" }, (!this.useDocumentDetector || this.performanceDegradedMode) && (h("button", { key: 'bc6baf4e00199dfdd50bbfbf8abbcede0fb719e9', class: "capture-button primary-button", onClick: () => this.takeManualScreenshot(), type: "button", disabled: this.processingButton !== null }, this.processingButton === 'capture-back' && (h("span", { key: '3a56f9132fce454c792818925c8bed5557e69eed', class: "button-spinner" })), "Capturar Reverso")), h("button", { key: '2fe7e44bc91b73581d6333b7c404ec018a390372', class: "skip-button", onClick: () => this.skipBackCapture(), type: "button", disabled: this.processingButton !== null }, this.processingButton === 'skip-back' && (h("span", { key: 'ebb2d40cbcb646c9bd70ebe278b0643f9335779b', class: "button-spinner" })), this.enableBackDocumentTimer && this.backDocumentTimerRemaining > 0
995
+ } })))), this.isMaskReady && (h("div", { key: 'c56fde56b7a86a4e8a4cf558745291ea5cde12fd', class: "overlay-mask" }, h("div", { key: '04ed3f01f271dc84eed594cb4b60c2453645bd41', class: "card-outline" }, h("div", { key: '648bd423a5e886d4768115237de5896c7223b30b', class: "side side-top" }), h("div", { key: 'b8878059493ca61961b9b3c82ecc18b50b79ac85', class: "side side-right" }), h("div", { key: '09e5ad64ff33dbd5c112bf52b71e14409ab6aa65', class: "side side-bottom" }), h("div", { key: 'b8ba3d83c9bc1b4a0da859d7ed4b9a15eaddcc2a', class: "side side-left" })), !captureState.showFlipAnimation && !captureState.showSuccessAnimation && (h("div", { key: '3279701a240f77ac96e68a34ad95c099340c9a6a', class: `guide-text ${this.showPerformanceMessage ? 'performance-warning-text' : ''}` }, this.getGuideText(captureState.step))), captureState.step === 'back' && !captureState.showFlipAnimation && !captureState.showSuccessAnimation && (h("div", { key: '2adf96d0a57e482372fd9586229dac2301b64fd4', class: "back-capture-section" }, h("div", { key: '305a147c9cfee854c60ac946a48a1d21b2792725', class: "back-capture-buttons" }, (!this.useDocumentDetector || this.performanceDegradedMode || this.showManualCaptureButton) && (h("button", { key: '43270a0647f39307229c540dd5130fb58b1ff4fb', class: "capture-button primary-button", onClick: () => this.takeManualScreenshot(), type: "button", disabled: this.processingButton !== null }, this.processingButton === 'capture-back' && (h("span", { key: 'eb4666603774564eef95a120ac13faeb9e10c8b4', class: "button-spinner" })), "Capturar Reverso")), h("button", { key: 'cac667d9548ae2314ad5a677c5ed90f25184f728', class: "skip-button", onClick: () => this.skipBackCapture(), type: "button", disabled: this.processingButton !== null }, this.processingButton === 'skip-back' && (h("span", { key: '0af7aa4106ce189ae2d79bec78ede01abe25b1e7', class: "button-spinner" })), this.enableBackDocumentTimer && this.backDocumentTimerRemaining > 0
1204
996
  ? `Saltar reverso (${this.backDocumentTimerRemaining}s)`
1205
- : 'Saltar reverso')))), captureState.isVideoActive && (h("div", { key: '4373e4f9ab73d93ce32ae52fbdc14f7bcb69e68e', class: "camera-controls" }, h("button", { key: '5d2afe5b71b02d379fe2ec82bd57a86f614fbea6', class: `camera-selector-button ${this.isSwitchingCamera ? 'loading' : ''}`, onClick: () => this.toggleCameraSelector(), type: "button", title: "Seleccionar c\u00E1mara", disabled: this.isSwitchingCamera }, this.isSwitchingCamera ? (h("div", { class: "button-spinner" })) : ('Cámaras')))), this.showCameraSelector && cameraInfo.availableCameras.length > 0 && (h("div", { key: '4fe5e10260a1299a0dc8517646bed8134fe38d9a', class: "camera-selector-dropdown" }, h("div", { key: 'b041acd0b0292864d20ad256301e7be714854424', class: "camera-selector-header" }, h("span", { key: '2769170dc9ce382b420a719cad6f9bb1f5e4420f' }, "Seleccionar C\u00E1mara"), h("button", { key: '0c54f73bb29041ba88e1838c5b1c8a54eafdc67d', class: "close-selector", onClick: () => this.toggleCameraSelector(), type: "button" }, "\u00D7")), h("div", { key: 'd72ae015c5e89cc3396c14406591308eda4d4c4a', class: "camera-list" }, cameraInfo.availableCameras.map((camera) => (h("button", { key: camera.id, class: `camera-option ${cameraInfo.selectedCameraId === camera.id ? 'selected' : ''}`, onClick: () => this.handleCameraSwitch(camera.id), type: "button" }, h("span", { class: "camera-label" }, camera.label || `Cámara ${cameraInfo.availableCameras.indexOf(camera) + 1}`, camera.hasAutofocus && (h("span", { class: "autofocus-icon", title: "Autofoco disponible" }, "\u29BF"))), cameraInfo.selectedCameraId === camera.id && (h("span", { class: "selected-indicator" }, "\u2713")))))), h("div", { key: '5933bb5c8345debf2eb78fc2cd3900cb09a29335', class: "device-info" }, h("small", { key: 'a126d886feaede4f9657abee9b45d1eff1910e25' }, "Dispositivo: ", cameraInfo.deviceType)))), this.showManualCaptureButton && captureState.step === 'front' && !captureState.showFlipAnimation && !captureState.showSuccessAnimation && (h("div", { key: '62ab98c6afa629583ff13f1792422ef1c5012883', class: "manual-capture-section" }, h("button", { key: '93a42f7b0626a63ab795652eb9eb81657f4fec13', class: "manual-capture-button", onClick: () => this.takeManualScreenshot(), type: "button", disabled: this.processingButton !== null }, this.processingButton === 'capture-front' && (h("span", { key: '77b5aaf62edab4fe8eb68f37083121d9f8493797', class: "button-spinner" })), "Capturar Frente"))))), captureState.isCapturing && (h("div", { key: '399242238fd4a2a4985af0f30faed504d73a0adc', class: "capture-animation" })), captureState.showFlipAnimation && (h("div", { key: '06add02bc244511dc0dc82bf206f41d9ce3cdcd3', class: "flip-animation" }, h("div", { key: 'e3949d8e41bc496bf503d1dcd34df53d2bf876aa', class: "id-card-icon" }), h("div", { key: 'e8ebdd9d29e0b33dcfc506b40e67e0d4af8cb0bb', class: "flip-text" }, "\u00A1Voltea tu identificaci\u00F3n!"))), captureState.showSuccessAnimation && (h("div", { key: 'f72f6fc4d42c7b10d98c8aff7541596afe131883', class: "success-animation" }, h("div", { key: '8d0d422b37caa97f695f62c0094c52c3c12c7bda', class: "check-icon" }), h("div", { key: 'd9d673dbfd2af4a1b8ca1a775e5b318326d70446', class: "success-text" }, "\u00A1Proceso completado!"))), h("div", { key: 'fdfa1239ddea40bbbabf032542a7160fae3f3c96', class: `component-status status-${this.currentStatus.type}` }, (this.currentStatus.type === 'loading' || this.currentStatus.type === 'initializing') && (h("div", { key: '34bb9d5b83e4383c4f640ccf11189484514e4efd', class: "status-spinner" })), h("div", { key: '131bcd252fc7e1f6eb27332d64fd249b5889aa9d', class: "status-content" }, h("div", { key: '911b7324456e84842fa3c14c9a6fd3ba475804cf', class: "status-message" }, this.currentStatus.message), this.currentStatus.description && (h("div", { key: 'e938b9294ee3c6125b133bf737caa4a33a016872', class: "status-description" }, this.currentStatus.description)))), this.debug && (h("div", { key: 'cab385a12f6ccf8579d2d073c1ed987bf815efeb', class: "performance-monitor" }, h("div", { key: '903f8a7005a98c4b99eb7d4c91662911cee8beae', class: "performance-expanded" }, h("div", { key: 'f1ba17573d53442a23212e2c8fdd132bd3ddf4f0', class: "metrics-row" }, h("div", { key: '71357107dcc19749e5af2d5668df535db65cb986', class: "metric-compact" }, h("span", { key: '9ad542fb9445340c669c3d18fc293e2364fc5dcc', class: "metric-label" }, "FPS"), h("span", { key: 'ab0fb401df5dc792c0a641a574851aec48093862', class: `metric-value ${this.performanceData.fps < 15 ? 'warning' : this.performanceData.fps < 10 ? 'danger' : 'good'}` }, this.performanceData.fps)), h("div", { key: 'a650ab2a1af27829d4a63a264f00907dfba363c6', class: "metric-compact" }, h("span", { key: '56e195b0fd468f2a457a66b2342ed6a80fbef0a0', class: "metric-label" }, "MEM"), h("span", { key: '265445131d4492c6e2f7571d367f52c93e00b711', class: `metric-value ${this.performanceData.memoryUsage > 100 ? 'warning' : this.performanceData.memoryUsage > 200 ? 'danger' : 'good'}` }, this.performanceData.memoryUsage, "MB"))), h("div", { key: '56023a82a1978c7c2f8f08edac729f39efcafa63', class: "metrics-row" }, h("div", { key: '6f1ceb668fc246ec11bfeee3f14c745f21d4986e', class: "metric-compact" }, h("span", { key: '92efba3ee31c5b9a382f1e205584950217482722', class: "metric-label" }, "INF"), h("span", { key: 'fc2baec34fd2f0696a216c487753b94b8bacaf7e', class: `metric-value ${this.performanceData.inferenceTime > 100 ? 'warning' : this.performanceData.inferenceTime > 200 ? 'danger' : 'good'}` }, this.performanceData.inferenceTime, "ms")), h("div", { key: '683eeb875e96c94cf36c403385c2764239fb5a4d', class: "metric-compact" }, h("span", { key: '33ba3f357868f7feaaeefab35e3ecc35d3b5b726', class: "metric-label" }, "FRAME"), h("span", { key: 'f496be674b0328556d27a9a9b2f24ffa50ff76ea', class: `metric-value ${this.performanceData.frameProcessingTime > 50 ? 'warning' : this.performanceData.frameProcessingTime > 100 ? 'danger' : 'good'}` }, this.performanceData.frameProcessingTime, "ms"))), h("div", { key: '521f275481d35c2132dbcf138e4bbda84a0b97b2', class: "metrics-row" }, h("div", { key: '17acc0238696816077b80b66aee317ae9ab20e75', class: "metric-compact" }, h("span", { key: 'cac1a4ee661de14739623a1a6f0149ba72fa918c', class: "metric-label" }, "DET"), h("span", { key: '70071c404c5e50001d813f1f3e0d1002776ed887', class: "metric-value good" }, this.performanceData.successfulDetections, "/", this.performanceData.totalDetections)), h("div", { key: '26a00ad1c95e6c2b8feaafc36103fb7fb869039f', class: "metric-compact" }, h("span", { key: 'a1c7fb80b6795f10111c1ed403de933aadcbe450', class: "metric-label" }, "RATE"), h("span", { key: '49471b7bfa2d6ca6357a39bf611738fd6344764a', class: `metric-value ${this.performanceData.detectionRate < 30 ? 'danger' : this.performanceData.detectionRate < 60 ? 'warning' : 'good'}` }, this.performanceData.detectionRate, "%")))))), h("div", { key: '3870b7399d2d5068e7f59177225476b00bef7fc7', class: "watermark" }, h("img", { key: '5030e9f14eebd4546207ced129d7d00d85abb189', src: "https://storage.googleapis.com/jaak-static/commons/powered-by-jaak.png", alt: "Powered by Jaak" })))));
997
+ : 'Saltar reverso')))), captureState.isVideoActive && (h("div", { key: 'de6e5c4fad4d4d996b894457c9af52bc71e533fb', class: "camera-controls" }, h("button", { key: 'cfddcf2420d5f5923a6b02ca446bbe1b8e9fc5e4', class: `camera-selector-button ${this.isSwitchingCamera ? 'loading' : ''}`, onClick: () => this.toggleCameraSelector(), type: "button", title: "Seleccionar c\u00E1mara", disabled: this.isSwitchingCamera }, this.isSwitchingCamera ? (h("div", { class: "button-spinner" })) : ('Cámaras')))), this.showCameraSelector && cameraInfo.availableCameras.length > 0 && (h("div", { key: '5fb73f958b9a5a6f9242032c4530b0bdab84f6c5', class: "camera-selector-dropdown" }, h("div", { key: '8ee2d26b1001e571e7b6c326e927926fa08287fd', class: "camera-selector-header" }, h("span", { key: '78350b0fb1bd933f7c8c59d8dab0b7122ffbe363' }, "Seleccionar C\u00E1mara"), h("button", { key: 'bb750e0ddd5a1ee5ff96bd57805a7f90b8821e9f', class: "close-selector", onClick: () => this.toggleCameraSelector(), type: "button" }, "\u00D7")), h("div", { key: 'd0f6343cf1b7367f3da33ec8cf64891109d923b8', class: "camera-list" }, cameraInfo.availableCameras.map((camera) => (h("button", { key: camera.id, class: `camera-option ${cameraInfo.selectedCameraId === camera.id ? 'selected' : ''}`, onClick: () => this.handleCameraSwitch(camera.id), type: "button" }, h("span", { class: "camera-label" }, camera.label || `Cámara ${cameraInfo.availableCameras.indexOf(camera) + 1}`, camera.hasAutofocus && (h("span", { class: "autofocus-icon", title: "Autofoco disponible" }, "\u29BF"))), cameraInfo.selectedCameraId === camera.id && (h("span", { class: "selected-indicator" }, "\u2713")))))), h("div", { key: 'c9642fbfb0acea766d3f0542f4cc9f17f4af4d7b', class: "device-info" }, h("small", { key: 'b6e9507ff7addf011f339f6c22a88a96b40db68a' }, "Dispositivo: ", cameraInfo.deviceType)))), this.showManualCaptureButton && captureState.step === 'front' && !captureState.showFlipAnimation && !captureState.showSuccessAnimation && (h("div", { key: '04ae9262409284782850b90945eb7038673e2097', class: "manual-capture-section" }, h("button", { key: '27c315e503ccba468b89ebd58d6b70f40ddd06ba', class: "manual-capture-button", onClick: () => this.takeManualScreenshot(), type: "button", disabled: this.processingButton !== null }, this.processingButton === 'capture-front' && (h("span", { key: '8f2dcd2df9a218b37eb0b8204a8724362cfeaa53', class: "button-spinner" })), "Capturar Frente"))))), captureState.isCapturing && (h("div", { key: '6fd6fe1d0213b01c8119a67fb8108f73227feee1', class: "capture-animation" })), captureState.showFlipAnimation && (h("div", { key: 'fba3816b48b99ca64510ecbefc0d41431569c9ae', class: "flip-animation" }, h("div", { key: 'beea1c8245b5d81f1008efc6d1b079a61c821e7f', class: "id-card-icon" }), h("div", { key: 'f0fbc34f619a653e2c0ade764ca99e7aa582d157', class: "flip-text" }, "\u00A1Voltea tu identificaci\u00F3n!"))), captureState.showSuccessAnimation && (h("div", { key: 'e4a0e6d31112e3a50024d1d0430b4ad997049fe7', class: "success-animation" }, h("div", { key: '5dd3f781f55630bc904c81207548ae35bc79b452', class: "check-icon" }), h("div", { key: 'a10ebc557582325091efb0abd12d62b27a43b98c', class: "success-text" }, "\u00A1Proceso completado!"))), h("div", { key: '975865955dee1803b5215ecf049701c98b324855', class: `component-status status-${this.currentStatus.type}` }, (this.currentStatus.type === 'loading' || this.currentStatus.type === 'initializing') && (h("div", { key: '84f6f67202e26ce80f7fc5d5f321e23b5bc55c57', class: "status-spinner" })), h("div", { key: 'a1ae56ed156e8feb279a1bf160f749c5d0b5ce45', class: "status-content" }, h("div", { key: 'd62932554cea257ce19763df26e0ba702e50eeca', class: "status-message" }, this.currentStatus.message), this.currentStatus.description && (h("div", { key: 'c5506fa12dd0d37d26dc26c9f2381c843330451f', class: "status-description" }, this.currentStatus.description)))), this.debug && (h("div", { key: '2097eda63185f336f7319014fae2ef6db1e41761', class: "performance-monitor" }, h("div", { key: 'd611c494c6b1a5930ef64aebdcba41e5d94c9ee6', class: "performance-expanded" }, h("div", { key: '800d46831e7b9bec260d9c5e67ea1a3eb9c2933e', class: "metrics-row" }, h("div", { key: 'dd0db1faa9050d98e71da4b5cd26a4a484c37c64', class: "metric-compact" }, h("span", { key: 'f0e6ea61a35ddb2ae5c2a6aff8c255a02c5c1219', class: "metric-label" }, "FPS"), h("span", { key: 'cbf4df4d142f6f01e45f566a8ede8fbbf29ad673', class: `metric-value ${this.performanceData.fps < 15 ? 'warning' : this.performanceData.fps < 10 ? 'danger' : 'good'}` }, this.performanceData.fps)), h("div", { key: '83861ad31fa46c8199a5583e4b3f8eefd44bacd6', class: "metric-compact" }, h("span", { key: '41b8de4cda47959dfc9df393e95fdadde534dd21', class: "metric-label" }, "MEM"), h("span", { key: 'b268f13cc78066e240ed158f1443113a94827aff', class: `metric-value ${this.performanceData.memoryUsage > 100 ? 'warning' : this.performanceData.memoryUsage > 200 ? 'danger' : 'good'}` }, this.performanceData.memoryUsage, "MB"))), h("div", { key: '9f9a9d0690906b186492af23b900c5fa0f5cff89', class: "metrics-row" }, h("div", { key: '84fa6e453dc36e4a74e8b573447b17230766229e', class: "metric-compact" }, h("span", { key: 'f17d52899090c89f532d74c552dd8c5338fc2d83', class: "metric-label" }, "INF"), h("span", { key: '2beca0d7ce55ed574f6b01efc086c5846983e024', class: `metric-value ${this.performanceData.inferenceTime > 100 ? 'warning' : this.performanceData.inferenceTime > 200 ? 'danger' : 'good'}` }, this.performanceData.inferenceTime, "ms")), h("div", { key: '981e300cf076e81bfe946974f6cffd63619eacde', class: "metric-compact" }, h("span", { key: '3dfb0c996a69eb87b0f711322675cad69c471146', class: "metric-label" }, "FRAME"), h("span", { key: '3ae2ac6e90cda77f23e559f3197c3b761f9bdc40', class: `metric-value ${this.performanceData.frameProcessingTime > 50 ? 'warning' : this.performanceData.frameProcessingTime > 100 ? 'danger' : 'good'}` }, this.performanceData.frameProcessingTime, "ms"))), h("div", { key: '2c51216838d87728d9d7764e5ba8a50fa02eb493', class: "metrics-row" }, h("div", { key: 'eda810ffb80ec38ab84583f59b26706f90a50fc9', class: "metric-compact" }, h("span", { key: '978ba9c0c67d6da6b29b3535af33a314bab9276a', class: "metric-label" }, "DET"), h("span", { key: '3e5e169fd4a3906283d8f918b5bbc7c5df6ccd0f', class: "metric-value good" }, this.performanceData.successfulDetections, "/", this.performanceData.totalDetections)), h("div", { key: 'b4b915c745e35c09470a4dc5edfc112d32cfb8b6', class: "metric-compact" }, h("span", { key: '3e2a7b88a4446813c955efb0dfa9e2958e8e1448', class: "metric-label" }, "RATE"), h("span", { key: 'f4f073f7ee622167a241c6a1c535ef580c13d9ab', class: `metric-value ${this.performanceData.detectionRate < 30 ? 'danger' : this.performanceData.detectionRate < 60 ? 'warning' : 'good'}` }, this.performanceData.detectionRate, "%")))))), h("div", { key: '76c556e92f6d7980539f1a30efe8751f665164fb', class: "watermark" }, h("img", { key: 'af23e115d6b4e92a72e55d6d98fde0e4b1d09e9b', src: "https://storage.googleapis.com/jaak-static/commons/powered-by-jaak.png", alt: "Powered by Jaak" })))));
1206
998
  }
1207
999
  // Utility methods
1208
1000
  updateDetectionBoxes(boxes) {
@@ -1399,8 +1191,8 @@ export class JaakStamps {
1399
1191
  if (captureState.step === 'front') {
1400
1192
  this.stateManager.setCapturedImages({
1401
1193
  front: {
1402
- fullFrame: captureCanvas.toDataURL('image/png'),
1403
- cropped: croppedCanvas.toDataURL('image/png')
1194
+ fullFrame: captureCanvas.toDataURL('image/jpeg'),
1195
+ cropped: croppedCanvas.toDataURL('image/jpeg')
1404
1196
  }
1405
1197
  });
1406
1198
  // Check if document classification is enabled (independent of detector)
@@ -1426,8 +1218,6 @@ export class JaakStamps {
1426
1218
  showFlipAnimation: true
1427
1219
  });
1428
1220
  this.triggerRerender();
1429
- // Progressive resource cleanup after front capture
1430
- await this.onFrontCaptureComplete();
1431
1221
  setTimeout(() => {
1432
1222
  this.stateManager.updateCaptureState({
1433
1223
  showFlipAnimation: false,
@@ -1442,8 +1232,8 @@ export class JaakStamps {
1442
1232
  else if (captureState.step === 'back') {
1443
1233
  this.stateManager.setCapturedImages({
1444
1234
  back: {
1445
- fullFrame: captureCanvas.toDataURL('image/png'),
1446
- cropped: croppedCanvas.toDataURL('image/png')
1235
+ fullFrame: captureCanvas.toDataURL('image/jpeg'),
1236
+ cropped: croppedCanvas.toDataURL('image/jpeg')
1447
1237
  }
1448
1238
  });
1449
1239
  this.completeProcess(false);
@@ -1481,8 +1271,8 @@ export class JaakStamps {
1481
1271
  if (captureState.step === 'front') {
1482
1272
  this.stateManager.setCapturedImages({
1483
1273
  front: {
1484
- fullFrame: captureCanvas.toDataURL('image/png'),
1485
- cropped: croppedCanvas.toDataURL('image/png')
1274
+ fullFrame: captureCanvas.toDataURL('image/jpeg'),
1275
+ cropped: croppedCanvas.toDataURL('image/jpeg')
1486
1276
  }
1487
1277
  });
1488
1278
  // Check if document classification is enabled
@@ -1503,8 +1293,6 @@ export class JaakStamps {
1503
1293
  isDetectionPaused: true,
1504
1294
  showFlipAnimation: true
1505
1295
  });
1506
- // Progressive resource cleanup after front capture
1507
- await this.onFrontCaptureComplete();
1508
1296
  setTimeout(() => {
1509
1297
  this.stateManager.updateCaptureState({
1510
1298
  showFlipAnimation: false,
@@ -1516,8 +1304,8 @@ export class JaakStamps {
1516
1304
  else if (captureState.step === 'back') {
1517
1305
  this.stateManager.setCapturedImages({
1518
1306
  back: {
1519
- fullFrame: captureCanvas.toDataURL('image/png'),
1520
- cropped: croppedCanvas.toDataURL('image/png')
1307
+ fullFrame: captureCanvas.toDataURL('image/jpeg'),
1308
+ cropped: croppedCanvas.toDataURL('image/jpeg')
1521
1309
  }
1522
1310
  });
1523
1311
  this.completeProcess(false);
@@ -1643,10 +1431,13 @@ export class JaakStamps {
1643
1431
  this.useDocumentDetector = false; // Desactivar detector automático
1644
1432
  // Actualizar el estado con mensaje de error
1645
1433
  this.updateStatus('Modo manual activado', errorMessage, 'error');
1646
- // Ocultar mensaje después de 5 segundos
1647
- setTimeout(() => {
1648
- this.updateStatus('Captura manual', 'Use el botón para capturar', 'ready');
1649
- }, 5000);
1434
+ // Continuar con la configuración de cámara para mostrar el video
1435
+ this.continueWithCameraSetup().catch(() => {
1436
+ // Si falla la configuración de cámara, mantener el mensaje de error pero cambiar el estado
1437
+ setTimeout(() => {
1438
+ this.updateStatus('Captura manual', 'Use el botón para capturar', 'ready');
1439
+ }, 5000);
1440
+ });
1650
1441
  }
1651
1442
  stopPerformanceMonitoring() {
1652
1443
  // Nota: No necesitamos limpiar más variables porque ya no se usarán
@@ -1682,16 +1473,6 @@ export class JaakStamps {
1682
1473
  setTimeout(() => {
1683
1474
  this.stateManager.updateCaptureState({ showSuccessAnimation: false });
1684
1475
  }, 3000);
1685
- // Aggressive cleanup after process completion with delay
1686
- setTimeout(async () => {
1687
- const cleanupResult = await this.aggressiveResourceCleanup();
1688
- if (this.debug) {
1689
- console.log('🧹 Post-completion cleanup:', cleanupResult.freed);
1690
- if (cleanupResult.errors.length > 0) {
1691
- console.warn('⚠️ Cleanup errors:', cleanupResult.errors);
1692
- }
1693
- }
1694
- }, 1000); // Wait 1 second after completion
1695
1476
  }
1696
1477
  stopDetection() {
1697
1478
  if (this.animationId) {
@@ -1743,6 +1524,12 @@ export class JaakStamps {
1743
1524
  try {
1744
1525
  // Close the selector immediately when user selects a camera
1745
1526
  this.showCameraSelector = false;
1527
+ // Check if user selected the same camera that's already active
1528
+ const currentCameraId = this.cameraService.getSelectedCameraId();
1529
+ if (currentCameraId === cameraId) {
1530
+ // Same camera selected, just close the selector without switching
1531
+ return;
1532
+ }
1746
1533
  this.isSwitchingCamera = true;
1747
1534
  // Stop current video stream
1748
1535
  if (this.videoStream) {
@@ -2273,7 +2060,7 @@ export class JaakStamps {
2273
2060
  },
2274
2061
  "stopCapture": {
2275
2062
  "complexType": {
2276
- "signature": "() => Promise<{ success: boolean; resourcesFreed: string[]; cleanupErrors: string[]; error?: undefined; } | { success: boolean; error: any; resourcesFreed?: undefined; cleanupErrors?: undefined; }>",
2063
+ "signature": "() => Promise<{ success: boolean; error?: undefined; } | { success: boolean; error: any; }>",
2277
2064
  "parameters": [],
2278
2065
  "references": {
2279
2066
  "Promise": {
@@ -2281,7 +2068,7 @@ export class JaakStamps {
2281
2068
  "id": "global::Promise"
2282
2069
  }
2283
2070
  },
2284
- "return": "Promise<{ success: boolean; resourcesFreed: string[]; cleanupErrors: string[]; error?: undefined; } | { success: boolean; error: any; resourcesFreed?: undefined; cleanupErrors?: undefined; }>"
2071
+ "return": "Promise<{ success: boolean; error?: undefined; } | { success: boolean; error: any; }>"
2285
2072
  },
2286
2073
  "docs": {
2287
2074
  "text": "",
@@ -2441,40 +2228,6 @@ export class JaakStamps {
2441
2228
  "text": "",
2442
2229
  "tags": []
2443
2230
  }
2444
- },
2445
- "getResourceReport": {
2446
- "complexType": {
2447
- "signature": "() => Promise<any>",
2448
- "parameters": [],
2449
- "references": {
2450
- "Promise": {
2451
- "location": "global",
2452
- "id": "global::Promise"
2453
- }
2454
- },
2455
- "return": "Promise<any>"
2456
- },
2457
- "docs": {
2458
- "text": "",
2459
- "tags": []
2460
- }
2461
- },
2462
- "forceResourceCleanup": {
2463
- "complexType": {
2464
- "signature": "() => Promise<{ success: boolean; resourcesFreed: string[]; errors: string[]; timestamp: string; error?: undefined; } | { success: boolean; error: any; resourcesFreed?: undefined; errors?: undefined; timestamp?: undefined; }>",
2465
- "parameters": [],
2466
- "references": {
2467
- "Promise": {
2468
- "location": "global",
2469
- "id": "global::Promise"
2470
- }
2471
- },
2472
- "return": "Promise<{ success: boolean; resourcesFreed: string[]; errors: string[]; timestamp: string; error?: undefined; } | { success: boolean; error: any; resourcesFreed?: undefined; errors?: undefined; timestamp?: undefined; }>"
2473
- },
2474
- "docs": {
2475
- "text": "",
2476
- "tags": []
2477
- }
2478
2231
  }
2479
2232
  };
2480
2233
  }