@jaak.ai/stamps 2.0.0-dev.28 → 2.0.0-dev.30

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.
@@ -71,41 +71,72 @@ const JaakStamps$1 = /*@__PURE__*/ proxyCustomElement(class JaakStamps extends H
71
71
  preprocessCtx;
72
72
  captureCanvas;
73
73
  captureCtx;
74
- MODEL_PATH = "https://storage.googleapis.com/jaak-static/web/component/stamps/ddmyp-v1.onnx";
74
+ MODEL_PATH = "https://storage.googleapis.com/jaak-static/web/component/stamps/ddmyp-v2.onnx";
75
75
  MOBILENET_MODEL_PATH = "https://storage.googleapis.com/jaak-static/web/component/stamps/cdmmp-v1.onnx";
76
76
  MOBILENET_CLASSES_PATH = "https://storage.googleapis.com/jaak-static/web/component/stamps/cdmmp-v1.json";
77
77
  INPUT_SIZE = 320;
78
78
  CONFIDENCE_THRESHOLD = 0.6;
79
79
  // ISO/IEC 7810 ID-1 standard dimensions (85.60mm x 53.98mm)
80
80
  ID1_ASPECT_RATIO = 85.60 / 53.98; // 1.5863320574...
81
- debugLog(...args) {
82
- if (this.debug) {
83
- console.log(...args);
81
+ logger = {
82
+ info: (...args) => {
83
+ if (this.debug) {
84
+ console.log(`[JAAK-STAMPS] [INFO] [${new Date().toLocaleTimeString()}]`, ...args);
85
+ }
86
+ },
87
+ warn: (...args) => {
88
+ if (this.debug) {
89
+ console.warn(`[JAAK-STAMPS] [WARN] [${new Date().toLocaleTimeString()}]`, ...args);
90
+ }
91
+ },
92
+ error: (...args) => {
93
+ if (this.debug) {
94
+ console.error(`[JAAK-STAMPS] [ERROR] [${new Date().toLocaleTimeString()}]`, ...args);
95
+ }
96
+ },
97
+ debug: (...args) => {
98
+ if (this.debug) {
99
+ console.debug(`[JAAK-STAMPS] [DEBUG] [${new Date().toLocaleTimeString()}]`, ...args);
100
+ }
101
+ },
102
+ state: (state, data) => {
103
+ if (this.debug) {
104
+ console.log(`[JAAK-STAMPS] [STATE] [${new Date().toLocaleTimeString()}] ${state}`, data || '');
105
+ }
106
+ },
107
+ performance: (operation, duration) => {
108
+ if (this.debug) {
109
+ console.log(`[JAAK-STAMPS] [PERF] [${new Date().toLocaleTimeString()}] ${operation}: ${duration}ms`);
110
+ }
84
111
  }
85
- }
112
+ };
86
113
  validateMaskSize() {
87
114
  if (this.maskSize < 50 || this.maskSize > 100) {
88
- console.warn(`maskSize debe estar entre 50 y 100. Valor actual: ${this.maskSize}. Usando valor por defecto: 90`);
115
+ this.logger.warn(`Propiedad maskSize inválida. Valor: ${this.maskSize}, esperado: 50-100. Usando valor por defecto: 90`);
89
116
  this.maskSize = 90;
90
117
  }
91
118
  }
92
119
  validateCropMargin() {
93
120
  if (this.cropMargin < 0 || this.cropMargin > 100) {
94
- console.warn(`cropMargin debe estar entre 0 y 100. Valor actual: ${this.cropMargin}. Usando valor por defecto: 0`);
121
+ this.logger.warn(`Propiedad cropMargin inválida. Valor: ${this.cropMargin}, esperado: 0-100. Usando valor por defecto: 0`);
95
122
  this.cropMargin = 0;
96
123
  }
97
124
  }
98
125
  validatePreferredCamera() {
99
126
  const validOptions = ['auto', 'front', 'back'];
100
127
  if (!validOptions.includes(this.preferredCamera)) {
101
- console.warn(`preferredCamera debe ser uno de: ${validOptions.join(', ')}. Valor actual: ${this.preferredCamera}. Usando valor por defecto: 'auto'`);
128
+ this.logger.warn(`Propiedad preferredCamera inválida. Valor: ${this.preferredCamera}, esperado: ${validOptions.join(', ')}. Usando valor por defecto: 'auto'`);
102
129
  this.preferredCamera = 'auto';
103
130
  }
104
131
  }
105
132
  emitReadyEvent() {
106
133
  const isDocumentReady = !!window.ort && this.isModelPreloaded;
107
134
  this.isReady.emit(isDocumentReady);
108
- this.debugLog('🟢 isReady event emitted:', isDocumentReady);
135
+ this.logger.state('COMPONENTE_LISTO', {
136
+ ortLibraryLoaded: !!window.ort,
137
+ modelPreloaded: this.isModelPreloaded,
138
+ isReady: isDocumentReady
139
+ });
109
140
  }
110
141
  isRearCamera(stream) {
111
142
  const videoTrack = stream.getVideoTracks()[0];
@@ -128,7 +159,11 @@ const JaakStamps$1 = /*@__PURE__*/ proxyCustomElement(class JaakStamps extends H
128
159
  else {
129
160
  this.deviceType = 'desktop';
130
161
  }
131
- this.debugLog('📱 Device type detected:', this.deviceType);
162
+ this.logger.state('DISPOSITIVO_DETECTADO', {
163
+ deviceType: this.deviceType,
164
+ userAgent: navigator.userAgent,
165
+ screenDimensions: { width: window.innerWidth, height: window.innerHeight }
166
+ });
132
167
  // Enumerate available cameras
133
168
  await this.enumerateAndDetectCameras();
134
169
  // Load user preference
@@ -139,7 +174,7 @@ const JaakStamps$1 = /*@__PURE__*/ proxyCustomElement(class JaakStamps extends H
139
174
  // First, check if we have permission to enumerate devices
140
175
  const permissionStatus = await this.checkCameraPermission();
141
176
  if (permissionStatus === 'denied') {
142
- this.debugLog(' Camera permission denied');
177
+ this.logger.error('Permiso de cámara denegado por el usuario');
143
178
  this.statusMessage = "Permiso de cámara denegado";
144
179
  this.statusColor = "#ff6b6b";
145
180
  return;
@@ -153,7 +188,7 @@ const JaakStamps$1 = /*@__PURE__*/ proxyCustomElement(class JaakStamps extends H
153
188
  const devices = await navigator.mediaDevices.enumerateDevices();
154
189
  this.availableCameras = devices.filter(device => device.kind === 'videoinput');
155
190
  this.isMultipleCamerasAvailable = this.availableCameras.length > 1;
156
- this.debugLog('📹 Available cameras:', {
191
+ this.logger.state('CAMARAS_DETECTADAS', {
157
192
  count: this.availableCameras.length,
158
193
  isMultipleCamerasAvailable: this.isMultipleCamerasAvailable,
159
194
  cameras: this.availableCameras.map(cam => ({
@@ -165,7 +200,7 @@ const JaakStamps$1 = /*@__PURE__*/ proxyCustomElement(class JaakStamps extends H
165
200
  this.setInitialCameraPreference();
166
201
  }
167
202
  catch (error) {
168
- this.debugLog('Error enumerating cameras:', error);
203
+ this.logger.error('Error al enumerar cámaras disponibles:', error);
169
204
  this.handleCameraPermissionError(error);
170
205
  }
171
206
  }
@@ -178,7 +213,7 @@ const JaakStamps$1 = /*@__PURE__*/ proxyCustomElement(class JaakStamps extends H
178
213
  return permission.state;
179
214
  }
180
215
  catch (error) {
181
- this.debugLog('⚠️ Could not check camera permission:', error);
216
+ this.logger.warn('No se pudo verificar permisos de cámara:', error);
182
217
  return 'prompt';
183
218
  }
184
219
  }
@@ -221,11 +256,11 @@ const JaakStamps$1 = /*@__PURE__*/ proxyCustomElement(class JaakStamps extends H
221
256
  !camera.label.toLowerCase().includes('back') && !camera.label.toLowerCase().includes('rear'));
222
257
  if (frontCamera) {
223
258
  this.selectedCameraId = frontCamera.deviceId;
224
- this.debugLog('👤 User selected front camera:', frontCamera.label);
259
+ this.logger.state('CAMARA_FRONTAL_SELECCIONADA', { label: frontCamera.label, deviceId: frontCamera.deviceId });
225
260
  }
226
261
  else {
227
262
  this.selectedCameraId = this.availableCameras[0].deviceId;
228
- this.debugLog('⚠️ Front camera not found, using first available:', this.availableCameras[0].label);
263
+ this.logger.warn('Cámara frontal no encontrada, usando primera disponible:', this.availableCameras[0].label);
229
264
  }
230
265
  }
231
266
  else if (this.preferredCamera === 'back') {
@@ -236,11 +271,11 @@ const JaakStamps$1 = /*@__PURE__*/ proxyCustomElement(class JaakStamps extends H
236
271
  camera.label.toLowerCase().includes('environment'));
237
272
  if (backCamera) {
238
273
  this.selectedCameraId = backCamera.deviceId;
239
- this.debugLog('📷 User selected back camera:', backCamera.label);
274
+ this.logger.state('CAMARA_TRASERA_SELECCIONADA', { label: backCamera.label, deviceId: backCamera.deviceId });
240
275
  }
241
276
  else {
242
277
  this.selectedCameraId = this.availableCameras[0].deviceId;
243
- this.debugLog('⚠️ Back camera not found, using first available:', this.availableCameras[0].label);
278
+ this.logger.warn('Cámara trasera no encontrada, usando primera disponible:', this.availableCameras[0].label);
244
279
  }
245
280
  }
246
281
  else {
@@ -253,17 +288,17 @@ const JaakStamps$1 = /*@__PURE__*/ proxyCustomElement(class JaakStamps extends H
253
288
  camera.label.toLowerCase().includes('environment'));
254
289
  if (rearCamera) {
255
290
  this.selectedCameraId = rearCamera.deviceId;
256
- this.debugLog('📱 Auto-selected rear camera for mobile:', rearCamera.label);
291
+ this.logger.state('CAMARA_AUTO_SELECCIONADA_MOBILE', { type: 'rear', label: rearCamera.label, deviceId: rearCamera.deviceId });
257
292
  }
258
293
  else {
259
294
  this.selectedCameraId = this.availableCameras[0].deviceId;
260
- this.debugLog('📱 Rear camera not found, using first available:', this.availableCameras[0].label);
295
+ this.logger.warn('Cámara trasera no encontrada en mobile, usando primera disponible:', this.availableCameras[0].label);
261
296
  }
262
297
  }
263
298
  else {
264
299
  // For desktop, use first available camera (usually the only one)
265
300
  this.selectedCameraId = this.availableCameras[0].deviceId;
266
- this.debugLog('💻 Auto-selected desktop camera:', this.availableCameras[0].label);
301
+ this.logger.state('CAMARA_AUTO_SELECCIONADA_DESKTOP', { label: this.availableCameras[0].label, deviceId: this.availableCameras[0].deviceId });
267
302
  }
268
303
  }
269
304
  }
@@ -277,12 +312,12 @@ const JaakStamps$1 = /*@__PURE__*/ proxyCustomElement(class JaakStamps extends H
277
312
  if (isStillAvailable) {
278
313
  this.selectedCameraId = preference.cameraId;
279
314
  this.preferredCameraFacing = preference.facing;
280
- this.debugLog('💾 Loaded camera preference:', preference);
315
+ this.logger.state('PREFERENCIA_CAMARA_CARGADA', preference);
281
316
  }
282
317
  }
283
318
  }
284
319
  catch (error) {
285
- this.debugLog('⚠️ Error loading camera preference:', error);
320
+ this.logger.warn('Error al cargar preferencia de cámara:', error);
286
321
  }
287
322
  }
288
323
  saveCameraPreference() {
@@ -293,10 +328,10 @@ const JaakStamps$1 = /*@__PURE__*/ proxyCustomElement(class JaakStamps extends H
293
328
  timestamp: Date.now()
294
329
  };
295
330
  localStorage.setItem('jaak-stamps-camera-preference', JSON.stringify(preference));
296
- this.debugLog('💾 Saved camera preference:', preference);
331
+ this.logger.state('PREFERENCIA_CAMARA_GUARDADA', preference);
297
332
  }
298
333
  catch (error) {
299
- this.debugLog('⚠️ Error saving camera preference:', error);
334
+ this.logger.warn('Error al guardar preferencia de cámara:', error);
300
335
  }
301
336
  }
302
337
  async switchCamera(cameraId) {
@@ -306,7 +341,7 @@ const JaakStamps$1 = /*@__PURE__*/ proxyCustomElement(class JaakStamps extends H
306
341
  // Check if the selected camera is still available
307
342
  const selectedCamera = this.availableCameras.find(cam => cam.deviceId === cameraId);
308
343
  if (!selectedCamera) {
309
- this.debugLog(' Selected camera not found, re-enumerating...');
344
+ this.logger.warn('Cámara seleccionada no encontrada, re-enumerando dispositivos...');
310
345
  await this.enumerateAndDetectCameras();
311
346
  return;
312
347
  }
@@ -330,10 +365,10 @@ const JaakStamps$1 = /*@__PURE__*/ proxyCustomElement(class JaakStamps extends H
330
365
  this.saveCameraPreference();
331
366
  // Setup new camera with error handling
332
367
  await this.setupCameraWithRetry();
333
- this.debugLog('🔄 Switched to camera:', selectedCamera.label);
368
+ this.logger.state('CAMARA_CAMBIADA', { label: selectedCamera.label, deviceId: selectedCamera.deviceId });
334
369
  }
335
370
  catch (error) {
336
- this.debugLog('Error switching camera:', error);
371
+ this.logger.error('Error al cambiar de cámara:', error);
337
372
  this.handleCameraPermissionError(error);
338
373
  }
339
374
  }
@@ -348,7 +383,7 @@ const JaakStamps$1 = /*@__PURE__*/ proxyCustomElement(class JaakStamps extends H
348
383
  return; // Success
349
384
  }
350
385
  catch (error) {
351
- this.debugLog(`❌ Camera setup attempt ${attempt} failed:`, error);
386
+ this.logger.error(`Intento ${attempt} de configuración de cámara fallido:`, error);
352
387
  if (attempt === maxRetries) {
353
388
  // Last attempt failed, handle the error
354
389
  this.statusMessage = "Error al configurar la cámara";
@@ -368,7 +403,7 @@ const JaakStamps$1 = /*@__PURE__*/ proxyCustomElement(class JaakStamps extends H
368
403
  }
369
404
  toggleCameraSelector() {
370
405
  this.showCameraSelector = !this.showCameraSelector;
371
- this.debugLog('📹 Camera selector toggled:', {
406
+ this.logger.state('SELECTOR_CAMARA_TOGGLE', {
372
407
  showCameraSelector: this.showCameraSelector,
373
408
  isMultipleCamerasAvailable: this.isMultipleCamerasAvailable,
374
409
  availableCameras: this.availableCameras.length,
@@ -384,6 +419,13 @@ const JaakStamps$1 = /*@__PURE__*/ proxyCustomElement(class JaakStamps extends H
384
419
  await this.switchCamera(nextCamera.deviceId);
385
420
  }
386
421
  async componentDidLoad() {
422
+ this.logger.state('COMPONENTE_INICIALIZANDO', {
423
+ debug: this.debug,
424
+ maskSize: this.maskSize,
425
+ cropMargin: this.cropMargin,
426
+ useDocumentClassification: this.useDocumentClassification,
427
+ preferredCamera: this.preferredCamera
428
+ });
387
429
  if (this.debug) {
388
430
  // Show detailed initialization loading state only in debug mode
389
431
  this.isLoading = true;
@@ -448,7 +490,7 @@ const JaakStamps$1 = /*@__PURE__*/ proxyCustomElement(class JaakStamps extends H
448
490
  this.canvasRef.height = rect.height;
449
491
  // Update mask positioning based on container and video dimensions
450
492
  this.updateMaskDimensions(rect);
451
- this.debugLog('📐 Canvas resized:', { width: rect.width, height: rect.height });
493
+ this.logger.debug('Canvas redimensionado:', { width: rect.width, height: rect.height });
452
494
  }
453
495
  }
454
496
  updateMaskDimensions(containerRect) {
@@ -508,7 +550,7 @@ const JaakStamps$1 = /*@__PURE__*/ proxyCustomElement(class JaakStamps extends H
508
550
  this.el.style.setProperty('--mask-center-y', `${videoCenterYPercent}%`);
509
551
  // Mark mask as ready now that dimensions are calculated
510
552
  this.isMaskReady = true;
511
- this.debugLog('🎯 Mask dimensions updated:', {
553
+ this.logger.state('DIMENSIONES_MASCARA_ACTUALIZADAS', {
512
554
  video: { width: videoWidth, height: videoHeight },
513
555
  displayed: { width: displayedVideoWidth, height: displayedVideoHeight },
514
556
  mask: { widthPercent: maskWidthPercent, heightPercent: maskHeightPercent },
@@ -530,7 +572,7 @@ const JaakStamps$1 = /*@__PURE__*/ proxyCustomElement(class JaakStamps extends H
530
572
  this.captureCtx = this.captureCanvas.getContext('2d', {
531
573
  alpha: false
532
574
  });
533
- this.debugLog('🎨 Canvas pool initialized for performance');
575
+ this.logger.state('CANVAS_POOL_INICIALIZADO', { preprocessCanvasSize: this.INPUT_SIZE });
534
576
  }
535
577
  disconnectedCallback() {
536
578
  this.cleanup();
@@ -578,7 +620,7 @@ const JaakStamps$1 = /*@__PURE__*/ proxyCustomElement(class JaakStamps extends H
578
620
  }
579
621
  async preloadModel() {
580
622
  if (this.isModelPreloaded || this.session) {
581
- this.debugLog('🚀 Model already preloaded or session exists');
623
+ this.logger.state('MODELO_YA_PRECARGADO', { sessionExists: !!this.session, modelPreloaded: this.isModelPreloaded });
582
624
  return { success: true, message: 'Model already loaded' };
583
625
  }
584
626
  try {
@@ -586,7 +628,7 @@ const JaakStamps$1 = /*@__PURE__*/ proxyCustomElement(class JaakStamps extends H
586
628
  this.statusMessage = "Precargando modelos...";
587
629
  this.statusColor = "#007bff";
588
630
  const modelPath = this.MODEL_PATH;
589
- this.debugLog('🤖 Preloading detection model:', modelPath);
631
+ this.logger.state('PRECARGANDO_MODELO_DETECCION', { modelPath });
590
632
  // Configure ONNX Runtime with device-specific optimizations
591
633
  const sessionOptions = this.getSessionOptions();
592
634
  const deviceInfo = this.getDeviceMemoryInfo();
@@ -595,7 +637,7 @@ const JaakStamps$1 = /*@__PURE__*/ proxyCustomElement(class JaakStamps extends H
595
637
  }
596
638
  catch (error) {
597
639
  if (error.message.includes('failed to allocate a buffer')) {
598
- this.debugLog(' Buffer allocation failed during preload, trying with minimal settings');
640
+ this.logger.warn('Fallo en asignación de buffer durante precarga, intentando con configuración mínima');
599
641
  const fallbackOptions = {
600
642
  executionProviders: ['wasm'],
601
643
  graphOptimizationLevel: 'disabled',
@@ -616,7 +658,7 @@ const JaakStamps$1 = /*@__PURE__*/ proxyCustomElement(class JaakStamps extends H
616
658
  // For low memory devices, load sequentially to avoid memory pressure
617
659
  if (this.useDocumentClassification) {
618
660
  if (deviceInfo.isLowMemory) {
619
- this.debugLog('🔄 Sequential model loading for low memory device');
661
+ this.logger.state('CARGA_SECUENCIAL_MODELOS', { reason: 'low memory device' });
620
662
  await new Promise(resolve => setTimeout(resolve, 1000));
621
663
  }
622
664
  await this.loadMobileNetModel();
@@ -626,11 +668,15 @@ const JaakStamps$1 = /*@__PURE__*/ proxyCustomElement(class JaakStamps extends H
626
668
  this.statusMessage = "Modelos precargados. Listo para comenzar detección";
627
669
  this.statusColor = "#28a745";
628
670
  this.emitReadyEvent();
629
- this.debugLog(' Models preloaded successfully');
671
+ this.logger.state('MODELOS_PRECARGADOS_EXITOSAMENTE', {
672
+ detectionModel: !!this.session,
673
+ classificationModel: !!this.mobileNetSession,
674
+ useClassification: this.useDocumentClassification
675
+ });
630
676
  return { success: true, message: 'Models preloaded successfully' };
631
677
  }
632
678
  catch (error) {
633
- this.debugLog('Error preloading models:', error);
679
+ this.logger.error('Error al precargar modelos:', error);
634
680
  this.isLoading = false;
635
681
  this.statusMessage = "Error al precargar los modelos";
636
682
  this.statusColor = "#ff6b6b";
@@ -658,7 +704,7 @@ const JaakStamps$1 = /*@__PURE__*/ proxyCustomElement(class JaakStamps extends H
658
704
  }
659
705
  async setPreferredCamera(camera) {
660
706
  this.preferredCamera = camera;
661
- this.debugLog('🎯 Camera preference changed to:', camera);
707
+ this.logger.state('PREFERENCIA_CAMARA_CAMBIADA', { newPreference: camera });
662
708
  // Re-detect and apply new camera preference
663
709
  await this.enumerateAndDetectCameras();
664
710
  // If video is active, switch to the new preferred camera
@@ -673,14 +719,14 @@ const JaakStamps$1 = /*@__PURE__*/ proxyCustomElement(class JaakStamps extends H
673
719
  }
674
720
  async loadMobileNetModel() {
675
721
  try {
676
- this.debugLog('🤖 Loading MobileNet model...');
722
+ this.logger.state('CARGANDO_MODELO_MOBILENET', { path: this.MOBILENET_MODEL_PATH });
677
723
  // Load class map
678
724
  const classResponse = await fetch(this.MOBILENET_CLASSES_PATH);
679
725
  if (!classResponse.ok) {
680
726
  throw new Error(`Failed to load class map: ${this.MOBILENET_CLASSES_PATH}`);
681
727
  }
682
728
  this.mobileNetClassMap = await classResponse.json();
683
- this.debugLog('📋 MobileNet classes loaded:', this.mobileNetClassMap);
729
+ this.logger.state('CLASES_MOBILENET_CARGADAS', { classCount: Object.keys(this.mobileNetClassMap).length });
684
730
  // Load model
685
731
  const sessionOptions = this.getSessionOptions();
686
732
  try {
@@ -688,7 +734,7 @@ const JaakStamps$1 = /*@__PURE__*/ proxyCustomElement(class JaakStamps extends H
688
734
  }
689
735
  catch (error) {
690
736
  if (error.message.includes('failed to allocate a buffer')) {
691
- this.debugLog(' MobileNet buffer allocation failed, trying with minimal settings');
737
+ this.logger.warn('Fallo en asignación de buffer de MobileNet, intentando con configuración mínima');
692
738
  const fallbackOptions = {
693
739
  executionProviders: ['wasm'],
694
740
  graphOptimizationLevel: 'disabled',
@@ -705,10 +751,10 @@ const JaakStamps$1 = /*@__PURE__*/ proxyCustomElement(class JaakStamps extends H
705
751
  throw error;
706
752
  }
707
753
  }
708
- this.debugLog(' MobileNet model loaded successfully');
754
+ this.logger.state('MODELO_MOBILENET_CARGADO_EXITOSAMENTE', { sessionCreated: !!this.mobileNetSession });
709
755
  }
710
756
  catch (error) {
711
- this.debugLog('Error loading MobileNet model:', error);
757
+ this.logger.error('Error al cargar modelo MobileNet:', error);
712
758
  throw error;
713
759
  }
714
760
  }
@@ -735,11 +781,11 @@ const JaakStamps$1 = /*@__PURE__*/ proxyCustomElement(class JaakStamps extends H
735
781
  }
736
782
  async classifyDocument(canvas) {
737
783
  if (!this.mobileNetSession || !this.mobileNetClassMap) {
738
- this.debugLog('⚠️ MobileNet model not loaded');
784
+ this.logger.warn('Modelo MobileNet no está cargado, saltando clasificación');
739
785
  return null;
740
786
  }
741
787
  try {
742
- this.debugLog('🔍 Classifying document...');
788
+ this.logger.state('CLASIFICANDO_DOCUMENTO', { timestamp: Date.now() });
743
789
  // Preprocess image for MobileNet
744
790
  const inputTensor = this.preprocessMobileNet(canvas);
745
791
  // Run inference
@@ -750,10 +796,11 @@ const JaakStamps$1 = /*@__PURE__*/ proxyCustomElement(class JaakStamps extends H
750
796
  const maxIdx = output.reduce((bestIdx, val, idx, arr) => val > arr[bestIdx] ? idx : bestIdx, 0);
751
797
  const confidence = output[maxIdx];
752
798
  const className = this.mobileNetClassMap[maxIdx.toString()] || "unknown";
753
- this.debugLog('📄 Document classification result:', {
799
+ this.logger.state('DOCUMENTO_CLASIFICADO', {
754
800
  class: className,
755
801
  confidence: confidence.toFixed(3),
756
- classIndex: maxIdx
802
+ classIndex: maxIdx,
803
+ timestamp: Date.now()
757
804
  });
758
805
  return {
759
806
  class: className,
@@ -762,7 +809,7 @@ const JaakStamps$1 = /*@__PURE__*/ proxyCustomElement(class JaakStamps extends H
762
809
  };
763
810
  }
764
811
  catch (error) {
765
- this.debugLog('Error classifying document:', error);
812
+ this.logger.error('Error al clasificar documento:', error);
766
813
  return null;
767
814
  }
768
815
  }
@@ -804,7 +851,7 @@ const JaakStamps$1 = /*@__PURE__*/ proxyCustomElement(class JaakStamps extends H
804
851
  }
805
852
  this.mobileNetClassMap = undefined;
806
853
  this.isModelPreloaded = false;
807
- this.debugLog('🧹 Canvas pool cleaned up');
854
+ this.logger.state('CANVAS_POOL_LIMPIADO', { timestamp: Date.now() });
808
855
  }
809
856
  async getMaxResolution() {
810
857
  try {
@@ -853,18 +900,19 @@ const JaakStamps$1 = /*@__PURE__*/ proxyCustomElement(class JaakStamps extends H
853
900
  constraints.width = { ideal: maxWidth };
854
901
  constraints.height = { ideal: maxHeight };
855
902
  }
856
- this.debugLog('📐 Resolution capabilities:', {
903
+ this.logger.state('CAPACIDADES_RESOLUCION_DETECTADAS', {
857
904
  maxWidth: capabilities.width.max,
858
905
  maxHeight: capabilities.height.max,
859
906
  selectedWidth: constraints.width.ideal,
860
907
  selectedHeight: constraints.height.ideal,
861
- isTablet
908
+ isTablet,
909
+ deviceType: this.deviceType
862
910
  });
863
911
  }
864
912
  return constraints;
865
913
  }
866
914
  catch (err) {
867
- this.debugLog('⚠️ Could not get capabilities, using fallback');
915
+ this.logger.warn('No se pudieron obtener capacidades de cámara, usando configuración de respaldo');
868
916
  // Optimized fallback for tablets
869
917
  const isTablet = /iPad|Android/i.test(navigator.userAgent) && window.innerWidth >= 768;
870
918
  const fallbackConstraints = {
@@ -897,8 +945,11 @@ const JaakStamps$1 = /*@__PURE__*/ proxyCustomElement(class JaakStamps extends H
897
945
  // Determine if video should be mirrored
898
946
  const isRear = this.isRearCamera(stream);
899
947
  this.shouldMirrorVideo = !isRear;
900
- this.debugLog('📹 Rear camera:', isRear);
901
- this.debugLog('🪞 Should mirror video:', this.shouldMirrorVideo);
948
+ this.logger.state('CAMARA_CONFIGURADA', {
949
+ isRearCamera: isRear,
950
+ shouldMirrorVideo: this.shouldMirrorVideo,
951
+ videoActive: this.isVideoActive
952
+ });
902
953
  return new Promise((resolve) => {
903
954
  this.videoRef.onloadedmetadata = async () => {
904
955
  await this.videoRef.play();
@@ -915,7 +966,7 @@ const JaakStamps$1 = /*@__PURE__*/ proxyCustomElement(class JaakStamps extends H
915
966
  }
916
967
  }
917
968
  catch (err) {
918
- this.debugLog("❌ No se pudo acceder a la cámara:", err);
969
+ this.logger.error('No se pudo acceder a la cámara:', err);
919
970
  this.handleCameraPermissionError(err);
920
971
  }
921
972
  }
@@ -937,7 +988,37 @@ const JaakStamps$1 = /*@__PURE__*/ proxyCustomElement(class JaakStamps extends H
937
988
  B.push(data[i + 2] / 255);
938
989
  }
939
990
  const transposedData = new Float32Array(R.concat(G, B));
940
- return new window.ort.Tensor("float32", transposedData, [1, 3, this.INPUT_SIZE, this.INPUT_SIZE]);
991
+ // Convert to float16 for the lighter model
992
+ const float16Data = new Uint16Array(transposedData.length);
993
+ for (let i = 0; i < transposedData.length; i++) {
994
+ float16Data[i] = this.float32ToFloat16(transposedData[i]);
995
+ }
996
+ return new window.ort.Tensor("float16", float16Data, [1, 3, this.INPUT_SIZE, this.INPUT_SIZE]);
997
+ }
998
+ float32ToFloat16(value) {
999
+ // Convert float32 to float16 using IEEE 754 half precision format
1000
+ const buffer = new ArrayBuffer(4);
1001
+ const view = new DataView(buffer);
1002
+ view.setFloat32(0, value, true);
1003
+ const f = view.getUint32(0, true);
1004
+ const sign = (f >> 31) & 0x1;
1005
+ const exp = (f >> 23) & 0xFF;
1006
+ const frac = f & 0x7FFFFF;
1007
+ let newExp = exp - 127 + 15;
1008
+ if (exp === 0) {
1009
+ newExp = 0;
1010
+ }
1011
+ else if (exp === 0xFF) {
1012
+ newExp = 0x1F;
1013
+ }
1014
+ else if (newExp >= 0x1F) {
1015
+ newExp = 0x1F;
1016
+ return (sign << 15) | (newExp << 10);
1017
+ }
1018
+ else if (newExp <= 0) {
1019
+ return (sign << 15);
1020
+ }
1021
+ return (sign << 15) | (newExp << 10) | (frac >> 13);
941
1022
  }
942
1023
  getDeviceMemoryInfo() {
943
1024
  const nav = navigator;
@@ -981,6 +1062,12 @@ const JaakStamps$1 = /*@__PURE__*/ proxyCustomElement(class JaakStamps extends H
981
1062
  };
982
1063
  }
983
1064
  async startDetection() {
1065
+ this.logger.state('INICIANDO_DETECCION', {
1066
+ sessionExists: !!this.session,
1067
+ modelPreloaded: this.isModelPreloaded,
1068
+ videoActive: this.isVideoActive,
1069
+ captureStep: this.captureStep
1070
+ });
984
1071
  try {
985
1072
  // Check if model is already preloaded
986
1073
  if (!this.session) {
@@ -994,14 +1081,14 @@ const JaakStamps$1 = /*@__PURE__*/ proxyCustomElement(class JaakStamps extends H
994
1081
  this.statusColor = "#007bff";
995
1082
  }
996
1083
  const modelPath = this.MODEL_PATH;
997
- this.debugLog('🤖 Loading detection model:', modelPath);
1084
+ this.logger.state('CARGANDO_MODELO_DETECCION', { modelPath });
998
1085
  const sessionOptions = this.getSessionOptions();
999
1086
  try {
1000
1087
  this.session = await window.ort.InferenceSession.create(modelPath, sessionOptions);
1001
1088
  }
1002
1089
  catch (error) {
1003
1090
  if (error.message.includes('failed to allocate a buffer')) {
1004
- this.debugLog(' Buffer allocation failed, trying with minimal settings');
1091
+ this.logger.warn('Fallo en asignación de buffer, intentando con configuración mínima');
1005
1092
  const fallbackOptions = {
1006
1093
  executionProviders: ['wasm'],
1007
1094
  graphOptimizationLevel: 'disabled',
@@ -1032,7 +1119,7 @@ const JaakStamps$1 = /*@__PURE__*/ proxyCustomElement(class JaakStamps extends H
1032
1119
  this.emitReadyEvent();
1033
1120
  }
1034
1121
  else {
1035
- this.debugLog('🚀 Using preloaded models');
1122
+ this.logger.state('USANDO_MODELOS_PRECARGADOS', { sessionExists: !!this.session, modelPreloaded: this.isModelPreloaded });
1036
1123
  if (this.debug) {
1037
1124
  this.statusMessage = "Usando modelos precargados...";
1038
1125
  this.statusColor = "#007bff";
@@ -1051,7 +1138,7 @@ const JaakStamps$1 = /*@__PURE__*/ proxyCustomElement(class JaakStamps extends H
1051
1138
  this.detectFrame();
1052
1139
  }
1053
1140
  catch (err) {
1054
- this.debugLog("Error al inicializar:", err);
1141
+ this.logger.error('Error al inicializar detección:', err);
1055
1142
  this.statusMessage = "Error al inicializar el detector";
1056
1143
  this.statusColor = "#ff6b6b";
1057
1144
  this.isLoading = false;
@@ -1133,7 +1220,7 @@ const JaakStamps$1 = /*@__PURE__*/ proxyCustomElement(class JaakStamps extends H
1133
1220
  }
1134
1221
  }
1135
1222
  catch (e) {
1136
- this.debugLog("Error en inferencia:", e);
1223
+ this.logger.error('Error en inferencia de modelo:', e);
1137
1224
  // Solo continuar si no hemos completado el proceso
1138
1225
  if (this.captureStep !== 'completed') {
1139
1226
  // On error, wait longer before retrying
@@ -1261,7 +1348,7 @@ const JaakStamps$1 = /*@__PURE__*/ proxyCustomElement(class JaakStamps extends H
1261
1348
  if (!this.hasScreenshotTaken) {
1262
1349
  this.lastDetectedBox = bestBox;
1263
1350
  this.takeScreenshot().catch(error => {
1264
- this.debugLog('Error taking screenshot:', error);
1351
+ this.logger.error('Error al tomar captura de pantalla:', error);
1265
1352
  });
1266
1353
  this.hasScreenshotTaken = true;
1267
1354
  // Reset para permitir segunda captura
@@ -1279,6 +1366,7 @@ const JaakStamps$1 = /*@__PURE__*/ proxyCustomElement(class JaakStamps extends H
1279
1366
  if (boxes.length === 0) {
1280
1367
  this.statusMessage = "Posicione la identificación dentro del marco";
1281
1368
  this.statusColor = "#ff6b6b";
1369
+ this.logger.debug('Sin detección de documento en el frame');
1282
1370
  }
1283
1371
  else {
1284
1372
  const bestBox = boxes.reduce((best, current) => current.score > best.score ? current : best);
@@ -1288,6 +1376,11 @@ const JaakStamps$1 = /*@__PURE__*/ proxyCustomElement(class JaakStamps extends H
1288
1376
  if (allSidesAligned) {
1289
1377
  this.statusMessage = "Identificación perfectamente alineada. Mantenga inmóvil";
1290
1378
  this.statusColor = "#00ff00";
1379
+ this.logger.state('DOCUMENTO_PERFECTAMENTE_ALINEADO', {
1380
+ score: bestBox.score,
1381
+ boxDimensions: { width: bestBox.w, height: bestBox.h },
1382
+ alignedSides: 4
1383
+ });
1291
1384
  }
1292
1385
  else if (alignedSides > 0) {
1293
1386
  this.statusMessage = `Alinee los lados restantes (${alignedSides}/4 lados correctos)`;
@@ -1348,6 +1441,14 @@ const JaakStamps$1 = /*@__PURE__*/ proxyCustomElement(class JaakStamps extends H
1348
1441
  async takeScreenshot() {
1349
1442
  if (!this.videoRef || !this.lastDetectedBox)
1350
1443
  return;
1444
+ this.logger.state('INICIANDO_CAPTURA', {
1445
+ captureStep: this.captureStep,
1446
+ detectedBox: this.lastDetectedBox,
1447
+ videoResolution: {
1448
+ width: this.videoRef.videoWidth,
1449
+ height: this.videoRef.videoHeight
1450
+ }
1451
+ });
1351
1452
  // Activar animación
1352
1453
  this.triggerCaptureAnimation();
1353
1454
  // OPTIMIZATION: Reuse capture canvas for full frame
@@ -1387,7 +1488,7 @@ const JaakStamps$1 = /*@__PURE__*/ proxyCustomElement(class JaakStamps extends H
1387
1488
  await this.loadMobileNetModel();
1388
1489
  }
1389
1490
  catch (error) {
1390
- this.debugLog('⚠️ Failed to load classification model, continuing without classification:', error);
1491
+ this.logger.warn('Fallo al cargar modelo de clasificación, continuando sin clasificación:', error);
1391
1492
  }
1392
1493
  }
1393
1494
  // Classify the cropped document if model is available
@@ -1395,7 +1496,7 @@ const JaakStamps$1 = /*@__PURE__*/ proxyCustomElement(class JaakStamps extends H
1395
1496
  const classification = await this.classifyDocument(croppedCanvas);
1396
1497
  if (classification && classification.class === 'passport') {
1397
1498
  // If it's a passport, skip back capture since passports don't have a back side
1398
- this.debugLog('📄 Passport detected - skipping back capture');
1499
+ this.logger.state('PASAPORTE_DETECTADO_SALTANDO_REVERSO', { classification: classification?.class });
1399
1500
  this.completeProcess(true);
1400
1501
  return;
1401
1502
  }
@@ -1416,14 +1517,23 @@ const JaakStamps$1 = /*@__PURE__*/ proxyCustomElement(class JaakStamps extends H
1416
1517
  this.isDetectionPaused = false;
1417
1518
  }, 3000);
1418
1519
  }, 800);
1419
- this.debugLog('📸 FRENTE capturado. Esperando trasera...');
1520
+ this.logger.state('CAPTURA_FRENTE_COMPLETADA', {
1521
+ captureStep: this.captureStep,
1522
+ hasFullFrame: !!this.capturedFullFrame,
1523
+ hasCroppedId: !!this.capturedCroppedId
1524
+ });
1420
1525
  }
1421
1526
  else if (this.captureStep === 'back') {
1422
1527
  // Captura de la trasera usando canvas reutilizado
1423
1528
  this.capturedBackFullFrame = this.captureCanvas.toDataURL('image/png');
1424
1529
  this.capturedBackCroppedId = croppedCanvas.toDataURL('image/png');
1425
1530
  this.completeProcess(false);
1426
- this.debugLog('📸 TRASERA capturada. Proceso completado. Detector detenido. Imágenes emitidas.');
1531
+ this.logger.state('CAPTURA_TRASERA_COMPLETADA', {
1532
+ captureStep: this.captureStep,
1533
+ hasBackFullFrame: !!this.capturedBackFullFrame,
1534
+ hasBackCroppedId: !!this.capturedBackCroppedId,
1535
+ processCompleted: true
1536
+ });
1427
1537
  }
1428
1538
  }
1429
1539
  triggerCaptureAnimation() {
@@ -1447,7 +1557,7 @@ const JaakStamps$1 = /*@__PURE__*/ proxyCustomElement(class JaakStamps extends H
1447
1557
  const ctx = this.canvasRef.getContext("2d");
1448
1558
  ctx.clearRect(0, 0, this.canvasRef.width, this.canvasRef.height);
1449
1559
  }
1450
- this.debugLog('🛑 Detector de identificación detenido');
1560
+ this.logger.state('DETECTOR_DETENIDO', { timestamp: Date.now() });
1451
1561
  }
1452
1562
  resetDetection() {
1453
1563
  this.bestScore = 0;
@@ -1486,6 +1596,13 @@ const JaakStamps$1 = /*@__PURE__*/ proxyCustomElement(class JaakStamps extends H
1486
1596
  "Proceso completado (solo frente capturado)" :
1487
1597
  "Proceso de captura completado exitosamente";
1488
1598
  this.statusColor = "#28a745";
1599
+ this.logger.state('PROCESO_COMPLETADO', {
1600
+ skippedBack,
1601
+ hasFrontImages: !!(this.capturedFullFrame && this.capturedCroppedId),
1602
+ hasBackImages: !!(this.capturedBackFullFrame && this.capturedBackCroppedId),
1603
+ totalImages: skippedBack ? 2 : 4,
1604
+ timestamp: new Date().toISOString()
1605
+ });
1489
1606
  // Detener el detector
1490
1607
  this.stopDetection();
1491
1608
  // Emitir evento con las imágenes capturadas
@@ -1537,7 +1654,7 @@ const JaakStamps$1 = /*@__PURE__*/ proxyCustomElement(class JaakStamps extends H
1537
1654
  this.cleanup();
1538
1655
  }
1539
1656
  render() {
1540
- return (h("div", { key: 'bacf8b2ded1c5015d01dd4240dda6a93fbfb629e', class: "detector-container" }, h("div", { key: '235aefbd8916d6b53ab191c654ed00f303ca73b7', class: "video-container" }, h("video", { key: '9b641c7092c5ecfa601b1f80d6bf8c310539c436', ref: el => this.videoRef = el, autoplay: true, muted: true, playsinline: true, class: this.shouldMirrorVideo ? 'mirror' : '', style: { display: this.isVideoActive ? 'block' : 'none' } }), h("canvas", { key: '2c3c384436b7dd91084dbdd27a34ac9192fa3f22', ref: el => this.canvasRef = el, class: this.shouldMirrorVideo ? 'mirror' : '' }), this.isMaskReady && (h("div", { key: '9e2ca398482ebae4da984854483af3159d908d2b', class: "overlay-mask" }, h("div", { key: 'ee14fd65d752351644a281fc4cbd7d8cf8765eec', class: "card-outline" }, h("div", { key: 'c5a924145ac54e7f545b0b6571f1d7d259fc1145', class: "side side-top" }), h("div", { key: 'a88e9ab5f1a4f7041edb44008697b619bf52a85b', class: "side side-right" }), h("div", { key: '08fbf94000951ea31d029469d8158b8bd3349bf8', class: "side side-bottom" }), h("div", { key: '3b9ead8e1d2c0f7fea2878a248241681c07bd0f6', class: "side side-left" }), h("div", { key: 'f96b9a5a0f00f016b11486a63ca984b368d18c8b', class: "corner corner-tl" }), h("div", { key: '30210f2ec60913466665dea50a1e8bc6cba34b41', class: "corner corner-tr" }), h("div", { key: 'cc4644c99957a9ddf68901ddd368037e01c56899', class: "corner corner-bl" }), h("div", { key: '95b08e9b36f880dda1d614f929ceb71259f5ec38', class: "corner corner-br" }), !this.showFlipAnimation && !this.showSuccessAnimation && (h("div", { key: '9bb545a793764b258381b0e3d665472c67d65b5b', class: "guide-text" }, this.statusMessage))), this.captureStep === 'back' && !this.showFlipAnimation && !this.showSuccessAnimation && (h("button", { key: '3b78e394067ea610021fd915215fca30ed0d654b', class: "skip-button", onClick: () => this.skipBackCapture(), type: "button" }, "Saltar reverso")), this.isVideoActive && (h("div", { key: '85fbcf97d151fbf1f37a2f6f90bbd93ef77afdba', class: "camera-controls" }, this.isMultipleCamerasAvailable && (h("button", { key: '56bab78e6ea660e42057b5e6bc322f6990116119', class: "flip-camera-button", onClick: () => this.flipCamera(), type: "button", title: "Cambiar c\u00E1mara" }, "Girar c\u00E1mara")), h("button", { key: 'c149303ed671d326efada743393e52b5a3710710', class: "camera-selector-button", onClick: () => this.toggleCameraSelector(), type: "button", title: "Seleccionar c\u00E1mara" }, "C\u00E1maras"), this.debug && (h("div", { key: 'ce7c0c1dbc2ba267dbd0181dd7268e2d9f7209c0', style: {
1657
+ return (h("div", { key: 'a09694bc3b5f78bc792ea101d470ada1a438a57b', class: "detector-container" }, h("div", { key: 'c673c10d3311a44479d4462f3efbb4b6257ec6a9', class: "video-container" }, h("video", { key: 'c9faf3f111c50f945bce9d566fea2bd6b249fa78', ref: el => this.videoRef = el, autoplay: true, muted: true, playsinline: true, class: this.shouldMirrorVideo ? 'mirror' : '', style: { display: this.isVideoActive ? 'block' : 'none' } }), h("canvas", { key: 'bdc04a389f6b956f7ca138d9fe74db38a6c8812c', ref: el => this.canvasRef = el, class: this.shouldMirrorVideo ? 'mirror' : '' }), this.isMaskReady && (h("div", { key: '317156579b40924a7bb96c89dd247713f87f1aa9', class: "overlay-mask" }, h("div", { key: '71cfc3c3bbfdae49f05fd563e14f56181440fafa', class: "card-outline" }, h("div", { key: '3f940eeb59d783f47e2e2651ccf1a7be19f1d8b9', class: "side side-top" }), h("div", { key: 'f07e54e9542811897191e9a9a08f91b9e4785cc6', class: "side side-right" }), h("div", { key: '5b6a323213ddff52071b3469068cba0b31930ea0', class: "side side-bottom" }), h("div", { key: '44cf6567819855ab915fcee51cec7d08cb8654a8', class: "side side-left" }), h("div", { key: '8f866542b2d1a399418d1c8cb58ea856d5f3b9e7', class: "corner corner-tl" }), h("div", { key: 'a6567d410c755553d4be5b77dfc965e63b4ef07f', class: "corner corner-tr" }), h("div", { key: '255636461627f2deb61c9feacda3c9379abaaf29', class: "corner corner-bl" }), h("div", { key: 'dd029757b1ccc49c44bedee12c19b9485ef16545', class: "corner corner-br" }), !this.showFlipAnimation && !this.showSuccessAnimation && (h("div", { key: '37aef58019835eac5883042554c648b89cd305ac', class: "guide-text" }, this.statusMessage))), this.captureStep === 'back' && !this.showFlipAnimation && !this.showSuccessAnimation && (h("button", { key: '541f6d35d0655093f767423fc6851b521a5b43cd', class: "skip-button", onClick: () => this.skipBackCapture(), type: "button" }, "Saltar reverso")), this.isVideoActive && (h("div", { key: '73f2232b7c79f8b935cc78f2e5de1f064e4a3472', class: "camera-controls" }, this.isMultipleCamerasAvailable && (h("button", { key: '3c176f9848dc4bf3b7144e2d68225562ae3780c0', class: "flip-camera-button", onClick: () => this.flipCamera(), type: "button", title: "Cambiar c\u00E1mara" }, "Girar c\u00E1mara")), h("button", { key: '9460ad4c42872324141ab19b516e7fa026afdd37', class: "camera-selector-button", onClick: () => this.toggleCameraSelector(), type: "button", title: "Seleccionar c\u00E1mara" }, "C\u00E1maras"), this.debug && (h("div", { key: '961d825eaba6077189f32193d527fe98a6d4e1e1', style: {
1541
1658
  position: 'absolute',
1542
1659
  top: '50px',
1543
1660
  right: '0',
@@ -1547,10 +1664,10 @@ const JaakStamps$1 = /*@__PURE__*/ proxyCustomElement(class JaakStamps extends H
1547
1664
  fontSize: '10px',
1548
1665
  borderRadius: '4px',
1549
1666
  whiteSpace: 'nowrap'
1550
- } }, "C\u00E1maras: ", this.availableCameras.length, h("br", { key: 'd62a6ddde7160f41075b3b1d00340515019a48ca' }), "M\u00FAltiples: ", this.isMultipleCamerasAvailable ? 'Sí' : 'No', h("br", { key: 'fe8c322421809a58f49150ef877ae0502d34d002' }), "Selector: ", this.showCameraSelector ? 'Visible' : 'Oculto', h("br", { key: '084d8c5c6c0193edcaf3bd7d64d0bce8e0bb6964' }), "Video: ", this.isVideoActive ? 'Activo' : 'Inactivo')))), this.showCameraSelector && this.availableCameras.length > 0 && (h("div", { key: '03b1a66188e65f1843c50aec096db840d60bb703', class: "camera-selector-dropdown" }, h("div", { key: 'fe7e08d25dd394d893a7f6269c80a2aaa4732134', class: "camera-selector-header" }, h("span", { key: '1b8f4892c3eef6dac8c682e152abb35e2331496c' }, "Seleccionar C\u00E1mara"), h("button", { key: '396c78a3753c707619e27ef7e5f3a412ba8480c6', class: "close-selector", onClick: () => this.toggleCameraSelector(), type: "button" }, "\u00D7")), h("div", { key: '6d56d67efe54719f21978cc6cc44cf2f421469bb', class: "camera-list" }, this.availableCameras.map((camera) => (h("button", { key: camera.deviceId, class: `camera-option ${this.selectedCameraId === camera.deviceId ? 'selected' : ''}`, onClick: () => {
1667
+ } }, "C\u00E1maras: ", this.availableCameras.length, h("br", { key: 'f7e12d21177478d03f6df0490dfc91df12bd1225' }), "M\u00FAltiples: ", this.isMultipleCamerasAvailable ? 'Sí' : 'No', h("br", { key: '1f1cc8cf92e10b9b902fd981875621fa8dbe70f2' }), "Selector: ", this.showCameraSelector ? 'Visible' : 'Oculto', h("br", { key: 'c119c6567b28fc33e99b59f76e53e9359491ab77' }), "Video: ", this.isVideoActive ? 'Activo' : 'Inactivo')))), this.showCameraSelector && this.availableCameras.length > 0 && (h("div", { key: 'c230990e87f3b6133263c42fc1b568c0caf076e2', class: "camera-selector-dropdown" }, h("div", { key: '44c224e93c5832eea498e756a446e12ce8255e61', class: "camera-selector-header" }, h("span", { key: '64d951db4843164378424f2d8d2ed2802eb35170' }, "Seleccionar C\u00E1mara"), h("button", { key: '0575a7d0a9a99d665d42c6a7f7d8ceff53da9bd2', class: "close-selector", onClick: () => this.toggleCameraSelector(), type: "button" }, "\u00D7")), h("div", { key: '4aceed8bcf821710af343611f1b31efdfe61438e', class: "camera-list" }, this.availableCameras.map((camera) => (h("button", { key: camera.deviceId, class: `camera-option ${this.selectedCameraId === camera.deviceId ? 'selected' : ''}`, onClick: () => {
1551
1668
  this.switchCamera(camera.deviceId);
1552
1669
  this.toggleCameraSelector();
1553
- }, type: "button" }, h("span", { class: "camera-label" }, camera.label || `Cámara ${this.availableCameras.indexOf(camera) + 1}`), this.selectedCameraId === camera.deviceId && (h("span", { class: "selected-indicator" }, "\u2713")))))), h("div", { key: '7f5dda6214695d50c08d2ba4ccec236f3bd158cf', class: "device-info" }, h("small", { key: '50d2768f82b9b7f0a9c1729a5167493f731fb4f6' }, "Dispositivo: ", this.deviceType)))))), this.isCapturing && (h("div", { key: '7ed246b862639b2c6df54dbd32ebb883776bfbd7', class: "capture-animation" })), this.showFlipAnimation && (h("div", { key: 'f2d3a97dfcb9fd757b2f39ec184bce3f5dcb3595', class: "flip-animation" }, h("div", { key: '89a98223c60317d2b9449029ba393c75bec154b3', class: "id-card-icon" }), h("div", { key: '507f6f1b7f38082772bbac2fc28046618161c69b', class: "flip-text" }, "\u00A1Voltea tu identificaci\u00F3n!"))), this.showSuccessAnimation && (h("div", { key: '9010d5be6684759b5d99c58ee65b0a7ebe82b9cb', class: "success-animation" }, h("div", { key: '454c39a5c0d457418b8abdc6e63b1c8a249a118f', class: "check-icon" }), h("div", { key: '502e55f1496f7d8cde9178c416bd9db4cf0491eb', class: "success-text" }, "\u00A1Proceso completado!"))), this.isLoading && (h("div", { key: 'e4d6b7c5ebc8da42689150195dd837e77e152ea3', class: "loading-overlay" }, h("div", { key: '7cc39dbbe94e0730c47829291b83717476517f7f', class: "loading-spinner" }), h("div", { key: '4c1afe04fc7a627c9a57c2f7b851ce62f9305676', class: "loading-text" }, this.statusMessage))), this.debug && (h("div", { key: '8745c4603b35003bff859657c86c713b7f58e204', class: "status-bar" }, h("div", { key: 'e098f2402d58d1808052e3d213f851e66db69ee4', class: "status-message", style: { 'color': this.statusColor } }, this.statusMessage))), h("div", { key: 'af4e07b405af5b1786009b0e9ecf72551753de28', class: "watermark" }, h("img", { key: '25f4b80f13528617007aad160c855c4fff0c8af5', src: "https://storage.googleapis.com/jaak-static/commons/powered-by-jaak.png", alt: "Powered by Jaak" })))));
1670
+ }, type: "button" }, h("span", { class: "camera-label" }, camera.label || `Cámara ${this.availableCameras.indexOf(camera) + 1}`), this.selectedCameraId === camera.deviceId && (h("span", { class: "selected-indicator" }, "\u2713")))))), h("div", { key: 'd6d691cc499a35f40e348cf61d8f81a380e6fe98', class: "device-info" }, h("small", { key: 'ed38304b9dcac5b99d7b32f5733c59b335433f61' }, "Dispositivo: ", this.deviceType)))))), this.isCapturing && (h("div", { key: 'ad19c6c3a2cb761a67b80e52761b2b9cb14d251d', class: "capture-animation" })), this.showFlipAnimation && (h("div", { key: '480615ac9b8ceb5cfc2d821d5777b213c2e86d83', class: "flip-animation" }, h("div", { key: '45e74e5ef254bce75f51d2d12a5961722fb0af03', class: "id-card-icon" }), h("div", { key: '38b9274a67fa8cf1f83bd4b06a3d4ef3d03cdb14', class: "flip-text" }, "\u00A1Voltea tu identificaci\u00F3n!"))), this.showSuccessAnimation && (h("div", { key: 'a6344502e3bbbe298dfb509b41354a54038826aa', class: "success-animation" }, h("div", { key: '579f89d7c8d0ff76e42af611286d96a35d3dbfb9', class: "check-icon" }), h("div", { key: '5bb5c155c70f4bf7a04a62d10142e413763fa1fa', class: "success-text" }, "\u00A1Proceso completado!"))), this.isLoading && (h("div", { key: '664113d7266be3c4171291faede143e736efadf0', class: "loading-overlay" }, h("div", { key: 'b699ad30f1784e1a92657391c080b91e017f7420', class: "loading-spinner" }), h("div", { key: '287f8e13229e4d14de31b0c5ad7d89a202eca5f9', class: "loading-text" }, this.statusMessage))), this.debug && (h("div", { key: 'ba649b0414153cb28b2c6e3c5451b324a990ec63', class: "status-bar" }, h("div", { key: '55b11462af7ef04d293757e2e45344f9206352ac', class: "status-message", style: { 'color': this.statusColor } }, this.statusMessage))), h("div", { key: '3b24a505519d8b483fad2b2f66ef8159d458e1b4', class: "watermark" }, h("img", { key: 'd61f9366631661835e1dd9500500c2b7a7334581', src: "https://storage.googleapis.com/jaak-static/commons/powered-by-jaak.png", alt: "Powered by Jaak" })))));
1554
1671
  }
1555
1672
  static get style() { return myComponentCss; }
1556
1673
  }, [1, "jaak-stamps", {