alphavalid-sdk 0.1.0 → 0.1.1
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/bin/alphavalid.js +28 -0
- package/dist/alphavalid.es.js +2 -2
- package/dist/alphavalid.umd.js +1 -1
- package/dist/index.d.ts.map +1 -1
- package/package.json +1 -1
package/bin/alphavalid.js
CHANGED
|
@@ -30,6 +30,34 @@ function copyModels() {
|
|
|
30
30
|
console.log(`[AlphaValid] Models copiados para ${dest}`);
|
|
31
31
|
}
|
|
32
32
|
|
|
33
|
+
// Após copiar os models, também copie o GIF de loader para um caminho padrão
|
|
34
|
+
// que funcione bem em Angular (src/assets/images) e Vite (public/images).
|
|
35
|
+
try {
|
|
36
|
+
const projectRoot = process.cwd();
|
|
37
|
+
const sdkRoot = path.join(__dirname, '..');
|
|
38
|
+
const loaderSrc = path.join(sdkRoot, 'demo', 'public', 'images', 'alphaloader.gif');
|
|
39
|
+
|
|
40
|
+
if (fs.existsSync(loaderSrc)) {
|
|
41
|
+
// Angular: src/assets/images
|
|
42
|
+
const angularImages = path.join(projectRoot, 'src', 'assets', 'images');
|
|
43
|
+
if (fs.existsSync(path.join(projectRoot, 'angular.json'))) {
|
|
44
|
+
fs.mkdirSync(angularImages, { recursive: true });
|
|
45
|
+
fs.copyFileSync(loaderSrc, path.join(angularImages, 'alphaloader.gif'));
|
|
46
|
+
console.log('[AlphaValid] Loader GIF copiado para', angularImages);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
// Vite / SPA genérica: public/images
|
|
50
|
+
const viteImages = path.join(projectRoot, 'public', 'images');
|
|
51
|
+
if (fs.existsSync(path.join(projectRoot, 'vite.config.js')) || fs.existsSync(path.join(projectRoot, 'vite.config.ts')) || fs.existsSync(path.join(projectRoot, 'index.html'))) {
|
|
52
|
+
fs.mkdirSync(viteImages, { recursive: true });
|
|
53
|
+
fs.copyFileSync(loaderSrc, path.join(viteImages, 'alphaloader.gif'));
|
|
54
|
+
console.log('[AlphaValid] Loader GIF copiado para', viteImages);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
} catch (e) {
|
|
58
|
+
// silencioso: se falhar, o app pode configurar loader.src manualmente
|
|
59
|
+
}
|
|
60
|
+
|
|
33
61
|
try {
|
|
34
62
|
copyModels();
|
|
35
63
|
} catch (e) {
|
package/dist/alphavalid.es.js
CHANGED
|
@@ -19451,13 +19451,13 @@ var R_ = class {
|
|
|
19451
19451
|
uiMode: "Mobile",
|
|
19452
19452
|
guideCircleRatio: .72,
|
|
19453
19453
|
detectionIntervalMs: 50,
|
|
19454
|
-
modelsPath: "/alphavalid-models",
|
|
19454
|
+
modelsPath: "/assets/alphavalid-models",
|
|
19455
19455
|
userPreview: !0,
|
|
19456
19456
|
previewOkText: "OK",
|
|
19457
19457
|
previewRetakeText: "Tirar outra",
|
|
19458
19458
|
loader: {
|
|
19459
19459
|
enabled: !0,
|
|
19460
|
-
src: "/images/alphaloader.gif",
|
|
19460
|
+
src: "/assets/images/alphaloader.gif",
|
|
19461
19461
|
sizePx: 120,
|
|
19462
19462
|
minVisibleMs: 900
|
|
19463
19463
|
},
|
package/dist/alphavalid.umd.js
CHANGED
|
@@ -3841,7 +3841,7 @@ Expected: `+l+`.`)}}function cp(e,t,n){return!isFinite(e)&&!isFinite(t)||!(isNaN
|
|
|
3841
3841
|
.alphavalid-userPreview .alphavalid-userPreview-meta { font-size: 0.95rem; }
|
|
3842
3842
|
}
|
|
3843
3843
|
|
|
3844
|
-
`,document.head.appendChild(e)}if(e)try{e.classList.add(`alphavalid-root`)}catch{}}}var G_=l({setupModels:()=>K_});async function K_(){function e(){return q_.default.existsSync(`angular.json`)?`angular`:q_.default.existsSync(`vite.config.js`)||q_.default.existsSync(`vite.config.ts`)||q_.default.existsSync(`index.html`)||q_.default.existsSync(`public`)?`vite`:`unknown`}function t(){let t=e();return t===`angular`?J_.default.join(`src`,`assets`,`alphavalid-models`):t===`vite`?J_.default.join(`public`,`alphavalid-models`):J_.default.join(`alphavalid-models`)}let n=J_.default.join(__dirname,`../models`),r=J_.default.resolve(process.cwd(),t());if(!q_.default.existsSync(n))throw Error(`[AlphaValid] Pasta de models não encontrada: `+n);q_.default.mkdirSync(r,{recursive:!0});for(let e of q_.default.readdirSync(n))q_.default.copyFileSync(J_.default.join(n,e),J_.default.join(r,e));return`[AlphaValid] Models copiados para ${r}`}var q_,J_,Y_=s((()=>{q_=d(x()),J_=d(x())})),X_=[`/assets/alphavalid-models`,`/alphavalid-models`],Z_=`cameraContainer`;async function Q_(e){for(let t of[`face_landmark_68_tiny_model-weights_manifest.json`,`face_landmark_68_tiny_model-shard1.bin`,`tiny_face_detector_model-weights_manifest.json`,`tiny_face_detector_model-shard1.bin`])try{if(!(await fetch(`${e}/${t}`,{method:`HEAD`})).ok)throw Error()}catch{throw Error(`\n[AlphaValid] Models não encontrados.\n\nExecute automaticamente:\nnpx alphavalid-sdk setup\n\nOu configure manualmente:\nmodelsPath: '${e}'\n`)}return e}async function $_(){let{setupModels:e}=await Promise.resolve().then(()=>(Y_(),G_));return e()}e.AlphaValid=class{_camera=null;_overlay=null;_container=null;_faceDetector=j_();_loopTimer=null;_lastStatusValid=!1;_options=null;_status=`idle`;_challengeIndex=0;_challengeStartedAt=null;_challengeEnterAt=null;_challengeCompletedAt=null;_challengeBaselineSeen=!1;_blinkArmed=!1;_state=null;_stableSince=null;_lastStableCx=null;_lastStableCy=null;_lastStableArea=null;_autoCaptureFired=!1;_lastGoodStatus=null;_lastGoodAt=0;_lastStatusForCaptureGate=null;_lastLookForwardGateOk=null;_forcedHintMessage=null;_poseLatch={left:0,right:0,up:0,down:0,at:0};_lastPoseChallenge=null;_mouthJawBaseline=null;_faceLostAt=null;_lookForwardOkSince=null;_blinkCount=0;_blinkPrevClosed=!1;_cheeseBaseline=null;_cheeseBaselineSamples=0;_cheeseBaselineSum=0;_cheeseBaselineStartedAt=null;_challengeHoldSince=null;_challengeLastStepOk=!1;_challengeHoldProgress=0;_challengeUiProgress=0;_startOptions=null;_previewBlob=null;_previewActions=null;_cheeseWindow=[];_cheeseWindowStart=null;_openMouthWindow=[];_openMouthWindowStart=null;_lifecycle=`idle`;_loopActive=!1;_debug=!1;_isCapturing=!1;_userPreviewUi=null;_userPreviewUrl=null;_loader=null;_captureBtn=null;_disposeCaptureButton(){try{this._captureBtn?.dispose()}catch{}this._captureBtn=null}_syncCaptureButton(e){let t=this._options;if(!t||!this._container)return;let n=t.uiMode===`Mobile`,r=t.captureButton?.enabled!==!1,i=t.autoCapture?.enabled===!0;if(!(n&&r&&!i)){this._captureBtn&&this._disposeCaptureButton();return}this._captureBtn||=U_({container:this._container,text:t.captureButton?.text??`Capturar imagem`,color:t.captureButton?.color??`#00bcd4`,onClick:()=>{this.capture().catch(()=>{})}});let a=e??this._state;if(this._lifecycle===`preview`){this._captureBtn.hide();return}let o=a?.challenge?.enabled?a.challenge.completed===!0:!0;this._lifecycle===`running`&&o?this._captureBtn.show():this._captureBtn.hide();let s=a?.isReadyToCapture===!0&&(a?.challenge?.enabled?a.challenge.completed===!0:!0),c=this._options?.requireLookForwardForCapture===!0,l=this._lastStatusForCaptureGate??this._lastGoodStatus??{},u=c?this._isLookForwardForCapture(l,{requireLf:c}):!0;c&&s&&!u?this._forcedHintMessage=`olhe para a camera`:this._forcedHintMessage=null,this._captureBtn.setEnabled(s&&u)}_setLifecycle(e){this._debug&&console.log(`[AlphaValid] lifecycle ${this._lifecycle} → ${e}`),this._lifecycle=e}async _pause(){if(this._lifecycle===`running`){this._loopTimer!=null&&(window.clearTimeout(this._loopTimer),this._loopTimer=null);try{this._camera?.video?.pause()}catch{}this._loopActive=!1,this._setLifecycle(`paused`)}}async _retakeFromPreview(){this._debug&&console.log(`[AlphaValid] preview action: retake()`,{lifecycle:this._lifecycle,hasCamera:!!this._camera,hasOptions:!!this._options,hasStartOptions:!!this._startOptions}),this._previewBlob=null,this._previewActions=null,this._hideUserPreviewUi();let e=this._startOptions;if(!e){this._debug&&console.warn(`[AlphaValid] retake ignored: missing _startOptions (cannot restart)`);return}try{await this.stop(),await this.start(e)}catch(e){throw this._debug&&console.error(`[AlphaValid] retake failed`,e),e}}async _confirmFromPreview(){if(this._debug&&console.log(`[AlphaValid] preview action: confirm()`,{lifecycle:this._lifecycle,hasBlob:!!this._previewBlob}),this._lifecycle!==`preview`){this._debug&&console.warn(`[AlphaValid] confirm ignored: not in preview`,{lifecycle:this._lifecycle});return}let e=this._previewBlob;if(e){if(this._options?.userPreview&&this._options?.uiMode===`Mobile`)try{this._options?.onUserPreviewConfirm?.(e)}catch{}else this._options?.autoCapture?.onCapture?.(e),this._options?.onCapture?.(e);this._hideUserPreviewUi(),this._previewBlob=null,this._previewActions=null,await this.stop()}}_hideUserPreviewUi(){try{this._userPreviewUi?.hide()}catch{}if(this._userPreviewUrl){try{URL.revokeObjectURL(this._userPreviewUrl)}catch{}this._userPreviewUrl=null}}_disposeUserPreviewUi(){this._hideUserPreviewUi();try{this._userPreviewUi?.dispose()}catch{}this._userPreviewUi=null}async _showPreview(e){if(this._debug&&console.log(`[AlphaValid] entering preview`,{lifecycle:this._lifecycle,blobSize:e?.size}),this._lifecycle!==`paused`&&this._lifecycle!==`preview`){this._debug&&console.warn(`[AlphaValid] _showPreview ignored due to lifecycle`,{lifecycle:this._lifecycle});return}this._setLifecycle(`preview`),this._previewBlob=e,this._previewActions={retake:()=>{this._debug&&console.log(`[AlphaValid] preview action clicked: retake`),this._retakeFromPreview()},confirm:()=>{this._debug&&console.log(`[AlphaValid] preview action clicked: confirm`),this._confirmFromPreview()}};let t=this._options;if(t?.userPreview&&t?.uiMode===`Mobile`&&this._container&&t){if(this._userPreviewUi||=R_({container:this._container,labels:z_(t),onOk:()=>this._previewActions?.confirm(),onRetake:()=>this._previewActions?.retake()}),this._userPreviewUrl)try{URL.revokeObjectURL(this._userPreviewUrl)}catch{}this._userPreviewUrl=URL.createObjectURL(e);let n=`preview: ${(e.size/1024).toFixed(1)} KB · ${new Date().toLocaleTimeString()}`;this._userPreviewUi.show(this._userPreviewUrl,n);return}t?.onPreview?.(e,this._previewActions)}_setVideoVisibility(e){let t=this._camera?.video;if(t)try{e?(t.style.visibility=`visible`,t.style.opacity=`1`,t.style.pointerEvents=`auto`):(t.style.visibility=`hidden`,t.style.opacity=`0`,t.style.pointerEvents=`none`),t.style.transition||(t.style.transition=`opacity 160ms ease`)}catch{}}async start(e){if(this._lifecycle===`running`||this._lifecycle===`preview`)return;this._debug=typeof e.debug==`boolean`?e.debug:!!e.debug?.enabled;let t=e.container??document.getElementById(Z_);if(!t)throw Error(`[AlphaValid] Container nao encontrado. Informe options.container ou crie <div id="${Z_}"></div>.`);f(t,`options.container`);let n=e.liveness;if(e.livenessPreset){let t=e.livenessPreset,r={};t===`normal`||(t===`easy`?(r.strictness=.3,r.lookForwardTolerance=.85,r.lookForwardYawTol=.1,r.lookSideTol=.08,r.lookUpDownTol=.16,r.poseProgressAccept=.55):t===`strict`&&(r.strictness=.8,r.lookForwardTolerance=.6,r.lookForwardYawTol=.04,r.lookSideTol=.03,r.lookUpDownTol=.08,r.poseProgressAccept=.8,r.lookForwardHoldMs=1200,r.challengeMinHoldMs=220)),n={...r,...e.liveness}}let r={...e,container:t,liveness:n};this._startOptions=r,await this.stop(),this._blinkCount=0,this._blinkPrevClosed=!1,this._options={overlay:!0,uiMode:`Mobile`,guideCircleRatio:.72,detectionIntervalMs:50,modelsPath:`/alphavalid-models`,userPreview:!0,previewOkText:`OK`,previewRetakeText:`Tirar outra`,loader:{enabled:!0,src:`/images/alphaloader.gif`,sizePx:120,minVisibleMs:900},captureButton:{enabled:!0,text:`Capturar imagem`,color:`#00bcd4`},requireLookForwardForCapture:!0,...r};let i=this._options;this._container=t;let a=t;if(!a)throw Error(`[AlphaValid] Container nao encontrado apos inicializacao.`);try{W_(a)}catch{}i.loader?.enabled!==!1&&(this._loader?.dispose(),this._loader=V_(a,i.loader),this._loader.show()),this._disposeCaptureButton(),this._status=`initializing`,i.onStateChange?.({status:this._status,feedback:{code:`INITIALIZING`,message:`Inicializando câmera...`},message:`Inicializando câmera...`,isReadyToCapture:!1,challenge:{enabled:!1,index:0,total:0,completed:!1}});try{i.onFeedback?.({code:`INITIALIZING`,message:`Inicializando câmera...`}),this._camera=await m(a),this._setVideoVisibility(!1),i.uiMode!==`headless`&&i.overlay!==!1&&(i.uiMode===`Mobile`?this._overlay=I_(a):this._overlay=b(a,i.guideCircleRatio));let t=i.modelsPath;if(t)await Q_(t);else{for(let n of X_)try{await Q_(n),t=n,e.debug&&console.log(`[AlphaValid] Models encontrados em: ${n}`);break}catch{}if(!t)throw Error(`
|
|
3844
|
+
`,document.head.appendChild(e)}if(e)try{e.classList.add(`alphavalid-root`)}catch{}}}var G_=l({setupModels:()=>K_});async function K_(){function e(){return q_.default.existsSync(`angular.json`)?`angular`:q_.default.existsSync(`vite.config.js`)||q_.default.existsSync(`vite.config.ts`)||q_.default.existsSync(`index.html`)||q_.default.existsSync(`public`)?`vite`:`unknown`}function t(){let t=e();return t===`angular`?J_.default.join(`src`,`assets`,`alphavalid-models`):t===`vite`?J_.default.join(`public`,`alphavalid-models`):J_.default.join(`alphavalid-models`)}let n=J_.default.join(__dirname,`../models`),r=J_.default.resolve(process.cwd(),t());if(!q_.default.existsSync(n))throw Error(`[AlphaValid] Pasta de models não encontrada: `+n);q_.default.mkdirSync(r,{recursive:!0});for(let e of q_.default.readdirSync(n))q_.default.copyFileSync(J_.default.join(n,e),J_.default.join(r,e));return`[AlphaValid] Models copiados para ${r}`}var q_,J_,Y_=s((()=>{q_=d(x()),J_=d(x())})),X_=[`/assets/alphavalid-models`,`/alphavalid-models`],Z_=`cameraContainer`;async function Q_(e){for(let t of[`face_landmark_68_tiny_model-weights_manifest.json`,`face_landmark_68_tiny_model-shard1.bin`,`tiny_face_detector_model-weights_manifest.json`,`tiny_face_detector_model-shard1.bin`])try{if(!(await fetch(`${e}/${t}`,{method:`HEAD`})).ok)throw Error()}catch{throw Error(`\n[AlphaValid] Models não encontrados.\n\nExecute automaticamente:\nnpx alphavalid-sdk setup\n\nOu configure manualmente:\nmodelsPath: '${e}'\n`)}return e}async function $_(){let{setupModels:e}=await Promise.resolve().then(()=>(Y_(),G_));return e()}e.AlphaValid=class{_camera=null;_overlay=null;_container=null;_faceDetector=j_();_loopTimer=null;_lastStatusValid=!1;_options=null;_status=`idle`;_challengeIndex=0;_challengeStartedAt=null;_challengeEnterAt=null;_challengeCompletedAt=null;_challengeBaselineSeen=!1;_blinkArmed=!1;_state=null;_stableSince=null;_lastStableCx=null;_lastStableCy=null;_lastStableArea=null;_autoCaptureFired=!1;_lastGoodStatus=null;_lastGoodAt=0;_lastStatusForCaptureGate=null;_lastLookForwardGateOk=null;_forcedHintMessage=null;_poseLatch={left:0,right:0,up:0,down:0,at:0};_lastPoseChallenge=null;_mouthJawBaseline=null;_faceLostAt=null;_lookForwardOkSince=null;_blinkCount=0;_blinkPrevClosed=!1;_cheeseBaseline=null;_cheeseBaselineSamples=0;_cheeseBaselineSum=0;_cheeseBaselineStartedAt=null;_challengeHoldSince=null;_challengeLastStepOk=!1;_challengeHoldProgress=0;_challengeUiProgress=0;_startOptions=null;_previewBlob=null;_previewActions=null;_cheeseWindow=[];_cheeseWindowStart=null;_openMouthWindow=[];_openMouthWindowStart=null;_lifecycle=`idle`;_loopActive=!1;_debug=!1;_isCapturing=!1;_userPreviewUi=null;_userPreviewUrl=null;_loader=null;_captureBtn=null;_disposeCaptureButton(){try{this._captureBtn?.dispose()}catch{}this._captureBtn=null}_syncCaptureButton(e){let t=this._options;if(!t||!this._container)return;let n=t.uiMode===`Mobile`,r=t.captureButton?.enabled!==!1,i=t.autoCapture?.enabled===!0;if(!(n&&r&&!i)){this._captureBtn&&this._disposeCaptureButton();return}this._captureBtn||=U_({container:this._container,text:t.captureButton?.text??`Capturar imagem`,color:t.captureButton?.color??`#00bcd4`,onClick:()=>{this.capture().catch(()=>{})}});let a=e??this._state;if(this._lifecycle===`preview`){this._captureBtn.hide();return}let o=a?.challenge?.enabled?a.challenge.completed===!0:!0;this._lifecycle===`running`&&o?this._captureBtn.show():this._captureBtn.hide();let s=a?.isReadyToCapture===!0&&(a?.challenge?.enabled?a.challenge.completed===!0:!0),c=this._options?.requireLookForwardForCapture===!0,l=this._lastStatusForCaptureGate??this._lastGoodStatus??{},u=c?this._isLookForwardForCapture(l,{requireLf:c}):!0;c&&s&&!u?this._forcedHintMessage=`olhe para a camera`:this._forcedHintMessage=null,this._captureBtn.setEnabled(s&&u)}_setLifecycle(e){this._debug&&console.log(`[AlphaValid] lifecycle ${this._lifecycle} → ${e}`),this._lifecycle=e}async _pause(){if(this._lifecycle===`running`){this._loopTimer!=null&&(window.clearTimeout(this._loopTimer),this._loopTimer=null);try{this._camera?.video?.pause()}catch{}this._loopActive=!1,this._setLifecycle(`paused`)}}async _retakeFromPreview(){this._debug&&console.log(`[AlphaValid] preview action: retake()`,{lifecycle:this._lifecycle,hasCamera:!!this._camera,hasOptions:!!this._options,hasStartOptions:!!this._startOptions}),this._previewBlob=null,this._previewActions=null,this._hideUserPreviewUi();let e=this._startOptions;if(!e){this._debug&&console.warn(`[AlphaValid] retake ignored: missing _startOptions (cannot restart)`);return}try{await this.stop(),await this.start(e)}catch(e){throw this._debug&&console.error(`[AlphaValid] retake failed`,e),e}}async _confirmFromPreview(){if(this._debug&&console.log(`[AlphaValid] preview action: confirm()`,{lifecycle:this._lifecycle,hasBlob:!!this._previewBlob}),this._lifecycle!==`preview`){this._debug&&console.warn(`[AlphaValid] confirm ignored: not in preview`,{lifecycle:this._lifecycle});return}let e=this._previewBlob;if(e){if(this._options?.userPreview&&this._options?.uiMode===`Mobile`)try{this._options?.onUserPreviewConfirm?.(e)}catch{}else this._options?.autoCapture?.onCapture?.(e),this._options?.onCapture?.(e);this._hideUserPreviewUi(),this._previewBlob=null,this._previewActions=null,await this.stop()}}_hideUserPreviewUi(){try{this._userPreviewUi?.hide()}catch{}if(this._userPreviewUrl){try{URL.revokeObjectURL(this._userPreviewUrl)}catch{}this._userPreviewUrl=null}}_disposeUserPreviewUi(){this._hideUserPreviewUi();try{this._userPreviewUi?.dispose()}catch{}this._userPreviewUi=null}async _showPreview(e){if(this._debug&&console.log(`[AlphaValid] entering preview`,{lifecycle:this._lifecycle,blobSize:e?.size}),this._lifecycle!==`paused`&&this._lifecycle!==`preview`){this._debug&&console.warn(`[AlphaValid] _showPreview ignored due to lifecycle`,{lifecycle:this._lifecycle});return}this._setLifecycle(`preview`),this._previewBlob=e,this._previewActions={retake:()=>{this._debug&&console.log(`[AlphaValid] preview action clicked: retake`),this._retakeFromPreview()},confirm:()=>{this._debug&&console.log(`[AlphaValid] preview action clicked: confirm`),this._confirmFromPreview()}};let t=this._options;if(t?.userPreview&&t?.uiMode===`Mobile`&&this._container&&t){if(this._userPreviewUi||=R_({container:this._container,labels:z_(t),onOk:()=>this._previewActions?.confirm(),onRetake:()=>this._previewActions?.retake()}),this._userPreviewUrl)try{URL.revokeObjectURL(this._userPreviewUrl)}catch{}this._userPreviewUrl=URL.createObjectURL(e);let n=`preview: ${(e.size/1024).toFixed(1)} KB · ${new Date().toLocaleTimeString()}`;this._userPreviewUi.show(this._userPreviewUrl,n);return}t?.onPreview?.(e,this._previewActions)}_setVideoVisibility(e){let t=this._camera?.video;if(t)try{e?(t.style.visibility=`visible`,t.style.opacity=`1`,t.style.pointerEvents=`auto`):(t.style.visibility=`hidden`,t.style.opacity=`0`,t.style.pointerEvents=`none`),t.style.transition||(t.style.transition=`opacity 160ms ease`)}catch{}}async start(e){if(this._lifecycle===`running`||this._lifecycle===`preview`)return;this._debug=typeof e.debug==`boolean`?e.debug:!!e.debug?.enabled;let t=e.container??document.getElementById(Z_);if(!t)throw Error(`[AlphaValid] Container nao encontrado. Informe options.container ou crie <div id="${Z_}"></div>.`);f(t,`options.container`);let n=e.liveness;if(e.livenessPreset){let t=e.livenessPreset,r={};t===`normal`||(t===`easy`?(r.strictness=.3,r.lookForwardTolerance=.85,r.lookForwardYawTol=.1,r.lookSideTol=.08,r.lookUpDownTol=.16,r.poseProgressAccept=.55):t===`strict`&&(r.strictness=.8,r.lookForwardTolerance=.6,r.lookForwardYawTol=.04,r.lookSideTol=.03,r.lookUpDownTol=.08,r.poseProgressAccept=.8,r.lookForwardHoldMs=1200,r.challengeMinHoldMs=220)),n={...r,...e.liveness}}let r={...e,container:t,liveness:n};this._startOptions=r,await this.stop(),this._blinkCount=0,this._blinkPrevClosed=!1,this._options={overlay:!0,uiMode:`Mobile`,guideCircleRatio:.72,detectionIntervalMs:50,modelsPath:`/assets/alphavalid-models`,userPreview:!0,previewOkText:`OK`,previewRetakeText:`Tirar outra`,loader:{enabled:!0,src:`/assets/images/alphaloader.gif`,sizePx:120,minVisibleMs:900},captureButton:{enabled:!0,text:`Capturar imagem`,color:`#00bcd4`},requireLookForwardForCapture:!0,...r};let i=this._options;this._container=t;let a=t;if(!a)throw Error(`[AlphaValid] Container nao encontrado apos inicializacao.`);try{W_(a)}catch{}i.loader?.enabled!==!1&&(this._loader?.dispose(),this._loader=V_(a,i.loader),this._loader.show()),this._disposeCaptureButton(),this._status=`initializing`,i.onStateChange?.({status:this._status,feedback:{code:`INITIALIZING`,message:`Inicializando câmera...`},message:`Inicializando câmera...`,isReadyToCapture:!1,challenge:{enabled:!1,index:0,total:0,completed:!1}});try{i.onFeedback?.({code:`INITIALIZING`,message:`Inicializando câmera...`}),this._camera=await m(a),this._setVideoVisibility(!1),i.uiMode!==`headless`&&i.overlay!==!1&&(i.uiMode===`Mobile`?this._overlay=I_(a):this._overlay=b(a,i.guideCircleRatio));let t=i.modelsPath;if(t)await Q_(t);else{for(let n of X_)try{await Q_(n),t=n,e.debug&&console.log(`[AlphaValid] Models encontrados em: ${n}`);break}catch{}if(!t)throw Error(`
|
|
3845
3845
|
[AlphaValid] Models não encontrados.
|
|
3846
3846
|
|
|
3847
3847
|
Execute automaticamente:
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts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