@jaak.ai/stamps 2.0.0-dev.29 → 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.
- package/dist/cjs/jaak-stamps.cjs.entry.js +35 -5
- package/dist/cjs/jaak-stamps.cjs.entry.js.map +1 -1
- package/dist/cjs/jaak-stamps.entry.cjs.js.map +1 -1
- package/dist/collection/components/my-component/my-component.js +35 -5
- package/dist/collection/components/my-component/my-component.js.map +1 -1
- package/dist/components/jaak-stamps.js +35 -5
- package/dist/components/jaak-stamps.js.map +1 -1
- package/dist/esm/jaak-stamps.entry.js +35 -5
- package/dist/esm/jaak-stamps.entry.js.map +1 -1
- package/dist/jaak-stamps-webcomponent/jaak-stamps-webcomponent.esm.js +1 -1
- package/dist/jaak-stamps-webcomponent/jaak-stamps.entry.esm.js.map +1 -1
- package/dist/jaak-stamps-webcomponent/{p-28adb830.entry.js → p-b62b53f8.entry.js} +2 -2
- package/dist/jaak-stamps-webcomponent/p-b62b53f8.entry.js.map +1 -0
- package/dist/types/components/my-component/my-component.d.ts +1 -0
- package/package.json +1 -1
- package/dist/jaak-stamps-webcomponent/p-28adb830.entry.js.map +0 -1
|
@@ -71,7 +71,7 @@ const JaakStamps = class {
|
|
|
71
71
|
preprocessCtx;
|
|
72
72
|
captureCanvas;
|
|
73
73
|
captureCtx;
|
|
74
|
-
MODEL_PATH = "https://storage.googleapis.com/jaak-static/web/component/stamps/ddmyp-
|
|
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;
|
|
@@ -988,7 +988,37 @@ const JaakStamps = class {
|
|
|
988
988
|
B.push(data[i + 2] / 255);
|
|
989
989
|
}
|
|
990
990
|
const transposedData = new Float32Array(R.concat(G, B));
|
|
991
|
-
|
|
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);
|
|
992
1022
|
}
|
|
993
1023
|
getDeviceMemoryInfo() {
|
|
994
1024
|
const nav = navigator;
|
|
@@ -1624,7 +1654,7 @@ const JaakStamps = class {
|
|
|
1624
1654
|
this.cleanup();
|
|
1625
1655
|
}
|
|
1626
1656
|
render() {
|
|
1627
|
-
return (index.h("div", { key: '
|
|
1657
|
+
return (index.h("div", { key: 'a09694bc3b5f78bc792ea101d470ada1a438a57b', class: "detector-container" }, index.h("div", { key: 'c673c10d3311a44479d4462f3efbb4b6257ec6a9', class: "video-container" }, index.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' } }), index.h("canvas", { key: 'bdc04a389f6b956f7ca138d9fe74db38a6c8812c', ref: el => this.canvasRef = el, class: this.shouldMirrorVideo ? 'mirror' : '' }), this.isMaskReady && (index.h("div", { key: '317156579b40924a7bb96c89dd247713f87f1aa9', class: "overlay-mask" }, index.h("div", { key: '71cfc3c3bbfdae49f05fd563e14f56181440fafa', class: "card-outline" }, index.h("div", { key: '3f940eeb59d783f47e2e2651ccf1a7be19f1d8b9', class: "side side-top" }), index.h("div", { key: 'f07e54e9542811897191e9a9a08f91b9e4785cc6', class: "side side-right" }), index.h("div", { key: '5b6a323213ddff52071b3469068cba0b31930ea0', class: "side side-bottom" }), index.h("div", { key: '44cf6567819855ab915fcee51cec7d08cb8654a8', class: "side side-left" }), index.h("div", { key: '8f866542b2d1a399418d1c8cb58ea856d5f3b9e7', class: "corner corner-tl" }), index.h("div", { key: 'a6567d410c755553d4be5b77dfc965e63b4ef07f', class: "corner corner-tr" }), index.h("div", { key: '255636461627f2deb61c9feacda3c9379abaaf29', class: "corner corner-bl" }), index.h("div", { key: 'dd029757b1ccc49c44bedee12c19b9485ef16545', class: "corner corner-br" }), !this.showFlipAnimation && !this.showSuccessAnimation && (index.h("div", { key: '37aef58019835eac5883042554c648b89cd305ac', class: "guide-text" }, this.statusMessage))), this.captureStep === 'back' && !this.showFlipAnimation && !this.showSuccessAnimation && (index.h("button", { key: '541f6d35d0655093f767423fc6851b521a5b43cd', class: "skip-button", onClick: () => this.skipBackCapture(), type: "button" }, "Saltar reverso")), this.isVideoActive && (index.h("div", { key: '73f2232b7c79f8b935cc78f2e5de1f064e4a3472', class: "camera-controls" }, this.isMultipleCamerasAvailable && (index.h("button", { key: '3c176f9848dc4bf3b7144e2d68225562ae3780c0', class: "flip-camera-button", onClick: () => this.flipCamera(), type: "button", title: "Cambiar c\u00E1mara" }, "Girar c\u00E1mara")), index.h("button", { key: '9460ad4c42872324141ab19b516e7fa026afdd37', class: "camera-selector-button", onClick: () => this.toggleCameraSelector(), type: "button", title: "Seleccionar c\u00E1mara" }, "C\u00E1maras"), this.debug && (index.h("div", { key: '961d825eaba6077189f32193d527fe98a6d4e1e1', style: {
|
|
1628
1658
|
position: 'absolute',
|
|
1629
1659
|
top: '50px',
|
|
1630
1660
|
right: '0',
|
|
@@ -1634,10 +1664,10 @@ const JaakStamps = class {
|
|
|
1634
1664
|
fontSize: '10px',
|
|
1635
1665
|
borderRadius: '4px',
|
|
1636
1666
|
whiteSpace: 'nowrap'
|
|
1637
|
-
} }, "C\u00E1maras: ", this.availableCameras.length, index.h("br", { key: '
|
|
1667
|
+
} }, "C\u00E1maras: ", this.availableCameras.length, index.h("br", { key: 'f7e12d21177478d03f6df0490dfc91df12bd1225' }), "M\u00FAltiples: ", this.isMultipleCamerasAvailable ? 'Sí' : 'No', index.h("br", { key: '1f1cc8cf92e10b9b902fd981875621fa8dbe70f2' }), "Selector: ", this.showCameraSelector ? 'Visible' : 'Oculto', index.h("br", { key: 'c119c6567b28fc33e99b59f76e53e9359491ab77' }), "Video: ", this.isVideoActive ? 'Activo' : 'Inactivo')))), this.showCameraSelector && this.availableCameras.length > 0 && (index.h("div", { key: 'c230990e87f3b6133263c42fc1b568c0caf076e2', class: "camera-selector-dropdown" }, index.h("div", { key: '44c224e93c5832eea498e756a446e12ce8255e61', class: "camera-selector-header" }, index.h("span", { key: '64d951db4843164378424f2d8d2ed2802eb35170' }, "Seleccionar C\u00E1mara"), index.h("button", { key: '0575a7d0a9a99d665d42c6a7f7d8ceff53da9bd2', class: "close-selector", onClick: () => this.toggleCameraSelector(), type: "button" }, "\u00D7")), index.h("div", { key: '4aceed8bcf821710af343611f1b31efdfe61438e', class: "camera-list" }, this.availableCameras.map((camera) => (index.h("button", { key: camera.deviceId, class: `camera-option ${this.selectedCameraId === camera.deviceId ? 'selected' : ''}`, onClick: () => {
|
|
1638
1668
|
this.switchCamera(camera.deviceId);
|
|
1639
1669
|
this.toggleCameraSelector();
|
|
1640
|
-
}, type: "button" }, index.h("span", { class: "camera-label" }, camera.label || `Cámara ${this.availableCameras.indexOf(camera) + 1}`), this.selectedCameraId === camera.deviceId && (index.h("span", { class: "selected-indicator" }, "\u2713")))))), index.h("div", { key: '
|
|
1670
|
+
}, type: "button" }, index.h("span", { class: "camera-label" }, camera.label || `Cámara ${this.availableCameras.indexOf(camera) + 1}`), this.selectedCameraId === camera.deviceId && (index.h("span", { class: "selected-indicator" }, "\u2713")))))), index.h("div", { key: 'd6d691cc499a35f40e348cf61d8f81a380e6fe98', class: "device-info" }, index.h("small", { key: 'ed38304b9dcac5b99d7b32f5733c59b335433f61' }, "Dispositivo: ", this.deviceType)))))), this.isCapturing && (index.h("div", { key: 'ad19c6c3a2cb761a67b80e52761b2b9cb14d251d', class: "capture-animation" })), this.showFlipAnimation && (index.h("div", { key: '480615ac9b8ceb5cfc2d821d5777b213c2e86d83', class: "flip-animation" }, index.h("div", { key: '45e74e5ef254bce75f51d2d12a5961722fb0af03', class: "id-card-icon" }), index.h("div", { key: '38b9274a67fa8cf1f83bd4b06a3d4ef3d03cdb14', class: "flip-text" }, "\u00A1Voltea tu identificaci\u00F3n!"))), this.showSuccessAnimation && (index.h("div", { key: 'a6344502e3bbbe298dfb509b41354a54038826aa', class: "success-animation" }, index.h("div", { key: '579f89d7c8d0ff76e42af611286d96a35d3dbfb9', class: "check-icon" }), index.h("div", { key: '5bb5c155c70f4bf7a04a62d10142e413763fa1fa', class: "success-text" }, "\u00A1Proceso completado!"))), this.isLoading && (index.h("div", { key: '664113d7266be3c4171291faede143e736efadf0', class: "loading-overlay" }, index.h("div", { key: 'b699ad30f1784e1a92657391c080b91e017f7420', class: "loading-spinner" }), index.h("div", { key: '287f8e13229e4d14de31b0c5ad7d89a202eca5f9', class: "loading-text" }, this.statusMessage))), this.debug && (index.h("div", { key: 'ba649b0414153cb28b2c6e3c5451b324a990ec63', class: "status-bar" }, index.h("div", { key: '55b11462af7ef04d293757e2e45344f9206352ac', class: "status-message", style: { 'color': this.statusColor } }, this.statusMessage))), index.h("div", { key: '3b24a505519d8b483fad2b2f66ef8159d458e1b4', class: "watermark" }, index.h("img", { key: 'd61f9366631661835e1dd9500500c2b7a7334581', src: "https://storage.googleapis.com/jaak-static/commons/powered-by-jaak.png", alt: "Powered by Jaak" })))));
|
|
1641
1671
|
}
|
|
1642
1672
|
};
|
|
1643
1673
|
JaakStamps.style = myComponentCss;
|