@tsocial/tvweb-sdk 5.38.3 → 5.38.4
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/build/esm/{chunk-804b51ae.js → chunk-0042305b.js} +1 -1
- package/build/esm/{chunk-93ad2e94.js → chunk-0d38d10a.js} +1 -1
- package/build/esm/{chunk-bf273baf.js → chunk-1ffc8702.js} +1 -1
- package/build/esm/{chunk-abc9d931.js → chunk-27713cdc.js} +12 -2
- package/build/esm/chunk-3918125a.js +1 -0
- package/build/esm/{chunk-85504064.js → chunk-4f3a497a.js} +1 -1
- package/build/esm/{chunk-2c071949.js → chunk-4f993a97.js} +1 -1
- package/build/esm/{chunk-5a4684bb.js → chunk-65036591.js} +1 -1
- package/build/esm/{chunk-8eff00f2.js → chunk-67605c5a.js} +1 -1
- package/build/esm/{chunk-b0d9736a.js → chunk-77246947.js} +1 -1
- package/build/esm/{chunk-e1e2700f.js → chunk-788a3d4e.js} +1 -1
- package/build/esm/{chunk-68a33382.js → chunk-89b09e98.js} +1 -1
- package/build/esm/{chunk-5b66da4d.js → chunk-9462231f.js} +1 -1
- package/build/esm/{chunk-0da5ca80.js → chunk-9803c4f4.js} +1 -1
- package/build/esm/{chunk-6633ffde.js → chunk-99078e42.js} +1 -1
- package/build/esm/{chunk-dbd45d78.js → chunk-b9c073ce.js} +1 -1
- package/build/esm/{chunk-39590709.js → chunk-c385606a.js} +1 -1
- package/build/esm/{chunk-776149f4.js → chunk-cc109f43.js} +1 -1
- package/build/esm/{chunk-39bd8f09.js → chunk-d311aed8.js} +1 -1
- package/build/esm/{chunk-412186c9.js → chunk-ec2cd6ff.js} +1 -1
- package/build/esm/tvweb-sdk.esm.min.js +1 -1
- package/build/tvweb-sdk.cjs.min.js +12 -2
- package/build/tvweb-sdk.standalone.js +50 -37
- package/build/tvweb-sdk.standalone.min.js +12 -2
- package/package.json +5 -5
- package/build/esm/chunk-05fa8f5c.js +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{Y as r}from"./chunk-27713cdc.js";import{r as o}from"./chunk-67605c5a.js";var s=r(o());export{s as d};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
let e,t;import{n as n,s as a,d as s,r as r,P as i,aa as o,j as l,f as u,c as c,u as f,p as p,g as d}from"./chunk-
|
|
1
|
+
let e,t;import{n as n,s as a,d as s,r as r,P as i,aa as o,j as l,f as u,c as c,u as f,p as p,g as d}from"./chunk-27713cdc.js";import{L as g,C as m,S as h,u as v}from"./chunk-788a3d4e.js";import{W as A}from"./chunk-9803c4f4.js";var C,S,b,y,F,T,E,I,x,_={exports:{}};function M(){if(C)return _.exports;C=1;var e="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||"undefined"!=typeof msCrypto&&"function"==typeof window.msCrypto.getRandomValues&&msCrypto.getRandomValues.bind(msCrypto);if(e){var t=new Uint8Array(16);_.exports=function(){return e(t),t}}else{var n=Array(16);_.exports=function(){for(var e,t=0;t<16;t++)(3&t)==0&&(e=0x100000000*Math.random()),n[t]=e>>>((3&t)<<3)&255;return n}}return _.exports}function D(){if(b)return S;b=1;for(var e=[],t=0;t<256;++t)e[t]=(t+256).toString(16).substr(1);return S=function(t,n){var a=n||0;return""+e[t[a++]]+e[t[a++]]+e[t[a++]]+e[t[a++]]+"-"+e[t[a++]]+e[t[a++]]+"-"+e[t[a++]]+e[t[a++]]+"-"+e[t[a++]]+e[t[a++]]+"-"+e[t[a++]]+e[t[a++]]+e[t[a++]]+e[t[a++]]+e[t[a++]]+e[t[a++]]}}var U=function(){if(x)return I;x=1;var e=function(){if(F)return y;F=1;var e,t,n=M(),a=D(),s=0,r=0;return y=function(i,o,l){var u=o&&l||0,c=o||[],f=(i=i||{}).node||e,p=void 0!==i.clockseq?i.clockseq:t;if(null==f||null==p){var d=n();null==f&&(f=e=[1|d[0],d[1],d[2],d[3],d[4],d[5]]),null==p&&(p=t=(d[6]<<8|d[7])&16383)}var g=void 0!==i.msecs?i.msecs:new Date().getTime(),m=void 0!==i.nsecs?i.nsecs:r+1,h=g-s+(m-r)/1e4;if(h<0&&void 0===i.clockseq&&(p=p+1&16383),(h<0||g>s)&&void 0===i.nsecs&&(m=0),m>=1e4)throw Error("uuid.v1(): Can't create more than 10M uuids/sec");s=g,r=m,t=p;var v=((0xfffffff&(g+=122192928e5))*1e4+m)%0x100000000;c[u++]=v>>>24&255,c[u++]=v>>>16&255,c[u++]=v>>>8&255,c[u++]=255&v;var A=g/0x100000000*1e4&0xfffffff;c[u++]=A>>>8&255,c[u++]=255&A,c[u++]=A>>>24&15|16,c[u++]=A>>>16&255,c[u++]=p>>>8|128,c[u++]=255&p;for(var C=0;C<6;++C)c[u+C]=f[C];return o||a(c)}}(),t=function(){if(E)return T;E=1;var e=M(),t=D();return T=function(n,a,s){var r=a&&s||0;"string"==typeof n&&(a="binary"===n?Array(16):null,n=null);var i=(n=n||{}).random||(n.rng||e)();if(i[6]=15&i[6]|64,i[8]=63&i[8]|128,a)for(var o=0;o<16;++o)a[r+o]=i[o];return a||t(i)}}();return t.v1=e,t.v4=t,I=t}();let k=e=>{let t={};return Object.entries(e).forEach(([e,n])=>{if(n){if("customerUserId"===e){t.cus_user_id=n;return}if("faces"===e){t.faces=n.map(e=>({id:e.id}));return}if("gestureFaces"===e){t.gesture_faces=n.map(e=>({gesture:e.gesture,images:e.images.map(e=>({id:e.id}))}));return}if("videos"===e){t.videos=n;return}t[e.replace(/[A-Z]/g,e=>`_${e.toLowerCase()}`)]=n}}),t},R={enableVerifySanityPortrait:!1,enableVerifyFaceLiveness:!1};function w(e){let{apiCheck:t,mode:i,authType:o,authMethod:g,apiCredentials:m,onDone:h,onError:C,onClose:S,onReset:b,captureFrameSettings:y,onFramesCaptured:F,clientSettings:T,outputEncryptionSettings:E,logCredentials:I,flowId:x,serviceSettings:_,cameraScale:M,offsetFaceY:D,frontalMinSize:w,customTheme:N,livenessDetectionComponent:j,customComponent:V,customTexts:H,extraConfig:L}=e,B=v(),G=r.useMemo(()=>{let e={..._,...R};return u.getEnabledServices(e,B)},[B,_]),{FaceAuthenticationLoading:O}=V,[P,K]=r.useState(!1),{registerFace:W,authenFace:q}=function({apiCredentials:e,authMethod:t,enabledServices:a,authType:i}){let{apiClient:o}=s.useApiClient({apiCredentials:e}),l=r.useCallback(async e=>{let n=e.frontalFaces?.map(e=>({id:e.id}))??[],s=e.steps?.map(e=>({gesture:e.name,images:[{id:e.id}]})),r=[];return{selfieType:t,faces:n,gestureFaces:s,videos:r=a.enableUploadFrames?e.uploadFramesResult??[]:e.capturedFrames??[]}},[t,a.enableUploadFrames]),u=r.useCallback(async({sdkResult:e})=>{let t=await l(e),s=U.v4();t={...t,faceType:"selfie",customerUserId:s};let r=null;if(a.enableRegisterFace){let e=k(t);"success"===n(r=await o.httpClient.post("/v1/face_auth_register",e),"data.status")&&localStorage.setItem("tv:cus-user-id",s)}return{...t,apiResult:r}},[o.httpClient,l,a.enableRegisterFace]);return{registerFace:u,authenFace:r.useCallback(async({sdkResult:e})=>{let t=await l(e),n=localStorage.getItem("tv:cus-user-id");t={...t,customerUserId:n,authType:i};let s=null;if(a.enableAuthenticateFace){let e=k(t);s=await o.httpClient.post("/v1/face_auth",e)}return{...t,apiResult:s}},[o.httpClient,i,l,a.enableAuthenticateFace])}}({apiCredentials:m,authMethod:g,enabledServices:G,authType:o}),{billingSettings:z,enableBilling:Y}=c.useSDKSettings(),Z=f.getWebSetting(B,"data.settings.sdk_settings.billing_settings.billing_config"),$=f.getWebSetting(B,"data.settings.sdk_settings.billing_settings.url"),J=p.buildBillingInput(e),{submitBilling:Q}=d({enable:Y,onError:C,billingSettings:z??{json:Z??{}},billingUrl:$}),X=r.useCallback(e=>{let t={sdkStatus:a.BillingStatus.success,result:p.buildBillingOutput(e)};Q({service:a.BillingService.faceAuth,input:J,output:t}),h&&h(e)},[J,h,Q]),ee=r.useCallback(e=>{if(a.ErrorsWithoutBilling.includes(e.code))return void C(e);let t={error:e,sdkStatus:a.BillingStatus.fail};Q({service:a.BillingService.faceAuth,input:J,output:t}),C&&C(e)},[J,C,Q]),et=r.useCallback(e=>{var t,s;let r,l,u,c=(s={...e,frontalFaces:(r=n(t=e,"frontalFaces",[]),l=n(t,"frontalFacesEncrypted",[]),r.map((e,t)=>({blob:e,encrypted:l[t]??null})))},u={},u.faces=n(s,"frontalFaces"),u.videos=Array.isArray(n(s,"capturedFrames"))&&n(s,"capturedFrames").length>0?[{frames:n(s,"capturedFrames")}]:null,u.gestureFaces=Array.isArray(n(s,"steps"))&&n(s,"steps").length>0?n(s,"steps").map(e=>{let{name:t}=e;return{gesture:t,images:[{...e?.image}]}}):null,u);i===a.FaceAuthenticationMode.REGISTRATION&&(c={...c,customerUserID:U.v4(),faceType:"selfie",selfieType:g}),i===a.FaceAuthenticationMode.AUTHENTICATION&&(c={...c,selfieType:g,authType:o}),X(c)},[i,X,g,o]),en=r.useCallback(async e=>{if(!t||!G.enableUploadImages)return void et(e);try{let t;K(!0),i===a.FaceAuthenticationMode.REGISTRATION&&(t=await W({sdkResult:e})),i===a.FaceAuthenticationMode.AUTHENTICATION&&(t=await q({sdkResult:e})),X(t)}catch(e){console.error(e),ee({...a.Errors.api_call_error,details:e})}finally{K(!1)}},[t,G.enableUploadImages,et,i,X,W,q,ee]);return l.jsxs(A,{isWrappedBy:"face_authen",children:[l.jsx(j,{mode:(e=>{switch(e){case a.FaceAuthMethod.STANDARD_AUTHEN:return a.Mode.PASSIVE;case a.FaceAuthMethod.ADVANCED_AUTHEN_ACTIVE:return a.Mode.ACTIVE;case a.FaceAuthMethod.EDGE_AUTHEN:return a.Mode.FLASH_EDGE;case a.FaceAuthMethod.ADVANCED_AUTHEN_FLASH:return a.Mode.FLASH_ADVANCED;case a.FaceAuthMethod.LIGHT_AUTHEN:return a.Mode.PASSIVE;default:return e}})(g),cameraScale:M,offsetFaceY:D,frontalMinSize:w,captureFrameSettings:y,logCredentials:I,onLivenessDetectionDone:en,outputEncryptionSettings:E,onFramesCaptured:F,onError:C,onClose:S,onReset:b,clientSettings:T,customTheme:N,extraConfig:L,customComponent:V,apiCheck:t,apiCredentials:m,serviceSettings:G,flowId:x,customTexts:H}),l.jsx(O,{loading:P})]})}w.propTypes={apiCheck:i.bool,mode:i.string,authMethod:i.string,authType:i.string,onDone:i.func,onError:i.func,onClose:i.func,outputEncryptionSettings:i.shape({}),captureFrameSettings:i.shape({enable:i.bool,framesIntervalTime:i.number,framesBatchLength:i.number}),cameraScale:i.number,offsetFaceY:i.number,frontalMinSize:i.number,apiCredentials:i.shape({accessKey:i.string,secretKey:i.string,apiUrl:i.string}),logCredentials:i.shape({}),customTheme:i.shape({}),serviceSettings:i.shape({}),flowId:i.string,clientSettings:i.shape({}),livenessDetectionComponent:i.elementType,customComponent:i.shape({FaceAuthenticationLoading:i.elementType}),extraConfig:i.shape({}),onReset:i.func,onFramesCaptured:i.func,customTexts:i.shape({})},w.defaultProps={apiCheck:!1,mode:a.FaceAuthenticationMode.REGISTRATION,authMethod:a.FaceAuthMethod.EDGE_AUTHEN,authType:"transfer",onDone:()=>{},onError:()=>{},onClose:()=>{},outputEncryptionSettings:null,captureFrameSettings:{enable:!0,framesIntervalTime:180,framesBatchLength:15},cameraScale:1,offsetFaceY:0,frontalMinSize:null,apiCredentials:{accessKey:"",secretKey:"",apiUrl:""},logCredentials:null,customTheme:null,serviceSettings:{enableUploadFrames:!0,enableUploadImages:!0,enableRegisterFace:!0,enableAuthenticateFace:!0},flowId:"face_authen",clientSettings:null,livenessDetectionComponent:g,customComponent:{FaceAuthenticationLoading:o},extraConfig:null,onReset:()=>{},onFramesCaptured:()=>{},customTexts:{}};var N=(e=w,t=function(t){let{customTexts:n}=t;return l.jsx(h,{customTexts:n,children:l.jsx(e,{...t})})},function(e){let{apiCheck:n,apiCredentials:a,serviceSettings:s,flowId:r,clientSettings:i}=e,o=n&&(s?.enableGetClientSettings??!0);return l.jsx(m,{enableGetClientSettings:o,clientSettings:i,apiCredentials:a,flowId:r,children:l.jsx(t,{...e})})});function j(e){return l.jsx(N,{...e})}j.propTypes={logCredentials:i.shape({}),clientSettings:i.shape({})},j.defaultProps={logCredentials:null,clientSettings:null};export{j as default};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{o as e,P as i,s as t,x as c,Q as o,e as n,n as r,j as a}from"./chunk-
|
|
1
|
+
import{o as e,P as i,s as t,x as c,Q as o,e as n,n as r,j as a}from"./chunk-27713cdc.js";let s=e.img`
|
|
2
2
|
width: ${({width:e})=>e};
|
|
3
3
|
`;function l({type:e}){let i=c(),l=o(`Selfie.Active.directionIcon.${e}`,`${e}_arrow.gif`),F=o(`Selfie.Active.directionIcon.${t.FaceDirection.FRONTAL}`,"frontal_arrow.svg"),d=n(`Selfie.Active.directionIcon.${e}Width`)({theme:i}),f=r(i,`Selfie.Active.directionIcon.${e}`);return null===f?a.jsx(a.Fragment,{}):e===t.FaceDirection.FRONTAL&&F?a.jsx(s,{src:F,width:d,alt:""}):f&&null!==f?a.jsx(s,{src:r(i,`Selfie.Active.directionIcon.${e}`),width:d,alt:""}):a.jsx(s,{src:l,alt:"",width:d})}l.propTypes={type:i.oneOf([t.FaceDirection.LEFT,t.FaceDirection.RIGHT,t.FaceDirection.UP,t.FaceDirection.FRONTAL])},l.defaultProps={type:t.FaceDirection.LEFT};export{l as D};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{aL as e,w as i,aM as r,aN as t,aO as o,e as s,n as n,ai as a,aj as l,aP as d,af as c,aQ as g,Y as f,r as u,H as h,P as p,z as m,s as _,V as b,j as w,o as v,v as k,B as R,b as y,aR as S}from"./chunk-abc9d931.js";import{r as C,f as x,g as $,h as j,i as W,j as O,k as I,l as E,n as A,o as D,p as T}from"./chunk-0da5ca80.js";var P,L,V,z,M,B,F,N,H,U,q,K,J,Y,Z,G,Q,X,ee,ei,er,et,eo,es,en,ea,el,ed,ec,eg,ef,eu,eh,ep,em=Object.freeze({__proto__:null,blink:e,flipY:i,slide:r,spin:t,splash:o});let e_=({curStep:e,faceDirection:i})=>{let r=n(e,"stepTimeConstraints.delayTime");return!!r&&(null===e.firstFrameSpottedAt?(e.name===i&&(e.firstFrameSpottedAt=new Date().getTime()),!0):!!(new Date().getTime()-e.firstFrameSpottedAt<r)||!1)},eb=(e,i)=>({radius:e.radius??s("Selfie.progressCircle.radius")({theme:i}),strokeWidth:e.strokeWidth??s("Selfie.progressCircle.strokeWidth")({theme:i}),progress:e.progress??s("Selfie.progressCircle.progress")({theme:i}),showErrorRing:e.showErrorRing??s("Selfie.progressCircle.showErrorRing")({theme:i}),activeColor:e.activeColor??s("Selfie.progressCircle.activeColor")({theme:i}),innerPadding:e.innerPadding??s("Selfie.progressCircle.innerPadding")({theme:i}),outsideRingColor:e.outsideRingColor??s("Selfie.progressCircle.outsideRingColor")({theme:i}),outsideRingOpacity:e.outsideRingOpacity??s("Selfie.progressCircle.outsideRingOpacity")({theme:i}),insideRingColor:e.insideRingColor??s("Selfie.progressCircle.insideRingColor")({theme:i}),insideRingWidth:e.insideRingWidth??s("Selfie.progressCircle.insideRingWidth")({theme:i}),insideRingStrokeDash:e.insideRingStrokeDash??s("Selfie.progressCircle.insideRingStrokeDash")({theme:i}),errorRingWidth:e.errorRingWidth??s("Selfie.progressCircle.errorRingWidth")({theme:i}),errorRingColor:e.errorRingColor??s("Selfie.progressCircle.errorRingColor")({theme:i}),dashedRingColor:e.dashedRingColor??s("Selfie.progressCircle.dashedRingColor")({theme:i}),dashedRingOpacity:e.dashedRingOpacity??s("Selfie.progressCircle.dashedRingOpacity")({theme:i}),dashedRingWidth:e.dashedRingWidth??s("Selfie.progressCircle.dashedRingWidth")({theme:i}),dashedRingLineThick:e.dashedRingLineThick??s("Selfie.progressCircle.dashedRingLineThick")({theme:i}),dashedRingLineSpacing:e.dashedRingLineSpacing??s("Selfie.progressCircle.dashedRingLineSpacing")({theme:i}),dashedInsideRingColor:e.dashedInsideRingColor??s("Selfie.progressCircle.dashedInsideRingColor")({theme:i}),dashedInsideRingWidth:e.dashedInsideRingWidth??s("Selfie.progressCircle.dashedInsideRingWidth")({theme:i}),showOutsideRing:e.showOutsideRing??s("Selfie.progressCircle.showOutsideRing")({theme:i}),showInsideRing:e.showInsideRing??s("Selfie.progressCircle.showInsideRing")({theme:i}),showDashedRing:e.showDashedRing??s("Selfie.progressCircle.showDashedRing")({theme:i})}),ew=(e,i)=>({radius:e.radius??s("Selfie.progressCircleV2.radius")({theme:i}),strokeWidth:e.strokeWidth??s("Selfie.progressCircleV2.strokeWidth")({theme:i}),progress:e.progress??s("Selfie.progressCircleV2.progress")({theme:i}),activeColor:e.activeColor??s("Selfie.progressCircleV2.activeColor")({theme:i}),neutralColor:e.neutralColor??s("Selfie.progressCircleV2.neutralColor")({theme:i}),errorColor:e.errorColor??s("Selfie.progressCircleV2.errorColor")({theme:i}),tickWidth:e.tickWidth??s("Selfie.progressCircleV2.tickWidth")({theme:i}),numberOfTicks:e.numberOfTicks??s("Selfie.progressCircleV2.numberOfTicks")({theme:i})}),ev=({incomingFrame:e,currentBestFrame:i})=>e?.isEyeClosed&&!i?.isEyeClosed?i:!e?.isEyeClosed&&i?.isEyeClosed?e:e?.blurScore>i?.blurScore?e:i;function ek(e){return new Promise(i=>{let r=new Image;r.onload=i,r.onerror=i,r.src=e})}function eR(){if(z)return V;z=1;var e=a(),i=l(),r=j();return V=function(t){if(!i(t))return!1;var o=e(t);return"[object Error]"==o||"[object DOMException]"==o||"string"==typeof t.message&&"string"==typeof t.name&&!r(t)}}function ey(){return ei?ee:(ei=1,ee=/<%=([\s\S]+?)%>/g)}var eS=f(function(){if(ep)return eh;ep=1;var e=function(){if(L)return P;L=1;var e=C(),i=x(),r=$();return P=i(function(i,t,o,s){e(t,r(t),i,s)})}(),i=function(){if(B)return M;B=1;var e=O(),i=W(),r=eR();return M=i(function(i,t){try{return e(i,void 0,t)}catch(e){return r(e)?e:Error(e)}})}(),r=function(){if(N)return F;N=1;var e=d();return F=function(i,r){return e(r,function(e){return i[e]})}}(),t=function(){if(U)return H;U=1;var e=c(),i=Object.prototype,r=i.hasOwnProperty;return H=function(t,o,s,n){return void 0===t||e(t,i[s])&&!r.call(n,s)?o:t}}(),o=function(){if(K)return q;K=1;var e={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"};return q=function(i){return"\\"+e[i]}}(),s=eR(),n=T(),a=function(){if(X)return Q;X=1;var e=A(),i=function(){if(G)return Z;G=1;var e=E(),i=Y?J:(Y=1,J=I()(Object.keys,Object)),r=Object.prototype.hasOwnProperty;return Z=function(t){if(!e(t))return i(t);var o=[];for(var s in Object(t))r.call(t,s)&&"constructor"!=s&&o.push(s);return o}}(),r=D();return Q=function(t){return r(t)?e(t):i(t)}}(),l=ey(),f=function(){if(eu)return ef;eu=1;var e=function(){if(ea)return en;ea=1;var e=function(){if(es)return eo;es=1;var e=et?er:(et=1,er=function(e){return function(i){return null==e?void 0:e[i]}});return eo=e({"&":"&","<":"<",">":">",'"':""","'":"'"})}(),i=g(),r=/[&<>"']/g,t=RegExp(r.source);return en=function(o){return(o=i(o))&&t.test(o)?o.replace(r,e):o}}(),i=ed?el:(ed=1,el=/<%-([\s\S]+?)%>/g),r=eg?ec:(eg=1,ec=/<%([\s\S]+?)%>/g),t=ey();return ef={escape:i,evaluate:r,interpolate:t,variable:"",imports:{_:{escape:e}}}}(),u=g(),h=/\b__p \+= '';/g,p=/\b(__p \+=) '' \+/g,m=/(__e\(.*?\)|\b__t\)) \+\n'';/g,_=/[()=,{}\[\]\/\s]/,b=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,w=/($^)/,v=/['\n\r\u2028\u2029\\]/g,k=Object.prototype.hasOwnProperty;return eh=function(d,c,g){var R=f.imports._.templateSettings||f;g&&n(d,c,g)&&(c=void 0),d=u(d),c=e({},c,R,t);var y=e({},c.imports,R.imports,t),S=a(y),C=r(y,S),x,$,j=0,W=c.interpolate||w,O="__p += '",I=RegExp((c.escape||w).source+"|"+W.source+"|"+(W===l?b:w).source+"|"+(c.evaluate||w).source+"|$","g"),E=k.call(c,"sourceURL")?"//# sourceURL="+(c.sourceURL+"").replace(/\s/g," ")+"\n":"";d.replace(I,function(e,i,r,t,s,n){return r||(r=t),O+=d.slice(j,n).replace(v,o),i&&(x=!0,O+="' +\n__e("+i+") +\n'"),s&&($=!0,O+="';\n"+s+";\n__p += '"),r&&(O+="' +\n((__t = ("+r+")) == null ? '' : __t) +\n'"),j=n+e.length,e}),O+="';\n";var A=k.call(c,"variable")&&c.variable;if(A){if(_.test(A))throw Error("Invalid `variable` option passed into `_.template`")}else O="with (obj) {\n"+O+"\n}\n";O=($?O.replace(h,""):O).replace(p,"$1").replace(m,"$1;"),O="function("+(A||"obj")+") {\n"+(A?"":"obj || (obj = {});\n")+"var __t, __p = ''"+(x?", __e = _.escape":"")+($?", __j = Array.prototype.join;\nfunction print() { __p += __j.call(arguments, '') }\n":";\n")+O+"return __p\n}";var D=i(function(){return Function(S,E+"return "+O).apply(void 0,C)});if(D.source=O,s(D))throw D;return D}}());let eC=[],ex=()=>{eC=[]},e$=(e,i,r,t)=>{t&&ex(),eC.push({id:null});let o=eC.length-1;if(e&&e.key){let t=new Blob([JSON.stringify(i)]);r.uploadFile({file:t,metadata:JSON.stringify({type:"selfie"}),label:"video"},{"X-TV-Key":e.key}).then(e=>{e&&e.data&&e.data.file_id?eC[o].id=e.data.file_id:eC[o].id=-1})}else{let e=new Blob([JSON.stringify(i)]);r.uploadFile({file:e,metadata:JSON.stringify({type:"selfie"}),label:"video"}).then(e=>{e&&e.data&&e.data.file_id?eC[o].id=e.data.file_id:eC[o].id=-1})}},ej=()=>new Promise(e=>{let i=setInterval(()=>{eC.every(e=>e.id)&&(e(),clearInterval(i))},200)}),eW=e=>e.enable?eC.some(e=>-1===e.id)?null:eC:[],eO=[],eI=null,eE=!1,eA=()=>eO,eD=()=>{eE=!0,eO=[];try{eI instanceof MediaStream&&(eI.getTracks().forEach(e=>e.stop()),eI=null)}catch(e){}};async function eT({outputImagesSize:e,videoEl:i,resultAnalyzeVideoAndWindowSizes:r}){let t;eD();let o=document.createElement("canvas");o.width=e,o.height=e;let s=o.getContext("2d");try{let n={mimeType:"video/webm"};try{let e=(eI=i?.captureStream()?.clone()).getVideoTracks()[0];await e.applyConstraints({width:{min:360,ideal:400},height:{min:360,ideal:400}})}catch(e){}MediaRecorder.isTypeSupported("video/mp4")&&(eE=!1,!function e(i,r,t,o){if(!i||!o)return;let{cropX:s,cropY:n,cropWidth:a,cropHeight:l}=o;i.drawImage(r,s,n,a,l,0,0,t,t),eE||requestAnimationFrame(()=>e(i,r,t,o))}(s,i,e,r),eI=o.captureStream(25),n={mimeType:"video/mp4",videoBitsPerSecond:25e5}),t=new MediaRecorder(eI,n);let a=async()=>{await new Promise((e,i)=>{t.ondataavailable=r=>(function(e,i,r){if(e.data.size>0){let r=new Blob([e.data],{type:"video/mp4"});eO.push(r),i()}else console.error("No video have recored!"),r()})(r,e,i),"inactive"!==t.state&&t.stop()})};t.stopVideoRecording=a,t.discardRecording=()=>{"inactive"!==t.state&&t.stop()}}catch(e){}return{mediaRecorder:t}}let eP={data:{settings:{sdk_settings:{passive_liveness_settings:{auto_capture:{enable:!0,show_capture_button:!0,show_countdown:!0,wait_for_best_image_time_ms_web:3e3},manual_capture:{show_countdown:!0,wait_for_best_image_time_ms_web:3e3},blur_check:{enable:!0,web_blurry_threshold:.4},close_eye_detector:{enable:!0,web_threshold:.342,web_timeout:5,force_check:!1},web_is_required_frontal_face:!0},active_liveness_settings:{reset_flow_on_orientation_change:!0,wait_before_start_flow_ms:2e3,face_tracking_setting:{enable:!1,web_terminate_threshold:.0030152991993743408,web_warning_threshold:.0017317430600108828,limit_for:"all_flow",max_warning_time:5},flow_interval_time_ms:3e3,take_one_picture_time_ms:3e3,limit_time_liveness_check:{enable:!1,limit_time_second:45,remain_time_show:10,format:"s",max_retry_count:0,non_stoppable:!1},terminate_if_no_face:{enable:!1,max_invalid_frame:5,max_time_ms:1e3},close_eye_detector:{enable:!0,web_threshold:.342,web_timeout:5,force_check:!1},exif_data_settings:{enable:!0},record_video:{enable:!1},save_encoded_frames:{enable:!1,enable_logging:!1,frames_batch_len:0,frames_interval_ms:180,quality_android:90,quality_ios:80},auto_gen_frame_ids:{enable:!1,max_items:50}}}}}},eL=30,eV=e=>{let{shouldStart:i,totalTime:r,totalDelayBetweenReset:t,interruptible:o=!0,onReset:s,onTick:n,onTimesUp:a}=e,l=u.useRef(new h({totalTime:r,totalDelayBetweenReset:t,interruptible:o}));return u.useEffect(()=>l.current.on("tick",({remainTime:e})=>{n({remainTime:e})}),[n]),u.useEffect(()=>l.current.on("delaystart",()=>{a()}),[a]),u.useEffect(()=>l.current.on("reset",({attemptCount:e,fromBackground:i})=>{s({attemptCount:e,fromBackground:i})}),[s]),u.useEffect(()=>i?l.current.start():()=>{},[i]),{stopTimer:u.useCallback(()=>{l.current.stop()},[])}},{ErrorDuration:ez}=_;function eM({children:e,errorMsg:i,className:r}){return b.isValidElement(e)?i?w.jsx("div",{className:r,children:b.cloneElement(e,{errorMsg:i})}):null:i?w.jsx("div",{className:r,children:i}):null}function eB({children:e,className:i,error:r}){let t=u.useRef(0),o=u.useRef(""),s=m(),n=u.useRef(ez.SHORT),{code:a,duration:l=ez.SHORT}=r||{},d=s(a);return Date.now()-t.current>=n.current?(t.current=Date.now(),n.current=l,o.current=d,eM({children:e,errorMsg:d,className:i})):eM({children:e,errorMsg:o.current,className:i})}eB.propTypes={children:p.node,className:p.string},eB.defaultProps={className:""};let eF=v.g`
|
|
1
|
+
import{aL as e,w as i,aM as r,aN as t,aO as o,e as s,n as n,ai as a,aj as l,aP as d,af as c,aQ as g,Y as f,r as u,H as h,P as p,z as m,s as _,V as b,j as w,o as v,v as k,B as R,b as y,aR as S}from"./chunk-27713cdc.js";import{r as C,f as x,g as $,h as j,i as W,j as O,k as I,l as E,n as A,o as D,p as T}from"./chunk-9803c4f4.js";var P,L,V,z,M,B,F,N,H,U,q,K,J,Y,Z,G,Q,X,ee,ei,er,et,eo,es,en,ea,el,ed,ec,eg,ef,eu,eh,ep,em=Object.freeze({__proto__:null,blink:e,flipY:i,slide:r,spin:t,splash:o});let e_=({curStep:e,faceDirection:i})=>{let r=n(e,"stepTimeConstraints.delayTime");return!!r&&(null===e.firstFrameSpottedAt?(e.name===i&&(e.firstFrameSpottedAt=new Date().getTime()),!0):!!(new Date().getTime()-e.firstFrameSpottedAt<r)||!1)},eb=(e,i)=>({radius:e.radius??s("Selfie.progressCircle.radius")({theme:i}),strokeWidth:e.strokeWidth??s("Selfie.progressCircle.strokeWidth")({theme:i}),progress:e.progress??s("Selfie.progressCircle.progress")({theme:i}),showErrorRing:e.showErrorRing??s("Selfie.progressCircle.showErrorRing")({theme:i}),activeColor:e.activeColor??s("Selfie.progressCircle.activeColor")({theme:i}),innerPadding:e.innerPadding??s("Selfie.progressCircle.innerPadding")({theme:i}),outsideRingColor:e.outsideRingColor??s("Selfie.progressCircle.outsideRingColor")({theme:i}),outsideRingOpacity:e.outsideRingOpacity??s("Selfie.progressCircle.outsideRingOpacity")({theme:i}),insideRingColor:e.insideRingColor??s("Selfie.progressCircle.insideRingColor")({theme:i}),insideRingWidth:e.insideRingWidth??s("Selfie.progressCircle.insideRingWidth")({theme:i}),insideRingStrokeDash:e.insideRingStrokeDash??s("Selfie.progressCircle.insideRingStrokeDash")({theme:i}),errorRingWidth:e.errorRingWidth??s("Selfie.progressCircle.errorRingWidth")({theme:i}),errorRingColor:e.errorRingColor??s("Selfie.progressCircle.errorRingColor")({theme:i}),dashedRingColor:e.dashedRingColor??s("Selfie.progressCircle.dashedRingColor")({theme:i}),dashedRingOpacity:e.dashedRingOpacity??s("Selfie.progressCircle.dashedRingOpacity")({theme:i}),dashedRingWidth:e.dashedRingWidth??s("Selfie.progressCircle.dashedRingWidth")({theme:i}),dashedRingLineThick:e.dashedRingLineThick??s("Selfie.progressCircle.dashedRingLineThick")({theme:i}),dashedRingLineSpacing:e.dashedRingLineSpacing??s("Selfie.progressCircle.dashedRingLineSpacing")({theme:i}),dashedInsideRingColor:e.dashedInsideRingColor??s("Selfie.progressCircle.dashedInsideRingColor")({theme:i}),dashedInsideRingWidth:e.dashedInsideRingWidth??s("Selfie.progressCircle.dashedInsideRingWidth")({theme:i}),showOutsideRing:e.showOutsideRing??s("Selfie.progressCircle.showOutsideRing")({theme:i}),showInsideRing:e.showInsideRing??s("Selfie.progressCircle.showInsideRing")({theme:i}),showDashedRing:e.showDashedRing??s("Selfie.progressCircle.showDashedRing")({theme:i})}),ew=(e,i)=>({radius:e.radius??s("Selfie.progressCircleV2.radius")({theme:i}),strokeWidth:e.strokeWidth??s("Selfie.progressCircleV2.strokeWidth")({theme:i}),progress:e.progress??s("Selfie.progressCircleV2.progress")({theme:i}),activeColor:e.activeColor??s("Selfie.progressCircleV2.activeColor")({theme:i}),neutralColor:e.neutralColor??s("Selfie.progressCircleV2.neutralColor")({theme:i}),errorColor:e.errorColor??s("Selfie.progressCircleV2.errorColor")({theme:i}),tickWidth:e.tickWidth??s("Selfie.progressCircleV2.tickWidth")({theme:i}),numberOfTicks:e.numberOfTicks??s("Selfie.progressCircleV2.numberOfTicks")({theme:i})}),ev=({incomingFrame:e,currentBestFrame:i})=>e?.isEyeClosed&&!i?.isEyeClosed?i:!e?.isEyeClosed&&i?.isEyeClosed?e:e?.blurScore>i?.blurScore?e:i;function ek(e){return new Promise(i=>{let r=new Image;r.onload=i,r.onerror=i,r.src=e})}function eR(){if(z)return V;z=1;var e=a(),i=l(),r=j();return V=function(t){if(!i(t))return!1;var o=e(t);return"[object Error]"==o||"[object DOMException]"==o||"string"==typeof t.message&&"string"==typeof t.name&&!r(t)}}function ey(){return ei?ee:(ei=1,ee=/<%=([\s\S]+?)%>/g)}var eS=f(function(){if(ep)return eh;ep=1;var e=function(){if(L)return P;L=1;var e=C(),i=x(),r=$();return P=i(function(i,t,o,s){e(t,r(t),i,s)})}(),i=function(){if(B)return M;B=1;var e=O(),i=W(),r=eR();return M=i(function(i,t){try{return e(i,void 0,t)}catch(e){return r(e)?e:Error(e)}})}(),r=function(){if(N)return F;N=1;var e=d();return F=function(i,r){return e(r,function(e){return i[e]})}}(),t=function(){if(U)return H;U=1;var e=c(),i=Object.prototype,r=i.hasOwnProperty;return H=function(t,o,s,n){return void 0===t||e(t,i[s])&&!r.call(n,s)?o:t}}(),o=function(){if(K)return q;K=1;var e={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"};return q=function(i){return"\\"+e[i]}}(),s=eR(),n=T(),a=function(){if(X)return Q;X=1;var e=A(),i=function(){if(G)return Z;G=1;var e=E(),i=Y?J:(Y=1,J=I()(Object.keys,Object)),r=Object.prototype.hasOwnProperty;return Z=function(t){if(!e(t))return i(t);var o=[];for(var s in Object(t))r.call(t,s)&&"constructor"!=s&&o.push(s);return o}}(),r=D();return Q=function(t){return r(t)?e(t):i(t)}}(),l=ey(),f=function(){if(eu)return ef;eu=1;var e=function(){if(ea)return en;ea=1;var e=function(){if(es)return eo;es=1;var e=et?er:(et=1,er=function(e){return function(i){return null==e?void 0:e[i]}});return eo=e({"&":"&","<":"<",">":">",'"':""","'":"'"})}(),i=g(),r=/[&<>"']/g,t=RegExp(r.source);return en=function(o){return(o=i(o))&&t.test(o)?o.replace(r,e):o}}(),i=ed?el:(ed=1,el=/<%-([\s\S]+?)%>/g),r=eg?ec:(eg=1,ec=/<%([\s\S]+?)%>/g),t=ey();return ef={escape:i,evaluate:r,interpolate:t,variable:"",imports:{_:{escape:e}}}}(),u=g(),h=/\b__p \+= '';/g,p=/\b(__p \+=) '' \+/g,m=/(__e\(.*?\)|\b__t\)) \+\n'';/g,_=/[()=,{}\[\]\/\s]/,b=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,w=/($^)/,v=/['\n\r\u2028\u2029\\]/g,k=Object.prototype.hasOwnProperty;return eh=function(d,c,g){var R=f.imports._.templateSettings||f;g&&n(d,c,g)&&(c=void 0),d=u(d),c=e({},c,R,t);var y=e({},c.imports,R.imports,t),S=a(y),C=r(y,S),x,$,j=0,W=c.interpolate||w,O="__p += '",I=RegExp((c.escape||w).source+"|"+W.source+"|"+(W===l?b:w).source+"|"+(c.evaluate||w).source+"|$","g"),E=k.call(c,"sourceURL")?"//# sourceURL="+(c.sourceURL+"").replace(/\s/g," ")+"\n":"";d.replace(I,function(e,i,r,t,s,n){return r||(r=t),O+=d.slice(j,n).replace(v,o),i&&(x=!0,O+="' +\n__e("+i+") +\n'"),s&&($=!0,O+="';\n"+s+";\n__p += '"),r&&(O+="' +\n((__t = ("+r+")) == null ? '' : __t) +\n'"),j=n+e.length,e}),O+="';\n";var A=k.call(c,"variable")&&c.variable;if(A){if(_.test(A))throw Error("Invalid `variable` option passed into `_.template`")}else O="with (obj) {\n"+O+"\n}\n";O=($?O.replace(h,""):O).replace(p,"$1").replace(m,"$1;"),O="function("+(A||"obj")+") {\n"+(A?"":"obj || (obj = {});\n")+"var __t, __p = ''"+(x?", __e = _.escape":"")+($?", __j = Array.prototype.join;\nfunction print() { __p += __j.call(arguments, '') }\n":";\n")+O+"return __p\n}";var D=i(function(){return Function(S,E+"return "+O).apply(void 0,C)});if(D.source=O,s(D))throw D;return D}}());let eC=[],ex=()=>{eC=[]},e$=(e,i,r,t)=>{t&&ex(),eC.push({id:null});let o=eC.length-1;if(e&&e.key){let t=new Blob([JSON.stringify(i)]);r.uploadFile({file:t,metadata:JSON.stringify({type:"selfie"}),label:"video"},{"X-TV-Key":e.key}).then(e=>{e&&e.data&&e.data.file_id?eC[o].id=e.data.file_id:eC[o].id=-1})}else{let e=new Blob([JSON.stringify(i)]);r.uploadFile({file:e,metadata:JSON.stringify({type:"selfie"}),label:"video"}).then(e=>{e&&e.data&&e.data.file_id?eC[o].id=e.data.file_id:eC[o].id=-1})}},ej=()=>new Promise(e=>{let i=setInterval(()=>{eC.every(e=>e.id)&&(e(),clearInterval(i))},200)}),eW=e=>e.enable?eC.some(e=>-1===e.id)?null:eC:[],eO=[],eI=null,eE=!1,eA=()=>eO,eD=()=>{eE=!0,eO=[];try{eI instanceof MediaStream&&(eI.getTracks().forEach(e=>e.stop()),eI=null)}catch(e){}};async function eT({outputImagesSize:e,videoEl:i,resultAnalyzeVideoAndWindowSizes:r}){let t;eD();let o=document.createElement("canvas");o.width=e,o.height=e;let s=o.getContext("2d");try{let n={mimeType:"video/webm"};try{let e=(eI=i?.captureStream()?.clone()).getVideoTracks()[0];await e.applyConstraints({width:{min:360,ideal:400},height:{min:360,ideal:400}})}catch(e){}MediaRecorder.isTypeSupported("video/mp4")&&(eE=!1,!function e(i,r,t,o){if(!i||!o)return;let{cropX:s,cropY:n,cropWidth:a,cropHeight:l}=o;i.drawImage(r,s,n,a,l,0,0,t,t),eE||requestAnimationFrame(()=>e(i,r,t,o))}(s,i,e,r),eI=o.captureStream(25),n={mimeType:"video/mp4",videoBitsPerSecond:25e5}),t=new MediaRecorder(eI,n);let a=async()=>{await new Promise((e,i)=>{t.ondataavailable=r=>(function(e,i,r){if(e.data.size>0){let r=new Blob([e.data],{type:"video/mp4"});eO.push(r),i()}else console.error("No video have recored!"),r()})(r,e,i),"inactive"!==t.state&&t.stop()})};t.stopVideoRecording=a,t.discardRecording=()=>{"inactive"!==t.state&&t.stop()}}catch(e){}return{mediaRecorder:t}}let eP={data:{settings:{sdk_settings:{passive_liveness_settings:{auto_capture:{enable:!0,show_capture_button:!0,show_countdown:!0,wait_for_best_image_time_ms_web:3e3},manual_capture:{show_countdown:!0,wait_for_best_image_time_ms_web:3e3},blur_check:{enable:!0,web_blurry_threshold:.4},close_eye_detector:{enable:!0,web_threshold:.342,web_timeout:5,force_check:!1},web_is_required_frontal_face:!0},active_liveness_settings:{reset_flow_on_orientation_change:!0,wait_before_start_flow_ms:2e3,face_tracking_setting:{enable:!1,web_terminate_threshold:.0030152991993743408,web_warning_threshold:.0017317430600108828,limit_for:"all_flow",max_warning_time:5},flow_interval_time_ms:3e3,take_one_picture_time_ms:3e3,limit_time_liveness_check:{enable:!1,limit_time_second:45,remain_time_show:10,format:"s",max_retry_count:0,non_stoppable:!1},terminate_if_no_face:{enable:!1,max_invalid_frame:5,max_time_ms:1e3},close_eye_detector:{enable:!0,web_threshold:.342,web_timeout:5,force_check:!1},exif_data_settings:{enable:!0},record_video:{enable:!1},save_encoded_frames:{enable:!1,enable_logging:!1,frames_batch_len:0,frames_interval_ms:180,quality_android:90,quality_ios:80},auto_gen_frame_ids:{enable:!1,max_items:50}}}}}},eL=30,eV=e=>{let{shouldStart:i,totalTime:r,totalDelayBetweenReset:t,interruptible:o=!0,onReset:s,onTick:n,onTimesUp:a}=e,l=u.useRef(new h({totalTime:r,totalDelayBetweenReset:t,interruptible:o}));return u.useEffect(()=>l.current.on("tick",({remainTime:e})=>{n({remainTime:e})}),[n]),u.useEffect(()=>l.current.on("delaystart",()=>{a()}),[a]),u.useEffect(()=>l.current.on("reset",({attemptCount:e,fromBackground:i})=>{s({attemptCount:e,fromBackground:i})}),[s]),u.useEffect(()=>i?l.current.start():()=>{},[i]),{stopTimer:u.useCallback(()=>{l.current.stop()},[])}},{ErrorDuration:ez}=_;function eM({children:e,errorMsg:i,className:r}){return b.isValidElement(e)?i?w.jsx("div",{className:r,children:b.cloneElement(e,{errorMsg:i})}):null:i?w.jsx("div",{className:r,children:i}):null}function eB({children:e,className:i,error:r}){let t=u.useRef(0),o=u.useRef(""),s=m(),n=u.useRef(ez.SHORT),{code:a,duration:l=ez.SHORT}=r||{},d=s(a);return Date.now()-t.current>=n.current?(t.current=Date.now(),n.current=l,o.current=d,eM({children:e,errorMsg:d,className:i})):eM({children:e,errorMsg:o.current,className:i})}eB.propTypes={children:p.node,className:p.string},eB.defaultProps={className:""};let eF=v.g`
|
|
2
2
|
transition: stroke-dashoffset 0.4s;
|
|
3
3
|
transform: rotate(-90deg);
|
|
4
4
|
transform-origin: 50% 50%;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{ag as n,aS as t,ah as i,Y as r}from"./chunk-
|
|
1
|
+
import{ag as n,aS as t,ah as i,Y as r}from"./chunk-27713cdc.js";function e(){if(f)return u;f=1;var r=i(),e=function(){if(o)return a;o=1;var t=n();return a=function(){return t.Date.now()}}(),c=t(),v=Math.max,d=Math.min;return u=function(n,t,i){var a,o,u,f,l,m,s=0,g=!1,p=!1,h=!0;if("function"!=typeof n)throw TypeError("Expected a function");function T(t){var i=a,r=o;return a=o=void 0,s=t,f=n.apply(r,i)}t=c(t)||0,r(i)&&(g=!!i.leading,u=(p="maxWait"in i)?v(c(i.maxWait)||0,t):u,h="trailing"in i?!!i.trailing:h);function x(n){var i=n-m,r=n-s;return void 0===m||i>=t||i<0||p&&r>=u}function y(){var n,i,r,a,o=e();if(x(o))return E(o);l=setTimeout(y,(i=(n=o)-m,r=n-s,a=t-i,p?d(a,u-r):a))}function E(n){return(l=void 0,h&&a)?T(n):(a=o=void 0,f)}function w(){var n,i=e(),r=x(i);if(a=arguments,o=this,m=i,r){if(void 0===l){return s=n=m,l=setTimeout(y,t),g?T(n):f}if(p)return clearTimeout(l),l=setTimeout(y,t),T(m)}return void 0===l&&(l=setTimeout(y,t)),f}return w.cancel=function(){void 0!==l&&clearTimeout(l),s=0,a=m=o=l=void 0},w.flush=function(){return void 0===l?f:E(e())},w}}var a,o,u,f,c,v,d=r(function(){if(v)return c;v=1;var n=e(),t=i();return c=function(i,r,e){var a=!0,o=!0;if("function"!=typeof i)throw TypeError("Expected a function");return t(e)&&(a="leading"in e?!!e.leading:a,o="trailing"in e?!!e.trailing:o),n(i,r,{leading:a,maxWait:r,trailing:o})}}());export{e as r,d as t};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
let e,t;import{r as r,o as a,j as o,I as i,D as n,aD as l,F as s,at as c,aE as u,aF as h,s as d,c as f,G as m,k as g,aG as _,m as p,au as b,b as y,H as w,P as E,d as C}from"./chunk-
|
|
1
|
+
let e,t;import{r as r,o as a,j as o,I as i,D as n,aD as l,F as s,at as c,aE as u,aF as h,s as d,c as f,G as m,k as g,aG as _,m as p,au as b,b as y,H as w,P as E,d as C}from"./chunk-27713cdc.js";import{W as A}from"./chunk-b9c073ce.js";let F=({onVideoPlayed:e})=>{let[t,a]=r.useState(!1),[o,i]=r.useState({});return{onVideoPlayed:r.useCallback(t=>{i((e=>{let{videoAreaWidth:t,videoAreaHeight:r,lostX:a,lostY:o}=e;return{width:t,height:r,x:Math.max(a,0),y:Math.max(o,0)}})(t)),a(!0),"function"==typeof e&&e(t)},[e]),cropArea:o,isPlaying:t}},v={LOADING:"loading",FAR_FACE:"far_face",CLOSE_FACE:"close_face",START_FLASHING:"start_flashing",STOP_DECTECTING:"stop_detecting"},R={FAR_FACE:"far",CLOSE_FACE:"close",FLASHING:"flashing"},S={timeout:"timeout",no_face:"no_face"},x=({prediction:e,canvas:t,index:r,quality:a=.8})=>{let o=t.toDataURL("image/jpeg",a);return e?{label:"portrait",base64:o.split(",")[1],landmarks:e.landmarks,index:r}:{label:"portrait",base64:o.split(",")[1],index:r}},k=a.div`
|
|
2
2
|
position: fixed;
|
|
3
3
|
top: 0;
|
|
4
4
|
left: 0;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
let e;import{d as t,r as s,j as n,a as i,a8 as l,c as r,a7 as a,a9 as o,a1 as c,u as u,g as g,p as d,s as S,I as h,V as v}from"./chunk-
|
|
1
|
+
let e;import{d as t,r as s,j as n,a as i,a8 as l,c as r,a7 as a,a9 as o,a1 as c,u as u,g as g,p as d,s as S,I as h,V as v}from"./chunk-27713cdc.js";import{c as j,e as f,b as p,D as b,S as x}from"./chunk-9803c4f4.js";let k=s.createContext({}),y={},C=({children:e,enableGetClientSettings:i,clientSettings:l,apiCredentials:r,flowId:a})=>{let{apiClient:o}=t.useApiClient({apiCredentials:r}),[c,u]=s.useState({}),[g,d]=s.useState(!1);s.useEffect(()=>{i?async function e(){try{if(!o||"function"!=typeof o.clientSettings)return;let e=await o.clientSettings({flow_id:a});u(e)}catch(e){console.error(e)}finally{d(!0)}}():d(!0)},[i,o,a]);let S=y;return(l&&Object.keys(l).length>0?S=l:i&&(S=c),g)?n.jsx(k.Provider,{value:S,children:e}):null},m=()=>s.useContext(k),_=({children:e,onError:t})=>{let s=m();return n.jsx(i.LicenseProvider,{clientSettings:s,onError:t,children:e})},E=({children:e,onError:t,type:s})=>{let i=m();return n.jsx(l.Provider,{clientSettings:i,type:s,onError:t,children:e})},D={},P=({children:e,customTexts:t=D})=>{let s=m(),{lang:i,uiSettings:l}=r.useSDKSettings(),c=a({customTexts:t,clientSettings:s,lang:i,uiSettings:l});return n.jsx(o.SDKLocaleProvider,{value:c,children:e})},L={},B=({children:e,customTheme:t=L})=>{let s=m(),{uiSettings:i,themeVersion:l}=r.useSDKSettings(),a=j({customTheme:t,clientSettings:s,themeVersion:l,uiSettings:i,defaultThemes:f});return n.jsx(c,{theme:a,children:e})},z=v.lazy(()=>import("./chunk-1ffc8702.js")),w=v.lazy(()=>import("./chunk-0042305b.js")),A=v.lazy(()=>import("./chunk-cc109f43.js")),I=v.lazy(()=>import("./chunk-ec2cd6ff.js")),K=v.lazy(()=>import("./chunk-c385606a.js")),V=v.lazy(()=>import("./chunk-9462231f.js"));var T=(e=e=>{var t,i,l;let a,{logCredentials:o={enable:!1},livenessComponent:c,customTheme:v={},customTexts:j,...f}=e,{mode:k,flowId:y,onError:C,onClose:D,debug:L,onLivenessDetectionDone:T}=f,W=m(),{billingSettings:M,enableBilling:O,themeVersion:G}=r.useSDKSettings(),F=u.getWebSetting(W,"data.settings.sdk_settings.billing_settings.billing_config"),{submitBilling:U}=g({enable:O,onError:C,billingSettings:M??{json:F??{}},billingUrl:u.getWebSetting(W,"data.settings.sdk_settings.billing_settings.url")}),$=d.buildBillingInput(e),q=p(),H="face_authen"===q?S.BillingService.faceAuth:S.BillingService.selfie,J=s.useCallback(async(...e)=>{if("face_authen"===q)return void await T(...e);try{if(!await U({service:H,input:$,output:{...d.buildBillingOutput(e?.[0]||{}),sdkStatus:S.BillingStatus.success}}))return}catch(e){console.error(e)}await T(...e)},[$,H,q,T,U]),N=s.useCallback(e=>{S.ErrorsWithoutBilling.includes(e.code)?C(e):(U({service:H,input:$,output:{error:e,sdkStatus:S.BillingStatus.fail}}),C&&C(e))},[U,H,$,C]),Q=s.useCallback(()=>{U({service:H,input:$,output:{sdkStatus:S.BillingStatus.cancel}}),D&&D()},[U,H,$,D]),R=(t=k,i=c,l=G,a=I,t===S.Mode.ACTIVE&&(a=i?.ActiveLiveness??("v1"===l?K:I)),t===S.Mode.PASSIVE_V2&&(a=i?.PassiveLivenessV2??A),t===S.Mode.PASSIVE&&(a=i?.PassiveLiveness??("v1"===l?V:w)),"string"==typeof t&&t.startsWith("flash")&&(a=i?.FlashLiveness??z),a);return n.jsx(b,{debug:L,children:n.jsx(x,{onDone:T,onError:N,onClose:Q,children:n.jsx(P,{customTexts:j,children:n.jsx(E,{onError:N,type:"face_authen"===y?"face_auth":"liveness",children:n.jsx(_,{onError:C,children:n.jsx(B,{customTheme:v,children:n.jsx(h.SDKTrackingProvider,{value:{tracking:{...o}},children:n.jsx(s.Suspense,{fallback:null,children:n.jsx(R,{...f,onLivenessDetectionDone:J})})})})})})})})})},function(t){let{apiCheck:s,apiCredentials:i,serviceSettings:l,flowId:r,clientSettings:a}=t,o=s&&(l?.enableGetClientSettings??!0);return n.jsx(C,{enableGetClientSettings:o,clientSettings:a,apiCredentials:i,flowId:r,children:n.jsx(e,{...t})})}),W=Object.freeze({__proto__:null,default:T});export{C as C,T as L,P as S,W as i,m as u};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{P as e,r as t,j as r,b as o,e as n,l as a,h as i,i as s,k as l,m as c,n as d,s as u,o as g,q as p,t as m,B as f,v as k,w as h,S as b,x as _,y as C,z as B,A as w,c as y,C as v,D as x,E as P,F as S,G as I,H as R,I as $,J as D,K as M,L as E,M as T,N as j,O as A,Q as L,R as F,T as z,U as O,V as W,W as V,X as N,Y as Q,Z as q,_ as U,$ as X,a0 as H,a1 as K,a2 as Z,a3 as G,a4 as J,a5 as Y,g as ee,p as et,a6 as er,u as eo,a7 as en,a8 as ea,a9 as ei}from"./chunk-
|
|
1
|
+
import{P as e,r as t,j as r,b as o,e as n,l as a,h as i,i as s,k as l,m as c,n as d,s as u,o as g,q as p,t as m,B as f,v as k,w as h,S as b,x as _,y as C,z as B,A as w,c as y,C as v,D as x,E as P,F as S,G as I,H as R,I as $,J as D,K as M,L as E,M as T,N as j,O as A,Q as L,R as F,T as z,U as O,V as W,W as V,X as N,Y as Q,Z as q,_ as U,$ as X,a0 as H,a1 as K,a2 as Z,a3 as G,a4 as J,a5 as Y,g as ee,p as et,a6 as er,u as eo,a7 as en,a8 as ea,a9 as ei}from"./chunk-27713cdc.js";import{W as es,C as el,P as ec,O as ed}from"./chunk-b9c073ce.js";import{d as eu,u as eg,a as ep,t as em,b as ef,m as ek,c as eh,D as eb,S as e_}from"./chunk-9803c4f4.js";let eC="default",eB="error";function ew({className:e,width:o,height:n,type:a,strokeStyles:i,strokeWidth:s,radius:l,paddingStyle:c,defaultRectStyles:d,errorRectStyles:u,paddingCornerMultiplier:g=1.5}){let p=t.useMemo(()=>({[eC]:d,[eB]:u,...i}),[d,u,i]),m=l+s*g,f=p[a];return r.jsxs("svg",{width:o,height:n,className:e,children:[r.jsx("rect",{x:s/2,y:s/2,rx:l,ry:l,width:o-s,height:n-s,style:f}),r.jsx("path",{d:`M0,${m} Q0,0 ${m},0 L0,0 Z`,style:c}),r.jsx("path",{d:`M0,${n-m} Q0,${n} ${m},${n} L0,${n} Z`,style:c}),r.jsx("path",{d:`M${o-m},${n} Q${o},${n} ${o},${n-m} L${o},${n} Z`,style:c}),r.jsx("path",{d:`M${o-m},0 Q${o},0 ${o},${m} L${o},0 Z`,style:c})]})}ew.propTypes={className:e.string,width:e.number,height:e.number,strokeWidth:e.number,strokeStyles:e.shape({}),type:e.oneOf([eC,eB]),radius:e.number,paddingStyle:e.shape({}),defaultRectStyles:e.shape({}),errorRectStyles:e.shape({}),paddingCornerMultiplier:e.number},ew.defaultProps={className:"",width:eu.IDCapturing.rectangleMask.width,height:eu.IDCapturing.rectangleMask.height,strokeWidth:eu.IDCapturing.rectangleMask.strokeWidth,strokeStyles:eu.IDCapturing.rectangleMask.strokeStyles,type:eC,radius:eu.IDCapturing.rectangleMask.radius,paddingStyle:eu.IDCapturing.rectangleMask.paddingStyle,defaultRectStyles:eu.IDCapturing.rectangleMask.default,errorRectStyles:eu.IDCapturing.rectangleMask.error,paddingCornerMultiplier:1.5};let ey=o.isMobile?200:400,ev=o.isMobile?150:300,ex={ID_CARD:"id_card",QR_CODE:"qr_code"},eP=[{x:.02,y:.03,w:.46,h:.87},{x:.3,y:.03,w:.47,h:.87}],eS="raw",{Errors:eI}=u;async function eR(e,t){let r=i.getOpenCV(),o=e.getContext("2d").getImageData(0,0,e.width,e.height);return await r.fourPointTransform(o,t)}async function e$({canvas:e,paddingPercent:t=.04,glareThreshold:r}={}){let o=e.width,n=e.height,a=Math.floor(o*t),i=Math.floor(n*t),l=o-2*a,c=n-2*i,d=document.createElement("canvas"),u=d.getContext("2d");return d.width=l,d.height=c,u.drawImage(e,a,i,l,c,0,0,l,c),s.isCardGlare(d,r)}async function eD({blazefaceModel:e,predictedIdCardCanvas:t,frontSide:r}){let o=t.width,n=t.height,a=Math.floor(o/3),i=Math.floor(4*n/5),s=document.createElement("canvas"),d=s.getContext("2d");s.width=a,s.height=i,d.drawImage(t,0,Math.floor(n/5),a,i,0,0,a,i);let u=await l.getModelPredictions({model:e,sCanvas:s}),g=e=>e&&"function"==typeof e.arraySync?e.arraySync():e,p=e=>{e&&"function"==typeof e.dispose&&e.dispose()},m=u.map(e=>{let t={topLeft:g(e.topLeft),bottomRight:g(e.bottomRight),probability:g(e.probability),landmarks:g(e.landmarks)};return p(e.topLeft),p(e.bottomRight),p(e.probability),p(e.landmarks),t}).filter(({topLeft:e,bottomRight:t,probability:[r],landmarks:o})=>!(r<.9||o.length<4||.025>c.rectAreaRatio({small:{coords:[e,t]},big:{coords:[[0,0],[l.SIZE,l.SIZE]]}}))&&!0).length;if(r){if(0===m)return eI.id_detector_error_front_side_no_faces;if(m>1)return eI.id_detector_error_front_side_multiple_faces}else if(m>0)return eI.id_detector_error_back_side_has_faces;return null}async function eM({blazefaceModel:e,predictedIdCardCanvas:t,frontSide:r,hasFrontFace:o,hasBackFace:n,genericEnableCheckFrontFace:a,genericEnableCheckBackFace:i}){if(r&&!a||!r&&!i)return null;let{width:s,height:c}=t,d=document.createElement("canvas"),u=document.createElement("canvas");d.width=s/2,u.width=s/2,d.height=c,u.height=c;let g=d.getContext("2d"),p=u.getContext("2d");g.drawImage(t,0,0,s/2,c,0,0,s/2,c),p.drawImage(t,s/2,0,s/2,c,0,0,s/2,c);let m=e=>e&&"function"==typeof e.arraySync?e.arraySync():e,f=e=>{e&&"function"==typeof e.dispose&&e.dispose()},k=e=>{let t={probability:m(e.probability),landmarks:m(e.landmarks)};return f(e.topLeft),f(e.bottomRight),f(e.probability),f(e.landmarks),t},[h,b]=await Promise.all([l.getModelPredictions({model:e,sCanvas:d}),l.getModelPredictions({model:e,sCanvas:u})]),_=h.map(k),C=b.map(k),B=({probability:[e],landmarks:t})=>e>=.9&&t.length>=4,w=_.filter(B),y=C.filter(B),v=w.length>0||y.length>0;if(r){if(!v&&o||v&&!o)return eI.id_detector_error_front_side_no_faces}else if(!v&&n||v&&!n)return eI.id_detector_error_back_side_has_faces;return null}let eE=({canvas:e,cardPosition:t,quality:r=1})=>{if(!t||!t.corners||!Array.isArray(t.corners))return null;let[o,n,i]=t.corners,s=n?.location?.x-o?.location?.x-100,l=i?.location?.y-n?.location?.y-100,c=document.createElement("canvas");c.width=s,c.height=l,c.getContext("2d").drawImage(e,o?.location?.x+50,o?.location?.y+50,s,l,0,0,s,l);let d=c.toDataURL("image/jpeg",r);return a.base64ToMD5({base64:d}).toString()},eT=async({canvas:e,cardPosition:t,quality:r,count:o=3})=>{if(!t||!t.corners||!Array.isArray(t.corners))return[];let n=[];for(;n.length<o;){let a=performance.now(),i=eE({canvas:e,cardPosition:t,quality:r});if(n.push(i),n.length<o){let e=180-(a=Math.floor(performance.now()-a))>0?180-a:0;await new Promise(t=>setTimeout(t,e))}}return n},ej=(e,t)=>{if(null!=e)return parseFloat(e.toFixed(t))},eA=({currentFrameBlurScore:e,incomingFrameBlurScore:t,currentFrameGlareScore:r,incomingFrameGlareScore:o,settings:n,blurLargeThreshold:a,blurSmallThreshold:i})=>{if(null===e)return!0;let{enableBlurCheck:s,enableGlareCheck:l}=n,c=e?.small,d=e?.large,u=t?.small,g=t?.large;return(!s||!(u<i)&&!(g<a))&&(Math.abs(u-c)>Number.EPSILON?u>c:Math.abs(g-d)>Number.EPSILON?g>d:!!(l&&Math.abs(o-r)>Number.EPSILON)&&o>r)};function eL(e,t,r,o,n){r&&(r.strokeStyle=t,r.lineWidth=2,e.forEach(e=>{let[t,a,i,s]=e,l=(t+n.x)*o,c=(a+n.y)*o,d=(i+n.x)*o,u=(s+n.y)*o;r.strokeRect(l,c,d-l,u-c)}))}function eF(e){let t=e.find(e=>"top-left"===e.label).location,r=e.find(e=>"top-right"===e.label).location,o=e.find(e=>"bottom-right"===e.label).location,n=e.find(e=>"bottom-left"===e.label).location,a=Math.sqrt((o.x-n.x)**2+(o.y-n.y)**2),i=Math.sqrt((r.x-t.x)**2+(r.y-t.y)**2),s=Math.max(parseInt(a,10),parseInt(i,10)),l=Math.sqrt((t.x-n.x)**2+(t.y-n.y)**2),c=Math.sqrt((r.x-o.x)**2+(r.y-o.y)**2);return{topLeft:t,topRight:r,bottomRight:o,bottomLeft:n,maxWidth:s,maxHeight:Math.max(parseInt(l,10),parseInt(c,10))}}let ez=g(ew)``,eO=g.img`
|
|
2
2
|
position: absolute;
|
|
3
3
|
top: 0;
|
|
4
4
|
left: 0;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{x as e,y as r,Q as s,r as n,e as a,c as t,s as o,j as i,a2 as c,n as l,P as u,b as p}from"./chunk-
|
|
1
|
+
import{x as e,y as r,Q as s,r as n,e as a,c as t,s as o,j as i,a2 as c,n as l,P as u,b as p}from"./chunk-27713cdc.js";import{p as d,g as m,S as f,a as g,O as h,C as C,E as y,b as j,B as D,c as F,L as x}from"./chunk-65036591.js";import{u as S,C as b}from"./chunk-99078e42.js";import{M as I,O as T,W as E,C as k}from"./chunk-b9c073ce.js";import{D as R}from"./chunk-4f993a97.js";import{u as L}from"./chunk-9803c4f4.js";import"./chunk-67605c5a.js";import"./chunk-788a3d4e.js";let v=p.isMobile?{width:{ideal:640}}:null;function P(u){let{apiCheck:p,onLivenessDetectionDone:R,captureFrameSettings:P,onFramesCaptured:A,frontCamera:M,flipVideoHorizontal:O,customDirectionIcon:H,customStepTimeConstraints:V,onProcessing:w,customErrors:U,apiCredentials:$,outputEncryptionSettings:_,cameraScale:B,defaultCameraId:K,passiveModeAuto:N,offsetFaceY:z,styledComponent:G,serviceSettings:Y,onReset:W,isLoading:Q}=u,q=e(),{onErrorCallback:J,onCloseCallback:X}=L(),Z=r.useAsset("bg_camera_mask.png"),ee=r.useAsset("bg_camera_mask_red.png"),er=s("IDCapturing.loadingIcon.src","ic_loading.gif"),[es,en]=n.useState({}),{yFaceDetectionError:ea,yFaceVerificationStepsWrapper:et}=es,[eo,ei]=n.useState(""),[ec,el]=n.useState(),eu=n.useMemo(()=>({backgroundColor:a("Selfie.backgroundColor")({theme:q})}),[q]),ep=n.useCallback(({lostY:e,height:r,clientHeight:s})=>{let n=e+25,a=n+30;en({yFaceDetectionError:n,yFaceVerificationStepsWrapper:a+r+20});let t=Math.floor(e),o=Math.floor(s-e),i=Math.floor(a);return 0!==z&&(i+z<t||i+z+r>o)?J({code:`offsetFaceY must be in [-${i-t}, ${o-r-i}]`}):i+=z,{y:i}},[z,J]),{shouldResetFlowOnOrientationChange:ed,countdownToTakePicture:em,cropArea:ef,curStepIndex:eg,faceDetectionError:eh,resetFlow:eC,handleTriggerPassiveMode:ey,handleVideoPlayed:ej,refVideo:eD,showCountdown:eF,steps:ex,refIsReseting:eS,videoPlayed:eb,warmupDone:eI,showCaptureButton:eT,shouldShowCountdown:eE,showLoading:ek}=S({currentOrientation:ec,apiCheck:p,bgCameraMask:Z,bgCameraMaskRed:ee,surroundStyle:eu,onLivenessDetectionDone:R,onError:J,cropAreaDimension:ep,customDirectionIcon:H,captureFrameSettings:P,onFramesCaptured:A,setRemainingTime:ei,customStepTimeConstraints:V,onProcessing:w,customErrors:U,apiCredentials:$,outputEncryptionSettings:_,cameraScale:B,passiveModeAuto:N,serviceSettings:Y,onReset:W});n.useEffect(()=>{"string"==typeof ex[0]?.directionIcon&&Promise.all(ex.map(e=>d(e.directionIcon)))},[ex]);let{CloseCameraButton:eR}=G,eL=m(u,q),ev=eS.current?0:eg/ex.length*100,{lang:eP}=t.useSDKSettings(),eA=n.useRef(0),eM=n.useRef({}),eO=n.useRef(o.ErrorDuration.SHORT),eH=n.useMemo(()=>{let{msg:e,duration:r=o.ErrorDuration.SHORT}=eh||{},s=e?.[eP];return Date.now()-eA.current>=eO.current&&(eA.current=Date.now(),eO.current=r,eM.current=s),eM.current},[eh,eg]),eV=n.useCallback(e=>{el(e),ed?eC():e===I.LANDSCAPE?eD.current?.pause():eD.current?.play()},[eD,eC,ed]);return i.jsx(T,{onOrientationChange:eV,children:i.jsxs(c,{frontCamera:M,onVideoPlayed:ej,onClose:X,flipHorizontal:O??M,ref:eD,videoSettings:v,onError:J,scale:B,defaultCameraId:K,closeButton:eR||null,children:[!eI&&i.jsx(E,{}),eb?i.jsxs(i.Fragment,{children:["string"==typeof eH?i.jsx(f,{top:ea-15,className:"face-detection-error",children:eH}):null,ef.current?i.jsxs(k,{x:`${ef.current.x}px`,y:`${ef.current.y}px`,width:`${ef.current.width}px`,height:`${ef.current.height}px`,surroundStyle:ef.current.surroundStyle,children:[i.jsx(g,{}),i.jsx(h,{...eL,progress:ev,showErrorRing:!!eh&&a("Selfie.progressCircle.showErrorRing")({theme:q})}),eE?i.jsx(C,{children:em}):null,eh&&i.jsx(y,{})]}):null,eo&&i.jsx(j,{top:et-30,children:eo}),eT?i.jsx(D,{children:i.jsx(F,{onClick:ey,disabled:eF,children:l(q,"Selfie.captureIcon.src")?i.jsx("img",{src:l(q,"Selfie.captureIcon.src"),alt:""}):i.jsx(b,{fillColor:"rgba(193, 197, 204, 1)"})})}):null]}):null,(ek||Q)&&i.jsx(x,{children:i.jsx("img",{src:er,alt:""})})]})})}P.propTypes={apiCheck:u.bool,mode:u.string,onLivenessDetectionDone:u.func,onClose:u.func,onError:u.func,onReset:u.func,captureFrameSettings:u.shape({}),onFramesCaptured:u.func,frontCamera:u.bool,isLoading:u.bool,flipVideoHorizontal:u.bool,customDirectionIcon:u.shape({}),customStepTimeConstraints:u.shape({}),onProcessing:u.func,customErrors:u.shape({}),apiCredentials:u.shape({accessKey:u.string,secretKey:u.string,apiUrl:u.string}),outputEncryptionSettings:u.shape({}),cameraScale:u.number,defaultCameraId:u.string,passiveModeAuto:u.bool,offsetFaceY:u.number,styledComponent:u.shape({CloseCameraButton:u.node}),serviceSettings:u.shape({})},P.defaultProps={apiCheck:!1,mode:null,onLivenessDetectionDone:null,onClose:null,onError:()=>{},onReset:()=>{},captureFrameSettings:{enable:!1,framesIntervalTime:180,framesBatchLength:0},onFramesCaptured:()=>{},frontCamera:!0,isLoading:!1,flipVideoHorizontal:null,customDirectionIcon:{[o.FaceDirection.LEFT]:i.jsx(R,{type:o.FaceDirection.LEFT}),[o.FaceDirection.RIGHT]:i.jsx(R,{type:o.FaceDirection.RIGHT}),[o.FaceDirection.UP]:i.jsx(R,{type:o.FaceDirection.UP}),[o.FaceDirection.FRONTAL]:i.jsx(R,{type:o.FaceDirection.FRONTAL})},customStepTimeConstraints:{[o.FaceDirection.UP]:{delayTime:0},[o.FaceDirection.LEFT]:{delayTime:0},[o.FaceDirection.RIGHT]:{delayTime:0},[o.FaceDirection.FRONTAL]:{delayTime:2e3}},onProcessing:()=>{},customErrors:null,apiCredentials:{accessKey:"",secretKey:"",apiUrl:""},outputEncryptionSettings:null,cameraScale:1,defaultCameraId:void 0,passiveModeAuto:!1,offsetFaceY:0,styledComponent:{CloseCameraButton:null},serviceSettings:{enableUploadFrames:!0,enableUploadImages:!0,enableVerifySanityPortrait:!0,enableVerifySanityIDCard:!0,enableVerifyFaceLiveness:!0,enableDetectIDCardTampering:!0,enableReadIDCardInfo:!0}};export{P as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as r,r as o,s as e,$ as n,ab as t,ac as i,ad as a,ae as s,af as u,ag as d,ah as c,ai as l,aj as g,ak as f,al as p,am as h,Y as b,u as x,an as y}from"./chunk-abc9d931.js";let k=o.createContext(!1),C=({children:o,debug:e=!1})=>r.jsx(k.Provider,{value:e,children:o}),T=()=>o.useContext(k),v={tsBlue:"#0276f1",tsSecondary:"rgba(0, 47, 117, 0.6)"},m={IDCapturing:{backgroundColor:"rgba(0, 0, 0, 0.6)",titleFront:{color:"#fff",fontSize:"20px",fontWeight:"normal",backgroundColor:"unset"},titleBack:{color:"#fff",fontSize:"20px",fontWeight:"normal",backgroundColor:"unset"},instruction:{padding:"unset",color:"#fff",fontSize:"16px",fontWeight:"normal",backgroundColor:"unset",border:"unset",borderRadius:"unset"},captureInstruction:{capturing:{padding:"12px 12px",color:"#ffffff",fontSize:"14px",fontWeight:"normal",background:"rgba(15, 23, 42, 0.25)",border:"none",borderRadius:"100px"},captured:{padding:"12px 12px",color:"#ffffff",fontSize:"14px",fontWeight:"normal",background:"rgba(15, 23, 42, 0.25)",border:"none",borderRadius:"100px"}},error:{padding:"5px 10px",color:"#fff",fontSize:"16px",fontWeight:"normal",backgroundColor:"#ea3223",border:"unset",borderRadius:"3px"},toggle:{color:"#d1d1d1",fontSize:"16px",fontWeight:"500",gap:"16px",backgroundColor:"#fff",active:{backgroundColor:"#2196f3"},inactive:{backgroundColor:"#ccc"}},countdown:{color:"#fff",fontSize:"18px",fontWeight:"normal",backgroundColor:"#ea3223",border:"unset",borderRadius:"3px"},cardIcon:{src:"",width:"auto",height:"38px"},captureIcon:{src:"",width:"60px",height:"60px",disabled:{src:""}},loadingIcon:{src:"",width:"100px",height:"100px"},rectangleMask:{width:600,height:400,strokeWidth:2,strokeStyles:{},radius:10,paddingStyle:{fill:"rgba(0, 0, 0, 0.6)"},default:{fill:"none",stroke:"#fff",strokeWidth:2,strokeDasharray:"7, 4",opacity:.6},error:{fill:"rgba(234,50,35, 0.1)",strokeWidth:2,stroke:"#ea3223"}}},IDConfirmPopup:{image:{borderRadius:"5px"}},IDUploadButton:{background:"rgba(255, 255, 255, 0.2)",border:"1px solid rgba(255, 255, 255, 0.25)",borderRadius:"8px",color:"#ffffff",padding:"12px",leftOffset:"24px",focusOutlineColor:"#ffffff"},IDUploadErrorToast:{background:"rgba(0, 0, 0, 0.75)",color:"#ffffff",borderRadius:"8px",fontSize:"14px",padding:"10px 16px",maxWidthInset:"48px"},QRStep:{title:{color:"#fff",fontSize:"20px",fontWeight:"700",backgroundColor:"unset"},guidelinePopup:{image:{src:"",borderRadius:"5px",backgroundColor:"#e7e6e6"},guideText:{color:v.tsSecondary,fontSize:"16px",fontWeight:"normal",textAlign:"center",lineHeight:"20px"},countdownText:{color:v.tsSecondary,fontSize:"16px",fontWeight:"normal",textAlign:"center",lineHeight:"20px"}},scanTooltip:{backgroundColor:"#00ce78",borderRadius:"8px",color:"#fff",padding:"10px",textAlign:"center"},scanCountdown:{textAlign:"center",color:"#fff",fontSize:"18px",fontWeight:"normal",backgroundColor:"#ea3223",border:"none",borderRadius:"3px",padding:"5px 10px"},invalidPopup:{padding:"10px",title:{display:"block",color:v.tsSecondary,fontSize:"16px",fontWeight:"bold",margin:"25px 0 0 0",padding:"0 0 0 0"},description:{color:v.tsSecondary,fontSize:"16px",fontWeight:"normal",textAlign:"center",margin:"30px 0 0 0",padding:"0 0 0 0"},retryButton:{color:"#fff",fontSize:"1rem",fontWeight:"normal",backgroundColor:v.tsBlue,border:"none",borderRadius:"3px",outline:"none",height:"66px",margin:"30px 0 0 0"},skipButton:{color:v.tsBlue,fontSize:"1rem",fontWeight:"normal",backgroundColor:"unset",border:"none",borderRadius:"unset",outline:"none",height:"unset",margin:"20px 0"}},resultText:{success:{textColor:"#000",fontSize:"1rem",fontWeight:"normal",mainColor:"#34ce60"},error:{textColor:"#000",fontSize:"1rem",fontWeight:"normal",mainColor:"#ff9532"}}}},D={IDCapturing:{backgroundColor:"rgba(0, 0, 0, 0.6)",titleFront:{...e.DesignToken.Typography.h4,color:e.DesignToken.Color.base.white,backgroundColor:"unset"},titleBack:{...e.DesignToken.Typography.h4,color:e.DesignToken.Color.base.white,backgroundColor:"unset"},instruction:{...e.DesignToken.Typography.body,padding:"5px 10px",color:"rgba(255, 255, 255, 0.8)",backgroundColor:"unset",border:"unset",borderRadius:"unset"},captureInstruction:{capturing:{...e.DesignToken.Typography.label,color:e.DesignToken.Color.base.white,padding:`6px ${e.DesignToken.Spacing.sm}`,background:"rgba(15, 23, 42, 0.35)",border:"none",borderRadius:"100px"},captured:{...e.DesignToken.Typography.label,color:e.DesignToken.Color.base.white,padding:`6px ${e.DesignToken.Spacing.sm}`,background:"rgba(15, 23, 42, 0.35)",border:"none",borderRadius:"100px"}},error:{...e.DesignToken.Typography.body,padding:"5px 10px",color:e.DesignToken.Color.semantic.error[400],backgroundColor:"transparent",border:"unset",borderRadius:e.DesignToken.CornerRadius["2xs"]},toggle:{...e.DesignToken.Typography.body,color:e.DesignToken.Color.base.white,gap:e.DesignToken.Spacing.base,backgroundColor:e.DesignToken.Color.base.white,active:{backgroundColor:e.DesignToken.Color.base.blue},inactive:{backgroundColor:e.DesignToken.Color.neutral[300]}},countdown:{...e.DesignToken.Typography.body,color:e.DesignToken.Color.semantic.error[400],backgroundColor:"transparent",border:"unset",borderRadius:e.DesignToken.CornerRadius["2xs"]},cardIcon:{src:"",width:"auto",height:"38px"},captureIcon:{src:"",width:e.DesignToken.Height["7xl"],height:e.DesignToken.Height["7xl"],disabled:{src:""}},loadingIcon:{src:"",width:"47px",height:"47px"},rectangleMask:{width:600,height:400,strokeWidth:n.getCSSNumericValue(e.DesignToken.BorderWidth["3xl"]),strokeStyles:{},radius:n.getCSSNumericValue(e.DesignToken.CornerRadius.base),paddingStyle:{fill:"rgba(0, 0, 0, 0.6)"},default:{fill:"none",stroke:e.DesignToken.Color.neutral[400],strokeWidth:n.getCSSNumericValue(e.DesignToken.BorderWidth["3xl"])},error:{fill:"none",strokeWidth:n.getCSSNumericValue(e.DesignToken.BorderWidth["3xl"]),stroke:e.DesignToken.Color.semantic.error[400]}}},IDConfirmPopup:{image:{borderRadius:e.DesignToken.CornerRadius["2xs"]}},IDUploadButton:{background:"rgba(255, 255, 255, 0.2)",border:"1px solid rgba(255, 255, 255, 0.25)",borderRadius:e.DesignToken.CornerRadius.xs,color:e.DesignToken.Color.base.white,padding:e.DesignToken.Spacing.sm,leftOffset:"24px",focusOutlineColor:e.DesignToken.Color.base.white},IDUploadErrorToast:{background:"rgba(0, 0, 0, 0.75)",color:e.DesignToken.Color.base.white,borderRadius:e.DesignToken.CornerRadius.xs,fontSize:"14px",padding:"10px 16px",maxWidthInset:"48px"},QRStep:{title:{...e.DesignToken.Typography.h4,backgroundColor:"unset"},guidelinePopup:{image:{src:"",borderRadius:e.DesignToken.CornerRadius["2xs"],backgroundColor:"transparent"},guideText:{...e.DesignToken.Typography.body,color:e.DesignToken.Color.neutral[600],textAlign:"center"},countdownText:{...e.DesignToken.UIText.medium,color:e.DesignToken.Color.neutral[500],textAlign:"center"}},scanTooltip:{backgroundColor:"transparent",borderRadius:e.DesignToken.CornerRadius.xs,color:e.DesignToken.Color.base.white,padding:"10px",textAlign:"center"},scanCountdown:{...e.DesignToken.Typography.body,color:e.DesignToken.Color.semantic.error[400],textAlign:"center",backgroundColor:"transparent",border:"none",borderRadius:e.DesignToken.CornerRadius["2xs"],padding:"0px"},invalidPopup:{padding:"10px",title:{...e.DesignToken.Typography.h6,color:e.DesignToken.Color.content.primary,display:"none",margin:"25px 0 0 0",padding:"0 0 0 0"},description:{...e.DesignToken.Typography.body,color:e.DesignToken.Color.content.secondary,textAlign:"center",margin:"30px 0 0 0",padding:"0 0 0 0"},retryButton:{...e.DesignToken.Typography.body,color:e.DesignToken.Color.base.white,backgroundColor:e.DesignToken.Color.base.blue,borderRadius:e.DesignToken.CornerRadius.xs,border:"none",outline:"none",height:e.DesignToken.Height["3xl"],margin:"24px 0 0 0"},skipButton:{...e.DesignToken.Typography.body,color:e.DesignToken.Color.content.primary,backgroundColor:e.DesignToken.Color.background.tertiary,borderRadius:e.DesignToken.CornerRadius.xs,border:"none",outline:"none",height:e.DesignToken.Height["3xl"],margin:"12px 0"}},resultText:{success:{...e.DesignToken.Typography.body,textColor:e.DesignToken.Color.content.primary,mainColor:e.DesignToken.Color.semantic.success[400]},error:{...e.DesignToken.Typography.body,textColor:e.DesignToken.Color.content.primary,mainColor:e.DesignToken.Color.semantic.warning[500]}}}},R=m,S=D,{DesignToken:W}=e,w={FlashLiveness:{maskFill:"#fff",mask:{strokeColor:W.Color.separators.secondary,strokeColorError:W.Color.semantic.error[400],strokeWidth:4,path:"M118.5 2.5C54.2233 2.5 2.5 59.5579 2.5 129.447C2.5 146.072 3.68394 172.618 8.16415 200.483C12.6369 228.301 20.4309 257.673 33.7816 279.787C46.9667 301.626 59.6817 317.047 73.3658 327.003C87.1207 337.011 101.735 341.41 118.5 341.41C135.265 341.41 149.879 337.011 163.634 327.003C177.318 317.047 190.033 301.626 203.218 279.787C216.569 257.673 224.363 228.301 228.836 200.483C233.316 172.618 234.5 146.072 234.5 129.447C234.5 59.5579 182.777 2.5 118.5 2.5Z",width:237,height:344},title:{hidden:!1,height:"auto",color:W.Color.content.primary,fontSize:W.Typography.h5.fontSize,fontWeight:W.Typography.h5.fontWeight,lineHeight:W.Typography.h5.lineHeight},guideline:{text:{close:{color:W.Color.content.primary,fontSize:W.Typography.h6.fontSize,fontWeight:W.FontWeight["semi-bold"],background:W.Color.background.secondary,border:`${W.BorderWidth.base} solid ${W.Color.separators.tertiary}`,borderRadius:"100px",padding:"12px 16px"},far:{color:W.Color.content.primary,fontSize:W.Typography.h6.fontSize,fontWeight:W.FontWeight["semi-bold"],background:W.Color.background.secondary,border:`${W.BorderWidth.base} solid ${W.Color.separators.tertiary}`,borderRadius:"100px",padding:"12px 16px"},flashing:{color:W.Color.content["on-bg-color"],fontSize:W.Typography.label.fontSize,fontWeight:W.Typography.label.fontWeight,background:"rgba(15, 23, 42, 0.35)",border:"none",borderRadius:"100px",padding:"12px 16px"}},icon:{color:W.Color.blue[900],src:""}},instruction:{color:W.Color.content["on-bg-color"],fontSize:W.Typography.label.fontSize,fontWeight:W.Typography.label.fontWeight,background:"rgba(15, 23, 42, 0.35)",border:"none",borderRadius:"100px",backdropFilter:"blur(28px)",maxWidth:"200px"},timeoutText:{color:W.Color.semantic.error[400],fontSize:W.Typography.body.fontSize,fontWeight:W.Typography.body.fontWeight,padding:"0"},errorOverlay:{backgroundColor:"transparent",opacity:0},progressBar:{mainColor:W.Color.blue[900],secondaryColor:W.Color.blue[100],textColor:W.Color.blue[900],fontSize:W.Typography.body.fontSize,fontWeight:W.FontWeight["semi-bold"]},flashing:{logo:{src:"",width:"140px",height:"auto"},backgroundPattern:{srcMobile:"",srcDesktop:"",width:"100%",height:"auto"}}}},z=w,j=w,{DesignToken:_}=e,I={Selfie:{backgroundColor:"#FFF",title:{...e.DesignToken.Typography.h5,color:e.DesignToken.Color.content.primary},countdown:{color:_.Color.semantic.error[400],fontSize:_.Typography.body.fontSize,fontWeight:_.Typography.body.fontWeight,backgroundColor:"transparent",border:"unset",borderRadius:"3px",padding:"0px"},loadingIcon:{src:"",width:"47px",height:"47px"},error:{color:_.Color.semantic.error[400],fontSize:_.Typography.body.fontSize,fontWeight:_.Typography.body.fontWeight,backgroundColor:"transparent",border:"unset",borderRadius:"3px",padding:"5px 10px"},progressCircle:{activeColor:"rgba(52, 152, 211, 1)",innerPadding:3,showDashedRing:!0,showOutsideRing:!1,dashedRingLineThick:"2",dashedRingLineSpacing:"3.5",dashedRingColor:"rgba(193, 197, 204, 1)",dashedRingOpacity:1,insideRingColor:"#fff",insideRingWidth:10,insideRingStrokeDash:"0",outsideRingOpacity:1,outsideRingColor:"#fff",errorRingWidth:0,radius:160,strokeWidth:3,progress:0,showErrorRing:!1,errorRingColor:"#df0000",dashedRingWidth:10,dashedInsideRingColor:"#fff",dashedInsideRingWidth:3,showInsideRing:!0},progressCircleV2:{activeColor:_.Color.blue[900],neutralColor:_.Color.neutral[300],errorColor:_.Color.semantic.error[400],radius:160,strokeWidth:2,progress:0,tickWidth:15,numberOfTicks:200},Active:{instruction:{color:_.Color.content.primary,fontSize:_.Typography.body.fontSize,fontWeight:_.Typography.body.fontWeight,textShadow:"none",backgroundColor:"unset",border:"unset",borderRadius:"unset"},directionIcon:{frontal:"",frontalWidth:"168px",left:"",leftWidth:"150px",right:"",rightWidth:"150px",up:"",upWidth:"150px"},imageHolder:{width:"72px",height:"72px",borderRadius:"50%",border:`3px solid ${_.Color.blue[900]}`,fontSize:"16px",color:"#fff",fontWeight:"700",frontal:"",left:"",right:"",up:"",activeStepBorder:`1px solid ${_.Color.separators.tertiary}`,activeStepBorderRadius:"50%"}}}},O={Selfie:{backgroundColor:"rgba(0, 0, 0, 0.6)",captureIcon:{src:"",width:"50px"},countdown:{color:"#fff",fontSize:"18px",fontWeight:"normal",backgroundColor:"#ea3223",border:"unset",borderRadius:"3px",padding:"5px 10px"},loadingIcon:{src:"",width:"47px",height:"47px"},error:{color:"#fff",fontSize:"18px",fontWeight:"normal",backgroundColor:"#ea3223",border:"unset",borderRadius:"3px",padding:"5px 10px"},progressCircle:{radius:160,strokeWidth:3,progress:0,showErrorRing:!0,activeColor:"#0092ff",innerPadding:5,outsideRingColor:"#f2f6f9",outsideRingOpacity:.1,insideRingColor:"#f2f6f9",insideRingWidth:1,insideRingStrokeDash:"2",errorRingColor:"#df0000",errorRingWidth:1,dashedRingColor:"#ffffff",dashedRingOpacity:.3,dashedRingWidth:10,dashedRingLineThick:1,dashedRingLineSpacing:6,dashedInsideRingColor:"#ffffff",dashedInsideRingWidth:0,showOutsideRing:!1,showDashedRing:!1,showInsideRing:!0},Active:{instruction:{color:"#fff",fontSize:"20px",fontWeight:"normal",textShadow:"2px 2px 4px #000000",backgroundColor:"unset",border:"unset",borderRadius:"unset"},directionIcon:{frontal:"",frontalWidth:"140px",left:"",leftWidth:"80px",right:"",rightWidth:"80px",up:"",upWidth:"80px"},imageHolder:{width:"40px",height:"40px",borderRadius:"50%",border:"2px solid #fff",fontSize:"16px",color:"#fff",fontWeight:"700",frontal:"",left:"",right:"",up:""}}}},A=I,{DesignToken:B}=e,P={PassiveLiveness:{instruction:{color:B.Color.content["on-bg-color"],fontSize:B.Typography.label.fontSize,fontWeight:B.Typography.label.fontWeight,background:"rgba(15, 23, 42, 0.35)",border:"none",borderRadius:"100px",backdropFilter:"blur(28px)",padding:"12px 12px"}}},F=P,q=P,U={closeButton:{top:e.DesignToken.Spacing.base,right:e.DesignToken.Spacing.base,left:"auto",bottom:"auto",display:"block",src:"",width:"24px",height:"auto"},popup:{backgroundColor:e.DesignToken.Color.base.white,padding:"10px",border:"none",borderRadius:e.DesignToken.CornerRadius.sm,overlay:{backgroundColor:e.DesignToken.Color.mask[70]},title:{...e.DesignToken.Typography.h6,fontWeight:e.DesignToken.FontWeight["semi-bold"],color:e.DesignToken.Color.content.primary,textAlign:"center",display:"initial",margin:"25px 0 0 0",padding:"0 0 0 0"},description:{...e.DesignToken.Typography.body,color:e.DesignToken.Color.content.secondary,textAlign:"center",border:"unset",borderRadius:"unset",margin:"30px 0 0 0",padding:"0 0 0 0"},primaryButton:{...e.DesignToken.Typography.body,color:e.DesignToken.Color.base.white,backgroundColor:e.DesignToken.Color.base.blue,borderRadius:e.DesignToken.CornerRadius.xs,border:"none",outline:"none",height:e.DesignToken.Height["3xl"],maxWidth:"unset"},secondaryButton:{...e.DesignToken.Typography.body,color:e.DesignToken.Color.content.primary,backgroundColor:e.DesignToken.Color.background.tertiary,borderRadius:e.DesignToken.CornerRadius.xs,border:"none",outline:"none",height:e.DesignToken.Height["3xl"],maxWidth:"unset"}}},H={v1:{...R,...z,...O,...F,...U},v2:{...S,...j,...A,...q,...U}};function $(){if(rn)return re;rn=1;var r=s();return re=function(){try{var o=r(Object,"defineProperty");return o({},"",{}),o}catch(r){}}()}function E(){if(ri)return rt;ri=1;var r=$();return rt=function(o,e,n){"__proto__"==e&&r?r(o,e,{configurable:!0,enumerable:!0,value:n,writable:!0}):o[e]=n}}function L(){if(rs)return ra;rs=1;var r=E(),o=u();return ra=function(e,n,t){(void 0===t||o(e[n],t))&&(void 0!==t||n in e)||r(e,n,t)}}var M,V,K,N,Q,Y,Z,G,J,X,rr,ro,re,rn,rt,ri,ra,rs,ru,rd,rc,rl,rg,rf,rp,rh,rb,rx,ry,rk,rC,rT,rv,rm,rD,rR,rS,rW,rw,rz,rj,r_,rI,rO,rA,rB,rP,rF,rq,rU,rH,r$,rE,rL,rM,rV,rK,rN,rQ,rY,rZ,rG,rJ,rX,r0,r1,r2,r3,r5,r4,r6,r7,r8,r9,or,oo,oe,on,ot,oi,oa,os,ou,od,oc,ol,og,of,op,oh,ob,ox,oy,ok,oC,oT,ov,om,oD,oR,oS,oW,ow,oz,oj,o_,oI,oO,oA,oB={exports:{}};oB.exports;function oP(){return rD?rm:(rD=1,rm=function(r,o){return function(e){return r(o(e))}})}function oF(){return rS?rR:(rS=1,rR=oP()(Object.getPrototypeOf,Object))}function oq(){if(rw)return rW;rw=1;var r=Object.prototype;return rW=function(o){var e=o&&o.constructor;return o===("function"==typeof e&&e.prototype||r)}}function oU(){if(rA)return rO;rA=1;var r=function(){if(rI)return r_;rI=1;var r=l(),o=g();return r_=function(e){return o(e)&&"[object Arguments]"==r(e)}}(),o=g(),e=Object.prototype,n=e.hasOwnProperty,t=e.propertyIsEnumerable;return rO=r(function(){return arguments}())?r:function(r){return o(r)&&n.call(r,"callee")&&!t.call(r,"callee")}}function oH(){return rP?rB:(rP=1,rB=function(r){return"number"==typeof r&&r>-1&&r%1==0&&r<=0x1fffffffffffff})}function o$(){if(rq)return rF;rq=1;var r=f(),o=oH();return rF=function(e){return null!=e&&o(e.length)&&!r(e)}}var oE={exports:{}};function oL(){var r,o,e,n,t,i,a,s;if(rL)return oE.exports;return rL=1,r=oE,o=oE.exports,e=d(),n=rE?r$:(rE=1,r$=function(){return!1}),s=(a=(i=(t=o&&!o.nodeType&&o)&&r&&!r.nodeType&&r)&&i.exports===t?e.Buffer:void 0)?a.isBuffer:void 0,r.exports=s||n,oE.exports}function oM(){if(rV)return rM;rV=1;var r=l(),o=oF(),e=g(),n=Object.prototype,t=Function.prototype.toString,i=n.hasOwnProperty,a=t.call(Object);return rM=function(n){if(!e(n)||"[object Object]"!=r(n))return!1;var s=o(n);if(null===s)return!0;var u=i.call(s,"constructor")&&s.constructor;return"function"==typeof u&&u instanceof u&&t.call(u)==a}}oE.exports;var oV={exports:{}};oV.exports;function oK(){if(rJ)return rG;rJ=1;var r=function(){if(rN)return rK;rN=1;var r=l(),o=oH(),e=g(),n={};return n["[object Float32Array]"]=n["[object Float64Array]"]=n["[object Int8Array]"]=n["[object Int16Array]"]=n["[object Int32Array]"]=n["[object Uint8Array]"]=n["[object Uint8ClampedArray]"]=n["[object Uint16Array]"]=n["[object Uint32Array]"]=!0,n["[object Arguments]"]=n["[object Array]"]=n["[object ArrayBuffer]"]=n["[object Boolean]"]=n["[object DataView]"]=n["[object Date]"]=n["[object Error]"]=n["[object Function]"]=n["[object Map]"]=n["[object Number]"]=n["[object Object]"]=n["[object RegExp]"]=n["[object Set]"]=n["[object String]"]=n["[object WeakMap]"]=!1,rK=function(t){return e(t)&&o(t.length)&&!!n[r(t)]}}(),o=rY?rQ:(rY=1,rQ=function(r){return function(o){return r(o)}}),e=function(){var r,o,e,n,t,i;if(rZ)return oV.exports;return rZ=1,r=oV,o=oV.exports,e=p(),i=(t=(n=o&&!o.nodeType&&o)&&r&&!r.nodeType&&r)&&t.exports===n&&e.process,r.exports=function(){try{var r=t&&t.require&&t.require("util").types;if(r)return r;return i&&i.binding&&i.binding("util")}catch(r){}}(),oV.exports}(),n=e&&e.isTypedArray;return rG=n?o(n):r}function oN(){return r0?rX:(r0=1,rX=function(r,o){if("constructor"!==o||"function"!=typeof r[o]){if("__proto__"!=o)return r[o]}})}function oQ(){if(r5)return r3;r5=1;var r=function(){if(r2)return r1;r2=1;var r=E(),o=u(),e=Object.prototype.hasOwnProperty;return r1=function(n,t,i){var a=n[t];e.call(n,t)&&o(a,i)&&(void 0!==i||t in n)||r(n,t,i)}}(),o=E();return r3=function(e,n,t,i){var a=!t;t||(t={});for(var s=-1,u=n.length;++s<u;){var d=n[s],c=i?i(t[d],e[d],d,t,e):void 0;void 0===c&&(c=e[d]),a?o(t,d,c):r(t,d,c)}return t}}function oY(){if(r8)return r7;r8=1;var r=/^(?:0|[1-9]\d*)$/;return r7=function(o,e){var n=typeof o;return!!(e=null==e?0x1fffffffffffff:e)&&("number"==n||"symbol"!=n&&r.test(o))&&o>-1&&o%1==0&&o<e}}function oZ(){if(or)return r9;or=1;var r=r6?r4:(r6=1,r4=function(r,o){for(var e=-1,n=Array(r);++e<r;)n[e]=o(e);return n}),o=oU(),e=h(),n=oL(),t=oY(),i=oK(),a=Object.prototype.hasOwnProperty;return r9=function(s,u){var d=e(s),c=!d&&o(s),l=!d&&!c&&n(s),g=!d&&!c&&!l&&i(s),f=d||c||l||g,p=f?r(s.length,String):[],h=p.length;for(var b in s)(u||a.call(s,b))&&!(f&&("length"==b||l&&("offset"==b||"parent"==b)||g&&("buffer"==b||"byteLength"==b||"byteOffset"==b)||t(b,h)))&&p.push(b);return p}}function oG(){if(oa)return oi;oa=1;var r=oZ(),o=function(){if(ot)return on;ot=1;var r=c(),o=oq(),e=oe?oo:(oe=1,oo=function(r){var o=[];if(null!=r)for(var e in Object(r))o.push(e);return o}),n=Object.prototype.hasOwnProperty;return on=function(t){if(!r(t))return e(t);var i=o(t),a=[];for(var s in t)"constructor"==s&&(i||!n.call(t,s))||a.push(s);return a}}(),e=o$();return oi=function(n){return e(n)?r(n,!0):o(n)}}function oJ(){return op?of:(op=1,of=function(r){return r})}function oX(){return ob?oh:(ob=1,oh=function(r,o,e){switch(e.length){case 0:return r.call(o);case 1:return r.call(o,e[0]);case 2:return r.call(o,e[0],e[1]);case 3:return r.call(o,e[0],e[1],e[2])}return r.apply(o,e)})}function o0(){if(ow)return oW;ow=1;var r=oJ(),o=function(){if(oy)return ox;oy=1;var r=oX(),o=Math.max;return ox=function(e,n,t){return n=o(void 0===n?e.length-1:n,0),function(){for(var i=arguments,a=-1,s=o(i.length-n,0),u=Array(s);++a<s;)u[a]=i[n+a];a=-1;for(var d=Array(n+1);++a<n;)d[a]=i[a];return d[n]=t(u),r(e,this,d)}}}(),e=function(){if(oS)return oR;oS=1;var r=function(){if(ov)return oT;ov=1;var r=oC?ok:(oC=1,ok=function(r){return function(){return r}}),o=$(),e=oJ();return oT=o?function(e,n){return o(e,"toString",{configurable:!0,enumerable:!1,value:r(n),writable:!0})}:e}();return oR=(function(){if(oD)return om;oD=1;var r=Date.now;return om=function(o){var e=0,n=0;return function(){var t=r(),i=16-(t-n);if(n=t,i>0){if(++e>=800)return arguments[0]}else e=0;return o.apply(void 0,arguments)}}})()(r)}();return oW=function(n,t){return e(o(n,t,r),n+"")}}function o1(){if(oj)return oz;oj=1;var r=u(),o=o$(),e=oY(),n=c();return oz=function(t,i,a){if(!n(a))return!1;var s=typeof i;return("number"==s?!!(o(a)&&e(i,a.length)):"string"==s&&i in a)&&r(a[i],t)}}function o2(){if(oI)return o_;oI=1;var r=o0(),o=o1();return o_=function(e){return r(function(r,n){var t=-1,i=n.length,a=i>1?n[i-1]:void 0,s=i>2?n[2]:void 0;for(a=e.length>3&&"function"==typeof a?(i--,a):void 0,s&&o(n[0],n[1],s)&&(a=i<3?void 0:a,i=1),r=Object(r);++t<i;){var u=n[t];u&&e(r,u,t,a)}return r})}}var o3=b(function(){if(oA)return oO;oA=1;var r=function(){if(og)return ol;og=1;var r=function(){if(ro)return rr;ro=1;var r=t(),o=function(){if(V)return M;V=1;var r=t();return M=function(){this.__data__=new r,this.size=0}}(),e=N?K:(N=1,K=function(r){var o=this.__data__,e=o.delete(r);return this.size=o.size,e}),n=Y?Q:(Y=1,Q=function(r){return this.__data__.get(r)}),s=G?Z:(G=1,Z=function(r){return this.__data__.has(r)}),u=function(){if(X)return J;X=1;var r=t(),o=i(),e=a();return J=function(n,t){var i=this.__data__;if(i instanceof r){var a=i.__data__;if(!o||a.length<199)return a.push([n,t]),this.size=++i.size,this;i=this.__data__=new e(a)}return i.set(n,t),this.size=i.size,this}}();function d(o){var e=this.__data__=new r(o);this.size=e.size}return d.prototype.clear=o,d.prototype.delete=e,d.prototype.get=n,d.prototype.has=s,d.prototype.set=u,rr=d}(),o=L(),e=rl?rc:(rl=1,rc=(rd?ru:(rd=1,ru=function(r){return function(o,e,n){for(var t=-1,i=Object(o),a=n(o),s=a.length;s--;){var u=a[r?s:++t];if(!1===e(i[u],u,i))break}return o}}))()),n=function(){if(oc)return od;oc=1;var r=L(),o=function(){var r,o,e,n,t,i,a;if(rg)return oB.exports;return rg=1,r=oB,o=oB.exports,e=d(),a=(i=(t=(n=o&&!o.nodeType&&o)&&r&&!r.nodeType&&r)&&t.exports===n?e.Buffer:void 0)?i.allocUnsafe:void 0,r.exports=function(r,o){if(o)return r.slice();var e=r.length,n=a?a(e):new r.constructor(e);return r.copy(n),n},oB.exports}(),e=function(){if(ry)return rx;ry=1;var r=function(){if(rb)return rh;rb=1;var r=rp?rf:(rp=1,rf=d().Uint8Array);return rh=function(o){var e=new o.constructor(o.byteLength);return new r(e).set(new r(o)),e}}();return rx=function(o,e){var n=e?r(o.buffer):o.buffer;return new o.constructor(n,o.byteOffset,o.length)}}(),n=rC?rk:(rC=1,rk=function(r,o){var e=-1,n=r.length;for(o||(o=Array(n));++e<n;)o[e]=r[e];return o}),t=function(){if(rj)return rz;rj=1;var r=function(){if(rv)return rT;rv=1;var r=c(),o=Object.create;return rT=function(){function e(){}return function(n){if(!r(n))return{};if(o)return o(n);e.prototype=n;var t=new e;return e.prototype=void 0,t}}()}(),o=oF(),e=oq();return rz=function(n){return"function"!=typeof n.constructor||e(n)?{}:r(o(n))}}(),i=oU(),a=h(),s=function(){if(rH)return rU;rH=1;var r=o$(),o=g();return rU=function(e){return o(e)&&r(e)}}(),u=oL(),l=f(),p=c(),b=oM(),x=oK(),y=oN(),k=function(){if(ou)return os;ou=1;var r=oQ(),o=oG();return os=function(e){return r(e,o(e))}}();return od=function(d,c,g,f,h,C,T){var v=y(d,g),m=y(c,g),D=T.get(m);if(D)return void r(d,g,D);var R=C?C(v,m,g+"",d,c,T):void 0,S=void 0===R;if(S){var W=a(m),w=!W&&u(m),z=!W&&!w&&x(m);R=m,W||w||z?a(v)?R=v:s(v)?R=n(v):w?(S=!1,R=o(m,!0)):z?(S=!1,R=e(m,!0)):R=[]:b(m)||i(m)?(R=v,i(v)?R=k(v):(!p(v)||l(v))&&(R=t(m))):S=!1}S&&(T.set(m,R),h(R,m,f,C,T),T.delete(m)),r(d,g,R)}}(),s=c(),u=oG(),l=oN();return ol=function t(i,a,d,c,g){i!==a&&e(a,function(e,u){if(g||(g=new r),s(e))n(i,a,u,d,t,c,g);else{var f=c?c(l(i,u),e,u+"",i,a,g):void 0;void 0===f&&(f=e),o(i,u,f)}},u)}}();return oO=o2()(function(o,e,n){r(o,e,n)})}());let o5=r=>{let{customTheme:e,clientSettings:n,themeVersion:t,uiSettings:i,defaultThemes:a=H}=r,s=x.getWebSetting(n,"data.settings.sdk_settings.ui_custom_settings");return o.useMemo(()=>{let r=y.selectUiSettings(i,s);return{...o3({},y.mapUISettingsToCustomTheme(r),e),themeVersion:t,defaultThemes:a}},[e,a,t,i,s])},o4=()=>{},o6=o.createContext({onDoneCallback:o4,onErrorCallback:o4,onCloseCallback:o4}),o7=({children:e,onDone:n=o4,onError:t=o4,onClose:i=o4})=>{let a=o.useCallback(r=>{n&&n(r)},[n]),s=o.useCallback(r=>{t&&t(r)},[t]),u=o.useCallback(()=>{i&&i()},[i]),d=o.useMemo(()=>({onDoneCallback:a,onErrorCallback:s,onCloseCallback:u}),[a,s,u]);return r.jsx(o6.Provider,{value:d,children:e})},o8=()=>{let r=o.useContext(o6);if(void 0===r)throw Error("useSDKCallback must be used within a SDKCallbackProvider");return r},o9=o.createContext(""),er=({children:o,isWrappedBy:e=""})=>r.jsx(o9.Provider,{value:e,children:o}),eo=()=>o.useContext(o9);export{C as D,o7 as S,er as W,T as a,eo as b,o5 as c,D as d,H as e,o2 as f,oG as g,oM as h,o0 as i,oX as j,oP as k,oq as l,o3 as m,oZ as n,o$ as o,o1 as p,oQ as r,v as t,o8 as u};
|
|
1
|
+
import{j as r,r as o,s as e,$ as n,ab as t,ac as i,ad as a,ae as s,af as u,ag as d,ah as c,ai as l,aj as g,ak as f,al as p,am as h,Y as b,u as x,an as y}from"./chunk-27713cdc.js";let k=o.createContext(!1),C=({children:o,debug:e=!1})=>r.jsx(k.Provider,{value:e,children:o}),T=()=>o.useContext(k),v={tsBlue:"#0276f1",tsSecondary:"rgba(0, 47, 117, 0.6)"},m={IDCapturing:{backgroundColor:"rgba(0, 0, 0, 0.6)",titleFront:{color:"#fff",fontSize:"20px",fontWeight:"normal",backgroundColor:"unset"},titleBack:{color:"#fff",fontSize:"20px",fontWeight:"normal",backgroundColor:"unset"},instruction:{padding:"unset",color:"#fff",fontSize:"16px",fontWeight:"normal",backgroundColor:"unset",border:"unset",borderRadius:"unset"},captureInstruction:{capturing:{padding:"12px 12px",color:"#ffffff",fontSize:"14px",fontWeight:"normal",background:"rgba(15, 23, 42, 0.25)",border:"none",borderRadius:"100px"},captured:{padding:"12px 12px",color:"#ffffff",fontSize:"14px",fontWeight:"normal",background:"rgba(15, 23, 42, 0.25)",border:"none",borderRadius:"100px"}},error:{padding:"5px 10px",color:"#fff",fontSize:"16px",fontWeight:"normal",backgroundColor:"#ea3223",border:"unset",borderRadius:"3px"},toggle:{color:"#d1d1d1",fontSize:"16px",fontWeight:"500",gap:"16px",backgroundColor:"#fff",active:{backgroundColor:"#2196f3"},inactive:{backgroundColor:"#ccc"}},countdown:{color:"#fff",fontSize:"18px",fontWeight:"normal",backgroundColor:"#ea3223",border:"unset",borderRadius:"3px"},cardIcon:{src:"",width:"auto",height:"38px"},captureIcon:{src:"",width:"60px",height:"60px",disabled:{src:""}},loadingIcon:{src:"",width:"100px",height:"100px"},rectangleMask:{width:600,height:400,strokeWidth:2,strokeStyles:{},radius:10,paddingStyle:{fill:"rgba(0, 0, 0, 0.6)"},default:{fill:"none",stroke:"#fff",strokeWidth:2,strokeDasharray:"7, 4",opacity:.6},error:{fill:"rgba(234,50,35, 0.1)",strokeWidth:2,stroke:"#ea3223"}}},IDConfirmPopup:{image:{borderRadius:"5px"}},IDUploadButton:{background:"rgba(255, 255, 255, 0.2)",border:"1px solid rgba(255, 255, 255, 0.25)",borderRadius:"8px",color:"#ffffff",padding:"12px",leftOffset:"24px",focusOutlineColor:"#ffffff"},IDUploadErrorToast:{background:"rgba(0, 0, 0, 0.75)",color:"#ffffff",borderRadius:"8px",fontSize:"14px",padding:"10px 16px",maxWidthInset:"48px"},QRStep:{title:{color:"#fff",fontSize:"20px",fontWeight:"700",backgroundColor:"unset"},guidelinePopup:{image:{src:"",borderRadius:"5px",backgroundColor:"#e7e6e6"},guideText:{color:v.tsSecondary,fontSize:"16px",fontWeight:"normal",textAlign:"center",lineHeight:"20px"},countdownText:{color:v.tsSecondary,fontSize:"16px",fontWeight:"normal",textAlign:"center",lineHeight:"20px"}},scanTooltip:{backgroundColor:"#00ce78",borderRadius:"8px",color:"#fff",padding:"10px",textAlign:"center"},scanCountdown:{textAlign:"center",color:"#fff",fontSize:"18px",fontWeight:"normal",backgroundColor:"#ea3223",border:"none",borderRadius:"3px",padding:"5px 10px"},invalidPopup:{padding:"10px",title:{display:"block",color:v.tsSecondary,fontSize:"16px",fontWeight:"bold",margin:"25px 0 0 0",padding:"0 0 0 0"},description:{color:v.tsSecondary,fontSize:"16px",fontWeight:"normal",textAlign:"center",margin:"30px 0 0 0",padding:"0 0 0 0"},retryButton:{color:"#fff",fontSize:"1rem",fontWeight:"normal",backgroundColor:v.tsBlue,border:"none",borderRadius:"3px",outline:"none",height:"66px",margin:"30px 0 0 0"},skipButton:{color:v.tsBlue,fontSize:"1rem",fontWeight:"normal",backgroundColor:"unset",border:"none",borderRadius:"unset",outline:"none",height:"unset",margin:"20px 0"}},resultText:{success:{textColor:"#000",fontSize:"1rem",fontWeight:"normal",mainColor:"#34ce60"},error:{textColor:"#000",fontSize:"1rem",fontWeight:"normal",mainColor:"#ff9532"}}}},D={IDCapturing:{backgroundColor:"rgba(0, 0, 0, 0.6)",titleFront:{...e.DesignToken.Typography.h4,color:e.DesignToken.Color.base.white,backgroundColor:"unset"},titleBack:{...e.DesignToken.Typography.h4,color:e.DesignToken.Color.base.white,backgroundColor:"unset"},instruction:{...e.DesignToken.Typography.body,padding:"5px 10px",color:"rgba(255, 255, 255, 0.8)",backgroundColor:"unset",border:"unset",borderRadius:"unset"},captureInstruction:{capturing:{...e.DesignToken.Typography.label,color:e.DesignToken.Color.base.white,padding:`6px ${e.DesignToken.Spacing.sm}`,background:"rgba(15, 23, 42, 0.35)",border:"none",borderRadius:"100px"},captured:{...e.DesignToken.Typography.label,color:e.DesignToken.Color.base.white,padding:`6px ${e.DesignToken.Spacing.sm}`,background:"rgba(15, 23, 42, 0.35)",border:"none",borderRadius:"100px"}},error:{...e.DesignToken.Typography.body,padding:"5px 10px",color:e.DesignToken.Color.semantic.error[400],backgroundColor:"transparent",border:"unset",borderRadius:e.DesignToken.CornerRadius["2xs"]},toggle:{...e.DesignToken.Typography.body,color:e.DesignToken.Color.base.white,gap:e.DesignToken.Spacing.base,backgroundColor:e.DesignToken.Color.base.white,active:{backgroundColor:e.DesignToken.Color.base.blue},inactive:{backgroundColor:e.DesignToken.Color.neutral[300]}},countdown:{...e.DesignToken.Typography.body,color:e.DesignToken.Color.semantic.error[400],backgroundColor:"transparent",border:"unset",borderRadius:e.DesignToken.CornerRadius["2xs"]},cardIcon:{src:"",width:"auto",height:"38px"},captureIcon:{src:"",width:e.DesignToken.Height["7xl"],height:e.DesignToken.Height["7xl"],disabled:{src:""}},loadingIcon:{src:"",width:"47px",height:"47px"},rectangleMask:{width:600,height:400,strokeWidth:n.getCSSNumericValue(e.DesignToken.BorderWidth["3xl"]),strokeStyles:{},radius:n.getCSSNumericValue(e.DesignToken.CornerRadius.base),paddingStyle:{fill:"rgba(0, 0, 0, 0.6)"},default:{fill:"none",stroke:e.DesignToken.Color.neutral[400],strokeWidth:n.getCSSNumericValue(e.DesignToken.BorderWidth["3xl"])},error:{fill:"none",strokeWidth:n.getCSSNumericValue(e.DesignToken.BorderWidth["3xl"]),stroke:e.DesignToken.Color.semantic.error[400]}}},IDConfirmPopup:{image:{borderRadius:e.DesignToken.CornerRadius["2xs"]}},IDUploadButton:{background:"rgba(255, 255, 255, 0.2)",border:"1px solid rgba(255, 255, 255, 0.25)",borderRadius:e.DesignToken.CornerRadius.xs,color:e.DesignToken.Color.base.white,padding:e.DesignToken.Spacing.sm,leftOffset:"24px",focusOutlineColor:e.DesignToken.Color.base.white},IDUploadErrorToast:{background:"rgba(0, 0, 0, 0.75)",color:e.DesignToken.Color.base.white,borderRadius:e.DesignToken.CornerRadius.xs,fontSize:"14px",padding:"10px 16px",maxWidthInset:"48px"},QRStep:{title:{...e.DesignToken.Typography.h4,backgroundColor:"unset"},guidelinePopup:{image:{src:"",borderRadius:e.DesignToken.CornerRadius["2xs"],backgroundColor:"transparent"},guideText:{...e.DesignToken.Typography.body,color:e.DesignToken.Color.neutral[600],textAlign:"center"},countdownText:{...e.DesignToken.UIText.medium,color:e.DesignToken.Color.neutral[500],textAlign:"center"}},scanTooltip:{backgroundColor:"transparent",borderRadius:e.DesignToken.CornerRadius.xs,color:e.DesignToken.Color.base.white,padding:"10px",textAlign:"center"},scanCountdown:{...e.DesignToken.Typography.body,color:e.DesignToken.Color.semantic.error[400],textAlign:"center",backgroundColor:"transparent",border:"none",borderRadius:e.DesignToken.CornerRadius["2xs"],padding:"0px"},invalidPopup:{padding:"10px",title:{...e.DesignToken.Typography.h6,color:e.DesignToken.Color.content.primary,display:"none",margin:"25px 0 0 0",padding:"0 0 0 0"},description:{...e.DesignToken.Typography.body,color:e.DesignToken.Color.content.secondary,textAlign:"center",margin:"30px 0 0 0",padding:"0 0 0 0"},retryButton:{...e.DesignToken.Typography.body,color:e.DesignToken.Color.base.white,backgroundColor:e.DesignToken.Color.base.blue,borderRadius:e.DesignToken.CornerRadius.xs,border:"none",outline:"none",height:e.DesignToken.Height["3xl"],margin:"24px 0 0 0"},skipButton:{...e.DesignToken.Typography.body,color:e.DesignToken.Color.content.primary,backgroundColor:e.DesignToken.Color.background.tertiary,borderRadius:e.DesignToken.CornerRadius.xs,border:"none",outline:"none",height:e.DesignToken.Height["3xl"],margin:"12px 0"}},resultText:{success:{...e.DesignToken.Typography.body,textColor:e.DesignToken.Color.content.primary,mainColor:e.DesignToken.Color.semantic.success[400]},error:{...e.DesignToken.Typography.body,textColor:e.DesignToken.Color.content.primary,mainColor:e.DesignToken.Color.semantic.warning[500]}}}},R=m,S=D,{DesignToken:W}=e,w={FlashLiveness:{maskFill:"#fff",mask:{strokeColor:W.Color.separators.secondary,strokeColorError:W.Color.semantic.error[400],strokeWidth:4,path:"M118.5 2.5C54.2233 2.5 2.5 59.5579 2.5 129.447C2.5 146.072 3.68394 172.618 8.16415 200.483C12.6369 228.301 20.4309 257.673 33.7816 279.787C46.9667 301.626 59.6817 317.047 73.3658 327.003C87.1207 337.011 101.735 341.41 118.5 341.41C135.265 341.41 149.879 337.011 163.634 327.003C177.318 317.047 190.033 301.626 203.218 279.787C216.569 257.673 224.363 228.301 228.836 200.483C233.316 172.618 234.5 146.072 234.5 129.447C234.5 59.5579 182.777 2.5 118.5 2.5Z",width:237,height:344},title:{hidden:!1,height:"auto",color:W.Color.content.primary,fontSize:W.Typography.h5.fontSize,fontWeight:W.Typography.h5.fontWeight,lineHeight:W.Typography.h5.lineHeight},guideline:{text:{close:{color:W.Color.content.primary,fontSize:W.Typography.h6.fontSize,fontWeight:W.FontWeight["semi-bold"],background:W.Color.background.secondary,border:`${W.BorderWidth.base} solid ${W.Color.separators.tertiary}`,borderRadius:"100px",padding:"12px 16px"},far:{color:W.Color.content.primary,fontSize:W.Typography.h6.fontSize,fontWeight:W.FontWeight["semi-bold"],background:W.Color.background.secondary,border:`${W.BorderWidth.base} solid ${W.Color.separators.tertiary}`,borderRadius:"100px",padding:"12px 16px"},flashing:{color:W.Color.content["on-bg-color"],fontSize:W.Typography.label.fontSize,fontWeight:W.Typography.label.fontWeight,background:"rgba(15, 23, 42, 0.35)",border:"none",borderRadius:"100px",padding:"12px 16px"}},icon:{color:W.Color.blue[900],src:""}},instruction:{color:W.Color.content["on-bg-color"],fontSize:W.Typography.label.fontSize,fontWeight:W.Typography.label.fontWeight,background:"rgba(15, 23, 42, 0.35)",border:"none",borderRadius:"100px",backdropFilter:"blur(28px)",maxWidth:"200px"},timeoutText:{color:W.Color.semantic.error[400],fontSize:W.Typography.body.fontSize,fontWeight:W.Typography.body.fontWeight,padding:"0"},errorOverlay:{backgroundColor:"transparent",opacity:0},progressBar:{mainColor:W.Color.blue[900],secondaryColor:W.Color.blue[100],textColor:W.Color.blue[900],fontSize:W.Typography.body.fontSize,fontWeight:W.FontWeight["semi-bold"]},flashing:{logo:{src:"",width:"140px",height:"auto"},backgroundPattern:{srcMobile:"",srcDesktop:"",width:"100%",height:"auto"}}}},z=w,j=w,{DesignToken:_}=e,I={Selfie:{backgroundColor:"#FFF",title:{...e.DesignToken.Typography.h5,color:e.DesignToken.Color.content.primary},countdown:{color:_.Color.semantic.error[400],fontSize:_.Typography.body.fontSize,fontWeight:_.Typography.body.fontWeight,backgroundColor:"transparent",border:"unset",borderRadius:"3px",padding:"0px"},loadingIcon:{src:"",width:"47px",height:"47px"},error:{color:_.Color.semantic.error[400],fontSize:_.Typography.body.fontSize,fontWeight:_.Typography.body.fontWeight,backgroundColor:"transparent",border:"unset",borderRadius:"3px",padding:"5px 10px"},progressCircle:{activeColor:"rgba(52, 152, 211, 1)",innerPadding:3,showDashedRing:!0,showOutsideRing:!1,dashedRingLineThick:"2",dashedRingLineSpacing:"3.5",dashedRingColor:"rgba(193, 197, 204, 1)",dashedRingOpacity:1,insideRingColor:"#fff",insideRingWidth:10,insideRingStrokeDash:"0",outsideRingOpacity:1,outsideRingColor:"#fff",errorRingWidth:0,radius:160,strokeWidth:3,progress:0,showErrorRing:!1,errorRingColor:"#df0000",dashedRingWidth:10,dashedInsideRingColor:"#fff",dashedInsideRingWidth:3,showInsideRing:!0},progressCircleV2:{activeColor:_.Color.blue[900],neutralColor:_.Color.neutral[300],errorColor:_.Color.semantic.error[400],radius:160,strokeWidth:2,progress:0,tickWidth:15,numberOfTicks:200},Active:{instruction:{color:_.Color.content.primary,fontSize:_.Typography.body.fontSize,fontWeight:_.Typography.body.fontWeight,textShadow:"none",backgroundColor:"unset",border:"unset",borderRadius:"unset"},directionIcon:{frontal:"",frontalWidth:"168px",left:"",leftWidth:"150px",right:"",rightWidth:"150px",up:"",upWidth:"150px"},imageHolder:{width:"72px",height:"72px",borderRadius:"50%",border:`3px solid ${_.Color.blue[900]}`,fontSize:"16px",color:"#fff",fontWeight:"700",frontal:"",left:"",right:"",up:"",activeStepBorder:`1px solid ${_.Color.separators.tertiary}`,activeStepBorderRadius:"50%"}}}},O={Selfie:{backgroundColor:"rgba(0, 0, 0, 0.6)",captureIcon:{src:"",width:"50px"},countdown:{color:"#fff",fontSize:"18px",fontWeight:"normal",backgroundColor:"#ea3223",border:"unset",borderRadius:"3px",padding:"5px 10px"},loadingIcon:{src:"",width:"47px",height:"47px"},error:{color:"#fff",fontSize:"18px",fontWeight:"normal",backgroundColor:"#ea3223",border:"unset",borderRadius:"3px",padding:"5px 10px"},progressCircle:{radius:160,strokeWidth:3,progress:0,showErrorRing:!0,activeColor:"#0092ff",innerPadding:5,outsideRingColor:"#f2f6f9",outsideRingOpacity:.1,insideRingColor:"#f2f6f9",insideRingWidth:1,insideRingStrokeDash:"2",errorRingColor:"#df0000",errorRingWidth:1,dashedRingColor:"#ffffff",dashedRingOpacity:.3,dashedRingWidth:10,dashedRingLineThick:1,dashedRingLineSpacing:6,dashedInsideRingColor:"#ffffff",dashedInsideRingWidth:0,showOutsideRing:!1,showDashedRing:!1,showInsideRing:!0},Active:{instruction:{color:"#fff",fontSize:"20px",fontWeight:"normal",textShadow:"2px 2px 4px #000000",backgroundColor:"unset",border:"unset",borderRadius:"unset"},directionIcon:{frontal:"",frontalWidth:"140px",left:"",leftWidth:"80px",right:"",rightWidth:"80px",up:"",upWidth:"80px"},imageHolder:{width:"40px",height:"40px",borderRadius:"50%",border:"2px solid #fff",fontSize:"16px",color:"#fff",fontWeight:"700",frontal:"",left:"",right:"",up:""}}}},A=I,{DesignToken:B}=e,P={PassiveLiveness:{instruction:{color:B.Color.content["on-bg-color"],fontSize:B.Typography.label.fontSize,fontWeight:B.Typography.label.fontWeight,background:"rgba(15, 23, 42, 0.35)",border:"none",borderRadius:"100px",backdropFilter:"blur(28px)",padding:"12px 12px"}}},F=P,q=P,U={closeButton:{top:e.DesignToken.Spacing.base,right:e.DesignToken.Spacing.base,left:"auto",bottom:"auto",display:"block",src:"",width:"24px",height:"auto"},popup:{backgroundColor:e.DesignToken.Color.base.white,padding:"10px",border:"none",borderRadius:e.DesignToken.CornerRadius.sm,overlay:{backgroundColor:e.DesignToken.Color.mask[70]},title:{...e.DesignToken.Typography.h6,fontWeight:e.DesignToken.FontWeight["semi-bold"],color:e.DesignToken.Color.content.primary,textAlign:"center",display:"initial",margin:"25px 0 0 0",padding:"0 0 0 0"},description:{...e.DesignToken.Typography.body,color:e.DesignToken.Color.content.secondary,textAlign:"center",border:"unset",borderRadius:"unset",margin:"30px 0 0 0",padding:"0 0 0 0"},primaryButton:{...e.DesignToken.Typography.body,color:e.DesignToken.Color.base.white,backgroundColor:e.DesignToken.Color.base.blue,borderRadius:e.DesignToken.CornerRadius.xs,border:"none",outline:"none",height:e.DesignToken.Height["3xl"],maxWidth:"unset"},secondaryButton:{...e.DesignToken.Typography.body,color:e.DesignToken.Color.content.primary,backgroundColor:e.DesignToken.Color.background.tertiary,borderRadius:e.DesignToken.CornerRadius.xs,border:"none",outline:"none",height:e.DesignToken.Height["3xl"],maxWidth:"unset"}}},H={v1:{...R,...z,...O,...F,...U},v2:{...S,...j,...A,...q,...U}};function $(){if(rn)return re;rn=1;var r=s();return re=function(){try{var o=r(Object,"defineProperty");return o({},"",{}),o}catch(r){}}()}function E(){if(ri)return rt;ri=1;var r=$();return rt=function(o,e,n){"__proto__"==e&&r?r(o,e,{configurable:!0,enumerable:!0,value:n,writable:!0}):o[e]=n}}function L(){if(rs)return ra;rs=1;var r=E(),o=u();return ra=function(e,n,t){(void 0===t||o(e[n],t))&&(void 0!==t||n in e)||r(e,n,t)}}var M,V,K,N,Q,Y,Z,G,J,X,rr,ro,re,rn,rt,ri,ra,rs,ru,rd,rc,rl,rg,rf,rp,rh,rb,rx,ry,rk,rC,rT,rv,rm,rD,rR,rS,rW,rw,rz,rj,r_,rI,rO,rA,rB,rP,rF,rq,rU,rH,r$,rE,rL,rM,rV,rK,rN,rQ,rY,rZ,rG,rJ,rX,r0,r1,r2,r3,r5,r4,r6,r7,r8,r9,or,oo,oe,on,ot,oi,oa,os,ou,od,oc,ol,og,of,op,oh,ob,ox,oy,ok,oC,oT,ov,om,oD,oR,oS,oW,ow,oz,oj,o_,oI,oO,oA,oB={exports:{}};oB.exports;function oP(){return rD?rm:(rD=1,rm=function(r,o){return function(e){return r(o(e))}})}function oF(){return rS?rR:(rS=1,rR=oP()(Object.getPrototypeOf,Object))}function oq(){if(rw)return rW;rw=1;var r=Object.prototype;return rW=function(o){var e=o&&o.constructor;return o===("function"==typeof e&&e.prototype||r)}}function oU(){if(rA)return rO;rA=1;var r=function(){if(rI)return r_;rI=1;var r=l(),o=g();return r_=function(e){return o(e)&&"[object Arguments]"==r(e)}}(),o=g(),e=Object.prototype,n=e.hasOwnProperty,t=e.propertyIsEnumerable;return rO=r(function(){return arguments}())?r:function(r){return o(r)&&n.call(r,"callee")&&!t.call(r,"callee")}}function oH(){return rP?rB:(rP=1,rB=function(r){return"number"==typeof r&&r>-1&&r%1==0&&r<=0x1fffffffffffff})}function o$(){if(rq)return rF;rq=1;var r=f(),o=oH();return rF=function(e){return null!=e&&o(e.length)&&!r(e)}}var oE={exports:{}};function oL(){var r,o,e,n,t,i,a,s;if(rL)return oE.exports;return rL=1,r=oE,o=oE.exports,e=d(),n=rE?r$:(rE=1,r$=function(){return!1}),s=(a=(i=(t=o&&!o.nodeType&&o)&&r&&!r.nodeType&&r)&&i.exports===t?e.Buffer:void 0)?a.isBuffer:void 0,r.exports=s||n,oE.exports}function oM(){if(rV)return rM;rV=1;var r=l(),o=oF(),e=g(),n=Object.prototype,t=Function.prototype.toString,i=n.hasOwnProperty,a=t.call(Object);return rM=function(n){if(!e(n)||"[object Object]"!=r(n))return!1;var s=o(n);if(null===s)return!0;var u=i.call(s,"constructor")&&s.constructor;return"function"==typeof u&&u instanceof u&&t.call(u)==a}}oE.exports;var oV={exports:{}};oV.exports;function oK(){if(rJ)return rG;rJ=1;var r=function(){if(rN)return rK;rN=1;var r=l(),o=oH(),e=g(),n={};return n["[object Float32Array]"]=n["[object Float64Array]"]=n["[object Int8Array]"]=n["[object Int16Array]"]=n["[object Int32Array]"]=n["[object Uint8Array]"]=n["[object Uint8ClampedArray]"]=n["[object Uint16Array]"]=n["[object Uint32Array]"]=!0,n["[object Arguments]"]=n["[object Array]"]=n["[object ArrayBuffer]"]=n["[object Boolean]"]=n["[object DataView]"]=n["[object Date]"]=n["[object Error]"]=n["[object Function]"]=n["[object Map]"]=n["[object Number]"]=n["[object Object]"]=n["[object RegExp]"]=n["[object Set]"]=n["[object String]"]=n["[object WeakMap]"]=!1,rK=function(t){return e(t)&&o(t.length)&&!!n[r(t)]}}(),o=rY?rQ:(rY=1,rQ=function(r){return function(o){return r(o)}}),e=function(){var r,o,e,n,t,i;if(rZ)return oV.exports;return rZ=1,r=oV,o=oV.exports,e=p(),i=(t=(n=o&&!o.nodeType&&o)&&r&&!r.nodeType&&r)&&t.exports===n&&e.process,r.exports=function(){try{var r=t&&t.require&&t.require("util").types;if(r)return r;return i&&i.binding&&i.binding("util")}catch(r){}}(),oV.exports}(),n=e&&e.isTypedArray;return rG=n?o(n):r}function oN(){return r0?rX:(r0=1,rX=function(r,o){if("constructor"!==o||"function"!=typeof r[o]){if("__proto__"!=o)return r[o]}})}function oQ(){if(r5)return r3;r5=1;var r=function(){if(r2)return r1;r2=1;var r=E(),o=u(),e=Object.prototype.hasOwnProperty;return r1=function(n,t,i){var a=n[t];e.call(n,t)&&o(a,i)&&(void 0!==i||t in n)||r(n,t,i)}}(),o=E();return r3=function(e,n,t,i){var a=!t;t||(t={});for(var s=-1,u=n.length;++s<u;){var d=n[s],c=i?i(t[d],e[d],d,t,e):void 0;void 0===c&&(c=e[d]),a?o(t,d,c):r(t,d,c)}return t}}function oY(){if(r8)return r7;r8=1;var r=/^(?:0|[1-9]\d*)$/;return r7=function(o,e){var n=typeof o;return!!(e=null==e?0x1fffffffffffff:e)&&("number"==n||"symbol"!=n&&r.test(o))&&o>-1&&o%1==0&&o<e}}function oZ(){if(or)return r9;or=1;var r=r6?r4:(r6=1,r4=function(r,o){for(var e=-1,n=Array(r);++e<r;)n[e]=o(e);return n}),o=oU(),e=h(),n=oL(),t=oY(),i=oK(),a=Object.prototype.hasOwnProperty;return r9=function(s,u){var d=e(s),c=!d&&o(s),l=!d&&!c&&n(s),g=!d&&!c&&!l&&i(s),f=d||c||l||g,p=f?r(s.length,String):[],h=p.length;for(var b in s)(u||a.call(s,b))&&!(f&&("length"==b||l&&("offset"==b||"parent"==b)||g&&("buffer"==b||"byteLength"==b||"byteOffset"==b)||t(b,h)))&&p.push(b);return p}}function oG(){if(oa)return oi;oa=1;var r=oZ(),o=function(){if(ot)return on;ot=1;var r=c(),o=oq(),e=oe?oo:(oe=1,oo=function(r){var o=[];if(null!=r)for(var e in Object(r))o.push(e);return o}),n=Object.prototype.hasOwnProperty;return on=function(t){if(!r(t))return e(t);var i=o(t),a=[];for(var s in t)"constructor"==s&&(i||!n.call(t,s))||a.push(s);return a}}(),e=o$();return oi=function(n){return e(n)?r(n,!0):o(n)}}function oJ(){return op?of:(op=1,of=function(r){return r})}function oX(){return ob?oh:(ob=1,oh=function(r,o,e){switch(e.length){case 0:return r.call(o);case 1:return r.call(o,e[0]);case 2:return r.call(o,e[0],e[1]);case 3:return r.call(o,e[0],e[1],e[2])}return r.apply(o,e)})}function o0(){if(ow)return oW;ow=1;var r=oJ(),o=function(){if(oy)return ox;oy=1;var r=oX(),o=Math.max;return ox=function(e,n,t){return n=o(void 0===n?e.length-1:n,0),function(){for(var i=arguments,a=-1,s=o(i.length-n,0),u=Array(s);++a<s;)u[a]=i[n+a];a=-1;for(var d=Array(n+1);++a<n;)d[a]=i[a];return d[n]=t(u),r(e,this,d)}}}(),e=function(){if(oS)return oR;oS=1;var r=function(){if(ov)return oT;ov=1;var r=oC?ok:(oC=1,ok=function(r){return function(){return r}}),o=$(),e=oJ();return oT=o?function(e,n){return o(e,"toString",{configurable:!0,enumerable:!1,value:r(n),writable:!0})}:e}();return oR=(function(){if(oD)return om;oD=1;var r=Date.now;return om=function(o){var e=0,n=0;return function(){var t=r(),i=16-(t-n);if(n=t,i>0){if(++e>=800)return arguments[0]}else e=0;return o.apply(void 0,arguments)}}})()(r)}();return oW=function(n,t){return e(o(n,t,r),n+"")}}function o1(){if(oj)return oz;oj=1;var r=u(),o=o$(),e=oY(),n=c();return oz=function(t,i,a){if(!n(a))return!1;var s=typeof i;return("number"==s?!!(o(a)&&e(i,a.length)):"string"==s&&i in a)&&r(a[i],t)}}function o2(){if(oI)return o_;oI=1;var r=o0(),o=o1();return o_=function(e){return r(function(r,n){var t=-1,i=n.length,a=i>1?n[i-1]:void 0,s=i>2?n[2]:void 0;for(a=e.length>3&&"function"==typeof a?(i--,a):void 0,s&&o(n[0],n[1],s)&&(a=i<3?void 0:a,i=1),r=Object(r);++t<i;){var u=n[t];u&&e(r,u,t,a)}return r})}}var o3=b(function(){if(oA)return oO;oA=1;var r=function(){if(og)return ol;og=1;var r=function(){if(ro)return rr;ro=1;var r=t(),o=function(){if(V)return M;V=1;var r=t();return M=function(){this.__data__=new r,this.size=0}}(),e=N?K:(N=1,K=function(r){var o=this.__data__,e=o.delete(r);return this.size=o.size,e}),n=Y?Q:(Y=1,Q=function(r){return this.__data__.get(r)}),s=G?Z:(G=1,Z=function(r){return this.__data__.has(r)}),u=function(){if(X)return J;X=1;var r=t(),o=i(),e=a();return J=function(n,t){var i=this.__data__;if(i instanceof r){var a=i.__data__;if(!o||a.length<199)return a.push([n,t]),this.size=++i.size,this;i=this.__data__=new e(a)}return i.set(n,t),this.size=i.size,this}}();function d(o){var e=this.__data__=new r(o);this.size=e.size}return d.prototype.clear=o,d.prototype.delete=e,d.prototype.get=n,d.prototype.has=s,d.prototype.set=u,rr=d}(),o=L(),e=rl?rc:(rl=1,rc=(rd?ru:(rd=1,ru=function(r){return function(o,e,n){for(var t=-1,i=Object(o),a=n(o),s=a.length;s--;){var u=a[r?s:++t];if(!1===e(i[u],u,i))break}return o}}))()),n=function(){if(oc)return od;oc=1;var r=L(),o=function(){var r,o,e,n,t,i,a;if(rg)return oB.exports;return rg=1,r=oB,o=oB.exports,e=d(),a=(i=(t=(n=o&&!o.nodeType&&o)&&r&&!r.nodeType&&r)&&t.exports===n?e.Buffer:void 0)?i.allocUnsafe:void 0,r.exports=function(r,o){if(o)return r.slice();var e=r.length,n=a?a(e):new r.constructor(e);return r.copy(n),n},oB.exports}(),e=function(){if(ry)return rx;ry=1;var r=function(){if(rb)return rh;rb=1;var r=rp?rf:(rp=1,rf=d().Uint8Array);return rh=function(o){var e=new o.constructor(o.byteLength);return new r(e).set(new r(o)),e}}();return rx=function(o,e){var n=e?r(o.buffer):o.buffer;return new o.constructor(n,o.byteOffset,o.length)}}(),n=rC?rk:(rC=1,rk=function(r,o){var e=-1,n=r.length;for(o||(o=Array(n));++e<n;)o[e]=r[e];return o}),t=function(){if(rj)return rz;rj=1;var r=function(){if(rv)return rT;rv=1;var r=c(),o=Object.create;return rT=function(){function e(){}return function(n){if(!r(n))return{};if(o)return o(n);e.prototype=n;var t=new e;return e.prototype=void 0,t}}()}(),o=oF(),e=oq();return rz=function(n){return"function"!=typeof n.constructor||e(n)?{}:r(o(n))}}(),i=oU(),a=h(),s=function(){if(rH)return rU;rH=1;var r=o$(),o=g();return rU=function(e){return o(e)&&r(e)}}(),u=oL(),l=f(),p=c(),b=oM(),x=oK(),y=oN(),k=function(){if(ou)return os;ou=1;var r=oQ(),o=oG();return os=function(e){return r(e,o(e))}}();return od=function(d,c,g,f,h,C,T){var v=y(d,g),m=y(c,g),D=T.get(m);if(D)return void r(d,g,D);var R=C?C(v,m,g+"",d,c,T):void 0,S=void 0===R;if(S){var W=a(m),w=!W&&u(m),z=!W&&!w&&x(m);R=m,W||w||z?a(v)?R=v:s(v)?R=n(v):w?(S=!1,R=o(m,!0)):z?(S=!1,R=e(m,!0)):R=[]:b(m)||i(m)?(R=v,i(v)?R=k(v):(!p(v)||l(v))&&(R=t(m))):S=!1}S&&(T.set(m,R),h(R,m,f,C,T),T.delete(m)),r(d,g,R)}}(),s=c(),u=oG(),l=oN();return ol=function t(i,a,d,c,g){i!==a&&e(a,function(e,u){if(g||(g=new r),s(e))n(i,a,u,d,t,c,g);else{var f=c?c(l(i,u),e,u+"",i,a,g):void 0;void 0===f&&(f=e),o(i,u,f)}},u)}}();return oO=o2()(function(o,e,n){r(o,e,n)})}());let o5=r=>{let{customTheme:e,clientSettings:n,themeVersion:t,uiSettings:i,defaultThemes:a=H}=r,s=x.getWebSetting(n,"data.settings.sdk_settings.ui_custom_settings");return o.useMemo(()=>{let r=y.selectUiSettings(i,s);return{...o3({},y.mapUISettingsToCustomTheme(r),e),themeVersion:t,defaultThemes:a}},[e,a,t,i,s])},o4=()=>{},o6=o.createContext({onDoneCallback:o4,onErrorCallback:o4,onCloseCallback:o4}),o7=({children:e,onDone:n=o4,onError:t=o4,onClose:i=o4})=>{let a=o.useCallback(r=>{n&&n(r)},[n]),s=o.useCallback(r=>{t&&t(r)},[t]),u=o.useCallback(()=>{i&&i()},[i]),d=o.useMemo(()=>({onDoneCallback:a,onErrorCallback:s,onCloseCallback:u}),[a,s,u]);return r.jsx(o6.Provider,{value:d,children:e})},o8=()=>{let r=o.useContext(o6);if(void 0===r)throw Error("useSDKCallback must be used within a SDKCallbackProvider");return r},o9=o.createContext(""),er=({children:o,isWrappedBy:e=""})=>r.jsx(o9.Provider,{value:e,children:o}),eo=()=>o.useContext(o9);export{C as D,o7 as S,er as W,T as a,eo as b,o5 as c,D as d,H as e,o2 as f,oG as g,oM as h,o0 as i,oX as j,oP as k,oq as l,o3 as m,oZ as n,o$ as o,o1 as p,oQ as r,v as t,o8 as u};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e,n as t,u as a,aG as s,s as n,c as i,a9 as r,d as l,I as c,f as o,b as u,aJ as _,aK as m,F as g,L as d,W as f,M as h,D as b,au as v,k as p,aA as w,j as k}from"./chunk-abc9d931.js";import{t as y}from"./chunk-8eff00f2.js";import{n as F,t as T,u as L,o as R,q as C,r as B,v as S,s as x,y as I}from"./chunk-5a4684bb.js";import{m as M}from"./chunk-0da5ca80.js";import{u as D}from"./chunk-e1e2700f.js";let E=s.faceTracker(),P=new _,{FaceDirection:j,Errors:A,Messages:W,TrackLivenessEvents:V}=n,N={enable:!1,framesIntervalTime:180,framesBatchLength:0},U={[n.FaceDirection.UP]:{delayTime:0},[n.FaceDirection.LEFT]:{delayTime:0},[n.FaceDirection.RIGHT]:{delayTime:0},[n.FaceDirection.FRONTAL]:{delayTime:2e3}},O=()=>{},z=()=>{},K=()=>{};function q({apiCheck:_,bgCameraMask:k,bgCameraMaskRed:G,surroundStyle:Z,cropAreaDimension:J,customInstructions:H,customIcon:X,customDirectionIcon:Q,customStepTimeConstraints:Y=U,onLivenessDetectionDone:$,onError:ee,frontalMinSize:et,waitingTimeToGetBetterFrames:ea=500,captureFrameSettings:es=N,setRemainingTime:en=O,onProcessing:ei=K,customErrors:er,customMessages:el,apiCredentials:ec={},onFramesCaptured:eo=z,initFirstGestureTimeout:eu=2e3,outputEncryptionSettings:e_,cameraScale:em=1,passiveModeAuto:eg=!1,sendCustomEvent:ed,serviceSettings:ef,currentOrientation:eh,onReset:eb}={}){let[ev,ep]=e.useState(!1),[ew,ek]=e.useState(!1),[ey,eF]=e.useState(!1),[eT,eL]=e.useState(!1),eR=e.useRef(null),{lang:eC,assetRoot:eB,customUrls:eS,exifKey:ex}=i.useSDKSettings(),eI=r.useSDKLocale(),{apiClient:eM}=l.useApiClient({apiCredentials:ec}),[,eD]=e.useReducer(e=>e+1,0),eE=e.useRef(null),[eP,ej]=e.useState(!1),eA=e.useRef({}),{sendEvent:eW}=c.useSDKTracking(),[eV,eN]=e.useState(3),[eU,eO]=e.useState(!1),ez=e.useRef(!1),eK=e.useCallback(e=>{eO(e),ez.current=e},[]),eq=e.useRef(null),eG=e.useRef([]),eZ=e.useRef(null),eJ=e.useRef(),eH=e.useRef(null);null===eH.current&&(eH.current=s.initFaceVerificationData({assetRoot:eB,customInstructions:H,customIcon:X,customDirectionIcon:Q,customStepTimeConstraints:Y,Locale:eI,lang:eC}));let[eX,eQ]=e.useState(),eY=e.useCallback(e=>{eQ(e)},[]),e$=e.useMemo(()=>y(eY,500),[eY]),e0=e.useRef([]),e1=e.useRef(),e4=D(),{flowIntervalTimeMs:e2,limitTimeLivenessCheck:e3,terminateIfNoFace:e5,closeEyeDetectorSettings:e7,exifDataSettings:e6,recordVideo:e8,autoCaptureSettings:e9,manualCaptureSettings:te,blurCheckSettings:tt,webIsRequiredFrontalFace:ta,waitBeforeStartFlowMs:ts,resetFlowOnOrientationChange:tn,captureFrameSettings:ti}=function({clientSettings:s,captureFrameSettingsProp:n}){return e.useMemo(()=>{let e,i=M({},F,s),r={enable:t(i,"data.settings.sdk_settings.passive_liveness_settings.auto_capture.enable"),showCaptureButton:t(i,"data.settings.sdk_settings.passive_liveness_settings.auto_capture.show_capture_button"),showCountdown:t(i,"data.settings.sdk_settings.passive_liveness_settings.auto_capture.show_countdown"),waitForBestImageTimeMsWeb:t(i,"data.settings.sdk_settings.passive_liveness_settings.auto_capture.wait_for_best_image_time_ms_web")},l={showCountdown:t(i,"data.settings.sdk_settings.passive_liveness_settings.manual_capture.show_countdown"),waitForBestImageTimeMsWeb:t(i,"data.settings.sdk_settings.passive_liveness_settings.manual_capture.wait_for_best_image_time_ms_web")},c={enable:t(i,"data.settings.sdk_settings.passive_liveness_settings.blur_check.enable"),webBlurryThreshold:t(i,"data.settings.sdk_settings.passive_liveness_settings.blur_check.web_blurry_threshold")},o={enable:t(i,"data.settings.sdk_settings.passive_liveness_settings.close_eye_detector.enable"),webThreshold:t(i,"data.settings.sdk_settings.passive_liveness_settings.close_eye_detector.web_threshold"),webTimeout:t(i,"data.settings.sdk_settings.passive_liveness_settings.close_eye_detector.web_timeout"),forceCheck:t(i,"data.settings.sdk_settings.passive_liveness_settings.close_eye_detector.force_check")},u=t(i,"data.settings.sdk_settings.passive_liveness_settings.web_is_required_frontal_face"),_=a.getWebSetting(i,"data.settings.sdk_settings.active_liveness_settings.limit_time_liveness_check.max_retry_count"),m={enable:t(i,"data.settings.sdk_settings.active_liveness_settings.limit_time_liveness_check.enable"),limitTimeSecond:t(i,"data.settings.sdk_settings.active_liveness_settings.limit_time_liveness_check.limit_time_second"),remainTimeShow:t(i,"data.settings.sdk_settings.active_liveness_settings.limit_time_liveness_check.remain_time_show"),format:t(i,"data.settings.sdk_settings.active_liveness_settings.limit_time_liveness_check.format"),enableMaxRetries:_>0,totalMaxRetries:_,interruptible:!a.getWebSetting(i,"data.settings.sdk_settings.active_liveness_settings.limit_time_liveness_check.non_stoppable")},g={enable:t(i,"data.settings.sdk_settings.active_liveness_settings.terminate_if_no_face.enable"),maxInvalidFrame:t(i,"data.settings.sdk_settings.active_liveness_settings.terminate_if_no_face.max_invalid_frame"),maxTimeMs:t(i,"data.settings.sdk_settings.active_liveness_settings.terminate_if_no_face.max_time_ms")},d={enable:t(i,"data.settings.sdk_settings.active_liveness_settings.exif_data_settings.enable")},f={enable:t(i,"data.settings.sdk_settings.active_liveness_settings.record_video.enable")},h=t(i,"data.settings.sdk_settings.active_liveness_settings.wait_before_start_flow_ms"),b=t(i,"data.settings.sdk_settings.active_liveness_settings.reset_flow_on_orientation_change"),v=t(i,"data.settings.sdk_settings.active_liveness_settings.flow_interval_time_ms"),p=t(s,"data.settings.sdk_settings.active_liveness_settings.save_encoded_frames");return{autoCaptureSettings:r,manualCaptureSettings:l,blurCheckSettings:c,closeEyeDetectorSettings:o,webIsRequiredFrontalFace:u,limitTimeLivenessCheck:m,terminateIfNoFace:g,exifDataSettings:d,recordVideo:f,waitBeforeStartFlowMs:h,resetFlowOnOrientationChange:b,flowIntervalTimeMs:v,captureFrameSettings:e=p?{enable:p.enable,enableLogging:p.enable_logging,framesBatchLength:p.frames_batch_len,framesIntervalTime:p.frames_interval_ms}:n}},[s,n])}({clientSettings:e4,captureFrameSettingsProp:es}),tr=e9?.enable?e9?.waitForBestImageTimeMsWeb:te?.waitForBestImageTimeMsWeb,tl=e8?.enable,tc=e.useMemo(()=>o.getEnabledServices(ef,e4),[e4,ef]),to=e.useRef(""),tu=e.useCallback(e=>{if(e?.event){if(e.event===V?.show_alert){let t=e.log?.alert;if(t===to.current)return;to.current=t}eW(e),ed&&ed(e)}},[ed,eW]),t_=e.useMemo(()=>y(e=>{tu(e)},2e3),[tu]),tm=e.useRef(0),tg=e.useRef(),td=e.useRef();e.useEffect(()=>{tu({tag:"selfie",event:V?.start_camera,log:{}})},[tu]),e.useEffect(()=>(P.start(),()=>{P.stop()}),[]),e.useEffect(()=>{let e=!1;return async function t(){!eP&&(e1.current=performance.now(),eA.current=await m(eS),await g.initTensorFlow({preferredBackends:["wasm","webgl","cpu"]}),e||(ej(!0),tu({tag:"selfie",event:V?.show_warmup,log:{}}),tu({tag:"selfie",event:V?.finish_load_model,log:{status:"success",time_in_ms:performance.now()-e1.current}}),e1.current=null))}(),()=>{e=!0}},[eP,eS,tu]);let tf=e.useRef(!1),th=e.useCallback(()=>{eH.current.curStepIndex=eH.current.steps.length,tf.current=!0,eF(!1),td.current?.discardRecording(),clearInterval(eq.current)},[]),tb=e.useCallback(()=>{eH.current=s.initFaceVerificationData({assetRoot:eB,customInstructions:H,customIcon:X,customDirectionIcon:Q,Locale:eI,lang:eC}),tm.current=0,tg.current=null,e0.current=[],eL(!1),eQ(null),x(),td.current?.start(),tf.current=!1,eK(!1),eN(3),eZ.current=null,eG.current=[],eJ.current=null,"function"==typeof eb&&eb(),eD()},[eI,eB,Q,X,H,eK,eC,eb]),tv=e.useCallback(()=>{th(),setTimeout(()=>{tb()},e2)},[e2,tb,th]),tp=e.useMemo(()=>({...A,...er}),[er]),tw=e.useMemo(()=>({...W,...el}),[el]),tk=e.useCallback(()=>{let e={};Object.keys(tp.liveness_terminated_time_out?.msg).forEach(t=>{let a=T(tp.liveness_terminated_time_out?.msg[t]);e[t]=a({x:e3.limitTimeSecond})}),eQ({...tp.liveness_terminated_time_out,msg:e,duration:.95*e2}),tu({tag:"selfie",event:V?.show_alert,log:{alert:"liveness_terminated_time_out,"}}),P.stop(),en(""),th()},[tp.liveness_terminated_time_out,e2,e3.limitTimeSecond,th,tu,en]),ty=e.useCallback(({remainTime:e})=>{if(e>0&&e<=e3.remainTimeShow){let t=T(tw.REMAIN_TIME[eC]),a=e;switch(e3.format){case"mm:ss":a=e.toString().padStart(5,"00:00");break;case"ss":a=e.toString().padStart(2,"0")}en(t({x:a}))}},[eC,e3.format,e3.remainTimeShow,tw.REMAIN_TIME,en]),tF=e.useCallback(({attemptCount:e,fromBackground:t})=>{e3.enableMaxRetries&&e>=e3.totalMaxRetries&&ee(n.Errors.max_retry_reached),t&&th(),P.start(),tb()},[e3.enableMaxRetries,e3.totalMaxRetries,ee,tb,th]),{stopTimer:tT}=L({totalTime:e3.limitTimeSecond,totalDelayBetweenReset:e2/1e3,interruptible:e3.interruptible,shouldStart:ew&&e3.enable&&eP,onTimesUp:tk,onTick:ty,onReset:tF}),tL=e.useCallback(({clientWidth:e,clientHeight:t,videoAreaWidth:a,videoAreaHeight:s,lostX:n,lostY:i})=>{let r,l;u.isMobile?l=r=a:r=l=s-200;let c=Math.floor((a-r)/2)+n;eE.current={x:c,y:5+i,width:r,height:l,image:k,surroundStyle:Z},"object"==typeof J?eE.current={...eE.current,...J}:"function"==typeof J&&(eE.current={...eE.current,...J({clientWidth:e,clientHeight:t,videoAreaWidth:a,videoAreaHeight:s,lostX:n,lostY:i,isMobile:u.isMobile,width:r,height:l})}),eD(),ek(!0)},[k,Z,J]),tR=e.useCallback(()=>{eN(3),clearInterval(eq.current),eK(!0);let e=async e=>{if(e-1==0){let e;P.stop(),tT(),clearInterval(eq.current),ei(),await td.current?.stopVideoRecording(),ep(!0),d.addExifData("user_action",{start_selfie:Date.now()-1e3*P.duration("from_1st_frame"),end_selfie:Date.now()});let t=(e=e9.enable?[eZ.current]:eG.current).map(e=>f.resizeBlobImg(e.blob,400,400)),a=(await Promise.all(t)).map((t,a)=>{let s=d.parseLivenessImg({...e[a],gesture:"frontal"});return d.writeCurrentExif({imageData:{blob:t},enableExifData:e6.enable,additionalData:s})}),s=await Promise.all(a),n={};if(e_&&e_.key){let{key:e}=e_,t=s.map(t=>h.encrypt({blob:t,key:e}));n={frontalFacesEncrypted:await Promise.all(t)}}let i=[...e0.current];if(e_&&e_.key){let e=await Promise.all(i.map(e=>e?.base64));if(i=i.map((t,a)=>({...t,base64:e[a]})),ti.enable&&ti.framesBatchLength>0&&i.length%ti.framesBatchLength>0){let e=i.slice(-1*(i.length%ti.framesBatchLength));eo(e),_&&tc.enableUploadFrames&&R(e_,e,eM,i.length===ti.framesBatchLength)}}else ti.enable&&ti.framesBatchLength>0&&i.length%ti.framesBatchLength>0&&(eo(i.slice(-1*(i.length%ti.framesBatchLength)).map(({base64:e,label:t,index:a})=>({base64:e,label:t,index:a}))),_&&tc.enableUploadFrames&&R(e_,i.slice(-1*(i.length%ti.framesBatchLength)),eM));if(_&&tc.enableUploadImages){let t=e=>({label:"portrait",metadata:JSON.stringify({gesture_score:e,gesture:j.FRONTAL})}),a=e.map((e,a)=>eM.uploadImage({file:s[a],...t(e.leftRightScore)}));e_&&e_.key&&(a=e.map((e,a)=>{let s=new Blob([n.frontalFacesEncrypted[a].hex]);return eM.uploadImage({file:s,...t(e.leftRightScore)},{"X-TV-Key":e_.key})}));try{let t=await Promise.all(a),s=null;tc.enableVerifyFaceLiveness&&(s=eM.verifyFaceLiveness({images:t.map(e=>({id:e.data.image_id})),videos:[{frames:i}]}));let n=null;tc.enableVerifySanityPortrait&&(n=eM.requestVerifyPortrait({image:{id:t?.[t.length-1]?.data?.image_id}}));let[r,l]=await Promise.all([s,n]);$({apiCheckPassed:r?.data.is_live??!1,verifyFaceLivenessResult:r?.data??null,verifyFacePortraitResult:l?.data??null,frontalFaces:t.map((t,a)=>({id:t?.data?.image_id,blob:e?.[a]?.blob}))})}catch(e){ee({error:e})}}else $({frontalFaces:s,...n,capturedFrames:i,video:C()}),B()}};eq.current=setInterval(()=>{eN(t=>(e(t),t-1))},tr/3)},[eK,tr,tT,ei,e9.enable,e_,ti.enable,ti.framesBatchLength,_,tc.enableUploadImages,tc.enableUploadFrames,tc.enableVerifyFaceLiveness,tc.enableVerifySanityPortrait,e6.enable,eo,eM,$,ee]),tC=e.useRef({});e.useEffect(()=>{tC.current.isFirstValidFrameFoundRef=eT},[eT]),e.useEffect(()=>{let e,t=eR.current;async function a({faceDirection:e,canvas:t,leftRightScore:a,blurScore:s,isEyeClosed:n}){if(!0===ez.current&&(ta&&e===j.FRONTAL||!ta)){let e=await b.takePicture({canvas:t});e9?.enable&&Date.now()-eJ.current<e9?.waitForBestImageTimeMsWeb?(eZ.current||(eZ.current={blob:e,blurScore:s,isEyeClosed:n,captureTime:Date.now()}),tt?.enable&&(eZ.current=I({incomingFrame:{blob:e,blurScore:s,isEyeClosed:n,captureTime:Date.now()},currentBestFrame:eZ.current}))):eG.current.length<1&&eG.current.push({blob:e,leftRightScore:a,captureTime:Date.now(),blurScore:s})}}async function i(r,l){let c,o;if(l?.width===0||l?.height===0)return;let{isFirstValidFrameFoundRef:u}=tC.current,{cropX:m,cropY:g,cropWidth:d,cropHeight:f}=r;l.getContext("2d").drawImage(t,m,g,d,f,-((400*em-400)/2)/em,-((400*em-400)/2)/em,400,400);let{blazefaceModel:h,closeEyesModel:b}=eA.current,[y,F]=await Promise.all([v.calculateBlurScore(l),p.getModelPredictions({model:h,sCanvas:l})]),{error:T,fullFace:L,faceRatio:C,faceNotFrontalMinThreshold:B}=await s.validatePredictions({predictions:F,width:p.SIZE,height:p.SIZE});c=T,eE.current.image=k;let S=null,x=null,I=null,{curStepIndex:M,steps:D}=eH.current;if(L){I=L.landmarks;let e=await s.calculateFaceDirection({landmarks:I,getPerfectFrontal:!0});e&&(S=e.gesture,x=e.leftRightScore);let t=e7?.webTimeout+Y[n.FaceDirection.FRONTAL].delayTime/1e3;if(e7?.enable&&(-1===P.duration("limit_close_eye")||P.duration("limit_close_eye")<t)){e7?.forceCheck||-1!==P.duration("limit_close_eye")||P.start("limit_close_eye");let{isEyeClose:e}=await b.predict(l,I,e7?.webThreshold);e&&!c&&(c=A.close_eye)}}let W=c?.code==="no_face"||c?.code==="partial_face",N=M<D.length;if(!function({noFace:e,isFirstValidFrameFoundRef:t}){if(!e5.enable||!t)return;let{max_time_ms:a}=e5;tg.current&&e||(tg.current={time:Date.now(),frame:0}),e&&tg.current.frame++;let{time:s}=tg.current;e&&Date.now()-s>=a&&(eQ({...tp.liveness_terminated_no_face,duration:e2}),tu({tag:"selfie",event:V?.show_alert,log:{alert:"liveness_terminated_no_face"}}),tv())}({noFace:W&&N,isFirstValidFrameFoundRef:u}),c?.code&&t_({tag:"selfie",event:V?.show_alert,log:{alert:c.code}}),!c||"face_too_small"===c.code&&S!==j.FRONTAL&&C>=B){if(!function(e,t,a,s){if(e0.current.length&&Date.now()-e0.current[e0.current.length-1].time<ti.framesIntervalTime)return;if(ti.enable&&!0){let{topLeft:s,bottomRight:n}=e,i=[...s,...n],{score:r,time:l}=E(e,0===e0.current.length),c={label:"portrait",base64:t.toDataURL("image/jpeg",.8).split(",")[1],landmarks:a,original_landmarks:a,score:r,time:l,index:e0.current.length,bbox:i,original_bbox:i};if(e_&&e_.key){if(c.base64=w.encryptFrameBase64(c.base64,e_.key),e0.current.push(c),ti.framesBatchLength>0&&e0.current.length%ti.framesBatchLength==0&&eo){let e=e0.current.slice(-ti.framesBatchLength);Promise.all(e.map(e=>e?.base64)).then(t=>{eo(e.map(({label:e,index:a},s)=>({base64:t[s],label:e,index:a}))),_&&tc.enableUploadFrames&&R(e_,e.map(({label:e,index:a},s)=>({base64:t[s],label:e,index:a})),eM,e0.current.length===ti.framesBatchLength)})}}else e0.current.push(c),ti.framesBatchLength>0&&e0.current.length%ti.framesBatchLength==0&&eo&&(eo(e0.current.slice(-ti.framesBatchLength).map(({base64:e,label:t,index:a})=>({base64:e,label:t,index:a}))),_&&tc.enableUploadFrames&&R(e_,e0.current.slice(-ti.framesBatchLength),eM,e0.current.length===ti.framesBatchLength));return};}(F[0],l,I),S!==j.FRONTAL&&ta)o=tp.not_frontal_face,eE.current.image=G;else if(!c){u||(eL(!0),P.start("from_1st_frame"));let e=e9?.enable&&!ez.current&&0===eG.current.length;tt?.enable?null!==y&&y>tt?.webBlurryThreshold?(o=null,e&&(eJ.current=Date.now(),tR())):ez.current||(o=tp.liveness_blurry):e&&(eJ.current=Date.now(),tR());let{isEyeClose:t}=await b.predict(l,I,e7?.webThreshold);await a({faceDirection:S,canvas:l,leftRightScore:x,blurScore:y,...null!==t?{isEyeClosed:t}:{}})}}else M<D.length&&(o=tp[c.code],eE.current.image=G);e$(o),-1!==e&&(e=requestAnimationFrame(()=>i(r,l)))}async function r(){let e=b.analyzeVideoAndWindowSizes(t,eE.current),a=document.createElement("canvas");a.width=400,a.height=400;let s=a.getContext("2d");s.translate(400,0),s.scale(-1*em,+em);let{mediaRecorder:n}=tl&&t?await S({outputImagesSize:400,videoEl:t,resultAnalyzeVideoAndWindowSizes:e}):{};td.current=n,td.current&&td.current.start(),i(e,a)}return ew&&eP&&setTimeout(()=>{r()},ts??eu),()=>{cancelAnimationFrame(e),e=-1}},[eh,ts,ta,tt?.enable,tt?.webBlurryThreshold,e9?.enable,e9?.waitForBestImageTimeMsWeb,eu,ew,eC,eM,_,k,G,$,ee,et,ea,ti,ei,e3.enable,en,e$,Y,e2,tv,e5,tp,eP,tu,eo,e_,em,tR,eg,e7?.enable,e7?.webThreshold,e7?.webTimeout,e7?.forceCheck,e6.enable,ex,t_,ti.framesBatchLength,tl,tc.enableUploadFrames]),e.useEffect(()=>{eX&&(eX?.code!==tp?.liveness_terminated_time_out&&eX?.code!==tp?.liveness_terminated_no_face&&e9?.enable&&ez.current||(clearInterval(eq.current),eK(!1),eZ.current=null,eG.current=[],eJ.current=null))},[e9?.enable,eX,eK,tp]);let{curStepIndex:tB,steps:tS}=eH.current,tx=eT&&!eX&&!eg&&(!e9?.enable||e9?.showCaptureButton),tI=eU&&!tf.current&&(e9?.enable?e9?.showCountdown:te?.showCountdown);return{resetFlowOnOrientationChange:tn,countdownToTakePicture:eV,cropArea:eE,curStepIndex:tB,faceDetectionError:eX,resetFlow:tv,handleTriggerPassiveMode:tR,handleVideoPlayed:tL,refVideo:eR,refIsReseting:tf,showCountdown:eU,steps:tS,videoPlayed:ew,activeCapturing:ey,isFirstValidFrameFound:eT,warmupDone:eP,showLoading:ev,showCaptureButton:tx,shouldShowCountdown:tI}}function G({className:e="",fillColor:t=null}){return k.jsxs("svg",{className:e,width:"38px",height:"32px",viewBox:"0 0 24 21","data-testid":"camera-icon",children:[k.jsx("title",{children:"FA45C15C-1E21-4D7B-9585-07FB9F999CB8"}),k.jsx("desc",{children:"Created with sketchtool."}),k.jsx("g",{id:"Web-demo",stroke:"none",strokeWidth:"1",fill:"none",fillRule:"evenodd",children:k.jsx("g",{id:"step1",transform:"translate(-950.000000, -380.000000)",fill:t??"currentColor",fillRule:"nonzero",children:k.jsx("g",{id:"Group",transform:"translate(950.000000, 380.000000)",children:k.jsx("g",{id:"Group-2",children:k.jsx("g",{id:"camera",children:k.jsx("path",{d:"M21,3 L17,3 L15,0 L9,0 L7,3 L3,3 C1.34314575,3 0,4.34314575 0,6 L0,18 C0,19.6568542 1.34314575,21 3,21 L21,21 C22.6568542,21 24,19.6568542 24,18 L24,6 C24,4.34314575 22.6568542,3 21,3 Z M12,17 C9.23857625,17 7,14.7614237 7,12 C7,9.23857625 9.23857625,7 12,7 C14.7614237,7 17,9.23857625 17,12 C17,14.7614237 14.7614237,17 12,17 L12,17 Z",id:"Shape"})})})})})})]})}export{G as C,q as u};
|
|
1
|
+
import{r as e,n as t,u as a,aG as s,s as n,c as i,a9 as r,d as l,I as c,f as o,b as u,aJ as _,aK as m,F as g,L as d,W as f,M as h,D as b,au as v,k as p,aA as w,j as k}from"./chunk-27713cdc.js";import{t as y}from"./chunk-67605c5a.js";import{n as F,t as T,u as L,o as R,q as C,r as B,v as S,s as x,y as I}from"./chunk-65036591.js";import{m as M}from"./chunk-9803c4f4.js";import{u as D}from"./chunk-788a3d4e.js";let E=s.faceTracker(),P=new _,{FaceDirection:j,Errors:A,Messages:W,TrackLivenessEvents:V}=n,N={enable:!1,framesIntervalTime:180,framesBatchLength:0},U={[n.FaceDirection.UP]:{delayTime:0},[n.FaceDirection.LEFT]:{delayTime:0},[n.FaceDirection.RIGHT]:{delayTime:0},[n.FaceDirection.FRONTAL]:{delayTime:2e3}},O=()=>{},z=()=>{},K=()=>{};function q({apiCheck:_,bgCameraMask:k,bgCameraMaskRed:G,surroundStyle:Z,cropAreaDimension:J,customInstructions:H,customIcon:X,customDirectionIcon:Q,customStepTimeConstraints:Y=U,onLivenessDetectionDone:$,onError:ee,frontalMinSize:et,waitingTimeToGetBetterFrames:ea=500,captureFrameSettings:es=N,setRemainingTime:en=O,onProcessing:ei=K,customErrors:er,customMessages:el,apiCredentials:ec={},onFramesCaptured:eo=z,initFirstGestureTimeout:eu=2e3,outputEncryptionSettings:e_,cameraScale:em=1,passiveModeAuto:eg=!1,sendCustomEvent:ed,serviceSettings:ef,currentOrientation:eh,onReset:eb}={}){let[ev,ep]=e.useState(!1),[ew,ek]=e.useState(!1),[ey,eF]=e.useState(!1),[eT,eL]=e.useState(!1),eR=e.useRef(null),{lang:eC,assetRoot:eB,customUrls:eS,exifKey:ex}=i.useSDKSettings(),eI=r.useSDKLocale(),{apiClient:eM}=l.useApiClient({apiCredentials:ec}),[,eD]=e.useReducer(e=>e+1,0),eE=e.useRef(null),[eP,ej]=e.useState(!1),eA=e.useRef({}),{sendEvent:eW}=c.useSDKTracking(),[eV,eN]=e.useState(3),[eU,eO]=e.useState(!1),ez=e.useRef(!1),eK=e.useCallback(e=>{eO(e),ez.current=e},[]),eq=e.useRef(null),eG=e.useRef([]),eZ=e.useRef(null),eJ=e.useRef(),eH=e.useRef(null);null===eH.current&&(eH.current=s.initFaceVerificationData({assetRoot:eB,customInstructions:H,customIcon:X,customDirectionIcon:Q,customStepTimeConstraints:Y,Locale:eI,lang:eC}));let[eX,eQ]=e.useState(),eY=e.useCallback(e=>{eQ(e)},[]),e$=e.useMemo(()=>y(eY,500),[eY]),e0=e.useRef([]),e1=e.useRef(),e4=D(),{flowIntervalTimeMs:e2,limitTimeLivenessCheck:e3,terminateIfNoFace:e5,closeEyeDetectorSettings:e7,exifDataSettings:e6,recordVideo:e8,autoCaptureSettings:e9,manualCaptureSettings:te,blurCheckSettings:tt,webIsRequiredFrontalFace:ta,waitBeforeStartFlowMs:ts,resetFlowOnOrientationChange:tn,captureFrameSettings:ti}=function({clientSettings:s,captureFrameSettingsProp:n}){return e.useMemo(()=>{let e,i=M({},F,s),r={enable:t(i,"data.settings.sdk_settings.passive_liveness_settings.auto_capture.enable"),showCaptureButton:t(i,"data.settings.sdk_settings.passive_liveness_settings.auto_capture.show_capture_button"),showCountdown:t(i,"data.settings.sdk_settings.passive_liveness_settings.auto_capture.show_countdown"),waitForBestImageTimeMsWeb:t(i,"data.settings.sdk_settings.passive_liveness_settings.auto_capture.wait_for_best_image_time_ms_web")},l={showCountdown:t(i,"data.settings.sdk_settings.passive_liveness_settings.manual_capture.show_countdown"),waitForBestImageTimeMsWeb:t(i,"data.settings.sdk_settings.passive_liveness_settings.manual_capture.wait_for_best_image_time_ms_web")},c={enable:t(i,"data.settings.sdk_settings.passive_liveness_settings.blur_check.enable"),webBlurryThreshold:t(i,"data.settings.sdk_settings.passive_liveness_settings.blur_check.web_blurry_threshold")},o={enable:t(i,"data.settings.sdk_settings.passive_liveness_settings.close_eye_detector.enable"),webThreshold:t(i,"data.settings.sdk_settings.passive_liveness_settings.close_eye_detector.web_threshold"),webTimeout:t(i,"data.settings.sdk_settings.passive_liveness_settings.close_eye_detector.web_timeout"),forceCheck:t(i,"data.settings.sdk_settings.passive_liveness_settings.close_eye_detector.force_check")},u=t(i,"data.settings.sdk_settings.passive_liveness_settings.web_is_required_frontal_face"),_=a.getWebSetting(i,"data.settings.sdk_settings.active_liveness_settings.limit_time_liveness_check.max_retry_count"),m={enable:t(i,"data.settings.sdk_settings.active_liveness_settings.limit_time_liveness_check.enable"),limitTimeSecond:t(i,"data.settings.sdk_settings.active_liveness_settings.limit_time_liveness_check.limit_time_second"),remainTimeShow:t(i,"data.settings.sdk_settings.active_liveness_settings.limit_time_liveness_check.remain_time_show"),format:t(i,"data.settings.sdk_settings.active_liveness_settings.limit_time_liveness_check.format"),enableMaxRetries:_>0,totalMaxRetries:_,interruptible:!a.getWebSetting(i,"data.settings.sdk_settings.active_liveness_settings.limit_time_liveness_check.non_stoppable")},g={enable:t(i,"data.settings.sdk_settings.active_liveness_settings.terminate_if_no_face.enable"),maxInvalidFrame:t(i,"data.settings.sdk_settings.active_liveness_settings.terminate_if_no_face.max_invalid_frame"),maxTimeMs:t(i,"data.settings.sdk_settings.active_liveness_settings.terminate_if_no_face.max_time_ms")},d={enable:t(i,"data.settings.sdk_settings.active_liveness_settings.exif_data_settings.enable")},f={enable:t(i,"data.settings.sdk_settings.active_liveness_settings.record_video.enable")},h=t(i,"data.settings.sdk_settings.active_liveness_settings.wait_before_start_flow_ms"),b=t(i,"data.settings.sdk_settings.active_liveness_settings.reset_flow_on_orientation_change"),v=t(i,"data.settings.sdk_settings.active_liveness_settings.flow_interval_time_ms"),p=t(s,"data.settings.sdk_settings.active_liveness_settings.save_encoded_frames");return{autoCaptureSettings:r,manualCaptureSettings:l,blurCheckSettings:c,closeEyeDetectorSettings:o,webIsRequiredFrontalFace:u,limitTimeLivenessCheck:m,terminateIfNoFace:g,exifDataSettings:d,recordVideo:f,waitBeforeStartFlowMs:h,resetFlowOnOrientationChange:b,flowIntervalTimeMs:v,captureFrameSettings:e=p?{enable:p.enable,enableLogging:p.enable_logging,framesBatchLength:p.frames_batch_len,framesIntervalTime:p.frames_interval_ms}:n}},[s,n])}({clientSettings:e4,captureFrameSettingsProp:es}),tr=e9?.enable?e9?.waitForBestImageTimeMsWeb:te?.waitForBestImageTimeMsWeb,tl=e8?.enable,tc=e.useMemo(()=>o.getEnabledServices(ef,e4),[e4,ef]),to=e.useRef(""),tu=e.useCallback(e=>{if(e?.event){if(e.event===V?.show_alert){let t=e.log?.alert;if(t===to.current)return;to.current=t}eW(e),ed&&ed(e)}},[ed,eW]),t_=e.useMemo(()=>y(e=>{tu(e)},2e3),[tu]),tm=e.useRef(0),tg=e.useRef(),td=e.useRef();e.useEffect(()=>{tu({tag:"selfie",event:V?.start_camera,log:{}})},[tu]),e.useEffect(()=>(P.start(),()=>{P.stop()}),[]),e.useEffect(()=>{let e=!1;return async function t(){!eP&&(e1.current=performance.now(),eA.current=await m(eS),await g.initTensorFlow({preferredBackends:["wasm","webgl","cpu"]}),e||(ej(!0),tu({tag:"selfie",event:V?.show_warmup,log:{}}),tu({tag:"selfie",event:V?.finish_load_model,log:{status:"success",time_in_ms:performance.now()-e1.current}}),e1.current=null))}(),()=>{e=!0}},[eP,eS,tu]);let tf=e.useRef(!1),th=e.useCallback(()=>{eH.current.curStepIndex=eH.current.steps.length,tf.current=!0,eF(!1),td.current?.discardRecording(),clearInterval(eq.current)},[]),tb=e.useCallback(()=>{eH.current=s.initFaceVerificationData({assetRoot:eB,customInstructions:H,customIcon:X,customDirectionIcon:Q,Locale:eI,lang:eC}),tm.current=0,tg.current=null,e0.current=[],eL(!1),eQ(null),x(),td.current?.start(),tf.current=!1,eK(!1),eN(3),eZ.current=null,eG.current=[],eJ.current=null,"function"==typeof eb&&eb(),eD()},[eI,eB,Q,X,H,eK,eC,eb]),tv=e.useCallback(()=>{th(),setTimeout(()=>{tb()},e2)},[e2,tb,th]),tp=e.useMemo(()=>({...A,...er}),[er]),tw=e.useMemo(()=>({...W,...el}),[el]),tk=e.useCallback(()=>{let e={};Object.keys(tp.liveness_terminated_time_out?.msg).forEach(t=>{let a=T(tp.liveness_terminated_time_out?.msg[t]);e[t]=a({x:e3.limitTimeSecond})}),eQ({...tp.liveness_terminated_time_out,msg:e,duration:.95*e2}),tu({tag:"selfie",event:V?.show_alert,log:{alert:"liveness_terminated_time_out,"}}),P.stop(),en(""),th()},[tp.liveness_terminated_time_out,e2,e3.limitTimeSecond,th,tu,en]),ty=e.useCallback(({remainTime:e})=>{if(e>0&&e<=e3.remainTimeShow){let t=T(tw.REMAIN_TIME[eC]),a=e;switch(e3.format){case"mm:ss":a=e.toString().padStart(5,"00:00");break;case"ss":a=e.toString().padStart(2,"0")}en(t({x:a}))}},[eC,e3.format,e3.remainTimeShow,tw.REMAIN_TIME,en]),tF=e.useCallback(({attemptCount:e,fromBackground:t})=>{e3.enableMaxRetries&&e>=e3.totalMaxRetries&&ee(n.Errors.max_retry_reached),t&&th(),P.start(),tb()},[e3.enableMaxRetries,e3.totalMaxRetries,ee,tb,th]),{stopTimer:tT}=L({totalTime:e3.limitTimeSecond,totalDelayBetweenReset:e2/1e3,interruptible:e3.interruptible,shouldStart:ew&&e3.enable&&eP,onTimesUp:tk,onTick:ty,onReset:tF}),tL=e.useCallback(({clientWidth:e,clientHeight:t,videoAreaWidth:a,videoAreaHeight:s,lostX:n,lostY:i})=>{let r,l;u.isMobile?l=r=a:r=l=s-200;let c=Math.floor((a-r)/2)+n;eE.current={x:c,y:5+i,width:r,height:l,image:k,surroundStyle:Z},"object"==typeof J?eE.current={...eE.current,...J}:"function"==typeof J&&(eE.current={...eE.current,...J({clientWidth:e,clientHeight:t,videoAreaWidth:a,videoAreaHeight:s,lostX:n,lostY:i,isMobile:u.isMobile,width:r,height:l})}),eD(),ek(!0)},[k,Z,J]),tR=e.useCallback(()=>{eN(3),clearInterval(eq.current),eK(!0);let e=async e=>{if(e-1==0){let e;P.stop(),tT(),clearInterval(eq.current),ei(),await td.current?.stopVideoRecording(),ep(!0),d.addExifData("user_action",{start_selfie:Date.now()-1e3*P.duration("from_1st_frame"),end_selfie:Date.now()});let t=(e=e9.enable?[eZ.current]:eG.current).map(e=>f.resizeBlobImg(e.blob,400,400)),a=(await Promise.all(t)).map((t,a)=>{let s=d.parseLivenessImg({...e[a],gesture:"frontal"});return d.writeCurrentExif({imageData:{blob:t},enableExifData:e6.enable,additionalData:s})}),s=await Promise.all(a),n={};if(e_&&e_.key){let{key:e}=e_,t=s.map(t=>h.encrypt({blob:t,key:e}));n={frontalFacesEncrypted:await Promise.all(t)}}let i=[...e0.current];if(e_&&e_.key){let e=await Promise.all(i.map(e=>e?.base64));if(i=i.map((t,a)=>({...t,base64:e[a]})),ti.enable&&ti.framesBatchLength>0&&i.length%ti.framesBatchLength>0){let e=i.slice(-1*(i.length%ti.framesBatchLength));eo(e),_&&tc.enableUploadFrames&&R(e_,e,eM,i.length===ti.framesBatchLength)}}else ti.enable&&ti.framesBatchLength>0&&i.length%ti.framesBatchLength>0&&(eo(i.slice(-1*(i.length%ti.framesBatchLength)).map(({base64:e,label:t,index:a})=>({base64:e,label:t,index:a}))),_&&tc.enableUploadFrames&&R(e_,i.slice(-1*(i.length%ti.framesBatchLength)),eM));if(_&&tc.enableUploadImages){let t=e=>({label:"portrait",metadata:JSON.stringify({gesture_score:e,gesture:j.FRONTAL})}),a=e.map((e,a)=>eM.uploadImage({file:s[a],...t(e.leftRightScore)}));e_&&e_.key&&(a=e.map((e,a)=>{let s=new Blob([n.frontalFacesEncrypted[a].hex]);return eM.uploadImage({file:s,...t(e.leftRightScore)},{"X-TV-Key":e_.key})}));try{let t=await Promise.all(a),s=null;tc.enableVerifyFaceLiveness&&(s=eM.verifyFaceLiveness({images:t.map(e=>({id:e.data.image_id})),videos:[{frames:i}]}));let n=null;tc.enableVerifySanityPortrait&&(n=eM.requestVerifyPortrait({image:{id:t?.[t.length-1]?.data?.image_id}}));let[r,l]=await Promise.all([s,n]);$({apiCheckPassed:r?.data.is_live??!1,verifyFaceLivenessResult:r?.data??null,verifyFacePortraitResult:l?.data??null,frontalFaces:t.map((t,a)=>({id:t?.data?.image_id,blob:e?.[a]?.blob}))})}catch(e){ee({error:e})}}else $({frontalFaces:s,...n,capturedFrames:i,video:C()}),B()}};eq.current=setInterval(()=>{eN(t=>(e(t),t-1))},tr/3)},[eK,tr,tT,ei,e9.enable,e_,ti.enable,ti.framesBatchLength,_,tc.enableUploadImages,tc.enableUploadFrames,tc.enableVerifyFaceLiveness,tc.enableVerifySanityPortrait,e6.enable,eo,eM,$,ee]),tC=e.useRef({});e.useEffect(()=>{tC.current.isFirstValidFrameFoundRef=eT},[eT]),e.useEffect(()=>{let e,t=eR.current;async function a({faceDirection:e,canvas:t,leftRightScore:a,blurScore:s,isEyeClosed:n}){if(!0===ez.current&&(ta&&e===j.FRONTAL||!ta)){let e=await b.takePicture({canvas:t});e9?.enable&&Date.now()-eJ.current<e9?.waitForBestImageTimeMsWeb?(eZ.current||(eZ.current={blob:e,blurScore:s,isEyeClosed:n,captureTime:Date.now()}),tt?.enable&&(eZ.current=I({incomingFrame:{blob:e,blurScore:s,isEyeClosed:n,captureTime:Date.now()},currentBestFrame:eZ.current}))):eG.current.length<1&&eG.current.push({blob:e,leftRightScore:a,captureTime:Date.now(),blurScore:s})}}async function i(r,l){let c,o;if(l?.width===0||l?.height===0)return;let{isFirstValidFrameFoundRef:u}=tC.current,{cropX:m,cropY:g,cropWidth:d,cropHeight:f}=r;l.getContext("2d").drawImage(t,m,g,d,f,-((400*em-400)/2)/em,-((400*em-400)/2)/em,400,400);let{blazefaceModel:h,closeEyesModel:b}=eA.current,[y,F]=await Promise.all([v.calculateBlurScore(l),p.getModelPredictions({model:h,sCanvas:l})]),{error:T,fullFace:L,faceRatio:C,faceNotFrontalMinThreshold:B}=await s.validatePredictions({predictions:F,width:p.SIZE,height:p.SIZE});c=T,eE.current.image=k;let S=null,x=null,I=null,{curStepIndex:M,steps:D}=eH.current;if(L){I=L.landmarks;let e=await s.calculateFaceDirection({landmarks:I,getPerfectFrontal:!0});e&&(S=e.gesture,x=e.leftRightScore);let t=e7?.webTimeout+Y[n.FaceDirection.FRONTAL].delayTime/1e3;if(e7?.enable&&(-1===P.duration("limit_close_eye")||P.duration("limit_close_eye")<t)){e7?.forceCheck||-1!==P.duration("limit_close_eye")||P.start("limit_close_eye");let{isEyeClose:e}=await b.predict(l,I,e7?.webThreshold);e&&!c&&(c=A.close_eye)}}let W=c?.code==="no_face"||c?.code==="partial_face",N=M<D.length;if(!function({noFace:e,isFirstValidFrameFoundRef:t}){if(!e5.enable||!t)return;let{max_time_ms:a}=e5;tg.current&&e||(tg.current={time:Date.now(),frame:0}),e&&tg.current.frame++;let{time:s}=tg.current;e&&Date.now()-s>=a&&(eQ({...tp.liveness_terminated_no_face,duration:e2}),tu({tag:"selfie",event:V?.show_alert,log:{alert:"liveness_terminated_no_face"}}),tv())}({noFace:W&&N,isFirstValidFrameFoundRef:u}),c?.code&&t_({tag:"selfie",event:V?.show_alert,log:{alert:c.code}}),!c||"face_too_small"===c.code&&S!==j.FRONTAL&&C>=B){if(!function(e,t,a,s){if(e0.current.length&&Date.now()-e0.current[e0.current.length-1].time<ti.framesIntervalTime)return;if(ti.enable&&!0){let{topLeft:s,bottomRight:n}=e,i=[...s,...n],{score:r,time:l}=E(e,0===e0.current.length),c={label:"portrait",base64:t.toDataURL("image/jpeg",.8).split(",")[1],landmarks:a,original_landmarks:a,score:r,time:l,index:e0.current.length,bbox:i,original_bbox:i};if(e_&&e_.key){if(c.base64=w.encryptFrameBase64(c.base64,e_.key),e0.current.push(c),ti.framesBatchLength>0&&e0.current.length%ti.framesBatchLength==0&&eo){let e=e0.current.slice(-ti.framesBatchLength);Promise.all(e.map(e=>e?.base64)).then(t=>{eo(e.map(({label:e,index:a},s)=>({base64:t[s],label:e,index:a}))),_&&tc.enableUploadFrames&&R(e_,e.map(({label:e,index:a},s)=>({base64:t[s],label:e,index:a})),eM,e0.current.length===ti.framesBatchLength)})}}else e0.current.push(c),ti.framesBatchLength>0&&e0.current.length%ti.framesBatchLength==0&&eo&&(eo(e0.current.slice(-ti.framesBatchLength).map(({base64:e,label:t,index:a})=>({base64:e,label:t,index:a}))),_&&tc.enableUploadFrames&&R(e_,e0.current.slice(-ti.framesBatchLength),eM,e0.current.length===ti.framesBatchLength));return};}(F[0],l,I),S!==j.FRONTAL&&ta)o=tp.not_frontal_face,eE.current.image=G;else if(!c){u||(eL(!0),P.start("from_1st_frame"));let e=e9?.enable&&!ez.current&&0===eG.current.length;tt?.enable?null!==y&&y>tt?.webBlurryThreshold?(o=null,e&&(eJ.current=Date.now(),tR())):ez.current||(o=tp.liveness_blurry):e&&(eJ.current=Date.now(),tR());let{isEyeClose:t}=await b.predict(l,I,e7?.webThreshold);await a({faceDirection:S,canvas:l,leftRightScore:x,blurScore:y,...null!==t?{isEyeClosed:t}:{}})}}else M<D.length&&(o=tp[c.code],eE.current.image=G);e$(o),-1!==e&&(e=requestAnimationFrame(()=>i(r,l)))}async function r(){let e=b.analyzeVideoAndWindowSizes(t,eE.current),a=document.createElement("canvas");a.width=400,a.height=400;let s=a.getContext("2d");s.translate(400,0),s.scale(-1*em,+em);let{mediaRecorder:n}=tl&&t?await S({outputImagesSize:400,videoEl:t,resultAnalyzeVideoAndWindowSizes:e}):{};td.current=n,td.current&&td.current.start(),i(e,a)}return ew&&eP&&setTimeout(()=>{r()},ts??eu),()=>{cancelAnimationFrame(e),e=-1}},[eh,ts,ta,tt?.enable,tt?.webBlurryThreshold,e9?.enable,e9?.waitForBestImageTimeMsWeb,eu,ew,eC,eM,_,k,G,$,ee,et,ea,ti,ei,e3.enable,en,e$,Y,e2,tv,e5,tp,eP,tu,eo,e_,em,tR,eg,e7?.enable,e7?.webThreshold,e7?.webTimeout,e7?.forceCheck,e6.enable,ex,t_,ti.framesBatchLength,tl,tc.enableUploadFrames]),e.useEffect(()=>{eX&&(eX?.code!==tp?.liveness_terminated_time_out&&eX?.code!==tp?.liveness_terminated_no_face&&e9?.enable&&ez.current||(clearInterval(eq.current),eK(!1),eZ.current=null,eG.current=[],eJ.current=null))},[e9?.enable,eX,eK,tp]);let{curStepIndex:tB,steps:tS}=eH.current,tx=eT&&!eX&&!eg&&(!e9?.enable||e9?.showCaptureButton),tI=eU&&!tf.current&&(e9?.enable?e9?.showCountdown:te?.showCountdown);return{resetFlowOnOrientationChange:tn,countdownToTakePicture:eV,cropArea:eE,curStepIndex:tB,faceDetectionError:eX,resetFlow:tv,handleTriggerPassiveMode:tR,handleVideoPlayed:tL,refVideo:eR,refIsReseting:tf,showCountdown:eU,steps:tS,videoPlayed:ew,activeCapturing:ey,isFirstValidFrameFound:eT,warmupDone:eP,showLoading:ev,showCaptureButton:tx,shouldShowCountdown:tI}}function G({className:e="",fillColor:t=null}){return k.jsxs("svg",{className:e,width:"38px",height:"32px",viewBox:"0 0 24 21","data-testid":"camera-icon",children:[k.jsx("title",{children:"FA45C15C-1E21-4D7B-9585-07FB9F999CB8"}),k.jsx("desc",{children:"Created with sketchtool."}),k.jsx("g",{id:"Web-demo",stroke:"none",strokeWidth:"1",fill:"none",fillRule:"evenodd",children:k.jsx("g",{id:"step1",transform:"translate(-950.000000, -380.000000)",fill:t??"currentColor",fillRule:"nonzero",children:k.jsx("g",{id:"Group",transform:"translate(950.000000, 380.000000)",children:k.jsx("g",{id:"Group-2",children:k.jsx("g",{id:"camera",children:k.jsx("path",{d:"M21,3 L17,3 L15,0 L9,0 L7,3 L3,3 C1.34314575,3 0,4.34314575 0,6 L0,18 C0,19.6568542 1.34314575,21 3,21 L21,21 C22.6568542,21 24,19.6568542 24,18 L24,6 C24,4.34314575 22.6568542,3 21,3 Z M12,17 C9.23857625,17 7,14.7614237 7,12 C7,9.23857625 9.23857625,7 12,7 C14.7614237,7 17,9.23857625 17,12 C17,14.7614237 14.7614237,17 12,17 L12,17 Z",id:"Shape"})})})})})})]})}export{G as C,q as u};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{o as e,P as t,j as n,B as o,r as r,V as i,aT as a,a0 as u,e as l,c as s,z as c,b as d,n as p,aU as f}from"./chunk-
|
|
1
|
+
import{o as e,P as t,j as n,B as o,r as r,V as i,aT as a,a0 as u,e as l,c as s,z as c,b as d,n as p,aU as f}from"./chunk-27713cdc.js";let h=e.table`
|
|
2
2
|
width: 100%;
|
|
3
3
|
height: 100%;
|
|
4
4
|
td {
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{o as e,P as r,s as t,x as n,Q as s,e as i,n as a,j as o,y as c,r as l,aH as u,c as m,a2 as p,b as d,aI as f}from"./chunk-
|
|
1
|
+
import{o as e,P as r,s as t,x as n,Q as s,e as i,n as a,j as o,y as c,r as l,aH as u,c as m,a2 as p,b as d,aI as f}from"./chunk-27713cdc.js";import{M as g,O as h,W as x,C as F}from"./chunk-b9c073ce.js";import{u as j}from"./chunk-d311aed8.js";import{p as y,g as C,a as D,O as S,I as b,h as I,F as T,i as v,j as E,L as L,b as R,S as k}from"./chunk-65036591.js";import{u as V}from"./chunk-9803c4f4.js";import"./chunk-3918125a.js";import"./chunk-67605c5a.js";import"./chunk-788a3d4e.js";let _=e.img`
|
|
2
2
|
width: ${({width:e})=>e};
|
|
3
3
|
`;function w({type:e}){let r=n(),t=s(`Selfie.Active.directionIcon.${e}`,`${e}_arrow.gif`),c=i(`Selfie.Active.directionIcon.${e}Width`)({theme:r}),l=a(r,`Selfie.Active.directionIcon.${e}`);return null===l?o.jsx(o.Fragment,{}):l&&null!==l?o.jsx(_,{src:a(r,`Selfie.Active.directionIcon.${e}`),width:c,alt:""}):o.jsx(_,{src:t,alt:"",width:c})}w.propTypes={type:r.oneOf([t.FaceDirection.LEFT,t.FaceDirection.RIGHT,t.FaceDirection.UP,t.FaceDirection.FRONTAL])},w.defaultProps={type:t.FaceDirection.LEFT};let A=d.isMobile?{width:{ideal:640}}:null,$=({stepNumber:e,type:r,theme:t})=>{let n=f(`instruction_${r}.svg`),s=a(t,`Selfie.Active.imageHolder.${r}`);return null===s?o.jsx(o.Fragment,{}):"string"==typeof s&&""!==s?o.jsx("img",{src:s,alt:""}):"v1"===a(t,"themeVersion")?o.jsx("span",{children:e}):o.jsx("img",{src:n,alt:""})};function P(e){var r,f;let{apiCheck:_,onLivenessDetectionDone:w,captureFrameSettings:P,onFramesCaptured:H,frontCamera:N,flipVideoHorizontal:O,customDirectionIcon:M,customStepTimeConstraints:U,onProcessing:B,customErrors:K,apiCredentials:G,outputEncryptionSettings:W,cameraScale:z,defaultCameraId:Y,offsetFaceY:Q,styledComponent:q,isLoading:J,serviceSettings:X,onReset:Z}=e,ee=n(),{onErrorCallback:er,onCloseCallback:et}=V(),en=c.useAsset("bg_camera_mask.png"),es=c.useAsset("bg_camera_mask_red.png"),ei=s("IDCapturing.loadingIcon.src","ic_loading.gif"),[ea,eo]=l.useState({}),{yFaceVerificationStepsWrapper:ec,yFaceDetectionError:el}=ea,[eu,em]=l.useState(""),[ep,ed]=l.useState(),ef=l.useMemo(()=>({backgroundColor:i("Selfie.backgroundColor")({theme:ee})}),[ee]);u(a(ee,"themeVersion"),"up_arrow.gif"),u(a(ee,"themeVersion"),"left_arrow.gif"),u(a(ee,"themeVersion"),"right_arrow.gif"),u(a(ee,"themeVersion"),"frontal_arrow.gif"),u(a(ee,"themeVersion"),"instruction_up.svg"),u(a(ee,"themeVersion"),"instruction_left.svg"),u(a(ee,"themeVersion"),"instruction_right.svg"),u(a(ee,"themeVersion"),"instruction_frontal.svg");let eg=l.useCallback(({clientHeight:e,videoAreaWidth:r,videoAreaHeight:t,lostX:n,lostY:s})=>{let i,a;d.isMobile?a=i=r:i=a=t-200;let o=Math.floor((r-i)/2)+n,c=5+s,l=s+25,u=l+30;eo({yFaceDetectionError:l,yFaceVerificationStepsWrapper:u+a+20});let m=Math.floor(s),p=Math.floor(e-s);return c=Math.floor(u),0!==Q&&(c+Q<m||c+Q+a>p)?er({code:`offsetFaceY must be in [-${c-m}, ${p-a-c}]`}):c+=Q,{x:o,y:c,width:i,height:a}},[Q,er]),{shouldResetFlowOnOrientationChange:eh,cropArea:ex,curStepIndex:eF,directionIcon:ej,directionIconAnimation:ey,faceDetectionError:eC,resetFlow:eD,handleVideoPlayed:eS,instructions:eb,refVideo:eI,refIsReseting:eT,steps:ev,videoPlayed:eE,activeCapturing:eL,warmupDone:eR,showLoading:ek}=j({currentOrientation:ep,apiCheck:_,bgCameraMask:en,bgCameraMaskRed:es,surroundStyle:ef,onLivenessDetectionDone:w,onError:er,cropAreaDimension:eg,customDirectionIcon:M,captureFrameSettings:P,onFramesCaptured:H,setRemainingTime:em,customStepTimeConstraints:U,onProcessing:B,customErrors:K,apiCredentials:G,outputEncryptionSettings:W,cameraScale:z,serviceSettings:X,onReset:Z});l.useEffect(()=>{"string"==typeof ev[0]?.directionIcon&&Promise.all(ev.map(e=>y(e.directionIcon)))},[ev]);let{CloseCameraButton:eV}=q,e_=C(e,ee),ew=eT.current?0:eF/ev.length*100,{lang:eA}=m.useSDKSettings(),e$=l.useRef(0),eP=l.useRef({}),eH=l.useRef(t.ErrorDuration.SHORT),eN=l.useMemo(()=>{let{msg:e,duration:r=t.ErrorDuration.SHORT}=eC||{},n=e?.[eA];return Date.now()-e$.current>=eH.current&&(e$.current=Date.now(),eH.current=r,eP.current=n),eP.current},[eC,eF]),eO=l.useCallback(e=>{ed(e),eh?eD():e===g.LANDSCAPE?eI.current?.pause():eI.current?.play()},[eI,eD,eh]);return o.jsx(h,{onOrientationChange:eO,children:o.jsxs(p,{frontCamera:N,onVideoPlayed:eS,onClose:et,flipHorizontal:O??N,ref:eI,videoSettings:A,onError:er,scale:z,defaultCameraId:Y,closeButton:eV||null,children:[!eR&&o.jsx(x,{}),eE?o.jsxs(o.Fragment,{children:[ex.current?o.jsxs(F,{x:`${ex.current.x}px`,y:`${ex.current.y}px`,width:`${ex.current.width}px`,height:`${ex.current.height}px`,surroundStyle:ex.current.surroundStyle,children:[o.jsx(D,{}),o.jsx(S,{...e_,progress:ew,showErrorRing:!!eC&&i("Selfie.progressCircle.showErrorRing")({theme:ee})}),o.jsx(b,{children:(r=ej,f=ey,r?"string"==typeof r?o.jsx("img",{className:f,src:r,alt:"",style:{maxWidth:"98px",maxHeight:"98px",marginBottom:"25px"}}):r:null)}),eL&&o.jsx(I,{})]}):null,eb?o.jsxs(o.Fragment,{children:[o.jsx(T,{top:ec+5,className:"instructions",children:eb}),o.jsx(v,{top:ec+35,children:ev.map((e,r)=>{let{name:t,image:{objUrl:n}}=e;return o.jsx(E,{active:eF>=r,className:"step-item",children:n?o.jsx("img",{className:"image_preview",src:n,alt:""}):o.jsx($,{stepNumber:r+1,type:t,theme:ee})},t)})})]}):null]}):null,(ek||J)&&o.jsx(L,{children:o.jsx("img",{src:ei,alt:"",className:"spin"})}),eu&&o.jsx(R,{top:ec-30,children:eu}),"string"==typeof eN?o.jsx(k,{top:el-15,className:"face-detection-error",children:eN}):null]})})}P.propTypes={apiCheck:r.bool,onLivenessDetectionDone:r.func,onClose:r.func,onError:r.func,onReset:r.func,captureFrameSettings:r.shape({}),onFramesCaptured:r.func,flipVideoHorizontal:r.bool,frontCamera:r.bool,isLoading:r.bool,customDirectionIcon:r.shape({}),customStepTimeConstraints:r.shape({}),onProcessing:r.func,customErrors:r.shape({}),apiCredentials:r.shape({accessKey:r.string,secretKey:r.string,apiUrl:r.string}),outputEncryptionSettings:r.shape({}),cameraScale:r.number,defaultCameraId:r.string,offsetFaceY:r.number,styledComponent:r.shape({CloseCameraButton:r.node}),serviceSettings:r.shape({})},P.defaultProps={apiCheck:!1,onLivenessDetectionDone:null,onClose:null,onError:()=>{},onReset:()=>{},captureFrameSettings:{enable:!1,framesIntervalTime:180,framesBatchLength:0},onFramesCaptured:()=>{},flipVideoHorizontal:null,frontCamera:!0,isLoading:!1,customDirectionIcon:{[t.FaceDirection.LEFT]:o.jsx(w,{type:t.FaceDirection.LEFT}),[t.FaceDirection.RIGHT]:o.jsx(w,{type:t.FaceDirection.RIGHT}),[t.FaceDirection.UP]:o.jsx(w,{type:t.FaceDirection.UP}),[t.FaceDirection.FRONTAL]:o.jsx(w,{type:t.FaceDirection.FRONTAL})},customStepTimeConstraints:{[t.FaceDirection.UP]:{delayTime:0},[t.FaceDirection.LEFT]:{delayTime:0},[t.FaceDirection.RIGHT]:{delayTime:0},[t.FaceDirection.FRONTAL]:{delayTime:2e3}},onProcessing:()=>{},customErrors:null,apiCredentials:{accessKey:"",secretKey:"",apiUrl:""},outputEncryptionSettings:null,cameraScale:1,defaultCameraId:void 0,offsetFaceY:0,styledComponent:{CloseCameraButton:null},serviceSettings:{enableUploadFrames:!0,enableUploadImages:!0,enableVerifySanityPortrait:!0,enableVerifySanityIDCard:!0,enableVerifyFaceLiveness:!0,enableDetectIDCardTampering:!0,enableReadIDCardInfo:!0}};export{P as default};
|