@sekyro/elements 0.1.0-rc.11 → 0.1.0-rc.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +8 -0
- package/dist/cdn/chunks/{capture-session-doc-2XRGB6AO-ZURBQ4YP.js → capture-session-doc-FAMDLRRZ-QPOFTNTG.js} +1 -1
- package/dist/cdn/chunks/challenge-frame-YBTLAQ5G-NN763UU5.js +1 -0
- package/dist/cdn/chunks/{chunk-ADYI7APR.js → chunk-3DDOCOIB.js} +1 -1
- package/dist/cdn/chunks/{chunk-TXDGBMD4.js → chunk-4YBL75VD.js} +1 -1
- package/dist/cdn/chunks/{chunk-R3P75ZRR.js → chunk-5JWGGQBH.js} +1 -1
- package/dist/cdn/chunks/{chunk-VPJEUYYP.js → chunk-7JUL7AKT.js} +1 -1
- package/dist/cdn/chunks/{chunk-RKNAZPA7.js → chunk-AARN2MG7.js} +1 -1
- package/dist/cdn/chunks/{chunk-TPDANNML.js → chunk-BMUUDLFA.js} +1 -1
- package/dist/cdn/chunks/{chunk-S774ZMGH.js → chunk-CSKOH7QX.js} +1 -1
- package/dist/cdn/chunks/{chunk-BMOSAKXR.js → chunk-CVFJQIMW.js} +1 -1
- package/dist/cdn/chunks/{chunk-K5SATFJY.js → chunk-FVWYONHZ.js} +1 -1
- package/dist/cdn/chunks/{chunk-FQYXVP54.js → chunk-GPGK6XZM.js} +1 -1
- package/dist/cdn/chunks/{chunk-E7OQJP4I.js → chunk-GZOBS7KG.js} +1 -1
- package/dist/cdn/chunks/chunk-JJ3Q52P3.js +25 -0
- package/dist/cdn/chunks/{chunk-S4ABXV4B.js → chunk-K4BLQMYZ.js} +1 -1
- package/dist/cdn/chunks/{chunk-QMBS54J5.js → chunk-LBZCFEU4.js} +2 -2
- package/dist/cdn/chunks/{chunk-C6HZ7TYS.js → chunk-Q5BUNNRN.js} +2 -2
- package/dist/cdn/chunks/{chunk-RH3APX6G.js → chunk-SDK2YXFV.js} +1 -1
- package/dist/cdn/chunks/{chunk-3CEJV42Q.js → chunk-UN4V3UNQ.js} +1 -1
- package/dist/cdn/chunks/{chunk-O23O5AAH.js → chunk-VHNWBOKW.js} +1 -1
- package/dist/cdn/chunks/{chunk-DW3VKKDE.js → chunk-XDRH4VWV.js} +1 -1
- package/dist/cdn/chunks/{chunk-XSGAV3PT.js → chunk-YFJBTK3L.js} +1 -1
- package/dist/cdn/chunks/{chunk-QXWWOMOK.js → chunk-YLH3WX7Y.js} +1 -1
- package/dist/cdn/chunks/{create-document-capture-XWNBUC55-FZGHPB6L.js → create-document-capture-WFTNVMCE-QOCPJSAU.js} +1 -1
- package/dist/cdn/chunks/{document-capture-view-2NFKF44N-4F3CP2ZO.js → document-capture-view-GENB535Z-YBRM7NWN.js} +1 -1
- package/dist/cdn/chunks/{eid-view-UGYVZ5NM-NQLRT4US.js → eid-view-IQRZGEMP-SPGYQDQP.js} +1 -1
- package/dist/cdn/chunks/{email-otp-view-ENQVRS66-DCCJA246.js → email-otp-view-CL76K5TY-TJMSLYLZ.js} +1 -1
- package/dist/cdn/chunks/{flow-views-HNJPDQ63-ER7B4XJF.js → flow-views-C3EIMXME-ODOF67JZ.js} +1 -1
- package/dist/cdn/chunks/{form-view-6ERKUFVD-2JHV2SHY.js → form-view-MEYCK437-JBO5DNG5.js} +1 -1
- package/dist/cdn/chunks/overlay-de-LOQWEHOH-HSNQGD4A.js +1 -0
- package/dist/cdn/chunks/overlay-es-F54CKFZO-BTQKTR4A.js +1 -0
- package/dist/cdn/chunks/overlay-pt-NHIQY3JB-DQ7MH2QJ.js +1 -0
- package/dist/cdn/chunks/{plan-runner-KX7KUS3M-CECACJOR.js → plan-runner-LSQTIO6L-XZJIKXPZ.js} +1 -1
- package/dist/cdn/chunks/{portrait-capture-view-ARRN3JW6-XRLTO3JS.js → portrait-capture-view-VTN2VU3E-JH34ISLI.js} +1 -1
- package/dist/cdn/chunks/{portrait-review-view-JF6TYNBU-57HERUGH.js → portrait-review-view-JTRGDYNV-C2O6OFYY.js} +1 -1
- package/dist/cdn/chunks/{proof-of-address-view-46Q6F7H5-7ES2ZRQL.js → proof-of-address-view-UQOZZXQO-T3QOIQNE.js} +1 -1
- package/dist/cdn/define.js +1 -1
- package/dist/cdn/index.js +1 -1
- package/dist/{chunk-DXR3ZGW2.js → chunk-6OZGEXX6.js} +1 -1
- package/dist/{chunk-37I3KKNR.js → chunk-753PBLDK.js} +1 -1
- package/dist/chunk-BZGVYIDN.js +25 -0
- package/dist/{chunk-NC6MJEKS.js → chunk-FBXU2OZN.js} +1 -1
- package/dist/{chunk-Y6IZDRYW.js → chunk-FCIH6PVW.js} +1 -1
- package/dist/{chunk-ZDYBRXXU.js → chunk-GA2DVM5C.js} +1 -1
- package/dist/{chunk-PNZPHUSG.js → chunk-HLMRVFVD.js} +1 -1
- package/dist/{chunk-5MQUCOFK.js → chunk-K7PFKAQD.js} +1 -1
- package/dist/{chunk-Q5HUTAIF.js → chunk-KNWOL5RR.js} +1 -1
- package/dist/{chunk-GBOZODQT.js → chunk-LGFZBFVB.js} +2 -2
- package/dist/{chunk-JQOJI5Z3.js → chunk-PYQREZ33.js} +1 -1
- package/dist/{chunk-43AFSR5C.js → chunk-W6ODZ5JK.js} +1 -1
- package/dist/{chunk-FHAN7WFM.js → chunk-XEWL7C6M.js} +1 -1
- package/dist/{chunk-OCLSIGRD.js → chunk-ZUVOUGIA.js} +1 -1
- package/dist/define.cjs +3 -3
- package/dist/define.js +1 -1
- package/dist/{document-capture-view-2NFKF44N-4JPWTBPF.js → document-capture-view-GENB535Z-L5V7YSPP.js} +1 -1
- package/dist/{eid-view-UGYVZ5NM-H7FHAGGG.js → eid-view-IQRZGEMP-LAMWORUL.js} +1 -1
- package/dist/{email-otp-view-ENQVRS66-5ZB3UKOO.js → email-otp-view-CL76K5TY-C7O472UB.js} +1 -1
- package/dist/{flow-views-HNJPDQ63-RAX3SDYO.js → flow-views-C3EIMXME-GGE4OUEO.js} +1 -1
- package/dist/{form-view-6ERKUFVD-Q2C54SUQ.js → form-view-MEYCK437-356QICGF.js} +1 -1
- package/dist/index.cjs +3 -3
- package/dist/index.d.cts +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -1
- package/dist/overlay-de-LOQWEHOH-YIQXHAUD.js +1 -0
- package/dist/overlay-es-F54CKFZO-JNTVTVWI.js +1 -0
- package/dist/overlay-pt-NHIQY3JB-V5CJ5SGF.js +1 -0
- package/dist/{portrait-capture-view-ARRN3JW6-RZYLVCCJ.js → portrait-capture-view-VTN2VU3E-2HKWLWRG.js} +1 -1
- package/dist/{portrait-review-view-JF6TYNBU-NHMROJU3.js → portrait-review-view-JTRGDYNV-TNR7WBYD.js} +1 -1
- package/dist/{proof-of-address-view-46Q6F7H5-TPLEKAFW.js → proof-of-address-view-UQOZZXQO-XJTGU3G6.js} +1 -1
- package/package.json +2 -2
- package/sbom.cdx.json +4 -4
- package/dist/cdn/chunks/challenge-frame-YAQJ5YMB-MHZYRGKY.js +0 -1
- package/dist/cdn/chunks/chunk-SOI356LX.js +0 -25
- package/dist/cdn/chunks/overlay-de-2DL4MNC7-5CBBHT7P.js +0 -1
- package/dist/cdn/chunks/overlay-es-FMHWRKQW-REFKUX4J.js +0 -1
- package/dist/cdn/chunks/overlay-pt-OGIELLCM-GU2A32BS.js +0 -1
- package/dist/chunk-VD7QSFUC.js +0 -25
- package/dist/overlay-de-2DL4MNC7-ELIZ2XHC.js +0 -1
- package/dist/overlay-es-FMHWRKQW-5PQ3EGK2.js +0 -1
- package/dist/overlay-pt-OGIELLCM-QT53YCS2.js +0 -1
package/dist/define.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{g as e}from"./chunk-
|
|
1
|
+
import{g as e}from"./chunk-LGFZBFVB.js";import"./chunk-KNWOL5RR.js";import"./chunk-PYQREZ33.js";import"./chunk-6OZGEXX6.js";import"./chunk-ZUVOUGIA.js";import"./chunk-FBXU2OZN.js";import"./chunk-W6ODZ5JK.js";import"./chunk-FCIH6PVW.js";import"./chunk-XEWL7C6M.js";import"./chunk-YZ6YGLNN.js";import"./chunk-K7PFKAQD.js";import"./chunk-HLMRVFVD.js";import"./chunk-BZGVYIDN.js";import"./chunk-SSU37LFQ.js";e();export{e as defineSekyroElements};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{a as Ye}from"./chunk-ZDYBRXXU.js";import{d as Ge}from"./chunk-JQOJI5Z3.js";import{a as Be,b as Ee,c as Ve}from"./chunk-43AFSR5C.js";import"./chunk-Y6IZDRYW.js";import{a as Ie}from"./chunk-5MQUCOFK.js";import"./chunk-PNZPHUSG.js";import{E as Ae,F as Ue,G as Re,I as Oe,K as pe,L as ve,a as dt,b as ut,c as B,o as De,q as Pe,v as X,w as he,y as me}from"./chunk-VD7QSFUC.js";import{a as c,c as He,i as h}from"./chunk-SSU37LFQ.js";var i=He(dt(),1),e=He(ut(),1);var ht={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"/>'},mt={"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":"يبدو أن هذه بطاقة تعريف أو بطاقة إقامة"},te={"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"},pt={"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"},vt={"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":"رفع صورة"},ae={"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"},kt={"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.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":"لنحاول مرة أخرى"},ne={"native.doc.introTitle":"Photograph your document","native.doc.introLead":"Your phone's camera will open. The photo is taken by itself as soon as the document is well framed.","native.doc.tip.flat":"Lay the document flat on a dark surface.","native.doc.tip.glare":"Avoid glare from lamps or sunlight.","native.doc.tip.frame":"Keep the whole document in the frame.","native.doc.openCamera":"Open the camera","native.doc.changeDocument":"Change document","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"},yt={"native.doc.introTitle":"Photographiez votre pièce","native.doc.introLead":"La caméra de votre téléphone va s'ouvrir. La photo est prise automatiquement dès que la pièce est bien cadrée.","native.doc.tip.flat":"Posez la pièce à plat, sur une surface sombre.","native.doc.tip.glare":"Évitez les reflets de lampe ou de soleil.","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.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"},gt=["locking","capturing"],F,Xe=(F=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,n){return this.presentHint(t,n),this.presentLock(t,n),this.presentCard(t,n),this.shutterSince=t.manualShutter?this.shutterSince??n:null,this.shown={...this.shown,manualShutter:this.shutterSince!==null&&n-this.shutterSince>=1e3},this.shown}presentHint(t,n){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=n),o===this.shown.hint)return;let r=n-this.candidateSince>=(o===null?0:350),v=this.shown.hint===null||n-this.hintShownAt>=1200;r&&v&&(this.shown={...this.shown,hint:o},this.hintShownAt=n)}presentLock(t,n){if(gt.includes(t.phase)){this.shown={...this.shown,locking:!0},this.lockLostAt=null;return}if(this.shown.locking){if(t.phase!=="framing"){this.shown={...this.shown,locking:!1},this.lockLostAt=null;return}this.lockLostAt??(this.lockLostAt=n),n-this.lockLostAt>=300&&(this.shown={...this.shown,locking:!1},this.lockLostAt=null)}}presentCard(t,n){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=n),n-this.lostSince>=300&&(this.shown={...this.shown,card:null});return}if(this.lostSince=null,this.detectedSince??(this.detectedSince=n),n-this.detectedSince<250)return;let r=this.shown.card;if(r===null){this.shown={...this.shown,card:{...o}};return}let v=.35;this.shown={...this.shown,card:{fill:r.fill+(o.fill-r.fill)*v,offsetX:r.offsetX+(o.offsetX-r.offsetX)*v,offsetY:r.offsetY+(o.offsetY-r.offsetY)*v}}}},c(F,"ge"),F);h(Xe,"ScanPresenter");var wt=Xe,Ct={en:ne,fr:yt,ar:kt,es:ne,pt:ne,de:ne},bt=450,ke=h(a=>t=>Ie(a.strings[t]??Ct[a.locale][t]??""),"useScanCopy");function Q({name:a}){return(0,e.jsx)("svg",{className:"sekyro-glyph",viewBox:"0 0 24 24",fill:"none","aria-hidden":"true",focusable:"false",dangerouslySetInnerHTML:{__html:ht[a]}})}c(Q,"re");h(Q,"ScanGlyph");var zt={en:te,fr:pt,ar:mt,es:te,pt:te,de:te},St={en:ae,fr:ft,ar:vt,es:ae,pt:ae,de:ae},_t="image/jpeg,image/png,image/heic,image/heif";function E(a){let t=a.strings,n=h(o=>t[o]??St[a.locale][o],"text");return{t:h(o=>n(o)??"","t")}}c(E,"W");h(E,"uploadCopy");function Fe(a,t){return a===null||a.state==="fallback"||a.state==="mismatch"?null:a.state==="searching"?t?"dcv3.mrz.searching":"dcv3.mrz.showMrzSide":a.state==="valid"?"dcv3.mrz.valid":a.coach!==void 0?`dcv3.mrz.${a.coach}`:"dcv3.mrz.reading"}c(Fe,"yt");h(Fe,"mrzInstruction");var Nt={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"};function oe(a){if(a.reason==="unreadable")return"doc.reason_unreadable";let t=a.reason!==void 0?Nt[a.reason]:void 0;return t!==void 0?t:a.reason==="tester_document_mismatch"?"reasons.tester_document_mismatch":a.reason!==void 0&&a.reason!=="side_missing"?Pe(a.reason):null}c(oe,"ye");h(oe,"reasonOf");var xt=new Set(["document_type_not_accepted","tester_document_mismatch","document_type_mismatch","provider_unavailable","document_type_not_supported","document_sides_mismatch"]);function $t({step:a,i18n:t,liveMrz:n,barcodeAssetBaseUrl:o,ageLead:r,...v}){let[C,f]=(0,i.useState)(!1),k=(0,i.useRef)(-1),[y,g]=(0,i.useState)("idle"),T=(0,i.useRef)(null),b=typeof a.uploadDocument=="function",N=b?a.photo?.source??"camera":"camera",V=b&&N!=="camera"&&a.photo?.uploadOffered===!0,[w,I]=(0,i.useState)(null),M=N==="upload"?"upload":N==="choice"?w??a.photo?.pick??"source":"camera",H=y==="sending"?void 0:()=>T.current?.click(),p=h(async D=>{let q=D.currentTarget.files?.[0];if(D.currentTarget.value="",q!==void 0){f(!1),g("sending");try{await a.uploadDocument(q),g("idle")}catch(j){g(j instanceof TypeError&&j.message==="unsupported_file"?"unsupported":"failed")}}},"onFile"),Z=V?(0,e.jsx)("input",{ref:T,type:"file",accept:_t,hidden:!0,"data-testid":"sekyro-doc-upload","aria-label":E(t).t("doc.uploadTitle"),onChange:c(D=>{p(D)},"onChange")}):null,z=E(t),W=a.photo?.cameraOnPhone===!0;return M==="camera"&&W?(0,e.jsx)(Ge,{i18n:t,lead:t.t("handoff.lead.document"),refresh:a.refresh,actions:(0,e.jsx)(B,{kind:"ghost",full:!0,onClick:c(()=>I("upload"),"onClick"),children:z.t("doc.source.upload")})}):M==="source"?(0,e.jsx)(Ye,{testId:"sekyro-doc-source",title:z.t("doc.source.title"),lead:z.t("doc.source.description"),cameraLabel:W?t.t("capture.source.phone"):z.t("doc.source.camera"),onPhone:W,uploadLabel:z.t("doc.source.upload"),notice:(0,e.jsx)(re,{step:a,i18n:t}),onCamera:c(()=>I("camera"),"onCamera"),onUpload:c(()=>I("upload"),"onUpload")}):M==="upload"?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(Qe,{step:a,i18n:t,ageLead:r===!0,upload:y,offered:V,onPick:c(()=>T.current?.click(),"onPick"),...N==="choice"?{onCamera:h(()=>I("camera"),"onCamera")}:{},...v}),Z]}):(0,e.jsxs)(e.Fragment,{children:[C?(0,e.jsx)(Ze,{step:a,i18n:t,attempts:k,...n!==void 0?{liveMrz:n}:{},...o!==void 0?{barcodeAssetBaseUrl:o}:{},...V&&H!==void 0?{onUpload:H}:{},onClose:c(()=>f(!1),"onClose")}):(0,e.jsx)(je,{step:a,i18n:t,ageLead:r===!0,onOpen:c(()=>f(!0),"onOpen"),upload:y,...V&&H!==void 0?{onUpload:H}:{},...v}),Z]})}c($t,"un");h($t,"DocumentCaptureView");function ye({passport:a}){let t=Math.round(228/(a?1.42:1.586));return(0,e.jsxs)("svg",{className:"sekyro-mark sekyro-mark--card",viewBox:`-12 -12 252 ${t+24}`,"aria-hidden":"true",focusable:"false",children:[(0,e.jsx)("defs",{children:(0,e.jsx)("clipPath",{id:"sekyro-card-clip",children:(0,e.jsx)("rect",{width:228,height:t,rx:"12.5"})})}),(0,e.jsx)("rect",{className:"sekyro-mark__card",width:228,height:t,rx:"12.5"}),(0,e.jsx)("rect",{className:"sekyro-mark__photo",x:"17",y:"17",width:"55",height:t*.52,rx:"6"}),[0,1,2].map(n=>(0,e.jsx)("rect",{className:"sekyro-mark__text",x:"88",y:23+n*t*.12,width:100-n*20,height:"6",rx:"3"},n)),[0,1].map(n=>(0,e.jsx)("rect",{className:"sekyro-mark__text",x:"17",y:t*.74+n*9,width:194,height:"4",rx:"2"},n)),(0,e.jsx)("g",{clipPath:"url(#sekyro-card-clip)",children:(0,e.jsx)("g",{className:"sekyro-mark__read",style:{"--sekyro-read-w":"228px"},children:(0,e.jsx)("rect",{x:"-1",width:"2",height:t,className:"sekyro-mark__beam"})})}),(0,e.jsx)("path",{className:"sekyro-mark__brackets",d:We(-10,-10,248,t+20,16,30)})]})}c(ye,"Je");h(ye,"ScanMark");function We(a,t,n,o,r,v){let C=Math.min(r,v*.6);return[[a,t,1,1],[a+n,t,-1,1],[a,t+o,1,-1],[a+n,t+o,-1,-1]].map(([f,k,y,g])=>`M${f} ${k+g*v}V${k+g*C}Q${f} ${k} ${f+y*C} ${k}H${f+y*v}`).join("")}c(We,"wt");h(We,"brackets");function je({step:a,i18n:t,ageLead:n,onOpen:o,onChangeCountry:r,onChangeDocument:v,upload:C,onUpload:f}){let k=ke(t),y=E(t),g=a.documentType==="passport",T=oe(a),b=C==="sending",N=(0,i.useContext)(Ue)?.busy===!0;return(0,e.jsxs)("section",{className:"sekyro-step","data-testid":"sekyro-document",children:[(0,e.jsx)(ye,{passport:g}),(0,e.jsx)(he,{title:k("native.doc.introTitle"),lead:n?t.t("doc.ageStepUp"):k("native.doc.introLead")}),(0,e.jsx)(re,{step:a,i18n:t}),a.reason!==void 0&&xt.has(a.reason)?null:(0,e.jsxs)("ul",{className:"sekyro-tiprows",children:[(0,e.jsxs)("li",{children:[(0,e.jsx)(X,{name:g?"passport":"card"}),k("native.doc.tip.flat")]}),(0,e.jsxs)("li",{children:[(0,e.jsx)(X,{name:"light"}),k("native.doc.tip.glare")]}),(0,e.jsxs)("li",{children:[(0,e.jsx)(Q,{name:"image"}),k("native.doc.tip.frame")]})]}),(0,e.jsx)(ge,{i18n:t,...v!==void 0?{onChangeDocument:v}:{},...r!==void 0?{onChangeCountry:r}:{}}),(0,e.jsx)(we,{i18n:t,upload:C}),b?(0,e.jsx)("p",{className:"sekyro-text-muted",role:"status",children:t.t("doc.uploading")}):f!==void 0?(0,e.jsx)("p",{className:"sekyro-text-muted",children:y.t("doc.uploadHint")}):null,(0,e.jsxs)(me,{children:[(0,e.jsxs)(B,{full:!0,onClick:o,disabled:b||N,children:[(0,e.jsx)(X,{name:"camera"}),k("native.doc.openCamera")]}),f!==void 0?(0,e.jsxs)(B,{full:!0,kind:"ghost",onClick:f,children:[(0,e.jsx)(Q,{name:"image"}),y.t("doc.uploadInstead")]}):null]})]})}c(je,"Ct");h(je,"DocumentIntro");function re({step:a,i18n:t}){let n=oe(a);return n===null?null:(0,e.jsxs)(pe,{tone:"warning",children:[(0,e.jsx)("span",{children:t.t(n)}),(0,e.jsx)("span",{children:ve(t,a.attemptsRemaining,a.attemptsExhausted)})]})}c(re,"ke");h(re,"ReasonNotice");function ge({i18n:a,onChangeCountry:t,onChangeDocument:n}){let o=ke(a);return n===void 0&&t===void 0?null:(0,e.jsxs)("div",{className:"sekyro-links",children:[n!==void 0?(0,e.jsx)("button",{type:"button",className:"sekyro-link",onClick:n,children:o("native.doc.changeDocument")}):null,t!==void 0?(0,e.jsx)("button",{type:"button",className:"sekyro-link",onClick:t,children:a.t("native.doc.changeCountry")}):null]})}c(ge,"et");h(ge,"ChangeLinks");function we({i18n:a,upload:t}){return t!=="unsupported"&&t!=="failed"?null:(0,e.jsx)(pe,{tone:"warning",children:(0,e.jsx)("span",{children:E(a).t(t==="unsupported"?"doc.uploadUnsupported":"doc.uploadFailed")})})}c(we,"tt");h(we,"UploadNotice");function Qe({step:a,i18n:t,ageLead:n,upload:o,offered:r,onPick:v,onCamera:C,onChangeCountry:f,onChangeDocument:k}){let y=E(t),g=o==="sending";return(0,e.jsxs)("section",{className:"sekyro-step","data-testid":"sekyro-doc-upload-screen",children:[(0,e.jsx)(ye,{passport:a.documentType==="passport"}),(0,e.jsx)(he,{title:y.t("doc.uploadTitle"),lead:n?t.t("doc.ageStepUp"):y.t("doc.uploadHint")}),n?(0,e.jsx)("p",{className:"sekyro-text-muted",children:y.t("doc.uploadHint")}):null,(0,e.jsx)(re,{step:a,i18n:t}),(0,e.jsx)(ge,{i18n:t,...k!==void 0?{onChangeDocument:k}:{},...f!==void 0?{onChangeCountry:f}:{}}),(0,e.jsx)(we,{i18n:t,upload:o}),g?(0,e.jsx)("p",{className:"sekyro-text-muted",role:"status",children:t.t("doc.uploading")}):null,(0,e.jsxs)(me,{children:[(0,e.jsxs)(B,{full:!0,onClick:v,disabled:g||!r||a.attemptsExhausted,children:[(0,e.jsx)(Q,{name:"image"}),y.t("doc.source.upload")]}),C!==void 0?(0,e.jsxs)(B,{full:!0,kind:"ghost",onClick:C,disabled:g,children:[(0,e.jsx)(X,{name:"camera"}),y.t("doc.source.camera")]}):null]})]})}c(Qe,"_t");h(Qe,"DocumentUploadScreen");function fe(a,t,n){let o=a*.88,r=o/n;return{x:(a-o)/2,y:t*.42-r/2,w:o,h:r}}c(fe,"Ze");h(fe,"guideRect");var Lt={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"},Tt=h(()=>typeof window<"u"&&window.matchMedia?.("(prefers-reduced-motion: reduce)").matches===!0,"reduceMotion");function Ze({step:a,i18n:t,liveMrz:n,barcodeAssetBaseUrl:o,onClose:r,attempts:v,onUpload:C}){let f=ke(t),k=(0,i.useContext)(Be),y=(0,i.useRef)(k);y.current=k;let g=(0,i.useRef)(null),T=(0,i.useRef)(null),b=(0,i.useRef)(null),[N,V]=(0,i.useState)("idle"),[w,I]=(0,i.useState)(null),[M,H]=(0,i.useState)(null),[p,Z]=(0,i.useState)({w:0,h:0}),[z,W]=(0,i.useState)({hint:null,locking:!1,card:null,manualShutter:!1}),[D,q]=(0,i.useState)({}),[j,et]=(0,i.useState)(null),[Ce,tt]=(0,i.useState)(null),[be,ze]=(0,i.useState)(0),[Se,_e]=(0,i.useState)(null),[J,Ne]=(0,i.useState)(null),P=a.documentType==="passport",K=P?1.42:1.586;Ae(!0),(0,i.useLayoutEffect)(()=>{let s=g.current;if(s===null)return;let u=h(()=>Z({w:s.clientWidth,h:s.clientHeight}),"measure");if(u(),typeof ResizeObserver>"u")return;let d=new ResizeObserver(u);return d.observe(s),()=>d.disconnect()},[]);let l=fe(p.w,p.h,K);(0,i.useEffect)(()=>{p.w===0||p.h===0||b.current?.setGuide?.({viewAspect:p.w/p.h,rect:{x:l.x/p.w,y:l.y/p.h,width:l.w/p.w,height:l.h/p.h}})},[p.w,p.h,l.x,l.y,l.w,l.h]),(0,i.useEffect)(()=>{let s=T.current;if(s===null)return;let u=a.capture({video:s,...n!==void 0?{liveMrz:n}:{},...o!==void 0?{barcodeAssetBaseUrl:o}:{}});b.current=u;let d=g.current;if(d!==null&&d.clientWidth>0&&d.clientHeight>0){let m=fe(d.clientWidth,d.clientHeight,K);u.setGuide?.({viewAspect:d.clientWidth/d.clientHeight,rect:{x:m.x/d.clientWidth,y:m.y/d.clientHeight,width:m.w/d.clientWidth,height:m.h/d.clientHeight}})}let L=new wt,_={scan:null,feedback:null,gate:null},U=h(m=>{_={..._,...m};let $=_.gate?.guide,ct={phase:_.scan?.phase??"framing",hint:_.feedback?.reticle==="coaching"?_.feedback.key:null,card:$?.detected?{fill:$.fill,offsetX:$.offsetX,offsetY:$.offsetY}:null,manualShutter:_.scan?.manualShutter??!1},R=L.present(ct,performance.now());W(O=>O.hint===R.hint&&O.locking===R.locking&&O.manualShutter===R.manualShutter&&O.card?.fill===R.card?.fill&&O.card?.offsetX===R.card?.offsetX&&O.card?.offsetY===R.card?.offsetY?O:R)},"present"),st=[u.on("state",V),u.on("feedback",m=>U({feedback:m})),u.on("gate",m=>U({gate:m})),u.on("scan",m=>{I(m),U({scan:m})}),u.on("captured",m=>{q($=>({...$,[qe(m.side,P,$)]:m.previewDataUrl})),et(m.previewDataUrl),tt(Ke(s))}),u.on("error",m=>{H(m);let $=y.current;$!==null&&Ve($,Ee("document",m,Math.max(0,v.current)))}),u.on("mrz",m=>{m.state==="mismatch"?Ne(m.format??null):_e(m)})];return v.current+=1,u.start().catch(()=>{}),()=>{for(let m of st)m();u.destroy(),b.current=null}},[a.issuer,a.documentType]);let x=w?.phase??"framing",A=x==="reading"||x==="result",le=x==="flipCue"||x==="reaskRecto",G=z.locking,xe=w?.captured.length??0;(0,i.useEffect)(()=>{G&&ze(s=>s+1)},[G]),(0,i.useEffect)(()=>{xe>0&&ze(s=>s+1)},[xe]);let at=w?.expected??null;(0,i.useEffect)(()=>{_e(null)},[at]),(0,i.useEffect)(()=>{if(J===null)return;let s=setTimeout(()=>Ne(null),2e3);return()=>clearTimeout(s)},[J]);let $e=le||A||a.documentType==="drivers_license"?null:Fe(Se,P),ie=J!==null?J==="TD3"?"dcv3.mrz.looksLikePassport":"dcv3.mrz.looksLikeCard":$e,nt=ie===null?null:t.strings[ie]??zt[t.locale][ie],se=oe(a),Le=z.hint===null?null:Lt[z.hint]??`dcv2.${z.hint}`,ot=Le??(x==="flipCue"?w?.notice==="same_face"?"doc.sameFace":"doc.flip":x==="reaskRecto"?"doc.reaskRecto":A?"native.scan.reading":x==="locking"||x==="capturing"||G?"native.scan.holdStill":w?.notice==="reread"?se??"doc.reread":w?.notice==="technical"?"native.scan.retry":w?.notice==="blurry"?"native.scan.blurry":se??(P?"doc.showPage":"doc.showSide")),ce=nt??f(ot),Y=z.card,S=l;if(!G&&Y!==null&&Y.fill>=.45&&Y.fill<=1.25&&!Tt()){let s=l.w*Y.fill,u=s/K,d=l.x+l.w/2+l.w*Math.max(-.25,Math.min(.25,Y.offsetX)),L=l.y+l.h/2+l.h*Math.max(-.25,Math.min(.25,Y.offsetY));S={x:d-s/2,y:L-u/2,w:s,h:u}}let ee=l.w*.045,de=28,Te=Math.min(ee,de*.6),rt=[[S.x,S.y,1,1],[S.x+S.w,S.y,-1,1],[S.x,S.y+S.h,1,-1],[S.x+S.w,S.y+S.h,-1,-1]],lt=G?"is-locked":z.hint!==null?"is-coaching":"",it=P?[{side:"single",label:"doc.progressPage"}]:[{side:"recto",label:"doc.progressFront"},{side:"verso",label:"doc.progressBack"}],Me=l.y+l.h+48,ue={insetInlineStart:l.x,insetBlockStart:l.y,inlineSize:l.w,blockSize:l.h,borderRadius:ee};return(0,e.jsx)("section",{className:"sekyro-lm","aria-label":ce,"data-testid":"sekyro-document",children:(0,e.jsxs)("div",{ref:g,className:`sekyro-lm-stage${A?" is-reading":""}${le?" is-flip":""}`,style:{"--sekyro-guide-w":`${l.w}px`},children:[(0,e.jsx)("video",{ref:T,className:"sekyro-lm-video",playsInline:!0,muted:!0,autoPlay:!0,"aria-hidden":"true",onPointerUp:c(s=>{let u=s.currentTarget,d=u.getBoundingClientRect(),L=Math.max(d.width/(u.videoWidth||1),d.height/(u.videoHeight||1)),_=u.videoWidth*L,U=u.videoHeight*L;_>0&&U>0&&b.current?.focusAt((s.clientX-d.left+(_-d.width)/2)/_,(s.clientY-d.top+(U-d.height)/2)/U)},"onPointerUp")}),p.w>0?(0,e.jsxs)(e.Fragment,{children:[A&&Ce!==null?(0,e.jsx)("img",{className:"sekyro-lm-scene",src:Ce,alt:""}):null,A&&j!==null?(0,e.jsx)("img",{className:"sekyro-lm-frozen",src:j,alt:"",style:ue}):null,(0,e.jsxs)("svg",{className:"sekyro-lm-overlay",viewBox:`0 0 ${p.w} ${p.h}`,"aria-hidden":"true",focusable:"false",children:[(0,e.jsxs)("defs",{children:[(0,e.jsxs)("linearGradient",{id:"sekyro-lm-top",x1:"0",y1:"0",x2:"0",y2:"1",children:[(0,e.jsx)("stop",{offset:"0",className:"sekyro-lm-ink",stopOpacity:"0.85"}),(0,e.jsx)("stop",{offset:"1",className:"sekyro-lm-ink",stopOpacity:"0"})]}),(0,e.jsxs)("linearGradient",{id:"sekyro-lm-bottom",x1:"0",y1:"0",x2:"0",y2:"1",children:[(0,e.jsx)("stop",{offset:"0",className:"sekyro-lm-ink",stopOpacity:"0"}),(0,e.jsx)("stop",{offset:"1",className:"sekyro-lm-ink",stopOpacity:"0.9"})]})]}),(0,e.jsx)("path",{className:"sekyro-lm-scrim",fillRule:"evenodd",d:`M0 0H${p.w}V${p.h}H0Z${Je(l,ee)}`}),(0,e.jsx)("rect",{width:p.w,height:Math.max(0,l.y),fill:"url(#sekyro-lm-top)"}),(0,e.jsx)("rect",{y:l.y+l.h,width:p.w,height:Math.max(0,p.h-l.y-l.h),fill:"url(#sekyro-lm-bottom)"}),(0,e.jsx)("g",{className:`sekyro-lm-brackets ${lt}`,children:rt.map(([s,u,d,L],_)=>(0,e.jsx)("path",{style:{transform:`translate(${s}px, ${u}px) scale(${d}, ${L})`},d:`M0 ${de}V${Te}Q0 0 ${Te} 0H${de}`},_))}),G?(0,e.jsx)("rect",{className:"sekyro-lm-trace",x:l.x,y:l.y,width:l.w,height:l.h,rx:ee,pathLength:"1",style:{animationDuration:`${bt}ms`}}):null]}),(0,e.jsx)("div",{className:"sekyro-lm-slot",style:ue,"aria-hidden":"true",children:A?(0,e.jsx)("span",{className:"sekyro-lm-read is-repeating"}):be>0?(0,e.jsx)("span",{className:"sekyro-lm-read"},be):null})]}):null,$e!==null?(0,e.jsx)("div",{className:"sekyro-lm-slot",style:ue,"aria-hidden":"true",children:(0,e.jsx)("span",{"data-testid":"sekyro-mrz-strip",className:`sekyro-lm-mrz${P?" is-page":""}${Se?.state==="valid"?" is-valid":""}`})}):null,(0,e.jsxs)("div",{className:"sekyro-lm-instruction",style:{insetBlockStart:l.y-64},children:[(0,e.jsx)("div",{role:"status","aria-live":"polite",children:(0,e.jsx)(Oe,{swapKey:ce,className:"sekyro-lm-line",children:ce})}),se!==null&&x==="framing"&&Le===null?(0,e.jsx)("p",{className:"sekyro-lm-attempts",children:ve(t,a.attemptsRemaining,a.attemptsExhausted)}):null]}),A?(0,e.jsxs)("p",{className:"sekyro-lm-under sekyro-lm-note",style:{insetBlockStart:Me-12},children:[(0,e.jsx)("span",{className:"sekyro-lm-spinner","aria-hidden":"true"}),f("native.scan.putDown")]}):le?(0,e.jsx)("div",{className:`sekyro-lm-under sekyro-lm-flip${x==="reaskRecto"?" is-toFront":""}`,style:{insetBlockStart:Me-20},"data-testid":"sekyro-flip-cue","aria-hidden":"true",children:(0,e.jsxs)("span",{className:"sekyro-lm-flip-card",style:{aspectRatio:String(K)},children:[(0,e.jsx)("span",{className:"sekyro-lm-flip-front"}),(0,e.jsx)("span",{className:"sekyro-lm-flip-back"})]})}):null,(0,e.jsxs)("div",{className:"sekyro-lm-controls",children:[(0,e.jsxs)("div",{className:"sekyro-lm-bar",children:[(0,e.jsx)("button",{type:"button",className:"sekyro-glass","aria-label":t.t("native.close"),onClick:r,children:(0,e.jsx)(X,{name:"close"})}),w?.torchAvailable?(0,e.jsx)("button",{type:"button",className:`sekyro-glass${w.torch?" is-on":""}`,"aria-label":t.t("doc.torchOn"),"aria-pressed":w.torch,onClick:c(()=>b.current?.setTorch(!w.torch),"onClick"),children:(0,e.jsx)(Q,{name:"flashlight"})}):null]}),M!==null?(0,e.jsxs)("div",{className:"sekyro-lm-error",role:"alert",children:[(0,e.jsx)("p",{children:t.t("doc.cameraBlocked")}),(0,e.jsx)("p",{children:t.t(M.kind==="permission"?"doc.cameraBlockedHint":De(M.kind))}),(0,e.jsx)(B,{onClick:c(()=>{H(null),v.current+=1,b.current?.retry()},"onClick"),children:t.t("doc.retryCamera")})]}):null,z.manualShutter?(0,e.jsx)("button",{type:"button",className:"sekyro-shutter","aria-label":t.t("doc.shutter"),onClick:c(()=>b.current?.shutter(),"onClick")}):null,(0,e.jsx)("ol",{className:"sekyro-lm-tray",children:it.map(({side:s,label:u})=>{let d=w?.captured.includes(s)??!1;return(0,e.jsxs)("li",{className:d?"is-done":void 0,"aria-current":!d&&(P||w?.expected===s)?"step":void 0,children:[d?(0,e.jsxs)("span",{className:"sekyro-lm-thumb",children:[D[s]!==void 0?(0,e.jsx)("img",{src:D[s],alt:""}):null,(0,e.jsx)("svg",{className:"sekyro-lm-check",viewBox:"0 0 18 18","aria-hidden":"true",children:(0,e.jsx)("path",{d:"M5 9.2l2.6 2.6L13 6.4"})})]}):null,f(u)]},s)})}),C!==void 0?(0,e.jsx)("button",{type:"button",className:"sekyro-lm-upload",onClick:C,children:E(t).t("doc.uploadInstead")}):null,N==="uploading"||N==="checking"?null:(0,e.jsx)(Re,{onStop:r})]}),N==="uploading"||N==="checking"?(0,e.jsx)("span",{className:"sekyro-visually-hidden",role:"status",children:N==="uploading"?t.t("doc.uploading"):f("native.scan.reading")}):null]})})}c(Ze,"Lt");h(Ze,"LumiereScan");function qe(a,t,n){return t?"single":a==="recto"||a==="verso"?a:n.recto===void 0?"recto":"verso"}c(qe,"zt");h(qe,"slotOf");function Je({x:a,y:t,w:n,h:o},r){return`M${a+r} ${t}H${a+n-r}Q${a+n} ${t} ${a+n} ${t+r}V${t+o-r}Q${a+n} ${t+o} ${a+n-r} ${t+o}H${a+r}Q${a} ${t+o} ${a} ${t+o-r}V${t+r}Q${a} ${t} ${a+r} ${t}Z`}c(Je,"xt");h(Je,"roundedRect");function Ke(a){let t=Math.round(a.videoWidth/4),n=Math.round(a.videoHeight/4);if(t===0||n===0||typeof document>"u")return null;try{let o=document.createElement("canvas");o.width=t,o.height=n;let r=o.getContext("2d");return r===null?null:(r.drawImage(a,0,0,t,n),o.toDataURL("image/jpeg",.7))}catch{return null}}c(Ke,"Tt");h(Ke,"sceneSnapshot");export{$t as DocumentCaptureView,bt as LOCK_TRACE_MS,_t as UPLOAD_ACCEPT,fe as guideRect,Fe as mrzInstruction,qe as slotOf};
|
|
1
|
+
"use client";import{a as Ye}from"./chunk-GA2DVM5C.js";import{d as Ge}from"./chunk-PYQREZ33.js";import{a as Be,b as Ee,c as Ve}from"./chunk-W6ODZ5JK.js";import"./chunk-FCIH6PVW.js";import{a as Ie}from"./chunk-K7PFKAQD.js";import"./chunk-HLMRVFVD.js";import{E as Ae,F as Ue,G as Re,I as Oe,K as pe,L as ve,a as dt,b as ut,c as B,o as De,q as Pe,v as X,w as he,y as me}from"./chunk-BZGVYIDN.js";import{a as c,c as He,i as h}from"./chunk-SSU37LFQ.js";var i=He(dt(),1),e=He(ut(),1);var ht={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"/>'},mt={"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":"يبدو أن هذه بطاقة تعريف أو بطاقة إقامة"},te={"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"},pt={"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"},vt={"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":"رفع صورة"},ae={"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"},kt={"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.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":"لنحاول مرة أخرى"},ne={"native.doc.introTitle":"Photograph your document","native.doc.introLead":"Your phone's camera will open. The photo is taken by itself as soon as the document is well framed.","native.doc.tip.flat":"Lay the document flat on a dark surface.","native.doc.tip.glare":"Avoid glare from lamps or sunlight.","native.doc.tip.frame":"Keep the whole document in the frame.","native.doc.openCamera":"Open the camera","native.doc.changeDocument":"Change document","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"},yt={"native.doc.introTitle":"Photographiez votre pièce","native.doc.introLead":"La caméra de votre téléphone va s'ouvrir. La photo est prise automatiquement dès que la pièce est bien cadrée.","native.doc.tip.flat":"Posez la pièce à plat, sur une surface sombre.","native.doc.tip.glare":"Évitez les reflets de lampe ou de soleil.","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.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"},gt=["locking","capturing"],F,Xe=(F=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,n){return this.presentHint(t,n),this.presentLock(t,n),this.presentCard(t,n),this.shutterSince=t.manualShutter?this.shutterSince??n:null,this.shown={...this.shown,manualShutter:this.shutterSince!==null&&n-this.shutterSince>=1e3},this.shown}presentHint(t,n){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=n),o===this.shown.hint)return;let r=n-this.candidateSince>=(o===null?0:350),v=this.shown.hint===null||n-this.hintShownAt>=1200;r&&v&&(this.shown={...this.shown,hint:o},this.hintShownAt=n)}presentLock(t,n){if(gt.includes(t.phase)){this.shown={...this.shown,locking:!0},this.lockLostAt=null;return}if(this.shown.locking){if(t.phase!=="framing"){this.shown={...this.shown,locking:!1},this.lockLostAt=null;return}this.lockLostAt??(this.lockLostAt=n),n-this.lockLostAt>=300&&(this.shown={...this.shown,locking:!1},this.lockLostAt=null)}}presentCard(t,n){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=n),n-this.lostSince>=300&&(this.shown={...this.shown,card:null});return}if(this.lostSince=null,this.detectedSince??(this.detectedSince=n),n-this.detectedSince<250)return;let r=this.shown.card;if(r===null){this.shown={...this.shown,card:{...o}};return}let v=.35;this.shown={...this.shown,card:{fill:r.fill+(o.fill-r.fill)*v,offsetX:r.offsetX+(o.offsetX-r.offsetX)*v,offsetY:r.offsetY+(o.offsetY-r.offsetY)*v}}}},c(F,"ge"),F);h(Xe,"ScanPresenter");var wt=Xe,Ct={en:ne,fr:yt,ar:kt,es:ne,pt:ne,de:ne},bt=450,ke=h(a=>t=>Ie(a.strings[t]??Ct[a.locale][t]??""),"useScanCopy");function Q({name:a}){return(0,e.jsx)("svg",{className:"sekyro-glyph",viewBox:"0 0 24 24",fill:"none","aria-hidden":"true",focusable:"false",dangerouslySetInnerHTML:{__html:ht[a]}})}c(Q,"re");h(Q,"ScanGlyph");var zt={en:te,fr:pt,ar:mt,es:te,pt:te,de:te},St={en:ae,fr:ft,ar:vt,es:ae,pt:ae,de:ae},_t="image/jpeg,image/png,image/heic,image/heif";function E(a){let t=a.strings,n=h(o=>t[o]??St[a.locale][o],"text");return{t:h(o=>n(o)??"","t")}}c(E,"W");h(E,"uploadCopy");function Fe(a,t){return a===null||a.state==="fallback"||a.state==="mismatch"?null:a.state==="searching"?t?"dcv3.mrz.searching":"dcv3.mrz.showMrzSide":a.state==="valid"?"dcv3.mrz.valid":a.coach!==void 0?`dcv3.mrz.${a.coach}`:"dcv3.mrz.reading"}c(Fe,"yt");h(Fe,"mrzInstruction");var Nt={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"};function oe(a){if(a.reason==="unreadable")return"doc.reason_unreadable";let t=a.reason!==void 0?Nt[a.reason]:void 0;return t!==void 0?t:a.reason==="tester_document_mismatch"?"reasons.tester_document_mismatch":a.reason!==void 0&&a.reason!=="side_missing"?Pe(a.reason):null}c(oe,"ye");h(oe,"reasonOf");var xt=new Set(["document_type_not_accepted","tester_document_mismatch","document_type_mismatch","provider_unavailable","document_type_not_supported","document_sides_mismatch"]);function $t({step:a,i18n:t,liveMrz:n,barcodeAssetBaseUrl:o,ageLead:r,...v}){let[C,f]=(0,i.useState)(!1),k=(0,i.useRef)(-1),[y,g]=(0,i.useState)("idle"),T=(0,i.useRef)(null),b=typeof a.uploadDocument=="function",N=b?a.photo?.source??"camera":"camera",V=b&&N!=="camera"&&a.photo?.uploadOffered===!0,[w,I]=(0,i.useState)(null),M=N==="upload"?"upload":N==="choice"?w??a.photo?.pick??"source":"camera",H=y==="sending"?void 0:()=>T.current?.click(),p=h(async D=>{let q=D.currentTarget.files?.[0];if(D.currentTarget.value="",q!==void 0){f(!1),g("sending");try{await a.uploadDocument(q),g("idle")}catch(j){g(j instanceof TypeError&&j.message==="unsupported_file"?"unsupported":"failed")}}},"onFile"),Z=V?(0,e.jsx)("input",{ref:T,type:"file",accept:_t,hidden:!0,"data-testid":"sekyro-doc-upload","aria-label":E(t).t("doc.uploadTitle"),onChange:c(D=>{p(D)},"onChange")}):null,z=E(t),W=a.photo?.cameraOnPhone===!0;return M==="camera"&&W?(0,e.jsx)(Ge,{i18n:t,lead:t.t("handoff.lead.document"),refresh:a.refresh,actions:(0,e.jsx)(B,{kind:"ghost",full:!0,onClick:c(()=>I("upload"),"onClick"),children:z.t("doc.source.upload")})}):M==="source"?(0,e.jsx)(Ye,{testId:"sekyro-doc-source",title:z.t("doc.source.title"),lead:z.t("doc.source.description"),cameraLabel:W?t.t("capture.source.phone"):z.t("doc.source.camera"),onPhone:W,uploadLabel:z.t("doc.source.upload"),notice:(0,e.jsx)(re,{step:a,i18n:t}),onCamera:c(()=>I("camera"),"onCamera"),onUpload:c(()=>I("upload"),"onUpload")}):M==="upload"?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(Qe,{step:a,i18n:t,ageLead:r===!0,upload:y,offered:V,onPick:c(()=>T.current?.click(),"onPick"),...N==="choice"?{onCamera:h(()=>I("camera"),"onCamera")}:{},...v}),Z]}):(0,e.jsxs)(e.Fragment,{children:[C?(0,e.jsx)(Ze,{step:a,i18n:t,attempts:k,...n!==void 0?{liveMrz:n}:{},...o!==void 0?{barcodeAssetBaseUrl:o}:{},...V&&H!==void 0?{onUpload:H}:{},onClose:c(()=>f(!1),"onClose")}):(0,e.jsx)(je,{step:a,i18n:t,ageLead:r===!0,onOpen:c(()=>f(!0),"onOpen"),upload:y,...V&&H!==void 0?{onUpload:H}:{},...v}),Z]})}c($t,"un");h($t,"DocumentCaptureView");function ye({passport:a}){let t=Math.round(228/(a?1.42:1.586));return(0,e.jsxs)("svg",{className:"sekyro-mark sekyro-mark--card",viewBox:`-12 -12 252 ${t+24}`,"aria-hidden":"true",focusable:"false",children:[(0,e.jsx)("defs",{children:(0,e.jsx)("clipPath",{id:"sekyro-card-clip",children:(0,e.jsx)("rect",{width:228,height:t,rx:"12.5"})})}),(0,e.jsx)("rect",{className:"sekyro-mark__card",width:228,height:t,rx:"12.5"}),(0,e.jsx)("rect",{className:"sekyro-mark__photo",x:"17",y:"17",width:"55",height:t*.52,rx:"6"}),[0,1,2].map(n=>(0,e.jsx)("rect",{className:"sekyro-mark__text",x:"88",y:23+n*t*.12,width:100-n*20,height:"6",rx:"3"},n)),[0,1].map(n=>(0,e.jsx)("rect",{className:"sekyro-mark__text",x:"17",y:t*.74+n*9,width:194,height:"4",rx:"2"},n)),(0,e.jsx)("g",{clipPath:"url(#sekyro-card-clip)",children:(0,e.jsx)("g",{className:"sekyro-mark__read",style:{"--sekyro-read-w":"228px"},children:(0,e.jsx)("rect",{x:"-1",width:"2",height:t,className:"sekyro-mark__beam"})})}),(0,e.jsx)("path",{className:"sekyro-mark__brackets",d:We(-10,-10,248,t+20,16,30)})]})}c(ye,"Je");h(ye,"ScanMark");function We(a,t,n,o,r,v){let C=Math.min(r,v*.6);return[[a,t,1,1],[a+n,t,-1,1],[a,t+o,1,-1],[a+n,t+o,-1,-1]].map(([f,k,y,g])=>`M${f} ${k+g*v}V${k+g*C}Q${f} ${k} ${f+y*C} ${k}H${f+y*v}`).join("")}c(We,"wt");h(We,"brackets");function je({step:a,i18n:t,ageLead:n,onOpen:o,onChangeCountry:r,onChangeDocument:v,upload:C,onUpload:f}){let k=ke(t),y=E(t),g=a.documentType==="passport",T=oe(a),b=C==="sending",N=(0,i.useContext)(Ue)?.busy===!0;return(0,e.jsxs)("section",{className:"sekyro-step","data-testid":"sekyro-document",children:[(0,e.jsx)(ye,{passport:g}),(0,e.jsx)(he,{title:k("native.doc.introTitle"),lead:n?t.t("doc.ageStepUp"):k("native.doc.introLead")}),(0,e.jsx)(re,{step:a,i18n:t}),a.reason!==void 0&&xt.has(a.reason)?null:(0,e.jsxs)("ul",{className:"sekyro-tiprows",children:[(0,e.jsxs)("li",{children:[(0,e.jsx)(X,{name:g?"passport":"card"}),k("native.doc.tip.flat")]}),(0,e.jsxs)("li",{children:[(0,e.jsx)(X,{name:"light"}),k("native.doc.tip.glare")]}),(0,e.jsxs)("li",{children:[(0,e.jsx)(Q,{name:"image"}),k("native.doc.tip.frame")]})]}),(0,e.jsx)(ge,{i18n:t,...v!==void 0?{onChangeDocument:v}:{},...r!==void 0?{onChangeCountry:r}:{}}),(0,e.jsx)(we,{i18n:t,upload:C}),b?(0,e.jsx)("p",{className:"sekyro-text-muted",role:"status",children:t.t("doc.uploading")}):f!==void 0?(0,e.jsx)("p",{className:"sekyro-text-muted",children:y.t("doc.uploadHint")}):null,(0,e.jsxs)(me,{children:[(0,e.jsxs)(B,{full:!0,onClick:o,disabled:b||N,children:[(0,e.jsx)(X,{name:"camera"}),k("native.doc.openCamera")]}),f!==void 0?(0,e.jsxs)(B,{full:!0,kind:"ghost",onClick:f,children:[(0,e.jsx)(Q,{name:"image"}),y.t("doc.uploadInstead")]}):null]})]})}c(je,"Ct");h(je,"DocumentIntro");function re({step:a,i18n:t}){let n=oe(a);return n===null?null:(0,e.jsxs)(pe,{tone:"warning",children:[(0,e.jsx)("span",{children:t.t(n)}),(0,e.jsx)("span",{children:ve(t,a.attemptsRemaining,a.attemptsExhausted)})]})}c(re,"ke");h(re,"ReasonNotice");function ge({i18n:a,onChangeCountry:t,onChangeDocument:n}){let o=ke(a);return n===void 0&&t===void 0?null:(0,e.jsxs)("div",{className:"sekyro-links",children:[n!==void 0?(0,e.jsx)("button",{type:"button",className:"sekyro-link",onClick:n,children:o("native.doc.changeDocument")}):null,t!==void 0?(0,e.jsx)("button",{type:"button",className:"sekyro-link",onClick:t,children:a.t("native.doc.changeCountry")}):null]})}c(ge,"et");h(ge,"ChangeLinks");function we({i18n:a,upload:t}){return t!=="unsupported"&&t!=="failed"?null:(0,e.jsx)(pe,{tone:"warning",children:(0,e.jsx)("span",{children:E(a).t(t==="unsupported"?"doc.uploadUnsupported":"doc.uploadFailed")})})}c(we,"tt");h(we,"UploadNotice");function Qe({step:a,i18n:t,ageLead:n,upload:o,offered:r,onPick:v,onCamera:C,onChangeCountry:f,onChangeDocument:k}){let y=E(t),g=o==="sending";return(0,e.jsxs)("section",{className:"sekyro-step","data-testid":"sekyro-doc-upload-screen",children:[(0,e.jsx)(ye,{passport:a.documentType==="passport"}),(0,e.jsx)(he,{title:y.t("doc.uploadTitle"),lead:n?t.t("doc.ageStepUp"):y.t("doc.uploadHint")}),n?(0,e.jsx)("p",{className:"sekyro-text-muted",children:y.t("doc.uploadHint")}):null,(0,e.jsx)(re,{step:a,i18n:t}),(0,e.jsx)(ge,{i18n:t,...k!==void 0?{onChangeDocument:k}:{},...f!==void 0?{onChangeCountry:f}:{}}),(0,e.jsx)(we,{i18n:t,upload:o}),g?(0,e.jsx)("p",{className:"sekyro-text-muted",role:"status",children:t.t("doc.uploading")}):null,(0,e.jsxs)(me,{children:[(0,e.jsxs)(B,{full:!0,onClick:v,disabled:g||!r||a.attemptsExhausted,children:[(0,e.jsx)(Q,{name:"image"}),y.t("doc.source.upload")]}),C!==void 0?(0,e.jsxs)(B,{full:!0,kind:"ghost",onClick:C,disabled:g,children:[(0,e.jsx)(X,{name:"camera"}),y.t("doc.source.camera")]}):null]})]})}c(Qe,"_t");h(Qe,"DocumentUploadScreen");function fe(a,t,n){let o=a*.88,r=o/n;return{x:(a-o)/2,y:t*.42-r/2,w:o,h:r}}c(fe,"Ze");h(fe,"guideRect");var Lt={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"},Tt=h(()=>typeof window<"u"&&window.matchMedia?.("(prefers-reduced-motion: reduce)").matches===!0,"reduceMotion");function Ze({step:a,i18n:t,liveMrz:n,barcodeAssetBaseUrl:o,onClose:r,attempts:v,onUpload:C}){let f=ke(t),k=(0,i.useContext)(Be),y=(0,i.useRef)(k);y.current=k;let g=(0,i.useRef)(null),T=(0,i.useRef)(null),b=(0,i.useRef)(null),[N,V]=(0,i.useState)("idle"),[w,I]=(0,i.useState)(null),[M,H]=(0,i.useState)(null),[p,Z]=(0,i.useState)({w:0,h:0}),[z,W]=(0,i.useState)({hint:null,locking:!1,card:null,manualShutter:!1}),[D,q]=(0,i.useState)({}),[j,et]=(0,i.useState)(null),[Ce,tt]=(0,i.useState)(null),[be,ze]=(0,i.useState)(0),[Se,_e]=(0,i.useState)(null),[J,Ne]=(0,i.useState)(null),P=a.documentType==="passport",K=P?1.42:1.586;Ae(!0),(0,i.useLayoutEffect)(()=>{let s=g.current;if(s===null)return;let u=h(()=>Z({w:s.clientWidth,h:s.clientHeight}),"measure");if(u(),typeof ResizeObserver>"u")return;let d=new ResizeObserver(u);return d.observe(s),()=>d.disconnect()},[]);let l=fe(p.w,p.h,K);(0,i.useEffect)(()=>{p.w===0||p.h===0||b.current?.setGuide?.({viewAspect:p.w/p.h,rect:{x:l.x/p.w,y:l.y/p.h,width:l.w/p.w,height:l.h/p.h}})},[p.w,p.h,l.x,l.y,l.w,l.h]),(0,i.useEffect)(()=>{let s=T.current;if(s===null)return;let u=a.capture({video:s,...n!==void 0?{liveMrz:n}:{},...o!==void 0?{barcodeAssetBaseUrl:o}:{}});b.current=u;let d=g.current;if(d!==null&&d.clientWidth>0&&d.clientHeight>0){let m=fe(d.clientWidth,d.clientHeight,K);u.setGuide?.({viewAspect:d.clientWidth/d.clientHeight,rect:{x:m.x/d.clientWidth,y:m.y/d.clientHeight,width:m.w/d.clientWidth,height:m.h/d.clientHeight}})}let L=new wt,_={scan:null,feedback:null,gate:null},U=h(m=>{_={..._,...m};let $=_.gate?.guide,ct={phase:_.scan?.phase??"framing",hint:_.feedback?.reticle==="coaching"?_.feedback.key:null,card:$?.detected?{fill:$.fill,offsetX:$.offsetX,offsetY:$.offsetY}:null,manualShutter:_.scan?.manualShutter??!1},R=L.present(ct,performance.now());W(O=>O.hint===R.hint&&O.locking===R.locking&&O.manualShutter===R.manualShutter&&O.card?.fill===R.card?.fill&&O.card?.offsetX===R.card?.offsetX&&O.card?.offsetY===R.card?.offsetY?O:R)},"present"),st=[u.on("state",V),u.on("feedback",m=>U({feedback:m})),u.on("gate",m=>U({gate:m})),u.on("scan",m=>{I(m),U({scan:m})}),u.on("captured",m=>{q($=>({...$,[qe(m.side,P,$)]:m.previewDataUrl})),et(m.previewDataUrl),tt(Ke(s))}),u.on("error",m=>{H(m);let $=y.current;$!==null&&Ve($,Ee("document",m,Math.max(0,v.current)))}),u.on("mrz",m=>{m.state==="mismatch"?Ne(m.format??null):_e(m)})];return v.current+=1,u.start().catch(()=>{}),()=>{for(let m of st)m();u.destroy(),b.current=null}},[a.issuer,a.documentType]);let x=w?.phase??"framing",A=x==="reading"||x==="result",le=x==="flipCue"||x==="reaskRecto",G=z.locking,xe=w?.captured.length??0;(0,i.useEffect)(()=>{G&&ze(s=>s+1)},[G]),(0,i.useEffect)(()=>{xe>0&&ze(s=>s+1)},[xe]);let at=w?.expected??null;(0,i.useEffect)(()=>{_e(null)},[at]),(0,i.useEffect)(()=>{if(J===null)return;let s=setTimeout(()=>Ne(null),2e3);return()=>clearTimeout(s)},[J]);let $e=le||A||a.documentType==="drivers_license"?null:Fe(Se,P),ie=J!==null?J==="TD3"?"dcv3.mrz.looksLikePassport":"dcv3.mrz.looksLikeCard":$e,nt=ie===null?null:t.strings[ie]??zt[t.locale][ie],se=oe(a),Le=z.hint===null?null:Lt[z.hint]??`dcv2.${z.hint}`,ot=Le??(x==="flipCue"?w?.notice==="same_face"?"doc.sameFace":"doc.flip":x==="reaskRecto"?"doc.reaskRecto":A?"native.scan.reading":x==="locking"||x==="capturing"||G?"native.scan.holdStill":w?.notice==="reread"?se??"doc.reread":w?.notice==="technical"?"native.scan.retry":w?.notice==="blurry"?"native.scan.blurry":se??(P?"doc.showPage":"doc.showSide")),ce=nt??f(ot),Y=z.card,S=l;if(!G&&Y!==null&&Y.fill>=.45&&Y.fill<=1.25&&!Tt()){let s=l.w*Y.fill,u=s/K,d=l.x+l.w/2+l.w*Math.max(-.25,Math.min(.25,Y.offsetX)),L=l.y+l.h/2+l.h*Math.max(-.25,Math.min(.25,Y.offsetY));S={x:d-s/2,y:L-u/2,w:s,h:u}}let ee=l.w*.045,de=28,Te=Math.min(ee,de*.6),rt=[[S.x,S.y,1,1],[S.x+S.w,S.y,-1,1],[S.x,S.y+S.h,1,-1],[S.x+S.w,S.y+S.h,-1,-1]],lt=G?"is-locked":z.hint!==null?"is-coaching":"",it=P?[{side:"single",label:"doc.progressPage"}]:[{side:"recto",label:"doc.progressFront"},{side:"verso",label:"doc.progressBack"}],Me=l.y+l.h+48,ue={insetInlineStart:l.x,insetBlockStart:l.y,inlineSize:l.w,blockSize:l.h,borderRadius:ee};return(0,e.jsx)("section",{className:"sekyro-lm","aria-label":ce,"data-testid":"sekyro-document",children:(0,e.jsxs)("div",{ref:g,className:`sekyro-lm-stage${A?" is-reading":""}${le?" is-flip":""}`,style:{"--sekyro-guide-w":`${l.w}px`},children:[(0,e.jsx)("video",{ref:T,className:"sekyro-lm-video",playsInline:!0,muted:!0,autoPlay:!0,"aria-hidden":"true",onPointerUp:c(s=>{let u=s.currentTarget,d=u.getBoundingClientRect(),L=Math.max(d.width/(u.videoWidth||1),d.height/(u.videoHeight||1)),_=u.videoWidth*L,U=u.videoHeight*L;_>0&&U>0&&b.current?.focusAt((s.clientX-d.left+(_-d.width)/2)/_,(s.clientY-d.top+(U-d.height)/2)/U)},"onPointerUp")}),p.w>0?(0,e.jsxs)(e.Fragment,{children:[A&&Ce!==null?(0,e.jsx)("img",{className:"sekyro-lm-scene",src:Ce,alt:""}):null,A&&j!==null?(0,e.jsx)("img",{className:"sekyro-lm-frozen",src:j,alt:"",style:ue}):null,(0,e.jsxs)("svg",{className:"sekyro-lm-overlay",viewBox:`0 0 ${p.w} ${p.h}`,"aria-hidden":"true",focusable:"false",children:[(0,e.jsxs)("defs",{children:[(0,e.jsxs)("linearGradient",{id:"sekyro-lm-top",x1:"0",y1:"0",x2:"0",y2:"1",children:[(0,e.jsx)("stop",{offset:"0",className:"sekyro-lm-ink",stopOpacity:"0.85"}),(0,e.jsx)("stop",{offset:"1",className:"sekyro-lm-ink",stopOpacity:"0"})]}),(0,e.jsxs)("linearGradient",{id:"sekyro-lm-bottom",x1:"0",y1:"0",x2:"0",y2:"1",children:[(0,e.jsx)("stop",{offset:"0",className:"sekyro-lm-ink",stopOpacity:"0"}),(0,e.jsx)("stop",{offset:"1",className:"sekyro-lm-ink",stopOpacity:"0.9"})]})]}),(0,e.jsx)("path",{className:"sekyro-lm-scrim",fillRule:"evenodd",d:`M0 0H${p.w}V${p.h}H0Z${Je(l,ee)}`}),(0,e.jsx)("rect",{width:p.w,height:Math.max(0,l.y),fill:"url(#sekyro-lm-top)"}),(0,e.jsx)("rect",{y:l.y+l.h,width:p.w,height:Math.max(0,p.h-l.y-l.h),fill:"url(#sekyro-lm-bottom)"}),(0,e.jsx)("g",{className:`sekyro-lm-brackets ${lt}`,children:rt.map(([s,u,d,L],_)=>(0,e.jsx)("path",{style:{transform:`translate(${s}px, ${u}px) scale(${d}, ${L})`},d:`M0 ${de}V${Te}Q0 0 ${Te} 0H${de}`},_))}),G?(0,e.jsx)("rect",{className:"sekyro-lm-trace",x:l.x,y:l.y,width:l.w,height:l.h,rx:ee,pathLength:"1",style:{animationDuration:`${bt}ms`}}):null]}),(0,e.jsx)("div",{className:"sekyro-lm-slot",style:ue,"aria-hidden":"true",children:A?(0,e.jsx)("span",{className:"sekyro-lm-read is-repeating"}):be>0?(0,e.jsx)("span",{className:"sekyro-lm-read"},be):null})]}):null,$e!==null?(0,e.jsx)("div",{className:"sekyro-lm-slot",style:ue,"aria-hidden":"true",children:(0,e.jsx)("span",{"data-testid":"sekyro-mrz-strip",className:`sekyro-lm-mrz${P?" is-page":""}${Se?.state==="valid"?" is-valid":""}`})}):null,(0,e.jsxs)("div",{className:"sekyro-lm-instruction",style:{insetBlockStart:l.y-64},children:[(0,e.jsx)("div",{role:"status","aria-live":"polite",children:(0,e.jsx)(Oe,{swapKey:ce,className:"sekyro-lm-line",children:ce})}),se!==null&&x==="framing"&&Le===null?(0,e.jsx)("p",{className:"sekyro-lm-attempts",children:ve(t,a.attemptsRemaining,a.attemptsExhausted)}):null]}),A?(0,e.jsxs)("p",{className:"sekyro-lm-under sekyro-lm-note",style:{insetBlockStart:Me-12},children:[(0,e.jsx)("span",{className:"sekyro-lm-spinner","aria-hidden":"true"}),f("native.scan.putDown")]}):le?(0,e.jsx)("div",{className:`sekyro-lm-under sekyro-lm-flip${x==="reaskRecto"?" is-toFront":""}`,style:{insetBlockStart:Me-20},"data-testid":"sekyro-flip-cue","aria-hidden":"true",children:(0,e.jsxs)("span",{className:"sekyro-lm-flip-card",style:{aspectRatio:String(K)},children:[(0,e.jsx)("span",{className:"sekyro-lm-flip-front"}),(0,e.jsx)("span",{className:"sekyro-lm-flip-back"})]})}):null,(0,e.jsxs)("div",{className:"sekyro-lm-controls",children:[(0,e.jsxs)("div",{className:"sekyro-lm-bar",children:[(0,e.jsx)("button",{type:"button",className:"sekyro-glass","aria-label":t.t("native.close"),onClick:r,children:(0,e.jsx)(X,{name:"close"})}),w?.torchAvailable?(0,e.jsx)("button",{type:"button",className:`sekyro-glass${w.torch?" is-on":""}`,"aria-label":t.t("doc.torchOn"),"aria-pressed":w.torch,onClick:c(()=>b.current?.setTorch(!w.torch),"onClick"),children:(0,e.jsx)(Q,{name:"flashlight"})}):null]}),M!==null?(0,e.jsxs)("div",{className:"sekyro-lm-error",role:"alert",children:[(0,e.jsx)("p",{children:t.t("doc.cameraBlocked")}),(0,e.jsx)("p",{children:t.t(M.kind==="permission"?"doc.cameraBlockedHint":De(M.kind))}),(0,e.jsx)(B,{onClick:c(()=>{H(null),v.current+=1,b.current?.retry()},"onClick"),children:t.t("doc.retryCamera")})]}):null,z.manualShutter?(0,e.jsx)("button",{type:"button",className:"sekyro-shutter","aria-label":t.t("doc.shutter"),onClick:c(()=>b.current?.shutter(),"onClick")}):null,(0,e.jsx)("ol",{className:"sekyro-lm-tray",children:it.map(({side:s,label:u})=>{let d=w?.captured.includes(s)??!1;return(0,e.jsxs)("li",{className:d?"is-done":void 0,"aria-current":!d&&(P||w?.expected===s)?"step":void 0,children:[d?(0,e.jsxs)("span",{className:"sekyro-lm-thumb",children:[D[s]!==void 0?(0,e.jsx)("img",{src:D[s],alt:""}):null,(0,e.jsx)("svg",{className:"sekyro-lm-check",viewBox:"0 0 18 18","aria-hidden":"true",children:(0,e.jsx)("path",{d:"M5 9.2l2.6 2.6L13 6.4"})})]}):null,f(u)]},s)})}),C!==void 0?(0,e.jsx)("button",{type:"button",className:"sekyro-lm-upload",onClick:C,children:E(t).t("doc.uploadInstead")}):null,N==="uploading"||N==="checking"?null:(0,e.jsx)(Re,{onStop:r})]}),N==="uploading"||N==="checking"?(0,e.jsx)("span",{className:"sekyro-visually-hidden",role:"status",children:N==="uploading"?t.t("doc.uploading"):f("native.scan.reading")}):null]})})}c(Ze,"Lt");h(Ze,"LumiereScan");function qe(a,t,n){return t?"single":a==="recto"||a==="verso"?a:n.recto===void 0?"recto":"verso"}c(qe,"zt");h(qe,"slotOf");function Je({x:a,y:t,w:n,h:o},r){return`M${a+r} ${t}H${a+n-r}Q${a+n} ${t} ${a+n} ${t+r}V${t+o-r}Q${a+n} ${t+o} ${a+n-r} ${t+o}H${a+r}Q${a} ${t+o} ${a} ${t+o-r}V${t+r}Q${a} ${t} ${a+r} ${t}Z`}c(Je,"xt");h(Je,"roundedRect");function Ke(a){let t=Math.round(a.videoWidth/4),n=Math.round(a.videoHeight/4);if(t===0||n===0||typeof document>"u")return null;try{let o=document.createElement("canvas");o.width=t,o.height=n;let r=o.getContext("2d");return r===null?null:(r.drawImage(a,0,0,t,n),o.toDataURL("image/jpeg",.7))}catch{return null}}c(Ke,"Tt");h(Ke,"sceneSnapshot");export{$t as DocumentCaptureView,bt as LOCK_TRACE_MS,_t as UPLOAD_ACCEPT,fe as guideRect,Fe as mrzInstruction,qe as slotOf};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{a as j,b as v,c as z}from"./chunk-N2DNXUEA.js";import{a as O,b as W,c as q}from"./chunk-
|
|
1
|
+
"use client";import{a as j,b as v,c as z}from"./chunk-N2DNXUEA.js";import{a as O,b as W,c as q}from"./chunk-XEWL7C6M.js";import{a as U}from"./chunk-YZ6YGLNN.js";import{a as E}from"./chunk-K7PFKAQD.js";import"./chunk-HLMRVFVD.js";import{H as T,K as R,a as te,b as oe,c as N,t as P,y as A}from"./chunk-BZGVYIDN.js";import{a as u,c as L,i as o}from"./chunk-SSU37LFQ.js";var a=L(te(),1),i=L(oe(),1);import{isValidNni as ce,normalizeNni as J}from"@sekyro/web";var K={en:v,fr:z,ar:j,es:v,pt:v,de:v},w=6,pe=new Set(["eid_identifier_invalid","eid_code_invalid","eid_locked","eid_not_enrolled"]),Q=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:X}){let C=d.strings,r=o((n,t)=>E(C[n]??K[d.locale][n]??"",t),"t"),I=o((n,t)=>{let se=new Intl.PluralRules(d.locale).select(t),G=`${n}.${se}`,le=C[G]??K[d.locale][G]??r(`${n}.other`);return E(le,{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"),[B,Y]=(0,a.useState)(""),[f,_]=(0,a.useState)(""),[c,S]=(0,a.useState)(!1),[b,p]=(0,a.useState)(null),s=e.phase==="code",D=q(s),l=(0,a.useId)(),Z=P(),[ee,ie]=O(e.reason==="eid_code_invalid",e.codeAttemptsRemaining??0,()=>_("")),m=o(async n=>{S(!0),p(null);try{await n()}catch(t){p(U(t,d.strings)),X?.(t)}finally{S(!1)}},"run"),F=(0,a.useRef)(!1);(0,a.useEffect)(()=>{!e.identifierBound||s||e.reason!==void 0||F.current||(F.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 M=(0,a.useRef)(s);(0,a.useEffect)(()=>{s&&!M.current&&document.getElementById(`${l}-code`)?.focus(),M.current=s},[s,l]);let k=e.reason==="eid_locked",H=Q(e.codeExpiresAt,D),x=s&&e.codeExpiresAt!==void 0&&H===0,$=Q(e.resendAvailableAt,D),V=e.resendsRemaining===0||e.reason==="eid_resend_limit",ne=o(n=>{if(n.preventDefault(),s){f.length===w&&!k&&m(()=>e.verify(f));return}if(e.identifierBound){m(()=>e.start());return}let t=J(B);if(e.country==="MR"){if(!/^\d{10}$/.test(t))return p("population.invalid");if(!ce(t))return p("population.reason_nni_invalid")}m(()=>e.start(t))},"onSubmit"),g=e.reason?.startsWith("eid_")?e.reason:void 0,re=(0,i.jsxs)(i.Fragment,{children:[g!==void 0?(0,i.jsxs)(R,{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:I("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)(R,{tone:"danger",children:(0,i.jsx)("span",{children:d.t(b)})}):null]}),[ae,de]=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:ne,noValidate:!0,"data-testid":"sekyro-eid",children:[(0,i.jsxs)("div",{className:"sekyro-heading",children:[(0,i.jsx)("h2",{id:l,ref:Z,tabIndex:-1,className:"sekyro-text-body",children:ae}),(0,i.jsx)("p",{className:"sekyro-text-muted",children:s&&e.context.simulation!==void 0?(0,i.jsx)(T,{template:d.t("sandbox.otpHint"),code:e.context.simulation.otpCode}):de}),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]}),re,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)(W,{id:`${l}-code`,value:f,length:w,invalid:ee,onChange:u(n=>{p(null),n!==""&&ie(),_(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(H)})}):null]}),(0,i.jsx)("span",{className:"sekyro-visually-hidden",role:"status","aria-live":"polite",children:x?r("eid.expired"):""}),(0,i.jsxs)(A,{children:[(0,i.jsx)(N,{type:"submit",full:!0,disabled:c||f.length!==w||k,"aria-busy":c||void 0,children:r("eid.verify")}),(0,i.jsx)("div",{className:"sekyro-resend-row",children:V?(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")})}),!V&&e.resendsRemaining!==void 0?(0,i.jsx)("p",{className:"sekyro-help sekyro-center",children:I("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:B,"aria-describedby":`${l}-nni-help`,"aria-invalid":b==="population.invalid"||b==="population.reason_nni_invalid"||void 0,onChange:u(n=>{p(null),Y(J(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)(A,{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 G,b as J,c as K}from"./chunk-FHAN7WFM.js";import{a as Y}from"./chunk-YZ6YGLNN.js";import{a as B}from"./chunk-5MQUCOFK.js";import"./chunk-PNZPHUSG.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-VD7QSFUC.js";import{a as p,c as W,i as r}from"./chunk-SSU37LFQ.js";var s=W(de(),1),e=W(me(),1);import{OtpInputError as pe}from"@sekyro/web";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},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"),_e=600,Oe=60,fe=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 ve({step:a,i18n:n,className:h,defaultEmail:_="",onError:Z}){let i=r((t,o)=>B(n.strings[t]??he[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 pe&&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,_e),C=Q(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;P(A===null?null:l?()=>{}:A);let[oe,le]=i("emailOtp.sentTo").split("{email}"),M=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&&M!==void 0?(0,e.jsx)(j,{template:n.t("sandbox.otpHint"),code:M}):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: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=>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(ve,"Ve");r(ve,"EmailOtpView");export{ve as EmailOtpView};
|
|
1
|
+
"use client";import{a as G,b as J,c as K}from"./chunk-XEWL7C6M.js";import{a as Y}from"./chunk-YZ6YGLNN.js";import{a as B}from"./chunk-K7PFKAQD.js";import"./chunk-HLMRVFVD.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-BZGVYIDN.js";import{a as p,c as W,i as r}from"./chunk-SSU37LFQ.js";var s=W(de(),1),e=W(me(),1);import{OtpInputError as pe}from"@sekyro/web";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},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"),_e=600,Oe=60,fe=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 ve({step:a,i18n:n,className:h,defaultEmail:_="",onError:Z}){let i=r((t,o)=>B(n.strings[t]??he[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 pe&&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,_e),C=Q(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;P(A===null?null:l?()=>{}:A);let[oe,le]=i("emailOtp.sentTo").split("{email}"),M=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&&M!==void 0?(0,e.jsx)(j,{template:n.t("sandbox.otpHint"),code:M}):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: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=>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(ve,"Ve");r(ve,"EmailOtpView");export{ve as EmailOtpView};
|