@sekyro/elements 0.1.0-rc.24 → 0.1.0-rc.25

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.
Files changed (92) hide show
  1. package/CHANGELOG.md +9 -0
  2. package/dist/cdn/chunks/{capture-session-doc-BGLEMR2J-LN5RQDCK.js → capture-session-doc-56O6IQ3D-FTWOAELH.js} +1 -1
  3. package/dist/cdn/chunks/challenge-frame-LWDSKM5K-J3CNO3XT.js +1 -0
  4. package/dist/cdn/chunks/{chunk-MXKAKHUA.js → chunk-23W5VB46.js} +1 -1
  5. package/dist/cdn/chunks/{chunk-YFZ54VRE.js → chunk-34QKBDWM.js} +1 -1
  6. package/dist/cdn/chunks/{chunk-VHJIEZ5D.js → chunk-43I6I3SU.js} +1 -1
  7. package/dist/cdn/chunks/{chunk-SGAGSEY4.js → chunk-4EWD6VW3.js} +1 -1
  8. package/dist/cdn/chunks/{chunk-ICGDGBER.js → chunk-4VFGV3VA.js} +1 -1
  9. package/dist/cdn/chunks/{chunk-IX5EXDOC.js → chunk-53PI7QVO.js} +1 -1
  10. package/dist/cdn/chunks/chunk-5ZUDZLHN.js +1 -0
  11. package/dist/cdn/chunks/chunk-AXCBMN2S.js +33 -0
  12. package/dist/cdn/chunks/{chunk-SX373VNU.js → chunk-B5QW2GSC.js} +1 -1
  13. package/dist/cdn/chunks/{chunk-X7U4LD32.js → chunk-E7S6A26U.js} +1 -1
  14. package/dist/cdn/chunks/chunk-IHKI3APK.js +25 -0
  15. package/dist/cdn/chunks/{chunk-CCPSNJ26.js → chunk-PNQ5TDY5.js} +1 -1
  16. package/dist/cdn/chunks/{chunk-BE4SRRNK.js → chunk-PPERVFSD.js} +1 -1
  17. package/dist/cdn/chunks/{chunk-UJ2FDGWQ.js → chunk-SS7SVE6O.js} +1 -1
  18. package/dist/cdn/chunks/{chunk-L2FCXJYM.js → chunk-UALTP6H4.js} +1 -1
  19. package/dist/cdn/chunks/chunk-VD2BADU2.js +1 -0
  20. package/dist/cdn/chunks/chunk-VQSFTT4B.js +3 -0
  21. package/dist/cdn/chunks/{chunk-H4EO527J.js → chunk-W5QMFEZY.js} +1 -1
  22. package/dist/cdn/chunks/chunk-XYXBZEKH.js +1 -0
  23. package/dist/cdn/chunks/{chunk-TD2XP34G.js → chunk-YR7GTH7M.js} +1 -1
  24. package/dist/cdn/chunks/{chunk-6JA64VAB.js → chunk-YWAPDHEW.js} +1 -1
  25. package/dist/cdn/chunks/{create-document-capture-KATGPNCR-KPF7ZYWX.js → create-document-capture-TTMHZP7R-YI3GL7MF.js} +1 -1
  26. package/dist/cdn/chunks/{document-capture-view-PTB5A72I-LW2M5LK2.js → document-capture-view-5EYETVEI-UMC6FOKY.js} +1 -1
  27. package/dist/cdn/chunks/{eid-view-B2M6AJ3J-ASEHPZBH.js → eid-view-INQTMVDU-FRHHODOC.js} +1 -1
  28. package/dist/cdn/chunks/{email-otp-view-FLSDWKJU-TQOH44CO.js → email-otp-view-OO535PQT-6N2IPXEG.js} +1 -1
  29. package/dist/cdn/chunks/flow-views-EW2KEEFU-7LTB52QC.js +1 -0
  30. package/dist/cdn/chunks/{form-view-26PNMO6Q-DNIJNLLU.js → form-view-LJLYP54G-N2BB5ZXR.js} +1 -1
  31. package/dist/cdn/chunks/overlay-de-VGC75M5R-ZUC7ZPRY.js +1 -0
  32. package/dist/cdn/chunks/overlay-es-CSXBWVAG-IQMHKRYH.js +1 -0
  33. package/dist/cdn/chunks/overlay-pt-RGTYSSOJ-EH2IJ6QI.js +1 -0
  34. package/dist/cdn/chunks/plan-runner-FW3EAJCC-H4N5NEL4.js +1 -0
  35. package/dist/cdn/chunks/{portrait-capture-view-IFT7B4OG-EYDBLNTC.js → portrait-capture-view-N36CKIFR-JIO6P6XN.js} +1 -1
  36. package/dist/cdn/chunks/{portrait-review-view-BISWT5BQ-YJ6TLEKW.js → portrait-review-view-OG23OEMA-E4JD5Q5S.js} +1 -1
  37. package/dist/cdn/chunks/{proof-of-address-view-UXF6OH5N-6HTCJNXW.js → proof-of-address-view-CHM5JRHI-PUHZCNXH.js} +1 -1
  38. package/dist/cdn/define.js +1 -1
  39. package/dist/cdn/index.js +1 -1
  40. package/dist/{chunk-VK6DRWZL.js → chunk-2PJRIGH2.js} +1 -1
  41. package/dist/{chunk-L5QAOX6C.js → chunk-2QEYDBI7.js} +1 -1
  42. package/dist/{chunk-DEVOHXNC.js → chunk-FFRJKCZK.js} +1 -1
  43. package/dist/chunk-GDADEN5C.js +33 -0
  44. package/dist/{chunk-73G4CDPH.js → chunk-JAEOFYLJ.js} +1 -1
  45. package/dist/chunk-JW4QXADM.js +25 -0
  46. package/dist/{chunk-VWAWL2QM.js → chunk-KEN7JBVG.js} +1 -1
  47. package/dist/{chunk-YD6JLLO5.js → chunk-MLH4M6JP.js} +1 -1
  48. package/dist/chunk-NMUB5C2E.js +1 -0
  49. package/dist/{chunk-R7M4HNG5.js → chunk-OEZKZQC4.js} +1 -1
  50. package/dist/{chunk-W6RHH3ZZ.js → chunk-RAF7Z7I3.js} +1 -1
  51. package/dist/{chunk-TPO4FOFT.js → chunk-RJVZHRDP.js} +1 -1
  52. package/dist/{chunk-QLIY4W2U.js → chunk-RXILZ6JM.js} +1 -1
  53. package/dist/{chunk-2N6CQWVG.js → chunk-SD4A47RM.js} +1 -1
  54. package/dist/define.cjs +5 -5
  55. package/dist/define.js +1 -1
  56. package/dist/{document-capture-view-PTB5A72I-J2XPPS5A.js → document-capture-view-5EYETVEI-ZQ5RAN4Y.js} +1 -1
  57. package/dist/{eid-view-B2M6AJ3J-ASHVXRTP.js → eid-view-INQTMVDU-H7KHUN3L.js} +1 -1
  58. package/dist/{email-otp-view-FLSDWKJU-3KB6CCWB.js → email-otp-view-OO535PQT-6EYUU43N.js} +1 -1
  59. package/dist/flow-views-EW2KEEFU-H7LOLIEJ.js +1 -0
  60. package/dist/{form-view-26PNMO6Q-6W54V6CN.js → form-view-LJLYP54G-OUW66I62.js} +1 -1
  61. package/dist/index.cjs +5 -5
  62. package/dist/index.d.cts +6 -2
  63. package/dist/index.d.ts +6 -2
  64. package/dist/index.js +1 -1
  65. package/dist/overlay-de-VGC75M5R-C6XYWRT5.js +1 -0
  66. package/dist/overlay-es-CSXBWVAG-MSMVW5KX.js +1 -0
  67. package/dist/overlay-pt-RGTYSSOJ-QA5FJP3U.js +1 -0
  68. package/dist/{portrait-capture-view-IFT7B4OG-RA2APHRL.js → portrait-capture-view-N36CKIFR-S2H37PI5.js} +1 -1
  69. package/dist/{portrait-review-view-BISWT5BQ-HV4F6WC7.js → portrait-review-view-OG23OEMA-MO3FN432.js} +1 -1
  70. package/dist/{proof-of-address-view-UXF6OH5N-4HTOLYIT.js → proof-of-address-view-CHM5JRHI-U6ARAGX7.js} +1 -1
  71. package/dist/styles.css +14 -0
  72. package/package.json +2 -2
  73. package/sbom.cdx.json +4 -4
  74. package/dist/cdn/chunks/challenge-frame-3JHCNDHE-IYU6HGYD.js +0 -1
  75. package/dist/cdn/chunks/chunk-75QP4SUF.js +0 -1
  76. package/dist/cdn/chunks/chunk-EAHT3Y3Z.js +0 -1
  77. package/dist/cdn/chunks/chunk-HBIVE2ZZ.js +0 -33
  78. package/dist/cdn/chunks/chunk-HPTAAPIB.js +0 -1
  79. package/dist/cdn/chunks/chunk-QVU5SNFG.js +0 -25
  80. package/dist/cdn/chunks/chunk-XXYPLLFI.js +0 -3
  81. package/dist/cdn/chunks/flow-views-UZRN6BIU-HPYJIEOF.js +0 -1
  82. package/dist/cdn/chunks/overlay-de-TP7ROFVF-5EEFWZ4E.js +0 -1
  83. package/dist/cdn/chunks/overlay-es-LLTS3D6J-U2DPYDC2.js +0 -1
  84. package/dist/cdn/chunks/overlay-pt-UUJUOJNJ-E57Q5MWT.js +0 -1
  85. package/dist/cdn/chunks/plan-runner-XGT4VKVF-NDQH73OS.js +0 -1
  86. package/dist/chunk-CO3QPDWV.js +0 -25
  87. package/dist/chunk-NEP66INV.js +0 -33
  88. package/dist/chunk-S5CM7A4T.js +0 -1
  89. package/dist/flow-views-UZRN6BIU-SEDEA5AH.js +0 -1
  90. package/dist/overlay-de-TP7ROFVF-5EB3LXPD.js +0 -1
  91. package/dist/overlay-es-LLTS3D6J-4M7PVHUX.js +0 -1
  92. package/dist/overlay-pt-UUJUOJNJ-LDRAURGT.js +0 -1
@@ -0,0 +1,3 @@
1
+ import{A as ot,B as st,C as lt,H as ve,I as oe,J as ut,K as ct,L as dt,a as G,b as We,c as Je,f as Ye,g as Qe,h as Xe,i as et,j as he,k as tt,m as K,o as N,p as L,q as J,r as ae,s as D,t as ye,v as nt,w as rt,x as it,y as at}from"./chunk-XYXBZEKH.js";import{g as ft}from"./chunk-B5QW2GSC.js";import{b as Ze}from"./chunk-43I6I3SU.js";import{b as ze,c as me,e as pt}from"./chunk-6MYG4HWP.js";import{a as t}from"./chunk-4FHWXBOB.js";function Vt(n){let a=n.now??(()=>Date.now()),f=n.setTimer??((w,u)=>setTimeout(w,u)),p=n.clearTimer??(w=>clearTimeout(w)),A=null,M=!1,g=!1,x=!1,B=0,P=null,C=t(()=>{P!==null&&p(P),P=null},"_"),T=t(()=>{let w=n.armRamp;w===void 0||M||g||x||a()<B||(M=!0,w().catch(()=>{}).then(u=>{if(M=!1,!x){if(u===void 0){B=a()+2e3;return}if(u.challenge===void 0){g=!0;return}A={challenge:u.challenge,expiresAt:u.expiresAt},C(),P=f(()=>{P=null,!x&&A!==null&&n.waiting()&&T()},Math.max(1e3,u.expiresAt-a()-2e4))}}))},"x");return{arm(){A!==null&&A.expiresAt-a()>2e4||T()},take(){let w=A;return A=null,C(),w!==null&&w.expiresAt-a()>=12e3?w.challenge:void 0},stop(){x=!0,A=null,C()}}}t(Vt,"Rt");function $t(n){return n.idNumberBound??n.nniBound}t($t,"he");function mt(n){return n===void 0?void 0:n.idNumberFromDocument??n.nniFromDocument}t(mt,"re");var yt="https://api.sekyro.ai",Ht=5e3,zt=24e4,vt=3e4,Zt=15e4,gt=9e4;function ht(n,a){return n==="portrait_icao"||n==="poa"||n==="doc_ocr"&&a.source==="upload"?gt:vt}t(ht,"Pt");var Wt=25*6e4,Jt=30*6e4,Nn=20*6e4,Yt=1,Qt=3e3,Xt=1500,en=10;function ge(n){return n instanceof Error&&n.name==="ChallengeError"&&n.code||"challenge_failed"}t(ge,"Ae");var _e=new Set(["aborted","embedder_opaque","site_key_rejected","clock_wrong"]);function tn(n){return new Promise(a=>setTimeout(a,n))}t(tn,"Rn");function nn(){let n=globalThis.crypto;if(n!==void 0&&typeof n.randomUUID=="function")return n.randomUUID();let a=new Uint8Array(16);if(n!==void 0&&typeof n.getRandomValues=="function")n.getRandomValues(a);else for(let p=0;p<16;p+=1)a[p]=Math.floor(Math.random()*256);a[6]=(a[6]??0)&15|64,a[8]=(a[8]??0)&63|128;let f=[...a].map(p=>p.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(nn,"xn");function rn(n){return an(n,{})}t(rn,"jo");function an(n,a){let f=n.apiOrigin??yt,p=n.autoRetry??!0,A=n.rearm??"auto",M=a.client??new Je({apiOrigin:f,sessionToken:n.clientToken,fetch:n.fetch,locale:n.locale}),g=new Proxy(M,{get(e,r){if(r==="submitCheck")return Rt;let i=Reflect.get(e,r,e);return typeof i=="function"?i.bind(e):i}}),x=a.sleep??tn,B=a.uuid??nn,P=a.getChallengeToken??((e,r)=>import("./challenge-frame-LWDSKM5K-J3CNO3XT.js").then(i=>i.executeChallenge({frameUrl:e.url,siteKey:e.siteKey,action:"liveness",subject:r.subject,signal:r.signal,...n.locale!==void 0?{locale:n.locale}:{},...r.onInteractive!==void 0?{onInteractive:r.onInteractive}:{},...r.onRuns!==void 0?{onRuns:r.onRuns}:{}}))),C=pt(),T=null,w=null,u=!1,Ae=new AbortController,h=null,Y=null,Q=null,X=t(()=>Q??ut(h),"ae"),ee=t(()=>ct(oe(h),X()),"ue"),I=t(e=>{h=e,N(e)||It(e),C.emit("view",e),T?.onView(e)},"T"),b=t(()=>h!==null?Promise.resolve(h):(Y??(Y=g.getSession().then(e=>(I(e),e)).finally(()=>{Y=null})),Y),"M"),O=t(async()=>{let e=await g.getSession();return I(e),e},"V"),se=t(async(e,r)=>{e.plan!==void 0?I(e):await O()},"ge"),te=null,Me=t(async e=>{let r=await b();if(e||!r.consentRecorded){let i=await g.recordConsent(n.locale);i.plan!==void 0?I(i):h!==null&&I({...h,consentRecorded:!0})}z()&&re(r)},"Te"),E=t(e=>e?.force===!0?Me(!0):(te??(te=Me(!1).finally(()=>{te=null})),te),"L"),le={client:g,ensureConsent:t(e=>E(e),"ensureConsent"),sleep:x,uuid:B,...a.random!==void 0?{random:a.random}:{},onBusy:t(e=>{u||C.emit("busy",e)},"onBusy")},Ce=!1,Se=null,ue=t(e=>{if(e.status==="verified"||e.status==="not_verified"||e.status==="review"){if(Ce)return;Ce=!0}Se=JSON.stringify(e),C.emit("result",e)},"ke"),At=t(e=>{Se!==JSON.stringify(e)&&ue(e)},"$t"),xe=t(async e=>{let r=h;e&&(r=await O().catch(()=>h));let i=r===null?null:K(r);return i!==null&&!u&&C.emit("method",i),i!==null},"Fe"),ce=null,Te=!1,Ie=!1,Oe=t(()=>ot(le,(e,r)=>e.submitCheck("population_registry",{},{idempotencyKey:r})),"Ue"),Re=t(e=>$t(e)===!0||mt(J(e,"population_registry"))===!0,"Be"),Mt=t(async()=>{try{let e=await b();if(N(e)||K(e)!==null||L(e)?.checkType!=="population_registry")return;if(!Re(e)&&mt(J(e,"population_registry"))===void 0&&(e=await O()),!Re(e)){Ie=!0;return}await E(),await se(await Oe(),"population_registry");let r=h===null?void 0:J(h,"population_registry");if(r?.state==="input_required"&&r.reason==="registry_unavailable"&&tt(r)>0){if(await x(Ht),u)return;await se(await Oe(),"population_registry")}}catch(e){if(e instanceof G&&(e.code==="check_not_active"||e.code==="step_not_on_path")){await O().catch(()=>{});return}Te=!0;return}h!==null&&N(h)&&ue(ye(h,{autoRetry:p}))},"Qt"),Ee=t(()=>(ce??(ce=Mt()),ce),"qe"),S=a.now??Date.now,U=null,V,Ct=0,de=t((e,r)=>`${e.url}
2
+ ${e.siteKey}
3
+ ${r}`,"be"),Ne=0,$=0,ne,F=0,H=0,St=0,Pe=t(()=>{u||C.emit("browserCheck",{pending:H>0,...F>0?{interactive:!0}:{}})},"Ke"),pe=t((e,r)=>{Ne+=1;let i=S(),o=!1,s=!1,d=t(m=>{if(o===m)return;o=m,m&&(s=!0);let k=F>0;F=Math.max(0,F+(m?1:-1)),k!==F>0&&Pe()},"S");$+=1;let c=0,v=t(m=>{$+=c===0?Math.max(0,m-1):m,c+=m},"A"),l=P(e,{signal:Ae.signal,subject:r,onInteractive:d,onRuns:v}),y={key:de(e,r),at:i,token:l};return l.then(()=>{y.issuedAt=S(),d(!1),s&&!u&&q({check:"attestation",kind:"generic",engineKind:"interactive_passed",attempt:St++,challengeMs:S()-i,interactive:!0,checks:Math.min(50,$)})},m=>{let k=ge(m);if(y.failed=k,d(!1),u||k==="aborted")return;let{detail:ie,readyMs:Kt}=m;q({check:"attestation",kind:"unavailable",engineKind:k,attempt:Ct++,challengeMs:S()-i,readyMs:Kt,detail:ie,inApp:Ze(),...s?{interactive:!0}:{},checks:Math.min(50,$)})}),l.catch(()=>{}),y},"Ce"),Le=t((e,r)=>e!==null&&e.key===r&&(e.issuedAt===void 0||S()-e.issuedAt<zt),"je"),re=t((e,r={})=>{let i=e?.challenge??null;if(e===null||i===null||u)return;let o=ae(e.sessionId),s=U;(r.replaceFailed===!0&&s?.failed!==void 0&&!_e.has(s.failed)||!Le(s,de(i,o)))&&(U=pe(i,o))},"de"),De=t(e=>{let r=H>0;H=Math.max(0,H+e),r!==H>0&&Pe()},"Ye"),xt=t(async e=>{De(1);let r;try{let i=e.token.then(o=>({token:o}),o=>({error:ge(o)}));for(;;){let o=await Promise.race([i,new Promise(s=>{r=setTimeout(()=>s(void 0),Zt)})]);if(u)return{error:"aborted"};if(!(o===void 0&&F>0))return o}}finally{clearTimeout(r),De(-1)}},"Jt"),je=t(async(e,r,i)=>{let o=de(e,r),s=U;U=null;let d=Le(s,o)&&(s.failed===void 0||_e.has(s.failed))?s:pe(e,r),c=d===s?0:1,v,l=new Promise(y=>{v=setTimeout(()=>y("late"),i)});try{for(;;){let y=await Promise.race([d.token.then(m=>({token:m}),m=>({error:ge(m)})),l]);if(y==="late"){let m=u?void 0:await xt(d);return m===void 0?(!u&&U===null&&(U=d),{error:"timeout"}):("token"in m&&(ne=Math.max(0,Math.round((d.issuedAt??S())-d.at))),m)}if("token"in y)return ne=Math.max(0,Math.round((d.issuedAt??S())-d.at)),y;if(u||_e.has(y.error)||c>=Yt||c>0&&await Promise.race([x(Qt*c),l])==="late")return y;if(u)return{error:"aborted"};c+=1,d=pe(e,r)}}finally{clearTimeout(v)}},"We"),R=null,Tt=t(e=>R===null||S()-R>=e,"zt"),z=t(()=>Tt(Wt),"Z"),Ue=!1,Fe=null,It=t(e=>{let r=e.challenge?.provenMs;R===null&&typeof r=="number"&&r>0&&(R=S()-Math.max(0,Jt-r)),Ue||(Ue=!0,z()&&re(e));let i=L(e),o=i!==void 0&&(i.checkType==="phone_otp"||i.checkType==="email_otp")?`${i.checkType}:${he(e).indexOf(i)}`:null;o!==null&&o!==Fe&&(Fe=o,re(e))},"en"),Ot=t(e=>{let r=e.attestation;return typeof r?.turnstileToken=="string"&&r.turnstileToken.length>0},"tn"),qe=new Map,Ge=t(async e=>{let r=await b(),i=r.challenge;if(i==null||r.simulation!==void 0)return;let o=await je(i,ae(r.sessionId),e);if(!("token"in o))throw at(o.error);return o.token},"Xe"),Rt=t(async(e,r,i={})=>{let o=r;if("attestation"in o)try{let l=await M.submitCheck(e,r,i);return Ot(o)&&(R=S()),l}catch(l){throw l instanceof G&&l.code==="attestation_invalid"&&(R=null),l}let s=(e==="phone_otp"||e==="email_otp")&&o.action!=="verify",d=i.idempotencyKey,c=d!==void 0?qe.get(d):void 0;c===void 0&&(s||z())&&(c=await Ge(ht(e,o)),d!==void 0&&c!==void 0&&qe.set(d,c));let v=t((l,y)=>l!==void 0?{...y,browserCheckToken:l}:y,"A");try{let l=await M.submitCheck(e,r,v(c,i));return c!==void 0&&(R=S()),l}catch(l){if(!(l instanceof G)||l.code!=="attestation_invalid"||(R=null,c!==void 0))throw l;let y=await Ge(ht(e,o)),m=d!==void 0?{...i,idempotencyKey:B()}:i,k=await M.submitCheck(e,r,v(y,m));return y!==void 0&&(R=S()),k}},"nn"),Ke=t(async(e={})=>{if(V=void 0,e.always!==!0&&!z())return{};let r=await b(),i=r.challenge;if(i==null)return{};let o=e.always===!0?gt:vt,s=await je(i,ae(r.sessionId),o);if("token"in s)return{channel:"hosted_web",turnstileToken:s.token};if(V=s.error,r.simulation!==void 0)return{channel:"hosted_web"};throw new it(s.error)},"Je"),Et=t(()=>V,"on"),Nt=t(()=>({checks:Math.min(50,Math.max(Ne,$)),...ne!==void 0?{challengeMs:Math.min(6e5,ne)}:{}}),"rn"),q=t(e=>{if(u)return;let r=g.reportCaptureIssue;if(r===void 0)return;let i=e.formFactor;try{i??(i=ze())}catch{}try{Promise.resolve(r.call(g,{...e,...i!==void 0?{formFactor:i}:{}})).catch(()=>{})}catch{}},"j"),_=null,Z=null,Be=new WeakMap,Ve=Promise.resolve(),W=0,Pt=t(async()=>{let e=await b();for(let r=0;r<en&&!u&&!N(e)&&L(e)===void 0&&he(e).some(i=>i.state==="processing")&&(await x(Xt),!u);r+=1)e=await O();return e},"sn"),Lt=t(async(e,r,i)=>{let{capture:o}=e,s=t(()=>u,"f"),d=t(()=>e.alive&&e.attempt===i,"S"),c=t(l=>{d()&&o.setFlowState(l)},"g"),v=t(l=>{if(!s()&&(l.status==="unavailable"&&l.reasonCode!==void 0&&!Ye(l.reasonCode)&&q({check:"liveness",kind:"unavailable",phase:"upload",engineKind:l.reasonCode,attempt:Math.max(0,e.issues.value)}),ue(l),!!d())){if(l.status==="retry"&&A==="auto"){o.handle.retry();return}o.setFlowState("done")}},"A");if(r.degraded==="NO_RECORDER"){let l=h?.sessionId??(await b().catch(()=>null))?.sessionId??"";v(D(l,"no_recorder"));return}c("uploading");try{if(await Ee(),s())return;let l=await b(),y;if(!N(l)&&K(l)!==null){await xe(!1),v(D(l.sessionId,"method_required"));return}if(!N(l)){if(L(l)?.checkType==="population_registry"){v(D(l.sessionId,Ie?"nni_unbound":Te?"network":"registry_unavailable"));return}if(await E(),s())return;y=h??l;let m=await st({...le,artifacts:r,getAttestation:Ke,attestationError:Et,attestationFacts:Nt,clipKeys:{get:t(()=>Be.get(r)??null,"get"),set:t(k=>{Be.set(r,k)},"set")},getView:t(()=>h??l,"getView"),refreshView:O,applySubmit:se,onPhase:c,isCancelled:s,onKeyframePromoted:t(k=>{w=k},"onKeyframePromoted")});if(s())return;if(m.kind==="unavailable"){m.reason==="attestation"&&(Z={bound:e,artifacts:r});let k=D(l.sessionId,m.reason),ie=m.reason==="attestation"?V:void 0;v(ie!==void 0?{...k,attestationError:ie}:k);return}if(m.kind==="resync"&&await O(),h!==null&&K(h)!==null){await xe(!1),v(D(l.sessionId,"method_required"));return}l=await Pt()}v(ye(l,{autoRetry:p,previous:y}))}catch{if(s())return;v(D(h?.sessionId??"","network"))}},"an"),$e=t((e,r)=>{let i=e.attempt;W>0&&e.alive&&e.capture.setFlowState("uploading"),W+=1,Ve=Ve.then(()=>Lt(e,r,i)).finally(()=>{W-=1,W===0&&T?.onChainIdle()}).catch(()=>{})},"tt"),He=t(e=>{_?.capture.handle.destroy(),_!==null&&(_.alive=!1,_.ramp.stop());let r=Vt({armRamp:typeof g.armRamp=="function"?()=>g.armRamp():void 0,waiting:t(()=>s.alive&&ee()==="self"&&(o.handle.state==="starting"||o.handle.state==="gating"),"waiting")}),i=Promise.resolve(),o=ft(e,T?.captureInternals?.(e)??a.capture,()=>h?.capture?.liveness?.keyframe?.rank===!0,ee,()=>r.take()??h?.capture?.liveness?.screenRamp,{session:t(()=>oe(h),"session"),onModeChange:t(c=>{Q=c},"onModeChange")}),s={capture:o,alive:!0,ramp:r,attempt:0,issues:Xe()};_=s,o.handle.on("error",c=>{q(Qe("liveness",c,s.issues.value))}),o.handle.on("state",c=>{if(s.issues.note(c),c==="starting"){s.attempt+=1,Z?.bound===s&&(Z=null),z()&&re(h,{replaceFailed:!0});let v=h===null?void 0:L(h)?.checkType;i=v==="liveness"||v==="face_match"?E().catch(()=>{}):Promise.resolve()}(c==="starting"||c==="gating")&&ee()==="self"&&i.then(()=>{s.alive&&r.arm()})}),o.handle.on("captured",c=>{Promise.resolve().then(()=>$e(s,c))});let d=o.handle;return{get state(){return d.state},get captureMode(){return d.captureMode},get facingMode(){return d.facingMode},on:t((c,v)=>d.on(c,v),"on"),start:t(async c=>{if(h===null&&await b().catch(()=>{}),!!s.alive)return d.start(c)},"start"),retry:t(()=>{let c=Z;if(c!==null&&c.bound===s&&s.alive){Z=null,$e(s,c.artifacts);return}d.retry()},"retry"),switchCamera:t(()=>d.switchCamera(),"switchCamera"),canSwitchCaptureMode:t(()=>d.canSwitchCaptureMode(),"canSwitchCaptureMode"),setCaptureMode:t(c=>d.setCaptureMode(c),"setCaptureMode"),destroy:t(()=>{s.alive=!1,r.stop(),_===s&&(_=null),d.destroy()},"destroy")}},"nt"),Dt=t(async()=>{if(u)return null;try{let e=await b();return u?null:K(e)}catch{return null}},"un"),jt=t(async()=>{if(u)return"self";try{let e=await b();if(u)return"self";let r=oe(e);return r==="choice"?X()??r:r}catch{return"self"}},"cn"),Ut=t(async()=>{if(u)return!1;try{let e=await b();return u||N(e)||me()?!1:ve(e,L(e))==="phone"||ve(e,J(e,"liveness"))==="phone"}catch{return!1}},"dn"),Ft=t(async()=>{if(u)return!1;try{let e=await b();return!u&&e.returning===!0}catch{return!1}},"ln"),qt=t(async e=>{let r=(await b()).plan?.choice,i=r?.options.find(s=>et[s.service]===e);if(!i)throw new RangeError(`method ${String(e)} is not offered`);let o=await g.choose(r.nodeId,i.id);u||I(o)},"pn"),fe=null,Gt=t(()=>(fe??(fe=import("./plan-runner-FW3EAJCC-H4N5NEL4.js").then(e=>{let r=e.createPlanRunner({runtime:le,currentView:t(()=>h,"currentView"),cameraMode:ee,captureModeSwitch:{pick:X,choose:t(i=>{Q=i},"choose")},ensureView:b,refreshView:O,ensureConsent:t(()=>E(),"ensureConsent"),liveness:He,stopLiveness:t(()=>{_!==null&&(_.alive=!1,_.ramp.stop(),_.capture.handle.destroy(),_=null)},"stopLiveness"),chainBusy:t(()=>W>0,"chainBusy"),destroyed:t(()=>u,"destroyed"),sleep:x,isMobile:me,now:a.now??Date.now,keptFaceKey:t(()=>w,"keptFaceKey"),setView:I,baseCapture:a.capture,emitStep:t(i=>{u||C.emit("step",i)},"emitStep"),emitResult:At,reportCaptureIssue:q,documentInternals:a.document,documentFacts:a.documentFacts,portraitInternals:a.portrait,livePhotoInternals:a.livePhoto,uploadInternals:a.upload,pageCameraInternals:a.pageCamera});return T=r,r})),fe),"fn");return{consent:t(()=>E(),"consent"),startRegistry:Ee,methodChoice:Dt,selectMethod:qt,reportCameraUnavailable:t(async e=>{await E();let r=g.reportCameraUnavailable;if(r===void 0)throw new TypeError("this client cannot report a missing camera");let i=await r.call(g,e).catch(o=>{if(o instanceof G&&o.code==="check_out_of_order")return g.getSession();throw o});u||I(i)},"reportCameraUnavailable"),reportCaptureIssue:q,testerGate:t(async e=>{let r=g.testerGate;if(r===void 0)throw new TypeError("this client cannot run the tester gate");let i=e.clip,o=We(e.clipMime??"");if(i===void 0||!rt.includes(o))throw new TypeError("the capture has no clip");await E();let s=await nt(g,"clip",o,i.size,{engine:e.engine,durationMs:e.clipMs});await g.uploadToSpaces(s.uploadUrl,i,o);let{key:d}=await g.completeMedia(s.key),c=await Ke({always:!0}),v=await r.call(g,{clipKey:d,attestation:c,captureChannel:e.captureChannel,capture:{...lt(e),attestationError:V}}),{bound:l,missReason:y,...m}=v;return u||(m.plan!==void 0?I(m):await O()),l===!0||y===void 0?{bound:l===!0}:{bound:!1,missReason:y}},"testerGate"),mobileRequired:Ut,captureMode:jt,chooseCaptureMode:t(e=>{Q=e},"chooseCaptureMode"),get captureChoice(){return X()},returning:Ft,liveness:He,run:t(async()=>{if(u)throw new Error("verification destroyed");return(await Gt()).run()},"run"),currentStep:t(()=>T?.current()??null,"currentStep"),voiceClips:t(async()=>{if(u)return null;try{let e=await b();return u?null:e.voice??null}catch{return null}},"voiceClips"),on:t((e,r)=>C.on(e,r),"on"),destroy:t(()=>{u=!0,Ae.abort(),T?.destroy(),_!==null&&(_.alive=!1,_.capture.handle.destroy(),_=null),C.clear()},"destroy")}}t(an,"Pn");var _t=["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"],bt=["carte_identite","passport","residence_permit","drivers_license"],on=["carte_identite","passport","residence_permit"];function ke(n,a){let f=n.byIssuer?.[a]??n.default;return bt.filter(p=>f==="*"?on.includes(p):f.includes(p))}t(ke,"En");function kt(n,a=_t){return[...new Set([...a,...Object.keys(n.byIssuer??{})])].filter(f=>ke(n,f).length>0).sort()}t(kt,"Qo");var j={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",remoteOptions:30,remoteFilterAbove:12,remoteOther:120,remoteValue:128};function sn(n,a){let f=be(a);return f===""?[...n]:n.filter(p=>be([p.title,p.label,p.description].filter(Boolean).join(" ")).includes(f))}t(sn,"Jo");function be(n){return n.normalize("NFKD").replace(/[\u0300-\u036f\u064b-\u065f\u0670\u0640]/g,"").toLowerCase().replace(/\s+/g," ").trim()}t(be,"vt");var Pn={remote_choice:j.remoteOther,full_name:j.fullName,occupation:j.occupation,email:j.email,short_text:j.shortText,long_text:j.longText},wt=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"}),Ln=new Map(Object.entries(wt)),Dn=new Map(Object.entries(wt).map(([n,a])=>[a,n]));function ln(n,a){let f=Object.keys(n.names??{});if(f.length===1){let A=n.names?.[f[0]],M=A?.[a]??A?.en;if(M!==void 0&&M!=="")return M}if(f.length>1)return;let p=n.nationalEid?.providerName;return p!==void 0&&p!==""?p:void 0}t(ln,"pr");var jn=10*1024*1024;function Ar(n){if(n==="permission")return"denied";if(n==="notfound"||n==="insecure"||n==="unsupported")return"no_camera"}t(Ar,"Se");var un=/^[A-Z0-9][A-Z0-9 -]{0,39}$/,cn=Object.freeze({normalize:t(n=>n.trim().toUpperCase().replace(/\s+/g," "),"normalize"),check:t(n=>un.test(n),"check"),registrySources:Object.freeze([]),describe:"number must be 1 to 40 letters, digits, spaces or hyphens"}),dn=/^[A-Z0-9]{4,20}$/,we=t(n=>n.trim().toUpperCase().replace(/[\s-]+/g,""),"m"),pn=Object.freeze({normalize:we,check:t(n=>dn.test(we(n)),"check"),registrySources:Object.freeze([]),describe:"number must be 4 to 20 letters or digits"});function fn(n){return typeof n=="string"&&/^\d{10}$/.test(n)&&Number(n)%97===1}t(fn,"Re");var mn={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:we},hn={mr_nni_mod97:t(n=>fn(n),"mr_nni_mod97")};function yn(n){let a=new RegExp(n.pattern,"u"),f=n.check===null?void 0:hn[n.check];return Object.freeze({normalize:mn[n.normalize],check:t(p=>a.test(p.trim())&&(f===void 0||f(p)),"check"),registrySources:Object.freeze([...n.registrySources]),describe:n.describe})}t(yn,"Me");var vn=Object.freeze(Object.fromEntries(Object.entries(dt).map(([n,a])=>[n,yn(a)])));function gn(n,a){return vn[`${n.toUpperCase()}:${a}`]??(a==="drivers_license"?pn:cn)}t(gn,"C");var Mr=Object.freeze({JPN:"JP",MRT:"MR"});function Cr(n){return gn("MR","national_id").check(n)}t(Cr,"Oe");function _n(n){let a="";for(let f of n){let p=f.codePointAt(0)??0;p>=1632&&p<=1641?a+=String(p-1632):p>=1776&&p<=1785?a+=String(p-1776):f!==" "&&f!=="-"&&f!==" "&&(a+=f)}return a}t(_n,"H");function Sr(n){return _n(n)}t(Sr,"De");var xr=ke,Tr=kt;var bn=t(()=>import("./create-document-capture-TTMHZP7R-YI3GL7MF.js"),"E");function kn(){bn().then(n=>n.warmDocumentCapture()).catch(()=>{})}t(kn,"O");function Ir(){kn()}t(Ir,"nt");var wn=t(()=>import("./create-portrait-capture-5VGYZUOK-KTCFCHTN.js"),"D");function An(){wn().then(n=>n.warmPortraitCapture()).catch(()=>{})}t(An,"L");function Or(){An()}t(Or,"ut");export{rn as a,j as b,sn as c,ln as d,Ar as e,Cr as f,Sr as g,xr as h,Tr as i,Ir as j,Or as k};
@@ -1 +1 @@
1
- import{a as d}from"./chunk-QVU5SNFG.js";import{a as t}from"./chunk-5QL6W6FW.js";import{a as i,c as r}from"./chunk-4FHWXBOB.js";var s=r(d(),1);var u=(0,s.createContext)(null);function c(a,n,o){let e=n.detail;return{check:a,kind:n.kind,...e?.name!==void 0?{name:e.name}:{},...e?.phase!==void 0?{phase:e.phase}:{},...e?.engineKind!==void 0?{engineKind:e.engineKind}:{},attempt:Math.max(0,Math.min(1e3,o))}}i(c,"a");t(c,"captureIssueOf");function m(a,n){if(a!==void 0)try{a(n)}catch{}}i(m,"o");t(m,"sendCaptureIssue");export{u as a,c as b,m as c};
1
+ import{a as d}from"./chunk-IHKI3APK.js";import{a as t}from"./chunk-5QL6W6FW.js";import{a as i,c as r}from"./chunk-4FHWXBOB.js";var s=r(d(),1);var u=(0,s.createContext)(null);function c(a,n,o){let e=n.detail;return{check:a,kind:n.kind,...e?.name!==void 0?{name:e.name}:{},...e?.phase!==void 0?{phase:e.phase}:{},...e?.engineKind!==void 0?{engineKind:e.engineKind}:{},attempt:Math.max(0,Math.min(1e3,o))}}i(c,"a");t(c,"captureIssueOf");function m(a,n){if(a!==void 0)try{a(n)}catch{}}i(m,"o");t(m,"sendCaptureIssue");export{u as a,c as b,m as c};
@@ -0,0 +1 @@
1
+ import{b as L}from"./chunk-B5QW2GSC.js";import{a as J,c as N}from"./chunk-43I6I3SU.js";import{b as U}from"./chunk-6MYG4HWP.js";import{a as r}from"./chunk-4FHWXBOB.js";var b,h=(b=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(b,"u"),b);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,R=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,g,st=(g=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}:{},...t.interactive===!0?{interactive:!0}:{},...typeof t.checks=="number"&&Number.isInteger(t.checks)&&t.checks>=0&&t.checks<=50?{checks:t.checks}:{}};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(-R),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(R,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(-R),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=N.timezone();d!==void 0&&(c["sekyro-client-timezone"]=d)}catch{}c["sekyro-client-form-factor"]=U();try{let d=await N.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(g,"w"),g);function G(e){return typeof e=="number"&&Number.isInteger(e)&&e>=0&&e<=6e5}r(G,"S");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 be=new Set(["nni_unbound","id_number_unbound","method_required","mobile_required","portrait_required"]);function ut(e){return be.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 ge={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=>ge[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",Ne=2,Re=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<Ne){c+=1;let u=o.retryAfterSeconds!==void 0?o.retryAfterSeconds*1e3:void 0;await e.sleep(u!==void 0?Math.min(u,Ke):Re);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,bt=(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,gt=(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,ge 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,bt as F,gt as G,kt as H,et as I,wt as J,Mt as K,St as L};
@@ -1 +1 @@
1
- import{a as C,d as f,e as l,f as d,g as m,h as v,i as p,j as g,l as x}from"./chunk-QVU5SNFG.js";import{a as i}from"./chunk-5QL6W6FW.js";import{a as o,c as b}from"./chunk-4FHWXBOB.js";var r=b(C(),1);var y={ar:l,fr:d,en:f};function h(e,t){let s=v(e),a=s===void 0?y[m(e)]:{...y.en,...s};if(t===void 0)return a;let n={...a};for(let u of Object.keys(t)){let c=t[u];typeof c=="string"&&(n[u]=c)}return x(n,t),n}o(h,"T");i(h,"resolveStrings");function j(e){let[,t]=(0,r.useState)(0),s=p(e);return(0,r.useEffect)(()=>{if(!s)return;let a=!0;return g(e).then(()=>a&&t(n=>n+1)),()=>{a=!1}},[e,s]),!s}o(j,"w");i(j,"useLocaleReady");var S=(0,r.createContext)(e=>f[e]??""),E=S.Provider;function k(){return(0,r.useContext)(S)}o(k,"I");i(k,"useStrings");export{h as a,j as b,E as c,k as d};
1
+ import{a as C,d as f,e as l,f as d,g as m,h as v,i as p,j as g,l as x}from"./chunk-IHKI3APK.js";import{a as i}from"./chunk-5QL6W6FW.js";import{a as o,c as b}from"./chunk-4FHWXBOB.js";var r=b(C(),1);var y={ar:l,fr:d,en:f};function h(e,t){let s=v(e),a=s===void 0?y[m(e)]:{...y.en,...s};if(t===void 0)return a;let n={...a};for(let u of Object.keys(t)){let c=t[u];typeof c=="string"&&(n[u]=c)}return x(n,t),n}o(h,"T");i(h,"resolveStrings");function j(e){let[,t]=(0,r.useState)(0),s=p(e);return(0,r.useEffect)(()=>{if(!s)return;let a=!0;return g(e).then(()=>a&&t(n=>n+1)),()=>{a=!1}},[e,s]),!s}o(j,"w");i(j,"useLocaleReady");var S=(0,r.createContext)(e=>f[e]??""),E=S.Provider;function k(){return(0,r.useContext)(S)}o(k,"I");i(k,"useStrings");export{h as a,j as b,E as c,k as d};
@@ -1 +1 @@
1
- import{i as X}from"./chunk-XXYPLLFI.js";import{a as z,b as ee}from"./chunk-QVU5SNFG.js";import{a as n}from"./chunk-5QL6W6FW.js";import{a,c as Z}from"./chunk-4FHWXBOB.js";var u=Z(z(),1),J=Z(z(),1),s=Z(ee(),1);var h=Z(ee(),1);var he="AC247 AD376 AE971/0 AF93/0 AG1/1 AI1/1 AL355/0 AM374/0 AO244 AR54/0 AS1/1 AT43/0 AU61/0 AW297 AX358/0 AZ994/0 BA387/0 BB1/1 BD880/0 BE32/0 BF226 BG359/0 BH973 BI257 BJ229 BL590/0 BM1/1 BN673 BO591/0 BQ599 BR55/0 BS1/1 BT975 BW267 BY375/8 BZ501 CA1/1 CC61/0 CD243/0 CF236 CG242 CH41/0 CI225 CK682 CL56 CM237 CN86/0 CO57/0 CR506 CU53/0 CV238 CW599 CX61/0 CY357 CZ420 DE49/0 DJ253 DK45 DM1/1 DO1/1 DZ213/0 EC593/0 EE372 EG20/0 EH212/0 ER291/0 ES34 ET251/0 FI358/0 FJ679 FK500 FM691 FO298 FR33/0 GA241 GB44/0 GD1/1 GE995/0 GF594/0 GG44/0 GH233/0 GI350 GL299 GM220 GN224 GP590/0 GQ240 GR30 GT502 GU1/1 GW245 GY592 HK852 HN504 HR385/0 HT509 HU36/06 ID62/0 IE353/0 IL972/0 IM44/0 IN91/0 IO246 IQ964/0 IR98/0 IS354 IT39 JE44/0 JM1/1 JO962/0 JP81/0 KE254/0 KG996/0 KH855/0 KI686/0 KM269 KN1/1 KP850/0 KR82/0 KW965 KY1/1 KZ7/8 LA856/0 LB961/0 LC1/1 LI423/0 LK94/0 LR231/0 LS266 LT370/0 LU352 LV371 LY218/0 MA212/0 MC377/0 MD373/0 ME382/0 MF590/0 MG261/0 MH692/1 MK389/0 ML223 MM95/0 MN976/0 MO853 MP1/1 MQ596/0 MR222 MS1/1 MT356 MU230 MV960 MW265/0 MX52 MY60/0 MZ258 NA264/0 NC687 NE227 NF672 NG234/0 NI505 NL31/0 NO47 NP977/0 NR674 NU683 NZ64/0 OM968 PA507 PE51/0 PF689 PG675 PH63/0 PK92/0 PL48 PM508/0 PR1/1 PS970/0 PT351 PW680 PY595/0 QA974 RE262/0 RO40/0 RS381/0 RU7/8 RW250/0 SA966/0 SB677 SC248 SD249/0 SE46/0 SG65 SH290 SI386/0 SJ47 SK421/0 SL232/0 SM378 SN221 SO252/0 SR597 SS211/0 ST239 SV503 SX1/1 SY963/0 SZ268 TA290 TC1/1 TD235 TG228 TH66/0 TJ992 TK690 TL670 TM993/8 TN216 TO676 TR90/0 TT1/1 TV688 TW886/0 TZ255/0 UA380/0 UG256/0 US1/1 UY598/0 UZ998 VA39 VC1/1 VE58/0 VG1/1 VI1/1 VN84/0 VU678 WF681 WS685 XK383/0 YE967/0 YT262/0 ZA27/0 ZM260/0 ZW263/0",j;function Q(e){return j??(j=new Map(he.split(" ").map(l=>{let[r,t]=l.slice(2).split("/");return[l.slice(0,2),[r,t]]}))),j.get(e.toUpperCase())}a(Q,"z");n(Q,"entryOf");function pe(e){return Q(e)?.[0]}a(pe,"Ne");n(pe,"dialCodeOf");function ne(e){return Q(e)?.[1]}a(ne,"ee");n(ne,"nationalPrefixOf");var le=n(e=>e.normalize("NFD").replace(/\p{Diacritic}/gu,"").toLocaleLowerCase(),"fold");function ae(e,l){let r=le(l.trim());return r===""?e:e.filter(t=>le(t.name).includes(r)||t.code.toLowerCase()===r)}a(ae,"ce");n(ae,"matchCountries");function oe({countries:e,label:l,searchPlaceholder:r,noMatch:t,onPick:v,selected:P,searchRef:f,scroll:E=!1,searchable:w=!0,detail:D,extra:y}){let[M,b]=(0,J.useState)(""),c=(0,J.useId)(),T=ae(e,M),N=(0,s.jsxs)("ul",{className:`sekyro-rows${E?" sekyro-rows--scroll":""}`,children:[T.map(d=>{let S=D?.(d.code);return(0,s.jsx)("li",{children:(0,s.jsxs)("button",{type:"button",className:"sekyro-row-btn","aria-current":P===d.code||void 0,onClick:a(()=>v(d.code),"onClick"),children:[(0,s.jsx)("span",{className:"sekyro-row-btn__flag","aria-hidden":"true",children:ce(d.code)}),(0,s.jsx)("span",{className:"sekyro-row-btn__name",children:d.name}),S!==void 0?(0,s.jsx)("bdi",{className:"sekyro-row-btn__detail",dir:"ltr",children:S}):null]})},d.code)}),y!==void 0?(0,s.jsx)("li",{children:(0,s.jsxs)("button",{type:"button",className:"sekyro-row-btn","aria-current":y.current||void 0,onClick:y.onPick,children:[(0,s.jsx)("span",{className:"sekyro-row-btn__flag","aria-hidden":"true",children:"🌐"}),(0,s.jsx)("span",{className:"sekyro-row-btn__name",children:y.label})]})}):null]});return w?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)("div",{className:"sekyro-field",children:[(0,s.jsx)("label",{className:"sekyro-label",htmlFor:c,children:l}),(0,s.jsx)("input",{ref:f,id:c,type:"search",className:"sekyro-input",placeholder:r,value:M,onChange:a(d=>b(d.target.value),"onChange")})]}),T.length===0&&y===void 0?(0,s.jsx)("p",{className:"sekyro-text-muted",children:t}):N]}):N}a(oe,"te");n(oe,"CountryList");function U(e){let l=X(e).replace(/\D/g,"");return/^\D*\+/.test(e)?`+${l}`:l.startsWith("00")?`+${l.slice(2)}`:l}a(U,"H");n(U,"digitsOf");var te=n((e,l)=>(l.trunk!==void 0&&e.startsWith(l.trunk)?e.slice(l.trunk.length):e).slice(0,Math.max(...l.lengths)),"fitDigits");function Y(e,l){let r="",t=0;for(let v of l?.formats?.find(P=>new RegExp(`^(?:${P.leading})`).test(e))?.groups??[])t<e.length&&(r+=(t>0?" ":"")+e.slice(t,t+v)),t+=v;return r+e.slice(t)}a(Y,"Z");n(Y,"groupDigits");function ie(e,l){let r=0;for(let t=l;t>0&&r<e.length;r+=1)e[r]!==" "&&(t-=1);return r}a(ie,"oe");n(ie,"caretAfter");var se=n((e,l)=>l.find(r=>e.startsWith(r.dial)),"countryOfNumber"),me=n((e,l)=>e.lengths.join(", ").replace(/, (\d+)$/,` ${l} $1`),"lengthsLabel");function q(e){let l=U(e).replace("+","");return/^\d{8,15}$/.test(l)?`+${l}`:null}a(q,"le");n(q,"normalizedPhone");var ce=n(e=>String.fromCodePoint(...Array.from(e.toUpperCase(),l=>127397+l.charCodeAt(0))),"flagOf");function de(e,l){if(l===null||!e.startsWith(l.dial))return q(e);let r=e.slice(l.dial.length).replace(/\D/g,""),t=ne(l.code);return t!==void 0&&r.startsWith(t)&&(r=r.slice(t.length)),q(l.dial+r)}a(de,"ye");n(de,"e164Of");var re=n((e,l)=>(se(e,l)??l[0])?.code??null,"countryFor");function ue(e){let l=null;try{l=new Intl.DisplayNames([e],{type:"region"})}catch{}return r=>`${l?.of(r.code)??r.code} (${r.dial})`}a(ue,"me");n(ue,"countryLabels");var fe="other",ye=8;function ge({countries:e,international:l,closed:r,defaultPhone:t}){let[v,P]=(0,u.useState)(()=>re(t,e)),[f,E]=(0,u.useState)(t),[w,D]=(0,u.useState)(!1),[y,M]=(0,u.useState)(!1),b=e.map(o=>o.code).join(","),c=e.find(o=>o.code===v)??null,T=(0,u.useRef)(c);c!==null&&(T.current=c),(0,u.useEffect)(()=>{if(v===null||!e.some(o=>o.code===v)){let o=re(t,e);P(o);let i=T.current,k=e.find(C=>C.code===o)?.dial;k!==void 0&&E(C=>i!==null&&C.startsWith(i.dial)?k+C.slice(i.dial.length):C.startsWith("+")?C:k)}},[b,t]);let N=w||c===null,d=N||f.startsWith("+")&&!f.startsWith(c.dial),S=d?void 0:c.rule,x=d?f:f.replace(c.dial,"").replace(/\D/g,""),p=S?te(x,S):x,W=d&&!N&&!l&&r&&!e.some(o=>o.dial.startsWith(f)),I=W?null:S?S.lengths.includes(p.length)?c.dial+p:null:N&&!f.startsWith("+")?null:de(f,w?null:c),H=d||c===null?I??f:`${c.dial} ${Y(p,S)}`,B=d?U(f).replace("+","")==="":p==="";return{countries:e,international:l,phone:f,selected:c,other:w,whole:d,free:N,rule:S,national:p,refused:W,typed:I,shown:H,empty:B,lengthShown:y,setLengthShown:M,onNumber:n(o=>{let i=o.target,k=o.nativeEvent.inputType,C=Math.max(0,i.value.lastIndexOf("+")),G=U(i.value.slice(C)),A=se(G,e),_=U(i.value.slice(C,i.selectionStart)).length,F=G,V=G;if(M(!1),!A&&(N||G.startsWith("+")))l&&D(!0);else{let R=A??c,g=A?G.slice(A.dial.length):G;if(P(R.code),D(!1),g===p&&k?.startsWith("delete")&&(k.endsWith("Forward")||(_-=1),g=g.slice(0,_)+g.slice(_+1)),R.rule){let $=te(g,R.rule),O=g.length-$.length;_-=O,g=O>0&&!A&&p.length===$.length?p:$}V=R.dial+g,F=Y(g,R.rule)}E(V),i.value=F;let K=ie(F,_);i.setSelectionRange(K,K)},"onNumber"),onCountry:n(o=>{M(!1);let i=e.find(k=>k.code===o);D(i===void 0),i!==void 0&&P(i.code),E(i===void 0?"":i.dial+(d?"":p))},"onCountry")}}a(ge,"_e");n(ge,"usePhoneField");function Ne({field:e,id:l,locale:r,t,inputRef:v,invalid:P=!1,describedby:f,required:E,compact:w=!1,ready:D}){let{selected:y,whole:M,other:b,free:c,national:T,rule:N,phone:d,refused:S,typed:x,countries:p,international:W}=e,[I,H]=(0,u.useState)(!1),B=(0,u.useRef)(null),o=(0,u.useRef)(null),i=(0,u.useRef)(null),k=(0,u.useRef)(null),C=v??k,G=(0,u.useId)(),A=S?t("otp.reason_otp_destination_not_allowed"):e.lengthShown&&N?t("otp.phoneLengthError",{digits:me(N,t("otp.or"))}):"",_=p.length>1||W,F=ue(r),V=(0,u.useMemo)(()=>{let m=null;try{m=new Intl.DisplayNames([r],{type:"region"})}catch{}return p.map(L=>({code:L.code,name:m?.of(L.code)??L.code}))},[p,r]),K=p.length>ye,R=[M?"":`${l}-dial ${l}-hint`,A?`${l}-error`:"",f??""].join(" ").trim()||void 0,g=n(m=>{H(!1),requestAnimationFrame(()=>(m==="lead"?B.current:C.current)?.focus())},"close"),$=n(()=>{if(I)return g("lead");H(!0),requestAnimationFrame(()=>(i.current??o.current?.querySelector('[aria-current="true"]')??o.current?.querySelector("button"))?.focus())},"toggle"),O=n(()=>(0,h.jsxs)("span",{className:"sekyro-phone__dial",id:`${l}-dial`,"aria-hidden":_||void 0,children:[(0,h.jsx)("span",{className:"sekyro-phone__flag","aria-hidden":"true",children:b?"🌐":ce(y.code)}),b?null:y.dial]}),"dial");return(0,h.jsxs)(h.Fragment,{children:[(0,h.jsxs)("div",{className:`sekyro-phone${w?" sekyro-phone--compact":""}`,dir:"ltr",children:[y===null||M&&!b?null:_?(0,h.jsx)("button",{ref:B,type:"button",className:"sekyro-phone__lead sekyro-phone__pick","aria-label":`${t("otp.countryLabel")}: ${b?t("otp.otherCountry"):F(y)}`,"aria-expanded":I,"aria-controls":I?G:void 0,onClick:$,children:O()}):(0,h.jsx)("div",{className:"sekyro-phone__lead",children:O()}),(0,h.jsx)("input",{ref:C,id:l,className:"sekyro-phone__input",type:"tel",dir:"ltr",inputMode:"tel",autoComplete:"tel",required:E,"aria-describedby":R,"aria-invalid":!!A||P||void 0,placeholder:c?"+":void 0,value:M?d:Y(T,N),onChange:e.onNumber,onKeyDown:a(m=>{m.key==="Enter"&&D===!1&&e.setLengthShown(!0)},"onKeyDown"),onBlur:a(m=>{let L=m.relatedTarget;L!==null&&(B.current?.contains(L)||o.current?.contains(L))||e.setLengthShown(T!==""&&x===null)},"onBlur")})]}),I?(0,h.jsx)("div",{ref:o,id:G,className:"sekyro-phone__list",onKeyDown:a(m=>{m.key==="Escape"&&(m.preventDefault(),g("lead"))},"onKeyDown"),children:(0,h.jsx)(oe,{countries:V,label:(0,h.jsx)("span",{className:"sekyro-visually-hidden",children:t("otp.countrySearch")}),searchPlaceholder:t("otp.countrySearch"),noMatch:t("doc.noCountryMatch"),searchable:K,scroll:!0,...K?{searchRef:i}:{},...!b&&y!==null?{selected:y.code}:{},detail:a(m=>p.find(L=>L.code===m)?.dial,"detail"),onPick:a(m=>{e.onCountry(m),g("number")},"onPick"),...W?{extra:{label:t("otp.otherCountry"),current:b,onPick:n(()=>{e.onCountry(fe),g("number")},"onPick")}}:{}})}):null,M?null:(0,h.jsx)("span",{className:"sekyro-help",id:`${l}-hint`,children:t("otp.phonePlaceholderGeneric")}),A?(0,h.jsx)("span",{className:"sekyro-help is-danger",id:`${l}-error`,role:"alert",children:A}):null]})}a(Ne,"xe");n(Ne,"PhoneField");export{pe as a,oe as b,ce as c,ge as d,Ne as e};
1
+ import{g as X}from"./chunk-VQSFTT4B.js";import{a as z,b as ee}from"./chunk-IHKI3APK.js";import{a as n}from"./chunk-5QL6W6FW.js";import{a,c as Z}from"./chunk-4FHWXBOB.js";var u=Z(z(),1),J=Z(z(),1),s=Z(ee(),1);var h=Z(ee(),1);var he="AC247 AD376 AE971/0 AF93/0 AG1/1 AI1/1 AL355/0 AM374/0 AO244 AR54/0 AS1/1 AT43/0 AU61/0 AW297 AX358/0 AZ994/0 BA387/0 BB1/1 BD880/0 BE32/0 BF226 BG359/0 BH973 BI257 BJ229 BL590/0 BM1/1 BN673 BO591/0 BQ599 BR55/0 BS1/1 BT975 BW267 BY375/8 BZ501 CA1/1 CC61/0 CD243/0 CF236 CG242 CH41/0 CI225 CK682 CL56 CM237 CN86/0 CO57/0 CR506 CU53/0 CV238 CW599 CX61/0 CY357 CZ420 DE49/0 DJ253 DK45 DM1/1 DO1/1 DZ213/0 EC593/0 EE372 EG20/0 EH212/0 ER291/0 ES34 ET251/0 FI358/0 FJ679 FK500 FM691 FO298 FR33/0 GA241 GB44/0 GD1/1 GE995/0 GF594/0 GG44/0 GH233/0 GI350 GL299 GM220 GN224 GP590/0 GQ240 GR30 GT502 GU1/1 GW245 GY592 HK852 HN504 HR385/0 HT509 HU36/06 ID62/0 IE353/0 IL972/0 IM44/0 IN91/0 IO246 IQ964/0 IR98/0 IS354 IT39 JE44/0 JM1/1 JO962/0 JP81/0 KE254/0 KG996/0 KH855/0 KI686/0 KM269 KN1/1 KP850/0 KR82/0 KW965 KY1/1 KZ7/8 LA856/0 LB961/0 LC1/1 LI423/0 LK94/0 LR231/0 LS266 LT370/0 LU352 LV371 LY218/0 MA212/0 MC377/0 MD373/0 ME382/0 MF590/0 MG261/0 MH692/1 MK389/0 ML223 MM95/0 MN976/0 MO853 MP1/1 MQ596/0 MR222 MS1/1 MT356 MU230 MV960 MW265/0 MX52 MY60/0 MZ258 NA264/0 NC687 NE227 NF672 NG234/0 NI505 NL31/0 NO47 NP977/0 NR674 NU683 NZ64/0 OM968 PA507 PE51/0 PF689 PG675 PH63/0 PK92/0 PL48 PM508/0 PR1/1 PS970/0 PT351 PW680 PY595/0 QA974 RE262/0 RO40/0 RS381/0 RU7/8 RW250/0 SA966/0 SB677 SC248 SD249/0 SE46/0 SG65 SH290 SI386/0 SJ47 SK421/0 SL232/0 SM378 SN221 SO252/0 SR597 SS211/0 ST239 SV503 SX1/1 SY963/0 SZ268 TA290 TC1/1 TD235 TG228 TH66/0 TJ992 TK690 TL670 TM993/8 TN216 TO676 TR90/0 TT1/1 TV688 TW886/0 TZ255/0 UA380/0 UG256/0 US1/1 UY598/0 UZ998 VA39 VC1/1 VE58/0 VG1/1 VI1/1 VN84/0 VU678 WF681 WS685 XK383/0 YE967/0 YT262/0 ZA27/0 ZM260/0 ZW263/0",j;function Q(e){return j??(j=new Map(he.split(" ").map(l=>{let[r,t]=l.slice(2).split("/");return[l.slice(0,2),[r,t]]}))),j.get(e.toUpperCase())}a(Q,"z");n(Q,"entryOf");function pe(e){return Q(e)?.[0]}a(pe,"Ne");n(pe,"dialCodeOf");function ne(e){return Q(e)?.[1]}a(ne,"ee");n(ne,"nationalPrefixOf");var le=n(e=>e.normalize("NFD").replace(/\p{Diacritic}/gu,"").toLocaleLowerCase(),"fold");function ae(e,l){let r=le(l.trim());return r===""?e:e.filter(t=>le(t.name).includes(r)||t.code.toLowerCase()===r)}a(ae,"ce");n(ae,"matchCountries");function oe({countries:e,label:l,searchPlaceholder:r,noMatch:t,onPick:v,selected:P,searchRef:f,scroll:E=!1,searchable:w=!0,detail:D,extra:y}){let[M,b]=(0,J.useState)(""),c=(0,J.useId)(),T=ae(e,M),N=(0,s.jsxs)("ul",{className:`sekyro-rows${E?" sekyro-rows--scroll":""}`,children:[T.map(d=>{let S=D?.(d.code);return(0,s.jsx)("li",{children:(0,s.jsxs)("button",{type:"button",className:"sekyro-row-btn","aria-current":P===d.code||void 0,onClick:a(()=>v(d.code),"onClick"),children:[(0,s.jsx)("span",{className:"sekyro-row-btn__flag","aria-hidden":"true",children:ce(d.code)}),(0,s.jsx)("span",{className:"sekyro-row-btn__name",children:d.name}),S!==void 0?(0,s.jsx)("bdi",{className:"sekyro-row-btn__detail",dir:"ltr",children:S}):null]})},d.code)}),y!==void 0?(0,s.jsx)("li",{children:(0,s.jsxs)("button",{type:"button",className:"sekyro-row-btn","aria-current":y.current||void 0,onClick:y.onPick,children:[(0,s.jsx)("span",{className:"sekyro-row-btn__flag","aria-hidden":"true",children:"🌐"}),(0,s.jsx)("span",{className:"sekyro-row-btn__name",children:y.label})]})}):null]});return w?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)("div",{className:"sekyro-field",children:[(0,s.jsx)("label",{className:"sekyro-label",htmlFor:c,children:l}),(0,s.jsx)("input",{ref:f,id:c,type:"search",className:"sekyro-input",placeholder:r,value:M,onChange:a(d=>b(d.target.value),"onChange")})]}),T.length===0&&y===void 0?(0,s.jsx)("p",{className:"sekyro-text-muted",children:t}):N]}):N}a(oe,"te");n(oe,"CountryList");function U(e){let l=X(e).replace(/\D/g,"");return/^\D*\+/.test(e)?`+${l}`:l.startsWith("00")?`+${l.slice(2)}`:l}a(U,"H");n(U,"digitsOf");var te=n((e,l)=>(l.trunk!==void 0&&e.startsWith(l.trunk)?e.slice(l.trunk.length):e).slice(0,Math.max(...l.lengths)),"fitDigits");function Y(e,l){let r="",t=0;for(let v of l?.formats?.find(P=>new RegExp(`^(?:${P.leading})`).test(e))?.groups??[])t<e.length&&(r+=(t>0?" ":"")+e.slice(t,t+v)),t+=v;return r+e.slice(t)}a(Y,"Z");n(Y,"groupDigits");function ie(e,l){let r=0;for(let t=l;t>0&&r<e.length;r+=1)e[r]!==" "&&(t-=1);return r}a(ie,"oe");n(ie,"caretAfter");var se=n((e,l)=>l.find(r=>e.startsWith(r.dial)),"countryOfNumber"),me=n((e,l)=>e.lengths.join(", ").replace(/, (\d+)$/,` ${l} $1`),"lengthsLabel");function q(e){let l=U(e).replace("+","");return/^\d{8,15}$/.test(l)?`+${l}`:null}a(q,"le");n(q,"normalizedPhone");var ce=n(e=>String.fromCodePoint(...Array.from(e.toUpperCase(),l=>127397+l.charCodeAt(0))),"flagOf");function de(e,l){if(l===null||!e.startsWith(l.dial))return q(e);let r=e.slice(l.dial.length).replace(/\D/g,""),t=ne(l.code);return t!==void 0&&r.startsWith(t)&&(r=r.slice(t.length)),q(l.dial+r)}a(de,"ye");n(de,"e164Of");var re=n((e,l)=>(se(e,l)??l[0])?.code??null,"countryFor");function ue(e){let l=null;try{l=new Intl.DisplayNames([e],{type:"region"})}catch{}return r=>`${l?.of(r.code)??r.code} (${r.dial})`}a(ue,"me");n(ue,"countryLabels");var fe="other",ye=8;function ge({countries:e,international:l,closed:r,defaultPhone:t}){let[v,P]=(0,u.useState)(()=>re(t,e)),[f,E]=(0,u.useState)(t),[w,D]=(0,u.useState)(!1),[y,M]=(0,u.useState)(!1),b=e.map(o=>o.code).join(","),c=e.find(o=>o.code===v)??null,T=(0,u.useRef)(c);c!==null&&(T.current=c),(0,u.useEffect)(()=>{if(v===null||!e.some(o=>o.code===v)){let o=re(t,e);P(o);let i=T.current,k=e.find(C=>C.code===o)?.dial;k!==void 0&&E(C=>i!==null&&C.startsWith(i.dial)?k+C.slice(i.dial.length):C.startsWith("+")?C:k)}},[b,t]);let N=w||c===null,d=N||f.startsWith("+")&&!f.startsWith(c.dial),S=d?void 0:c.rule,x=d?f:f.replace(c.dial,"").replace(/\D/g,""),p=S?te(x,S):x,W=d&&!N&&!l&&r&&!e.some(o=>o.dial.startsWith(f)),I=W?null:S?S.lengths.includes(p.length)?c.dial+p:null:N&&!f.startsWith("+")?null:de(f,w?null:c),H=d||c===null?I??f:`${c.dial} ${Y(p,S)}`,B=d?U(f).replace("+","")==="":p==="";return{countries:e,international:l,phone:f,selected:c,other:w,whole:d,free:N,rule:S,national:p,refused:W,typed:I,shown:H,empty:B,lengthShown:y,setLengthShown:M,onNumber:n(o=>{let i=o.target,k=o.nativeEvent.inputType,C=Math.max(0,i.value.lastIndexOf("+")),G=U(i.value.slice(C)),A=se(G,e),_=U(i.value.slice(C,i.selectionStart)).length,F=G,V=G;if(M(!1),!A&&(N||G.startsWith("+")))l&&D(!0);else{let R=A??c,g=A?G.slice(A.dial.length):G;if(P(R.code),D(!1),g===p&&k?.startsWith("delete")&&(k.endsWith("Forward")||(_-=1),g=g.slice(0,_)+g.slice(_+1)),R.rule){let $=te(g,R.rule),O=g.length-$.length;_-=O,g=O>0&&!A&&p.length===$.length?p:$}V=R.dial+g,F=Y(g,R.rule)}E(V),i.value=F;let K=ie(F,_);i.setSelectionRange(K,K)},"onNumber"),onCountry:n(o=>{M(!1);let i=e.find(k=>k.code===o);D(i===void 0),i!==void 0&&P(i.code),E(i===void 0?"":i.dial+(d?"":p))},"onCountry")}}a(ge,"_e");n(ge,"usePhoneField");function Ne({field:e,id:l,locale:r,t,inputRef:v,invalid:P=!1,describedby:f,required:E,compact:w=!1,ready:D}){let{selected:y,whole:M,other:b,free:c,national:T,rule:N,phone:d,refused:S,typed:x,countries:p,international:W}=e,[I,H]=(0,u.useState)(!1),B=(0,u.useRef)(null),o=(0,u.useRef)(null),i=(0,u.useRef)(null),k=(0,u.useRef)(null),C=v??k,G=(0,u.useId)(),A=S?t("otp.reason_otp_destination_not_allowed"):e.lengthShown&&N?t("otp.phoneLengthError",{digits:me(N,t("otp.or"))}):"",_=p.length>1||W,F=ue(r),V=(0,u.useMemo)(()=>{let m=null;try{m=new Intl.DisplayNames([r],{type:"region"})}catch{}return p.map(L=>({code:L.code,name:m?.of(L.code)??L.code}))},[p,r]),K=p.length>ye,R=[M?"":`${l}-dial ${l}-hint`,A?`${l}-error`:"",f??""].join(" ").trim()||void 0,g=n(m=>{H(!1),requestAnimationFrame(()=>(m==="lead"?B.current:C.current)?.focus())},"close"),$=n(()=>{if(I)return g("lead");H(!0),requestAnimationFrame(()=>(i.current??o.current?.querySelector('[aria-current="true"]')??o.current?.querySelector("button"))?.focus())},"toggle"),O=n(()=>(0,h.jsxs)("span",{className:"sekyro-phone__dial",id:`${l}-dial`,"aria-hidden":_||void 0,children:[(0,h.jsx)("span",{className:"sekyro-phone__flag","aria-hidden":"true",children:b?"🌐":ce(y.code)}),b?null:y.dial]}),"dial");return(0,h.jsxs)(h.Fragment,{children:[(0,h.jsxs)("div",{className:`sekyro-phone${w?" sekyro-phone--compact":""}`,dir:"ltr",children:[y===null||M&&!b?null:_?(0,h.jsx)("button",{ref:B,type:"button",className:"sekyro-phone__lead sekyro-phone__pick","aria-label":`${t("otp.countryLabel")}: ${b?t("otp.otherCountry"):F(y)}`,"aria-expanded":I,"aria-controls":I?G:void 0,onClick:$,children:O()}):(0,h.jsx)("div",{className:"sekyro-phone__lead",children:O()}),(0,h.jsx)("input",{ref:C,id:l,className:"sekyro-phone__input",type:"tel",dir:"ltr",inputMode:"tel",autoComplete:"tel",required:E,"aria-describedby":R,"aria-invalid":!!A||P||void 0,placeholder:c?"+":void 0,value:M?d:Y(T,N),onChange:e.onNumber,onKeyDown:a(m=>{m.key==="Enter"&&D===!1&&e.setLengthShown(!0)},"onKeyDown"),onBlur:a(m=>{let L=m.relatedTarget;L!==null&&(B.current?.contains(L)||o.current?.contains(L))||e.setLengthShown(T!==""&&x===null)},"onBlur")})]}),I?(0,h.jsx)("div",{ref:o,id:G,className:"sekyro-phone__list",onKeyDown:a(m=>{m.key==="Escape"&&(m.preventDefault(),g("lead"))},"onKeyDown"),children:(0,h.jsx)(oe,{countries:V,label:(0,h.jsx)("span",{className:"sekyro-visually-hidden",children:t("otp.countrySearch")}),searchPlaceholder:t("otp.countrySearch"),noMatch:t("doc.noCountryMatch"),searchable:K,scroll:!0,...K?{searchRef:i}:{},...!b&&y!==null?{selected:y.code}:{},detail:a(m=>p.find(L=>L.code===m)?.dial,"detail"),onPick:a(m=>{e.onCountry(m),g("number")},"onPick"),...W?{extra:{label:t("otp.otherCountry"),current:b,onPick:n(()=>{e.onCountry(fe),g("number")},"onPick")}}:{}})}):null,M?null:(0,h.jsx)("span",{className:"sekyro-help",id:`${l}-hint`,children:t("otp.phonePlaceholderGeneric")}),A?(0,h.jsx)("span",{className:"sekyro-help is-danger",id:`${l}-error`,role:"alert",children:A}):null]})}a(Ne,"xe");n(Ne,"PhoneField");export{pe as a,oe as b,ce as c,ge as d,Ne as e};
@@ -1 +1 @@
1
- import{a as t,b as r,c as a,d as m,e as o,f as p,g as i}from"./chunk-CCPSNJ26.js";import"./chunk-F6BL7IXJ.js";import"./chunk-F4Q2Q4OC.js";import"./chunk-SX373VNU.js";import"./chunk-VHJIEZ5D.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,a as FACE_CONFIRM_BUDGET_MS,t as SAME_FACE_MAX_DROPS,p as createDocumentCapture,i as createDocumentCaptureInternal,m as faceVerdict,o as warmDocumentCapture};
1
+ import{a as t,b as r,c as a,d as m,e as o,f as p,g as i}from"./chunk-PNQ5TDY5.js";import"./chunk-F6BL7IXJ.js";import"./chunk-F4Q2Q4OC.js";import"./chunk-B5QW2GSC.js";import"./chunk-43I6I3SU.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,a as FACE_CONFIRM_BUDGET_MS,t as SAME_FACE_MAX_DROPS,p as createDocumentCapture,i as createDocumentCaptureInternal,m as faceVerdict,o as warmDocumentCapture};
@@ -1 +1 @@
1
- "use client";import{a as ot}from"./chunk-IX5EXDOC.js";import{a as Xe}from"./chunk-7UCVVWRT.js";import"./chunk-SIBJ56BG.js";import{a as nt}from"./chunk-EAHT3Y3Z.js";import{a as Je,b as et,c as tt}from"./chunk-H4EO527J.js";import{j as We}from"./chunk-XXYPLLFI.js";import"./chunk-TD2XP34G.js";import{d as at}from"./chunk-L2FCXJYM.js";import"./chunk-YFZ54VRE.js";import{F as je,G as Qe,H as Ze,J as qe,L as Q,M as le,a as Rt,b as Ut,c as O,o as Ye,q as Ke,v as A,w as Ce,y as _e}from"./chunk-QVU5SNFG.js";import"./chunk-75QP4SUF.js";import"./chunk-SX373VNU.js";import"./chunk-VHJIEZ5D.js";import"./chunk-P7K7ELYZ.js";import{a as s}from"./chunk-5QL6W6FW.js";import"./chunk-6MYG4HWP.js";import"./chunk-JS2IXPNL.js";import"./chunk-SLLJX5QK.js";import{a as l,c as Fe}from"./chunk-4FHWXBOB.js";var i=Fe(Rt(),1),n=Fe(Ut(),1);var Bt={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"/>'},Et={"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":"يبدو أن هذه بطاقة تعريف أو بطاقة إقامة"},ce={"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"},Vt={"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"},Gt={"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":"رفع صورة"},de={"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"},Ft={"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"},Wt={"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":"انتهت صلاحية هذه الوثيقة. امسح وثيقة سارية.","native.scan.surface":"الحواف غير واضحة. ضع البطاقة على سطح أغمق."},ue={"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.","native.scan.surface":"The edges are hard to see. Put the card on a darker surface."},Xt={"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.","native.scan.surface":"Les bords se voient mal. Posez la carte sur une surface plus sombre."},F,rt=(F=class{constructor(){this.shown=null,this.shownAt=0,this.yielded=null,this.shownPhotos=0}present(t,a,o,r,m=0){(t===null||t.key!==this.yielded)&&(this.yielded=null);let y=this.shown;return t!==null&&this.yielded===null?y?.kind==="problem"&&y.key===t.key&&y.action===t.action?(this.shownPhotos=m,!t.blocking&&a!==null&&r-this.shownAt>=3e3?(this.yielded=t.key,this.show({kind:"hint",key:a,action:null},r,m)):y):this.show({kind:"problem",key:t.key,action:t.action},r,m):y?.kind==="problem"&&t===null&&m===this.shownPhotos&&(o||r-this.shownAt<3e3)?y:a===null?this.show(null,r):y?.kind==="hint"&&y.key===a?y:this.show({kind:"hint",key:a,action:null},r)}show(t,a,o=this.shownPhotos){return this.shown=t,this.shownAt=a,this.shownPhotos=o,t}},l(F,"_e"),F);s(rt,"NoticeBand");var Yt=rt,Kt=["locking","capturing"],W,it=(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 o=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(o!==this.candidate&&(this.candidate=o,this.candidateSince=a),o===this.shown.hint)return;let r=a-this.candidateSince>=(o===null?0:350),m=this.shown.hint===null||a-this.hintShownAt>=2500;r&&m&&(this.shown={...this.shown,hint:o},this.hintShownAt=a)}presentLock(t,a){if(Kt.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 o=t.card;if(o===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 r=this.shown.card;if(r===null){this.shown={...this.shown,card:{...o}};return}let m=.35;this.shown={...this.shown,card:{fill:r.fill+(o.fill-r.fill)*m,offsetX:r.offsetX+(o.offsetX-r.offsetX)*m,offsetY:r.offsetY+(o.offsetY-r.offsetY)*m}}}},l(W,"Ce"),W);s(it,"ScanPresenter");var jt=it,Qt={en:ue,fr:Xt,ar:Wt,es:ue,pt:ue,de:ue},Zt=450,Se=s(e=>(t,a)=>nt(e.strings[t]??Qt[e.locale][t]??"",a),"useScanCopy");function st(e,t){try{return new Intl.DisplayNames([t],{type:"region"}).of(e)??e}catch{return e}}l(st,"$t");s(st,"regionName");function lt(e){let t=e.documentType,a=t===null?"native.doc.introTitle":`native.doc.titleOf.${t}`,o=t!==null&&e.issuer!==null&&We(e.documents,e.issuer).length===1;return{titleKey:a,onlyKey:o?`native.doc.onlyType.${t}`:null}}l(lt,"Ot");s(lt,"introCopy");function Z({name:e}){return(0,n.jsx)("svg",{className:"sekyro-glyph",viewBox:"0 0 24 24",fill:"none","aria-hidden":"true",focusable:"false",dangerouslySetInnerHTML:{__html:Bt[e]}})}l(Z,"me");s(Z,"ScanGlyph");var qt={en:ce,fr:Vt,ar:Et,es:ce,pt:ce,de:ce},Jt={en:de,fr:Ft,ar:Gt,es:de,pt:de,de},en="image/jpeg,image/png,image/heic,image/heif";function B(e){let t=e.strings,a=s(o=>t[o]??Jt[e.locale][o],"text");return{t:s(o=>a(o)??"","t")}}l(B,"G");s(B,"uploadCopy");function ct(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"}l(ct,"Kt");s(ct,"mrzInstruction");function dt(e){return e?.state==="reading"&&e.coach!==void 0&&e.coach!=="holdStill"?`mrz:${e.coach}`:null}l(dt,"Bt");s(dt,"mrzHint");function ut(e){return e==="carte_identite"||e==="passport"||e==="residence_permit"||e==="drivers_license"?`native.scan.showInstead.${e}`:null}l(ut,"Vt");s(ut,"showInsteadKey");var tn={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 he(e){if(e.reason==="unreadable")return"doc.reason_unreadable";let t=e.reason!==void 0?tn[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"?Ke(e.reason):null}l(he,"xe");s(he,"reasonOf");var ht=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 nn({step:e,i18n:t,liveMrz:a,barcodeAssetBaseUrl:o,ageLead:r,...m}){let[y,h]=(0,i.useState)(!1),k=(0,i.useRef)(-1),[g,w]=(0,i.useState)("idle"),x=(0,i.useRef)(null),S=typeof e.uploadDocument=="function",b=S?e.photo?.source??"camera":"camera",M=S&&b!=="camera"&&e.photo?.uploadOffered===!0,[C,E]=(0,i.useState)(null),I=b==="upload"?"upload":b==="choice"?C??e.photo?.pick??"source":"camera",D=g==="sending"?void 0:()=>x.current?.click(),f=s(async V=>{let Y=V.currentTarget.files?.[0];if(V.currentTarget.value="",Y!==void 0){h(!1),w("sending");try{await e.uploadDocument(Y),w("idle")}catch(J){w(J instanceof TypeError&&J.message==="unsupported_file"?"unsupported":"failed")}}},"onFile"),q=M?(0,n.jsx)("input",{ref:x,type:"file",accept:en,hidden:!0,"data-testid":"sekyro-doc-upload","aria-label":B(t).t("doc.uploadTitle"),onChange:l(V=>{f(V)},"onChange")}):null,T=B(t),X=e.photo?.cameraOnPhone===!0;return I==="camera"&&X?(0,n.jsx)(at,{i18n:t,lead:t.t("handoff.lead.document"),refresh:e.refresh,actions:(0,n.jsx)(O,{kind:"ghost",full:!0,onClick:l(()=>E("upload"),"onClick"),children:T.t("doc.source.upload")})}):I==="source"?(0,n.jsx)(ot,{testId:"sekyro-doc-source",title:T.t("doc.source.title"),lead:T.t("doc.source.description"),cameraLabel:X?t.t("capture.source.phone"):T.t("doc.source.camera"),onPhone:X,uploadLabel:T.t("doc.source.upload"),notice:(0,n.jsx)(pe,{step:e,i18n:t}),onCamera:l(()=>E("camera"),"onCamera"),onUpload:l(()=>E("upload"),"onUpload")}):I==="upload"?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(vt,{step:e,i18n:t,ageLead:r===!0,upload:g,offered:M,onPick:l(()=>x.current?.click(),"onPick"),...b==="choice"?{onCamera:s(()=>E("camera"),"onCamera")}:{},...m}),q]}):(0,n.jsxs)(n.Fragment,{children:[y?(0,n.jsx)(yt,{step:e,i18n:t,attempts:k,...a!==void 0?{liveMrz:a}:{},...o!==void 0?{barcodeAssetBaseUrl:o}:{},...M&&D!==void 0?{onUpload:D}:{},onClose:l(()=>h(!1),"onClose")}):(0,n.jsx)(mt,{step:e,i18n:t,ageLead:r===!0,onOpen:l(()=>h(!0),"onOpen"),upload:g,...M&&D!==void 0?{onUpload:D}:{},...m}),q]})}l(nn,"Gn");s(nn,"DocumentCaptureView");function Ne({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:pt(-10,-10,248,t+20,16,30)})]})}l(Ne,"ht");s(Ne,"ScanMark");function pt(e,t,a,o,r,m){let y=Math.min(r,m*.6);return[[e,t,1,1],[e+a,t,-1,1],[e,t+o,1,-1],[e+a,t+o,-1,-1]].map(([h,k,g,w])=>`M${h} ${k+w*m}V${k+w*y}Q${h} ${k} ${h+g*y} ${k}H${h+g*m}`).join("")}l(pt,"Gt");s(pt,"brackets");function mt({step:e,i18n:t,ageLead:a,onOpen:o,onChangeCountry:r,onChangeDocument:m,upload:y,onUpload:h}){let k=Se(t),g=B(t),w=e.documentType==="passport",x=lt(e),S=he(e),b=y==="sending",M=(0,i.useContext)(Qe)?.busy===!0,C=Xe(e.acceptedNationalities,t);return(0,n.jsxs)("section",{className:"sekyro-step sekyro-step--doc-intro","data-testid":"sekyro-document",children:[(0,n.jsx)(Ne,{passport:w}),(0,n.jsx)(Ce,{title:k(x.titleKey)||k("native.doc.introTitle"),lead:a?t.t("doc.ageStepUp"):k("native.doc.introLead")}),x.onlyKey!==null&&e.issuer!==null?(0,n.jsx)("p",{className:"sekyro-text-muted sekyro-doc-only",children:k(x.onlyKey,{country:st(e.issuer,t.locale)})}):null,C!==null?(0,n.jsx)(Q,{tone:"info",children:C}):null,(0,n.jsx)(pe,{step:e,i18n:t}),e.reason!==void 0&&ht.has(e.reason)?null:(0,n.jsxs)("ul",{className:"sekyro-tiprows",children:[(0,n.jsxs)("li",{children:[(0,n.jsx)(A,{name:w?"passport":"card"}),k("native.doc.tip.flat")]}),(0,n.jsxs)("li",{children:[(0,n.jsx)(A,{name:"light"}),k("native.doc.tip.glare")]}),(0,n.jsxs)("li",{children:[(0,n.jsx)(Z,{name:"image"}),k("native.doc.tip.frame")]})]}),(0,n.jsx)(xe,{i18n:t,...m!==void 0?{onChangeDocument:m}:{},...r!==void 0?{onChangeCountry:r}:{}}),(0,n.jsx)(Te,{i18n:t,upload:y}),b?(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:g.t("doc.uploadHint")}):null,(0,n.jsxs)(_e,{children:[(0,n.jsxs)(O,{full:!0,onClick:o,disabled:b||M,children:[(0,n.jsx)(A,{name:"camera"}),k("native.doc.openCamera")]}),h!==void 0?(0,n.jsxs)(O,{full:!0,kind:"ghost",onClick:h,children:[(0,n.jsx)(Z,{name:"image"}),g.t("doc.uploadInstead")]}):null]})]})}l(mt,"Ft");s(mt,"DocumentIntro");function pe({step:e,i18n:t}){let a=he(e);return a===null&&e.reasonHidden===!0?(0,n.jsx)(Q,{tone:"info",children:(0,n.jsx)("span",{children:le(t,e.attemptsRemaining,e.attemptsExhausted)})}):a===null?null:(0,n.jsxs)(Q,{tone:"warning",children:[(0,n.jsx)("span",{children:t.t(a)}),(0,n.jsx)("span",{children:le(t,e.attemptsRemaining,e.attemptsExhausted)})]})}l(pe,"Te");s(pe,"ReasonNotice");function xe({i18n:e,onChangeCountry:t,onChangeDocument:a}){let o=Se(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:o("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]})}l(xe,"ft");s(xe,"ChangeLinks");function Te({i18n:e,upload:t}){return t!=="unsupported"&&t!=="failed"?null:(0,n.jsx)(Q,{tone:"warning",children:(0,n.jsx)("span",{children:B(e).t(t==="unsupported"?"doc.uploadUnsupported":"doc.uploadFailed")})})}l(Te,"yt");s(Te,"UploadNotice");function vt({step:e,i18n:t,ageLead:a,upload:o,offered:r,onPick:m,onCamera:y,onChangeCountry:h,onChangeDocument:k}){let g=B(t),w=o==="sending";return(0,n.jsxs)("section",{className:"sekyro-step","data-testid":"sekyro-doc-upload-screen",children:[(0,n.jsx)(Ne,{passport:e.documentType==="passport"}),(0,n.jsx)(Ce,{title:g.t("doc.uploadTitle"),lead:a?t.t("doc.ageStepUp"):g.t("doc.uploadHint")}),a?(0,n.jsx)("p",{className:"sekyro-text-muted",children:g.t("doc.uploadHint")}):null,(0,n.jsx)(pe,{step:e,i18n:t}),(0,n.jsx)(xe,{i18n:t,...k!==void 0?{onChangeDocument:k}:{},...h!==void 0?{onChangeCountry:h}:{}}),(0,n.jsx)(Te,{i18n:t,upload:o}),w?(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:m,disabled:w||!r||e.attemptsExhausted,children:[(0,n.jsx)(Z,{name:"image"}),g.t("doc.source.upload")]}),y!==void 0?(0,n.jsxs)(O,{full:!0,kind:"ghost",onClick:y,disabled:w,children:[(0,n.jsx)(A,{name:"camera"}),g.t("doc.source.camera")]}):null]})]})}l(vt,"Xt");s(vt,"DocumentUploadScreen");function ze(e,t,a){let o=e*.88,r=o/a;return{x:(e-o)/2,y:t*.42-r/2,w:o,h:r}}l(ze,"ut");s(ze,"guideRect");var an={"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",low_contrast:"native.scan.surface"},on=s(()=>typeof window<"u"&&window.matchMedia?.("(prefers-reduced-motion: reduce)").matches===!0,"reduceMotion");function yt({step:e,i18n:t,liveMrz:a,barcodeAssetBaseUrl:o,onClose:r,attempts:m,onUpload:y}){let h=Se(t),k=(0,i.useContext)(Je),g=(0,i.useRef)(k);g.current=k;let w=(0,i.useRef)(null),x=(0,i.useRef)(null),S=(0,i.useRef)(null),[b,M]=(0,i.useState)("idle"),[C,E]=(0,i.useState)(null),[I,D]=(0,i.useState)(null),[f,q]=(0,i.useState)({w:0,h:0}),[T,X]=(0,i.useState)({hint:null,locking:!1,card:null,manualShutter:!1}),[V,Y]=(0,i.useState)({}),[J,$e]=(0,i.useState)({}),[Me,Pe]=(0,i.useState)(null),[Le,zt]=(0,i.useState)(null),[Ie,He]=(0,i.useState)(0),[me,Oe]=(0,i.useState)(null),[ve,St]=(0,i.useState)(null),[ee,Nt]=(0,i.useState)(0),te=(0,i.useRef)(0);te.current=ee;let[xt,Ae]=(0,i.useState)(0),De=(0,i.useRef)(0),ne=(0,i.useRef)(null);(0,i.useEffect)(()=>{Ae(te.current)},[e.reason,e.attemptsRemaining]);let R=e.documentType==="passport",ae=R?1.42:1.586;je(!0),(0,i.useLayoutEffect)(()=>{let d=w.current;if(d===null)return;let v=s(()=>q({w:d.clientWidth,h:d.clientHeight}),"measure");if(v(),typeof ResizeObserver>"u")return;let p=new ResizeObserver(v);return p.observe(d),()=>p.disconnect()},[]);let c=ze(f.w,f.h,ae);(0,i.useEffect)(()=>{f.w===0||f.h===0||S.current?.setGuide?.({viewAspect:f.w/f.h,rect:{x:c.x/f.w,y:c.y/f.h,width:c.w/f.w,height:c.h/f.h}})},[f.w,f.h,c.x,c.y,c.w,c.h]),(0,i.useEffect)(()=>{let d=x.current;if(d===null)return;let v=e.capture({video:d,...a!==void 0?{liveMrz:a}:{},...o!==void 0?{barcodeAssetBaseUrl:o}:{}});S.current=v,Y({}),$e({}),Pe(null);let p=w.current;if(p!==null&&p.clientWidth>0&&p.clientHeight>0){let u=ze(p.clientWidth,p.clientHeight,ae);v.setGuide?.({viewAspect:p.clientWidth/p.clientHeight,rect:{x:u.x/p.clientWidth,y:u.y/p.clientHeight,width:u.w/p.clientWidth,height:u.h/p.clientHeight}})}let $=new jt,z={scan:null,feedback:null,gate:null,mrz:null},H=s(u=>{z={...z,...u};let _=z.gate?.guide,Dt={phase:z.scan?.phase??"framing",hint:z.feedback?.reticle==="coaching"?z.feedback.key:e.documentType==="drivers_license"?null:dt(z.mrz),card:_?.detected?{fill:_.fill,offsetX:_.offsetX,offsetY:_.offsetY}:null,manualShutter:z.scan?.manualShutter??!1},K=$.present(Dt,performance.now());X(j=>j.hint===K.hint&&j.locking===K.locking&&j.manualShutter===K.manualShutter&&_t(j.card,K.card)?j:K)},"present"),At=[v.on("state",M),v.on("feedback",u=>H({feedback:u})),v.on("gate",u=>H({gate:u})),v.on("scan",u=>{u.captured.length===0&&De.current>0&&Ae(te.current),De.current=u.captured.length,ne.current=(ne.current??u.captured).filter(_=>u.captured.includes(_)),E(u),H({scan:u})}),v.on("captured",u=>{Nt(_=>_+1),Y(_=>({..._,[wt(u.side,R,_)]:u.previewDataUrl})),u.photo!==void 0&&$e(_=>({..._,[u.photo]:u.previewDataUrl})),Pe(u.previewDataUrl),zt(bt(d))}),v.on("error",u=>{D(u);let _=g.current;_!==null&&tt(_,et("document",u,Math.max(0,m.current)))}),v.on("mrz",u=>{u.state==="mismatch"?St({format:u.format??null,at:te.current}):(Oe(u),H({mrz:u}))})];return m.current+=1,v.start().catch(()=>{}),()=>{ne.current=null;for(let u of At)u();v.destroy(),S.current=null}},[e.issuer,e.documentType]);let P=C?.phase??"framing",L=P==="reading"||P==="result",oe=P==="flipCue"||P==="reaskRecto",U=T.locking,Re=C?.captured.length??0;(0,i.useEffect)(()=>{U&&He(d=>d+1)},[U]),(0,i.useEffect)(()=>{Re>0&&He(d=>d+1)},[Re]);let Tt=C?.expected??null;(0,i.useEffect)(()=>{Oe(null)},[Tt]);let ye=oe||L||e.documentType==="drivers_license"?null:ct(me,R),Ue=s(d=>t.strings[d]??qt[t.locale][d],"liveText"),$t=s(d=>d.startsWith("dcv3.")?Ue(d):h(d),"copy"),ke=ye!==null?Ue(ye):h(P==="flipCue"?"doc.flip":P==="reaskRecto"?"doc.reaskRecto":L?"native.scan.reading":P==="locking"||P==="capturing"||U?"native.scan.holdStill":R?"doc.showPage":"doc.showSide"),re=e.browserCheck??null,fe=re!==null&&L,ie=he(e),Be=s(d=>({key:h(d),action:le(t,e.attemptsRemaining,e.attemptsExhausted),blocking:e.reason!==void 0&&ht.has(e.reason)}),"reasonProblem"),Ee=ut(e.documentType),Mt=me?.state==="expired"&&!oe&&!L?{key:h("native.scan.expired"),action:null,blocking:!0}:ve!==null&&ee<=ve.at+1?{key:h(ve.format==="TD3"?"native.scan.seenPassport":"native.scan.seenCard"),action:Ee===null?null:h(Ee),blocking:!0}:C?.notice==="same_face"?{key:h("doc.sameFace"),action:null,blocking:!1}:C?.notice==="reread"?ie!==null?Be(ie):{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}:ie!==null&&ee===xt?Be(ie):null,Pt=T.hint===null?null:$t(an[T.hint]??`dcv2.${T.hint}`),Ve=kt(Mt,Pt,U||P==="capturing"||L,ee),G=T.card,N=c;if(!U&&G!==null&&G.fill>=.45&&G.fill<=1.25&&!on()){let d=c.w*G.fill,v=d/ae,p=c.x+c.w/2+c.w*Math.max(-.25,Math.min(.25,G.offsetX)),$=c.y+c.h/2+c.h*Math.max(-.25,Math.min(.25,G.offsetY));N={x:p-d/2,y:$-v/2,w:d,h:v}}let se=c.w*.045,ge=28,Ge=Math.min(se,ge*.6),Lt=[[N.x,N.y,1,1],[N.x+N.w,N.y,-1,1],[N.x,N.y+N.h,1,-1],[N.x+N.w,N.y+N.h,-1,-1]],It=U?"is-locked":Ve!==null?"is-coaching":"",Ht=R?[{side:"single",label:"doc.progressPage"}]:[{side:"recto",label:"doc.progressFront"},{side:"verso",label:"doc.progressBack"}],Ot=c.y+c.h+16,we={insetInlineStart:c.x,insetBlockStart:c.y,inlineSize:c.w,blockSize:c.h,borderRadius:se};return(0,n.jsx)("section",{className:"sekyro-lm","aria-label":ke,"data-testid":"sekyro-document",children:(0,n.jsxs)("div",{ref:w,className:`sekyro-lm-stage${L?" is-reading":""}${oe?" is-flip":""}`,style:{"--sekyro-guide-w":`${c.w}px`},children:[(0,n.jsx)("video",{ref:x,className:"sekyro-lm-video",playsInline:!0,muted:!0,autoPlay:!0,"aria-hidden":"true",onPointerUp:l(d=>{let v=d.currentTarget,p=v.getBoundingClientRect(),$=Math.max(p.width/(v.videoWidth||1),p.height/(v.videoHeight||1)),z=v.videoWidth*$,H=v.videoHeight*$;z>0&&H>0&&S.current?.focusAt((d.clientX-p.left+(z-p.width)/2)/z,(d.clientY-p.top+(H-p.height)/2)/H)},"onPointerUp")}),f.w>0?(0,n.jsxs)(n.Fragment,{children:[L&&Le!==null?(0,n.jsx)("img",{className:"sekyro-lm-scene",src:Le,alt:""}):null,L&&Me!==null?(0,n.jsx)("img",{className:"sekyro-lm-frozen",src:Me,alt:"",style:we}):null,(0,n.jsxs)("svg",{className:"sekyro-lm-overlay",viewBox:`0 0 ${f.w} ${f.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${f.w}V${f.h}H0Z${Ct(c,se)}`}),(0,n.jsx)("rect",{width:f.w,height:Math.max(0,c.y),fill:"url(#sekyro-lm-top)"}),(0,n.jsx)("rect",{y:c.y+c.h,width:f.w,height:Math.max(0,f.h-c.y-c.h),fill:"url(#sekyro-lm-bottom)"}),(0,n.jsx)("g",{className:`sekyro-lm-brackets ${It}`,children:Lt.map(([d,v,p,$],z)=>(0,n.jsx)("path",{style:{transform:`translate(${d}px, ${v}px) scale(${p}, ${$})`},d:`M0 ${ge}V${Ge}Q0 0 ${Ge} 0H${ge}`},z))}),U?(0,n.jsx)("rect",{className:"sekyro-lm-trace",x:c.x,y:c.y,width:c.w,height:c.h,rx:se,pathLength:"1",style:{animationDuration:`${Zt}ms`}}):null]}),(0,n.jsx)("div",{className:"sekyro-lm-slot",style:we,"aria-hidden":"true",children:L?(0,n.jsx)("span",{className:"sekyro-lm-read is-repeating"}):Ie>0?(0,n.jsx)("span",{className:"sekyro-lm-read"},Ie):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${R?" is-page":""}${me?.state==="valid"?" is-valid":""}`})}):null,(0,n.jsx)("div",{className:"sekyro-lm-instruction",style:{insetBlockStart:c.y-64},children:(0,n.jsx)("div",{role:"status","aria-live":"polite","data-testid":"sekyro-scan-instruction",children:fe?null:(0,n.jsx)(qe,{swapKey:ke,className:"sekyro-lm-line",children:ke})})}),(0,n.jsxs)("div",{className:"sekyro-lm-below",style:{insetBlockStart:Ot,inlineSize:c.w,insetInlineStart:c.x},children:[(0,n.jsx)(ft,{band:Ve}),fe?null:L?(0,n.jsxs)("p",{className:"sekyro-lm-note",children:[(0,n.jsx)("span",{className:"sekyro-lm-spinner","aria-hidden":"true"}),h("native.scan.putDown")]}):oe?(0,n.jsx)("div",{className:`sekyro-lm-flip${P==="reaskRecto"?" is-toFront":""}`,"data-testid":"sekyro-flip-cue","aria-hidden":"true",children:(0,n.jsxs)("span",{className:"sekyro-lm-flip-card",style:{aspectRatio:String(ae)},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:r,children:(0,n.jsx)(A,{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:l(()=>S.current?.setTorch(!C.torch),"onClick"),children:(0,n.jsx)(Z,{name:"flashlight"})}):null]}),I!==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(I.kind==="permission"?"doc.cameraBlockedHint":Ye(I.kind))}),(0,n.jsx)(O,{onClick:l(()=>{D(null),m.current+=1,S.current?.retry()},"onClick"),children:t.t("doc.retryCamera")})]}):null,re!==null&&I===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(re.code==="clock_wrong"?"errors.device_clock":"errors.attestation_invalid")}),(0,n.jsx)(O,{onClick:re.retry,children:t.t("common.retry")})]}):null,T.manualShutter?(0,n.jsx)("button",{type:"button",className:"sekyro-shutter","aria-label":t.t("doc.shutter"),onClick:l(()=>S.current?.shutter(),"onClick")}):null,(0,n.jsx)("ol",{className:"sekyro-lm-tray",children:Ht.map(({side:d,label:v})=>{let p=C?.captured.includes(d)??!1,$=gt(d,C,J,V);return(0,n.jsxs)("li",{className:p?"is-done":void 0,"aria-current":!p&&(R||C?.expected===d)?"step":void 0,children:[p?(0,n.jsxs)("span",{className:"sekyro-lm-thumb",children:[$!==void 0?(0,n.jsx)("img",{src:$,alt:""}):(0,n.jsx)(A,{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),p&&$===void 0&&ne.current?.includes(d)?(0,n.jsx)("span",{className:"sekyro-lm-received",children:h("doc.sideReceived")}):null]},d)})}),y!==void 0?(0,n.jsx)("button",{type:"button",className:"sekyro-lm-upload",onClick:y,children:B(t).t("doc.uploadInstead")}):null,b==="uploading"||b==="checking"?null:(0,n.jsx)(Ze,{onStop:r})]}),!fe&&(b==="uploading"||b==="checking")?(0,n.jsx)("span",{className:"sekyro-visually-hidden",role:"status",children:b==="uploading"?t.t("doc.uploading"):h("native.scan.reading")}):null]})})}l(yt,"Qt");s(yt,"LumiereScan");function kt(e,t,a,o){let r=(0,i.useRef)(null);r.current??(r.current=new Yt);let[m,y]=(0,i.useState)(null),h=(0,i.useRef)({problem:e,hint:t,busy:a,photos:o});h.current={problem:e,hint:t,busy:a,photos:o};let k=e===null?null:`${e.blocking}|${e.key}|${e.action??""}`;return(0,i.useEffect)(()=>{let g=s(()=>{let{problem:x,hint:S,busy:b,photos:M}=h.current;y(r.current?.present(x,S,b,performance.now(),M)??null)},"run");g();let w=setInterval(g,250);return()=>clearInterval(w)},[k,t,a,o]),m}l(kt,"Zt");s(kt,"useNoticeBand");function ft({band:e}){let[t,a]=(0,i.useState)(e);(0,i.useEffect)(()=>{e!==null&&a(e)},[e]);let o=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:o!==null?(0,n.jsxs)("div",{className:"sekyro-notice sekyro-notice--warning","data-kind":o.kind,"aria-hidden":e===null||void 0,children:[(0,n.jsx)("span",{className:"sekyro-notice__icon","aria-hidden":"true",children:(0,n.jsx)(A,{name:"warning"})}),(0,n.jsxs)("div",{className:"sekyro-notice__body",children:[(0,n.jsx)("span",{children:o.key}),o.action!==null&&o.action!==""?(0,n.jsx)("span",{children:o.action}):null]})]}):null})})}l(ft,"Jt");s(ft,"NoticeBandView");function gt(e,t,a,o){if(t?.photos===void 0)return o[e];let r=t.photos[e];return r===void 0?void 0:a[r]}l(gt,"qt");s(gt,"thumbOf");function wt(e,t,a){return t?"single":e==="recto"||e==="verso"?e:a.recto===void 0?"recto":"verso"}l(wt,"en");s(wt,"slotOf");function Ct({x:e,y:t,w:a,h:o},r){return`M${e+r} ${t}H${e+a-r}Q${e+a} ${t} ${e+a} ${t+r}V${t+o-r}Q${e+a} ${t+o} ${e+a-r} ${t+o}H${e+r}Q${e} ${t+o} ${e} ${t+o-r}V${t+r}Q${e} ${t} ${e+r} ${t}Z`}l(Ct,"tn");s(Ct,"roundedRect");var be=.004;function _t(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}l(_t,"nn");s(_t,"sameCard");function bt(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 o=document.createElement("canvas");o.width=t,o.height=a;let r=o.getContext("2d");return r===null?null:(r.drawImage(e,0,0,t,a),o.toDataURL("image/jpeg",.7))}catch{return null}}l(bt,"on");s(bt,"sceneSnapshot");export{nn as DocumentCaptureView,Zt as LOCK_TRACE_MS,en as UPLOAD_ACCEPT,ze as guideRect,lt as introCopy,dt as mrzHint,ct as mrzInstruction,_t as sameCard,ut as showInsteadKey,wt as slotOf,gt as thumbOf};
1
+ "use client";import{a as ot}from"./chunk-53PI7QVO.js";import{a as Xe}from"./chunk-7UCVVWRT.js";import"./chunk-SIBJ56BG.js";import{a as nt}from"./chunk-VD2BADU2.js";import{a as Je,b as et,c as tt}from"./chunk-W5QMFEZY.js";import{h as We}from"./chunk-VQSFTT4B.js";import"./chunk-YR7GTH7M.js";import{d as at}from"./chunk-UALTP6H4.js";import"./chunk-34QKBDWM.js";import{E as je,F as Qe,G as Ze,I as qe,K as Q,L as le,a as Rt,b as Ut,c as O,o as Ye,q as Ke,v as A,w as Ce,y as _e}from"./chunk-IHKI3APK.js";import"./chunk-XYXBZEKH.js";import"./chunk-B5QW2GSC.js";import"./chunk-43I6I3SU.js";import"./chunk-P7K7ELYZ.js";import{a as s}from"./chunk-5QL6W6FW.js";import"./chunk-6MYG4HWP.js";import"./chunk-JS2IXPNL.js";import"./chunk-SLLJX5QK.js";import{a as l,c as Fe}from"./chunk-4FHWXBOB.js";var i=Fe(Rt(),1),n=Fe(Ut(),1);var Bt={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"/>'},Et={"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":"يبدو أن هذه بطاقة تعريف أو بطاقة إقامة"},ce={"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"},Vt={"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"},Gt={"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":"رفع صورة"},de={"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"},Ft={"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"},Wt={"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":"انتهت صلاحية هذه الوثيقة. امسح وثيقة سارية.","native.scan.surface":"الحواف غير واضحة. ضع البطاقة على سطح أغمق."},ue={"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.","native.scan.surface":"The edges are hard to see. Put the card on a darker surface."},Xt={"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.","native.scan.surface":"Les bords se voient mal. Posez la carte sur une surface plus sombre."},F,rt=(F=class{constructor(){this.shown=null,this.shownAt=0,this.yielded=null,this.shownPhotos=0}present(t,a,o,r,m=0){(t===null||t.key!==this.yielded)&&(this.yielded=null);let y=this.shown;return t!==null&&this.yielded===null?y?.kind==="problem"&&y.key===t.key&&y.action===t.action?(this.shownPhotos=m,!t.blocking&&a!==null&&r-this.shownAt>=3e3?(this.yielded=t.key,this.show({kind:"hint",key:a,action:null},r,m)):y):this.show({kind:"problem",key:t.key,action:t.action},r,m):y?.kind==="problem"&&t===null&&m===this.shownPhotos&&(o||r-this.shownAt<3e3)?y:a===null?this.show(null,r):y?.kind==="hint"&&y.key===a?y:this.show({kind:"hint",key:a,action:null},r)}show(t,a,o=this.shownPhotos){return this.shown=t,this.shownAt=a,this.shownPhotos=o,t}},l(F,"_e"),F);s(rt,"NoticeBand");var Yt=rt,Kt=["locking","capturing"],W,it=(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 o=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(o!==this.candidate&&(this.candidate=o,this.candidateSince=a),o===this.shown.hint)return;let r=a-this.candidateSince>=(o===null?0:350),m=this.shown.hint===null||a-this.hintShownAt>=2500;r&&m&&(this.shown={...this.shown,hint:o},this.hintShownAt=a)}presentLock(t,a){if(Kt.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 o=t.card;if(o===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 r=this.shown.card;if(r===null){this.shown={...this.shown,card:{...o}};return}let m=.35;this.shown={...this.shown,card:{fill:r.fill+(o.fill-r.fill)*m,offsetX:r.offsetX+(o.offsetX-r.offsetX)*m,offsetY:r.offsetY+(o.offsetY-r.offsetY)*m}}}},l(W,"Ce"),W);s(it,"ScanPresenter");var jt=it,Qt={en:ue,fr:Xt,ar:Wt,es:ue,pt:ue,de:ue},Zt=450,Se=s(e=>(t,a)=>nt(e.strings[t]??Qt[e.locale][t]??"",a),"useScanCopy");function st(e,t){try{return new Intl.DisplayNames([t],{type:"region"}).of(e)??e}catch{return e}}l(st,"$t");s(st,"regionName");function lt(e){let t=e.documentType,a=t===null?"native.doc.introTitle":`native.doc.titleOf.${t}`,o=t!==null&&e.issuer!==null&&We(e.documents,e.issuer).length===1;return{titleKey:a,onlyKey:o?`native.doc.onlyType.${t}`:null}}l(lt,"Ot");s(lt,"introCopy");function Z({name:e}){return(0,n.jsx)("svg",{className:"sekyro-glyph",viewBox:"0 0 24 24",fill:"none","aria-hidden":"true",focusable:"false",dangerouslySetInnerHTML:{__html:Bt[e]}})}l(Z,"me");s(Z,"ScanGlyph");var qt={en:ce,fr:Vt,ar:Et,es:ce,pt:ce,de:ce},Jt={en:de,fr:Ft,ar:Gt,es:de,pt:de,de},en="image/jpeg,image/png,image/heic,image/heif";function B(e){let t=e.strings,a=s(o=>t[o]??Jt[e.locale][o],"text");return{t:s(o=>a(o)??"","t")}}l(B,"G");s(B,"uploadCopy");function ct(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"}l(ct,"Kt");s(ct,"mrzInstruction");function dt(e){return e?.state==="reading"&&e.coach!==void 0&&e.coach!=="holdStill"?`mrz:${e.coach}`:null}l(dt,"Bt");s(dt,"mrzHint");function ut(e){return e==="carte_identite"||e==="passport"||e==="residence_permit"||e==="drivers_license"?`native.scan.showInstead.${e}`:null}l(ut,"Vt");s(ut,"showInsteadKey");var tn={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 he(e){if(e.reason==="unreadable")return"doc.reason_unreadable";let t=e.reason!==void 0?tn[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"?Ke(e.reason):null}l(he,"xe");s(he,"reasonOf");var ht=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 nn({step:e,i18n:t,liveMrz:a,barcodeAssetBaseUrl:o,ageLead:r,...m}){let[y,h]=(0,i.useState)(!1),k=(0,i.useRef)(-1),[g,w]=(0,i.useState)("idle"),x=(0,i.useRef)(null),S=typeof e.uploadDocument=="function",b=S?e.photo?.source??"camera":"camera",M=S&&b!=="camera"&&e.photo?.uploadOffered===!0,[C,E]=(0,i.useState)(null),I=b==="upload"?"upload":b==="choice"?C??e.photo?.pick??"source":"camera",D=g==="sending"?void 0:()=>x.current?.click(),f=s(async V=>{let Y=V.currentTarget.files?.[0];if(V.currentTarget.value="",Y!==void 0){h(!1),w("sending");try{await e.uploadDocument(Y),w("idle")}catch(J){w(J instanceof TypeError&&J.message==="unsupported_file"?"unsupported":"failed")}}},"onFile"),q=M?(0,n.jsx)("input",{ref:x,type:"file",accept:en,hidden:!0,"data-testid":"sekyro-doc-upload","aria-label":B(t).t("doc.uploadTitle"),onChange:l(V=>{f(V)},"onChange")}):null,T=B(t),X=e.photo?.cameraOnPhone===!0;return I==="camera"&&X?(0,n.jsx)(at,{i18n:t,lead:t.t("handoff.lead.document"),refresh:e.refresh,actions:(0,n.jsx)(O,{kind:"ghost",full:!0,onClick:l(()=>E("upload"),"onClick"),children:T.t("doc.source.upload")})}):I==="source"?(0,n.jsx)(ot,{testId:"sekyro-doc-source",title:T.t("doc.source.title"),lead:T.t("doc.source.description"),cameraLabel:X?t.t("capture.source.phone"):T.t("doc.source.camera"),onPhone:X,uploadLabel:T.t("doc.source.upload"),notice:(0,n.jsx)(pe,{step:e,i18n:t}),onCamera:l(()=>E("camera"),"onCamera"),onUpload:l(()=>E("upload"),"onUpload")}):I==="upload"?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(vt,{step:e,i18n:t,ageLead:r===!0,upload:g,offered:M,onPick:l(()=>x.current?.click(),"onPick"),...b==="choice"?{onCamera:s(()=>E("camera"),"onCamera")}:{},...m}),q]}):(0,n.jsxs)(n.Fragment,{children:[y?(0,n.jsx)(yt,{step:e,i18n:t,attempts:k,...a!==void 0?{liveMrz:a}:{},...o!==void 0?{barcodeAssetBaseUrl:o}:{},...M&&D!==void 0?{onUpload:D}:{},onClose:l(()=>h(!1),"onClose")}):(0,n.jsx)(mt,{step:e,i18n:t,ageLead:r===!0,onOpen:l(()=>h(!0),"onOpen"),upload:g,...M&&D!==void 0?{onUpload:D}:{},...m}),q]})}l(nn,"Gn");s(nn,"DocumentCaptureView");function Ne({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:pt(-10,-10,248,t+20,16,30)})]})}l(Ne,"ht");s(Ne,"ScanMark");function pt(e,t,a,o,r,m){let y=Math.min(r,m*.6);return[[e,t,1,1],[e+a,t,-1,1],[e,t+o,1,-1],[e+a,t+o,-1,-1]].map(([h,k,g,w])=>`M${h} ${k+w*m}V${k+w*y}Q${h} ${k} ${h+g*y} ${k}H${h+g*m}`).join("")}l(pt,"Gt");s(pt,"brackets");function mt({step:e,i18n:t,ageLead:a,onOpen:o,onChangeCountry:r,onChangeDocument:m,upload:y,onUpload:h}){let k=Se(t),g=B(t),w=e.documentType==="passport",x=lt(e),S=he(e),b=y==="sending",M=(0,i.useContext)(Qe)?.busy===!0,C=Xe(e.acceptedNationalities,t);return(0,n.jsxs)("section",{className:"sekyro-step sekyro-step--doc-intro","data-testid":"sekyro-document",children:[(0,n.jsx)(Ne,{passport:w}),(0,n.jsx)(Ce,{title:k(x.titleKey)||k("native.doc.introTitle"),lead:a?t.t("doc.ageStepUp"):k("native.doc.introLead")}),x.onlyKey!==null&&e.issuer!==null?(0,n.jsx)("p",{className:"sekyro-text-muted sekyro-doc-only",children:k(x.onlyKey,{country:st(e.issuer,t.locale)})}):null,C!==null?(0,n.jsx)(Q,{tone:"info",children:C}):null,(0,n.jsx)(pe,{step:e,i18n:t}),e.reason!==void 0&&ht.has(e.reason)?null:(0,n.jsxs)("ul",{className:"sekyro-tiprows",children:[(0,n.jsxs)("li",{children:[(0,n.jsx)(A,{name:w?"passport":"card"}),k("native.doc.tip.flat")]}),(0,n.jsxs)("li",{children:[(0,n.jsx)(A,{name:"light"}),k("native.doc.tip.glare")]}),(0,n.jsxs)("li",{children:[(0,n.jsx)(Z,{name:"image"}),k("native.doc.tip.frame")]})]}),(0,n.jsx)(xe,{i18n:t,...m!==void 0?{onChangeDocument:m}:{},...r!==void 0?{onChangeCountry:r}:{}}),(0,n.jsx)(Te,{i18n:t,upload:y}),b?(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:g.t("doc.uploadHint")}):null,(0,n.jsxs)(_e,{children:[(0,n.jsxs)(O,{full:!0,onClick:o,disabled:b||M,children:[(0,n.jsx)(A,{name:"camera"}),k("native.doc.openCamera")]}),h!==void 0?(0,n.jsxs)(O,{full:!0,kind:"ghost",onClick:h,children:[(0,n.jsx)(Z,{name:"image"}),g.t("doc.uploadInstead")]}):null]})]})}l(mt,"Ft");s(mt,"DocumentIntro");function pe({step:e,i18n:t}){let a=he(e);return a===null&&e.reasonHidden===!0?(0,n.jsx)(Q,{tone:"info",children:(0,n.jsx)("span",{children:le(t,e.attemptsRemaining,e.attemptsExhausted)})}):a===null?null:(0,n.jsxs)(Q,{tone:"warning",children:[(0,n.jsx)("span",{children:t.t(a)}),(0,n.jsx)("span",{children:le(t,e.attemptsRemaining,e.attemptsExhausted)})]})}l(pe,"Te");s(pe,"ReasonNotice");function xe({i18n:e,onChangeCountry:t,onChangeDocument:a}){let o=Se(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:o("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]})}l(xe,"ft");s(xe,"ChangeLinks");function Te({i18n:e,upload:t}){return t!=="unsupported"&&t!=="failed"?null:(0,n.jsx)(Q,{tone:"warning",children:(0,n.jsx)("span",{children:B(e).t(t==="unsupported"?"doc.uploadUnsupported":"doc.uploadFailed")})})}l(Te,"yt");s(Te,"UploadNotice");function vt({step:e,i18n:t,ageLead:a,upload:o,offered:r,onPick:m,onCamera:y,onChangeCountry:h,onChangeDocument:k}){let g=B(t),w=o==="sending";return(0,n.jsxs)("section",{className:"sekyro-step","data-testid":"sekyro-doc-upload-screen",children:[(0,n.jsx)(Ne,{passport:e.documentType==="passport"}),(0,n.jsx)(Ce,{title:g.t("doc.uploadTitle"),lead:a?t.t("doc.ageStepUp"):g.t("doc.uploadHint")}),a?(0,n.jsx)("p",{className:"sekyro-text-muted",children:g.t("doc.uploadHint")}):null,(0,n.jsx)(pe,{step:e,i18n:t}),(0,n.jsx)(xe,{i18n:t,...k!==void 0?{onChangeDocument:k}:{},...h!==void 0?{onChangeCountry:h}:{}}),(0,n.jsx)(Te,{i18n:t,upload:o}),w?(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:m,disabled:w||!r||e.attemptsExhausted,children:[(0,n.jsx)(Z,{name:"image"}),g.t("doc.source.upload")]}),y!==void 0?(0,n.jsxs)(O,{full:!0,kind:"ghost",onClick:y,disabled:w,children:[(0,n.jsx)(A,{name:"camera"}),g.t("doc.source.camera")]}):null]})]})}l(vt,"Xt");s(vt,"DocumentUploadScreen");function ze(e,t,a){let o=e*.88,r=o/a;return{x:(e-o)/2,y:t*.42-r/2,w:o,h:r}}l(ze,"ut");s(ze,"guideRect");var an={"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",low_contrast:"native.scan.surface"},on=s(()=>typeof window<"u"&&window.matchMedia?.("(prefers-reduced-motion: reduce)").matches===!0,"reduceMotion");function yt({step:e,i18n:t,liveMrz:a,barcodeAssetBaseUrl:o,onClose:r,attempts:m,onUpload:y}){let h=Se(t),k=(0,i.useContext)(Je),g=(0,i.useRef)(k);g.current=k;let w=(0,i.useRef)(null),x=(0,i.useRef)(null),S=(0,i.useRef)(null),[b,M]=(0,i.useState)("idle"),[C,E]=(0,i.useState)(null),[I,D]=(0,i.useState)(null),[f,q]=(0,i.useState)({w:0,h:0}),[T,X]=(0,i.useState)({hint:null,locking:!1,card:null,manualShutter:!1}),[V,Y]=(0,i.useState)({}),[J,$e]=(0,i.useState)({}),[Me,Pe]=(0,i.useState)(null),[Le,zt]=(0,i.useState)(null),[Ie,He]=(0,i.useState)(0),[me,Oe]=(0,i.useState)(null),[ve,St]=(0,i.useState)(null),[ee,Nt]=(0,i.useState)(0),te=(0,i.useRef)(0);te.current=ee;let[xt,Ae]=(0,i.useState)(0),De=(0,i.useRef)(0),ne=(0,i.useRef)(null);(0,i.useEffect)(()=>{Ae(te.current)},[e.reason,e.attemptsRemaining]);let R=e.documentType==="passport",ae=R?1.42:1.586;je(!0),(0,i.useLayoutEffect)(()=>{let d=w.current;if(d===null)return;let v=s(()=>q({w:d.clientWidth,h:d.clientHeight}),"measure");if(v(),typeof ResizeObserver>"u")return;let p=new ResizeObserver(v);return p.observe(d),()=>p.disconnect()},[]);let c=ze(f.w,f.h,ae);(0,i.useEffect)(()=>{f.w===0||f.h===0||S.current?.setGuide?.({viewAspect:f.w/f.h,rect:{x:c.x/f.w,y:c.y/f.h,width:c.w/f.w,height:c.h/f.h}})},[f.w,f.h,c.x,c.y,c.w,c.h]),(0,i.useEffect)(()=>{let d=x.current;if(d===null)return;let v=e.capture({video:d,...a!==void 0?{liveMrz:a}:{},...o!==void 0?{barcodeAssetBaseUrl:o}:{}});S.current=v,Y({}),$e({}),Pe(null);let p=w.current;if(p!==null&&p.clientWidth>0&&p.clientHeight>0){let u=ze(p.clientWidth,p.clientHeight,ae);v.setGuide?.({viewAspect:p.clientWidth/p.clientHeight,rect:{x:u.x/p.clientWidth,y:u.y/p.clientHeight,width:u.w/p.clientWidth,height:u.h/p.clientHeight}})}let $=new jt,z={scan:null,feedback:null,gate:null,mrz:null},H=s(u=>{z={...z,...u};let _=z.gate?.guide,Dt={phase:z.scan?.phase??"framing",hint:z.feedback?.reticle==="coaching"?z.feedback.key:e.documentType==="drivers_license"?null:dt(z.mrz),card:_?.detected?{fill:_.fill,offsetX:_.offsetX,offsetY:_.offsetY}:null,manualShutter:z.scan?.manualShutter??!1},K=$.present(Dt,performance.now());X(j=>j.hint===K.hint&&j.locking===K.locking&&j.manualShutter===K.manualShutter&&_t(j.card,K.card)?j:K)},"present"),At=[v.on("state",M),v.on("feedback",u=>H({feedback:u})),v.on("gate",u=>H({gate:u})),v.on("scan",u=>{u.captured.length===0&&De.current>0&&Ae(te.current),De.current=u.captured.length,ne.current=(ne.current??u.captured).filter(_=>u.captured.includes(_)),E(u),H({scan:u})}),v.on("captured",u=>{Nt(_=>_+1),Y(_=>({..._,[wt(u.side,R,_)]:u.previewDataUrl})),u.photo!==void 0&&$e(_=>({..._,[u.photo]:u.previewDataUrl})),Pe(u.previewDataUrl),zt(bt(d))}),v.on("error",u=>{D(u);let _=g.current;_!==null&&tt(_,et("document",u,Math.max(0,m.current)))}),v.on("mrz",u=>{u.state==="mismatch"?St({format:u.format??null,at:te.current}):(Oe(u),H({mrz:u}))})];return m.current+=1,v.start().catch(()=>{}),()=>{ne.current=null;for(let u of At)u();v.destroy(),S.current=null}},[e.issuer,e.documentType]);let P=C?.phase??"framing",L=P==="reading"||P==="result",oe=P==="flipCue"||P==="reaskRecto",U=T.locking,Re=C?.captured.length??0;(0,i.useEffect)(()=>{U&&He(d=>d+1)},[U]),(0,i.useEffect)(()=>{Re>0&&He(d=>d+1)},[Re]);let Tt=C?.expected??null;(0,i.useEffect)(()=>{Oe(null)},[Tt]);let ye=oe||L||e.documentType==="drivers_license"?null:ct(me,R),Ue=s(d=>t.strings[d]??qt[t.locale][d],"liveText"),$t=s(d=>d.startsWith("dcv3.")?Ue(d):h(d),"copy"),ke=ye!==null?Ue(ye):h(P==="flipCue"?"doc.flip":P==="reaskRecto"?"doc.reaskRecto":L?"native.scan.reading":P==="locking"||P==="capturing"||U?"native.scan.holdStill":R?"doc.showPage":"doc.showSide"),re=e.browserCheck??null,fe=re!==null&&L,ie=he(e),Be=s(d=>({key:h(d),action:le(t,e.attemptsRemaining,e.attemptsExhausted),blocking:e.reason!==void 0&&ht.has(e.reason)}),"reasonProblem"),Ee=ut(e.documentType),Mt=me?.state==="expired"&&!oe&&!L?{key:h("native.scan.expired"),action:null,blocking:!0}:ve!==null&&ee<=ve.at+1?{key:h(ve.format==="TD3"?"native.scan.seenPassport":"native.scan.seenCard"),action:Ee===null?null:h(Ee),blocking:!0}:C?.notice==="same_face"?{key:h("doc.sameFace"),action:null,blocking:!1}:C?.notice==="reread"?ie!==null?Be(ie):{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}:ie!==null&&ee===xt?Be(ie):null,Pt=T.hint===null?null:$t(an[T.hint]??`dcv2.${T.hint}`),Ve=kt(Mt,Pt,U||P==="capturing"||L,ee),G=T.card,N=c;if(!U&&G!==null&&G.fill>=.45&&G.fill<=1.25&&!on()){let d=c.w*G.fill,v=d/ae,p=c.x+c.w/2+c.w*Math.max(-.25,Math.min(.25,G.offsetX)),$=c.y+c.h/2+c.h*Math.max(-.25,Math.min(.25,G.offsetY));N={x:p-d/2,y:$-v/2,w:d,h:v}}let se=c.w*.045,ge=28,Ge=Math.min(se,ge*.6),Lt=[[N.x,N.y,1,1],[N.x+N.w,N.y,-1,1],[N.x,N.y+N.h,1,-1],[N.x+N.w,N.y+N.h,-1,-1]],It=U?"is-locked":Ve!==null?"is-coaching":"",Ht=R?[{side:"single",label:"doc.progressPage"}]:[{side:"recto",label:"doc.progressFront"},{side:"verso",label:"doc.progressBack"}],Ot=c.y+c.h+16,we={insetInlineStart:c.x,insetBlockStart:c.y,inlineSize:c.w,blockSize:c.h,borderRadius:se};return(0,n.jsx)("section",{className:"sekyro-lm","aria-label":ke,"data-testid":"sekyro-document",children:(0,n.jsxs)("div",{ref:w,className:`sekyro-lm-stage${L?" is-reading":""}${oe?" is-flip":""}`,style:{"--sekyro-guide-w":`${c.w}px`},children:[(0,n.jsx)("video",{ref:x,className:"sekyro-lm-video",playsInline:!0,muted:!0,autoPlay:!0,"aria-hidden":"true",onPointerUp:l(d=>{let v=d.currentTarget,p=v.getBoundingClientRect(),$=Math.max(p.width/(v.videoWidth||1),p.height/(v.videoHeight||1)),z=v.videoWidth*$,H=v.videoHeight*$;z>0&&H>0&&S.current?.focusAt((d.clientX-p.left+(z-p.width)/2)/z,(d.clientY-p.top+(H-p.height)/2)/H)},"onPointerUp")}),f.w>0?(0,n.jsxs)(n.Fragment,{children:[L&&Le!==null?(0,n.jsx)("img",{className:"sekyro-lm-scene",src:Le,alt:""}):null,L&&Me!==null?(0,n.jsx)("img",{className:"sekyro-lm-frozen",src:Me,alt:"",style:we}):null,(0,n.jsxs)("svg",{className:"sekyro-lm-overlay",viewBox:`0 0 ${f.w} ${f.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${f.w}V${f.h}H0Z${Ct(c,se)}`}),(0,n.jsx)("rect",{width:f.w,height:Math.max(0,c.y),fill:"url(#sekyro-lm-top)"}),(0,n.jsx)("rect",{y:c.y+c.h,width:f.w,height:Math.max(0,f.h-c.y-c.h),fill:"url(#sekyro-lm-bottom)"}),(0,n.jsx)("g",{className:`sekyro-lm-brackets ${It}`,children:Lt.map(([d,v,p,$],z)=>(0,n.jsx)("path",{style:{transform:`translate(${d}px, ${v}px) scale(${p}, ${$})`},d:`M0 ${ge}V${Ge}Q0 0 ${Ge} 0H${ge}`},z))}),U?(0,n.jsx)("rect",{className:"sekyro-lm-trace",x:c.x,y:c.y,width:c.w,height:c.h,rx:se,pathLength:"1",style:{animationDuration:`${Zt}ms`}}):null]}),(0,n.jsx)("div",{className:"sekyro-lm-slot",style:we,"aria-hidden":"true",children:L?(0,n.jsx)("span",{className:"sekyro-lm-read is-repeating"}):Ie>0?(0,n.jsx)("span",{className:"sekyro-lm-read"},Ie):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${R?" is-page":""}${me?.state==="valid"?" is-valid":""}`})}):null,(0,n.jsx)("div",{className:"sekyro-lm-instruction",style:{insetBlockStart:c.y-64},children:(0,n.jsx)("div",{role:"status","aria-live":"polite","data-testid":"sekyro-scan-instruction",children:fe?null:(0,n.jsx)(qe,{swapKey:ke,className:"sekyro-lm-line",children:ke})})}),(0,n.jsxs)("div",{className:"sekyro-lm-below",style:{insetBlockStart:Ot,inlineSize:c.w,insetInlineStart:c.x},children:[(0,n.jsx)(ft,{band:Ve}),fe?null:L?(0,n.jsxs)("p",{className:"sekyro-lm-note",children:[(0,n.jsx)("span",{className:"sekyro-lm-spinner","aria-hidden":"true"}),h("native.scan.putDown")]}):oe?(0,n.jsx)("div",{className:`sekyro-lm-flip${P==="reaskRecto"?" is-toFront":""}`,"data-testid":"sekyro-flip-cue","aria-hidden":"true",children:(0,n.jsxs)("span",{className:"sekyro-lm-flip-card",style:{aspectRatio:String(ae)},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:r,children:(0,n.jsx)(A,{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:l(()=>S.current?.setTorch(!C.torch),"onClick"),children:(0,n.jsx)(Z,{name:"flashlight"})}):null]}),I!==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(I.kind==="permission"?"doc.cameraBlockedHint":Ye(I.kind))}),(0,n.jsx)(O,{onClick:l(()=>{D(null),m.current+=1,S.current?.retry()},"onClick"),children:t.t("doc.retryCamera")})]}):null,re!==null&&I===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(re.code==="clock_wrong"?"errors.device_clock":"errors.attestation_invalid")}),(0,n.jsx)(O,{onClick:re.retry,children:t.t("common.retry")})]}):null,T.manualShutter?(0,n.jsx)("button",{type:"button",className:"sekyro-shutter","aria-label":t.t("doc.shutter"),onClick:l(()=>S.current?.shutter(),"onClick")}):null,(0,n.jsx)("ol",{className:"sekyro-lm-tray",children:Ht.map(({side:d,label:v})=>{let p=C?.captured.includes(d)??!1,$=gt(d,C,J,V);return(0,n.jsxs)("li",{className:p?"is-done":void 0,"aria-current":!p&&(R||C?.expected===d)?"step":void 0,children:[p?(0,n.jsxs)("span",{className:"sekyro-lm-thumb",children:[$!==void 0?(0,n.jsx)("img",{src:$,alt:""}):(0,n.jsx)(A,{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),p&&$===void 0&&ne.current?.includes(d)?(0,n.jsx)("span",{className:"sekyro-lm-received",children:h("doc.sideReceived")}):null]},d)})}),y!==void 0?(0,n.jsx)("button",{type:"button",className:"sekyro-lm-upload",onClick:y,children:B(t).t("doc.uploadInstead")}):null,b==="uploading"||b==="checking"?null:(0,n.jsx)(Ze,{onStop:r})]}),!fe&&(b==="uploading"||b==="checking")?(0,n.jsx)("span",{className:"sekyro-visually-hidden",role:"status",children:b==="uploading"?t.t("doc.uploading"):h("native.scan.reading")}):null]})})}l(yt,"Qt");s(yt,"LumiereScan");function kt(e,t,a,o){let r=(0,i.useRef)(null);r.current??(r.current=new Yt);let[m,y]=(0,i.useState)(null),h=(0,i.useRef)({problem:e,hint:t,busy:a,photos:o});h.current={problem:e,hint:t,busy:a,photos:o};let k=e===null?null:`${e.blocking}|${e.key}|${e.action??""}`;return(0,i.useEffect)(()=>{let g=s(()=>{let{problem:x,hint:S,busy:b,photos:M}=h.current;y(r.current?.present(x,S,b,performance.now(),M)??null)},"run");g();let w=setInterval(g,250);return()=>clearInterval(w)},[k,t,a,o]),m}l(kt,"Zt");s(kt,"useNoticeBand");function ft({band:e}){let[t,a]=(0,i.useState)(e);(0,i.useEffect)(()=>{e!==null&&a(e)},[e]);let o=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:o!==null?(0,n.jsxs)("div",{className:"sekyro-notice sekyro-notice--warning","data-kind":o.kind,"aria-hidden":e===null||void 0,children:[(0,n.jsx)("span",{className:"sekyro-notice__icon","aria-hidden":"true",children:(0,n.jsx)(A,{name:"warning"})}),(0,n.jsxs)("div",{className:"sekyro-notice__body",children:[(0,n.jsx)("span",{children:o.key}),o.action!==null&&o.action!==""?(0,n.jsx)("span",{children:o.action}):null]})]}):null})})}l(ft,"Jt");s(ft,"NoticeBandView");function gt(e,t,a,o){if(t?.photos===void 0)return o[e];let r=t.photos[e];return r===void 0?void 0:a[r]}l(gt,"qt");s(gt,"thumbOf");function wt(e,t,a){return t?"single":e==="recto"||e==="verso"?e:a.recto===void 0?"recto":"verso"}l(wt,"en");s(wt,"slotOf");function Ct({x:e,y:t,w:a,h:o},r){return`M${e+r} ${t}H${e+a-r}Q${e+a} ${t} ${e+a} ${t+r}V${t+o-r}Q${e+a} ${t+o} ${e+a-r} ${t+o}H${e+r}Q${e} ${t+o} ${e} ${t+o-r}V${t+r}Q${e} ${t} ${e+r} ${t}Z`}l(Ct,"tn");s(Ct,"roundedRect");var be=.004;function _t(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}l(_t,"nn");s(_t,"sameCard");function bt(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 o=document.createElement("canvas");o.width=t,o.height=a;let r=o.getContext("2d");return r===null?null:(r.drawImage(e,0,0,t,a),o.toDataURL("image/jpeg",.7))}catch{return null}}l(bt,"on");s(bt,"sceneSnapshot");export{nn as DocumentCaptureView,Zt as LOCK_TRACE_MS,en as UPLOAD_ACCEPT,ze as guideRect,lt as introCopy,dt as mrzHint,ct as mrzInstruction,_t as sameCard,ut as showInsteadKey,wt as slotOf,gt as thumbOf};
@@ -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-X7U4LD32.js";import{a as q}from"./chunk-UJ2FDGWQ.js";import{a as w}from"./chunk-EAHT3Y3Z.js";import{h as T,i as A}from"./chunk-XXYPLLFI.js";import"./chunk-TD2XP34G.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-QVU5SNFG.js";import"./chunk-75QP4SUF.js";import"./chunk-SX373VNU.js";import"./chunk-VHJIEZ5D.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};
1
+ "use client";import{a as O,b as v,c as W}from"./chunk-YVQ6LFN4.js";import{a as q,b as J,c as K}from"./chunk-E7S6A26U.js";import{a as z}from"./chunk-SS7SVE6O.js";import{a as w}from"./chunk-VD2BADU2.js";import{f as T,g as A}from"./chunk-VQSFTT4B.js";import"./chunk-YR7GTH7M.js";import{H as j,K as E,a as oe,b as ce,c as N,t as U,y as R}from"./chunk-IHKI3APK.js";import"./chunk-XYXBZEKH.js";import"./chunk-B5QW2GSC.js";import"./chunk-43I6I3SU.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 u,c as P}from"./chunk-4FHWXBOB.js";var a=P(oe(),1),i=P(ce(),1);var Q={en:v,fr:W,ar:O,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"),me=o(e=>`${Math.floor(e/60)}:${String(e%60).padStart(2,"0")}`,"mmss");function ue({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]=q(e.reason==="eid_code_invalid",e.codeAttemptsRemaining??0,()=>_("")),m=o(async n=>{D(!0),p(null);try{await n()}catch(t){p(z(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,m(()=>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&&m(()=>e.verify(f));return}if(e.identifierBound){m(()=>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")}m(()=>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:u(()=>{m(()=>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:u(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:me(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:u(()=>{m(()=>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:u(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")})})]})]})}u(ue,"Ae");o(ue,"EidView");export{ue as EidView};
@@ -1 +1 @@
1
- "use client";import{a as J,b as K,c as Q}from"./chunk-X7U4LD32.js";import{a as B}from"./chunk-UJ2FDGWQ.js";import{a as G}from"./chunk-EAHT3Y3Z.js";import"./chunk-XXYPLLFI.js";import"./chunk-TD2XP34G.js";import{B as j,I as U,L as y,M as Y,a as me,b as pe,c as x,w as P,y as T}from"./chunk-QVU5SNFG.js";import{G as F}from"./chunk-75QP4SUF.js";import"./chunk-SX373VNU.js";import"./chunk-VHJIEZ5D.js";import"./chunk-P7K7ELYZ.js";import{a as r}from"./chunk-5QL6W6FW.js";import"./chunk-6MYG4HWP.js";import"./chunk-JS2IXPNL.js";import"./chunk-SLLJX5QK.js";import{a as p,c as W}from"./chunk-4FHWXBOB.js";var s=W(me(),1),e=W(pe(),1);var ce={"emailOtp.reason_otp_daily_cap_reached":"لا يمكننا إرسال رمز إلى بريدك الإلكتروني اليوم. اختر طريقة أخرى للتحقق إن كانت متاحة، أو حاول مرة أخرى لاحقًا.","emailOtp.reason_payment_method_required":"طريقة التحقق هذه غير متاحة حاليًا. اختر طريقة أخرى للتحقق إن كانت متاحة.","emailOtp.reason_spend_cap_reached":"طريقة التحقق هذه غير متاحة حاليًا. اختر طريقة أخرى للتحقق إن كانت متاحة.","emailOtp.reason_insufficient_balance":"طريقة التحقق هذه غير متاحة حاليًا. اختر طريقة أخرى للتحقق إن كانت متاحة.","emailOtp.reason_account_verification_required":"طريقة التحقق هذه غير متاحة حاليًا. اختر طريقة أخرى للتحقق إن كانت متاحة.","emailOtp.sendTitle":"تحقّق من بريدك الإلكتروني","emailOtp.sendDescription":"سنرسل إليك عبر البريد الإلكتروني رمزًا يُستخدم مرة واحدة لتأكيد أن هذا العنوان يخصّك","emailOtp.prefilledNotice":"سنرسل رمز تحقّق إلى بريدك الإلكتروني المسجّل.","emailOtp.emailLabel":"البريد الإلكتروني","emailOtp.emailHelper":"سنرسل رمزًا يُستخدم مرة واحدة إلى هذا العنوان","emailOtp.emailPlaceholder":"عنوان بريدك الإلكتروني","emailOtp.emailInvalid":"أدخل عنوان بريد إلكتروني صالحًا","emailOtp.send":"أرسل لي رمزًا عبر البريد الإلكتروني","emailOtp.verifyTitle":"أدخل الرمز","emailOtp.verifyDescription":"أدخل الرمز المكوّن من 6 أرقام الذي أرسلناه إلى بريدك الإلكتروني لإتمام التحقّق من عنوانك","emailOtp.sentTo":"أرسلنا رمزًا مكوّنًا من 6 أرقام إلى {email}","emailOtp.codeLabel":"رمز التحقّق","emailOtp.codeHelper":"أدخل الرمز المكوّن من 6 أرقام الوارد في الرسالة","emailOtp.verify":"تحقّق من الرمز","emailOtp.resend":"إعادة إرسال الرمز","emailOtp.resendIn":"إعادة إرسال الرمز خلال {seconds} ثانية","emailOtp.expiresIn":"ينتهي الرمز خلال {time}","emailOtp.expired":"انتهت صلاحية الرمز. أعد إرسال رمز جديد","emailOtp.reason_otp_mismatch":"الرمز غير صحيح. تحقّق منه وأعد إدخاله","emailOtp.reason_otp_expired":"انتهت صلاحية الرمز. أعد إرسال رمز جديد للمتابعة","emailOtp.reason_otp_send_failed":"تعذّر إرسال الرسالة. أعد المحاولة لاحقًا. إذا تكرر ذلك، فتواصل مع الجهة التي طلبت منك التحقق.","emailOtp.reason_otp_rate_limited":"طُلبت رموز كثيرة لهذا العنوان. أعد المحاولة لاحقًا أو أدخل عنوانًا آخر.","emailOtp.reason_email_invalid":"لا يمكننا الإرسال إلى هذا العنوان. تحقّق منه أو أدخل عنوانًا آخر","emailOtp.reason_email_disposable":"استخدم بريدًا إلكترونيًا دائمًا، وليس عنوانًا مؤقتًا","emailOtp.changeEmail":"تغيير البريد الإلكتروني","emailOtp.backToCode":"العودة إلى الرمز","emailOtp.reason_otp_resend_limit":"لا يمكنك طلب رموز أخرى. أدخل آخر رمز وصلك"},b={"emailOtp.reason_otp_daily_cap_reached":"We can't email you a code today. Choose another way to verify if one is offered, or try again later.","emailOtp.reason_payment_method_required":"This verification method is not available right now. Choose another way to verify if one is offered.","emailOtp.reason_spend_cap_reached":"This verification method is not available right now. Choose another way to verify if one is offered.","emailOtp.reason_insufficient_balance":"This verification method is not available right now. Choose another way to verify if one is offered.","emailOtp.reason_account_verification_required":"This verification method is not available right now. Choose another way to verify if one is offered.","emailOtp.sendTitle":"Verify your email address","emailOtp.sendDescription":"We'll email you a one-time code to confirm this address is yours","emailOtp.prefilledNotice":"We'll send a verification code to your registered email address.","emailOtp.emailLabel":"Email address","emailOtp.emailHelper":"We'll send a one-time code to this address","emailOtp.emailPlaceholder":"Your email address","emailOtp.emailInvalid":"Enter a valid email address","emailOtp.send":"Email me a code","emailOtp.verifyTitle":"Enter the code","emailOtp.verifyDescription":"Type the 6-digit code we emailed you to finish verifying your address","emailOtp.sentTo":"We sent a 6-digit code to {email}","emailOtp.codeLabel":"Verification code","emailOtp.codeHelper":"Enter the 6-digit code from the email","emailOtp.verify":"Verify code","emailOtp.resend":"Resend code","emailOtp.resendIn":"Resend code in {seconds}s","emailOtp.expiresIn":"Code expires in {time}","emailOtp.expired":"That code has expired. Resend a new one","emailOtp.reason_otp_mismatch":"That code was incorrect. Check it and enter it again","emailOtp.reason_otp_expired":"That code has expired. Resend a new code to continue","emailOtp.reason_otp_send_failed":"We couldn't send the email. Try again later. If it keeps happening, contact the organization that asked you to verify.","emailOtp.reason_otp_rate_limited":"Too many codes were requested for this address. Try again later, or enter another address.","emailOtp.reason_email_invalid":"We can't send to this address. Check it or enter another one","emailOtp.reason_email_disposable":"Use a permanent email address, not a temporary one","emailOtp.changeEmail":"Change email","emailOtp.backToCode":"Back to code","emailOtp.reason_otp_resend_limit":"You can't get more codes. Enter the last code you received"},ue={"emailOtp.reason_otp_daily_cap_reached":"Nous ne pouvons pas vous envoyer de code par e-mail aujourd'hui. Choisissez une autre méthode si elle est proposée, ou réessayez plus tard.","emailOtp.reason_payment_method_required":"Cette méthode de vérification n'est pas disponible pour le moment. Choisissez une autre méthode si elle est proposée.","emailOtp.reason_spend_cap_reached":"Cette méthode de vérification n'est pas disponible pour le moment. Choisissez une autre méthode si elle est proposée.","emailOtp.reason_insufficient_balance":"Cette méthode de vérification n'est pas disponible pour le moment. Choisissez une autre méthode si elle est proposée.","emailOtp.reason_account_verification_required":"Cette méthode de vérification n'est pas disponible pour le moment. Choisissez une autre méthode si elle est proposée.","emailOtp.sendTitle":"Vérifiez votre e-mail","emailOtp.sendDescription":"Nous vous enverrons par e-mail un code à usage unique pour confirmer que cette adresse vous appartient","emailOtp.prefilledNotice":"Nous enverrons un code de vérification à votre adresse e-mail enregistrée.","emailOtp.emailLabel":"Adresse e-mail","emailOtp.emailHelper":"Nous enverrons un code à usage unique à cette adresse","emailOtp.emailPlaceholder":"Votre adresse e-mail","emailOtp.emailInvalid":"Saisissez une adresse e-mail valide","emailOtp.send":"M'envoyer un code par e-mail","emailOtp.verifyTitle":"Saisissez le code","emailOtp.verifyDescription":"Saisissez le code à 6 chiffres que nous vous avons envoyé par e-mail pour finaliser la vérification de votre adresse","emailOtp.sentTo":"Nous avons envoyé un code à 6 chiffres à {email}","emailOtp.codeLabel":"Code de vérification","emailOtp.codeHelper":"Saisissez le code à 6 chiffres reçu par e-mail","emailOtp.verify":"Vérifier le code","emailOtp.resend":"Renvoyer le code","emailOtp.resendIn":"Renvoyer le code dans {seconds} s","emailOtp.expiresIn":"Le code expire dans {time}","emailOtp.expired":"Ce code a expiré. Renvoyez-en un nouveau","emailOtp.reason_otp_mismatch":"Ce code est incorrect. Vérifiez-le et saisissez-le à nouveau","emailOtp.reason_otp_expired":"Ce code a expiré. Renvoyez un nouveau code pour continuer","emailOtp.reason_otp_send_failed":"Nous n'avons pas pu envoyer l'e-mail. Réessayez plus tard. Si le problème continue, contactez l'organisation qui vous a demandé de vous vérifier.","emailOtp.reason_otp_rate_limited":"Trop de codes ont été demandés pour cette adresse. Réessayez plus tard ou saisissez une autre adresse.","emailOtp.reason_email_invalid":"Nous ne pouvons pas envoyer à cette adresse. Vérifiez-la ou saisissez-en une autre","emailOtp.reason_email_disposable":"Utilisez une adresse e-mail permanente, pas une adresse temporaire","emailOtp.changeEmail":"Changer d'adresse e-mail","emailOtp.backToCode":"Retour au code","emailOtp.reason_otp_resend_limit":"Vous ne pouvez plus demander de code. Saisissez le dernier code reçu"},he={en:b,fr:ue,ar:ce,es:b,pt:b,de:b},X=r((a,n,h)=>{if(a===void 0)return 0;let _=Date.parse(a)-n;return Number.isFinite(_)?Math.min(h,Math.max(0,Math.ceil(_/1e3))):0},"secondsUntil"),_e=600,Oe=60,fe=r(a=>`${Math.floor(a/60)}:${String(a%60).padStart(2,"0")}`,"mmss"),Z=new Set(["otp_expired","otp_send_failed","otp_rate_limited","otp_resend_limit","email_invalid","email_disposable","otp_daily_cap_reached","payment_method_required","spend_cap_reached","insufficient_balance","account_verification_required"]);function ve({step:a,i18n:n,className:h,defaultEmail:_="",onError:ee}){let i=r((t,o)=>G(n.strings[t]??he[n.locale][t],o),"t"),[N,ae]=(0,s.useState)(_),[O,z]=(0,s.useState)(""),[l,E]=(0,s.useState)(!1),[w,q]=(0,s.useState)(null),[g,c]=(0,s.useState)(!1),[I,ie]=(0,s.useState)(null),u=(0,s.useRef)(null),f=a.phase==="verify",m=f&&!g,R=Q(f),d=(0,s.useId)(),[te,se]=J(a.reason==="otp_mismatch",a.attemptsRemaining,()=>z("")),V=f?a.codeExpiresAt??"sent":null;(0,s.useEffect)(()=>{V!==null&&(c(!1),u.current!==null&&!Z.has(a.reason??"")&&ie(u.current),u.current=null)},[V]);let S=r(async t=>{E(!0),q(null);try{await t()}catch(o){q(o instanceof F&&o.field==="email"?i("emailOtp.emailInvalid"):n.t(B(o,n.strings))),ee?.(o)}finally{E(!1)}},"run"),$=r(t=>{let o=a.needsEmail?t?I:N.trim():null;u.current=o,S(async()=>{try{await a.send(o!==null?{email:o}:{})}catch(de){throw u.current=null,de}})},"send"),D=r(t=>{S(()=>a.verify(t))},"submitCode"),oe=r(t=>{t.preventDefault(),m?D(O):$(!1)},"onSubmit"),k=X(a.codeExpiresAt,R,_e),C=X(a.resendAvailableAt,R,Oe),v=m&&a.codeExpiresAt!==void 0&&k===0,L=a.needsEmail&&!a.attemptsExhausted,H=f&&(a.codeExpiresAt===void 0||k>0),A=m&&L?()=>c(!0):g&&H?()=>c(!1):null;j(A===null?null:l?()=>{}:A);let[le,re]=i("emailOtp.sentTo").split("{email}"),M=a.context.simulation?.otpCode,ne=a.reason==="otp_mismatch"?(0,e.jsxs)(y,{tone:"danger",children:[(0,e.jsx)("span",{children:i("emailOtp.reason_otp_mismatch")}),(0,e.jsx)("span",{children:Y(n,a.attemptsRemaining,a.attemptsExhausted)})]}):a.reason!==void 0&&Z.has(a.reason)?(0,e.jsx)(y,{tone:"warning",children:(0,e.jsx)("span",{children:i(`emailOtp.reason_${a.reason}`)})}):null;return(0,e.jsxs)("form",{className:`sekyro-step sekyro-otp${h?` ${h}`:""}`,"aria-labelledby":d,onSubmit:oe,noValidate:!0,children:[(0,e.jsx)(P,{id:d,title:i(m?"emailOtp.verifyTitle":"emailOtp.sendTitle"),lead:m&&M!==void 0?(0,e.jsx)(U,{template:n.t("sandbox.otpHint"),code:M}):m?(0,e.jsxs)(e.Fragment,{children:[le,(0,e.jsx)("bdi",{dir:"ltr",className:"sekyro-mono",children:I??a.sentToMasked}),re]}):i("emailOtp.sendDescription")}),ne,w!==null?(0,e.jsx)(y,{tone:"danger",children:(0,e.jsx)("span",{children:w})}):null,m?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsxs)("div",{className:"sekyro-field",children:[(0,e.jsx)("label",{className:"sekyro-label",htmlFor:`${d}-code`,children:i("emailOtp.codeLabel")}),(0,e.jsx)(K,{id:`${d}-code`,value:O,invalid:te,onChange:p(t=>{t!==""&&se(),z(t),t.length===6&&O.length!==6&&!l&&!a.attemptsExhausted&&D(t)},"onChange")}),(0,e.jsx)("span",{className:`sekyro-help sekyro-otp-expiry${v?" is-danger":""}`,"aria-hidden":!v||void 0,children:v?i("emailOtp.expired"):i("emailOtp.expiresIn",{time:fe(k)})})]}),(0,e.jsx)("span",{className:"sekyro-visually-hidden",role:"status","aria-live":"polite",children:v?i("emailOtp.expired"):""}),(0,e.jsxs)(T,{children:[(0,e.jsx)(x,{type:"submit",full:!0,disabled:l||O.length!==6,"aria-busy":l||void 0,children:i("emailOtp.verify")}),(0,e.jsxs)("div",{className:"sekyro-resend-row",children:[(0,e.jsx)("button",{type:"button",className:"sekyro-link sekyro-resend",disabled:l||C>0,onClick:p(()=>$(!0),"onClick"),children:C>0?i("emailOtp.resendIn",{seconds:C}):i("emailOtp.resend")}),L?(0,e.jsx)("button",{type:"button",className:"sekyro-link sekyro-resend",disabled:l,onClick:p(()=>c(!0),"onClick"),"data-testid":"sekyro-otp-change",children:i("emailOtp.changeEmail")}):null]})]})]}):(0,e.jsxs)(e.Fragment,{children:[a.needsEmail?(0,e.jsxs)("div",{className:"sekyro-field",children:[(0,e.jsx)("label",{className:"sekyro-label",htmlFor:`${d}-email`,children:i("emailOtp.emailLabel")}),(0,e.jsx)("input",{id:`${d}-email`,className:"sekyro-input",type:"email",dir:"ltr",inputMode:"email",autoComplete:"email",autoCapitalize:"none",spellCheck:!1,placeholder:i("emailOtp.emailPlaceholder"),value:N,"aria-describedby":`${d}-email-help`,onChange:p(t=>ae(t.target.value),"onChange")}),(0,e.jsx)("span",{id:`${d}-email-help`,className:"sekyro-help",children:i("emailOtp.emailHelper")})]}):(0,e.jsx)("p",{className:"sekyro-text-muted",children:i("emailOtp.prefilledNotice")}),(0,e.jsxs)(T,{children:[(0,e.jsx)(x,{type:"submit",full:!0,disabled:l,"aria-busy":l||void 0,children:i("emailOtp.send")}),g&&H?(0,e.jsx)("button",{type:"button",className:"sekyro-link sekyro-resend",disabled:l,onClick:p(()=>c(!1),"onClick"),"data-testid":"sekyro-otp-back-to-code",children:i("emailOtp.backToCode")}):null]})]})]})}p(ve,"Ve");r(ve,"EmailOtpView");export{ve as EmailOtpView};
1
+ "use client";import{a as G,b as J,c as K}from"./chunk-E7S6A26U.js";import{a as Y}from"./chunk-SS7SVE6O.js";import{a as B}from"./chunk-VD2BADU2.js";import"./chunk-VQSFTT4B.js";import"./chunk-YR7GTH7M.js";import{A as P,H as j,K as y,L as U,a as de,b as me,c as x,w as F,y as T}from"./chunk-IHKI3APK.js";import{G as W}from"./chunk-XYXBZEKH.js";import"./chunk-B5QW2GSC.js";import"./chunk-43I6I3SU.js";import"./chunk-P7K7ELYZ.js";import{a as r}from"./chunk-5QL6W6FW.js";import"./chunk-6MYG4HWP.js";import"./chunk-JS2IXPNL.js";import"./chunk-SLLJX5QK.js";import{a as p,c as M}from"./chunk-4FHWXBOB.js";var s=M(de(),1),e=M(me(),1);var pe={"emailOtp.reason_otp_daily_cap_reached":"لا يمكننا إرسال رمز إلى بريدك الإلكتروني اليوم. اختر طريقة أخرى للتحقق إن كانت متاحة، أو حاول مرة أخرى لاحقًا.","emailOtp.reason_payment_method_required":"طريقة التحقق هذه غير متاحة حاليًا. اختر طريقة أخرى للتحقق إن كانت متاحة.","emailOtp.reason_spend_cap_reached":"طريقة التحقق هذه غير متاحة حاليًا. اختر طريقة أخرى للتحقق إن كانت متاحة.","emailOtp.reason_insufficient_balance":"طريقة التحقق هذه غير متاحة حاليًا. اختر طريقة أخرى للتحقق إن كانت متاحة.","emailOtp.reason_account_verification_required":"طريقة التحقق هذه غير متاحة حاليًا. اختر طريقة أخرى للتحقق إن كانت متاحة.","emailOtp.sendTitle":"تحقّق من بريدك الإلكتروني","emailOtp.sendDescription":"سنرسل إليك عبر البريد الإلكتروني رمزًا يُستخدم مرة واحدة لتأكيد أن هذا العنوان يخصّك","emailOtp.prefilledNotice":"سنرسل رمز تحقّق إلى بريدك الإلكتروني المسجّل.","emailOtp.emailLabel":"البريد الإلكتروني","emailOtp.emailHelper":"سنرسل رمزًا يُستخدم مرة واحدة إلى هذا العنوان","emailOtp.emailPlaceholder":"عنوان بريدك الإلكتروني","emailOtp.emailInvalid":"أدخل عنوان بريد إلكتروني صالحًا","emailOtp.send":"أرسل لي رمزًا عبر البريد الإلكتروني","emailOtp.verifyTitle":"أدخل الرمز","emailOtp.verifyDescription":"أدخل الرمز المكوّن من 6 أرقام الذي أرسلناه إلى بريدك الإلكتروني لإتمام التحقّق من عنوانك","emailOtp.sentTo":"أرسلنا رمزًا مكوّنًا من 6 أرقام إلى {email}","emailOtp.codeLabel":"رمز التحقّق","emailOtp.codeHelper":"أدخل الرمز المكوّن من 6 أرقام الوارد في الرسالة","emailOtp.verify":"تحقّق من الرمز","emailOtp.resend":"إعادة إرسال الرمز","emailOtp.resendIn":"إعادة إرسال الرمز خلال {seconds} ثانية","emailOtp.expiresIn":"ينتهي الرمز خلال {time}","emailOtp.expired":"انتهت صلاحية الرمز. أعد إرسال رمز جديد","emailOtp.reason_otp_mismatch":"الرمز غير صحيح. تحقّق منه وأعد إدخاله","emailOtp.reason_otp_expired":"انتهت صلاحية الرمز. أعد إرسال رمز جديد للمتابعة","emailOtp.reason_otp_send_failed":"تعذّر إرسال الرسالة. أعد المحاولة لاحقًا. إذا تكرر ذلك، فتواصل مع الجهة التي طلبت منك التحقق.","emailOtp.reason_otp_rate_limited":"طُلبت رموز كثيرة لهذا العنوان. أعد المحاولة لاحقًا أو أدخل عنوانًا آخر.","emailOtp.reason_email_invalid":"لا يمكننا الإرسال إلى هذا العنوان. تحقّق منه أو أدخل عنوانًا آخر","emailOtp.reason_email_disposable":"استخدم بريدًا إلكترونيًا دائمًا، وليس عنوانًا مؤقتًا","emailOtp.changeEmail":"تغيير البريد الإلكتروني","emailOtp.backToCode":"العودة إلى الرمز","emailOtp.reason_otp_resend_limit":"لا يمكنك طلب رموز أخرى. أدخل آخر رمز وصلك"},b={"emailOtp.reason_otp_daily_cap_reached":"We can't email you a code today. Choose another way to verify if one is offered, or try again later.","emailOtp.reason_payment_method_required":"This verification method is not available right now. Choose another way to verify if one is offered.","emailOtp.reason_spend_cap_reached":"This verification method is not available right now. Choose another way to verify if one is offered.","emailOtp.reason_insufficient_balance":"This verification method is not available right now. Choose another way to verify if one is offered.","emailOtp.reason_account_verification_required":"This verification method is not available right now. Choose another way to verify if one is offered.","emailOtp.sendTitle":"Verify your email address","emailOtp.sendDescription":"We'll email you a one-time code to confirm this address is yours","emailOtp.prefilledNotice":"We'll send a verification code to your registered email address.","emailOtp.emailLabel":"Email address","emailOtp.emailHelper":"We'll send a one-time code to this address","emailOtp.emailPlaceholder":"Your email address","emailOtp.emailInvalid":"Enter a valid email address","emailOtp.send":"Email me a code","emailOtp.verifyTitle":"Enter the code","emailOtp.verifyDescription":"Type the 6-digit code we emailed you to finish verifying your address","emailOtp.sentTo":"We sent a 6-digit code to {email}","emailOtp.codeLabel":"Verification code","emailOtp.codeHelper":"Enter the 6-digit code from the email","emailOtp.verify":"Verify code","emailOtp.resend":"Resend code","emailOtp.resendIn":"Resend code in {seconds}s","emailOtp.expiresIn":"Code expires in {time}","emailOtp.expired":"That code has expired. Resend a new one","emailOtp.reason_otp_mismatch":"That code was incorrect. Check it and enter it again","emailOtp.reason_otp_expired":"That code has expired. Resend a new code to continue","emailOtp.reason_otp_send_failed":"We couldn't send the email. Try again later. If it keeps happening, contact the organization that asked you to verify.","emailOtp.reason_otp_rate_limited":"Too many codes were requested for this address. Try again later, or enter another address.","emailOtp.reason_email_invalid":"We can't send to this address. Check it or enter another one","emailOtp.reason_email_disposable":"Use a permanent email address, not a temporary one","emailOtp.changeEmail":"Change email","emailOtp.backToCode":"Back to code","emailOtp.reason_otp_resend_limit":"You can't get more codes. Enter the last code you received"},ce={"emailOtp.reason_otp_daily_cap_reached":"Nous ne pouvons pas vous envoyer de code par e-mail aujourd'hui. Choisissez une autre méthode si elle est proposée, ou réessayez plus tard.","emailOtp.reason_payment_method_required":"Cette méthode de vérification n'est pas disponible pour le moment. Choisissez une autre méthode si elle est proposée.","emailOtp.reason_spend_cap_reached":"Cette méthode de vérification n'est pas disponible pour le moment. Choisissez une autre méthode si elle est proposée.","emailOtp.reason_insufficient_balance":"Cette méthode de vérification n'est pas disponible pour le moment. Choisissez une autre méthode si elle est proposée.","emailOtp.reason_account_verification_required":"Cette méthode de vérification n'est pas disponible pour le moment. Choisissez une autre méthode si elle est proposée.","emailOtp.sendTitle":"Vérifiez votre e-mail","emailOtp.sendDescription":"Nous vous enverrons par e-mail un code à usage unique pour confirmer que cette adresse vous appartient","emailOtp.prefilledNotice":"Nous enverrons un code de vérification à votre adresse e-mail enregistrée.","emailOtp.emailLabel":"Adresse e-mail","emailOtp.emailHelper":"Nous enverrons un code à usage unique à cette adresse","emailOtp.emailPlaceholder":"Votre adresse e-mail","emailOtp.emailInvalid":"Saisissez une adresse e-mail valide","emailOtp.send":"M'envoyer un code par e-mail","emailOtp.verifyTitle":"Saisissez le code","emailOtp.verifyDescription":"Saisissez le code à 6 chiffres que nous vous avons envoyé par e-mail pour finaliser la vérification de votre adresse","emailOtp.sentTo":"Nous avons envoyé un code à 6 chiffres à {email}","emailOtp.codeLabel":"Code de vérification","emailOtp.codeHelper":"Saisissez le code à 6 chiffres reçu par e-mail","emailOtp.verify":"Vérifier le code","emailOtp.resend":"Renvoyer le code","emailOtp.resendIn":"Renvoyer le code dans {seconds} s","emailOtp.expiresIn":"Le code expire dans {time}","emailOtp.expired":"Ce code a expiré. Renvoyez-en un nouveau","emailOtp.reason_otp_mismatch":"Ce code est incorrect. Vérifiez-le et saisissez-le à nouveau","emailOtp.reason_otp_expired":"Ce code a expiré. Renvoyez un nouveau code pour continuer","emailOtp.reason_otp_send_failed":"Nous n'avons pas pu envoyer l'e-mail. Réessayez plus tard. Si le problème continue, contactez l'organisation qui vous a demandé de vous vérifier.","emailOtp.reason_otp_rate_limited":"Trop de codes ont été demandés pour cette adresse. Réessayez plus tard ou saisissez une autre adresse.","emailOtp.reason_email_invalid":"Nous ne pouvons pas envoyer à cette adresse. Vérifiez-la ou saisissez-en une autre","emailOtp.reason_email_disposable":"Utilisez une adresse e-mail permanente, pas une adresse temporaire","emailOtp.changeEmail":"Changer d'adresse e-mail","emailOtp.backToCode":"Retour au code","emailOtp.reason_otp_resend_limit":"Vous ne pouvez plus demander de code. Saisissez le dernier code reçu"},ue={en:b,fr:ce,ar:pe,es:b,pt:b,de:b},Q=r((a,n,h)=>{if(a===void 0)return 0;let _=Date.parse(a)-n;return Number.isFinite(_)?Math.min(h,Math.max(0,Math.ceil(_/1e3))):0},"secondsUntil"),he=600,_e=60,Oe=r(a=>`${Math.floor(a/60)}:${String(a%60).padStart(2,"0")}`,"mmss"),X=new Set(["otp_expired","otp_send_failed","otp_rate_limited","otp_resend_limit","email_invalid","email_disposable","otp_daily_cap_reached","payment_method_required","spend_cap_reached","insufficient_balance","account_verification_required"]);function fe({step:a,i18n:n,className:h,defaultEmail:_="",onError:Z}){let i=r((t,o)=>B(n.strings[t]??ue[n.locale][t],o),"t"),[N,ee]=(0,s.useState)(_),[O,z]=(0,s.useState)(""),[l,E]=(0,s.useState)(!1),[w,q]=(0,s.useState)(null),[g,c]=(0,s.useState)(!1),[I,ae]=(0,s.useState)(null),u=(0,s.useRef)(null),f=a.phase==="verify",m=f&&!g,R=K(f),d=(0,s.useId)(),[ie,te]=G(a.reason==="otp_mismatch",a.attemptsRemaining,()=>z("")),V=f?a.codeExpiresAt??"sent":null;(0,s.useEffect)(()=>{V!==null&&(c(!1),u.current!==null&&!X.has(a.reason??"")&&ae(u.current),u.current=null)},[V]);let S=r(async t=>{E(!0),q(null);try{await t()}catch(o){q(o instanceof W&&o.field==="email"?i("emailOtp.emailInvalid"):n.t(Y(o,n.strings))),Z?.(o)}finally{E(!1)}},"run"),$=r(t=>{let o=a.needsEmail?t?I:N.trim():null;u.current=o,S(async()=>{try{await a.send(o!==null?{email:o}:{})}catch(ne){throw u.current=null,ne}})},"send"),D=r(t=>{S(()=>a.verify(t))},"submitCode"),se=r(t=>{t.preventDefault(),m?D(O):$(!1)},"onSubmit"),k=Q(a.codeExpiresAt,R,he),C=Q(a.resendAvailableAt,R,_e),v=m&&a.codeExpiresAt!==void 0&&k===0,L=a.needsEmail&&!a.attemptsExhausted,H=f&&(a.codeExpiresAt===void 0||k>0);P(m&&L?()=>c(!0):g&&H?()=>c(!1):null,l);let[oe,le]=i("emailOtp.sentTo").split("{email}"),A=a.context.simulation?.otpCode,re=a.reason==="otp_mismatch"?(0,e.jsxs)(y,{tone:"danger",children:[(0,e.jsx)("span",{children:i("emailOtp.reason_otp_mismatch")}),(0,e.jsx)("span",{children:U(n,a.attemptsRemaining,a.attemptsExhausted)})]}):a.reason!==void 0&&X.has(a.reason)?(0,e.jsx)(y,{tone:"warning",children:(0,e.jsx)("span",{children:i(`emailOtp.reason_${a.reason}`)})}):null;return(0,e.jsxs)("form",{className:`sekyro-step sekyro-otp${h?` ${h}`:""}`,"aria-labelledby":d,onSubmit:se,noValidate:!0,children:[(0,e.jsx)(F,{id:d,title:i(m?"emailOtp.verifyTitle":"emailOtp.sendTitle"),lead:m&&A!==void 0?(0,e.jsx)(j,{template:n.t("sandbox.otpHint"),code:A}):m?(0,e.jsxs)(e.Fragment,{children:[oe,(0,e.jsx)("bdi",{dir:"ltr",className:"sekyro-mono",children:I??a.sentToMasked}),le]}):i("emailOtp.sendDescription")}),re,w!==null?(0,e.jsx)(y,{tone:"danger",children:(0,e.jsx)("span",{children:w})}):null,m?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsxs)("div",{className:"sekyro-field",children:[(0,e.jsx)("label",{className:"sekyro-label",htmlFor:`${d}-code`,children:i("emailOtp.codeLabel")}),(0,e.jsx)(J,{id:`${d}-code`,value:O,invalid:ie,onChange:p(t=>{t!==""&&te(),z(t),t.length===6&&O.length!==6&&!l&&!a.attemptsExhausted&&D(t)},"onChange")}),(0,e.jsx)("span",{className:`sekyro-help sekyro-otp-expiry${v?" is-danger":""}`,"aria-hidden":!v||void 0,children:v?i("emailOtp.expired"):i("emailOtp.expiresIn",{time:Oe(k)})})]}),(0,e.jsx)("span",{className:"sekyro-visually-hidden",role:"status","aria-live":"polite",children:v?i("emailOtp.expired"):""}),(0,e.jsxs)(T,{children:[(0,e.jsx)(x,{type:"submit",full:!0,disabled:l||O.length!==6,"aria-busy":l||void 0,children:i("emailOtp.verify")}),(0,e.jsxs)("div",{className:"sekyro-resend-row",children:[(0,e.jsx)("button",{type:"button",className:"sekyro-link sekyro-resend",disabled:l||C>0,onClick:p(()=>$(!0),"onClick"),children:C>0?i("emailOtp.resendIn",{seconds:C}):i("emailOtp.resend")}),L?(0,e.jsx)("button",{type:"button",className:"sekyro-link sekyro-resend",disabled:l,onClick:p(()=>c(!0),"onClick"),"data-testid":"sekyro-otp-change",children:i("emailOtp.changeEmail")}):null]})]})]}):(0,e.jsxs)(e.Fragment,{children:[a.needsEmail?(0,e.jsxs)("div",{className:"sekyro-field",children:[(0,e.jsx)("label",{className:"sekyro-label",htmlFor:`${d}-email`,children:i("emailOtp.emailLabel")}),(0,e.jsx)("input",{id:`${d}-email`,className:"sekyro-input",type:"email",dir:"ltr",inputMode:"email",autoComplete:"email",autoCapitalize:"none",spellCheck:!1,placeholder:i("emailOtp.emailPlaceholder"),value:N,"aria-describedby":`${d}-email-help`,onChange:p(t=>ee(t.target.value),"onChange")}),(0,e.jsx)("span",{id:`${d}-email-help`,className:"sekyro-help",children:i("emailOtp.emailHelper")})]}):(0,e.jsx)("p",{className:"sekyro-text-muted",children:i("emailOtp.prefilledNotice")}),(0,e.jsxs)(T,{children:[(0,e.jsx)(x,{type:"submit",full:!0,disabled:l,"aria-busy":l||void 0,children:i("emailOtp.send")}),g&&H?(0,e.jsx)("button",{type:"button",className:"sekyro-link sekyro-resend",disabled:l,onClick:p(()=>c(!1),"onClick"),"data-testid":"sekyro-otp-back-to-code",children:i("emailOtp.backToCode")}):null]})]})]})}p(fe,"Ve");r(fe,"EmailOtpView");export{fe as EmailOtpView};