@sekyro/elements 0.1.0-rc.19 → 0.1.0-rc.20
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/CHANGELOG.md +13 -0
- package/dist/cdn/chunks/capture-session-doc-HIN3YZG2-ZOYOVMIF.js +1 -0
- package/dist/cdn/chunks/{chunk-3PBU4237.js → chunk-2GVFM77I.js} +2 -2
- package/dist/cdn/chunks/{chunk-WANVL25H.js → chunk-32CNXSJQ.js} +1 -1
- package/dist/cdn/chunks/{chunk-L66SWMJ5.js → chunk-677IJRH3.js} +1 -1
- package/dist/cdn/chunks/chunk-BMTTAXWY.js +25 -0
- package/dist/cdn/chunks/{chunk-EPMGZQHF.js → chunk-BO327WCQ.js} +1 -1
- package/dist/cdn/chunks/chunk-BWOTZKA7.js +1 -0
- package/dist/cdn/chunks/{chunk-EXMVZUHU.js → chunk-CYEDFGUG.js} +1 -1
- package/dist/cdn/chunks/{chunk-RTCZJKYC.js → chunk-FQHV53QQ.js} +1 -1
- package/dist/cdn/chunks/chunk-FZP5NLDQ.js +1 -0
- package/dist/cdn/chunks/chunk-HOBGJOBT.js +1 -0
- package/dist/cdn/chunks/{chunk-ZWP6MDIC.js → chunk-HPTNANWX.js} +1 -1
- package/dist/cdn/chunks/{chunk-CGOCWIXM.js → chunk-K67DQTFL.js} +1 -1
- package/dist/cdn/chunks/{chunk-PAU2BFT7.js → chunk-L7I27OCG.js} +1 -1
- package/dist/cdn/chunks/{chunk-WCEIXBIS.js → chunk-LHYSCL4T.js} +1 -1
- package/dist/cdn/chunks/chunk-MINBJAVX.js +1 -0
- package/dist/cdn/chunks/chunk-MXMEO2IW.js +1 -0
- package/dist/cdn/chunks/{chunk-IXRKOBFA.js → chunk-PZVVXMQ6.js} +1 -1
- package/dist/cdn/chunks/chunk-RH466MDF.js +3 -0
- package/dist/cdn/chunks/{chunk-HXD7VO3F.js → chunk-U7QPOSFH.js} +1 -1
- package/dist/cdn/chunks/{chunk-6H2SLOEK.js → chunk-X6LDVTUQ.js} +1 -1
- package/dist/cdn/chunks/{chunk-K2JDLIFO.js → chunk-Z6OYPC4S.js} +1 -1
- package/dist/cdn/chunks/chunk-ZJNLNYA5.js +1 -0
- package/dist/cdn/chunks/{create-document-capture-4ZOSBL3Y-KLZDMWOQ.js → create-document-capture-Z3UK34XH-J7HHUVQU.js} +1 -1
- package/dist/cdn/chunks/document-capture-view-NI4452T4-UL6ELWE6.js +1 -0
- package/dist/cdn/chunks/{eid-view-6DXZ5ELB-ZX35JGDS.js → eid-view-GAIQODI5-AH3LJYP4.js} +1 -1
- package/dist/cdn/chunks/{email-otp-view-3UJPJOQ6-MIOPWSME.js → email-otp-view-SM2POPMA-XEEHDST5.js} +1 -1
- package/dist/cdn/chunks/{flow-views-ZVDXJZWH-C5ZVKCB6.js → flow-views-NBUWHG7J-HB57IJYX.js} +1 -1
- package/dist/cdn/chunks/{form-view-4NKEHYNF-I25LMP47.js → form-view-GOFXOQJO-6K34NRBN.js} +1 -1
- package/dist/cdn/chunks/overlay-de-YLCWZB42-REI3GVKV.js +1 -0
- package/dist/cdn/chunks/overlay-es-YIPBOMXT-5DHSESGX.js +1 -0
- package/dist/cdn/chunks/overlay-pt-JSDCAYVA-MQHVGOHK.js +1 -0
- package/dist/cdn/chunks/plan-runner-JSLWPJ6D-7PE72QOP.js +1 -0
- package/dist/cdn/chunks/{portrait-capture-view-QDUJ36UH-GRTZTYTJ.js → portrait-capture-view-TTUVVA7L-ENQSXXXH.js} +1 -1
- package/dist/cdn/chunks/{portrait-review-view-LW5DBF3L-K7WAOPAG.js → portrait-review-view-BCIENGKR-SHYX5FRE.js} +1 -1
- package/dist/cdn/chunks/{proof-of-address-view-E6WJTTIV-7ISFWEEZ.js → proof-of-address-view-SS2TIV3D-GFY3THLT.js} +1 -1
- package/dist/cdn/define.js +1 -1
- package/dist/cdn/index.js +1 -1
- package/dist/{chunk-BRS7YLGB.js → chunk-2TOYHI7F.js} +1 -1
- package/dist/{chunk-VBJ4CJHE.js → chunk-2ZWLZDO2.js} +1 -1
- package/dist/{chunk-QNK7OBIW.js → chunk-3NYC5YLB.js} +1 -1
- package/dist/chunk-3T7JA7T7.js +1 -0
- package/dist/{chunk-SVGBNMXK.js → chunk-47ELGOCA.js} +1 -1
- package/dist/{chunk-KYDIB6KR.js → chunk-7FYJ4XL4.js} +1 -1
- package/dist/{chunk-CY66YE6F.js → chunk-AUISCZAL.js} +1 -1
- package/dist/{chunk-7XJHQ3NM.js → chunk-GXENE4GQ.js} +1 -1
- package/dist/{chunk-5QJOJLKJ.js → chunk-HRJ5PESP.js} +1 -1
- package/dist/{chunk-RPA5QQVH.js → chunk-IYLMNTY5.js} +2 -2
- package/dist/chunk-TBECC5OK.js +1 -0
- package/dist/{chunk-PKK72TVJ.js → chunk-UJM3T4QD.js} +1 -1
- package/dist/{chunk-6FAODASF.js → chunk-V4USJ5ZA.js} +1 -1
- package/dist/chunk-XXCBLQ53.js +1 -0
- package/dist/chunk-YUZW7NSK.js +25 -0
- package/dist/define.cjs +5 -5
- package/dist/define.js +1 -1
- package/dist/document-capture-view-NI4452T4-VZHREVJN.js +1 -0
- package/dist/{eid-view-6DXZ5ELB-XDQVFDXS.js → eid-view-GAIQODI5-KCEO3AZS.js} +1 -1
- package/dist/{email-otp-view-3UJPJOQ6-5PQM7LNW.js → email-otp-view-SM2POPMA-O7WM3ZEZ.js} +1 -1
- package/dist/{flow-views-ZVDXJZWH-LOGNCRIA.js → flow-views-NBUWHG7J-PO2CMTIF.js} +1 -1
- package/dist/{form-view-4NKEHYNF-VFMN6QFW.js → form-view-GOFXOQJO-CRQWOLQA.js} +1 -1
- package/dist/index.cjs +5 -5
- package/dist/index.d.cts +4 -2
- package/dist/index.d.ts +4 -2
- package/dist/index.js +1 -1
- package/dist/overlay-de-YLCWZB42-XINMWIXZ.js +1 -0
- package/dist/overlay-es-YIPBOMXT-MS7EN5ZX.js +1 -0
- package/dist/overlay-pt-JSDCAYVA-27WQ3BLB.js +1 -0
- package/dist/{portrait-capture-view-QDUJ36UH-QZR4O3YW.js → portrait-capture-view-TTUVVA7L-6BGZEV6C.js} +1 -1
- package/dist/{portrait-review-view-LW5DBF3L-QVERJXKH.js → portrait-review-view-BCIENGKR-WZ7GCBEX.js} +1 -1
- package/dist/{proof-of-address-view-E6WJTTIV-4SHZIQ3O.js → proof-of-address-view-SS2TIV3D-C6YD4BRC.js} +1 -1
- package/dist/styles.css +2 -0
- package/package.json +2 -2
- package/sbom.cdx.json +4 -4
- package/dist/cdn/chunks/capture-session-doc-DFLSX6BB-3ULMTYJH.js +0 -1
- package/dist/cdn/chunks/chunk-2TFK736S.js +0 -1
- package/dist/cdn/chunks/chunk-4VHWJD57.js +0 -1
- package/dist/cdn/chunks/chunk-AC45ZP53.js +0 -1
- package/dist/cdn/chunks/chunk-D7YINY2U.js +0 -3
- package/dist/cdn/chunks/chunk-JR4AQLJ2.js +0 -1
- package/dist/cdn/chunks/chunk-LUO3AZFS.js +0 -1
- package/dist/cdn/chunks/chunk-PLWGAXYM.js +0 -25
- package/dist/cdn/chunks/chunk-YULJCSQ3.js +0 -1
- package/dist/cdn/chunks/document-capture-view-25EASYV7-EUEYS55L.js +0 -1
- package/dist/cdn/chunks/overlay-de-64ABPD3N-KIBBQI36.js +0 -1
- package/dist/cdn/chunks/overlay-es-VIMXYK2Q-KTLONTNF.js +0 -1
- package/dist/cdn/chunks/overlay-pt-3IBDZBAW-DQTJHDLG.js +0 -1
- package/dist/cdn/chunks/plan-runner-3BLEJWHF-3K3RBXJU.js +0 -1
- package/dist/chunk-57MVUXQ6.js +0 -25
- package/dist/chunk-M7HNWDQD.js +0 -1
- package/dist/chunk-XQPY6G2B.js +0 -1
- package/dist/chunk-YZ6YGLNN.js +0 -1
- package/dist/document-capture-view-25EASYV7-MOFQVGV6.js +0 -1
- package/dist/overlay-de-64ABPD3N-ARJE63WR.js +0 -1
- package/dist/overlay-es-VIMXYK2Q-JRHIX3OT.js +0 -1
- package/dist/overlay-pt-3IBDZBAW-JXQE6BVY.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b as U}from"./chunk-WANVL25H.js";import{a as J,c as R}from"./chunk-HXD7VO3F.js";import{b as L}from"./chunk-6MYG4HWP.js";import{a as r}from"./chunk-4FHWXBOB.js";var g,m=(g=class extends Error{constructor(t){super(t.message),this.name="HostedApiError",this.status=t.status,this.code=t.code,t.retryAfterSeconds!==void 0&&(this.retryAfterSeconds=t.retryAfterSeconds),t.details&&(this.details=t.details)}},r(g,"u"),g);function H(e,t,n=Math.random){let i=(e??t)*1e3,s=Math.min(Math.max(i,500),2e4),a=Math.round(s*(1+(n()*2-1)*.25));return Math.min(Math.max(a,500),2e4)}r(H,"T");var V=6e4,N=4,se=3e4,re=9e5,ae=200,oe=5,ce=400,de=new Set(["server_busy","request_timeout"]),ue=20,le=60,pe=600,he=2;function v(e){return(e.split(";")[0]??"").trim()}r(v,"l");var me={liveness:"clipKey",face_match:"imageKey",doc_ocr:"imageKey"},fe=`@sekyro/web/${J}`,ye=fe,b,it=(b=class{constructor(t){this.sessionId=null,this.bootstrap=null,this.captureNonces=[],this.captureFetch=null,this.reportedIssues=new Map,this.issueReports=0,this.issuesPausedUntil=0,this.apiOrigin=t.apiOrigin.replace(/\/+$/,""),this.sessionToken=t.sessionToken;let n=t.fetch;this.fetchImpl=(i,s)=>(n??globalThis.fetch).call(globalThis,i,s),this.requestTimeoutMs=t.requestTimeoutMs??se,this.retryAttempts=t.inProgressRetry?.attempts??oe,this.retryDelayMs=t.inProgressRetry?.delayMs??ce,this.random=t.random??Math.random,this.clientLocale=t.locale}async getSession(){let t=await this.api("GET","/hosted/session");return this.sessionId=t.sessionId,t}async recordConsent(t){let n=await this.api("POST","/hosted/consent",{body:{locale:t},busyRetry:!0}),i=this.captureHold;return this.captureHold=void 0,i&&this.armCapture(i),n}async reportCameraUnavailable(t){return this.api("POST","/hosted/camera-unavailable",{body:{cause:t}})}async testerGate(t){return this.api("POST","/hosted/tester-gate",{body:{input:t}})}async reportCaptureIssue(t){let n=typeof t.name=="string"?t.name.replace(/[^A-Za-z]/g,"").slice(0,40):"",i=typeof t.engineKind=="string"&&/^[a-z_]{1,32}$/.test(t.engineKind)?t.engineKind:void 0,s=typeof t.attempt=="number"&&Number.isInteger(t.attempt)&&t.attempt>=0&&t.attempt<=1e3?t.attempt:void 0,a=t.check==="attestation"?s??"":"",c=[t.check,a,t.kind,n,t.phase??"",i??""].join("|"),d=this.reportedIssues.get(c);if(d!==void 0)return d;if(Date.now()<this.issuesPausedUntil||this.issueReports>=ue)return;let o={check:t.check,kind:t.kind,...n!==""?{name:n}:{},...t.phase!==void 0?{phase:t.phase}:{},...i!==void 0?{engineKind:i}:{},...s!==void 0?{attempt:s}:{},...t.formFactor!==void 0?{formFactor:t.formFactor}:{},...typeof t.detail=="string"&&/^\d{1,10}$/.test(t.detail)?{detail:t.detail}:{},...G(t.challengeMs)?{challengeMs:t.challengeMs}:{},...G(t.readyMs)?{readyMs:t.readyMs}:{},...t.inApp===!0?{inApp:!0}:{}};this.issueReports+=1;let u=this.api("POST","/hosted/capture-issue",{body:o,empty:!0}).catch(l=>{if(l instanceof m&&l.status===429){let p=Math.min(Math.max(l.retryAfterSeconds??le,0),pe);this.issuesPausedUntil=Math.max(this.issuesPausedUntil,Date.now()+p*1e3);return}(!(l instanceof m)||l.status===0||l.status>=500)&&this.reportedIssues.delete(c)});return this.reportedIssues.set(c,u),u}async choose(t,n){let i=await this.api("POST","/hosted/choice",{body:{nodeId:t,option:n},busyRetry:!0});return this.sessionId=i.sessionId,i}async confirmIdentity(t){return this.api("POST","/hosted/identity/confirm",{body:{decision:t}})}async identityPortrait(){return this.api("GET","/hosted/identity/portrait",{blob:!0})}async presign(t,n,i,s={}){let a=await this.ensureSessionId(),c={kind:t,contentType:v(n),contentLength:i,...s.source==="upload"?{source:"upload"}:{}};return this.api("POST",`/sessions/${a}/media`,{body:c})}armCapture(t=2){let n=Date.now();this.captureNonces.filter(i=>i.expiresAt-V>n).length>=t||(this.captureHold===void 0?this.fillCaptureNonces(t,t):this.captureHold=Math.max(this.captureHold,t))}async armRamp(){try{let t=await this.ensureSessionId(),n=await this.api("POST",`/sessions/${t}/media/capture-nonces`,{body:{count:2,ramp:!0}}),i=Date.now(),s=U(n.screenRamp)?n.screenRamp:void 0,a=i+Math.max(0,n.expiresIn)*1e3;for(let d of Array.isArray(n.nonces)?n.nonces:[])typeof d!="string"||d.length===0||this.captureNonces.push({nonce:d,expiresAt:a,...s!==void 0?{arm:s.nonce}:{}});this.captureNonces=this.captureNonces.slice(-N),this.captureHold=void 0;let c=typeof n.rampExpiresIn=="number"&&n.rampExpiresIn>0?n.rampExpiresIn:0;return{...s!==void 0?{challenge:s}:{},expiresAt:i+c*1e3}}catch{return}}async presignCapture(t,n,i,s={}){let a=await this.ensureSessionId(),c=await this.takeCaptureNonce(s.arm),d=c===void 0?void 0:{nonce:c,...s.engine!==void 0?{engine:s.engine.slice(0,32)}:{},...s.durationMs!==void 0&&Number.isFinite(s.durationMs)?{captureMs:Math.min(36e5,Math.max(0,Math.round(s.durationMs)))}:{}},o={kind:t,contentType:v(n),contentLength:i,capture:d};return this.api("POST",`/sessions/${a}/media`,{body:o})}async takeCaptureNonce(t){let n=r(()=>{let i=Date.now();this.captureNonces=this.captureNonces.filter(a=>a.expiresAt-V>i);let s=this.captureNonces.findIndex(a=>a.arm===t);return this.captureNonces.splice(s<0?0:s,1)[0]?.nonce},"n");for(let i=0;i<2;i++){let s=n();if(s!==void 0)return s;await this.fillCaptureNonces(1)}return n()}fillCaptureNonces(t,n=0){return this.captureFetch??(this.captureFetch=(async()=>{try{let i=await this.ensureSessionId(),s=await this.api("POST",`/sessions/${i}/media/capture-nonces`,{body:{count:Math.min(N,Math.max(1,t))}}),a=Date.now()+Math.max(0,s.expiresIn)*1e3;for(let c of Array.isArray(s.nonces)?s.nonces:[])typeof c=="string"&&c.length>0&&this.captureNonces.push({nonce:c,expiresAt:a});this.captureNonces=this.captureNonces.slice(-N),this.captureHold=void 0}catch(i){i instanceof m&&i.code==="consent_required"&&(this.captureHold=Math.max(this.captureHold??0,n))}})().finally(()=>{this.captureFetch=null})),this.captureFetch}async uploadToSpaces(t,n,i){let s;try{s=await this.fetchImpl(t,{method:"PUT",headers:{"content-type":v(i)},body:n,signal:AbortSignal.timeout(re)})}catch(a){throw K(a)}if(!s.ok){let a=(await s.text().catch(()=>"")).slice(0,ae);throw new m({status:s.status,code:"upload_failed",message:`media upload failed (HTTP ${s.status})${a?`: ${a}`:""}`})}}async completeMedia(t){let n=await this.ensureSessionId();return this.api("POST",`/sessions/${n}/media/complete`,{body:{key:t}})}async submitCheck(t,n,i={}){let s=await this.ensureSessionId(),a={input:n,forceOutcome:i.forceOutcome};return this.api("POST",`/sessions/${s}/checks/${t}`,{body:a,idempotencyKey:i.idempotencyKey,...i.browserCheckToken!==void 0?{browserCheckToken:i.browserCheckToken}:{},busyRetry:i.idempotencyKey!==void 0})}async uploadAndSubmit(t,n,i,s={}){let a=v(n.contentType),c=await this.presign(n.kind,a,n.blob.size);await this.uploadToSpaces(c.uploadUrl,n.blob,a);let d=await this.completeMedia(c.key),o={...i,[me[t]]:d.key};return this.submitCheck(t,o,s)}async ensureSessionId(){return this.sessionId!==null?this.sessionId:(this.bootstrap??(this.bootstrap=this.getSession().finally(()=>{this.bootstrap=null})),(await this.bootstrap).sessionId)}async api(t,n,i={}){let s=t==="GET"||i.busyRetry===!0,a=`${this.apiOrigin}/api/v2${n}`,c={"x-session-token":this.sessionToken,"x-sekyro-sdk":ye};i.body!==void 0&&(c["content-type"]="application/json"),i.idempotencyKey!==void 0&&(c["x-idempotency-key"]=i.idempotencyKey),i.browserCheckToken!==void 0&&(c["sekyro-browser-check"]=i.browserCheckToken),this.clientLocale!==void 0&&(c["sekyro-client-locale"]=this.clientLocale);try{let d=R.timezone();d!==void 0&&(c["sekyro-client-timezone"]=d)}catch{}c["sekyro-client-form-factor"]=L();try{let d=await R.deviceHeader();d!==void 0&&(c["sekyro-client-device"]=d)}catch{}for(let d=0;;d++){let o;try{o=await this.fetchImpl(a,{method:t,headers:c,...i.body!==void 0?{body:JSON.stringify(i.body)}:{},cache:"no-store",signal:AbortSignal.timeout(this.requestTimeoutMs)})}catch(l){throw K(l)}if(o.ok){if(i.empty===!0)return;if(i.blob===!0)try{return await o.blob()}catch(p){throw K(p)}let l;try{l=await o.json()}catch{throw new m({status:o.status,code:"unknown_error",message:`response body was not valid JSON (HTTP ${o.status})`})}return _e(l)}let u=await ve(o);if(u.code==="idempotency_in_progress"&&d<this.retryAttempts){this.retryDelayMs>0&&await B(this.retryDelayMs);continue}if(s&&u.status===503&&de.has(u.code)){s=!1,await B(H(u.retryAfterSeconds,he,this.random));continue}throw u}}},r(b,"S"),b);function G(e){return typeof e=="number"&&Number.isInteger(e)&&e>=0&&e<=6e5}r(G,"k");function K(e){if((typeof e=="object"&&e!==null?e.name:void 0)==="TimeoutError")return new m({status:0,code:"timeout",message:"request timed out"});let t=e instanceof Error?e.message:String(e);return new m({status:0,code:"network_error",message:`network request failed: ${t}`})}r(K,"f");function _e(e){return e!==null&&typeof e=="object"&&"success"in e&&"data"in e?e.data:e}r(_e,"L");async function ve(e){let t="unknown_error",n=`request failed (HTTP ${e.status})`,i=Number.NaN,s;try{let d=await e.json();if(d!==null&&typeof d=="object"){let o=d;typeof o.code=="string"&&o.code.length>0&&(t=o.code),typeof o.message=="string"&&o.message.length>0&&(n=o.message),typeof o.retryAfterSeconds=="number"&&(i=o.retryAfterSeconds),Array.isArray(o.details?.issues)?s=o.details:Array.isArray(o.details?.errors)&&(s={...o.details,issues:[]})}}catch{}let a=e.headers.get("retry-after"),c=a===null?Math.floor(i):Number.parseInt(a,10);return new m({status:e.status,code:t,message:n,...Number.isFinite(c)&&c>=0?{retryAfterSeconds:c}:{},details:s})}r(ve,"V");function B(e){return new Promise(t=>setTimeout(t,e))}r(B,"R");function st(e){let t=e?.portrait,n=t?.icao,i=t?.purpose==="id_document";return n==null?i?{policy:"reject",profile:"id_document"}:null:{policy:n.policy==="alert"?"alert":"reject",profile:i||n.profile==="id_document"?"id_document":"selfie"}}r(st,"J");function rt(e){return{...e.baselineEyeOpenness!==void 0?{baselineEyeOpenness:e.baselineEyeOpenness}:{},...e.baselineEyeOpennessLeft!==void 0&&e.baselineEyeOpennessRight!==void 0?{baselineEyeOpennessLeft:e.baselineEyeOpennessLeft,baselineEyeOpennessRight:e.baselineEyeOpennessRight}:{},criteria:e.verdict??{},...e.backgroundCheck!==void 0?{backgroundCheck:e.backgroundCheck}:{}}}r(rt,"Q");var ge=new Set(["nni_unbound","id_number_unbound","method_required","mobile_required","portrait_required"]);function dt(e){return ge.has(e)}r(dt,"Ce");function ut(e,t,n){let i=t.detail;return{check:e,kind:t.kind,...i?.name!==void 0?{name:i.name}:{},...i?.phase!==void 0?{phase:i.phase}:{},...i?.engineKind!==void 0?{engineKind:i.engineKind}:{},attempt:Math.max(0,Math.min(1e3,n))}}r(ut,"ve");function lt(){let e=-1,t="";return{note(n){n==="starting"&&t!=="starting"&&(e+=1),t=n},newHandle(){t=""},noteError(){e<0&&(e=0)},get value(){return e}}}r(lt,"Pe");var be={document:"document_photo",nfc:"document_chip",population_registry:"national_number",national_eid:"national_eid"};function y(e){return e.plan?.steps??[]}r(y,"f");function F(e){return Math.max(0,e.attempts.max-e.attempts.used)}r(F,"x");function ke(e){let t=e.plan?.choice;return t!==void 0&&e.plan?.current===t.nodeId?t:null}r(ke,"J");function pt(e){let t=ke(e);if(t?.kind!=="identity_method")return null;let n=t.options.map(s=>be[s.service]).filter(s=>s!==void 0),i=t.options.find(s=>s.nationalEid)?.nationalEid;return i?{available:!0,selected:null,options:n,nationalEid:i}:{available:!0,selected:null,options:n}}r(pt,"Me");var we=new Set(["liveness","face_match"]);function j(e){return e!==void 0&&(e.state==="pending"||e.state==="input_required")}r(j,"S");function Me(e){return e.status!=="created"&&e.status!=="in_progress"}r(Me,"T");function W(e){let t=e.plan?.current,n=t==null?void 0:y(e).find(i=>i.id===t);return j(n)?n:void 0}r(W,"M");function O(e,t){return y(e).find(n=>n.checkType===t)}r(O,"_");function $(e){let t=y(e),n=t.findIndex(i=>i.checkType==="liveness");return t.find((i,s)=>s>n&&i.checkType==="face_match")}r($,"y");function Se(e,t){let n=O(t,"liveness")?.state,i=$(t)?.state;return($(e)?.state??"pending")==="pending"&&(n==="passed"||n==="review")&&i!==void 0&&i!=="pending"&&i!=="skipped"}r(Se,"F");function Z(e,t){let n=new Map(y(e).map(i=>[i.id,i.state]));return y(t).filter(i=>i.checkType==="face_match"&&(n.get(i.id)??"pending")==="pending"&&i.state!=="pending"&&i.state!=="skipped").map(i=>i.id)}r(Z,"V");var Ie=/^[0-9a-f]{24}$/i;function x(e){return Ie.test(e)?`ses_${e}`:e}r(x,"R");function E(e,t){let n=x(e);return t===void 0?{sessionId:n,status:"unavailable"}:{sessionId:n,status:"unavailable",reasonCode:t}}r(E,"w");function X(e,t,n){let i=x(e);return n===void 0?{sessionId:i,status:t}:{sessionId:i,status:t,reasonCode:n}}r(X,"O");function ht(e,t){let n=Ae(e,t),i=Ce(e);return i!==void 0&&(n.sandbox={simulated:!0,reason:i}),n}r(ht,"Ve");var Te=new Set(["no_testers","tester_gate_not_used","tester_gate_missed"]);function Ce(e){if(e.sandbox!==!0)return;let t=e.simulation?.reason;return Te.has(t)?t:void 0}r(Ce,"Z");function Ae(e,t){let n=x(e.sessionId);switch(e.status){case"created":case"in_progress":return Oe(e,t);case"verified":return P(e,{sessionId:n,status:"verified"});case"review_pending":return P(e,X(n,"review",Y(e,"review")));case"not_verified":return P(e,Ee(e));default:return P(e,{sessionId:n,status:"not_verified"})}}r(Ae,"Q");var xe=new Set([0,1,2,3]);function P(e,t){return xe.has(e.level)&&(t.level=e.level),typeof e.assurance=="string"&&e.assurance.length>0&&(t.assurance=e.assurance),t}r(P,"C");function Ee(e){let t={sessionId:x(e.sessionId),status:"not_verified"};return e.reason!==void 0&&(t.reason=e.reason),e.reasonCode!==void 0&&(t.reasonCode=e.reasonCode),e.reasonCode==="device_cooldown"&&e.retryAfter!==void 0&&(t.retryAfter=e.retryAfter),t}r(Ee,"ne");function Pe(e){return e==="rejected"?"rejected":e==="unavailable"?"unavailable":"inconclusive"}r(Pe,"te");function $e(e,t){if(t===void 0)return!1;let n=y(t).find(i=>i.id===e.id);return n!==void 0&&n.attempts.used===e.attempts.used}r($e,"ie");function Oe(e,t){let n=x(e.sessionId),i=y(e).find(a=>we.has(a.checkType)&&a.state==="input_required"&&a.reason!==void 0);if(i?.reason==="mobile_required")return E(n,"mobile_required");if(i?.reason!==void 0){if(i.result==="unavailable")return E(n,i.reason);let a=t.autoRetry&&(F(i)>0||$e(i,t.previous))?{sessionId:n,status:"retry",reasonCode:i.reason,attemptsRemaining:F(i)}:{sessionId:n,status:"not_verified",reason:Pe(i.result),reasonCode:i.reason,attemptsRemaining:F(i)};return i.retakeHint!==void 0&&(a.retakeHint=i.retakeHint),a}let s=W(e);return s===void 0&&y(e).some(a=>a.state==="review")?X(n,"review",Y(e,"review")):s?.checkType==="portrait_icao"?E(n,"portrait_required"):E(n)}r(Oe,"re");function Y(e,t){return y(e).find(n=>n.state===t&&n.reason!==void 0)?.reason}r(Y,"L");function ee(e,t,n,i,s){return e.presignCapture!==void 0?e.presignCapture(t,n,i,s):e.presign(t,n,i)}r(ee,"K");function te(e){return{engine:e?.engine,durationMs:e?.clipMs,arm:e?.screenRamp?.nonce}}r(te,"q");var qe=["video/webm","video/mp4"],Q="image/jpeg",Re=2,Ne=1e3,Ke=1e4,He=3,Fe=10,ze=3,je=new Set(["network_error","timeout","upload_failed","unknown_error","rate_limit_exceeded"]),De=new Set(["session_not_active","check_not_found","check_already_finalized","check_out_of_order","identity_confirm_required","check_not_active","step_not_on_path","native_app_required"]),k,D=(k=class extends Error{constructor(){super("verification destroyed"),this.name="FlowCancelledError"}},r(k,"k"),k);function Ue(e){let t=$(e);return O(e,"portrait_icao")?.state!=="pending"&&(t!==void 0?j(t):e.capture?.livePhoto?.oneCapture===!0)}r(Ue,"me");var w,A=(w=class extends Error{constructor(t){super(t),this.name="AttestationError"}},r(w,"h"),w),M,Le=(M=class extends A{constructor(t){super(`no attestation token: ${t}`),this.name="AttestationUnavailableError",this.code=t}},r(M,"E"),M);async function ne(e,t,n={}){let i=e.uuid(),s=!1,a=!1,c=0,d=0;for(;;)try{return await t(e.client,i)}catch(o){if(o instanceof A){if(a||o instanceof Le)throw o;a=!0,n.onAttestationInvalid?.(),i=e.uuid();continue}if(!(o instanceof m))throw o;if(o.code==="consent_required"&&!s){s=!0,await e.ensureConsent({force:!0}),i=e.uuid();continue}if(o.code==="attestation_invalid"&&!a){a=!0,n.onAttestationInvalid?.(),i=e.uuid();continue}if(o.code==="inference_unavailable"&&d<He){d+=1;let u=H(o.retryAfterSeconds,Fe,e.random??Math.random);e.onBusy?.({attempt:d,retryAfterSeconds:u/1e3}),await e.sleep(u),n.onAttestationInvalid?.(),i=e.uuid();continue}if(je.has(o.code)&&c<Re){c+=1;let u=o.retryAfterSeconds!==void 0?o.retryAfterSeconds*1e3:void 0;await e.sleep(u!==void 0?Math.min(u,Ke):Ne);continue}throw o}}r(ne,"D");var Je=new Set(["passed","review","processing","skipped"]);async function mt(e){let{artifacts:t}=e,n=t.clip,i=v(t.clipMime??"");if(t.degraded==="NO_RECORDER"||n===void 0||!qe.includes(i))return{kind:"unavailable",reason:"no_recorder"};e.client.armCapture?.(2);let s=Ve(e,t.keyframe),a=Ge(e,n,i,s),c=Be(e,s),d=!1,o=new Set,u=!0,l=0;for(;;){if(e.isCancelled())return{kind:"cancelled"};let p=e.getView();if(Me(p))return{kind:"settled"};let h=W(p),C=h?.checkType,q=C==="liveness"&&!d?"liveness":C==="face_match"&&!o.has(h?.id)&&o.size<2&&u?"face_match":null;if(q===null)return{kind:"settled"};if(q==="liveness"&&t.captureChannel==="desktop")return{kind:"unavailable",reason:"mobile_required"};try{if(q==="liveness"){d=!0;let f=await a();if(e.isCancelled())return{kind:"cancelled"};Se(p,f)&&o.add($(f)?.id);for(let ie of Z(p,f))o.add(ie);await e.applySubmit(f,"liveness");let _=O(e.getView(),"liveness")?.state;u=_===void 0||Je.has(_)}else{o.add(h?.id);let f=await c();if(e.isCancelled())return{kind:"cancelled"};for(let _ of Z(p,f))o.add(_);await e.applySubmit(f,"face_match")}}catch(f){if(e.isCancelled()||f instanceof D)return{kind:"cancelled"};let _=Xe(f);if(_.kind!=="resync"||l>=ze)return _;l+=1,await e.refreshView()}}}r(mt,"Fe");function Ve(e,t){let n=null,i=null,s=r(()=>n!==null?Promise.resolve(n):(i??(i=(async()=>{let a=await ee(e.client,"image",Q,t.size,te(e.artifacts));return await e.client.uploadToSpaces(a.uploadUrl,t,Q),n=(await e.client.completeMedia(a.key)).key,e.onKeyframePromoted?.(n),n})().finally(()=>{i=null})),i),"r");return{ensure:s,attempt:r(()=>s().catch(()=>null),"attempt"),current:r(()=>n,"current")}}r(Ve,"_e");function Ge(e,t,n,i){let s=e.clipKeys?.get()??null,a,c=null,d=0,o;return()=>ne(e,async(u,l)=>{if(s===null||a===void 0){if(e.isCancelled())throw new D;a===void 0&&!Ue(e.getView())&&(a=null),e.onPhase("uploading");let[p,h]=await Promise.all([s!==null?Promise.resolve(s):(async()=>{let C=await ee(u,"clip",n,t.size,te(e.artifacts));return await u.uploadToSpaces(C.uploadUrl,t,n),(await u.completeMedia(C.key)).key})(),a!==void 0?Promise.resolve(a===null?null:a.imageKey):i.attempt()]);s=p,e.clipKeys?.set(p),a===void 0&&(a=h===null?null:{imageKey:h})}if(c===null){let p=performance.now();try{c=await e.getAttestation(),o=e.attestationError?.()}catch(h){throw h instanceof A?h:new A(h instanceof Error?h.message:String(h))}d=Math.round(performance.now()-p)}return e.onPhase("checking"),u.submitCheck("liveness",{clipKey:s,attestation:c,captureChannel:e.artifacts.captureChannel,capture:{...Ze(e.artifacts),attestationMs:d,attestationError:o,...We(e.attestationFacts?.())},...a!==null?{faceMatch:a}:{}},{idempotencyKey:l})},{onAttestationInvalid:r(()=>{c=null},"onAttestationInvalid")})}r(Ge,"ge");function Be(e,t){return()=>ne(e,async(n,i)=>{if(t.current()===null){if(e.isCancelled())throw new D;e.onPhase("uploading")}let s=await t.ensure();return e.onPhase("checking"),n.submitCheck("face_match",{imageKey:s},{idempotencyKey:i})})}r(Be,"ye");function Ze(e){let t={width:e.width,height:e.height};for(let n of Qe)e[n]!==void 0&&(t[n]=e[n]);return t}r(Ze,"Se");var Qe=["engine","facingMode","mode","formFactor","clipMs","clipFrames","fps","clipRetakes","codec","cameraReadyMs","faceAcquireMs","captureMs","screenRamp","provenance"];function We(e){return e===void 0?{}:{attestationChecks:e.checks,...e.challengeMs!==void 0?{attestationChallengeMs:e.challengeMs}:{}}}r(We,"ke");function Xe(e){if(e instanceof A)return{kind:"unavailable",reason:"attestation"};if(e instanceof m){if(e.code==="attestation_invalid")return{kind:"unavailable",reason:"attestation"};if(e.code==="inference_unavailable")return{kind:"unavailable",reason:"inference_unavailable"};if(e.code==="mobile_required")return{kind:"unavailable",reason:"mobile_required"};if(De.has(e.code))return{kind:"resync"}}return{kind:"unavailable",reason:"network"}}r(Xe,"be");var ft="form_answers_invalid",S,yt=(S=class extends Error{constructor(t,n){super(`form answers refused (${t.map(i=>`${i.id}: ${i.code}`).join(", ")})`),this.name="FormAnswersError",this.issues=t,this.source=n}},r(S,"U"),S),I,_t=(I=class extends Error{constructor(t,n){super(`invalid ${t} (${n})`),this.name="InvalidInputError",this.field=t,this.kind=n}},r(I,"B"),I),T,vt=(T=class extends Error{constructor(t,n){super(`invalid ${t} (${n})`),this.name="OtpInputError",this.field=t,this.kind=n}},r(T,"$"),T);function z(e){return e?.source==="upload"?null:e?.source==="choice"&&e.sourcePick!=="camera"?"upload_or_phone":"phone"}r(z,"I");function gt(e,t){if(t===void 0||!j(t)||t.requiresMobile!==!0)return null;switch(t.checkType){case"liveness":return"phone";case"face_match":{if(t.reason!==void 0)return"phone";let n=O(e,"portrait_icao");return n?.state==="passed"||n?.state==="review"?null:"phone"}case"doc_ocr":return z(e.documents);case"poa":return z(e.proofOfAddress);case"portrait_icao":{let n=e.portrait;return n?.pendingFix!==void 0||n?.reuse?.pending===!0?null:z(n)}default:return null}}r(gt,"De");function Ye(e){let t=e?.capture,n=t?.mode;return n==="assisted"||n==="self"||n==="choice"?n:t?.cameraSwitch===!0?"assisted":"self"}r(Ye,"we");function bt(e){let t=e?.capture?.pick;return Ye(e)==="choice"&&(t==="self"||t==="assisted")?t:null}r(bt,"Be");function kt(e,t,n=null){return e==="choice"?t??n??"self":e}r(kt,"$e");var wt={"JP:drivers_license":{normalize:"upper_no_space_or_hyphen",pattern:"^[0-9]{12}$",check:null,registrySources:[],describe:"number must be the 12-digit Japanese driving licence number"},"JP:residence_permit":{normalize:"upper_no_space_or_hyphen",pattern:"^[A-Z]{2}[0-9]{8}[A-Z]{2}$",check:null,registrySources:[],describe:"number must be the 12-character residence card number: two letters, eight digits, two letters"},"MR:drivers_license":{normalize:"upper_no_space_or_hyphen",pattern:"^[0-9]{8}$",check:null,registrySources:[],describe:"number must be the 8-digit Mauritanian driver's license number"},"MR:national_id":{normalize:"trim",pattern:"^[0-9]{10}$",check:"mr_nni_mod97",registrySources:["MR.anrpts"],describe:"number must be the 10-digit Mauritanian national ID number with a valid check digit"}};export{m as a,v as b,it as c,st as d,rt as e,dt as f,ut as g,lt as h,be as i,y as j,F as k,ke as l,pt as m,j as n,Me as o,W as p,O as q,x as r,E as s,ht as t,Ce as u,ee as v,qe as w,Le as x,ne as y,mt as z,Ze as A,ft as B,yt as C,_t as D,vt as E,gt as F,Ye as G,bt as H,kt as I,wt as J};
|
|
1
|
+
import{b as L}from"./chunk-32CNXSJQ.js";import{a as J,c as R}from"./chunk-U7QPOSFH.js";import{b as U}from"./chunk-6MYG4HWP.js";import{a as r}from"./chunk-4FHWXBOB.js";var g,h=(g=class extends Error{constructor(t){super(t.message),this.name="HostedApiError",this.status=t.status,this.code=t.code,t.retryAfterSeconds!==void 0&&(this.retryAfterSeconds=t.retryAfterSeconds),t.details&&(this.details=t.details)}},r(g,"u"),g);function H(e,t,n=Math.random){let i=(e??t)*1e3,s=Math.min(Math.max(i,500),2e4),a=Math.round(s*(1+(n()*2-1)*.25));return Math.min(Math.max(a,500),2e4)}r(H,"T");var V=6e4,N=4,se=3e4,re=9e5,ae=200,oe=5,ce=400,de=new Set(["server_busy","request_timeout"]),ue=20,le=60,pe=600,he=2;function v(e){return(e.split(";")[0]??"").trim()}r(v,"l");var me={liveness:"clipKey",face_match:"imageKey",doc_ocr:"imageKey"},fe=`@sekyro/web/${J}`,ye=fe,b,st=(b=class{constructor(t){this.sessionId=null,this.bootstrap=null,this.captureNonces=[],this.captureFetch=null,this.reportedIssues=new Map,this.issueReports=0,this.issuesPausedUntil=0,this.apiOrigin=t.apiOrigin.replace(/\/+$/,""),this.sessionToken=t.sessionToken;let n=t.fetch;this.fetchImpl=(i,s)=>(n??globalThis.fetch).call(globalThis,i,s),this.requestTimeoutMs=t.requestTimeoutMs??se,this.retryAttempts=t.inProgressRetry?.attempts??oe,this.retryDelayMs=t.inProgressRetry?.delayMs??ce,this.random=t.random??Math.random,this.clientLocale=t.locale}async getSession(){let t=await this.api("GET","/hosted/session");return this.sessionId=t.sessionId,t}async recordConsent(t){let n=await this.api("POST","/hosted/consent",{body:{locale:t},busyRetry:!0}),i=this.captureHold;return this.captureHold=void 0,i&&this.armCapture(i),n}async reportCameraUnavailable(t){return this.api("POST","/hosted/camera-unavailable",{body:{cause:t}})}async testerGate(t){return this.api("POST","/hosted/tester-gate",{body:{input:t}})}async reportCaptureIssue(t){let n=typeof t.name=="string"?t.name.replace(/[^A-Za-z]/g,"").slice(0,40):"",i=typeof t.engineKind=="string"&&/^[a-z_]{1,32}$/.test(t.engineKind)?t.engineKind:void 0,s=typeof t.attempt=="number"&&Number.isInteger(t.attempt)&&t.attempt>=0&&t.attempt<=1e3?t.attempt:void 0,a=t.check==="attestation"?s??"":"",c=[t.check,a,t.kind,n,t.phase??"",i??""].join("|"),d=this.reportedIssues.get(c);if(d!==void 0)return d;if(Date.now()<this.issuesPausedUntil||this.issueReports>=ue)return;let o={check:t.check,kind:t.kind,...n!==""?{name:n}:{},...t.phase!==void 0?{phase:t.phase}:{},...i!==void 0?{engineKind:i}:{},...s!==void 0?{attempt:s}:{},...t.formFactor!==void 0?{formFactor:t.formFactor}:{},...typeof t.detail=="string"&&/^\d{1,10}$/.test(t.detail)?{detail:t.detail}:{},...G(t.challengeMs)?{challengeMs:t.challengeMs}:{},...G(t.readyMs)?{readyMs:t.readyMs}:{},...t.inApp===!0?{inApp:!0}:{}};this.issueReports+=1;let u=this.api("POST","/hosted/capture-issue",{body:o,empty:!0}).catch(l=>{if(l instanceof h&&l.status===429){let p=Math.min(Math.max(l.retryAfterSeconds??le,0),pe);this.issuesPausedUntil=Math.max(this.issuesPausedUntil,Date.now()+p*1e3);return}(!(l instanceof h)||l.status===0||l.status>=500)&&this.reportedIssues.delete(c)});return this.reportedIssues.set(c,u),u}async choose(t,n){let i=await this.api("POST","/hosted/choice",{body:{nodeId:t,option:n},busyRetry:!0});return this.sessionId=i.sessionId,i}async confirmIdentity(t){return this.api("POST","/hosted/identity/confirm",{body:{decision:t}})}async identityPortrait(){return this.api("GET","/hosted/identity/portrait",{blob:!0})}async presign(t,n,i,s={}){let a=await this.ensureSessionId(),c={kind:t,contentType:v(n),contentLength:i,...s.source==="upload"?{source:"upload"}:{}};return this.api("POST",`/sessions/${a}/media`,{body:c})}armCapture(t=2){let n=Date.now();this.captureNonces.filter(i=>i.expiresAt-V>n).length>=t||(this.captureHold===void 0?this.fillCaptureNonces(t,t):this.captureHold=Math.max(this.captureHold,t))}async armRamp(){try{let t=await this.ensureSessionId(),n=await this.api("POST",`/sessions/${t}/media/capture-nonces`,{body:{count:2,ramp:!0}}),i=Date.now(),s=L(n.screenRamp)?n.screenRamp:void 0,a=i+Math.max(0,n.expiresIn)*1e3;for(let d of Array.isArray(n.nonces)?n.nonces:[])typeof d!="string"||d.length===0||this.captureNonces.push({nonce:d,expiresAt:a,...s!==void 0?{arm:s.nonce}:{}});this.captureNonces=this.captureNonces.slice(-N),this.captureHold=void 0;let c=typeof n.rampExpiresIn=="number"&&n.rampExpiresIn>0?n.rampExpiresIn:0;return{...s!==void 0?{challenge:s}:{},expiresAt:i+c*1e3}}catch{return}}async presignCapture(t,n,i,s={}){let a=await this.ensureSessionId(),c=await this.takeCaptureNonce(s.arm),d=c===void 0?void 0:{nonce:c,...s.engine!==void 0?{engine:s.engine.slice(0,32)}:{},...s.durationMs!==void 0&&Number.isFinite(s.durationMs)?{captureMs:Math.min(36e5,Math.max(0,Math.round(s.durationMs)))}:{}},o={kind:t,contentType:v(n),contentLength:i,capture:d};return this.api("POST",`/sessions/${a}/media`,{body:o})}async takeCaptureNonce(t){let n=r(()=>{let i=Date.now();this.captureNonces=this.captureNonces.filter(a=>a.expiresAt-V>i);let s=this.captureNonces.findIndex(a=>a.arm===t);return this.captureNonces.splice(s<0?0:s,1)[0]?.nonce},"n");for(let i=0;i<2;i++){let s=n();if(s!==void 0)return s;await this.fillCaptureNonces(1)}return n()}fillCaptureNonces(t,n=0){return this.captureFetch??(this.captureFetch=(async()=>{try{let i=await this.ensureSessionId(),s=await this.api("POST",`/sessions/${i}/media/capture-nonces`,{body:{count:Math.min(N,Math.max(1,t))}}),a=Date.now()+Math.max(0,s.expiresIn)*1e3;for(let c of Array.isArray(s.nonces)?s.nonces:[])typeof c=="string"&&c.length>0&&this.captureNonces.push({nonce:c,expiresAt:a});this.captureNonces=this.captureNonces.slice(-N),this.captureHold=void 0}catch(i){i instanceof h&&i.code==="consent_required"&&(this.captureHold=Math.max(this.captureHold??0,n))}})().finally(()=>{this.captureFetch=null})),this.captureFetch}async uploadToSpaces(t,n,i){let s;try{s=await this.fetchImpl(t,{method:"PUT",headers:{"content-type":v(i)},body:n,signal:AbortSignal.timeout(re)})}catch(a){throw K(a)}if(!s.ok){let a=(await s.text().catch(()=>"")).slice(0,ae);throw new h({status:s.status,code:"upload_failed",message:`media upload failed (HTTP ${s.status})${a?`: ${a}`:""}`})}}async completeMedia(t){let n=await this.ensureSessionId();return this.api("POST",`/sessions/${n}/media/complete`,{body:{key:t}})}async submitCheck(t,n,i={}){let s=await this.ensureSessionId(),a={input:n,forceOutcome:i.forceOutcome};return this.api("POST",`/sessions/${s}/checks/${t}`,{body:a,idempotencyKey:i.idempotencyKey,...i.browserCheckToken!==void 0?{browserCheckToken:i.browserCheckToken}:{},busyRetry:i.idempotencyKey!==void 0})}async uploadAndSubmit(t,n,i,s={}){let a=v(n.contentType),c=await this.presign(n.kind,a,n.blob.size);await this.uploadToSpaces(c.uploadUrl,n.blob,a);let d=await this.completeMedia(c.key),o={...i,[me[t]]:d.key};return this.submitCheck(t,o,s)}async ensureSessionId(){return this.sessionId!==null?this.sessionId:(this.bootstrap??(this.bootstrap=this.getSession().finally(()=>{this.bootstrap=null})),(await this.bootstrap).sessionId)}async api(t,n,i={}){let s=t==="GET"||i.busyRetry===!0,a=`${this.apiOrigin}/api/v2${n}`,c={"x-session-token":this.sessionToken,"x-sekyro-sdk":ye};i.body!==void 0&&(c["content-type"]="application/json"),i.idempotencyKey!==void 0&&(c["x-idempotency-key"]=i.idempotencyKey),i.browserCheckToken!==void 0&&(c["sekyro-browser-check"]=i.browserCheckToken),this.clientLocale!==void 0&&(c["sekyro-client-locale"]=this.clientLocale);try{let d=R.timezone();d!==void 0&&(c["sekyro-client-timezone"]=d)}catch{}c["sekyro-client-form-factor"]=U();try{let d=await R.deviceHeader();d!==void 0&&(c["sekyro-client-device"]=d)}catch{}for(let d=0;;d++){let o;try{o=await this.fetchImpl(a,{method:t,headers:c,...i.body!==void 0?{body:JSON.stringify(i.body)}:{},cache:"no-store",signal:AbortSignal.timeout(this.requestTimeoutMs)})}catch(l){throw K(l)}if(o.ok){if(i.empty===!0)return;if(i.blob===!0)try{return await o.blob()}catch(p){throw K(p)}let l;try{l=await o.json()}catch{throw new h({status:o.status,code:"unknown_error",message:`response body was not valid JSON (HTTP ${o.status})`})}return _e(l)}let u=await ve(o);if(u.code==="idempotency_in_progress"&&d<this.retryAttempts){this.retryDelayMs>0&&await B(this.retryDelayMs);continue}if(s&&u.status===503&&de.has(u.code)){s=!1,await B(H(u.retryAfterSeconds,he,this.random));continue}throw u}}},r(b,"S"),b);function G(e){return typeof e=="number"&&Number.isInteger(e)&&e>=0&&e<=6e5}r(G,"k");function K(e){if((typeof e=="object"&&e!==null?e.name:void 0)==="TimeoutError")return new h({status:0,code:"timeout",message:"request timed out"});let t=e instanceof Error?e.message:String(e);return new h({status:0,code:"network_error",message:`network request failed: ${t}`})}r(K,"f");function _e(e){return e!==null&&typeof e=="object"&&"success"in e&&"data"in e?e.data:e}r(_e,"L");async function ve(e){let t="unknown_error",n=`request failed (HTTP ${e.status})`,i=Number.NaN,s;try{let d=await e.json();if(d!==null&&typeof d=="object"){let o=d;typeof o.code=="string"&&o.code.length>0&&(t=o.code),typeof o.message=="string"&&o.message.length>0&&(n=o.message),typeof o.retryAfterSeconds=="number"&&(i=o.retryAfterSeconds),Array.isArray(o.details?.issues)?s=o.details:Array.isArray(o.details?.errors)&&(s={...o.details,issues:[]})}}catch{}let a=e.headers.get("retry-after"),c=a===null?Math.floor(i):Number.parseInt(a,10);return new h({status:e.status,code:t,message:n,...Number.isFinite(c)&&c>=0?{retryAfterSeconds:c}:{},details:s})}r(ve,"V");function B(e){return new Promise(t=>setTimeout(t,e))}r(B,"R");function rt(e){let t=e?.portrait,n=t?.icao,i=t?.purpose==="id_document";return n==null?i?{policy:"reject",profile:"id_document"}:null:{policy:n.policy==="alert"?"alert":"reject",profile:i||n.profile==="id_document"?"id_document":"selfie"}}r(rt,"J");function at(e){return{...e.baselineEyeOpenness!==void 0?{baselineEyeOpenness:e.baselineEyeOpenness}:{},...e.baselineEyeOpennessLeft!==void 0&&e.baselineEyeOpennessRight!==void 0?{baselineEyeOpennessLeft:e.baselineEyeOpennessLeft,baselineEyeOpennessRight:e.baselineEyeOpennessRight}:{},criteria:e.verdict??{},...e.backgroundCheck!==void 0?{backgroundCheck:e.backgroundCheck}:{}}}r(at,"Q");var ge=new Set(["nni_unbound","id_number_unbound","method_required","mobile_required","portrait_required"]);function ut(e){return ge.has(e)}r(ut,"ve");function lt(e,t,n){let i=t.detail;return{check:e,kind:t.kind,...i?.name!==void 0?{name:i.name}:{},...i?.phase!==void 0?{phase:i.phase}:{},...i?.engineKind!==void 0?{engineKind:i.engineKind}:{},attempt:Math.max(0,Math.min(1e3,n))}}r(lt,"Pe");function pt(){let e=-1,t="";return{note(n){n==="starting"&&t!=="starting"&&(e+=1),t=n},newHandle(){t=""},noteError(){e<0&&(e=0)},get value(){return e}}}r(pt,"xe");var be={document:"document_photo",nfc:"document_chip",population_registry:"national_number",national_eid:"national_eid"};function y(e){return e.plan?.steps??[]}r(y,"f");function F(e){return Math.max(0,e.attempts.max-e.attempts.used)}r(F,"x");function ke(e){let t=e.plan?.choice;return t!==void 0&&e.plan?.current===t.nodeId?t:null}r(ke,"J");function ht(e){let t=ke(e);if(t?.kind!=="identity_method")return null;let n=t.options.map(s=>be[s.service]).filter(s=>s!==void 0),i=t.options.find(s=>s.nationalEid)?.nationalEid;return i?{available:!0,selected:null,options:n,nationalEid:i}:{available:!0,selected:null,options:n}}r(ht,"Ve");var we=new Set(["liveness","face_match"]);function j(e){return e!==void 0&&(e.state==="pending"||e.state==="input_required")}r(j,"R");function Me(e){return e.status!=="created"&&e.status!=="in_progress"}r(Me,"T");function Y(e){let t=e.plan?.current,n=t==null?void 0:y(e).find(i=>i.id===t);return j(n)?n:void 0}r(Y,"M");function $(e,t){return y(e).find(n=>n.checkType===t)}r($,"_");function O(e){let t=y(e),n=t.findIndex(i=>i.checkType==="liveness");return t.find((i,s)=>s>n&&i.checkType==="face_match")}r(O,"S");function Se(e,t){let n=$(t,"liveness")?.state,i=O(t)?.state;return(O(e)?.state??"pending")==="pending"&&(n==="passed"||n==="review")&&i!==void 0&&i!=="pending"&&i!=="skipped"}r(Se,"F");function Z(e,t){let n=new Map(y(e).map(i=>[i.id,i.state]));return y(t).filter(i=>i.checkType==="face_match"&&(n.get(i.id)??"pending")==="pending"&&i.state!=="pending"&&i.state!=="skipped").map(i=>i.id)}r(Z,"V");var Ie=/^[0-9a-f]{24}$/i;function x(e){return Ie.test(e)?`ses_${e}`:e}r(x,"k");function E(e,t){let n=x(e);return t===void 0?{sessionId:n,status:"unavailable"}:{sessionId:n,status:"unavailable",reasonCode:t}}r(E,"C");function W(e,t,n){let i=x(e);return n===void 0?{sessionId:i,status:t}:{sessionId:i,status:t,reasonCode:n}}r(W,"O");function mt(e,t){let n=Ae(e,t),i=Te(e);return i!==void 0&&(n.sandbox={simulated:!0,reason:i}),n}r(mt,"Ee");var Ce=new Set(["no_testers","tester_gate_not_used","tester_gate_missed"]);function Te(e){if(e.sandbox!==!0)return;let t=e.simulation?.reason;return Ce.has(t)?t:void 0}r(Te,"Z");function Ae(e,t){let n=x(e.sessionId);switch(e.status){case"created":case"in_progress":return $e(e,t);case"verified":return P(e,{sessionId:n,status:"verified"});case"review_pending":return P(e,W(n,"review",X(e,"review")));case"not_verified":return P(e,Ee(e));default:return P(e,{sessionId:n,status:"not_verified"})}}r(Ae,"Q");var xe=new Set([0,1,2,3]);function P(e,t){return xe.has(e.level)&&(t.level=e.level),typeof e.assurance=="string"&&e.assurance.length>0&&(t.assurance=e.assurance),t}r(P,"v");function Ee(e){let t={sessionId:x(e.sessionId),status:"not_verified"};return e.reason!==void 0&&(t.reason=e.reason),e.reasonCode!==void 0&&(t.reasonCode=e.reasonCode),e.reasonCode==="device_cooldown"&&e.retryAfter!==void 0&&(t.retryAfter=e.retryAfter),t}r(Ee,"ne");function Pe(e){return e==="rejected"?"rejected":e==="unavailable"?"unavailable":"inconclusive"}r(Pe,"te");function Oe(e,t){if(t===void 0)return!1;let n=y(t).find(i=>i.id===e.id);return n!==void 0&&n.attempts.used===e.attempts.used}r(Oe,"ie");function $e(e,t){let n=x(e.sessionId),i=y(e).find(a=>we.has(a.checkType)&&a.state==="input_required"&&a.reason!==void 0);if(i?.reason==="mobile_required")return E(n,"mobile_required");if(i?.reason!==void 0){if(i.result==="unavailable")return E(n,i.reason);let a=t.autoRetry&&(F(i)>0||Oe(i,t.previous))?{sessionId:n,status:"retry",reasonCode:i.reason,attemptsRemaining:F(i)}:{sessionId:n,status:"not_verified",reason:Pe(i.result),reasonCode:i.reason,attemptsRemaining:F(i)};return i.retakeHint!==void 0&&(a.retakeHint=i.retakeHint),a}let s=Y(e);return s===void 0&&y(e).some(a=>a.state==="review")?W(n,"review",X(e,"review")):s?.checkType==="portrait_icao"?E(n,"portrait_required"):E(n)}r($e,"re");function X(e,t){return y(e).find(n=>n.state===t&&n.reason!==void 0)?.reason}r(X,"L");function ee(e,t,n,i,s){return e.presignCapture!==void 0?e.presignCapture(t,n,i,s):e.presign(t,n,i)}r(ee,"K");function te(e){return{engine:e?.engine,durationMs:e?.clipMs,arm:e?.screenRamp?.nonce}}r(te,"q");var qe=["video/webm","video/mp4"],Q="image/jpeg",Re=2,Ne=1e3,Ke=1e4,He=3,Fe=10,ze=3,je=new Set(["network_error","timeout","upload_failed","unknown_error","rate_limit_exceeded"]),De=new Set(["session_not_active","check_not_found","check_already_finalized","check_out_of_order","identity_confirm_required","check_not_active","step_not_on_path","native_app_required"]),k,D=(k=class extends Error{constructor(){super("verification destroyed"),this.name="FlowCancelledError"}},r(k,"b"),k);function Le(e){let t=O(e);return $(e,"portrait_icao")?.state!=="pending"&&(t!==void 0?j(t):e.capture?.livePhoto?.oneCapture===!0)}r(Le,"me");var w,A=(w=class extends Error{constructor(t){super(t),this.name="AttestationError"}},r(w,"h"),w),M,Ue=(M=class extends A{constructor(t){super(`no attestation token: ${t}`),this.name="AttestationUnavailableError",this.code=t}},r(M,"E"),M);function ft(e){return new h({status:400,code:"attestation_invalid",message:`browser check: ${e}`,details:{issues:[],browserCheck:e}})}r(ft,"Oe");function Je(e){if(!(e instanceof h)||e.code!=="attestation_invalid")return;let t=e.details?.browserCheck;return typeof t=="string"?t:void 0}r(Je,"he");async function ne(e,t,n={}){let i=e.uuid(),s=!1,a=!1,c=0,d=0;for(;;)try{return await t(e.client,i)}catch(o){if(o instanceof A){if(a||o instanceof Ue)throw o;a=!0,n.onAttestationInvalid?.(),i=e.uuid();continue}if(!(o instanceof h))throw o;if(o.code==="consent_required"&&!s){s=!0,await e.ensureConsent({force:!0}),i=e.uuid();continue}if(o.code==="attestation_invalid"&&!a&&Je(o)===void 0){a=!0,n.onAttestationInvalid?.(),i=e.uuid();continue}if(o.code==="inference_unavailable"&&d<He){d+=1;let u=H(o.retryAfterSeconds,Fe,e.random??Math.random);e.onBusy?.({attempt:d,retryAfterSeconds:u/1e3}),await e.sleep(u),n.onAttestationInvalid?.(),i=e.uuid();continue}if(je.has(o.code)&&c<Re){c+=1;let u=o.retryAfterSeconds!==void 0?o.retryAfterSeconds*1e3:void 0;await e.sleep(u!==void 0?Math.min(u,Ke):Ne);continue}throw o}}r(ne,"D");var Ve=new Set(["passed","review","processing","skipped"]);async function yt(e){let{artifacts:t}=e,n=t.clip,i=v(t.clipMime??"");if(t.degraded==="NO_RECORDER"||n===void 0||!qe.includes(i))return{kind:"unavailable",reason:"no_recorder"};e.client.armCapture?.(2);let s=Ge(e,t.keyframe),a=Be(e,n,i,s),c=Ze(e,s),d=!1,o=new Set,u=!0,l=0;for(;;){if(e.isCancelled())return{kind:"cancelled"};let p=e.getView();if(Me(p))return{kind:"settled"};let m=Y(p),T=m?.checkType,q=T==="liveness"&&!d?"liveness":T==="face_match"&&!o.has(m?.id)&&o.size<2&&u?"face_match":null;if(q===null)return{kind:"settled"};if(q==="liveness"&&t.captureChannel==="desktop")return{kind:"unavailable",reason:"mobile_required"};try{if(q==="liveness"){d=!0;let f=await a();if(e.isCancelled())return{kind:"cancelled"};Se(p,f)&&o.add(O(f)?.id);for(let ie of Z(p,f))o.add(ie);await e.applySubmit(f,"liveness");let _=$(e.getView(),"liveness")?.state;u=_===void 0||Ve.has(_)}else{o.add(m?.id);let f=await c();if(e.isCancelled())return{kind:"cancelled"};for(let _ of Z(p,f))o.add(_);await e.applySubmit(f,"face_match")}}catch(f){if(e.isCancelled()||f instanceof D)return{kind:"cancelled"};let _=Xe(f);if(_.kind!=="resync"||l>=ze)return _;l+=1,await e.refreshView()}}}r(yt,"Le");function Ge(e,t){let n=null,i=null,s=r(()=>n!==null?Promise.resolve(n):(i??(i=(async()=>{let a=await ee(e.client,"image",Q,t.size,te(e.artifacts));return await e.client.uploadToSpaces(a.uploadUrl,t,Q),n=(await e.client.completeMedia(a.key)).key,e.onKeyframePromoted?.(n),n})().finally(()=>{i=null})),i),"r");return{ensure:s,attempt:r(()=>s().catch(()=>null),"attempt"),current:r(()=>n,"current")}}r(Ge,"ge");function Be(e,t,n,i){let s=e.clipKeys?.get()??null,a,c=null,d=0,o;return()=>ne(e,async(u,l)=>{if(s===null||a===void 0){if(e.isCancelled())throw new D;a===void 0&&!Le(e.getView())&&(a=null),e.onPhase("uploading");let[p,m]=await Promise.all([s!==null?Promise.resolve(s):(async()=>{let T=await ee(u,"clip",n,t.size,te(e.artifacts));return await u.uploadToSpaces(T.uploadUrl,t,n),(await u.completeMedia(T.key)).key})(),a!==void 0?Promise.resolve(a===null?null:a.imageKey):i.attempt()]);s=p,e.clipKeys?.set(p),a===void 0&&(a=m===null?null:{imageKey:m})}if(c===null){let p=performance.now();try{c=await e.getAttestation(),o=e.attestationError?.()}catch(m){throw m instanceof A?m:new A(m instanceof Error?m.message:String(m))}d=Math.round(performance.now()-p)}return e.onPhase("checking"),u.submitCheck("liveness",{clipKey:s,attestation:c,captureChannel:e.artifacts.captureChannel,capture:{...Qe(e.artifacts),attestationMs:d,attestationError:o,...We(e.attestationFacts?.())},...a!==null?{faceMatch:a}:{}},{idempotencyKey:l})},{onAttestationInvalid:r(()=>{c=null},"onAttestationInvalid")})}r(Be,"ye");function Ze(e,t){return()=>ne(e,async(n,i)=>{if(t.current()===null){if(e.isCancelled())throw new D;e.onPhase("uploading")}let s=await t.ensure();return e.onPhase("checking"),n.submitCheck("face_match",{imageKey:s},{idempotencyKey:i})})}r(Ze,"Se");function Qe(e){let t={width:e.width,height:e.height};for(let n of Ye)e[n]!==void 0&&(t[n]=e[n]);return t}r(Qe,"Re");var Ye=["engine","facingMode","mode","formFactor","clipMs","clipFrames","fps","clipRetakes","codec","cameraReadyMs","faceAcquireMs","captureMs","screenRamp","provenance"];function We(e){return e===void 0?{}:{attestationChecks:e.checks,...e.challengeMs!==void 0?{attestationChallengeMs:e.challengeMs}:{}}}r(We,"be");function Xe(e){if(e instanceof A)return{kind:"unavailable",reason:"attestation"};if(e instanceof h){if(e.code==="attestation_invalid")return{kind:"unavailable",reason:"attestation"};if(e.code==="inference_unavailable")return{kind:"unavailable",reason:"inference_unavailable"};if(e.code==="mobile_required")return{kind:"unavailable",reason:"mobile_required"};if(De.has(e.code))return{kind:"resync"}}return{kind:"unavailable",reason:"network"}}r(Xe,"we");var _t="form_answers_invalid",S,vt=(S=class extends Error{constructor(t,n){super(`form answers refused (${t.map(i=>`${i.id}: ${i.code}`).join(", ")})`),this.name="FormAnswersError",this.issues=t,this.source=n}},r(S,"U"),S),I,gt=(I=class extends Error{constructor(t,n){super(`invalid ${t} (${n})`),this.name="InvalidInputError",this.field=t,this.kind=n}},r(I,"B"),I),C,bt=(C=class extends Error{constructor(t,n){super(`invalid ${t} (${n})`),this.name="OtpInputError",this.field=t,this.kind=n}},r(C,"$"),C);function z(e){return e?.source==="upload"?null:e?.source==="choice"&&e.sourcePick!=="camera"?"upload_or_phone":"phone"}r(z,"I");function kt(e,t){if(t===void 0||!j(t)||t.requiresMobile!==!0)return null;switch(t.checkType){case"liveness":return"phone";case"face_match":{if(t.reason!==void 0)return"phone";let n=$(e,"portrait_icao");return n?.state==="passed"||n?.state==="review"?null:"phone"}case"doc_ocr":return z(e.documents);case"poa":return z(e.proofOfAddress);case"portrait_icao":{let n=e.portrait;return n?.pendingFix!==void 0||n?.reuse?.pending===!0?null:z(n)}default:return null}}r(kt,"Be");function et(e){let t=e?.capture,n=t?.mode;return n==="assisted"||n==="self"||n==="choice"?n:t?.cameraSwitch===!0?"assisted":"self"}r(et,"Ce");function wt(e){let t=e?.capture?.pick;return et(e)==="choice"&&(t==="self"||t==="assisted")?t:null}r(wt,"Ye");function Mt(e,t,n=null){return e==="choice"?t??n??"self":e}r(Mt,"ze");var St={"JP:drivers_license":{normalize:"upper_no_space_or_hyphen",pattern:"^[0-9]{12}$",check:null,registrySources:[],describe:"number must be the 12-digit Japanese driving licence number"},"JP:residence_permit":{normalize:"upper_no_space_or_hyphen",pattern:"^[A-Z]{2}[0-9]{8}[A-Z]{2}$",check:null,registrySources:[],describe:"number must be the 12-character residence card number: two letters, eight digits, two letters"},"MR:drivers_license":{normalize:"upper_no_space_or_hyphen",pattern:"^[0-9]{8}$",check:null,registrySources:[],describe:"number must be the 8-digit Mauritanian driver's license number"},"MR:national_id":{normalize:"trim",pattern:"^[0-9]{10}$",check:"mr_nni_mod97",registrySources:["MR.anrpts"],describe:"number must be the 10-digit Mauritanian national ID number with a valid check digit"}};export{h as a,v as b,st as c,rt as d,at as e,ut as f,lt as g,pt as h,be as i,y as j,F as k,ke as l,ht as m,j as n,Me as o,Y as p,$ as q,x as r,E as s,mt as t,Te as u,ee as v,qe as w,Ue as x,ft as y,Je as z,ne as A,yt as B,Qe as C,_t as D,vt as E,gt as F,bt as G,kt as H,et as I,wt as J,Mt as K,St as L};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import{A as Qe,B as Xe,C as et,H as me,I as ee,J as tt,K as nt,L as rt,a as U,b as je,c as Ke,f as Be,g as Ve,h as He,i as $e,j as pe,k as ze,m as F,o as N,p as q,q as $,r as X,s as D,t as fe,v as Ze,w as We,x as Je,y as Ye}from"./chunk-PZVVXMQ6.js";import{g as at}from"./chunk-32CNXSJQ.js";import{b as Ge}from"./chunk-U7QPOSFH.js";import{b as qe,c as de,e as it}from"./chunk-6MYG4HWP.js";import{a as t}from"./chunk-4FHWXBOB.js";function Ot(n){let i=n.now??(()=>Date.now()),f=n.setTimer??((A,c)=>setTimeout(A,c)),m=n.clearTimer??(A=>clearTimeout(A)),_=null,b=!1,d=!1,M=!1,j=0,P=null,C=t(()=>{P!==null&&m(P),P=null},"_"),S=t(()=>{let A=n.armRamp;A===void 0||b||d||M||i()<j||(b=!0,A().catch(()=>{}).then(c=>{if(b=!1,!M){if(c===void 0){j=i()+2e3;return}if(c.challenge===void 0){d=!0;return}_={challenge:c.challenge,expiresAt:c.expiresAt},C(),P=f(()=>{P=null,!M&&_!==null&&n.waiting()&&S()},Math.max(1e3,c.expiresAt-i()-2e4))}}))},"R");return{arm(){_!==null&&_.expiresAt-i()>2e4||S()},take(){let A=_;return _=null,C(),A!==null&&A.expiresAt-i()>=12e3?A.challenge:void 0},stop(){M=!0,_=null,C()}}}t(Ot,"St");function Dt(n){return n.idNumberBound??n.nniBound}t(Dt,"ue");function ot(n){return n===void 0?void 0:n.idNumberFromDocument??n.nniFromDocument}t(ot,"ee");var ct="https://api.sekyro.ai",Lt=5e3,Ut=24e4,dt=3e4,pt=9e4;function st(n,i){return n==="portrait_icao"||n==="poa"||n==="doc_ocr"&&i.source==="upload"?pt:dt}t(st,"kt");var Ft=25*6e4,qt=20*6e4,Gt=3,jt=3e3,Kt=1500,Bt=10;function lt(n){return n instanceof Error&&n.name==="ChallengeError"&&n.code||"challenge_failed"}t(lt,"Ct");var ut=new Set(["aborted","embedder_opaque","site_key_rejected","clock_wrong"]);function Vt(n){return new Promise(i=>setTimeout(i,n))}t(Vt,"pn");function Ht(){let n=globalThis.crypto;if(n!==void 0&&typeof n.randomUUID=="function")return n.randomUUID();let i=new Uint8Array(16);if(n!==void 0&&typeof n.getRandomValues=="function")n.getRandomValues(i);else for(let m=0;m<16;m+=1)i[m]=Math.floor(Math.random()*256);i[6]=(i[6]??0)&15|64,i[8]=(i[8]??0)&63|128;let f=[...i].map(m=>m.toString(16).padStart(2,"0")).join("");return`${f.slice(0,8)}-${f.slice(8,12)}-${f.slice(12,16)}-${f.slice(16,20)}-${f.slice(20)}`}t(Ht,"fn");function $t(n){return zt(n,{})}t($t,"Oo");function zt(n,i){let f=n.apiOrigin??ct,m=n.autoRetry??!0,_=n.rearm??"auto",b=i.client??new Ke({apiOrigin:f,sessionToken:n.clientToken,fetch:n.fetch,locale:n.locale}),d=new Proxy(b,{get(e,r){if(r==="submitCheck")return wt;let a=Reflect.get(e,r,e);return typeof a=="function"?a.bind(e):a}}),M=i.sleep??Vt,j=i.uuid??Ht,P=i.getChallengeToken??((e,r)=>import("./challenge-frame-YBTLAQ5G-NN763UU5.js").then(a=>a.executeChallenge({frameUrl:e.url,siteKey:e.siteKey,action:"liveness",subject:r.subject,signal:r.signal}))),C=it(),S=null,A=null,c=!1,ve=new AbortController,h=null,z=null,Z=null,W=t(()=>Z??tt(h),"ne"),J=t(()=>nt(ee(h),W()),"oe"),T=t(e=>{h=e,!N(e)&&(Re(qt)||bt(e))&&ue(e),C.emit("view",e),S?.onView(e)},"I"),k=t(()=>h!==null?Promise.resolve(h):(z??(z=d.getSession().then(e=>(T(e),e)).finally(()=>{z=null})),z),"P"),x=t(async()=>{let e=await d.getSession();return T(e),e},"v"),te=t(async(e,r)=>{e.plan!==void 0?T(e):await x()},"le"),Y=null,ge=t(async e=>{let r=await k();if(e||!r.consentRecorded){let a=await d.recordConsent(n.locale);a.plan!==void 0?T(a):h!==null&&T({...h,consentRecorded:!0})}Q()&&ue(r)},"Me"),R=t(e=>e?.force===!0?ge(!0):(Y??(Y=ge(!1).finally(()=>{Y=null})),Y),"N"),ne={client:d,ensureConsent:t(e=>R(e),"ensureConsent"),sleep:M,uuid:j,...i.random!==void 0?{random:i.random}:{},onBusy:t(e=>{c||C.emit("busy",e)},"onBusy")},_e=!1,be=null,re=t(e=>{if(e.status==="verified"||e.status==="not_verified"||e.status==="review"){if(_e)return;_e=!0}be=JSON.stringify(e),C.emit("result",e)},"me"),vt=t(e=>{be!==JSON.stringify(e)&&re(e)},"Ut"),ke=t(async e=>{let r=h;e&&(r=await x().catch(()=>h));let a=r===null?null:F(r);return a!==null&&!c&&C.emit("method",a),a!==null},"Ie"),ie=null,we=!1,Ae=!1,Ce=t(()=>Qe(ne,(e,r)=>e.submitCheck("population_registry",{},{idempotencyKey:r})),"Fe"),Me=t(e=>Dt(e)===!0||ot($(e,"population_registry"))===!0,"Ne"),gt=t(async()=>{try{let e=await k();if(N(e)||F(e)!==null||q(e)?.checkType!=="population_registry")return;if(!Me(e)&&ot($(e,"population_registry"))===void 0&&(e=await x()),!Me(e)){Ae=!0;return}await R(),await te(await Ce(),"population_registry");let r=h===null?void 0:$(h,"population_registry");if(r?.state==="input_required"&&r.reason==="registry_unavailable"&&ze(r)>0){if(await M(Lt),c)return;await te(await Ce(),"population_registry")}}catch(e){if(e instanceof U&&(e.code==="check_not_active"||e.code==="step_not_on_path")){await x().catch(()=>{});return}we=!0;return}h!==null&&N(h)&&re(fe(h,{autoRetry:m}))},"Bt"),Se=t(()=>(ie??(ie=gt()),ie),"He"),I=i.now??Date.now,L=null,K,ae,_t=0,oe=t((e,r)=>`${e.url}
|
|
2
|
+
${e.siteKey}
|
|
3
|
+
${r}`,"ye"),Te=0,se,le=t((e,r)=>{Te+=1;let a=I(),u=P(e,{signal:ve.signal,subject:r}),s={key:oe(e,r),at:a,token:u};return u.then(()=>{s.issuedAt=I(),ae=void 0},p=>{let l=lt(p);if(s.failed=l,c||l==="aborted")return;ae=l;let{detail:y,readyMs:o}=p;B({check:"attestation",kind:"unavailable",engineKind:l,attempt:_t++,challengeMs:I()-a,readyMs:o,detail:y,inApp:Ge()})}),u.catch(()=>{}),s},"Se"),xe=t((e,r)=>e!==null&&e.key===r&&(e.issuedAt===void 0||I()-e.issuedAt<Ut),"De"),ue=t((e,r={})=>{let a=e?.challenge??null;if(e===null||a===null||c)return;let u=X(e.sessionId),s=L;(r.replaceFailed===!0&&s?.failed!==void 0&&!ut.has(s.failed)||!xe(s,oe(a,u)))&&(L=le(a,u))},"_e"),Ie=t(async(e,r,a)=>{let u=oe(e,r),s=L;L=null;let p=xe(s,u)?s:le(e,r),l=p===s?0:1,y,o=new Promise(v=>{y=setTimeout(()=>v("late"),a)});try{for(;;){let v=await Promise.race([p.token.then(w=>({token:w}),w=>({error:lt(w)})),o]);if(v==="late")return!c&&L===null&&(L=p),{error:ae??"timeout"};if("token"in v)return se=Math.max(0,Math.round((p.issuedAt??I())-p.at)),v;if(c||ut.has(v.error)||l>=Gt||l>0&&await Promise.race([M(jt*l),o])==="late")return v;if(c)return{error:"aborted"};l+=1,p=le(e,r)}}finally{clearTimeout(y)}},"Ue"),O=null,bt=t(e=>pe(e).some(r=>(r.checkType==="phone_otp"||r.checkType==="email_otp")&&r.state!=="passed"&&r.state!=="skipped"),"Gt"),Re=t(e=>O===null||I()-O>=e,"Be"),Q=t(()=>Re(Ft),"re"),kt=t(e=>{let r=e.attestation;return typeof r?.turnstileToken=="string"&&r.turnstileToken.length>0},"Kt"),Ee=new Map,Ne=t(async e=>{let r=await k(),a=r.challenge;if(a==null||r.simulation!==void 0)return;let u=await Ie(a,X(r.sessionId),e);if(!("token"in u))throw Ye(u.error);return u.token},"Ge"),wt=t(async(e,r,a={})=>{let u=r;if("attestation"in u)try{let o=await b.submitCheck(e,r,a);return kt(u)&&(O=I()),o}catch(o){throw o instanceof U&&o.code==="attestation_invalid"&&(O=null),o}let s=(e==="phone_otp"||e==="email_otp")&&u.action!=="verify",p=a.idempotencyKey,l=p!==void 0?Ee.get(p):void 0;l===void 0&&(s||Q())&&(l=await Ne(st(e,u)),p!==void 0&&l!==void 0&&Ee.set(p,l));let y=t((o,v)=>o!==void 0?{...v,browserCheckToken:o}:v,"b");try{let o=await b.submitCheck(e,r,y(l,a));return l!==void 0&&(O=I()),o}catch(o){if(!(o instanceof U)||o.code!=="attestation_invalid"||(O=null,l!==void 0))throw o;let v=await Ne(st(e,u)),w=p!==void 0?{...a,idempotencyKey:j()}:a,E=await b.submitCheck(e,r,y(v,w));return v!==void 0&&(O=I()),E}},"jt"),Pe=t(async(e={})=>{if(K=void 0,e.always!==!0&&!Q())return{};let r=await k(),a=r.challenge;if(a==null)return{};let u=e.always===!0?pt:dt,s=await Ie(a,X(r.sessionId),u);if("token"in s)return{channel:"hosted_web",turnstileToken:s.token};if(K=s.error,r.simulation!==void 0)return{channel:"hosted_web"};throw new Je(s.error)},"Ke"),At=t(()=>K,"Yt"),Ct=t(()=>({checks:Math.min(50,Te),...se!==void 0?{challengeMs:Math.min(6e5,se)}:{}}),"Wt"),B=t(e=>{if(c)return;let r=d.reportCaptureIssue;if(r===void 0)return;let a=e.formFactor;try{a??(a=qe())}catch{}try{Promise.resolve(r.call(d,{...e,...a!==void 0?{formFactor:a}:{}})).catch(()=>{})}catch{}},"Y"),g=null,V=null,Oe=new WeakMap,De=Promise.resolve(),H=0,Mt=t(async()=>{let e=await k();for(let r=0;r<Bt&&!c&&!N(e)&&q(e)===void 0&&pe(e).some(a=>a.state==="processing")&&(await M(Kt),!c);r+=1)e=await x();return e},"$t"),St=t(async(e,r,a)=>{let{capture:u}=e,s=t(()=>c,"m"),p=t(()=>e.alive&&e.attempt===a,"C"),l=t(o=>{p()&&u.setFlowState(o)},"h"),y=t(o=>{if(!s()&&(o.status==="unavailable"&&o.reasonCode!==void 0&&!Be(o.reasonCode)&&B({check:"liveness",kind:"unavailable",phase:"upload",engineKind:o.reasonCode,attempt:Math.max(0,e.issues.value)}),re(o),!!p())){if(o.status==="retry"&&_==="auto"){u.handle.retry();return}u.setFlowState("done")}},"b");if(r.degraded==="NO_RECORDER"){let o=h?.sessionId??(await k().catch(()=>null))?.sessionId??"";y(D(o,"no_recorder"));return}l("uploading");try{if(await Se(),s())return;let o=await k(),v;if(!N(o)&&F(o)!==null){await ke(!1),y(D(o.sessionId,"method_required"));return}if(!N(o)){if(q(o)?.checkType==="population_registry"){y(D(o.sessionId,Ae?"nni_unbound":we?"network":"registry_unavailable"));return}if(await R(),s())return;v=h??o;let w=await Xe({...ne,artifacts:r,getAttestation:Pe,attestationError:At,attestationFacts:Ct,clipKeys:{get:t(()=>Oe.get(r)??null,"get"),set:t(E=>{Oe.set(r,E)},"set")},getView:t(()=>h??o,"getView"),refreshView:x,applySubmit:te,onPhase:l,isCancelled:s,onKeyframePromoted:t(E=>{A=E},"onKeyframePromoted")});if(s())return;if(w.kind==="unavailable"){w.reason==="attestation"&&(V={bound:e,artifacts:r});let E=D(o.sessionId,w.reason),Fe=w.reason==="attestation"?K:void 0;y(Fe!==void 0?{...E,attestationError:Fe}:E);return}if(w.kind==="resync"&&await x(),h!==null&&F(h)!==null){await ke(!1),y(D(o.sessionId,"method_required"));return}o=await Mt()}y(fe(o,{autoRetry:m,previous:v}))}catch{if(s())return;y(D(h?.sessionId??"","network"))}},"Qt"),Le=t((e,r)=>{let a=e.attempt;H>0&&e.alive&&e.capture.setFlowState("uploading"),H+=1,De=De.then(()=>St(e,r,a)).finally(()=>{H-=1,H===0&&S?.onChainIdle()}).catch(()=>{})},"We"),Ue=t(e=>{g?.capture.handle.destroy(),g!==null&&(g.alive=!1,g.ramp.stop());let r=Ot({armRamp:typeof d.armRamp=="function"?()=>d.armRamp():void 0,waiting:t(()=>s.alive&&J()==="self"&&(u.handle.state==="starting"||u.handle.state==="gating"),"waiting")}),a=Promise.resolve(),u=at(e,S?.captureInternals?.(e)??i.capture,()=>h?.capture?.liveness?.keyframe?.rank===!0,J,()=>r.take()??h?.capture?.liveness?.screenRamp,{session:t(()=>ee(h),"session"),onModeChange:t(l=>{Z=l},"onModeChange")}),s={capture:u,alive:!0,ramp:r,attempt:0,issues:He()};g=s,u.handle.on("error",l=>{B(Ve("liveness",l,s.issues.value))}),u.handle.on("state",l=>{if(s.issues.note(l),l==="starting"){s.attempt+=1,V?.bound===s&&(V=null),Q()&&ue(h,{replaceFailed:!0});let y=h===null?void 0:q(h)?.checkType;a=y==="liveness"||y==="face_match"?R().catch(()=>{}):Promise.resolve()}(l==="starting"||l==="gating")&&J()==="self"&&a.then(()=>{s.alive&&r.arm()})}),u.handle.on("captured",l=>{Promise.resolve().then(()=>Le(s,l))});let p=u.handle;return{get state(){return p.state},get captureMode(){return p.captureMode},get facingMode(){return p.facingMode},on:t((l,y)=>p.on(l,y),"on"),start:t(async l=>{if(h===null&&await k().catch(()=>{}),!!s.alive)return p.start(l)},"start"),retry:t(()=>{let l=V;if(l!==null&&l.bound===s&&s.alive){V=null,Le(s,l.artifacts);return}p.retry()},"retry"),switchCamera:t(()=>p.switchCamera(),"switchCamera"),canSwitchCaptureMode:t(()=>p.canSwitchCaptureMode(),"canSwitchCaptureMode"),setCaptureMode:t(l=>p.setCaptureMode(l),"setCaptureMode"),destroy:t(()=>{s.alive=!1,r.stop(),g===s&&(g=null),p.destroy()},"destroy")}},"$e"),Tt=t(async()=>{if(c)return null;try{let e=await k();return c?null:F(e)}catch{return null}},"Zt"),xt=t(async()=>{if(c)return"self";try{let e=await k();if(c)return"self";let r=ee(e);return r==="choice"?W()??r:r}catch{return"self"}},"Jt"),It=t(async()=>{if(c)return!1;try{let e=await k();return c||N(e)||de()?!1:me(e,q(e))==="phone"||me(e,$(e,"liveness"))==="phone"}catch{return!1}},"Xt"),Rt=t(async()=>{if(c)return!1;try{let e=await k();return!c&&e.returning===!0}catch{return!1}},"zt"),Et=t(async e=>{let r=(await k()).plan?.choice,a=r?.options.find(s=>$e[s.service]===e);if(!a)throw new RangeError(`method ${String(e)} is not offered`);let u=await d.choose(r.nodeId,a.id);c||T(u)},"en"),ce=null,Nt=t(()=>(ce??(ce=import("./plan-runner-JSLWPJ6D-7PE72QOP.js").then(e=>{let r=e.createPlanRunner({runtime:ne,currentView:t(()=>h,"currentView"),cameraMode:J,captureModeSwitch:{pick:W,choose:t(a=>{Z=a},"choose")},ensureView:k,refreshView:x,ensureConsent:t(()=>R(),"ensureConsent"),liveness:Ue,stopLiveness:t(()=>{g!==null&&(g.alive=!1,g.ramp.stop(),g.capture.handle.destroy(),g=null)},"stopLiveness"),chainBusy:t(()=>H>0,"chainBusy"),destroyed:t(()=>c,"destroyed"),sleep:M,isMobile:de,now:i.now??Date.now,keptFaceKey:t(()=>A,"keptFaceKey"),setView:T,baseCapture:i.capture,emitStep:t(a=>{c||C.emit("step",a)},"emitStep"),emitResult:vt,reportCaptureIssue:B,documentInternals:i.document,documentFacts:i.documentFacts,portraitInternals:i.portrait,livePhotoInternals:i.livePhoto,uploadInternals:i.upload,pageCameraInternals:i.pageCamera});return S=r,r})),ce),"tn");return{consent:t(()=>R(),"consent"),startRegistry:Se,methodChoice:Tt,selectMethod:Et,reportCameraUnavailable:t(async e=>{await R();let r=d.reportCameraUnavailable;if(r===void 0)throw new TypeError("this client cannot report a missing camera");let a=await r.call(d,e).catch(u=>{if(u instanceof U&&u.code==="check_out_of_order")return d.getSession();throw u});c||T(a)},"reportCameraUnavailable"),reportCaptureIssue:B,testerGate:t(async e=>{let r=d.testerGate;if(r===void 0)throw new TypeError("this client cannot run the tester gate");let a=e.clip,u=je(e.clipMime??"");if(a===void 0||!We.includes(u))throw new TypeError("the capture has no clip");await R();let s=await Ze(d,"clip",u,a.size,{engine:e.engine,durationMs:e.clipMs});await d.uploadToSpaces(s.uploadUrl,a,u);let{key:p}=await d.completeMedia(s.key),l=await Pe({always:!0}),y=await r.call(d,{clipKey:p,attestation:l,captureChannel:e.captureChannel,capture:{...et(e),attestationError:K}}),{bound:o,missReason:v,...w}=y;return c||(w.plan!==void 0?T(w):await x()),o===!0||v===void 0?{bound:o===!0}:{bound:!1,missReason:v}},"testerGate"),mobileRequired:It,captureMode:xt,chooseCaptureMode:t(e=>{Z=e},"chooseCaptureMode"),get captureChoice(){return W()},returning:Rt,liveness:Ue,run:t(async()=>{if(c)throw new Error("verification destroyed");return(await Nt()).run()},"run"),currentStep:t(()=>S?.current()??null,"currentStep"),voiceClips:t(async()=>{if(c)return null;try{let e=await k();return c?null:e.voice??null}catch{return null}},"voiceClips"),on:t((e,r)=>C.on(e,r),"on"),destroy:t(()=>{c=!0,ve.abort(),S?.destroy(),g!==null&&(g.alive=!1,g.capture.handle.destroy(),g=null),C.clear()},"destroy")}}t(zt,"mn");var ft=["AD","AE","AF","AG","AI","AL","AM","AO","AQ","AR","AS","AT","AU","AW","AX","AZ","BA","BB","BD","BE","BF","BG","BH","BI","BJ","BL","BM","BN","BO","BQ","BR","BS","BT","BV","BW","BY","BZ","CA","CC","CD","CF","CG","CH","CI","CK","CL","CM","CN","CO","CR","CU","CV","CW","CX","CY","CZ","DE","DJ","DK","DM","DO","DZ","EC","EE","EG","EH","ER","ES","ET","FI","FJ","FK","FM","FO","FR","GA","GB","GD","GE","GF","GG","GH","GI","GL","GM","GN","GP","GQ","GR","GS","GT","GU","GW","GY","HK","HM","HN","HR","HT","HU","ID","IE","IL","IM","IN","IO","IQ","IR","IS","IT","JE","JM","JO","JP","KE","KG","KH","KI","KM","KN","KP","KR","KW","KY","KZ","LA","LB","LC","LI","LK","LR","LS","LT","LU","LV","LY","MA","MC","MD","ME","MF","MG","MH","MK","ML","MM","MN","MO","MP","MQ","MR","MS","MT","MU","MV","MW","MX","MY","MZ","NA","NC","NE","NF","NG","NI","NL","NO","NP","NR","NU","NZ","OM","PA","PE","PF","PG","PH","PK","PL","PM","PN","PR","PS","PT","PW","PY","QA","RE","RO","RS","RU","RW","SA","SB","SC","SD","SE","SG","SH","SI","SJ","SK","SL","SM","SN","SO","SR","SS","ST","SV","SX","SY","SZ","TC","TD","TF","TG","TH","TJ","TK","TL","TM","TN","TO","TR","TT","TV","TW","TZ","UA","UG","UM","US","UY","UZ","VA","VC","VE","VG","VI","VN","VU","WF","WS","XK","YE","YT","ZA","ZM","ZW"],mt=["carte_identite","passport","residence_permit","drivers_license"],Zt=["carte_identite","passport","residence_permit"];function he(n,i){let f=n.byIssuer?.[i]??n.default;return mt.filter(m=>f==="*"?Zt.includes(m):f.includes(m))}t(he,"gn");function ht(n,i=ft){return[...new Set([...i,...Object.keys(n.byIssuer??{})])].filter(f=>he(n,f).length>0).sort()}t(ht,"Vo");var G={fullNameMin:2,fullName:200,email:254,occupation:120,shortText:120,longText:1e3,addressLine:120,addressLines:4,city:80,postcode:16,number:1e12,dateMin:"1900-01-01",dateMax:"2100-12-31"};var An={full_name:G.fullName,occupation:G.occupation,email:G.email,short_text:G.shortText,long_text:G.longText},yt=Object.freeze({nni_invalid:"id_number_invalid",nni_not_found:"registry_record_not_found",nni_recheck:"id_number_recheck",document_nni_mismatch:"document_id_number_mismatch",nni_locked:"id_number_locked",nni_unbound:"id_number_unbound",missing_nni:"missing_id_number",registry_needs_nni_source:"registry_needs_id_number_source"}),Cn=new Map(Object.entries(yt)),Mn=new Map(Object.entries(yt).map(([n,i])=>[i,n]));function Wt(n,i){let f=n.options.filter(d=>d.id!==n.current);if(i===void 0)return{switchTo:f,methods:[]};let m=t(d=>d.countries!==void 0&&d.countries.length>0,"i");if(i===null)return{switchTo:f.filter(d=>!m(d)),methods:[]};let _=i.toUpperCase(),b=t(d=>!m(d)||d.countries.includes(_),"u");return{switchTo:f.filter(b),methods:f.filter(d=>m(d)&&b(d))}}t(Wt,"Zo");function Jt(n,i,f){let m=n.names?.[i.toUpperCase()],_=m?.[f]??m?.en;if(_!==void 0&&_!=="")return _;let b=n.nationalEid?.providerName;return b!==void 0&&b!==""?b:void 0}t(Jt,"Jo");function Yt(n){return n===void 0?[]:[...new Set(n.options.filter(i=>i.id!==n.current).flatMap(i=>i.countries??[]).map(i=>i.toUpperCase()))]}t(Yt,"Xo");var Sn=10*1024*1024;function dr(n){if(n==="permission")return"denied";if(n==="notfound"||n==="insecure"||n==="unsupported")return"no_camera"}t(dr,"Ce");var Qt=/^[A-Z0-9][A-Z0-9 -]{0,39}$/,Xt=Object.freeze({normalize:t(n=>n.trim().toUpperCase().replace(/\s+/g," "),"normalize"),check:t(n=>Qt.test(n),"check"),registrySources:Object.freeze([]),describe:"number must be 1 to 40 letters, digits, spaces or hyphens"}),en=/^[A-Z0-9]{4,20}$/,ye=t(n=>n.trim().toUpperCase().replace(/[\s-]+/g,""),"m"),tn=Object.freeze({normalize:ye,check:t(n=>en.test(ye(n)),"check"),registrySources:Object.freeze([]),describe:"number must be 4 to 20 letters or digits"});function nn(n){return typeof n=="string"&&/^\d{10}$/.test(n)&&Number(n)%97===1}t(nn,"he");var rn={trim:t(n=>n.trim(),"trim"),upper_single_space:t(n=>n.trim().toUpperCase().replace(/\s+/g," "),"upper_single_space"),upper_no_space_or_hyphen:ye},an={mr_nni_mod97:t(n=>nn(n),"mr_nni_mod97")};function on(n){let i=new RegExp(n.pattern,"u"),f=n.check===null?void 0:an[n.check];return Object.freeze({normalize:rn[n.normalize],check:t(m=>i.test(m.trim())&&(f===void 0||f(m)),"check"),registrySources:Object.freeze([...n.registrySources]),describe:n.describe})}t(on,"ge");var sn=Object.freeze(Object.fromEntries(Object.entries(rt).map(([n,i])=>[n,on(i)])));function ln(n,i){return sn[`${n.toUpperCase()}:${i}`]??(i==="drivers_license"?tn:Xt)}t(ln,"C");var pr=Object.freeze({JPN:"JP",MRT:"MR"});function fr(n){return ln("MR","national_id").check(n)}t(fr,"Ae");function un(n){let i="";for(let f of n){let m=f.codePointAt(0)??0;m>=1632&&m<=1641?i+=String(m-1632):m>=1776&&m<=1785?i+=String(m-1776):f!==" "&&f!=="-"&&f!==" "&&(i+=f)}return i}t(un,"H");function mr(n){return un(n)}t(mr,"De");var hr=he,yr=ht;var cn=t(()=>import("./create-document-capture-Z3UK34XH-J7HHUVQU.js"),"E");function dn(){cn().then(n=>n.warmDocumentCapture()).catch(()=>{})}t(dn,"D");function vr(){dn()}t(vr,"rt");var pn=t(()=>import("./create-portrait-capture-5VGYZUOK-KTCFCHTN.js"),"O");function fn(){pn().then(n=>n.warmPortraitCapture()).catch(()=>{})}t(fn,"b");function gr(){fn()}t(gr,"dt");export{$t as a,Wt as b,Jt as c,Yt as d,dr as e,fr as f,mr as g,hr as h,yr as i,vr as j,gr as k};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as n}from"./chunk-4FHWXBOB.js";var S="0.1.0-rc.
|
|
1
|
+
import{a as n}from"./chunk-4FHWXBOB.js";var S="0.1.0-rc.41",k=/FBAN|FBAV|FB_IAB|FBIOS|MessengerForiOS|Instagram|WhatsApp|musical_ly|BytedanceWebview|TikTok|Snapchat|\bLine\/|LinkedInApp|Pinterest|MicroMessenger|; wv\)/i;function O(t){let e=t??(typeof navigator>"u"?"":String(navigator.userAgent??""));return k.test(e)}n(O,"p");var f="sekyro.did",C=1e4,w=n(()=>globalThis.process?.versions?.node,"v"),l;function y(){let t=globalThis.crypto;try{if(typeof t?.randomUUID=="function")return t.randomUUID()}catch{}try{if(typeof t?.getRandomValues=="function"){let e=t.getRandomValues(new Uint8Array(16));return Array.from(e,a=>a.toString(16).padStart(2,"0")).join("")}}catch{}}n(y,"b");function H(){try{let t=localStorage.getItem(f);if(t)return t;let e=y();return e!==void 0&&localStorage.setItem(f,e),e}catch{return l??(l=y()),l}}n(H,"I");async function M(){let t=globalThis.crypto?.subtle;if(!t)return"";let e=navigator,a=JSON.stringify([e.userAgent,e.platform,e.hardwareConcurrency??null,e.deviceMemory??null,e.maxTouchPoints??0,screen.width,screen.height,screen.colorDepth,globalThis.devicePixelRatio??1,Intl.DateTimeFormat().resolvedOptions().timeZone,e.languages?.join(",")??e.language]),i=await t.digest("SHA-256",new TextEncoder().encode(a));return Array.from(new Uint8Array(i),s=>s.toString(16).padStart(2,"0")).join("").slice(0,32)}n(M,"w");function x(){try{let t=Number(navigator.maxTouchPoints);return Number.isFinite(t)&&t>=0?{touch:Math.min(64,Math.trunc(t))}:{}}catch{return{}}}n(x,"k");function W(t){let e=new TextEncoder().encode(t),a="";for(let i of e)a+=String.fromCharCode(i);return btoa(a).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}n(W,"x");function j(t){let e,a,i,s,c,d,m=n(()=>d?.readyState==="live","u"),T=n(()=>{c!==void 0||!globalThis.crypto?.subtle||w()||m()||(c=Promise.race([import("./print-DCYX3CZD-DLQCPZZE.js"),new Promise(r=>setTimeout(r,C))]).then(r=>r?.computePrint(m)).then(r=>{r==="busy"?c=void 0:s=r}).catch(()=>{}))},"_");return{timezone(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone?.slice(0,64)||void 0}catch{return}},noteCameraLabel(r){r&&(e=r.slice(0,128))},noteCamera(r){a=r},noteCameraTrack(r){d=r},async deviceHeader(){try{i??(i=M().catch(()=>""));let r=[];navigator.webdriver&&r.push("webdriver"),/HeadlessChrome/.test(navigator.userAgent)&&r.push("headless");let p=await i,g=H(),A={v:1,platform:"web",sdk:t.sdk.slice(0,64),caps:["session_proof"],rampAtArm:!0,ids:[...g?[{kind:"web_local",value:g.slice(0,128)}]:[],...p?[{kind:"web_fp",value:p}]:[]],screen:{w:screen.width,h:screen.height,dpr:globalThis.devicePixelRatio??1},...x(),...e?{cameraLabel:e}:{},...r.length?{signals:r}:{},...s?{print:{v:2,...s,...a?{camera:a}:{}}}:{},...O()?{inApp:!0}:{}},I=W(JSON.stringify(A));return T(),I}catch{return}},printReady(){return c??Promise.resolve()}}}n(j,"A");var v=Symbol.for("sekyro.web.clientContext"),b=globalThis,u=b[v]??(b[v]=j({sdk:`@sekyro/web@${S}`}));function z(t){try{let e=t.getVideoTracks?.()[0];if(e){if(u.noteCameraLabel(e.label),u.noteCameraTrack(e),w())return;import("./camera-trait-DELAK3YN-4I2GHAFU.js").then(a=>a.noteCameraTrait(e,u)).catch(()=>{})}}catch{}}n(z,"M");var P=Object.freeze({LOW:Object.freeze({cadenceHz:5,inputWidth:128,animations:"reduced"}),MID:Object.freeze({cadenceHz:8,inputWidth:160,animations:"full"}),HIGH:Object.freeze({cadenceHz:10,inputWidth:192,animations:"full"})}),L=new Uint8Array([0,97,115,109,1,0,0,0,1,5,1,96,0,1,123,3,2,1,0,10,10,1,8,0,65,0,253,15,253,98,11]);function F(){let t=typeof navigator>"u"?void 0:navigator,e=!1;try{e=typeof WebAssembly<"u"&&WebAssembly.validate(L)}catch{e=!1}return{cores:t?.hardwareConcurrency??2,memGB:t?.deviceMemory??null,simd:e}}n(F,"o");function U(t){let e=t.memGB??4;return t.cores<4||e<3?"LOW":t.cores>=8&&e>=6?"HIGH":"MID"}n(U,"l");var h=["LOW","MID","HIGH"],o,_=(o=class{constructor(e){this.samples=[],this.adjusted=!1,this.current=e}get deviceClass(){return this.current}get profile(){return P[this.current]}record(e){if(this.adjusted||this.samples.length>=10)return this.current;if(this.samples.push(e),this.samples.length<10)return this.current;this.adjusted=!0;let a=this.samples.reduce((i,s)=>i+s,0)/this.samples.length;if(a>70)this.current="LOW";else if(a<25){let i=h.indexOf(this.current);this.current=h[Math.min(h.length-1,i+1)]??this.current}return this.current}},n(o,"i"),o);export{S as a,O as b,u as c,z as d,F as e,U as f,_ as g};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as g}from"./chunk-
|
|
1
|
+
import{a as g}from"./chunk-Z6OYPC4S.js";import{L as b,a as k,b as y,c as x}from"./chunk-BMTTAXWY.js";import{a as n}from"./chunk-5QL6W6FW.js";import{a as c,c as f}from"./chunk-4FHWXBOB.js";var l=f(k(),1),t=f(k(),1),w=f(k(),1),r=f(y(),1),e=f(y(),1);var i,C=(i=class extends w.Component{constructor(){super(...arguments),this.state={failed:!1}}static getDerivedStateFromError(){return{failed:!0}}render(){return this.state.failed?this.props.fallback:this.props.children}},c(i,"c"),i);n(C,"LoadBoundary");var j=C,F={load:n(()=>import("./flow-views-NBUWHG7J-HB57IJYX.js"),"load")};function S({view:s,i18n:a,quiet:o,...m}){let[d,h]=(0,t.useState)(0),u=(0,t.useMemo)(()=>(0,t.lazy)(()=>F.load().then(v=>({default:v[s]}))),[s,d]),p=(0,r.jsxs)(b,{tone:"danger",children:[(0,r.jsx)("span",{children:a.t("errors.network_error")}),(0,r.jsx)(x,{kind:"secondary",onClick:c(()=>h(v=>v+1),"onClick"),children:a.t("common.retry")})]});return(0,r.jsx)(j,{fallback:p,children:(0,r.jsx)(t.Suspense,{fallback:o===!0?null:(0,r.jsx)("p",{role:"status","aria-busy":"true",className:"sekyro-text-muted",children:a.t("common.loading")}),children:(0,r.jsx)(u,{...m,i18n:a})})},d)}c(S,"k");n(S,"Flow");var q=(0,l.createContext)(void 0);function B({i18n:s,lead:a,refresh:o,actions:m}){let d=(0,l.useContext)(q),[h,u]=(0,l.useState)(!1);if(d!==void 0)return(0,e.jsx)(S,{view:"HandoffView",i18n:s,url:d,lead:a,...o!==void 0?{refresh:o}:{},footer:m});let p=n(()=>{o!==void 0&&(u(!0),o().catch(()=>{}).finally(()=>u(!1)))},"again");return(0,e.jsx)(g,{tone:"brand",icon:"smartphone",title:s.t("handoff.title"),testId:"sekyro-phone-handoff",actions:(0,e.jsxs)(e.Fragment,{children:[m,o!==void 0?(0,e.jsx)(x,{kind:"secondary",full:!0,disabled:h,onClick:p,children:s.t("common.refresh")}):null]}),children:(0,e.jsx)("p",{children:a})})}c(B,"K");n(B,"PhoneHandoff");export{j as a,S as b,q as c,B as d};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b,t as r,v as l,y as o}from"./chunk-
|
|
1
|
+
import{b,t as r,v as l,y as o}from"./chunk-BMTTAXWY.js";import{a as i}from"./chunk-5QL6W6FW.js";import{a,c as p}from"./chunk-4FHWXBOB.js";var s=p(b(),1);function f({tone:d,icon:n,busy:c,title:m,titleId:e,children:u,actions:t,live:y,testId:h}){let k=r();return(0,s.jsxs)("section",{className:"sekyro-step sekyro-status",...e!==void 0?{"aria-labelledby":e}:{},...y?{role:"status","aria-live":"polite"}:{},"data-testid":h,children:[(0,s.jsxs)("div",{className:"sekyro-status__body",children:[(0,s.jsx)("span",{className:`sekyro-tile sekyro-tile--${d}${c?" is-busy":""}`,"aria-hidden":"true",children:(0,s.jsx)(l,{name:n})}),(0,s.jsxs)("div",{className:"sekyro-heading sekyro-status__text",children:[(0,s.jsx)("h2",{id:e,ref:k,tabIndex:-1,className:"sekyro-text-body",children:m}),u]})]}),t!=null&&t!==!1?(0,s.jsx)(o,{children:t}):null]})}a(f,"g");i(f,"StatusPage");export{f as a};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as Nr}from"./chunk-BWOTZKA7.js";import{c as _t}from"./chunk-MXMEO2IW.js";import{b as kr,d as br}from"./chunk-BO327WCQ.js";import{b as xr,c as Ct}from"./chunk-CYEDFGUG.js";import{a as yr,b as gr,c as vr,d as Me}from"./chunk-FQHV53QQ.js";import{G as _r,L as wr,M as Sr,a as K,b as de,c as te,m as pr,n as Je,p as hr,q as et,r as fr,s as mr,t as bt,u as le,v as Ee,w as tt,y as Cr}from"./chunk-BMTTAXWY.js";import{c as ir,d as cr,e as ur,h as dr}from"./chunk-32CNXSJQ.js";import{b as kt}from"./chunk-U7QPOSFH.js";import{a as s}from"./chunk-5QL6W6FW.js";import{g as lr}from"./chunk-6MYG4HWP.js";import{a as o,c as U}from"./chunk-4FHWXBOB.js";var Ar=U(K(),1),y=U(de(),1),re=U(de(),1),ye=U(K(),1),$=U(de(),1),C=U(K(),1),m=U(K(),1),at=U(K(),1),fe=U(de(),1),Qr=U(K(),1),X=U(K(),1),lt=U(K(),1),we=U(de(),1),Se=U(de(),1),P=U(de(),1);var it=U(K(),1),pe=U(K(),1);var Q=U(K(),1);var E=U(K(),1),me=U(K(),1),Te=U(K(),1),At=U(de(),1),v=U(de(),1);function ce({className:e,children:t}){return(0,y.jsx)("svg",{"aria-hidden":"true",focusable:"false",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",className:e??"sekyro-icon sekyro-icon--sm",children:t})}o(ce,"ne");s(ce,"Svg");var Mt="M4 7.5h2.2l1.4-1.9h8.8l1.4 1.9H20a1.6 1.6 0 0 1 1.6 1.6v8.3A1.6 1.6 0 0 1 20 19H4a1.6 1.6 0 0 1-1.6-1.6V9.1A1.6 1.6 0 0 1 4 7.5Z";function Mr(e){return(0,y.jsxs)(ce,{...e,children:[(0,y.jsx)("circle",{cx:"12",cy:"12",r:"4"}),(0,y.jsx)("path",{d:"M12 2.5v2M12 19.5v2M2.5 12h2M19.5 12h2M5.3 5.3l1.4 1.4M17.3 17.3l1.4 1.4M5.3 18.7l1.4-1.4M17.3 6.7l1.4-1.4"})]})}o(Mr,"ln");s(Mr,"SunIcon");function Er(e){return(0,y.jsxs)(ce,{...e,children:[(0,y.jsx)("circle",{cx:"12",cy:"12",r:"9"}),(0,y.jsx)("path",{d:"M9 10h.01M15 10h.01M8.8 14.6a4.2 4.2 0 0 0 6.4 0"})]})}o(Er,"un");s(Er,"FaceUncoveredIcon");function Lr(e){return(0,y.jsxs)(ce,{...e,children:[(0,y.jsx)("rect",{x:"7",y:"2.5",width:"10",height:"19",rx:"2"}),(0,y.jsx)("path",{d:"M10.5 18.5h3M2.5 9.5h2.5M19 9.5h2.5"}),(0,y.jsx)("circle",{cx:"12",cy:"9.5",r:"1.6"})]})}o(Lr,"dn");s(Lr,"PhoneEyeLevelIcon");function Ir(e){return(0,y.jsxs)(ce,{...e,children:[(0,y.jsx)("path",{d:"M2.5 12S6 5.5 12 5.5 21.5 12 21.5 12 18 18.5 12 18.5 2.5 12 2.5 12Z"}),(0,y.jsx)("circle",{cx:"12",cy:"12",r:"2.8"})]})}o(Ir,"pn");s(Ir,"LookStraightIcon");function Ur(e){return(0,y.jsxs)(ce,{...e,children:[(0,y.jsx)("path",{d:Mt}),(0,y.jsx)("path",{d:"M9 13l2 2 4-4"})]})}o(Ur,"fn");s(Ur,"CameraCheckIcon");function jr(e){return(0,y.jsxs)(ce,{...e,children:[(0,y.jsx)("path",{d:Mt}),(0,y.jsx)("path",{d:"M10.2 11.2a1.9 1.9 0 1 1 2.6 1.8c-.5.2-.8.6-.8 1.1v.3M12 16.4h.01"})]})}o(jr,"mn");s(jr,"CameraAskIcon");function Tr(e){return(0,y.jsxs)(ce,{...e,children:[(0,y.jsx)("path",{d:Mt}),(0,y.jsx)("path",{d:"M3 3l18 18"})]})}o(Tr,"yn");s(Tr,"CameraBlockedIcon");function nt({off:e,className:t}){return(0,y.jsxs)(ce,{className:t,children:[(0,y.jsx)("path",{d:"M4.5 9.5v5H8l4 3.5v-12L8 9.5H4.5Z"}),e?(0,y.jsx)("path",{d:"M4 4l16 16"}):(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)("path",{d:"M15.5 9.7a3.6 3.6 0 0 1 0 4.6"}),(0,y.jsx)("path",{d:"M18 7.6a6.6 6.6 0 0 1 0 8.8"})]})]})}o(nt,"Ve");s(nt,"SpeakerIcon");function Or(e){return(0,y.jsx)(ce,{...e,children:(0,y.jsx)("path",{d:"M5 12.5l4.5 4.5L19 7.5"})})}o(Or,"gn");s(Or,"CheckIcon");function Pr(e){return(0,y.jsxs)(ce,{className:e.className??"sekyro-spinner",children:[(0,y.jsx)("circle",{cx:"12",cy:"12",r:"9",opacity:"0.25"}),(0,y.jsx)("path",{d:"M21 12a9 9 0 0 0-9-9"})]})}o(Pr,"hn");s(Pr,"SpinnerIcon");var wt=["light","uncover","eyeLevel","straight"],In={light:{key:"capture.tips.light",icon:s(()=>(0,re.jsx)(Mr,{}),"icon")},uncover:{key:"capture.tips.uncover",icon:s(()=>(0,re.jsx)(Er,{}),"icon")},eyeLevel:{key:"capture.tips.eyeLevel",icon:s(()=>(0,re.jsx)(Lr,{}),"icon")},straight:{key:"capture.tips.straight",icon:s(()=>(0,re.jsx)(Ir,{}),"icon")}};function Br({tips:e}){let t=Me(),n=(0,Ar.useId)();return e.length===0?null:(0,re.jsxs)("section",{className:"sekyro-tips","aria-labelledby":n,"data-testid":"sekyro-tips",children:[(0,re.jsx)("p",{className:"sekyro-tips__title",id:n,children:t("capture.tips.title")}),(0,re.jsx)("ul",{className:"sekyro-tips__list",children:e.map(r=>{let a=typeof r=="string"?In[r]:void 0,l=typeof r=="string"?r:r.id,c=a!==void 0?a.icon():typeof r=="string"?void 0:r.icon,d=a!==void 0?t(a.key):typeof r=="string"?r:r.text;return(0,re.jsxs)("li",{className:"sekyro-tips__item",children:[c!=null?(0,re.jsx)("span",{className:"sekyro-tips__icon","aria-hidden":"true",children:c}):null,(0,re.jsx)("span",{children:d})]},l)})})]})}o(Br,"Cn");s(Br,"TipList");var Un=220;function qr({title:e,description:t,options:n,busy:r,error:a,focus:l,testId:c,look:d="cards",marked:S,onChoose:p}){let w=(0,ye.useId)(),N=bt(),[j,R]=(0,ye.useState)(null),B=(0,ye.useRef)(null);(0,ye.useEffect)(()=>{a!==null&&R(null)},[a]),(0,ye.useEffect)(()=>()=>{B.current!==null&&clearTimeout(B.current)},[]);let q=s(A=>{r||j!==null||(R(A),B.current=setTimeout(()=>{B.current=null,R(null),p(A)},Un))},"choose");return(0,$.jsxs)("section",{className:"sekyro-stack sekyro-stack--4 sekyro-choice","aria-labelledby":w,"data-testid":c,children:[(0,$.jsxs)("div",{className:d==="cards"?"sekyro-heading":"sekyro-stack sekyro-stack--1",children:[(0,$.jsx)("h2",{id:w,ref:l?N:void 0,tabIndex:-1,className:"sekyro-text-body",children:e}),t!==void 0&&t!==""?(0,$.jsx)("p",{className:"sekyro-text-muted",children:t}):null]}),a!==null?(0,$.jsx)(le,{tone:"danger",children:(0,$.jsx)("span",{children:a})}):null,d==="buttons"?(0,$.jsx)("div",{className:"sekyro-stack sekyro-stack--3",children:n.map((A,J)=>(0,$.jsx)(te,{kind:J===0?"primary":"ghost",full:!0,disabled:r,"aria-busy":r||void 0,onClick:o(()=>p(A.id),"onClick"),children:A.label},A.id))}):(0,$.jsx)("div",{className:"sekyro-choices",children:n.map(A=>(0,$.jsxs)("button",{type:"button",className:"sekyro-card","aria-pressed":(j??S)===A.id,"aria-busy":r||void 0,disabled:r||j!==null&&j!==A.id,onClick:o(()=>q(A.id),"onClick"),children:[A.glyph!==void 0?(0,$.jsx)("span",{className:"sekyro-card__tile",children:A.glyph}):null,(0,$.jsxs)("span",{className:"sekyro-card__body",children:[(0,$.jsx)("span",{className:"sekyro-card__title",children:A.label}),A.sub!==void 0?(0,$.jsx)("span",{className:"sekyro-card__sub",children:A.sub}):null]}),(0,$.jsx)("span",{className:"sekyro-radio","aria-hidden":"true"})]},A.id))})]})}o(qr,"bn");s(qr,"ChoiceScreen");var Vr=["fcv3.no_face","fcv3.come_closer","fcv3.move_back","fcv3.center_face","fcv3.straighten","fcv3.more_light","fcv3.too_bright","fcv3.hold_still","fcv3.steady_camera","fcv3.hold_upright","fcv3.one_face","capture.tips.summary","capture.lookAtColours"];function st(e){return e!==null&&Vr.includes(e)}o(st,"he");s(st,"isVoiceKey");var jn=s((e,t)=>Object.prototype.hasOwnProperty.call(e,t),"own");function je(e,t,n){let r;try{if(typeof e=="function")r=e(t,n);else{let a=e[n];r=a!=null&&jn(a,t)?a[t]:null}}catch{return null}return typeof r=="string"&&r!==""?r:null}o(je,"Me");s(je,"resolveClip");var Tn="UklGRiQAAABXQVZFZm10IBAAAAABAAEAESsAACJWAAACABAAZGF0YQAAAAA=",On={ar:"ar-SA",fr:"fr-FR",en:"en-US",es:"es-ES",pt:"pt-BR",de:"de-DE"};function ie(){return typeof window<"u"&&"speechSynthesis"in window?window.speechSynthesis:null}o(ie,"re");s(ie,"synth");function Dr(){return ie()!==null&&typeof SpeechSynthesisUtterance=="function"}o(Dr,"Lr");s(Dr,"speechAvailable");function St(e){return(e.split(/[-_]/)[0]??e).toLowerCase()}o(St,"Sn");s(St,"baseLang");function Et(e,t){let n=s(a=>a.replace(/_/g,"-").toLowerCase(),"norm"),r=St(t);return e.find(a=>n(a.lang)===n(t))??e.find(a=>St(a.lang)===r)}o(Et,"Mn");s(Et,"pickVoice");function Hr(e){if(!Dr())return!1;let t=[];try{t=ie()?.getVoices()??[]}catch{return!0}return t.length===0||Et(t,e)!==void 0}o(Hr,"wn");s(Hr,"speechUsable");function $r(e){let t=ie();return t===null||typeof t.addEventListener!="function"?()=>{}:(t.addEventListener("voiceschanged",e),()=>t.removeEventListener?.("voiceschanged",e))}o($r,"Ln");s($r,"subscribeVoices");function De(e){try{let t=typeof location<"u"?location.href:"http://localhost/",n=new URL(e,t);return`clip:${n.origin}${n.pathname}`}catch{return`clip:${e}`}}o(De,"Ke");s(De,"clipIdentity");function xt(e){e.pause(),e.removeAttribute("src"),e.load()}o(xt,"Rn");s(xt,"release");function Fr(){let e=null,t=null,n=0,r=null,a=null,l=null,c=!1,d=null,S=[],p=new Map,w=s(()=>{S=ie()?.getVoices()??[]},"loadVoices"),N=!1,j=s(()=>{let h=ie();N||h===null||(N=!0,w(),h.addEventListener?.("voiceschanged",w))},"bindVoices"),R=s(()=>(e??(e=new Audio),e),"element"),B=s((h,x,_,k)=>{let u=ie();if(u!==null&&h!==""&&typeof SpeechSynthesisUtterance=="function"){j();let M=Et(S,x);if(S.length===0||M!==void 0){u.cancel();let I=new SpeechSynthesisUtterance(h);I.lang=x,M!==void 0&&(I.voice=M),I.rate=.95,_!==void 0&&(I.onend=_),(_!==void 0||k!==void 0)&&(I.onerror=D=>{k!==void 0&&D.error==="not-allowed"?k():_?.()}),u.speak(I);return}}_?.()},"speak"),q=s(()=>{n+=1,r=null,a=l=null,e!==null&&(e.pause(),e.currentTime=0),ie()?.cancel()},"stop"),A=s(h=>{for(let x of h){let _=De(x);if(p.has(_))continue;let k=new Audio;k.preload="auto",k.src=x,p.set(_,k)}},"warmClips"),J=s((h,x,_)=>{let k={utterance:h,generation:x,end:_};d=k;let u=s(()=>x===n&&d===k,"live"),M=s(()=>{u()&&(a=k)},"block");if(ie()?.cancel(),h.url!==null){let I=R();I.pause(),I.muted=!1,I.src=h.url,I.currentTime=0,I.onended=_??null;let D=s(()=>{l===k&&(l=null)},"settled"),i=I.play();if(i===void 0)return;l=k,i.then(D,T=>{if(D(),!u())return;let O=T?.name;if(O!=="AbortError"){if(O==="NotAllowedError")return M();h.speech?B(h.text,h.lang,_,M):_?.()}});return}h.speech?B(h.text,h.lang,_,M):_?.()},"start");return{say(h){let x=h.url!==null?De(h.url):`tts:${h.lang}:${h.text}`;if(x===r)return;r=x,a=l=null,n+=1;let _=n,k=h.onEnd;J(h,_,k!==void 0?()=>{_===n&&k()}:void 0)},unlock({lang:h,speech:x,prefetch:_}){let k=a??(c?null:l);c=!0;let u=k!==null&&k.generation===n?k:null;a=l=null,u!==null&&J(u.utterance,u.generation,u.end);let M=R();if(t===null&&typeof Blob=="function"&&typeof URL.createObjectURL=="function"){let T=Uint8Array.from(atob(Tn),O=>O.charCodeAt(0));t=URL.createObjectURL(new Blob([T],{type:"audio/wav"}))}let I=M.paused===!1&&t!==null&&M.src!==t;t!==null&&!I&&(u===null||u.utterance.url===null)&&(M.muted=!0,M.onended=null,M.src=t,M.play()?.catch(()=>{}));let D=ie(),i=u!==null&&u.utterance.url===null;if(x&&!i&&D!==null&&typeof SpeechSynthesisUtterance=="function"){j();let T=new SpeechSynthesisUtterance(" ");T.volume=0,T.lang=h,D.speak(T)}A(_??[])},prefetch:A,stop:q,dispose(){q(),N&&ie()?.removeEventListener?.("voiceschanged",w),N=!1,t!==null&&URL.revokeObjectURL(t),t=null,e!==null&&xt(e),e=null;for(let h of p.values())xt(h);p.clear()}}}o(Fr,"_n");s(Fr,"createVoicePlayer");var Pn="sekyro.voiceGuidance";function Gr(e){try{if(typeof window>"u")return null;let t=window.localStorage.getItem(e);return t==="1"?!0:t==="0"?!1:null}catch{return null}}o(Gr,"xn");s(Gr,"readVoicePreference");function Kr(e,t){try{if(typeof window>"u")return;window.localStorage.setItem(e,t?"1":"0")}catch{}}o(Kr,"En");s(Kr,"writeVoicePreference");var Ve="capture.tips.summary",Bn=typeof window<"u"?C.useLayoutEffect:C.useEffect,qn=Object.freeze({});function rt(e,t){let n=new Set,r=[];for(let a of Vr){let l=a===Ve?null:je(e,a,t);l===null||n.has(De(l))||(n.add(De(l)),r.push(l))}return r}o(rt,"ht");s(rt,"resolvedClipUrls");function Zr({locale:e,defaultClips:t,options:n}){let r=n===!1,a=r?{}:n??{},l=a.storageKey===void 0?Pn:a.storageKey,[c,d]=(0,C.useState)(a.defaultEnabled??!0),S=(0,C.useRef)(c),[p,w]=(0,C.useState)(!1),[N,j]=(0,C.useState)("none"),[R,B]=(0,C.useState)(!1),q=(0,C.useRef)(!1),[A,J]=(0,C.useState)(0),h=(0,C.useRef)(null),x=(0,C.useCallback)(()=>(h.current??(h.current=Fr()),h.current),[]),_=On[e],k=a.speechFallback,u=k===void 0||k===!0?!0:k===!1?!1:k.includes(e),M=a.clips??t??qn,I=(0,C.useRef)(!1),D=(0,C.useRef)(M);Bn(()=>{D.current=M,S.current=c}),(0,C.useEffect)(()=>{if(r||l===null)return;let L=Gr(l);L!==null&&(S.current=L,d(L))},[r,l]),(0,C.useEffect)(()=>{if(!(r||!u))return $r(()=>J(L=>L+1))},[r,u]);let i=a.clips;(0,C.useEffect)(()=>{if(r)return;let L=u&&Hr(_);w(rt(M,e).length>0||L),j(i!==void 0&&je(i,Ve,e)!==null?"partner":je(M,Ve,e)!==null||L?"default":"none")},[r,M,i,e,u,_,A]),(0,C.useEffect)(()=>{if(r||!c||!I.current)return;let L=rt(M,e);L.length>0&&x().prefetch(L)},[r,c,M,e,x]),(0,C.useEffect)(()=>()=>{h.current?.dispose(),h.current=null,I.current=!1},[]);let T=(0,C.useCallback)(L=>{r||(I.current=!0,x().unlock({lang:_,speech:u,...L?{prefetch:rt(D.current,e)}:{}}))},[r,x,_,u,e]),O=(0,C.useCallback)(()=>T(S.current),[T]),z=(0,C.useCallback)(()=>{q.current=!1,B(!1)},[]),H=(0,C.useCallback)(()=>{z(),h.current?.stop()},[z]),ge=(0,C.useCallback)(()=>{q.current&&H()},[H]),he=(0,C.useCallback)((L,xe)=>{if(r)return;if(q.current){H();return}let ve=x();ve.stop(),q.current=!0,B(!0);let V=xe?.clip===!1?null:je(D.current,Ve,e);ve.say({url:V,text:L,lang:_,speech:u,onEnd:z})},[r,H,x,e,_,u,z]),Y=(0,C.useCallback)(L=>{r||(L?T(!0):H(),l!==null&&Kr(l,L),S.current=L,d(L))},[r,T,H,l]),W=(0,C.useCallback)(()=>Y(!S.current),[Y]),ne=(0,C.useCallback)((L,xe)=>{if(r||!c)return;q.current&&z();let ve=je(D.current,L,e);x().say({url:ve,text:xe,lang:_,speech:u})},[r,c,e,x,_,u,z]);return(0,C.useMemo)(()=>({supported:!r&&p,enabled:!r&&c,setEnabled:Y,toggle:W,unlock:O,speakKey:ne,stop:H,summary:r?"none":N,summaryPlaying:R,toggleSummary:he,stopSummary:ge}),[r,p,c,Y,W,O,ne,H,N,R,he,ge])}o(Zr,"vt");s(Zr,"useVoiceGuidance");function zr(e,t,n,r){let{speakKey:a,stop:l,enabled:c}=e,d=(0,C.useRef)(!1);(0,C.useEffect)(()=>{if(!r||!c){d.current&&l(),d.current=!1;return}d.current=!0,st(t)&&t!==Ve&&n!==""&&a(t,n)},[r,c,t,n,a,l])}o(zr,"Ct");s(zr,"useSpeakGuidance");function ot(e,t){let n=Yr(e);return n==="face"&&(t==="lighting"||e==="liveness_inconclusive")?"again":n}o(ot,"Pn");s(ot,"retryCoachingOf");function Yr(e){switch(e){case"multiple_faces":return"one_face";case"capture_back_camera":return"front_camera";case"capture_front_camera":return"back_camera";case"capture_not_upright":return"upright";case"media_unreadable":case"clip_too_short":return"recording";case"device_integrity_failed":return"device";default:return"face"}}o(Yr,"Pr");s(Yr,"coachingOfReason");var He={face:{title:"capture.retryCoaching.title",tips:["capture.retryCoaching.light","capture.retryCoaching.eyeLevel","capture.retryCoaching.head"]},again:{title:"capture.retryTips.title",tips:["capture.retryCoaching.eyeLevel","capture.retryCoaching.head"]},one_face:{title:"capture.retryTips.title",tips:["capture.retryOneFace.alone","capture.retryOneFace.screens"]},front_camera:{title:"capture.retryTips.title",tips:["capture.retryFrontCamera.screenSide"]},back_camera:{title:"capture.retryTips.title",tips:["capture.retryBackCamera.backSide","capture.retryBackCamera.circle"]},upright:{title:"capture.retryTips.title",tips:["capture.retryUpright.vertical","capture.retryUpright.untilEnd"]},recording:{title:"capture.retryTips.title",tips:["capture.retryRecording.cameraOn","capture.retryRecording.stay","capture.retryRecording.network"]},device:{title:"capture.retryTips.title",tips:["capture.retryDevice.screenRecording","capture.retryDevice.phone"]}};function Wr({showCoaching:e,coaching:t="face",attemptsText:n,showRetake:r,onRetake:a}){let l=Me(),c=(0,at.useRef)(null);return(0,at.useEffect)(()=>{r&&c.current?.focus()},[r]),!e&&!r?null:(0,fe.jsxs)("div",{className:"sekyro-stack sekyro-stack--3","data-testid":"sekyro-captured-panel",children:[e?(0,fe.jsxs)("div",{className:"sekyro-stack sekyro-stack--1",children:[(0,fe.jsx)("p",{className:"sekyro-text-body",children:l(He[t].title)}),(0,fe.jsx)("ul",{className:"sekyro-coaching",children:He[t].tips.map(d=>(0,fe.jsx)("li",{children:l(d)},d))}),n!==null?(0,fe.jsx)("p",{className:"sekyro-text-muted","data-testid":"sekyro-attempts-remaining",children:n}):null]}):null,r?(0,fe.jsx)(te,{ref:c,className:"sekyro-btn--start",onClick:a,children:l("capture.recordAgain")}):null]})}o(Wr,"Tn");s(Wr,"CapturedPanel");function Lt(){try{return!1}catch{return!1}}o(Lt,"nt");s(Lt,"isDevBuild");var Vn=(0,Qr.createContext)(null);function Xr({state:e}){let t=Me(),[n,r]=(0,lt.useState)(!1);(0,lt.useEffect)(()=>{e!=="unknown"&&r(!0)},[e]);let a=e==="granted"?(0,we.jsx)(Ur,{}):e==="denied"?(0,we.jsx)(Tr,{}):(0,we.jsx)(jr,{});return(0,we.jsxs)("div",{role:n?"status":void 0,className:`sekyro-permission sekyro-permission--${e}`,"data-testid":"sekyro-permission","data-state":e,children:[(0,we.jsx)("span",{className:"sekyro-permission__icon","aria-hidden":"true",children:a}),(0,we.jsx)("span",{children:t(`capture.permission.${e}`)})]})}o(Xr,"On");s(Xr,"PermissionRow");function Jr({voice:e}){let t=Me();if(!e.supported)return null;let n=e.enabled;return(0,Se.jsxs)("button",{type:"button",role:"switch","aria-checked":n,className:"sekyro-switch","data-testid":"sekyro-voice-switch",onClick:o(()=>e.toggle(),"onClick"),children:[(0,Se.jsxs)("span",{className:"sekyro-switch__label",children:[(0,Se.jsx)(nt,{off:!n}),t("capture.voiceGuidance")]}),(0,Se.jsx)("span",{className:"sekyro-switch__track","aria-hidden":"true",children:(0,Se.jsx)("span",{className:"sekyro-switch__thumb",children:n?(0,Se.jsx)(Or,{className:"sekyro-switch__check"}):null})})]})}o(Jr,"Hn");s(Jr,"VoiceSwitch");function en({assets:e,onRetryAssets:t,permission:n,captureMode:r="self",voice:a,tips:l,summary:c,startLabel:d,startDisabled:S,onStart:p}){let w=Me(),N=(0,X.useRef)(c?.stop);N.current=c?.stop,(0,X.useEffect)(()=>()=>N.current?.(),[]);let j=(0,X.useRef)(null),R=(0,X.useRef)(null),B=(0,X.useRef)(null),q=(0,X.useRef)(e),A=(0,X.useRef)(!1);(0,X.useEffect)(()=>{let u=q.current;if(q.current=e,u===e)return;let M=A.current;e!=="loading"&&(A.current=!1),tn(j.current)&&(e==="failed"?B.current?.focus():M&&R.current?.focus())},[e]);let J=(0,X.useCallback)(()=>{A.current=!0,t()},[t]),h=e==="loading",x=h||S,_=(0,X.useCallback)(()=>{x||(N.current?.(),p())},[x,p]),k;return e==="failed"?k=(0,P.jsxs)(le,{tone:"danger",testId:"sekyro-assets-error",children:[(0,P.jsx)("p",{className:"sekyro-text-body",children:w("fcv2.err.models")}),(0,P.jsx)(te,{kind:"ghost",ref:B,className:"sekyro-btn--start",onClick:J,"data-testid":"sekyro-assets-retry",children:w("common.retry")})]}):k=(0,P.jsxs)("div",{className:"sekyro-stack sekyro-stack--1",children:[(0,P.jsx)(te,{ref:R,full:!0,"data-testid":"sekyro-start","aria-disabled":x?"true":void 0,"aria-busy":h?"true":void 0,onClick:_,children:h?(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(Pr,{}),w("capture.preparing.title")]}):d??w("capture.start")}),h?(0,P.jsx)("p",{className:"sekyro-text-muted",children:w("capture.preparing.hint")}):null]}),(0,P.jsxs)("div",{ref:j,className:"sekyro-stack sekyro-stack--4","data-testid":"sekyro-intro","data-assets":e,children:[r==="assisted"?(0,P.jsxs)("div",{className:"sekyro-stack sekyro-stack--1","data-testid":"sekyro-assisted-intro",children:[(0,P.jsx)("h2",{className:"sekyro-text-body",children:w("capture.assisted.title")}),(0,P.jsx)("p",{className:"sekyro-text-muted",children:w("capture.assisted.lead")})]}):null,l!==!1?(0,P.jsx)(Br,{tips:l}):null,c!==void 0?(0,P.jsxs)(te,{kind:"ghost",className:"sekyro-btn--start",onClick:c.toggle,"data-testid":"sekyro-tips-listen",children:[(0,P.jsx)(nt,{off:!1}),w(c.playing?"capture.tips.stop":"capture.tips.listen")]}):null,(0,P.jsx)(Xr,{state:n}),(0,P.jsx)(Jr,{voice:a}),(0,P.jsx)("p",{className:"sekyro-text-muted",children:w("capture.securityNote")}),k,(0,P.jsx)("p",{role:"status",className:"sekyro-visually-hidden","data-testid":"sekyro-intro-status",children:e==="loading"?w("capture.preparing.title"):e==="ready"?w("capture.ready"):""})]})}o(en,"Fn");s(en,"PreCaptureScreen");function tn(e){if(typeof document>"u")return!1;let t=document.activeElement;return t===null||t===document.body||e!==null&&e.contains(t)}o(tn,"Hr");s(tn,"focusIsOurs");function rn(){let[e,t]=(0,it.useState)({state:"unknown",settled:!1});return(0,it.useEffect)(()=>lr(n=>t({state:n,settled:!0})),[]),{permission:e.state,permissionSettled:e.settled}}o(rn,"Dn");s(rn,"useCameraStatus");function nn(e){return It(e,"mobileRequired")}o(nn,"qn");s(nn,"useMobileRequired");function sn(e){return It(e,"returning").required}o(sn,"jn");s(sn,"useReturning");function It(e,t){let[n,r]=(0,pe.useState)({required:!1,settled:e===void 0});return(0,pe.useEffect)(()=>{let a=e?.[t];if(e===void 0||typeof a!="function"){r({required:!1,settled:!0});return}let l=!0;return r({required:!1,settled:!1}),Promise.resolve().then(()=>a.call(e)).then(c=>{l&&r({required:c===!0,settled:!0})},()=>{l&&r({required:!1,settled:!0})}),()=>{l=!1}},[e,t]),n}o(It,"Yn");s(It,"useFlag");function an(e){let t=s(()=>e?.captureChoice??null,"initialChoice"),[n,r]=(0,pe.useState)(()=>({session:"self",choice:t(),settled:e===void 0}));(0,pe.useEffect)(()=>{let l=e?.captureMode,c=e?.captureChoice??null;if(e===void 0||typeof l!="function"){r({session:"self",choice:c,settled:!0});return}let d=!0;return r({session:"self",choice:c,settled:!1}),Promise.resolve().then(()=>l.call(e)).then(S=>{let p=e.captureChoice??null;d&&r({session:p!==null&&S===p?"choice":S==="assisted"||S==="choice"?S:"self",choice:p,settled:!0})},()=>{d&&r({session:"self",choice:null,settled:!0})}),()=>{d=!1}},[e]);let a=(0,pe.useCallback)(l=>{e?.chooseCaptureMode?.(l),r(c=>({...c,choice:l}))},[e]);return{mode:n.session==="choice"?n.choice??"self":n.session==="assisted"?"assisted":"self",session:n.session,choice:n.choice,settled:n.settled,choose:a}}o(an,"$n");s(an,"useCaptureMode");function on(e){let[t,n]=(0,pe.useState)(!1);return(0,pe.useEffect)(()=>{if(n(!1),e===void 0)return;let r=e.on("busy",()=>n(!0)),a=e.on("result",()=>n(!1));return()=>{r(),a()}},[e]),t}o(on,"zn");s(on,"useBusy");var Dn=s(()=>"idle","serverSnapshot");function Nt(e){return ir(e!==void 0?{assetBaseUrl:e}:{})}o(Nt,"Qn");s(Nt,"preload");function ln(e,t=!0){let n=(0,Q.useSyncExternalStore)((0,Q.useCallback)(p=>ur(p,e),[e]),()=>cr(e),Dn),[r,a]=(0,Q.useState)(null),l=(0,Q.useRef)(!1),c=(0,Q.useCallback)(()=>{Nt(e).then(p=>{l.current&&p==="idle"&&a({base:e})})},[e]);(0,Q.useEffect)(()=>(l.current=!0,c(),()=>{l.current=!1}),[c]);let d=(0,Q.useRef)(null);(0,Q.useEffect)(()=>{if(n!=="idle"){d.current={base:e};return}!t||d.current===null||d.current.base!==e||(d.current=null,c())},[n,e,c,t]);let S=(0,Q.useCallback)(()=>{Nt(e)},[e]);return{gate:r!==null&&r.base===e&&n==="idle"||n==="ready"?"ready":n==="failed"?"failed":"loading",retry:S}}o(ln,"Jn");s(ln,"useLivenessAssets");var Rr={progress:0,hint:null,faceDetected:!1};function cn(e){let{videoRef:t,assetBaseUrl:n}=e,r=(0,E.useRef)(e.verification).current,a=(0,E.useRef)(!1);e.verification!==r&&!a.current&&Lt()&&(a.current=!0,console.warn("[@sekyro/react] <LivenessCapture>: the `verification` prop changed identity after mount. The first instance stays bound (the camera is not rebuilt); create the verification once (useMemo / useState / outside render) instead of on every render."));let l=(0,E.useRef)(null),[c,d]=(0,E.useState)("idle"),[S,p]=(0,E.useState)(Rr),[w,N]=(0,E.useState)(!1),[j,R]=(0,E.useState)(!1),[B,q]=(0,E.useState)(null),[A,J]=(0,E.useState)(!1),[h,x]=(0,E.useState)(null),[_,k]=(0,E.useState)(null),[u,M]=(0,E.useState)(null),[I,D]=(0,E.useState)(null),[i,T]=(0,E.useState)(null),[O,z]=(0,E.useState)(!1),H=(0,E.useRef)(null),ge=(0,E.useRef)("idle"),he=(0,E.useRef)(-1),[Y,W]=(0,E.useState)(0),ne=(0,E.useRef)(e);ne.current=e,(0,E.useEffect)(()=>{let ee=t.current;if(ee===null)return;let ue={video:ee,...n!==void 0?{assetBaseUrl:n}:{}},F=r!==void 0?r.liveness(ue):dr(ue);l.current=F;let Ne=s(()=>T(F.facingMode??null),"readFacing");Ne();let $e=[F.on("state",b=>{b==="mode_switch"?z(!0):b!=="starting"&&b!=="gating"&&z(!1),b==="starting"?(ge.current!=="starting"&&(he.current+=1,W(Math.max(0,he.current))),k(null),M(null),p(Rr),R(!1),N(!1),q(null),x(null),H.current=null):b==="gating"&&ge.current==="recording"&&(R(!1),N(!1),q(null),H.current=null),ge.current=b,Ne(),d(b),ne.current.onStateChange?.(b)}),F.on("gate",b=>{let ke=H.current;H.current=b.progress,N(ke!==null&&b.progress<ke-.001&&b.progress>0&&b.progress<1),b.progress>=1&&R(!0),p(b)}),F.on("frozen",({previewDataUrl:b})=>q(b)),F.on("profile",({animations:b})=>J(b==="reduced")),F.on("ramp",({colour:b})=>x(b)),F.on("captured",b=>{k(b),D(null),ne.current.onCaptured?.(b)}),F.on("error",b=>{M(b);let ke=r?.reportCaptureIssue;ke!==void 0&&Ct(Le=>ke.call(r,Le),xr("liveness",b,Math.max(0,he.current))),ne.current.onError?.(b)}),r?.on("result",b=>{D(b),ne.current.onResult?.(b)})];return()=>{for(let b of $e)b?.();l.current=null,F.destroy()}},[r,t,n]);let L=(0,E.useCallback)(()=>{l.current?.start()},[]),xe=(0,E.useCallback)(()=>{l.current?.retry()},[]),ve=(0,E.useCallback)(async()=>{let ee=l.current;return ee===null||typeof ee.canSwitchCaptureMode!="function"?!1:await ee.canSwitchCaptureMode().catch(()=>!1)===!0},[]),V=(0,E.useCallback)(async ee=>{let ue=l.current;if(ue===null||typeof ue.setCaptureMode!="function")return!1;let F=await ue.setCaptureMode(ee).catch(()=>!1)===!0;return F&&T(ue.facingMode??null),F},[]);return{state:c,gate:S,draining:w,gateLocked:j,frozenPreview:B,reduceMotion:A,rampColour:h,artifacts:_,error:u,result:I,facingMode:i,start:L,retry:xe,canSwitchCaptureMode:ve,setCaptureMode:V,modeRestarted:O,attempt:Y}}o(cn,"er");s(cn,"useLivenessHandle");var Hn=new Set(["national_number"]);function Rt(e){if(e==null||!e.available||e.selected!==null)return null;let t=e.options.filter(n=>Hn.has(n));return t.length>0?{...e,options:t}:null}o(Rt,"tr");s(Rt,"pending");function un(e){let[t,n]=(0,me.useState)(null),[r,a]=(0,me.useState)(e===void 0),[l,c]=(0,me.useState)(!1),[d,S]=(0,me.useState)(!1);(0,me.useEffect)(()=>{if(n(null),e===void 0){a(!0);return}let N=!0,j=e.methodChoice;typeof j=="function"?(a(!1),Promise.resolve().then(()=>j.call(e)).then(B=>{N&&n(Rt(B))},()=>{}).finally(()=>{N&&a(!0)})):a(!0);let R=e.on("method",B=>n(Rt(B)));return()=>{N=!1,R()}},[e]);let p=(0,me.useCallback)(async N=>{if(e===void 0)return!1;c(!0),S(!1);try{return await e.selectMethod(N),n(null),!0}catch{return S(!0),!1}finally{c(!1)}},[e]),w=t!==null&&t.options.length===1?t.options[0]:null;return{choice:t,auto:w==="national_number"&&!d?w:null,settled:r,busy:l,failed:d,select:p}}o(un,"nr");s(un,"useMethodChoice");var $n=["ar","fr","en"];function dn(e){if(typeof e!="string")return!1;try{let t=new URL(e);return t.protocol==="https:"||t.protocol==="http:"&&/^(localhost|127\.0\.0\.1)$/.test(t.hostname)}catch{return!1}}o(dn,"io");s(dn,"isClipUrl");function pn(e){let t=e.clips;if(typeof t!="object"||t===null)return null;let n={};for(let r of $n){let a=t[r];if(!(typeof a!="object"||a===null))for(let[l,c]of Object.entries(a))!st(l)||!dn(c)||((n[r]??(n[r]={}))[l]=c)}return Object.keys(n).length>0?n:null}o(pn,"ao");s(pn,"toVoiceClipMap");function hn(e){let[t,n]=(0,Te.useState)(null);(0,Te.useEffect)(()=>{if(n(null),e===void 0)return;let a=!0,l=s(d=>{if(!a)return;let S=typeof d=="object"&&d!==null&&typeof d.setId=="string"?d:null;n(p=>p?.setId===S?.setId?p:S)},"take");try{typeof e.voiceClips=="function"&&Promise.resolve(e.voiceClips()).then(l,()=>l(null))}catch{l(null)}let c=e.on("view",d=>l(d.voice));return()=>{a=!1,c()}},[e]);let r=(0,Te.useMemo)(()=>t!==null?pn(t):null,[t]);return e===void 0?null:r}o(hn,"rr");s(hn,"useServerVoiceClips");function fn({voice:e}){let t=Me();return(0,At.jsx)(te,{kind:"chip","aria-pressed":e.enabled,"aria-label":t("capture.voiceGuidance"),"data-testid":"sekyro-voice-toggle",onClick:o(()=>e.toggle(),"onClick"),children:(0,At.jsx)(nt,{off:!e.enabled,className:"sekyro-icon"})})}o(fn,"sr");s(fn,"VoiceChip");var Fn=new Set(["abandoned","not_opened","cancelled","superseded"]),Gn=800,Kn="capture.lookAtColours";function mn(e){return e===void 0||e!==!1&&e.length===wt.length&&wt.every(t=>e.includes(t))}o(mn,"mo");s(mn,"isDefaultTips");function yn(e){if(e.type==="keydown"&&e.key==="Escape")return!1;let t=globalThis.navigator?.userActivation;return t===void 0?!(e.type==="pointerup"&&e.pointerType==="touch"):t.isActive}o(yn,"yo");s(yn,"carriesActivation");function gn(e){return typeof e=="object"&&e!==null&&!(0,m.isValidElement)(e)&&"tone"in e&&"text"in e}o(gn,"go");s(gn,"isNoticeObject");var Zn=new Set(["nni_unbound","id_number_unbound","method_required","mobile_required","portrait_required"]);function vn(e){return e==="starting"||e==="gating"||e==="recording"||e==="mode_switch"}o(vn,"vo");s(vn,"isCapturing");function kn(e){return e==="captured"||e==="uploading"||e==="checking"}o(kn,"Co");s(kn,"isPostCapture");function zn({verification:e,locale:t,dir:n,strings:r,slots:a,autoStart:l=!1,notice:c,startDisabled:d=!1,startLabel:S,tips:p,tipsSummary:w,coach:N,voice:j,onGuidance:R,onCaptured:B,onResult:q,onError:A,onStateChange:J,assetBaseUrl:h,className:x}){let _=gr(t),k=(0,m.useMemo)(()=>yr(t,r),[t,r,_]),u=(0,m.useMemo)(()=>g=>k[g]??"",[k]),M=n??(t==="ar"?"rtl":"ltr"),I=(0,m.useRef)(null),D=(0,m.useContext)(Vn),i=cn({verification:e,videoRef:I,assetBaseUrl:h,onCaptured:B,onResult:q,onError:A,onStateChange:J}),T=ln(h,i.state==="idle"&&i.error===null),O=un(e),z=O.choice!==null,H=nn(e),ge=sn(e),he=on(e),Y=rn(),W=an(e),ne=W.session==="choice",L=W.mode==="assisted",xe=j!==!1&&j?.clips===void 0,ve=hn(xe?e:void 0),V=Zr({locale:t,defaultClips:ve,options:j}),ee=L?"environment":"user",ue=W.settled,F=(0,m.useRef)(null),Ne=(0,m.useRef)(!1),$e=(0,m.useRef)(V.unlock);$e.current=V.unlock,(0,m.useEffect)(()=>{let g=F.current;if(g===null)return;let oe=["pointerup","touchend","click","keydown"],_e=s(()=>{for(let qe of oe)g.removeEventListener(qe,Ae,!0)},"disarm");function Ae(qe){if(Ne.current){_e();return}yn(qe)&&(Ne.current=!0,_e(),$e.current())}o(Ae,"Re"),s(Ae,"onGesture");for(let qe of oe)g.addEventListener(qe,Ae,{capture:!0,passive:!0});return _e},[]);let b=(0,m.useCallback)(()=>{Ne.current||(Ne.current=!0,V.unlock()),i.start()},[V.unlock,i.start]),ke=(0,m.useCallback)(()=>i.start(),[i.start]),Le=(0,m.useRef)(!1),Oe=i.state==="idle"&&i.error===null,jt=!z&&!H.required&&(l===!0||l==="when-permitted"&&Y.permission==="granted"),Tt=jt&&O.settled&&H.settled&&ue,_n=l==="when-permitted"&&!Y.permissionSettled&&!Le.current,Ot=jt&&Oe&&!Le.current,ut=(_n||Ot||!ue)&&T.gate==="ready"?"loading":T.gate;(0,m.useEffect)(()=>{!Tt||!Oe||T.gate!=="ready"||Le.current||(Le.current=!0,ke())},[Tt,Oe,T.gate,ke]);let wn=Oe&&!z&&!H.required&&!(Ot&&T.gate==="ready"),[Pt,Bt]=(0,m.useState)(!1),{canSwitchCaptureMode:qt,setCaptureMode:Vt}=i;(0,m.useEffect)(()=>{if(!W.settled||!ne){Bt(!1);return}let g=!0;return qt().then(oe=>{g&&Bt(oe)}),()=>{g=!1}},[W.settled,ne,qt]);let{choose:Dt}=W,Ie=L?"self":"assisted",Sn=(0,m.useCallback)(async()=>{await Vt(Ie)&&Dt(Ie)},[Vt,Dt,Ie]),Ht=i.state!=="idle"&&i.facingMode!==null?i.facingMode:ee;(0,m.useEffect)(()=>{let g=I.current?.style;Ht==="user"?g?.removeProperty("transform"):g&&(g.transform="none")},[Ht]);let Fe=(0,m.useMemo)(()=>i.artifacts!==null&&typeof URL.createObjectURL=="function"?URL.createObjectURL(i.artifacts.keyframe):null,[i.artifacts]);(0,m.useEffect)(()=>{if(Fe!==null)return()=>URL.revokeObjectURL(Fe)},[Fe]);let $t=i.frozenPreview??Fe,Ue=e!==void 0,Z=vn(i.state),be=kn(i.state),Ge=Z||be,se=i.result,Ft=i.state==="done"&&se!==null,Ke=Z&&i.rampColour!==null,dt=i.state==="recording"&&i.frozenPreview!==null&&!Ke,Ze=D!==null,Gt=Pt&&Z&&!dt?{to:Ie,label:u(Ie==="assisted"?"capture.modeSwitch.toAssisted":"capture.modeSwitch.toSelf"),description:u(Ie==="assisted"?"capture.modeSwitch.toAssistedLabel":"capture.modeSwitch.toSelfLabel"),onSwitch:s(()=>{Sn()},"onSwitch")}:null,ze=i.modeRestarted&&Z?u("capture.modeSwitch.restarted"):null,Pe=be||dt,Kt=be?"checking":dt?"frozen":i.state==="recording"||Ke?"recording":i.gateLocked||i.gate.progress>=1?"locked":i.gate.faceDetected?"aligning":"seeking",Ye=Z?i.gate.hint:null,We=i.state==="starting"?"capture.preparing.title":Ye===null?null:Ye==="center"&&!i.gate.faceDetected?"fcv3.no_face":pr(Ye),[xn,Zt]=(0,m.useState)(null);(0,m.useEffect)(()=>{if(We!=="fcv3.no_face"){Zt(We);return}if(!Z)return;let g=setTimeout(()=>Zt(We),Gn);return()=>clearTimeout(g)},[We,Z]);let pt=Z&&!Ke&&typeof N=="string"&&N!=="",zt=L&&Z?u("capture.assisted.stage"):null,Re=Z&&!pt?Ke?Kn:xn:null,ht=pt?N:Re===null?"":u(Re);zr(V,Re,ht,Z);let Yt=(0,m.useRef)(R);Yt.current=R,(0,m.useEffect)(()=>{if(st(Re))try{Yt.current?.(Re)}catch(g){console.error("[@sekyro/react] onGuidance threw:",g)}},[Re]);let Be=(0,m.useMemo)(()=>({supported:V.supported,enabled:V.enabled,setEnabled:V.setEnabled,toggle:V.toggle}),[V.supported,V.enabled,V.setEnabled,V.toggle]),ft=a?.voicePrompt,Wt=ft!==void 0,Qt=j===void 0,Xt=(0,m.useRef)(!1);(0,m.useEffect)(()=>{!Wt||!Qt||Xt.current||!Lt()||(Xt.current=!0,console.warn("[@sekyro/react] <LivenessCapture>: `slots.voicePrompt` is set and `voice` is undefined, so the component speaks the guidance itself. If your slot plays audio, pass voice={false} or the person hears every hint twice; pass voice={{}} to keep the built-in voice and silence this warning."))},[Wt,Qt]);let Nn=ft!==void 0?(g,oe,_e)=>ft(g,oe,_e,Be):V.supported?()=>(0,v.jsx)(fn,{voice:Be}):void 0,{summary:mt,summaryPlaying:Jt,toggleSummary:er,stopSummary:tr}=V,Qe=w!==void 0&&w!=="",rr=Qe?w:u("capture.tips.summary"),nr=Qe?mt!=="none":mt==="partner"||mt==="default"&&mn(p),Rn=(0,m.useMemo)(()=>nr?{playing:Jt,toggle:s(()=>er(rr,{clip:!Qe}),"toggle"),stop:tr}:void 0,[nr,Jt,er,rr,tr,Qe]),An=(0,m.useMemo)(()=>({assets:ut,retryAssets:T.retry,permission:Y.permission,permissionSettled:Y.permissionSettled,captureMode:W.mode,facing:ee,voice:Be}),[ut,T.retry,Y.permission,Y.permissionSettled,W.mode,ee,Be]),Mn=gn(c)?(0,v.jsx)(le,{tone:c.tone,testId:"sekyro-host-notice",children:(0,v.jsx)("span",{children:c.text})}):c??null,ae=se!==null&&se.status==="retry"?se:null,G=Ft&&se.status==="unavailable"&&!z&&se.reasonCode!=="portrait_required"?se:null,Ce=Ft&&(se.status==="verified"||se.status==="not_verified"||se.status==="review")?se:null,yt=s((g,oe)=>{if(g===void 0)return null;if(g==="device_cooldown"){let Ae=fr(t,oe);if(Ae!==null)return u(Ae.key).replace("{time}",Ae.time)}let _e=et(g);return _e===null?null:u(_e)},"reasonText"),gt=s(g=>{let oe=g.retakeHint===void 0?null:Je(g.retakeHint);return oe===null?yt(g.reasonCode):u(oe)},"retryText"),sr=Ce===null?null:yt(Ce.reasonCode,Ce.retryAfter)??(Ce.status==="not_verified"&&Ce.reason!==void 0&&Fn.has(Ce.reason)?u("errors.session_expired"):null),En=G!==null&&G.reasonCode!==void 0&&G.reasonCode!=="nni_unbound"&&G.reasonCode!=="id_number_unbound"&&G.reasonCode!=="method_required"&&G.reasonCode!=="mobile_required"&&!(G.reasonCode==="no_recorder"&&i.artifacts?.degraded==="NO_RECORDER"),Xe=G?.reasonCode,ar=i.attempt;(0,m.useEffect)(()=>{G===null||Xe===void 0||e?.reportCaptureIssue===void 0||Zn.has(Xe)||Ct(g=>e.reportCaptureIssue?.(g),{check:"liveness",kind:"unavailable",phase:"upload",engineKind:Xe,attempt:Math.min(1e3,ar)})},[G,Xe,ar,e]);let or=bt(),Ln=z&&O.auto===null&&!Z&&!be&&i.error===null,vt=(0,m.useCallback)(async g=>{await O.select(g)&&i.state==="done"&&i.retry()},[O.select,i.state,i.retry]);return(0,m.useEffect)(()=>{O.auto!==null&&!O.busy&&!Z&&!be&&vt(O.auto)},[O.auto,O.busy,Z,be,vt]),(0,v.jsx)(vr,{value:u,children:(0,v.jsxs)("div",{ref:F,className:x===void 0?"sekyro-capture":`sekyro-capture ${x}`,dir:M,lang:t,"data-testid":"sekyro-liveness-capture","data-state":i.state,children:[a?.header,ae!==null&>(ae)!==null&&!(Ze&&Ge)?(0,v.jsx)(le,{tone:"warning",role:"status",testId:"sekyro-retry-notice",children:(0,v.jsx)("span",{children:gt(ae)})}):null,ze!==null&&!Ze?(0,v.jsx)(le,{tone:"info",role:"status",testId:"sekyro-mode-switch-status",children:(0,v.jsx)("span",{children:ze})}):null,he&&be&&!Ze?(0,v.jsx)(le,{tone:"info",role:"status",testId:"sekyro-busy-notice",children:(0,v.jsx)("span",{children:u("capture.busy")})}):null,H.required&&Oe?(0,v.jsx)(le,{tone:"info",role:"status",testId:"sekyro-mobile-required",children:(0,v.jsx)("span",{children:u("reasons.mobile_required")})}):null,i.error!==null?a?.errorPanel!==void 0?a.errorPanel(i.error,i.retry):(0,v.jsxs)(le,{tone:"danger",testId:"sekyro-error-notice",children:[(0,v.jsx)("span",{children:u(hr(i.error))}),i.error.retryable?(0,v.jsx)(te,{ref:or,kind:"ghost",className:"sekyro-btn--start",onClick:i.retry,children:u("common.retry")}):null]}):null,G!==null?(0,v.jsxs)(le,{tone:"danger",testId:"sekyro-unavailable-notice",children:[(0,v.jsx)("span",{children:(G.reasonCode==="attestation"&&G.attestationError==="clock_wrong"?u("errors.device_clock"):yt(G.reasonCode))??u(G.reasonCode===void 0?"errors.session_expired":"errors.network_error")}),En?(0,v.jsx)(te,{ref:or,kind:"ghost",className:"sekyro-btn--start",onClick:i.retry,children:u(G.reasonCode==="attestation"?"common.retry":"capture.recordAgain")}):null]}):null,sr!==null&&Ce!==null?(0,v.jsx)(le,{tone:Ce.status==="not_verified"?"danger":"info",testId:"sekyro-result-notice",children:(0,v.jsx)("span",{children:sr})}):null,(0,v.jsx)("div",{className:Ge?void 0:"sekyro-hidden","data-capture-live":Ge?"":void 0,children:Ze?D({videoRef:I,guidance:Pe&&Ue?u("capture.checking"):ht,coached:pt&&!(Pe&&Ue),note:Pe?Ue?u(he?"capture.busy":"capture.checkingHint"):null:ze??(ae!==null?gt(ae):zt),settled:Pe&&Ue,progress:i.gate.progress,phase:Kt,still:Pe?$t:null,live:Ge,modeSwitch:Gt,...Pt?{status:ze}:{},ramp:i.rampColour===null?null:{colour:i.rampColour}}):(0,v.jsx)(kr,{videoRef:I,guidanceText:ht,guidanceHint:Ye,guidanceKey:Re,progress:i.gate.progress,phase:Kt,draining:i.draining,stillUrl:$t,showChecking:Ue,operatorText:zt,voicePrompt:Nn,overlay:o(g=>(0,v.jsxs)(v.Fragment,{children:[a?.stageOverlay?.(g),(0,v.jsx)(br,{colour:i.rampColour})]}),"overlay"),reduceMotion:i.reduceMotion,modeSwitch:Gt})}),Ln&&O.choice!==null?(0,v.jsx)(qr,{title:u("method.title"),description:u("method.description"),options:O.choice.options.map(g=>({id:g,label:u(`method.${g}`)})),busy:O.busy,error:O.failed?u("errors.network_error"):null,focus:i.state==="done",testId:"sekyro-method",look:"buttons",onChoose:o(g=>{vt(g)},"onChoose")}):null,wn?(0,v.jsxs)(v.Fragment,{children:[ge&&a?.header===void 0&&a?.intro===void 0?(0,v.jsxs)("div",{className:"sekyro-stack sekyro-stack--1",children:[(0,v.jsx)("h2",{className:"sekyro-text-body",children:u("returning.title")}),(0,v.jsx)("p",{className:"sekyro-text-muted",children:u("returning.description")})]}):null,Mn,a?.intro!==void 0?a.intro(b,An):(0,v.jsx)(en,{assets:ut,onRetryAssets:T.retry,permission:Y.permission,captureMode:W.mode,voice:Be,tips:p??wt,summary:Rn,startLabel:S,startDisabled:d,onStart:b})]}):null,(0,v.jsx)(Wr,{showCoaching:ae!==null,coaching:ot(ae?.reasonCode,ae?.retakeHint),attemptsText:ae?.attemptsRemaining!==void 0?mr(k,t,ae.attemptsRemaining):null,showRetake:ae!==null&&!Z&&!be||!Ue&&i.state==="captured",onRetake:i.retry}),a?.footer]})})}o(zn,"Ei");s(zn,"LivenessCapture");var Ut=U(K(),1),ct=U(K(),1),f=U(de(),1);var _s={document:"card",population_registry:"id",national_eid:"smartphone",phone_otp:"phone",email_otp:"email"},ws={population_registry:"hashtag",national_eid:"key"};function Yn(e,t){switch(e.service){case"document":return t.t("method.document_photo");case"population_registry":return t.t("method.national_number");case"national_eid":{let n=e.nationalEid?.providerName;return n?t.t("method.national_eid",{provider:n}):t.t("method.national_eidGeneric")}default:return null}}o(Yn,"D");s(Yn,"identityLabel");function Wn(e,t){let[n,r]=(0,Ut.useState)(!1),[a,l]=(0,Ut.useState)(null);return{busy:n,error:a,run:s(c=>{r(!0),l(null),c().then(()=>r(!1),d=>{r(!1),l(e.t(Nr(d,e.strings))),t?.(d)})},"run")}}o(Wn,"q");s(Wn,"useChoiceAction");function bn(){let e=`sekyro-face-light-${(0,ct.useId)().replace(/[^A-Za-z0-9_-]/g,"")}`;return(0,f.jsxs)("svg",{className:"sekyro-mark sekyro-mark--face",viewBox:"0 0 168 206","aria-hidden":"true",focusable:"false",children:[(0,f.jsx)("defs",{children:(0,f.jsx)("mask",{id:e,children:(0,f.jsx)("ellipse",{className:"sekyro-mark__arc",cx:"84",cy:"103",rx:"76",ry:"95",pathLength:"1",fill:"none",stroke:"#fff",strokeWidth:"16"})})}),(0,f.jsx)("ellipse",{cx:"84",cy:"103",rx:"64",ry:"83",fill:"none",className:"sekyro-mark__line"}),(0,f.jsx)("path",{className:"sekyro-mark__face",d:"M68 64v10M100 64v10M84 66v25q0 2-6 1M60 108q24 18 48 0"}),(0,f.jsx)("ellipse",{className:"sekyro-mark__ticks",cx:"84",cy:"103",rx:"76",ry:"95",pathLength:"56"}),(0,f.jsx)("ellipse",{className:"sekyro-mark__ticks sekyro-mark__ticks--light",cx:"84",cy:"103",rx:"76",ry:"95",pathLength:"56",mask:`url(#${e})`})]})}o(bn,"O");s(bn,"FaceMark");var Qn={glasses:"jGlasses",lighting:"light",faceCamera:"camera"};function Xn(e){if(!(e?.kind!=="liveness"||e.reason===void 0))return{reason:e.reason,...e.retakeHint!==void 0?{retakeHint:e.retakeHint}:{},attemptsRemaining:e.attemptsRemaining??0,attemptsExhausted:e.attemptsExhausted===!0}}o(Xn,"ne");s(Xn,"faceIntroRetryOf");var Jn={"capture.retryFrontCamera.screenSide":"camera","capture.retryBackCamera.backSide":"camera","capture.retryUpright.vertical":"smartphone","capture.retryUpright.untilEnd":"smartphone","capture.retryRecording.cameraOn":"camera","capture.retryRecording.stay":"smartphone","capture.retryRecording.network":"smartphone","capture.retryDevice.screenRecording":"smartphone","capture.retryDevice.phone":"smartphone"};function es({start:e,context:t,tips:n,tipsTitle:r,human:a=!1,returning:l=!1,notice:c,retry:d}){let S=_t(),{t:p}=S,w=d===void 0?"face":ot(d.reason,d.retakeHint),N=w==="face"?null:He[w].tips,j=(0,ct.useContext)(_r)?.busy===!0;return(0,f.jsxs)("section",{className:"sekyro-step",children:[(0,f.jsx)(bn,{}),t.captureMode==="assisted"?(0,f.jsx)(tt,{title:p("capture.assisted.heading"),lead:p("capture.assisted.lead")}):l?(0,f.jsx)(tt,{title:p("returning.heading"),lead:p("returning.description")}):(0,f.jsx)(tt,{title:p(a?"native.face.humanIntroTitle":"native.face.introTitle"),lead:p(a?"native.face.humanIntroLead":"native.face.introLead")}),d!==void 0?(0,f.jsx)(Cn,{retry:d,title:He[w].title}):null,r!==void 0&&N===null?(0,f.jsx)("p",{className:"sekyro-section-label",children:r}):null,(0,f.jsx)("ul",{className:"sekyro-tiprows",children:N!==null?N.map(R=>(0,f.jsxs)("li",{children:[(0,f.jsx)(Ee,{name:Jn[R]??"face"}),p(R)]},R)):n!==void 0?n.map(R=>(0,f.jsxs)("li",{children:[(0,f.jsx)(Ee,{name:Qn[R.id]??"face"}),R.text]},R.id)):(0,f.jsxs)(f.Fragment,{children:[(0,f.jsxs)("li",{children:[(0,f.jsx)(Ee,{name:"light"}),p("capture.tips.light")]}),(0,f.jsxs)("li",{children:[(0,f.jsx)(Ee,{name:"jGlasses"}),p("capture.tips.uncover")]}),(0,f.jsxs)("li",{children:[(0,f.jsx)(Ee,{name:"smartphone"}),p("capture.tips.eyeLevel")]})]})}),c??null,c!==void 0?null:t.assets==="failed"?(0,f.jsx)(te,{kind:"secondary",full:!0,onClick:t.retryAssets,children:p("common.retry")}):null,c!==void 0?null:(0,f.jsx)(Cr,{children:(0,f.jsxs)(te,{full:!0,disabled:t.assets!=="ready"||j,"aria-busy":t.assets==="loading"||void 0,onClick:e,children:[(0,f.jsx)(Ee,{name:"camera"}),p("capture.start")]})})]})}o(es,"re");s(es,"FaceIntro");var ts=new Set(["match_inconclusive","no_face_source","below_threshold"]);function Cn({retry:e,title:t}){let n=_t(),r=e.retakeHint===void 0?null:Je(e.retakeHint),a=e.reason==="probe_not_from_liveness"?"capture.retrySamePerson.message":ts.has(e.reason)?"capture.retryMatch.message":et(e.reason);return(0,f.jsxs)(wr,{tone:"warning",children:[r!==null?(0,f.jsx)("span",{children:n.t(r)}):a!==null?(0,f.jsx)("span",{children:n.t(a)}):null,r===null?(0,f.jsx)("span",{children:n.t(t)}):null,(0,f.jsx)("span",{children:Sr(n,e.attemptsRemaining,e.attemptsExhausted)})]})}o(Cn,"K");s(Cn,"RetryNotice");function rs(e){return kt(e)}o(rs,"ce");s(rs,"isInAppBrowser");function ns(e,t){let n=t??(typeof navigator>"u"?"":String(navigator.userAgent??""));if(!/Android/i.test(n))return null;let r;try{r=new URL(e)}catch{return null}if(r.protocol!=="https:"&&r.protocol!=="http:")return null;let a=r.protocol.slice(0,-1);return`intent://${r.host}${r.pathname}${r.search}#Intent;scheme=${a};action=android.intent.action.VIEW;S.browser_fallback_url=${encodeURIComponent(e)};end`}o(ns,"le");s(ns,"androidBrowserIntent");export{qr as a,Lt as b,Vn as c,an as d,zn as e,_s as f,ws as g,Yn as h,Wn as i,Xn as j,es as k,rs as l,ns as m};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as t,b as r,c as m,d as o,e as p}from"./chunk-
|
|
1
|
+
import{a as t,b as r,c as m,d as o,e as p}from"./chunk-MINBJAVX.js";import"./chunk-HOBGJOBT.js";import"./chunk-F4Q2Q4OC.js";import"./chunk-32CNXSJQ.js";import"./chunk-U7QPOSFH.js";import"./chunk-P7K7ELYZ.js";import"./chunk-6MYG4HWP.js";import"./chunk-JS2IXPNL.js";import"./chunk-SLLJX5QK.js";import"./chunk-4FHWXBOB.js";export{r as BARCODE_BUDGET_MS,t as SAME_FACE_MAX_DROPS,o as createDocumentCapture,p as createDocumentCaptureInternal,m as warmDocumentCapture};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use client";import{a as et}from"./chunk-L7I27OCG.js";import{a as qe}from"./chunk-MXMEO2IW.js";import{a as je,b as Qe,c as Ze}from"./chunk-CYEDFGUG.js";import{h as Ve}from"./chunk-RH466MDF.js";import"./chunk-FQHV53QQ.js";import{d as Je}from"./chunk-X6LDVTUQ.js";import"./chunk-Z6OYPC4S.js";import{F as We,G as Xe,H as Ye,J as Ke,L as ie,M as se,a as It,b as At,c as O,o as Fe,q as Ge,v as D,w as Ce,y as _e}from"./chunk-BMTTAXWY.js";import"./chunk-PZVVXMQ6.js";import"./chunk-32CNXSJQ.js";import"./chunk-U7QPOSFH.js";import"./chunk-P7K7ELYZ.js";import{a as l}from"./chunk-5QL6W6FW.js";import"./chunk-6MYG4HWP.js";import"./chunk-JS2IXPNL.js";import"./chunk-SLLJX5QK.js";import{a as c,c as Ee}from"./chunk-4FHWXBOB.js";var i=Ee(It(),1),n=Ee(At(),1);var Ot={image:'<path d="M2 12C2 7.29 2 4.93 3.46 3.46C4.93 2 7.29 2 12 2C16.71 2 19.07 2 20.54 3.46C22 4.93 22 7.29 22 12C22 16.71 22 19.07 20.54 20.54C19.07 22 16.71 22 12 22C7.29 22 4.93 22 3.46 20.54C2 19.07 2 16.71 2 12Z" stroke="currentColor"/><path d="M14 8A2 2 0 1 0 18 8A2 2 0 1 0 14 8Z" stroke="currentColor"/><path d="M2 12.5L3.75 10.97C4.66 10.17 6.04 10.22 6.89 11.07L11.18 15.36C11.87 16.05 12.95 16.14 13.75 15.58L14.04 15.37C15.19 14.57 16.74 14.66 17.78 15.6L21 18.5" stroke="currentColor" stroke-linecap="round"/>',flashlight:'<path d="M9 11.66V19C9 19.93 9 20.4 9.15 20.77C9.36 21.26 9.74 21.64 10.23 21.85C10.6 22 11.07 22 12 22C12.93 22 13.4 22 13.77 21.85C14.26 21.64 14.64 21.26 14.85 20.77C15 20.4 15 19.93 15 19V11.66C15 10.84 15 10.43 15.15 10.06C15.3 9.7 15.59 9.41 16.17 8.83L16.17 8.83L19.41 5.59C19.7 5.3 19.85 5.15 19.92 4.97C20 4.78 20 4.58 20 4.17V4C20 3.06 20 2.59 19.71 2.29C19.41 2 18.94 2 18 2H6C5.06 2 4.59 2 4.29 2.29C4 2.59 4 3.06 4 4V4.17C4 4.58 4 4.78 4.08 4.97C4.15 5.15 4.3 5.3 4.59 5.59L7.83 8.83C8.41 9.41 8.7 9.7 8.85 10.06C9 10.43 9 10.84 9 11.66Z" stroke="currentColor" stroke-linecap="round"/><path d="M15 10H9" stroke="currentColor" stroke-linecap="round"/><path d="M12 13V15" stroke="currentColor" stroke-linecap="round"/><path d="M4.5 5H19.5" stroke="currentColor" stroke-linecap="round"/>'},Dt={"dcv3.mrz.searching":"ضع صفحة جواز السفر كاملة داخل الإطار","dcv3.mrz.showMrzSide":"اعرض الوجه الذي يحتوي على سطرين أو ثلاثة أسطر من الحروف","dcv3.mrz.reading":"جارٍ قراءة الوثيقة… ثبّتها","dcv3.mrz.moveCloser":"اقترب حتى تملأ أسطر الحروف الإطار","dcv3.mrz.turnSideways":"أدر هاتفك أفقيًا لقراءة أسطر الحروف","dcv3.mrz.glare":"أمِل الوثيقة لإزالة الانعكاس","dcv3.mrz.holdStill":"لا تتحرك","dcv3.mrz.valid":"تمت قراءة الوثيقة. جارٍ التقاط الصورة","dcv3.mrz.looksLikePassport":"يبدو أن هذا جواز سفر","dcv3.mrz.looksLikeCard":"يبدو أن هذه بطاقة تعريف أو بطاقة إقامة"},le={"dcv3.mrz.searching":"Fit the whole passport page in the frame","dcv3.mrz.showMrzSide":"Show the side with the two or three lines of characters","dcv3.mrz.reading":"Reading the document… hold it steady","dcv3.mrz.moveCloser":"Move closer so the lines of characters fill the frame","dcv3.mrz.turnSideways":"Turn your phone sideways to read the lines of characters","dcv3.mrz.glare":"Tilt the document to remove the reflection","dcv3.mrz.holdStill":"Hold still","dcv3.mrz.valid":"Document read. Taking the photo","dcv3.mrz.looksLikePassport":"This looks like a passport","dcv3.mrz.looksLikeCard":"This looks like an identity card or residence permit"},Rt={"dcv3.mrz.searching":"Cadrez toute la page du passeport","dcv3.mrz.showMrzSide":"Montrez la face avec les deux ou trois lignes de caractères","dcv3.mrz.reading":"Lecture du document… tenez-le immobile","dcv3.mrz.moveCloser":"Rapprochez-vous pour que les lignes de caractères remplissent le cadre","dcv3.mrz.turnSideways":"Tournez votre téléphone à l’horizontale pour lire les lignes de caractères","dcv3.mrz.glare":"Inclinez le document pour supprimer le reflet","dcv3.mrz.holdStill":"Ne bougez plus","dcv3.mrz.valid":"Document lu. Prise de la photo","dcv3.mrz.looksLikePassport":"Ceci ressemble à un passeport","dcv3.mrz.looksLikeCard":"Ceci ressemble à une carte d’identité ou un titre de séjour"},Ut={"doc.uploadInstead":"رفع صورة بدلًا من ذلك","doc.uploadTitle":"ارفع صورة لوثيقتك","doc.uploadHint":"صورة واضحة للوثيقة كاملة، ملتقطة بكاميرا.","doc.uploadUnsupported":"اختر صورة للوثيقة بصيغة JPEG أو PNG أو HEIC.","doc.uploadFailed":"تعذّر إرسال هذه الصورة. أعد المحاولة.","doc.source.title":"كيف تريد إضافة وثيقتك؟","doc.source.description":"التقط صورة بالكاميرا، أو ارفع صورة للوثيقة من هذا الجهاز.","doc.source.camera":"التقاط صورة","doc.source.upload":"رفع صورة"},ce={"doc.uploadInstead":"Upload a photo instead","doc.uploadTitle":"Upload a photo of your document","doc.uploadHint":"A clear photo of the whole document, taken with a camera.","doc.uploadUnsupported":"Choose a JPEG, PNG or HEIC photo of the document.","doc.uploadFailed":"We could not send this photo. Try again.","doc.source.title":"How do you want to add your document?","doc.source.description":"Take a photo with the camera, or upload a photo of the document from this device.","doc.source.camera":"Take a photo","doc.source.upload":"Upload a photo"},Bt={"doc.uploadInstead":"Téléverser une photo à la place","doc.uploadTitle":"Téléversez une photo de votre document","doc.uploadHint":"Une photo nette du document entier, prise avec un appareil photo.","doc.uploadUnsupported":"Choisissez une photo JPEG, PNG ou HEIC du document.","doc.uploadFailed":"Nous n'avons pas pu envoyer cette photo. Réessayez.","doc.source.title":"Comment voulez-vous ajouter votre document ?","doc.source.description":"Prenez une photo avec la caméra, ou importez une photo du document depuis cet appareil.","doc.source.camera":"Prendre une photo","doc.source.upload":"Importer une photo"},Et={"native.doc.introTitle":"سنلتقط صورة لوثيقتك","native.doc.introLead":"تُلتقط الصورة تلقائيًا عندما تكون الوثيقة داخل الإطار.","native.doc.tip.flat":"ضع الوثيقة مسطحة على سطح داكن.","native.doc.tip.glare":"تجنّب انعكاسات الضوء.","native.doc.tip.frame":"أبقِ الوثيقة كاملة داخل الإطار.","native.doc.openCamera":"افتح الكاميرا","native.doc.changeDocument":"تغيير الوثيقة","native.doc.titleOf.carte_identite":"صوّر بطاقة هويتك","native.doc.titleOf.passport":"صوّر جواز سفرك","native.doc.titleOf.residence_permit":"صوّر بطاقة إقامتك","native.doc.titleOf.drivers_license":"صوّر رخصة قيادتك","native.doc.onlyType.carte_identite":"{country}: تُقبل بطاقة الهوية فقط هنا.","native.doc.onlyType.passport":"{country}: يُقبل جواز السفر فقط هنا.","native.doc.onlyType.residence_permit":"{country}: تُقبل بطاقة الإقامة فقط هنا.","native.doc.onlyType.drivers_license":"{country}: تُقبل رخصة القيادة فقط هنا.","native.scan.closer":"اقترب قليلًا","native.scan.farther":"ابتعد قليلًا","native.scan.glare":"أمِل البطاقة قليلًا","native.scan.dark":"الإضاءة ضعيفة. شغّل المصباح.","native.scan.blurry":"الصورة غير واضحة. ثبّت الهاتف.","native.scan.holdStill":"لا تتحرك","native.scan.reading":"جارٍ التحقق من وثيقتك…","native.scan.putDown":"يمكنك وضع وثيقتك جانبًا.","native.scan.retry":"لنحاول مرة أخرى","native.scan.seenPassport":"يبدو أن هذا جواز سفر","native.scan.seenCard":"يبدو أن هذه بطاقة هوية أو بطاقة إقامة","native.scan.showInstead.carte_identite":"أظهر بطاقة هويتك بدلًا منها","native.scan.showInstead.passport":"أظهر صفحة الصورة في جواز سفرك بدلًا منها","native.scan.showInstead.residence_permit":"أظهر بطاقة إقامتك بدلًا منها","native.scan.showInstead.drivers_license":"أظهر رخصة قيادتك بدلًا منها","native.scan.expired":"انتهت صلاحية هذه الوثيقة. امسح وثيقة سارية."},de={"native.doc.introTitle":"Photograph your document","native.doc.introLead":"The photo is taken by itself once the document is in the frame.","native.doc.tip.flat":"Lay it flat on a dark surface.","native.doc.tip.glare":"Avoid glare from lights.","native.doc.tip.frame":"Keep all of it in the frame.","native.doc.openCamera":"Open the camera","native.doc.changeDocument":"Change document","native.doc.titleOf.carte_identite":"Photograph your identity card","native.doc.titleOf.passport":"Photograph your passport","native.doc.titleOf.residence_permit":"Photograph your residence permit","native.doc.titleOf.drivers_license":"Photograph your driver's license","native.doc.onlyType.carte_identite":"{country}: only an identity card is accepted here.","native.doc.onlyType.passport":"{country}: only a passport is accepted here.","native.doc.onlyType.residence_permit":"{country}: only a residence permit is accepted here.","native.doc.onlyType.drivers_license":"{country}: only a driver's license is accepted here.","native.scan.closer":"Move a little closer","native.scan.farther":"Move back a little","native.scan.glare":"Tilt the card a little","native.scan.dark":"Too dark. Turn on the light.","native.scan.blurry":"Blurry image. Hold the phone still.","native.scan.holdStill":"Hold still","native.scan.reading":"Checking your document…","native.scan.putDown":"You can put your document down.","native.scan.retry":"Let's try that again","native.scan.seenPassport":"This looks like a passport","native.scan.seenCard":"This looks like an identity card or residence permit","native.scan.showInstead.carte_identite":"Show your identity card instead","native.scan.showInstead.passport":"Show the photo page of your passport instead","native.scan.showInstead.residence_permit":"Show your residence permit instead","native.scan.showInstead.drivers_license":"Show your driver's license instead","native.scan.expired":"This document has expired. Scan a valid document."},Vt={"native.doc.introTitle":"Photographiez votre pièce","native.doc.introLead":"La photo se prend toute seule quand la pièce est bien cadrée.","native.doc.tip.flat":"Posez la pièce à plat sur fond sombre.","native.doc.tip.glare":"Évitez les reflets de lumière.","native.doc.tip.frame":"Gardez toute la pièce dans le cadre.","native.doc.openCamera":"Ouvrir la caméra","native.doc.changeDocument":"Changer de document","native.doc.titleOf.carte_identite":"Photographiez votre carte d'identité","native.doc.titleOf.passport":"Photographiez votre passeport","native.doc.titleOf.residence_permit":"Photographiez votre titre de séjour","native.doc.titleOf.drivers_license":"Photographiez votre permis de conduire","native.doc.onlyType.carte_identite":"{country} : seule la carte d'identité est acceptée ici.","native.doc.onlyType.passport":"{country} : seul le passeport est accepté ici.","native.doc.onlyType.residence_permit":"{country} : seul le titre de séjour est accepté ici.","native.doc.onlyType.drivers_license":"{country} : seul le permis de conduire est accepté ici.","native.scan.closer":"Approchez un peu","native.scan.farther":"Reculez un peu","native.scan.glare":"Inclinez un peu la carte","native.scan.dark":"Trop sombre. Allumez la lampe.","native.scan.blurry":"Image floue. Tenez le téléphone immobile.","native.scan.holdStill":"Ne bougez plus","native.scan.reading":"Vérification de votre document…","native.scan.putDown":"Vous pouvez poser votre pièce.","native.scan.retry":"Réessayons","native.scan.seenPassport":"Ceci ressemble à un passeport","native.scan.seenCard":"Ceci ressemble à une carte d'identité ou un titre de séjour","native.scan.showInstead.carte_identite":"Montrez plutôt votre carte d'identité","native.scan.showInstead.passport":"Montrez plutôt la page photo de votre passeport","native.scan.showInstead.residence_permit":"Montrez plutôt votre titre de séjour","native.scan.showInstead.drivers_license":"Montrez plutôt votre permis de conduire","native.scan.expired":"Ce document a expiré. Scannez un document valide."},G,tt=(G=class{constructor(){this.shown=null,this.shownAt=0,this.yielded=null}present(t,a,r,o){(t===null||t.key!==this.yielded)&&(this.yielded=null);let u=this.shown;return t!==null&&this.yielded===null?u?.kind==="problem"&&u.key===t.key&&u.action===t.action?!t.blocking&&a!==null&&o-this.shownAt>=3e3?(this.yielded=t.key,this.show({kind:"hint",key:a,action:null},o)):u:this.show({kind:"problem",key:t.key,action:t.action},o):u?.kind==="problem"&&t===null&&(r||o-this.shownAt<3e3)?u:a===null?this.show(null,o):u?.kind==="hint"&&u.key===a?u:this.show({kind:"hint",key:a,action:null},o)}show(t,a){return this.shown=t,this.shownAt=a,t}},c(G,"_e"),G);l(tt,"NoticeBand");var Ft=tt,Gt=["locking","capturing"],W,nt=(W=class{constructor(){this.shown={hint:null,locking:!1,card:null,manualShutter:!1},this.candidate=null,this.candidateSince=0,this.hintShownAt=0,this.lockLostAt=null,this.detectedSince=null,this.lostSince=null,this.shutterSince=null}present(t,a){return this.presentHint(t,a),this.presentLock(t,a),this.presentCard(t,a),this.shutterSince=t.manualShutter?this.shutterSince??a:null,this.shown={...this.shown,manualShutter:this.shutterSince!==null&&a-this.shutterSince>=1e3},this.shown}presentHint(t,a){let r=t.phase==="framing"&&!(t.hint==="blurry"&&t.card===null)?t.hint:null;if(t.phase!=="framing"){this.shown={...this.shown,hint:null},this.candidate=null;return}if(r!==this.candidate&&(this.candidate=r,this.candidateSince=a),r===this.shown.hint)return;let o=a-this.candidateSince>=(r===null?0:350),u=this.shown.hint===null||a-this.hintShownAt>=2500;o&&u&&(this.shown={...this.shown,hint:r},this.hintShownAt=a)}presentLock(t,a){if(Gt.includes(t.phase)){this.shown={...this.shown,locking:!0},this.lockLostAt=null;return}if(this.shown.locking){if(t.phase!=="framing"){this.shown={...this.shown,locking:!1},this.lockLostAt=null;return}this.lockLostAt??(this.lockLostAt=a),a-this.lockLostAt>=300&&(this.shown={...this.shown,locking:!1},this.lockLostAt=null)}}presentCard(t,a){let r=t.card;if(r===null||t.phase!=="framing"){if(t.phase!=="framing"){this.shown={...this.shown,card:null},this.detectedSince=null,this.lostSince=null;return}this.detectedSince=null,this.lostSince??(this.lostSince=a),a-this.lostSince>=300&&(this.shown={...this.shown,card:null});return}if(this.lostSince=null,this.detectedSince??(this.detectedSince=a),a-this.detectedSince<250)return;let o=this.shown.card;if(o===null){this.shown={...this.shown,card:{...r}};return}let u=.35;this.shown={...this.shown,card:{fill:o.fill+(r.fill-o.fill)*u,offsetX:o.offsetX+(r.offsetX-o.offsetX)*u,offsetY:o.offsetY+(r.offsetY-o.offsetY)*u}}}},c(W,"Ce"),W);l(nt,"ScanPresenter");var Wt=nt,Xt={en:de,fr:Vt,ar:Et,es:de,pt:de,de},Yt=450,Ne=l(e=>(t,a)=>qe(e.strings[t]??Xt[e.locale][t]??"",a),"useScanCopy");function at(e,t){try{return new Intl.DisplayNames([t],{type:"region"}).of(e)??e}catch{return e}}c(at,"It");l(at,"regionName");function rt(e){let t=e.documentType,a=t===null?"native.doc.introTitle":`native.doc.titleOf.${t}`,r=t!==null&&e.issuer!==null&&Ve(e.documents,e.issuer).length===1;return{titleKey:a,onlyKey:r?`native.doc.onlyType.${t}`:null}}c(rt,"Rt");l(rt,"introCopy");function Q({name:e}){return(0,n.jsx)("svg",{className:"sekyro-glyph",viewBox:"0 0 24 24",fill:"none","aria-hidden":"true",focusable:"false",dangerouslySetInnerHTML:{__html:Ot[e]}})}c(Q,"pe");l(Q,"ScanGlyph");var Kt={en:le,fr:Rt,ar:Dt,es:le,pt:le,de:le},jt={en:ce,fr:Bt,ar:Ut,es:ce,pt:ce,de:ce},Qt="image/jpeg,image/png,image/heic,image/heif";function E(e){let t=e.strings,a=l(r=>t[r]??jt[e.locale][r],"text");return{t:l(r=>a(r)??"","t")}}c(E,"G");l(E,"uploadCopy");function ot(e,t){return e===null||e.state==="fallback"||e.state==="mismatch"||e.state==="expired"?null:e.state==="searching"?t?"dcv3.mrz.searching":"dcv3.mrz.showMrzSide":e.state==="valid"?"dcv3.mrz.valid":e.coach==="holdStill"?"dcv3.mrz.holdStill":"dcv3.mrz.reading"}c(ot,"Et");l(ot,"mrzInstruction");function it(e){return e?.state==="reading"&&e.coach!==void 0&&e.coach!=="holdStill"?`mrz:${e.coach}`:null}c(it,"Ut");l(it,"mrzHint");function st(e){return e==="carte_identite"||e==="passport"||e==="residence_permit"||e==="drivers_license"?`native.scan.showInstead.${e}`:null}c(st,"At");l(st,"showInsteadKey");var Zt={document_type_mismatch:"doc.reason_document_type_mismatch",document_number_invalid:"doc.reason_document_number_invalid",provider_unavailable:"doc.reason_provider_unavailable",document_type_not_supported:"doc.reason_document_type_not_supported",document_sides_mismatch:"doc.reason_document_sides_mismatch",document_side_not_read:"doc.reason_document_side_not_read"};function ue(e){if(e.reason==="unreadable")return"doc.reason_unreadable";let t=e.reason!==void 0?Zt[e.reason]:void 0;return t!==void 0?t:e.reason==="tester_document_mismatch"?"reasons.tester_document_mismatch":e.reason!==void 0&&e.reason!=="side_missing"?Ge(e.reason):null}c(ue,"xe");l(ue,"reasonOf");var lt=new Set(["document_type_not_accepted","tester_document_mismatch","document_type_mismatch","provider_unavailable","document_type_not_supported","document_sides_mismatch","document_side_not_read"]);function qt({step:e,i18n:t,liveMrz:a,barcodeAssetBaseUrl:r,ageLead:o,...u}){let[w,h]=(0,i.useState)(!1),y=(0,i.useRef)(-1),[f,g]=(0,i.useState)("idle"),x=(0,i.useRef)(null),z=typeof e.uploadDocument=="function",N=z?e.photo?.source??"camera":"camera",L=z&&N!=="camera"&&e.photo?.uploadOffered===!0,[C,V]=(0,i.useState)(null),P=N==="upload"?"upload":N==="choice"?C??e.photo?.pick??"source":"camera",R=f==="sending"?void 0:()=>x.current?.click(),k=l(async H=>{let q=H.currentTarget.files?.[0];if(H.currentTarget.value="",q!==void 0){h(!1),g("sending");try{await e.uploadDocument(q),g("idle")}catch(Y){g(Y instanceof TypeError&&Y.message==="unsupported_file"?"unsupported":"failed")}}},"onFile"),Z=L?(0,n.jsx)("input",{ref:x,type:"file",accept:Qt,hidden:!0,"data-testid":"sekyro-doc-upload","aria-label":E(t).t("doc.uploadTitle"),onChange:c(H=>{k(H)},"onChange")}):null,$=E(t),X=e.photo?.cameraOnPhone===!0;return P==="camera"&&X?(0,n.jsx)(Je,{i18n:t,lead:t.t("handoff.lead.document"),refresh:e.refresh,actions:(0,n.jsx)(O,{kind:"ghost",full:!0,onClick:c(()=>V("upload"),"onClick"),children:$.t("doc.source.upload")})}):P==="source"?(0,n.jsx)(et,{testId:"sekyro-doc-source",title:$.t("doc.source.title"),lead:$.t("doc.source.description"),cameraLabel:X?t.t("capture.source.phone"):$.t("doc.source.camera"),onPhone:X,uploadLabel:$.t("doc.source.upload"),notice:(0,n.jsx)(he,{step:e,i18n:t}),onCamera:c(()=>V("camera"),"onCamera"),onUpload:c(()=>V("upload"),"onUpload")}):P==="upload"?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(ut,{step:e,i18n:t,ageLead:o===!0,upload:f,offered:L,onPick:c(()=>x.current?.click(),"onPick"),...N==="choice"?{onCamera:l(()=>V("camera"),"onCamera")}:{},...u}),Z]}):(0,n.jsxs)(n.Fragment,{children:[w?(0,n.jsx)(ht,{step:e,i18n:t,attempts:y,...a!==void 0?{liveMrz:a}:{},...r!==void 0?{barcodeAssetBaseUrl:r}:{},...L&&R!==void 0?{onUpload:R}:{},onClose:c(()=>h(!1),"onClose")}):(0,n.jsx)(dt,{step:e,i18n:t,ageLead:o===!0,onOpen:c(()=>h(!0),"onOpen"),upload:f,...L&&R!==void 0?{onUpload:R}:{},...u}),Z]})}c(qt,"An");l(qt,"DocumentCaptureView");function Se({passport:e}){let t=Math.round(228/(e?1.42:1.586));return(0,n.jsxs)("svg",{className:`sekyro-mark sekyro-mark--card${e?" sekyro-mark--passport":""}`,viewBox:`-12 ${e?-22:-12} 252 ${t+(e?34:24)}`,"aria-hidden":"true",focusable:"false",children:[(0,n.jsx)("defs",{children:(0,n.jsx)("clipPath",{id:"sekyro-card-clip",children:(0,n.jsx)("rect",{width:228,height:t,rx:"12.5"})})}),e?(0,n.jsx)("rect",{className:"sekyro-mark__page",x:"10",y:"-14",width:208,height:t,rx:"10"}):null,(0,n.jsx)("rect",{className:"sekyro-mark__card",width:228,height:t,rx:"12.5"}),(0,n.jsx)("rect",{className:"sekyro-mark__photo",x:"17",y:"17",width:"55",height:t*(e?.5:.62),rx:"6"}),[0,1,2].map(a=>(0,n.jsx)("rect",{className:"sekyro-mark__text",x:"88",y:23+a*t*.12,width:100-a*20,height:"6",rx:"3"},a)),e?[0,1].map(a=>(0,n.jsx)("line",{className:"sekyro-mark__code",x1:"17",x2:211,y1:t*.75+a*11,y2:t*.75+a*11},a)):(0,n.jsx)("rect",{className:"sekyro-mark__text",x:"88",y:23+3*t*.12,width:"60",height:"6",rx:"3"}),(0,n.jsx)("g",{clipPath:"url(#sekyro-card-clip)",children:(0,n.jsx)("g",{className:"sekyro-mark__read",style:{"--sekyro-read-w":"228px"},children:(0,n.jsx)("rect",{x:"-1",width:"2",height:t,className:"sekyro-mark__beam"})})}),(0,n.jsx)("path",{className:"sekyro-mark__brackets",d:ct(-10,-10,248,t+20,16,30)})]})}c(Se,"dt");l(Se,"ScanMark");function ct(e,t,a,r,o,u){let w=Math.min(o,u*.6);return[[e,t,1,1],[e+a,t,-1,1],[e,t+r,1,-1],[e+a,t+r,-1,-1]].map(([h,y,f,g])=>`M${h} ${y+g*u}V${y+g*w}Q${h} ${y} ${h+f*w} ${y}H${h+f*u}`).join("")}c(ct,"Bt");l(ct,"brackets");function dt({step:e,i18n:t,ageLead:a,onOpen:r,onChangeCountry:o,onChangeDocument:u,upload:w,onUpload:h}){let y=Ne(t),f=E(t),g=e.documentType==="passport",x=rt(e),z=ue(e),N=w==="sending",L=(0,i.useContext)(Xe)?.busy===!0;return(0,n.jsxs)("section",{className:"sekyro-step sekyro-step--doc-intro","data-testid":"sekyro-document",children:[(0,n.jsx)(Se,{passport:g}),(0,n.jsx)(Ce,{title:y(x.titleKey)||y("native.doc.introTitle"),lead:a?t.t("doc.ageStepUp"):y("native.doc.introLead")}),x.onlyKey!==null&&e.issuer!==null?(0,n.jsx)("p",{className:"sekyro-text-muted sekyro-doc-only",children:y(x.onlyKey,{country:at(e.issuer,t.locale)})}):null,(0,n.jsx)(he,{step:e,i18n:t}),e.reason!==void 0&<.has(e.reason)?null:(0,n.jsxs)("ul",{className:"sekyro-tiprows",children:[(0,n.jsxs)("li",{children:[(0,n.jsx)(D,{name:g?"passport":"card"}),y("native.doc.tip.flat")]}),(0,n.jsxs)("li",{children:[(0,n.jsx)(D,{name:"light"}),y("native.doc.tip.glare")]}),(0,n.jsxs)("li",{children:[(0,n.jsx)(Q,{name:"image"}),y("native.doc.tip.frame")]})]}),(0,n.jsx)(xe,{i18n:t,...u!==void 0?{onChangeDocument:u}:{},...o!==void 0?{onChangeCountry:o}:{}}),(0,n.jsx)($e,{i18n:t,upload:w}),N?(0,n.jsx)("p",{className:"sekyro-text-muted",role:"status",children:t.t("doc.uploading")}):h!==void 0?(0,n.jsx)("p",{className:"sekyro-text-muted",children:f.t("doc.uploadHint")}):null,(0,n.jsxs)(_e,{children:[(0,n.jsxs)(O,{full:!0,onClick:r,disabled:N||L,children:[(0,n.jsx)(D,{name:"camera"}),y("native.doc.openCamera")]}),h!==void 0?(0,n.jsxs)(O,{full:!0,kind:"ghost",onClick:h,children:[(0,n.jsx)(Q,{name:"image"}),f.t("doc.uploadInstead")]}):null]})]})}c(dt,"Vt");l(dt,"DocumentIntro");function he({step:e,i18n:t}){let a=ue(e);return a===null&&e.reasonHidden===!0?(0,n.jsx)(ie,{tone:"info",children:(0,n.jsx)("span",{children:se(t,e.attemptsRemaining,e.attemptsExhausted)})}):a===null?null:(0,n.jsxs)(ie,{tone:"warning",children:[(0,n.jsx)("span",{children:t.t(a)}),(0,n.jsx)("span",{children:se(t,e.attemptsRemaining,e.attemptsExhausted)})]})}c(he,"Te");l(he,"ReasonNotice");function xe({i18n:e,onChangeCountry:t,onChangeDocument:a}){let r=Ne(e);return a===void 0&&t===void 0?null:(0,n.jsxs)("div",{className:"sekyro-links",children:[a!==void 0?(0,n.jsx)("button",{type:"button",className:"sekyro-link",onClick:a,children:r("native.doc.changeDocument")}):null,t!==void 0?(0,n.jsx)("button",{type:"button",className:"sekyro-link",onClick:t,children:e.t("native.doc.changeCountry")}):null]})}c(xe,"ut");l(xe,"ChangeLinks");function $e({i18n:e,upload:t}){return t!=="unsupported"&&t!=="failed"?null:(0,n.jsx)(ie,{tone:"warning",children:(0,n.jsx)("span",{children:E(e).t(t==="unsupported"?"doc.uploadUnsupported":"doc.uploadFailed")})})}c($e,"pt");l($e,"UploadNotice");function ut({step:e,i18n:t,ageLead:a,upload:r,offered:o,onPick:u,onCamera:w,onChangeCountry:h,onChangeDocument:y}){let f=E(t),g=r==="sending";return(0,n.jsxs)("section",{className:"sekyro-step","data-testid":"sekyro-doc-upload-screen",children:[(0,n.jsx)(Se,{passport:e.documentType==="passport"}),(0,n.jsx)(Ce,{title:f.t("doc.uploadTitle"),lead:a?t.t("doc.ageStepUp"):f.t("doc.uploadHint")}),a?(0,n.jsx)("p",{className:"sekyro-text-muted",children:f.t("doc.uploadHint")}):null,(0,n.jsx)(he,{step:e,i18n:t}),(0,n.jsx)(xe,{i18n:t,...y!==void 0?{onChangeDocument:y}:{},...h!==void 0?{onChangeCountry:h}:{}}),(0,n.jsx)($e,{i18n:t,upload:r}),g?(0,n.jsx)("p",{className:"sekyro-text-muted",role:"status",children:t.t("doc.uploading")}):null,(0,n.jsxs)(_e,{children:[(0,n.jsxs)(O,{full:!0,onClick:u,disabled:g||!o||e.attemptsExhausted,children:[(0,n.jsx)(Q,{name:"image"}),f.t("doc.source.upload")]}),w!==void 0?(0,n.jsxs)(O,{full:!0,kind:"ghost",onClick:w,disabled:g,children:[(0,n.jsx)(D,{name:"camera"}),f.t("doc.source.camera")]}):null]})]})}c(ut,"Yt");l(ut,"DocumentUploadScreen");function ze(e,t,a){let r=e*.88,o=r/a;return{x:(e-r)/2,y:t*.42-o/2,w:r,h:o}}c(ze,"it");l(ze,"guideRect");var Jt={"mrz:moveCloser":"dcv3.mrz.moveCloser","mrz:turnSideways":"dcv3.mrz.turnSideways","mrz:glare":"dcv3.mrz.glare",too_far:"native.scan.closer",too_close:"native.scan.farther",focus_far:"native.scan.farther",glare:"native.scan.glare",too_bright:"native.scan.glare",too_dark:"native.scan.dark",blurry:"native.scan.blurry"},en=l(()=>typeof window<"u"&&window.matchMedia?.("(prefers-reduced-motion: reduce)").matches===!0,"reduceMotion");function ht({step:e,i18n:t,liveMrz:a,barcodeAssetBaseUrl:r,onClose:o,attempts:u,onUpload:w}){let h=Ne(t),y=(0,i.useContext)(je),f=(0,i.useRef)(y);f.current=y;let g=(0,i.useRef)(null),x=(0,i.useRef)(null),z=(0,i.useRef)(null),[N,L]=(0,i.useState)("idle"),[C,V]=(0,i.useState)(null),[P,R]=(0,i.useState)(null),[k,Z]=(0,i.useState)({w:0,h:0}),[$,X]=(0,i.useState)({hint:null,locking:!1,card:null,manualShutter:!1}),[H,q]=(0,i.useState)({}),[Y,gt]=(0,i.useState)(null),[Te,wt]=(0,i.useState)(null),[Me,Le]=(0,i.useState)(0),[pe,Pe]=(0,i.useState)(null),[me,Ct]=(0,i.useState)(null),[ve,_t]=(0,i.useState)(0),J=(0,i.useRef)(0);J.current=ve;let[bt,He]=(0,i.useState)(0),Ie=(0,i.useRef)(0),ee=(0,i.useRef)(null);(0,i.useEffect)(()=>{He(J.current)},[e.reason,e.attemptsRemaining]);let U=e.documentType==="passport",te=U?1.42:1.586;We(!0),(0,i.useLayoutEffect)(()=>{let s=g.current;if(s===null)return;let v=l(()=>Z({w:s.clientWidth,h:s.clientHeight}),"measure");if(v(),typeof ResizeObserver>"u")return;let m=new ResizeObserver(v);return m.observe(s),()=>m.disconnect()},[]);let d=ze(k.w,k.h,te);(0,i.useEffect)(()=>{k.w===0||k.h===0||z.current?.setGuide?.({viewAspect:k.w/k.h,rect:{x:d.x/k.w,y:d.y/k.h,width:d.w/k.w,height:d.h/k.h}})},[k.w,k.h,d.x,d.y,d.w,d.h]),(0,i.useEffect)(()=>{let s=x.current;if(s===null)return;let v=e.capture({video:s,...a!==void 0?{liveMrz:a}:{},...r!==void 0?{barcodeAssetBaseUrl:r}:{}});z.current=v;let m=g.current;if(m!==null&&m.clientWidth>0&&m.clientHeight>0){let p=ze(m.clientWidth,m.clientHeight,te);v.setGuide?.({viewAspect:m.clientWidth/m.clientHeight,rect:{x:p.x/m.clientWidth,y:p.y/m.clientHeight,width:p.w/m.clientWidth,height:p.h/m.clientHeight}})}let I=new Wt,_={scan:null,feedback:null,gate:null,mrz:null},A=l(p=>{_={..._,...p};let b=_.gate?.guide,Ht={phase:_.scan?.phase??"framing",hint:_.feedback?.reticle==="coaching"?_.feedback.key:e.documentType==="drivers_license"?null:it(_.mrz),card:b?.detected?{fill:b.fill,offsetX:b.offsetX,offsetY:b.offsetY}:null,manualShutter:_.scan?.manualShutter??!1},K=I.present(Ht,performance.now());X(j=>j.hint===K.hint&&j.locking===K.locking&&j.manualShutter===K.manualShutter&&kt(j.card,K.card)?j:K)},"present"),Pt=[v.on("state",L),v.on("feedback",p=>A({feedback:p})),v.on("gate",p=>A({gate:p})),v.on("scan",p=>{p.captured.length===0&&Ie.current>0&&He(J.current),Ie.current=p.captured.length,ee.current=(ee.current??p.captured).filter(b=>p.captured.includes(b)),V(p),A({scan:p})}),v.on("captured",p=>{_t(b=>b+1),q(b=>({...b,[vt(p.side,U,b)]:p.previewDataUrl})),gt(p.previewDataUrl),wt(ft(s))}),v.on("error",p=>{R(p);let b=f.current;b!==null&&Ze(b,Qe("document",p,Math.max(0,u.current)))}),v.on("mrz",p=>{p.state==="mismatch"?Ct({format:p.format??null,at:J.current}):(Pe(p),A({mrz:p}))})];return u.current+=1,v.start().catch(()=>{}),()=>{ee.current=null;for(let p of Pt)p();v.destroy(),z.current=null}},[e.issuer,e.documentType]);let T=C?.phase??"framing",M=T==="reading"||T==="result",ne=T==="flipCue"||T==="reaskRecto",B=$.locking,Ae=C?.captured.length??0;(0,i.useEffect)(()=>{B&&Le(s=>s+1)},[B]),(0,i.useEffect)(()=>{Ae>0&&Le(s=>s+1)},[Ae]);let zt=C?.expected??null;(0,i.useEffect)(()=>{Pe(null)},[zt]);let ye=ne||M||e.documentType==="drivers_license"?null:ot(pe,U),Oe=l(s=>t.strings[s]??Kt[t.locale][s],"liveText"),Nt=l(s=>s.startsWith("dcv3.")?Oe(s):h(s),"copy"),ke=ye!==null?Oe(ye):h(T==="flipCue"?"doc.flip":T==="reaskRecto"?"doc.reaskRecto":M?"native.scan.reading":T==="locking"||T==="capturing"||B?"native.scan.holdStill":U?"doc.showPage":"doc.showSide"),ae=e.browserCheck??null,fe=ae!==null&&M,re=ue(e),De=l(s=>({key:h(s),action:se(t,e.attemptsRemaining,e.attemptsExhausted),blocking:e.reason!==void 0&<.has(e.reason)}),"reasonProblem"),Re=st(e.documentType),St=pe?.state==="expired"&&!ne&&!M?{key:h("native.scan.expired"),action:null,blocking:!0}:me!==null&&ve<=me.at+1?{key:h(me.format==="TD3"?"native.scan.seenPassport":"native.scan.seenCard"),action:Re===null?null:h(Re),blocking:!0}:C?.notice==="same_face"?{key:h("doc.sameFace"),action:null,blocking:!1}:C?.notice==="reread"?re!==null?De(re):{key:h("doc.reread"),action:null,blocking:!1}:C?.notice==="technical"?{key:h("native.scan.retry"),action:null,blocking:!1}:C?.notice==="blurry"?{key:h("native.scan.blurry"),action:null,blocking:!1}:re!==null&&ve===bt?De(re):null,xt=$.hint===null?null:Nt(Jt[$.hint]??`dcv2.${$.hint}`),Ue=pt(St,xt,B||T==="capturing"||M),F=$.card,S=d;if(!B&&F!==null&&F.fill>=.45&&F.fill<=1.25&&!en()){let s=d.w*F.fill,v=s/te,m=d.x+d.w/2+d.w*Math.max(-.25,Math.min(.25,F.offsetX)),I=d.y+d.h/2+d.h*Math.max(-.25,Math.min(.25,F.offsetY));S={x:m-s/2,y:I-v/2,w:s,h:v}}let oe=d.w*.045,ge=28,Be=Math.min(oe,ge*.6),$t=[[S.x,S.y,1,1],[S.x+S.w,S.y,-1,1],[S.x,S.y+S.h,1,-1],[S.x+S.w,S.y+S.h,-1,-1]],Tt=B?"is-locked":Ue!==null?"is-coaching":"",Mt=U?[{side:"single",label:"doc.progressPage"}]:[{side:"recto",label:"doc.progressFront"},{side:"verso",label:"doc.progressBack"}],Lt=d.y+d.h+16,we={insetInlineStart:d.x,insetBlockStart:d.y,inlineSize:d.w,blockSize:d.h,borderRadius:oe};return(0,n.jsx)("section",{className:"sekyro-lm","aria-label":ke,"data-testid":"sekyro-document",children:(0,n.jsxs)("div",{ref:g,className:`sekyro-lm-stage${M?" is-reading":""}${ne?" is-flip":""}`,style:{"--sekyro-guide-w":`${d.w}px`},children:[(0,n.jsx)("video",{ref:x,className:"sekyro-lm-video",playsInline:!0,muted:!0,autoPlay:!0,"aria-hidden":"true",onPointerUp:c(s=>{let v=s.currentTarget,m=v.getBoundingClientRect(),I=Math.max(m.width/(v.videoWidth||1),m.height/(v.videoHeight||1)),_=v.videoWidth*I,A=v.videoHeight*I;_>0&&A>0&&z.current?.focusAt((s.clientX-m.left+(_-m.width)/2)/_,(s.clientY-m.top+(A-m.height)/2)/A)},"onPointerUp")}),k.w>0?(0,n.jsxs)(n.Fragment,{children:[M&&Te!==null?(0,n.jsx)("img",{className:"sekyro-lm-scene",src:Te,alt:""}):null,M&&Y!==null?(0,n.jsx)("img",{className:"sekyro-lm-frozen",src:Y,alt:"",style:we}):null,(0,n.jsxs)("svg",{className:"sekyro-lm-overlay",viewBox:`0 0 ${k.w} ${k.h}`,"aria-hidden":"true",focusable:"false",children:[(0,n.jsxs)("defs",{children:[(0,n.jsxs)("linearGradient",{id:"sekyro-lm-top",x1:"0",y1:"0",x2:"0",y2:"1",children:[(0,n.jsx)("stop",{offset:"0",className:"sekyro-lm-ink",stopOpacity:"0.85"}),(0,n.jsx)("stop",{offset:"1",className:"sekyro-lm-ink",stopOpacity:"0"})]}),(0,n.jsxs)("linearGradient",{id:"sekyro-lm-bottom",x1:"0",y1:"0",x2:"0",y2:"1",children:[(0,n.jsx)("stop",{offset:"0",className:"sekyro-lm-ink",stopOpacity:"0"}),(0,n.jsx)("stop",{offset:"1",className:"sekyro-lm-ink",stopOpacity:"0.9"})]})]}),(0,n.jsx)("path",{className:"sekyro-lm-scrim",fillRule:"evenodd",d:`M0 0H${k.w}V${k.h}H0Z${yt(d,oe)}`}),(0,n.jsx)("rect",{width:k.w,height:Math.max(0,d.y),fill:"url(#sekyro-lm-top)"}),(0,n.jsx)("rect",{y:d.y+d.h,width:k.w,height:Math.max(0,k.h-d.y-d.h),fill:"url(#sekyro-lm-bottom)"}),(0,n.jsx)("g",{className:`sekyro-lm-brackets ${Tt}`,children:$t.map(([s,v,m,I],_)=>(0,n.jsx)("path",{style:{transform:`translate(${s}px, ${v}px) scale(${m}, ${I})`},d:`M0 ${ge}V${Be}Q0 0 ${Be} 0H${ge}`},_))}),B?(0,n.jsx)("rect",{className:"sekyro-lm-trace",x:d.x,y:d.y,width:d.w,height:d.h,rx:oe,pathLength:"1",style:{animationDuration:`${Yt}ms`}}):null]}),(0,n.jsx)("div",{className:"sekyro-lm-slot",style:we,"aria-hidden":"true",children:M?(0,n.jsx)("span",{className:"sekyro-lm-read is-repeating"}):Me>0?(0,n.jsx)("span",{className:"sekyro-lm-read"},Me):null})]}):null,ye!==null?(0,n.jsx)("div",{className:"sekyro-lm-slot",style:we,"aria-hidden":"true",children:(0,n.jsx)("span",{"data-testid":"sekyro-mrz-strip",className:`sekyro-lm-mrz${U?" is-page":""}${pe?.state==="valid"?" is-valid":""}`})}):null,(0,n.jsx)("div",{className:"sekyro-lm-instruction",style:{insetBlockStart:d.y-64},children:(0,n.jsx)("div",{role:"status","aria-live":"polite","data-testid":"sekyro-scan-instruction",children:fe?null:(0,n.jsx)(Ke,{swapKey:ke,className:"sekyro-lm-line",children:ke})})}),(0,n.jsxs)("div",{className:"sekyro-lm-below",style:{insetBlockStart:Lt,inlineSize:d.w,insetInlineStart:d.x},children:[(0,n.jsx)(mt,{band:Ue}),fe?null:M?(0,n.jsxs)("p",{className:"sekyro-lm-note",children:[(0,n.jsx)("span",{className:"sekyro-lm-spinner","aria-hidden":"true"}),h("native.scan.putDown")]}):ne?(0,n.jsx)("div",{className:`sekyro-lm-flip${T==="reaskRecto"?" is-toFront":""}`,"data-testid":"sekyro-flip-cue","aria-hidden":"true",children:(0,n.jsxs)("span",{className:"sekyro-lm-flip-card",style:{aspectRatio:String(te)},children:[(0,n.jsx)("span",{className:"sekyro-lm-flip-front"}),(0,n.jsx)("span",{className:"sekyro-lm-flip-back"})]})}):null]}),(0,n.jsxs)("div",{className:"sekyro-lm-controls",children:[(0,n.jsxs)("div",{className:"sekyro-lm-bar",children:[(0,n.jsx)("button",{type:"button",className:"sekyro-glass","aria-label":t.t("native.close"),onClick:o,children:(0,n.jsx)(D,{name:"close"})}),C?.torchAvailable?(0,n.jsx)("button",{type:"button",className:`sekyro-glass${C.torch?" is-on":""}`,"aria-label":t.t("doc.torchOn"),"aria-pressed":C.torch,onClick:c(()=>z.current?.setTorch(!C.torch),"onClick"),children:(0,n.jsx)(Q,{name:"flashlight"})}):null]}),P!==null?(0,n.jsxs)("div",{className:"sekyro-lm-error",role:"alert",children:[(0,n.jsx)("p",{children:t.t("doc.cameraBlocked")}),(0,n.jsx)("p",{children:t.t(P.kind==="permission"?"doc.cameraBlockedHint":Fe(P.kind))}),(0,n.jsx)(O,{onClick:c(()=>{R(null),u.current+=1,z.current?.retry()},"onClick"),children:t.t("doc.retryCamera")})]}):null,ae!==null&&P===null?(0,n.jsxs)("div",{className:"sekyro-lm-error",role:"alert","data-testid":"sekyro-doc-browser-check",children:[(0,n.jsx)("p",{children:t.t(ae.code==="clock_wrong"?"errors.device_clock":"errors.attestation_invalid")}),(0,n.jsx)(O,{onClick:ae.retry,children:t.t("common.retry")})]}):null,$.manualShutter?(0,n.jsx)("button",{type:"button",className:"sekyro-shutter","aria-label":t.t("doc.shutter"),onClick:c(()=>z.current?.shutter(),"onClick")}):null,(0,n.jsx)("ol",{className:"sekyro-lm-tray",children:Mt.map(({side:s,label:v})=>{let m=C?.captured.includes(s)??!1;return(0,n.jsxs)("li",{className:m?"is-done":void 0,"aria-current":!m&&(U||C?.expected===s)?"step":void 0,children:[m?(0,n.jsxs)("span",{className:"sekyro-lm-thumb",children:[H[s]!==void 0?(0,n.jsx)("img",{src:H[s],alt:""}):(0,n.jsx)(D,{name:"card"}),(0,n.jsx)("svg",{className:"sekyro-lm-check",viewBox:"0 0 18 18","aria-hidden":"true",children:(0,n.jsx)("path",{d:"M5 9.2l2.6 2.6L13 6.4"})})]}):null,h(v),m&&H[s]===void 0&&ee.current?.includes(s)?(0,n.jsx)("span",{className:"sekyro-lm-received",children:h("doc.sideReceived")}):null]},s)})}),w!==void 0?(0,n.jsx)("button",{type:"button",className:"sekyro-lm-upload",onClick:w,children:E(t).t("doc.uploadInstead")}):null,N==="uploading"||N==="checking"?null:(0,n.jsx)(Ye,{onStop:o})]}),!fe&&(N==="uploading"||N==="checking")?(0,n.jsx)("span",{className:"sekyro-visually-hidden",role:"status",children:N==="uploading"?t.t("doc.uploading"):h("native.scan.reading")}):null]})})}c(ht,"Xt");l(ht,"LumiereScan");function pt(e,t,a){let r=(0,i.useRef)(null);r.current??(r.current=new Ft);let[o,u]=(0,i.useState)(null),w=(0,i.useRef)({problem:e,hint:t,busy:a});w.current={problem:e,hint:t,busy:a};let h=e===null?null:`${e.blocking}|${e.key}|${e.action??""}`;return(0,i.useEffect)(()=>{let y=l(()=>{let{problem:g,hint:x,busy:z}=w.current;u(r.current?.present(g,x,z,performance.now())??null)},"run");y();let f=setInterval(y,250);return()=>clearInterval(f)},[h,t,a]),o}c(pt,"Wt");l(pt,"useNoticeBand");function mt({band:e}){let[t,a]=(0,i.useState)(e);(0,i.useEffect)(()=>{e!==null&&a(e)},[e]);let r=e??t;return(0,n.jsx)("div",{className:`sekyro-lm-band${e!==null?" is-open":""}`,"data-testid":"sekyro-scan-notice",children:(0,n.jsx)("div",{role:"status","aria-live":"polite","aria-atomic":"true",children:r!==null?(0,n.jsxs)("div",{className:"sekyro-notice sekyro-notice--warning","data-kind":r.kind,"aria-hidden":e===null||void 0,children:[(0,n.jsx)("span",{className:"sekyro-notice__icon","aria-hidden":"true",children:(0,n.jsx)(D,{name:"warning"})}),(0,n.jsxs)("div",{className:"sekyro-notice__body",children:[(0,n.jsx)("span",{children:r.key}),r.action!==null&&r.action!==""?(0,n.jsx)("span",{children:r.action}):null]})]}):null})})}c(mt,"jt");l(mt,"NoticeBandView");function vt(e,t,a){return t?"single":e==="recto"||e==="verso"?e:a.recto===void 0?"recto":"verso"}c(vt,"Qt");l(vt,"slotOf");function yt({x:e,y:t,w:a,h:r},o){return`M${e+o} ${t}H${e+a-o}Q${e+a} ${t} ${e+a} ${t+o}V${t+r-o}Q${e+a} ${t+r} ${e+a-o} ${t+r}H${e+o}Q${e} ${t+r} ${e} ${t+r-o}V${t+o}Q${e} ${t} ${e+o} ${t}Z`}c(yt,"Zt");l(yt,"roundedRect");var be=.004;function kt(e,t){return e===null||t===null?e===t:Math.abs(e.fill-t.fill)<be&&Math.abs(e.offsetX-t.offsetX)<be&&Math.abs(e.offsetY-t.offsetY)<be}c(kt,"Jt");l(kt,"sameCard");function ft(e){let t=Math.round(e.videoWidth/4),a=Math.round(e.videoHeight/4);if(t===0||a===0||typeof document>"u")return null;try{let r=document.createElement("canvas");r.width=t,r.height=a;let o=r.getContext("2d");return o===null?null:(o.drawImage(e,0,0,t,a),r.toDataURL("image/jpeg",.7))}catch{return null}}c(ft,"qt");l(ft,"sceneSnapshot");export{qt as DocumentCaptureView,Yt as LOCK_TRACE_MS,Qt as UPLOAD_ACCEPT,ze as guideRect,rt as introCopy,it as mrzHint,ot as mrzInstruction,kt as sameCard,st as showInsteadKey,vt as slotOf};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{a as z,b as v,c as O}from"./chunk-YVQ6LFN4.js";import{a as W,b as J,c as K}from"./chunk-
|
|
1
|
+
"use client";import{a as z,b as v,c as O}from"./chunk-YVQ6LFN4.js";import{a as W,b as J,c as K}from"./chunk-K67DQTFL.js";import{a as q}from"./chunk-BWOTZKA7.js";import{a as w}from"./chunk-MXMEO2IW.js";import{f as T,g as A}from"./chunk-RH466MDF.js";import"./chunk-FQHV53QQ.js";import{I as j,L as E,a as oe,b as ce,c as N,t as U,y as R}from"./chunk-BMTTAXWY.js";import"./chunk-PZVVXMQ6.js";import"./chunk-32CNXSJQ.js";import"./chunk-U7QPOSFH.js";import"./chunk-P7K7ELYZ.js";import{a as o}from"./chunk-5QL6W6FW.js";import"./chunk-6MYG4HWP.js";import"./chunk-JS2IXPNL.js";import"./chunk-SLLJX5QK.js";import{a as m,c as P}from"./chunk-4FHWXBOB.js";var a=P(oe(),1),i=P(ce(),1);var Q={en:v,fr:O,ar:z,es:v,pt:v,de:v},C=6,pe=new Set(["eid_identifier_invalid","eid_code_invalid","eid_locked","eid_not_enrolled"]),X=o((e,d)=>{if(e===void 0)return 0;let h=Date.parse(e)-d;return Number.isFinite(h)?Math.max(0,Math.ceil(h/1e3)):0},"secondsUntil"),ue=o(e=>`${Math.floor(e/60)}:${String(e%60).padStart(2,"0")}`,"mmss");function me({step:e,i18n:d,className:h,onError:Y}){let I=d.strings,r=o((n,t)=>w(I[n]??Q[d.locale][n]??"",t),"t"),B=o((n,t)=>{let le=new Intl.PluralRules(d.locale).select(t),L=`${n}.${le}`,te=I[L]??Q[d.locale][L]??r(`${n}.other`);return w(te,{count:new Intl.NumberFormat(d.locale).format(t)})},"plural"),y=o(n=>e.providerName?r(`eid.${n}`,{provider:e.providerName}):r(`eid.${n}Generic`),"named"),[S,Z]=(0,a.useState)(""),[f,_]=(0,a.useState)(""),[c,D]=(0,a.useState)(!1),[b,p]=(0,a.useState)(null),s=e.phase==="code",F=K(s),l=(0,a.useId)(),ee=U(),[ie,ne]=W(e.reason==="eid_code_invalid",e.codeAttemptsRemaining??0,()=>_("")),u=o(async n=>{D(!0),p(null);try{await n()}catch(t){p(q(t,d.strings)),Y?.(t)}finally{D(!1)}},"run"),M=(0,a.useRef)(!1);(0,a.useEffect)(()=>{!e.identifierBound||s||e.reason!==void 0||M.current||(M.current=!0,u(()=>e.start()))},[e.identifierBound,s,e.reason]),(0,a.useEffect)(()=>{(e.reason==="eid_code_invalid"||e.codeExpiresAt!==void 0)&&_("")},[e.reason,e.codeExpiresAt,e.codeAttemptsRemaining]);let H=(0,a.useRef)(s);(0,a.useEffect)(()=>{s&&!H.current&&document.getElementById(`${l}-code`)?.focus(),H.current=s},[s,l]);let k=e.reason==="eid_locked",V=X(e.codeExpiresAt,F),x=s&&e.codeExpiresAt!==void 0&&V===0,$=X(e.resendAvailableAt,F),G=e.resendsRemaining===0||e.reason==="eid_resend_limit",re=o(n=>{if(n.preventDefault(),s){f.length===C&&!k&&u(()=>e.verify(f));return}if(e.identifierBound){u(()=>e.start());return}let t=A(S);if(e.country==="MR"){if(!/^\d{10}$/.test(t))return p("population.invalid");if(!T(t))return p("population.reason_nni_invalid")}u(()=>e.start(t))},"onSubmit"),g=e.reason?.startsWith("eid_")?e.reason:void 0,ae=(0,i.jsxs)(i.Fragment,{children:[g!==void 0?(0,i.jsxs)(E,{tone:pe.has(g)?"danger":"warning",children:[(0,i.jsx)("span",{children:r(`reasons.${g}`)}),g==="eid_code_invalid"&&e.codeAttemptsRemaining!==void 0?(0,i.jsx)("span",{children:B("eid.codeAttemptsRemaining",e.codeAttemptsRemaining)}):null,e.canUseCamera?(0,i.jsx)(N,{kind:"secondary",disabled:c,onClick:m(()=>{u(()=>e.useCamera())},"onClick"),children:r("eid.useCamera")}):null]}):null,b!==null?(0,i.jsx)(E,{tone:"danger",children:(0,i.jsx)("span",{children:d.t(b)})}):null]}),[de,se]=s?[y("codeTitle"),y("codeHelp")]:[y("identifierTitle"),y(e.identifierBound?"boundDescription":"identifierDescription")];return(0,i.jsxs)("form",{className:`sekyro-step sekyro-otp${h?` ${h}`:""}`,"aria-labelledby":l,onSubmit:re,noValidate:!0,"data-testid":"sekyro-eid",children:[(0,i.jsxs)("div",{className:"sekyro-heading",children:[(0,i.jsx)("h2",{id:l,ref:ee,tabIndex:-1,className:"sekyro-text-body",children:de}),(0,i.jsx)("p",{className:"sekyro-text-muted",children:s&&e.context.simulation!==void 0?(0,i.jsx)(j,{template:d.t("sandbox.otpHint"),code:e.context.simulation.otpCode}):se}),e.afterPass==="continue"?(0,i.jsx)("p",{className:"sekyro-text-muted","data-testid":"sekyro-eid-continue",children:e.providerName?r("eid.continueHint",{provider:e.providerName}):r("eid.continueHintGeneric")}):null]}),ae,s?(0,i.jsxs)(i.Fragment,{children:[(0,i.jsxs)("div",{className:"sekyro-field",children:[(0,i.jsx)("label",{className:"sekyro-label",htmlFor:`${l}-code`,children:r("eid.codeLabel")}),k?(0,i.jsx)("input",{id:`${l}-code`,className:"sekyro-input sekyro-input--number",dir:"ltr",value:f,disabled:!0,readOnly:!0}):(0,i.jsx)(J,{id:`${l}-code`,value:f,length:C,invalid:ie,onChange:m(n=>{p(null),n!==""&&ne(),_(n)},"onChange")}),e.codeExpiresAt!==void 0?(0,i.jsx)("span",{className:`sekyro-help sekyro-otp-expiry${x?" is-danger":""}`,children:x?r("eid.expired"):r("eid.expiresIn",{time:ue(V)})}):null]}),(0,i.jsx)("span",{className:"sekyro-visually-hidden",role:"status","aria-live":"polite",children:x?r("eid.expired"):""}),(0,i.jsxs)(R,{children:[(0,i.jsx)(N,{type:"submit",full:!0,disabled:c||f.length!==C||k,"aria-busy":c||void 0,children:r("eid.verify")}),(0,i.jsx)("div",{className:"sekyro-resend-row",children:G?(0,i.jsx)("p",{className:"sekyro-resend is-waiting",children:r("eid.noResendsLeft")}):(0,i.jsx)("button",{type:"button",className:"sekyro-link sekyro-resend",disabled:c||$>0||k,onClick:m(()=>{u(()=>e.resend())},"onClick"),children:$>0?r("eid.resendIn",{seconds:$}):r("eid.resend")})}),!G&&e.resendsRemaining!==void 0?(0,i.jsx)("p",{className:"sekyro-help sekyro-center",children:B("eid.resendsRemaining",e.resendsRemaining)}):null]})]}):(0,i.jsxs)(i.Fragment,{children:[e.identifierBound?null:(0,i.jsxs)("div",{className:"sekyro-field",children:[(0,i.jsx)("label",{className:"sekyro-label",htmlFor:`${l}-nni`,children:d.t("population.label")}),(0,i.jsx)("input",{id:`${l}-nni`,className:"sekyro-input sekyro-input--number",dir:"ltr",inputMode:"numeric",autoComplete:"off",placeholder:d.t("population.placeholder"),value:S,"aria-describedby":`${l}-nni-help`,"aria-invalid":b==="population.invalid"||b==="population.reason_nni_invalid"||void 0,onChange:m(n=>{p(null),Z(A(n.target.value).replace(/\D/g,"").slice(0,10))},"onChange")}),(0,i.jsx)("span",{id:`${l}-nni-help`,className:"sekyro-help",children:d.t("population.helper")})]}),(0,i.jsx)(R,{children:(0,i.jsx)(N,{type:"submit",full:!0,disabled:c,"aria-busy":c||void 0,children:r("eid.start")})})]})]})}m(me,"Ae");o(me,"EidView");export{me as EidView};
|