@sekyro/react 0.1.0-rc.35 → 0.1.0-rc.36
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
CHANGED
|
@@ -1,5 +1,16 @@
|
|
|
1
1
|
# @sekyro/react
|
|
2
2
|
|
|
3
|
+
## 0.1.0-rc.36
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- ae5142b: Document capture on low-end phones: the back of a card held still reaches the server again. A photo the live MRZ reader fired on is the MRZ face (the band classifier is not asked). After two same-face drops the next photo goes to the server as the missing face, a drop no longer waits for a flip the phone did not see, and the notice clears once the card leaves the guide. The server asking for the face the camera already waits on no longer restarts the scan. On the low reader tier the live MRZ read holds the auto-capture back for 3 s at most and the still confirmation (`deviceRead`) is skipped. Low-end devices keep the 1080p camera with the live reader (no 2560 × 1440 stream) and take the first still (no best-frame window). The barcode decoder has a 1.5 s budget per photo, after which the capture order decides. The React capture view no longer re-renders for sub-pixel bracket moves.
|
|
8
|
+
- Updated dependencies [7528fca]
|
|
9
|
+
- Updated dependencies [451cd78]
|
|
10
|
+
- Updated dependencies [4743339]
|
|
11
|
+
- Updated dependencies [ae5142b]
|
|
12
|
+
- @sekyro/web@0.1.0-rc.38
|
|
13
|
+
|
|
3
14
|
## 0.1.0-rc.35
|
|
4
15
|
|
|
5
16
|
### Patch Changes
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import{a as We}from"./chunk-KB7SLMC3.js";import{d as Fe}from"./chunk-ODSPOWMV.js";import"./chunk-6JKZ5S2U.js";import{a as Ue,b as Ee,c as Ke}from"./chunk-7MMT5M4E.js";import{d as Ae}from"./chunk-ERWGG4X6.js";import{a as V,b as he,d as fe,j as Be,k as Ve,l as Ge,n as Ye,p as ye,q as ve}from"./chunk-PEQBKIR7.js";import"./chunk-BMD5J7TC.js";import{a as B,m as Oe,o as Re}from"./chunk-P7TS7JPW.js";import{a as s}from"./chunk-2KED7D2Q.js";import{acceptedTypesFor as bt}from"@sekyro/web";import{useContext as nt,useEffect as G,useLayoutEffect as _t,useRef as L,useState as k}from"react";var Xe={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"/>'};var je={"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":"يبدو أن هذه بطاقة تعريف أو بطاقة إقامة"};var Q={"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"};var Qe={"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"};var Ze={"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":"رفع صورة"};var Z={"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"};var Je={"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"};var qe={"native.doc.introTitle":"سنلتقط صورة لوثيقتك","native.doc.introLead":"تُلتقط الصورة تلقائيًا عندما تكون الوثيقة داخل الإطار.","native.doc.tip.flat":"ضع الوثيقة مسطحة على سطح داكن.","native.doc.tip.glare":"تجنّب انعكاسات الضوء.","native.doc.tip.frame":"أبقِ الوثيقة كاملة داخل الإطار.","native.doc.openCamera":"افتح الكاميرا","native.doc.changeDocument":"تغيير الوثيقة","native.doc.titleOf.carte_identite":"صوّر بطاقة هويتك","native.doc.titleOf.passport":"صوّر جواز سفرك","native.doc.titleOf.residence_permit":"صوّر بطاقة إقامتك","native.doc.titleOf.drivers_license":"صوّر رخصة قيادتك","native.doc.onlyType.carte_identite":"{country}: تُقبل بطاقة الهوية فقط هنا.","native.doc.onlyType.passport":"{country}: يُقبل جواز السفر فقط هنا.","native.doc.onlyType.residence_permit":"{country}: تُقبل بطاقة الإقامة فقط هنا.","native.doc.onlyType.drivers_license":"{country}: تُقبل رخصة القيادة فقط هنا.","native.scan.closer":"اقترب قليلًا","native.scan.farther":"ابتعد قليلًا","native.scan.glare":"أمِل البطاقة قليلًا","native.scan.dark":"الإضاءة ضعيفة. شغّل المصباح.","native.scan.blurry":"الصورة غير واضحة. ثبّت الهاتف.","native.scan.holdStill":"لا تتحرك","native.scan.reading":"جارٍ التحقق من وثيقتك…","native.scan.putDown":"يمكنك وضع وثيقتك جانبًا.","native.scan.retry":"لنحاول مرة أخرى","native.scan.seenPassport":"يبدو أن هذا جواز سفر","native.scan.seenCard":"يبدو أن هذه بطاقة هوية أو بطاقة إقامة","native.scan.showInstead.carte_identite":"أظهر بطاقة هويتك بدلًا منها","native.scan.showInstead.passport":"أظهر صفحة الصورة في جواز سفرك بدلًا منها","native.scan.showInstead.residence_permit":"أظهر بطاقة إقامتك بدلًا منها","native.scan.showInstead.drivers_license":"أظهر رخصة قيادتك بدلًا منها"};var J={"native.doc.introTitle":"Photograph your document","native.doc.introLead":"The photo is taken by itself once the document is in the frame.","native.doc.tip.flat":"Lay it flat on a dark surface.","native.doc.tip.glare":"Avoid glare from lights.","native.doc.tip.frame":"Keep all of it in the frame.","native.doc.openCamera":"Open the camera","native.doc.changeDocument":"Change document","native.doc.titleOf.carte_identite":"Photograph your identity card","native.doc.titleOf.passport":"Photograph your passport","native.doc.titleOf.residence_permit":"Photograph your residence permit","native.doc.titleOf.drivers_license":"Photograph your driver's license","native.doc.onlyType.carte_identite":"{country}: only an identity card is accepted here.","native.doc.onlyType.passport":"{country}: only a passport is accepted here.","native.doc.onlyType.residence_permit":"{country}: only a residence permit is accepted here.","native.doc.onlyType.drivers_license":"{country}: only a driver's license is accepted here.","native.scan.closer":"Move a little closer","native.scan.farther":"Move back a little","native.scan.glare":"Tilt the card a little","native.scan.dark":"Too dark. Turn on the light.","native.scan.blurry":"Blurry image. Hold the phone still.","native.scan.holdStill":"Hold still","native.scan.reading":"Checking your document…","native.scan.putDown":"You can put your document down.","native.scan.retry":"Let's try that again","native.scan.seenPassport":"This looks like a passport","native.scan.seenCard":"This looks like an identity card or residence permit","native.scan.showInstead.carte_identite":"Show your identity card instead","native.scan.showInstead.passport":"Show the photo page of your passport instead","native.scan.showInstead.residence_permit":"Show your residence permit instead","native.scan.showInstead.drivers_license":"Show your driver's license instead"};var et={"native.doc.introTitle":"Photographiez votre pièce","native.doc.introLead":"La photo se prend toute seule quand la pièce est bien cadrée.","native.doc.tip.flat":"Posez la pièce à plat sur fond sombre.","native.doc.tip.glare":"Évitez les reflets de lumière.","native.doc.tip.frame":"Gardez toute la pièce dans le cadre.","native.doc.openCamera":"Ouvrir la caméra","native.doc.changeDocument":"Changer de document","native.doc.titleOf.carte_identite":"Photographiez votre carte d'identité","native.doc.titleOf.passport":"Photographiez votre passeport","native.doc.titleOf.residence_permit":"Photographiez votre titre de séjour","native.doc.titleOf.drivers_license":"Photographiez votre permis de conduire","native.doc.onlyType.carte_identite":"{country} : seule la carte d'identité est acceptée ici.","native.doc.onlyType.passport":"{country} : seul le passeport est accepté ici.","native.doc.onlyType.residence_permit":"{country} : seul le titre de séjour est accepté ici.","native.doc.onlyType.drivers_license":"{country} : seul le permis de conduire est accepté ici.","native.scan.closer":"Approchez un peu","native.scan.farther":"Reculez un peu","native.scan.glare":"Inclinez un peu la carte","native.scan.dark":"Trop sombre. Allumez la lampe.","native.scan.blurry":"Image floue. Tenez le téléphone immobile.","native.scan.holdStill":"Ne bougez plus","native.scan.reading":"Vérification de votre document…","native.scan.putDown":"Vous pouvez poser votre pièce.","native.scan.retry":"Réessayons","native.scan.seenPassport":"Ceci ressemble à un passeport","native.scan.seenCard":"Ceci ressemble à une carte d'identité ou un titre de séjour","native.scan.showInstead.carte_identite":"Montrez plutôt votre carte d'identité","native.scan.showInstead.passport":"Montrez plutôt la page photo de votre passeport","native.scan.showInstead.residence_permit":"Montrez plutôt votre titre de séjour","native.scan.showInstead.drivers_license":"Montrez plutôt votre permis de conduire"};var ge=class ge{constructor(){this.shown=null;this.shownAt=0;this.yielded=null}present(t,o,r,a){(t===null||t.key!==this.yielded)&&(this.yielded=null);let l=this.shown;return t!==null&&this.yielded===null?l?.kind==="problem"&&l.key===t.key&&l.action===t.action?!t.blocking&&o!==null&&a-this.shownAt>=3e3?(this.yielded=t.key,this.show({kind:"hint",key:o,action:null},a)):l:this.show({kind:"problem",key:t.key,action:t.action},a):l?.kind==="problem"&&t===null&&(r||a-this.shownAt<3e3)?l:o===null?this.show(null,a):l?.kind==="hint"&&l.key===o?l:this.show({kind:"hint",key:o,action:null},a)}show(t,o){return this.shown=t,this.shownAt=o,t}};s(ge,"NoticeBand");var re=ge;var wt=["locking","capturing"],Se=class Se{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,o){return this.presentHint(t,o),this.presentLock(t,o),this.presentCard(t,o),this.shutterSince=t.manualShutter?this.shutterSince??o:null,this.shown={...this.shown,manualShutter:this.shutterSince!==null&&o-this.shutterSince>=1e3},this.shown}presentHint(t,o){let r=t.phase==="framing"&&!(t.hint==="blurry"&&t.card===null)?t.hint:null;if(t.phase!=="framing"){this.shown={...this.shown,hint:null},this.candidate=null;return}if(r!==this.candidate&&(this.candidate=r,this.candidateSince=o),r===this.shown.hint)return;let a=o-this.candidateSince>=(r===null?0:350),l=this.shown.hint===null||o-this.hintShownAt>=2500;a&&l&&(this.shown={...this.shown,hint:r},this.hintShownAt=o)}presentLock(t,o){if(wt.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=o),o-this.lockLostAt>=300&&(this.shown={...this.shown,locking:!1},this.lockLostAt=null)}}presentCard(t,o){let r=t.card;if(r===null||t.phase!=="framing"){if(t.phase!=="framing"){this.shown={...this.shown,card:null},this.detectedSince=null,this.lostSince=null;return}this.detectedSince=null,this.lostSince??(this.lostSince=o),o-this.lostSince>=300&&(this.shown={...this.shown,card:null});return}if(this.lostSince=null,this.detectedSince??(this.detectedSince=o),o-this.detectedSince<250)return;let a=this.shown.card;if(a===null){this.shown={...this.shown,card:{...r}};return}let l=.35;this.shown={...this.shown,card:{fill:a.fill+(r.fill-a.fill)*l,offsetX:a.offsetX+(r.offsetX-a.offsetX)*l,offsetY:a.offsetY+(r.offsetY-a.offsetY)*l}}}};s(Se,"ScanPresenter");var ae=Se;import{Fragment as ke,jsx as n,jsxs as d}from"react/jsx-runtime";var Ct={en:J,fr:et,ar:qe,es:J,pt:J,de:J},zt=450,we=s(e=>(t,o)=>Ae(e.strings[t]??Ct[e.locale][t]??"",o),"useScanCopy");function Nt(e,t){try{return new Intl.DisplayNames([t],{type:"region"}).of(e)??e}catch{return e}}s(Nt,"regionName");function Dt(e){let t=e.documentType,o=t===null?"native.doc.introTitle":`native.doc.titleOf.${t}`,r=t!==null&&e.issuer!==null&&bt(e.documents,e.issuer).length===1;return{titleKey:o,onlyKey:r?`native.doc.onlyType.${t}`:null}}s(Dt,"introCopy");function se({name:e}){return n("svg",{className:"sekyro-glyph",viewBox:"0 0 24 24",fill:"none","aria-hidden":"true",focusable:"false",dangerouslySetInnerHTML:{__html:Xe[e]}})}s(se,"ScanGlyph");var xt={en:Q,fr:Qe,ar:je,es:Q,pt:Q,de:Q},Tt={en:Z,fr:Je,ar:Ze,es:Z,pt:Z,de:Z},Lt="image/jpeg,image/png,image/heic,image/heif";function W(e){let t=e.strings,o=s(r=>t[r]??Tt[e.locale][r],"text");return{t:s(r=>o(r)??"","t")}}s(W,"uploadCopy");function Mt(e,t){return e===null||e.state==="fallback"||e.state==="mismatch"?null:e.state==="searching"?t?"dcv3.mrz.searching":"dcv3.mrz.showMrzSide":e.state==="valid"?"dcv3.mrz.valid":e.coach==="holdStill"?"dcv3.mrz.holdStill":"dcv3.mrz.reading"}s(Mt,"mrzInstruction");function Pt(e){return e?.state==="reading"&&e.coach!==void 0&&e.coach!=="holdStill"?`mrz:${e.coach}`:null}s(Pt,"mrzHint");function It(e){return e==="carte_identite"||e==="passport"||e==="residence_permit"||e==="drivers_license"?`native.scan.showInstead.${e}`:null}s(It,"showInsteadKey");var $t={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 be(e){if(e.reason==="unreadable")return"doc.reason_unreadable";let t=e.reason!==void 0?$t[e.reason]:void 0;return t!==void 0?t:e.reason==="tester_document_mismatch"?"reasons.tester_document_mismatch":e.reason!==void 0&&e.reason!=="side_missing"?Re(e.reason):null}s(be,"reasonOf");var ot=new Set(["document_type_not_accepted","tester_document_mismatch","document_type_mismatch","provider_unavailable","document_type_not_supported","document_sides_mismatch"]);function Pn({step:e,i18n:t,liveMrz:o,barcodeAssetBaseUrl:r,ageLead:a,...l}){let[S,h]=k(!1),f=L(-1),[y,g]=k("idle"),w=L(null),C=typeof e.uploadDocument=="function",z=C?e.photo?.source??"camera":"camera",M=C&&z!=="camera"&&e.photo?.uploadOffered===!0,[b,Y]=k(null),H=z==="upload"?"upload":z==="choice"?b??e.photo?.pick??"source":"camera",O=y==="sending"?void 0:()=>w.current?.click(),v=s(async R=>{let ee=R.currentTarget.files?.[0];if(R.currentTarget.value="",ee!==void 0){h(!1),g("sending");try{await e.uploadDocument(ee),g("idle")}catch(j){g(j instanceof TypeError&&j.message==="unsupported_file"?"unsupported":"failed")}}},"onFile"),q=M?n("input",{ref:w,type:"file",accept:Lt,hidden:!0,"data-testid":"sekyro-doc-upload","aria-label":W(t).t("doc.uploadTitle"),onChange:R=>{v(R)}}):null,D=W(t),X=e.photo?.cameraOnPhone===!0;return H==="camera"&&X?n(Fe,{i18n:t,lead:t.t("handoff.lead.document"),refresh:e.refresh,actions:n(B,{kind:"ghost",full:!0,onClick:()=>Y("upload"),children:D.t("doc.source.upload")})}):H==="source"?n(We,{testId:"sekyro-doc-source",title:D.t("doc.source.title"),lead:D.t("doc.source.description"),cameraLabel:X?t.t("capture.source.phone"):D.t("doc.source.camera"),onPhone:X,uploadLabel:D.t("doc.source.upload"),notice:n(_e,{step:e,i18n:t}),onCamera:()=>Y("camera"),onUpload:()=>Y("upload")}):H==="upload"?d(ke,{children:[n(Rt,{step:e,i18n:t,ageLead:a===!0,upload:y,offered:M,onPick:()=>w.current?.click(),...z==="choice"?{onCamera:s(()=>Y("camera"),"onCamera")}:{},...l}),q]}):d(ke,{children:[S?n(Kt,{step:e,i18n:t,attempts:f,...o!==void 0?{liveMrz:o}:{},...r!==void 0?{barcodeAssetBaseUrl:r}:{},...M&&O!==void 0?{onUpload:O}:{},onClose:()=>h(!1)}):n(Ot,{step:e,i18n:t,ageLead:a===!0,onOpen:()=>h(!0),upload:y,...M&&O!==void 0?{onUpload:O}:{},...l}),q]})}s(Pn,"DocumentCaptureView");function rt({passport:e}){let o=Math.round(228/(e?1.42:1.586));return d("svg",{className:`sekyro-mark sekyro-mark--card${e?" sekyro-mark--passport":""}`,viewBox:`-12 ${e?-22:-12} 252 ${o+(e?34:24)}`,"aria-hidden":"true",focusable:"false",children:[n("defs",{children:n("clipPath",{id:"sekyro-card-clip",children:n("rect",{width:228,height:o,rx:"12.5"})})}),e?n("rect",{className:"sekyro-mark__page",x:"10",y:"-14",width:208,height:o,rx:"10"}):null,n("rect",{className:"sekyro-mark__card",width:228,height:o,rx:"12.5"}),n("rect",{className:"sekyro-mark__photo",x:"17",y:"17",width:"55",height:o*(e?.5:.62),rx:"6"}),[0,1,2].map(r=>n("rect",{className:"sekyro-mark__text",x:"88",y:23+r*o*.12,width:100-r*20,height:"6",rx:"3"},r)),e?[0,1].map(r=>n("line",{className:"sekyro-mark__code",x1:"17",x2:211,y1:o*.75+r*11,y2:o*.75+r*11},r)):n("rect",{className:"sekyro-mark__text",x:"88",y:23+3*o*.12,width:"60",height:"6",rx:"3"}),n("g",{clipPath:"url(#sekyro-card-clip)",children:n("g",{className:"sekyro-mark__read",style:{"--sekyro-read-w":"228px"},children:n("rect",{x:"-1",width:"2",height:o,className:"sekyro-mark__beam"})})}),n("path",{className:"sekyro-mark__brackets",d:Ht(-10,-10,248,o+20,16,30)})]})}s(rt,"ScanMark");function Ht(e,t,o,r,a,l){let S=Math.min(a,l*.6);return[[e,t,1,1],[e+o,t,-1,1],[e,t+r,1,-1],[e+o,t+r,-1,-1]].map(([f,y,g,w])=>`M${f} ${y+w*l}V${y+w*S}Q${f} ${y} ${f+g*S} ${y}H${f+g*l}`).join("")}s(Ht,"brackets");function Ot({step:e,i18n:t,ageLead:o,onOpen:r,onChangeCountry:a,onChangeDocument:l,upload:S,onUpload:h}){let f=we(t),y=W(t),g=e.documentType==="passport",w=Dt(e),C=be(e),z=S==="sending",M=nt(Ve)?.busy===!0;return d("section",{className:"sekyro-step sekyro-step--doc-intro","data-testid":"sekyro-document",children:[n(rt,{passport:g}),n(he,{title:f(w.titleKey)||f("native.doc.introTitle"),lead:o?t.t("doc.ageStepUp"):f("native.doc.introLead")}),w.onlyKey!==null&&e.issuer!==null?n("p",{className:"sekyro-text-muted sekyro-doc-only",children:f(w.onlyKey,{country:Nt(e.issuer,t.locale)})}):null,n(_e,{step:e,i18n:t}),e.reason!==void 0&&ot.has(e.reason)?null:d("ul",{className:"sekyro-tiprows",children:[d("li",{children:[n(V,{name:g?"passport":"card"}),f("native.doc.tip.flat")]}),d("li",{children:[n(V,{name:"light"}),f("native.doc.tip.glare")]}),d("li",{children:[n(se,{name:"image"}),f("native.doc.tip.frame")]})]}),n(at,{i18n:t,...l!==void 0?{onChangeDocument:l}:{},...a!==void 0?{onChangeCountry:a}:{}}),n(st,{i18n:t,upload:S}),z?n("p",{className:"sekyro-text-muted",role:"status",children:t.t("doc.uploading")}):h!==void 0?n("p",{className:"sekyro-text-muted",children:y.t("doc.uploadHint")}):null,d(fe,{children:[d(B,{full:!0,onClick:r,disabled:z||M,children:[n(V,{name:"camera"}),f("native.doc.openCamera")]}),h!==void 0?d(B,{full:!0,kind:"ghost",onClick:h,children:[n(se,{name:"image"}),y.t("doc.uploadInstead")]}):null]})]})}s(Ot,"DocumentIntro");function _e({step:e,i18n:t}){let o=be(e);return o===null?null:d(ye,{tone:"warning",children:[n("span",{children:t.t(o)}),n("span",{children:ve(t,e.attemptsRemaining,e.attemptsExhausted)})]})}s(_e,"ReasonNotice");function at({i18n:e,onChangeCountry:t,onChangeDocument:o}){let r=we(e);return o===void 0&&t===void 0?null:d("div",{className:"sekyro-links",children:[o!==void 0?n("button",{type:"button",className:"sekyro-link",onClick:o,children:r("native.doc.changeDocument")}):null,t!==void 0?n("button",{type:"button",className:"sekyro-link",onClick:t,children:e.t("native.doc.changeCountry")}):null]})}s(at,"ChangeLinks");function st({i18n:e,upload:t}){return t!=="unsupported"&&t!=="failed"?null:n(ye,{tone:"warning",children:n("span",{children:W(e).t(t==="unsupported"?"doc.uploadUnsupported":"doc.uploadFailed")})})}s(st,"UploadNotice");function Rt({step:e,i18n:t,ageLead:o,upload:r,offered:a,onPick:l,onCamera:S,onChangeCountry:h,onChangeDocument:f}){let y=W(t),g=r==="sending";return d("section",{className:"sekyro-step","data-testid":"sekyro-doc-upload-screen",children:[n(rt,{passport:e.documentType==="passport"}),n(he,{title:y.t("doc.uploadTitle"),lead:o?t.t("doc.ageStepUp"):y.t("doc.uploadHint")}),o?n("p",{className:"sekyro-text-muted",children:y.t("doc.uploadHint")}):null,n(_e,{step:e,i18n:t}),n(at,{i18n:t,...f!==void 0?{onChangeDocument:f}:{},...h!==void 0?{onChangeCountry:h}:{}}),n(st,{i18n:t,upload:r}),g?n("p",{className:"sekyro-text-muted",role:"status",children:t.t("doc.uploading")}):null,d(fe,{children:[d(B,{full:!0,onClick:l,disabled:g||!a||e.attemptsExhausted,children:[n(se,{name:"image"}),y.t("doc.source.upload")]}),S!==void 0?d(B,{full:!0,kind:"ghost",onClick:S,disabled:g,children:[n(V,{name:"camera"}),y.t("doc.source.camera")]}):null]})]})}s(Rt,"DocumentUploadScreen");function tt(e,t,o){let r=e*.88,a=r/o;return{x:(e-r)/2,y:t*.42-a/2,w:r,h:a}}s(tt,"guideRect");var Ut={"mrz:moveCloser":"dcv3.mrz.moveCloser","mrz:turnSideways":"dcv3.mrz.turnSideways","mrz:glare":"dcv3.mrz.glare",too_far:"native.scan.closer",too_close:"native.scan.farther",focus_far:"native.scan.farther",glare:"native.scan.glare",too_bright:"native.scan.glare",too_dark:"native.scan.dark",blurry:"native.scan.blurry"},Et=s(()=>typeof window<"u"&&window.matchMedia?.("(prefers-reduced-motion: reduce)").matches===!0,"reduceMotion");function Kt({step:e,i18n:t,liveMrz:o,barcodeAssetBaseUrl:r,onClose:a,attempts:l,onUpload:S}){let h=we(t),f=nt(Ue),y=L(f);y.current=f;let g=L(null),w=L(null),C=L(null),[z,M]=k("idle"),[b,Y]=k(null),[H,O]=k(null),[v,q]=k({w:0,h:0}),[D,X]=k({hint:null,locking:!1,card:null,manualShutter:!1}),[R,ee]=k({}),[j,it]=k(null),[Ce,ct]=k(null),[ze,Ne]=k(0),[De,xe]=k(null),[ie,lt]=k(null),[ce,dt]=k(0),Te=L(0);Te.current=ce;let U=e.documentType==="passport",te=U?1.42:1.586;Be(!0),_t(()=>{let c=g.current;if(c===null)return;let p=s(()=>q({w:c.clientWidth,h:c.clientHeight}),"measure");if(p(),typeof ResizeObserver>"u")return;let u=new ResizeObserver(p);return u.observe(c),()=>u.disconnect()},[]);let i=tt(v.w,v.h,te);G(()=>{v.w===0||v.h===0||C.current?.setGuide?.({viewAspect:v.w/v.h,rect:{x:i.x/v.w,y:i.y/v.h,width:i.w/v.w,height:i.h/v.h}})},[v.w,v.h,i.x,i.y,i.w,i.h]),G(()=>{let c=w.current;if(c===null)return;let p=e.capture({video:c,...o!==void 0?{liveMrz:o}:{},...r!==void 0?{barcodeAssetBaseUrl:r}:{}});C.current=p;let u=g.current;if(u!==null&&u.clientWidth>0&&u.clientHeight>0){let m=tt(u.clientWidth,u.clientHeight,te);p.setGuide?.({viewAspect:u.clientWidth/u.clientHeight,rect:{x:m.x/u.clientWidth,y:m.y/u.clientHeight,width:m.w/u.clientWidth,height:m.h/u.clientHeight}})}let I=new ae,_={scan:null,feedback:null,gate:null,mrz:null},$=s(m=>{_={..._,...m};let x=_.gate?.guide,kt={phase:_.scan?.phase??"framing",hint:_.feedback?.reticle==="coaching"?_.feedback.key:e.documentType==="drivers_license"?null:Pt(_.mrz),card:x?.detected?{fill:x.fill,offsetX:x.offsetX,offsetY:x.offsetY}:null,manualShutter:_.scan?.manualShutter??!1},K=I.present(kt,performance.now());X(A=>A.hint===K.hint&&A.locking===K.locking&&A.manualShutter===K.manualShutter&&A.card?.fill===K.card?.fill&&A.card?.offsetX===K.card?.offsetX&&A.card?.offsetY===K.card?.offsetY?A:K)},"present"),St=[p.on("state",M),p.on("feedback",m=>$({feedback:m})),p.on("gate",m=>$({gate:m})),p.on("scan",m=>{Y(m),$({scan:m})}),p.on("captured",m=>{dt(x=>x+1),ee(x=>({...x,[Vt(m.side,U,x)]:m.previewDataUrl})),it(m.previewDataUrl),ct(Yt(c))}),p.on("error",m=>{O(m);let x=y.current;x!==null&&Ke(x,Ee("document",m,Math.max(0,l.current)))}),p.on("mrz",m=>{m.state==="mismatch"?lt({format:m.format??null,at:Te.current}):(xe(m),$({mrz:m}))})];return l.current+=1,p.start().catch(()=>{}),()=>{for(let m of St)m();p.destroy(),C.current=null}},[e.issuer,e.documentType]);let T=b?.phase??"framing",P=T==="reading"||T==="result",le=T==="flipCue"||T==="reaskRecto",E=D.locking,Le=b?.captured.length??0;G(()=>{E&&Ne(c=>c+1)},[E]),G(()=>{Le>0&&Ne(c=>c+1)},[Le]);let ut=b?.expected??null;G(()=>{xe(null)},[ut]);let de=le||P||e.documentType==="drivers_license"?null:Mt(De,U),Me=s(c=>t.strings[c]??xt[t.locale][c],"liveText"),pt=s(c=>c.startsWith("dcv3.")?Me(c):h(c),"copy"),ue=de!==null?Me(de):h(T==="flipCue"?"doc.flip":T==="reaskRecto"?"doc.reaskRecto":P?"native.scan.reading":T==="locking"||T==="capturing"||E?"native.scan.holdStill":U?"doc.showPage":"doc.showSide"),ne=be(e),Pe=s(c=>({key:h(c),action:ve(t,e.attemptsRemaining,e.attemptsExhausted),blocking:e.reason!==void 0&&ot.has(e.reason)}),"reasonProblem"),Ie=It(e.documentType),mt=ie!==null&&ce<=ie.at+1?{key:h(ie.format==="TD3"?"native.scan.seenPassport":"native.scan.seenCard"),action:Ie===null?null:h(Ie),blocking:!0}:b?.notice==="same_face"?{key:h("doc.sameFace"),action:null,blocking:!1}:b?.notice==="reread"?ne!==null?Pe(ne):{key:h("doc.reread"),action:null,blocking:!1}:b?.notice==="technical"?{key:h("native.scan.retry"),action:null,blocking:!1}:b?.notice==="blurry"?{key:h("native.scan.blurry"),action:null,blocking:!1}:ne!==null&&ce===0?Pe(ne):null,ht=D.hint===null?null:pt(Ut[D.hint]??`dcv2.${D.hint}`),$e=At(mt,ht,E||T==="capturing"||P),F=D.card,N=i;if(!E&&F!==null&&F.fill>=.45&&F.fill<=1.25&&!Et()){let c=i.w*F.fill,p=c/te,u=i.x+i.w/2+i.w*Math.max(-.25,Math.min(.25,F.offsetX)),I=i.y+i.h/2+i.h*Math.max(-.25,Math.min(.25,F.offsetY));N={x:u-c/2,y:I-p/2,w:c,h:p}}let oe=i.w*.045,pe=28,He=Math.min(oe,pe*.6),ft=[[N.x,N.y,1,1],[N.x+N.w,N.y,-1,1],[N.x,N.y+N.h,1,-1],[N.x+N.w,N.y+N.h,-1,-1]],yt=E?"is-locked":$e!==null?"is-coaching":"",vt=U?[{side:"single",label:"doc.progressPage"}]:[{side:"recto",label:"doc.progressFront"},{side:"verso",label:"doc.progressBack"}],gt=i.y+i.h+16,me={insetInlineStart:i.x,insetBlockStart:i.y,inlineSize:i.w,blockSize:i.h,borderRadius:oe};return n("section",{className:"sekyro-lm","aria-label":ue,"data-testid":"sekyro-document",children:d("div",{ref:g,className:`sekyro-lm-stage${P?" is-reading":""}${le?" is-flip":""}`,style:{"--sekyro-guide-w":`${i.w}px`},children:[n("video",{ref:w,className:"sekyro-lm-video",playsInline:!0,muted:!0,autoPlay:!0,"aria-hidden":"true",onPointerUp:c=>{let p=c.currentTarget,u=p.getBoundingClientRect(),I=Math.max(u.width/(p.videoWidth||1),u.height/(p.videoHeight||1)),_=p.videoWidth*I,$=p.videoHeight*I;_>0&&$>0&&C.current?.focusAt((c.clientX-u.left+(_-u.width)/2)/_,(c.clientY-u.top+($-u.height)/2)/$)}}),v.w>0?d(ke,{children:[P&&Ce!==null?n("img",{className:"sekyro-lm-scene",src:Ce,alt:""}):null,P&&j!==null?n("img",{className:"sekyro-lm-frozen",src:j,alt:"",style:me}):null,d("svg",{className:"sekyro-lm-overlay",viewBox:`0 0 ${v.w} ${v.h}`,"aria-hidden":"true",focusable:"false",children:[d("defs",{children:[d("linearGradient",{id:"sekyro-lm-top",x1:"0",y1:"0",x2:"0",y2:"1",children:[n("stop",{offset:"0",className:"sekyro-lm-ink",stopOpacity:"0.85"}),n("stop",{offset:"1",className:"sekyro-lm-ink",stopOpacity:"0"})]}),d("linearGradient",{id:"sekyro-lm-bottom",x1:"0",y1:"0",x2:"0",y2:"1",children:[n("stop",{offset:"0",className:"sekyro-lm-ink",stopOpacity:"0"}),n("stop",{offset:"1",className:"sekyro-lm-ink",stopOpacity:"0.9"})]})]}),n("path",{className:"sekyro-lm-scrim",fillRule:"evenodd",d:`M0 0H${v.w}V${v.h}H0Z${Gt(i,oe)}`}),n("rect",{width:v.w,height:Math.max(0,i.y),fill:"url(#sekyro-lm-top)"}),n("rect",{y:i.y+i.h,width:v.w,height:Math.max(0,v.h-i.y-i.h),fill:"url(#sekyro-lm-bottom)"}),n("g",{className:`sekyro-lm-brackets ${yt}`,children:ft.map(([c,p,u,I],_)=>n("path",{style:{transform:`translate(${c}px, ${p}px) scale(${u}, ${I})`},d:`M0 ${pe}V${He}Q0 0 ${He} 0H${pe}`},_))}),E?n("rect",{className:"sekyro-lm-trace",x:i.x,y:i.y,width:i.w,height:i.h,rx:oe,pathLength:"1",style:{animationDuration:`${zt}ms`}}):null]}),n("div",{className:"sekyro-lm-slot",style:me,"aria-hidden":"true",children:P?n("span",{className:"sekyro-lm-read is-repeating"}):ze>0?n("span",{className:"sekyro-lm-read"},ze):null})]}):null,de!==null?n("div",{className:"sekyro-lm-slot",style:me,"aria-hidden":"true",children:n("span",{"data-testid":"sekyro-mrz-strip",className:`sekyro-lm-mrz${U?" is-page":""}${De?.state==="valid"?" is-valid":""}`})}):null,n("div",{className:"sekyro-lm-instruction",style:{insetBlockStart:i.y-64},children:n("div",{role:"status","aria-live":"polite","data-testid":"sekyro-scan-instruction",children:n(Ye,{swapKey:ue,className:"sekyro-lm-line",children:ue})})}),d("div",{className:"sekyro-lm-below",style:{insetBlockStart:gt,inlineSize:i.w,insetInlineStart:i.x},children:[n(Bt,{band:$e}),P?d("p",{className:"sekyro-lm-note",children:[n("span",{className:"sekyro-lm-spinner","aria-hidden":"true"}),h("native.scan.putDown")]}):le?n("div",{className:`sekyro-lm-flip${T==="reaskRecto"?" is-toFront":""}`,"data-testid":"sekyro-flip-cue","aria-hidden":"true",children:d("span",{className:"sekyro-lm-flip-card",style:{aspectRatio:String(te)},children:[n("span",{className:"sekyro-lm-flip-front"}),n("span",{className:"sekyro-lm-flip-back"})]})}):null]}),d("div",{className:"sekyro-lm-controls",children:[d("div",{className:"sekyro-lm-bar",children:[n("button",{type:"button",className:"sekyro-glass","aria-label":t.t("native.close"),onClick:a,children:n(V,{name:"close"})}),b?.torchAvailable?n("button",{type:"button",className:`sekyro-glass${b.torch?" is-on":""}`,"aria-label":t.t("doc.torchOn"),"aria-pressed":b.torch,onClick:()=>C.current?.setTorch(!b.torch),children:n(se,{name:"flashlight"})}):null]}),H!==null?d("div",{className:"sekyro-lm-error",role:"alert",children:[n("p",{children:t.t("doc.cameraBlocked")}),n("p",{children:t.t(H.kind==="permission"?"doc.cameraBlockedHint":Oe(H.kind))}),n(B,{onClick:()=>{O(null),l.current+=1,C.current?.retry()},children:t.t("doc.retryCamera")})]}):null,D.manualShutter?n("button",{type:"button",className:"sekyro-shutter","aria-label":t.t("doc.shutter"),onClick:()=>C.current?.shutter()}):null,n("ol",{className:"sekyro-lm-tray",children:vt.map(({side:c,label:p})=>{let u=b?.captured.includes(c)??!1;return d("li",{className:u?"is-done":void 0,"aria-current":!u&&(U||b?.expected===c)?"step":void 0,children:[u?d("span",{className:"sekyro-lm-thumb",children:[R[c]!==void 0?n("img",{src:R[c],alt:""}):null,n("svg",{className:"sekyro-lm-check",viewBox:"0 0 18 18","aria-hidden":"true",children:n("path",{d:"M5 9.2l2.6 2.6L13 6.4"})})]}):null,h(p)]},c)})}),S!==void 0?n("button",{type:"button",className:"sekyro-lm-upload",onClick:S,children:W(t).t("doc.uploadInstead")}):null,z==="uploading"||z==="checking"?null:n(Ge,{onStop:a})]}),z==="uploading"||z==="checking"?n("span",{className:"sekyro-visually-hidden",role:"status",children:z==="uploading"?t.t("doc.uploading"):h("native.scan.reading")}):null]})})}s(Kt,"LumiereScan");function At(e,t,o){let r=L(null);r.current??(r.current=new re);let[a,l]=k(null),S=L({problem:e,hint:t,busy:o});S.current={problem:e,hint:t,busy:o};let h=e===null?null:`${e.blocking}|${e.key}|${e.action??""}`;return G(()=>{let f=s(()=>{let{problem:g,hint:w,busy:C}=S.current;l(r.current?.present(g,w,C,performance.now())??null)},"run");f();let y=setInterval(f,250);return()=>clearInterval(y)},[h,t,o]),a}s(At,"useNoticeBand");function Bt({band:e}){let[t,o]=k(e);G(()=>{e!==null&&o(e)},[e]);let r=e??t;return n("div",{className:`sekyro-lm-band${e!==null?" is-open":""}`,"data-testid":"sekyro-scan-notice",children:n("div",{role:"status","aria-live":"polite","aria-atomic":"true",children:r!==null?d("div",{className:"sekyro-notice sekyro-notice--warning","data-kind":r.kind,"aria-hidden":e===null||void 0,children:[n("span",{className:"sekyro-notice__icon","aria-hidden":"true",children:n(V,{name:"warning"})}),d("div",{className:"sekyro-notice__body",children:[n("span",{children:r.key}),r.action!==null&&r.action!==""?n("span",{children:r.action}):null]})]}):null})})}s(Bt,"NoticeBandView");function Vt(e,t,o){return t?"single":e==="recto"||e==="verso"?e:o.recto===void 0?"recto":"verso"}s(Vt,"slotOf");function Gt({x:e,y:t,w:o,h:r},a){return`M${e+a} ${t}H${e+o-a}Q${e+o} ${t} ${e+o} ${t+a}V${t+r-a}Q${e+o} ${t+r} ${e+o-a} ${t+r}H${e+a}Q${e} ${t+r} ${e} ${t+r-a}V${t+a}Q${e} ${t} ${e+a} ${t}Z`}s(Gt,"roundedRect");function Yt(e){let t=Math.round(e.videoWidth/4),o=Math.round(e.videoHeight/4);if(t===0||o===0||typeof document>"u")return null;try{let r=document.createElement("canvas");r.width=t,r.height=o;let a=r.getContext("2d");return a===null?null:(a.drawImage(e,0,0,t,o),r.toDataURL("image/jpeg",.7))}catch{return null}}s(Yt,"sceneSnapshot");export{Pn as DocumentCaptureView,zt as LOCK_TRACE_MS,Lt as UPLOAD_ACCEPT,tt as guideRect,Dt as introCopy,Pt as mrzHint,Mt as mrzInstruction,It as showInsteadKey,Vt as slotOf};
|
|
2
|
+
import{a as We}from"./chunk-KB7SLMC3.js";import{d as Xe}from"./chunk-ODSPOWMV.js";import"./chunk-6JKZ5S2U.js";import{a as Ue,b as Ke,c as Ae}from"./chunk-7MMT5M4E.js";import{d as Be}from"./chunk-ERWGG4X6.js";import{a as A,b as he,d as fe,j as Ve,k as Ye,l as Ge,n as Fe,p as ye,q as ve}from"./chunk-PEQBKIR7.js";import"./chunk-BMD5J7TC.js";import{a as K,m as Re,o as Ee}from"./chunk-P7TS7JPW.js";import{a as s}from"./chunk-2KED7D2Q.js";import{acceptedTypesFor as _t}from"@sekyro/web";import{useContext as ot,useEffect as B,useLayoutEffect as Ct,useRef as L,useState as k}from"react";var je={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"/>'};var Qe={"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":"يبدو أن هذه بطاقة تعريف أو بطاقة إقامة"};var Q={"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"};var Ze={"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"};var Je={"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":"رفع صورة"};var Z={"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"};var qe={"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"};var et={"native.doc.introTitle":"سنلتقط صورة لوثيقتك","native.doc.introLead":"تُلتقط الصورة تلقائيًا عندما تكون الوثيقة داخل الإطار.","native.doc.tip.flat":"ضع الوثيقة مسطحة على سطح داكن.","native.doc.tip.glare":"تجنّب انعكاسات الضوء.","native.doc.tip.frame":"أبقِ الوثيقة كاملة داخل الإطار.","native.doc.openCamera":"افتح الكاميرا","native.doc.changeDocument":"تغيير الوثيقة","native.doc.titleOf.carte_identite":"صوّر بطاقة هويتك","native.doc.titleOf.passport":"صوّر جواز سفرك","native.doc.titleOf.residence_permit":"صوّر بطاقة إقامتك","native.doc.titleOf.drivers_license":"صوّر رخصة قيادتك","native.doc.onlyType.carte_identite":"{country}: تُقبل بطاقة الهوية فقط هنا.","native.doc.onlyType.passport":"{country}: يُقبل جواز السفر فقط هنا.","native.doc.onlyType.residence_permit":"{country}: تُقبل بطاقة الإقامة فقط هنا.","native.doc.onlyType.drivers_license":"{country}: تُقبل رخصة القيادة فقط هنا.","native.scan.closer":"اقترب قليلًا","native.scan.farther":"ابتعد قليلًا","native.scan.glare":"أمِل البطاقة قليلًا","native.scan.dark":"الإضاءة ضعيفة. شغّل المصباح.","native.scan.blurry":"الصورة غير واضحة. ثبّت الهاتف.","native.scan.holdStill":"لا تتحرك","native.scan.reading":"جارٍ التحقق من وثيقتك…","native.scan.putDown":"يمكنك وضع وثيقتك جانبًا.","native.scan.retry":"لنحاول مرة أخرى","native.scan.seenPassport":"يبدو أن هذا جواز سفر","native.scan.seenCard":"يبدو أن هذه بطاقة هوية أو بطاقة إقامة","native.scan.showInstead.carte_identite":"أظهر بطاقة هويتك بدلًا منها","native.scan.showInstead.passport":"أظهر صفحة الصورة في جواز سفرك بدلًا منها","native.scan.showInstead.residence_permit":"أظهر بطاقة إقامتك بدلًا منها","native.scan.showInstead.drivers_license":"أظهر رخصة قيادتك بدلًا منها"};var J={"native.doc.introTitle":"Photograph your document","native.doc.introLead":"The photo is taken by itself once the document is in the frame.","native.doc.tip.flat":"Lay it flat on a dark surface.","native.doc.tip.glare":"Avoid glare from lights.","native.doc.tip.frame":"Keep all of it in the frame.","native.doc.openCamera":"Open the camera","native.doc.changeDocument":"Change document","native.doc.titleOf.carte_identite":"Photograph your identity card","native.doc.titleOf.passport":"Photograph your passport","native.doc.titleOf.residence_permit":"Photograph your residence permit","native.doc.titleOf.drivers_license":"Photograph your driver's license","native.doc.onlyType.carte_identite":"{country}: only an identity card is accepted here.","native.doc.onlyType.passport":"{country}: only a passport is accepted here.","native.doc.onlyType.residence_permit":"{country}: only a residence permit is accepted here.","native.doc.onlyType.drivers_license":"{country}: only a driver's license is accepted here.","native.scan.closer":"Move a little closer","native.scan.farther":"Move back a little","native.scan.glare":"Tilt the card a little","native.scan.dark":"Too dark. Turn on the light.","native.scan.blurry":"Blurry image. Hold the phone still.","native.scan.holdStill":"Hold still","native.scan.reading":"Checking your document…","native.scan.putDown":"You can put your document down.","native.scan.retry":"Let's try that again","native.scan.seenPassport":"This looks like a passport","native.scan.seenCard":"This looks like an identity card or residence permit","native.scan.showInstead.carte_identite":"Show your identity card instead","native.scan.showInstead.passport":"Show the photo page of your passport instead","native.scan.showInstead.residence_permit":"Show your residence permit instead","native.scan.showInstead.drivers_license":"Show your driver's license instead"};var tt={"native.doc.introTitle":"Photographiez votre pièce","native.doc.introLead":"La photo se prend toute seule quand la pièce est bien cadrée.","native.doc.tip.flat":"Posez la pièce à plat sur fond sombre.","native.doc.tip.glare":"Évitez les reflets de lumière.","native.doc.tip.frame":"Gardez toute la pièce dans le cadre.","native.doc.openCamera":"Ouvrir la caméra","native.doc.changeDocument":"Changer de document","native.doc.titleOf.carte_identite":"Photographiez votre carte d'identité","native.doc.titleOf.passport":"Photographiez votre passeport","native.doc.titleOf.residence_permit":"Photographiez votre titre de séjour","native.doc.titleOf.drivers_license":"Photographiez votre permis de conduire","native.doc.onlyType.carte_identite":"{country} : seule la carte d'identité est acceptée ici.","native.doc.onlyType.passport":"{country} : seul le passeport est accepté ici.","native.doc.onlyType.residence_permit":"{country} : seul le titre de séjour est accepté ici.","native.doc.onlyType.drivers_license":"{country} : seul le permis de conduire est accepté ici.","native.scan.closer":"Approchez un peu","native.scan.farther":"Reculez un peu","native.scan.glare":"Inclinez un peu la carte","native.scan.dark":"Trop sombre. Allumez la lampe.","native.scan.blurry":"Image floue. Tenez le téléphone immobile.","native.scan.holdStill":"Ne bougez plus","native.scan.reading":"Vérification de votre document…","native.scan.putDown":"Vous pouvez poser votre pièce.","native.scan.retry":"Réessayons","native.scan.seenPassport":"Ceci ressemble à un passeport","native.scan.seenCard":"Ceci ressemble à une carte d'identité ou un titre de séjour","native.scan.showInstead.carte_identite":"Montrez plutôt votre carte d'identité","native.scan.showInstead.passport":"Montrez plutôt la page photo de votre passeport","native.scan.showInstead.residence_permit":"Montrez plutôt votre titre de séjour","native.scan.showInstead.drivers_license":"Montrez plutôt votre permis de conduire"};var ge=class ge{constructor(){this.shown=null;this.shownAt=0;this.yielded=null}present(t,o,r,a){(t===null||t.key!==this.yielded)&&(this.yielded=null);let l=this.shown;return t!==null&&this.yielded===null?l?.kind==="problem"&&l.key===t.key&&l.action===t.action?!t.blocking&&o!==null&&a-this.shownAt>=3e3?(this.yielded=t.key,this.show({kind:"hint",key:o,action:null},a)):l:this.show({kind:"problem",key:t.key,action:t.action},a):l?.kind==="problem"&&t===null&&(r||a-this.shownAt<3e3)?l:o===null?this.show(null,a):l?.kind==="hint"&&l.key===o?l:this.show({kind:"hint",key:o,action:null},a)}show(t,o){return this.shown=t,this.shownAt=o,t}};s(ge,"NoticeBand");var re=ge;var bt=["locking","capturing"],Se=class Se{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,o){return this.presentHint(t,o),this.presentLock(t,o),this.presentCard(t,o),this.shutterSince=t.manualShutter?this.shutterSince??o:null,this.shown={...this.shown,manualShutter:this.shutterSince!==null&&o-this.shutterSince>=1e3},this.shown}presentHint(t,o){let r=t.phase==="framing"&&!(t.hint==="blurry"&&t.card===null)?t.hint:null;if(t.phase!=="framing"){this.shown={...this.shown,hint:null},this.candidate=null;return}if(r!==this.candidate&&(this.candidate=r,this.candidateSince=o),r===this.shown.hint)return;let a=o-this.candidateSince>=(r===null?0:350),l=this.shown.hint===null||o-this.hintShownAt>=2500;a&&l&&(this.shown={...this.shown,hint:r},this.hintShownAt=o)}presentLock(t,o){if(bt.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=o),o-this.lockLostAt>=300&&(this.shown={...this.shown,locking:!1},this.lockLostAt=null)}}presentCard(t,o){let r=t.card;if(r===null||t.phase!=="framing"){if(t.phase!=="framing"){this.shown={...this.shown,card:null},this.detectedSince=null,this.lostSince=null;return}this.detectedSince=null,this.lostSince??(this.lostSince=o),o-this.lostSince>=300&&(this.shown={...this.shown,card:null});return}if(this.lostSince=null,this.detectedSince??(this.detectedSince=o),o-this.detectedSince<250)return;let a=this.shown.card;if(a===null){this.shown={...this.shown,card:{...r}};return}let l=.35;this.shown={...this.shown,card:{fill:a.fill+(r.fill-a.fill)*l,offsetX:a.offsetX+(r.offsetX-a.offsetX)*l,offsetY:a.offsetY+(r.offsetY-a.offsetY)*l}}}};s(Se,"ScanPresenter");var ae=Se;import{Fragment as we,jsx as n,jsxs as d}from"react/jsx-runtime";var zt={en:J,fr:tt,ar:et,es:J,pt:J,de:J},Nt=450,be=s(e=>(t,o)=>Be(e.strings[t]??zt[e.locale][t]??"",o),"useScanCopy");function Dt(e,t){try{return new Intl.DisplayNames([t],{type:"region"}).of(e)??e}catch{return e}}s(Dt,"regionName");function xt(e){let t=e.documentType,o=t===null?"native.doc.introTitle":`native.doc.titleOf.${t}`,r=t!==null&&e.issuer!==null&&_t(e.documents,e.issuer).length===1;return{titleKey:o,onlyKey:r?`native.doc.onlyType.${t}`:null}}s(xt,"introCopy");function se({name:e}){return n("svg",{className:"sekyro-glyph",viewBox:"0 0 24 24",fill:"none","aria-hidden":"true",focusable:"false",dangerouslySetInnerHTML:{__html:je[e]}})}s(se,"ScanGlyph");var Tt={en:Q,fr:Ze,ar:Qe,es:Q,pt:Q,de:Q},Lt={en:Z,fr:qe,ar:Je,es:Z,pt:Z,de:Z},Mt="image/jpeg,image/png,image/heic,image/heif";function G(e){let t=e.strings,o=s(r=>t[r]??Lt[e.locale][r],"text");return{t:s(r=>o(r)??"","t")}}s(G,"uploadCopy");function Pt(e,t){return e===null||e.state==="fallback"||e.state==="mismatch"?null:e.state==="searching"?t?"dcv3.mrz.searching":"dcv3.mrz.showMrzSide":e.state==="valid"?"dcv3.mrz.valid":e.coach==="holdStill"?"dcv3.mrz.holdStill":"dcv3.mrz.reading"}s(Pt,"mrzInstruction");function It(e){return e?.state==="reading"&&e.coach!==void 0&&e.coach!=="holdStill"?`mrz:${e.coach}`:null}s(It,"mrzHint");function $t(e){return e==="carte_identite"||e==="passport"||e==="residence_permit"||e==="drivers_license"?`native.scan.showInstead.${e}`:null}s($t,"showInsteadKey");var Ht={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 _e(e){if(e.reason==="unreadable")return"doc.reason_unreadable";let t=e.reason!==void 0?Ht[e.reason]:void 0;return t!==void 0?t:e.reason==="tester_document_mismatch"?"reasons.tester_document_mismatch":e.reason!==void 0&&e.reason!=="side_missing"?Ee(e.reason):null}s(_e,"reasonOf");var rt=new Set(["document_type_not_accepted","tester_document_mismatch","document_type_mismatch","provider_unavailable","document_type_not_supported","document_sides_mismatch"]);function $n({step:e,i18n:t,liveMrz:o,barcodeAssetBaseUrl:r,ageLead:a,...l}){let[S,h]=k(!1),f=L(-1),[y,g]=k("idle"),w=L(null),C=typeof e.uploadDocument=="function",z=C?e.photo?.source??"camera":"camera",M=C&&z!=="camera"&&e.photo?.uploadOffered===!0,[b,V]=k(null),H=z==="upload"?"upload":z==="choice"?b??e.photo?.pick??"source":"camera",O=y==="sending"?void 0:()=>w.current?.click(),v=s(async R=>{let ee=R.currentTarget.files?.[0];if(R.currentTarget.value="",ee!==void 0){h(!1),g("sending");try{await e.uploadDocument(ee),g("idle")}catch(X){g(X instanceof TypeError&&X.message==="unsupported_file"?"unsupported":"failed")}}},"onFile"),q=M?n("input",{ref:w,type:"file",accept:Mt,hidden:!0,"data-testid":"sekyro-doc-upload","aria-label":G(t).t("doc.uploadTitle"),onChange:R=>{v(R)}}):null,D=G(t),F=e.photo?.cameraOnPhone===!0;return H==="camera"&&F?n(Xe,{i18n:t,lead:t.t("handoff.lead.document"),refresh:e.refresh,actions:n(K,{kind:"ghost",full:!0,onClick:()=>V("upload"),children:D.t("doc.source.upload")})}):H==="source"?n(We,{testId:"sekyro-doc-source",title:D.t("doc.source.title"),lead:D.t("doc.source.description"),cameraLabel:F?t.t("capture.source.phone"):D.t("doc.source.camera"),onPhone:F,uploadLabel:D.t("doc.source.upload"),notice:n(Ce,{step:e,i18n:t}),onCamera:()=>V("camera"),onUpload:()=>V("upload")}):H==="upload"?d(we,{children:[n(Et,{step:e,i18n:t,ageLead:a===!0,upload:y,offered:M,onPick:()=>w.current?.click(),...z==="choice"?{onCamera:s(()=>V("camera"),"onCamera")}:{},...l}),q]}):d(we,{children:[S?n(At,{step:e,i18n:t,attempts:f,...o!==void 0?{liveMrz:o}:{},...r!==void 0?{barcodeAssetBaseUrl:r}:{},...M&&O!==void 0?{onUpload:O}:{},onClose:()=>h(!1)}):n(Rt,{step:e,i18n:t,ageLead:a===!0,onOpen:()=>h(!0),upload:y,...M&&O!==void 0?{onUpload:O}:{},...l}),q]})}s($n,"DocumentCaptureView");function at({passport:e}){let o=Math.round(228/(e?1.42:1.586));return d("svg",{className:`sekyro-mark sekyro-mark--card${e?" sekyro-mark--passport":""}`,viewBox:`-12 ${e?-22:-12} 252 ${o+(e?34:24)}`,"aria-hidden":"true",focusable:"false",children:[n("defs",{children:n("clipPath",{id:"sekyro-card-clip",children:n("rect",{width:228,height:o,rx:"12.5"})})}),e?n("rect",{className:"sekyro-mark__page",x:"10",y:"-14",width:208,height:o,rx:"10"}):null,n("rect",{className:"sekyro-mark__card",width:228,height:o,rx:"12.5"}),n("rect",{className:"sekyro-mark__photo",x:"17",y:"17",width:"55",height:o*(e?.5:.62),rx:"6"}),[0,1,2].map(r=>n("rect",{className:"sekyro-mark__text",x:"88",y:23+r*o*.12,width:100-r*20,height:"6",rx:"3"},r)),e?[0,1].map(r=>n("line",{className:"sekyro-mark__code",x1:"17",x2:211,y1:o*.75+r*11,y2:o*.75+r*11},r)):n("rect",{className:"sekyro-mark__text",x:"88",y:23+3*o*.12,width:"60",height:"6",rx:"3"}),n("g",{clipPath:"url(#sekyro-card-clip)",children:n("g",{className:"sekyro-mark__read",style:{"--sekyro-read-w":"228px"},children:n("rect",{x:"-1",width:"2",height:o,className:"sekyro-mark__beam"})})}),n("path",{className:"sekyro-mark__brackets",d:Ot(-10,-10,248,o+20,16,30)})]})}s(at,"ScanMark");function Ot(e,t,o,r,a,l){let S=Math.min(a,l*.6);return[[e,t,1,1],[e+o,t,-1,1],[e,t+r,1,-1],[e+o,t+r,-1,-1]].map(([f,y,g,w])=>`M${f} ${y+w*l}V${y+w*S}Q${f} ${y} ${f+g*S} ${y}H${f+g*l}`).join("")}s(Ot,"brackets");function Rt({step:e,i18n:t,ageLead:o,onOpen:r,onChangeCountry:a,onChangeDocument:l,upload:S,onUpload:h}){let f=be(t),y=G(t),g=e.documentType==="passport",w=xt(e),C=_e(e),z=S==="sending",M=ot(Ye)?.busy===!0;return d("section",{className:"sekyro-step sekyro-step--doc-intro","data-testid":"sekyro-document",children:[n(at,{passport:g}),n(he,{title:f(w.titleKey)||f("native.doc.introTitle"),lead:o?t.t("doc.ageStepUp"):f("native.doc.introLead")}),w.onlyKey!==null&&e.issuer!==null?n("p",{className:"sekyro-text-muted sekyro-doc-only",children:f(w.onlyKey,{country:Dt(e.issuer,t.locale)})}):null,n(Ce,{step:e,i18n:t}),e.reason!==void 0&&rt.has(e.reason)?null:d("ul",{className:"sekyro-tiprows",children:[d("li",{children:[n(A,{name:g?"passport":"card"}),f("native.doc.tip.flat")]}),d("li",{children:[n(A,{name:"light"}),f("native.doc.tip.glare")]}),d("li",{children:[n(se,{name:"image"}),f("native.doc.tip.frame")]})]}),n(st,{i18n:t,...l!==void 0?{onChangeDocument:l}:{},...a!==void 0?{onChangeCountry:a}:{}}),n(it,{i18n:t,upload:S}),z?n("p",{className:"sekyro-text-muted",role:"status",children:t.t("doc.uploading")}):h!==void 0?n("p",{className:"sekyro-text-muted",children:y.t("doc.uploadHint")}):null,d(fe,{children:[d(K,{full:!0,onClick:r,disabled:z||M,children:[n(A,{name:"camera"}),f("native.doc.openCamera")]}),h!==void 0?d(K,{full:!0,kind:"ghost",onClick:h,children:[n(se,{name:"image"}),y.t("doc.uploadInstead")]}):null]})]})}s(Rt,"DocumentIntro");function Ce({step:e,i18n:t}){let o=_e(e);return o===null?null:d(ye,{tone:"warning",children:[n("span",{children:t.t(o)}),n("span",{children:ve(t,e.attemptsRemaining,e.attemptsExhausted)})]})}s(Ce,"ReasonNotice");function st({i18n:e,onChangeCountry:t,onChangeDocument:o}){let r=be(e);return o===void 0&&t===void 0?null:d("div",{className:"sekyro-links",children:[o!==void 0?n("button",{type:"button",className:"sekyro-link",onClick:o,children:r("native.doc.changeDocument")}):null,t!==void 0?n("button",{type:"button",className:"sekyro-link",onClick:t,children:e.t("native.doc.changeCountry")}):null]})}s(st,"ChangeLinks");function it({i18n:e,upload:t}){return t!=="unsupported"&&t!=="failed"?null:n(ye,{tone:"warning",children:n("span",{children:G(e).t(t==="unsupported"?"doc.uploadUnsupported":"doc.uploadFailed")})})}s(it,"UploadNotice");function Et({step:e,i18n:t,ageLead:o,upload:r,offered:a,onPick:l,onCamera:S,onChangeCountry:h,onChangeDocument:f}){let y=G(t),g=r==="sending";return d("section",{className:"sekyro-step","data-testid":"sekyro-doc-upload-screen",children:[n(at,{passport:e.documentType==="passport"}),n(he,{title:y.t("doc.uploadTitle"),lead:o?t.t("doc.ageStepUp"):y.t("doc.uploadHint")}),o?n("p",{className:"sekyro-text-muted",children:y.t("doc.uploadHint")}):null,n(Ce,{step:e,i18n:t}),n(st,{i18n:t,...f!==void 0?{onChangeDocument:f}:{},...h!==void 0?{onChangeCountry:h}:{}}),n(it,{i18n:t,upload:r}),g?n("p",{className:"sekyro-text-muted",role:"status",children:t.t("doc.uploading")}):null,d(fe,{children:[d(K,{full:!0,onClick:l,disabled:g||!a||e.attemptsExhausted,children:[n(se,{name:"image"}),y.t("doc.source.upload")]}),S!==void 0?d(K,{full:!0,kind:"ghost",onClick:S,disabled:g,children:[n(A,{name:"camera"}),y.t("doc.source.camera")]}):null]})]})}s(Et,"DocumentUploadScreen");function nt(e,t,o){let r=e*.88,a=r/o;return{x:(e-r)/2,y:t*.42-a/2,w:r,h:a}}s(nt,"guideRect");var Ut={"mrz:moveCloser":"dcv3.mrz.moveCloser","mrz:turnSideways":"dcv3.mrz.turnSideways","mrz:glare":"dcv3.mrz.glare",too_far:"native.scan.closer",too_close:"native.scan.farther",focus_far:"native.scan.farther",glare:"native.scan.glare",too_bright:"native.scan.glare",too_dark:"native.scan.dark",blurry:"native.scan.blurry"},Kt=s(()=>typeof window<"u"&&window.matchMedia?.("(prefers-reduced-motion: reduce)").matches===!0,"reduceMotion");function At({step:e,i18n:t,liveMrz:o,barcodeAssetBaseUrl:r,onClose:a,attempts:l,onUpload:S}){let h=be(t),f=ot(Ue),y=L(f);y.current=f;let g=L(null),w=L(null),C=L(null),[z,M]=k("idle"),[b,V]=k(null),[H,O]=k(null),[v,q]=k({w:0,h:0}),[D,F]=k({hint:null,locking:!1,card:null,manualShutter:!1}),[R,ee]=k({}),[X,ct]=k(null),[ze,lt]=k(null),[Ne,De]=k(0),[xe,Te]=k(null),[ie,dt]=k(null),[ce,ut]=k(0),Le=L(0);Le.current=ce;let E=e.documentType==="passport",te=E?1.42:1.586;Ve(!0),Ct(()=>{let c=g.current;if(c===null)return;let p=s(()=>q({w:c.clientWidth,h:c.clientHeight}),"measure");if(p(),typeof ResizeObserver>"u")return;let u=new ResizeObserver(p);return u.observe(c),()=>u.disconnect()},[]);let i=nt(v.w,v.h,te);B(()=>{v.w===0||v.h===0||C.current?.setGuide?.({viewAspect:v.w/v.h,rect:{x:i.x/v.w,y:i.y/v.h,width:i.w/v.w,height:i.h/v.h}})},[v.w,v.h,i.x,i.y,i.w,i.h]),B(()=>{let c=w.current;if(c===null)return;let p=e.capture({video:c,...o!==void 0?{liveMrz:o}:{},...r!==void 0?{barcodeAssetBaseUrl:r}:{}});C.current=p;let u=g.current;if(u!==null&&u.clientWidth>0&&u.clientHeight>0){let m=nt(u.clientWidth,u.clientHeight,te);p.setGuide?.({viewAspect:u.clientWidth/u.clientHeight,rect:{x:m.x/u.clientWidth,y:m.y/u.clientHeight,width:m.w/u.clientWidth,height:m.h/u.clientHeight}})}let I=new ae,_={scan:null,feedback:null,gate:null,mrz:null},$=s(m=>{_={..._,...m};let x=_.gate?.guide,wt={phase:_.scan?.phase??"framing",hint:_.feedback?.reticle==="coaching"?_.feedback.key:e.documentType==="drivers_license"?null:It(_.mrz),card:x?.detected?{fill:x.fill,offsetX:x.offsetX,offsetY:x.offsetY}:null,manualShutter:_.scan?.manualShutter??!1},W=I.present(wt,performance.now());F(j=>j.hint===W.hint&&j.locking===W.locking&&j.manualShutter===W.manualShutter&&Ft(j.card,W.card)?j:W)},"present"),kt=[p.on("state",M),p.on("feedback",m=>$({feedback:m})),p.on("gate",m=>$({gate:m})),p.on("scan",m=>{V(m),$({scan:m})}),p.on("captured",m=>{ut(x=>x+1),ee(x=>({...x,[Yt(m.side,E,x)]:m.previewDataUrl})),ct(m.previewDataUrl),lt(Xt(c))}),p.on("error",m=>{O(m);let x=y.current;x!==null&&Ae(x,Ke("document",m,Math.max(0,l.current)))}),p.on("mrz",m=>{m.state==="mismatch"?dt({format:m.format??null,at:Le.current}):(Te(m),$({mrz:m}))})];return l.current+=1,p.start().catch(()=>{}),()=>{for(let m of kt)m();p.destroy(),C.current=null}},[e.issuer,e.documentType]);let T=b?.phase??"framing",P=T==="reading"||T==="result",le=T==="flipCue"||T==="reaskRecto",U=D.locking,Me=b?.captured.length??0;B(()=>{U&&De(c=>c+1)},[U]),B(()=>{Me>0&&De(c=>c+1)},[Me]);let pt=b?.expected??null;B(()=>{Te(null)},[pt]);let de=le||P||e.documentType==="drivers_license"?null:Pt(xe,E),Pe=s(c=>t.strings[c]??Tt[t.locale][c],"liveText"),mt=s(c=>c.startsWith("dcv3.")?Pe(c):h(c),"copy"),ue=de!==null?Pe(de):h(T==="flipCue"?"doc.flip":T==="reaskRecto"?"doc.reaskRecto":P?"native.scan.reading":T==="locking"||T==="capturing"||U?"native.scan.holdStill":E?"doc.showPage":"doc.showSide"),ne=_e(e),Ie=s(c=>({key:h(c),action:ve(t,e.attemptsRemaining,e.attemptsExhausted),blocking:e.reason!==void 0&&rt.has(e.reason)}),"reasonProblem"),$e=$t(e.documentType),ht=ie!==null&&ce<=ie.at+1?{key:h(ie.format==="TD3"?"native.scan.seenPassport":"native.scan.seenCard"),action:$e===null?null:h($e),blocking:!0}:b?.notice==="same_face"?{key:h("doc.sameFace"),action:null,blocking:!1}:b?.notice==="reread"?ne!==null?Ie(ne):{key:h("doc.reread"),action:null,blocking:!1}:b?.notice==="technical"?{key:h("native.scan.retry"),action:null,blocking:!1}:b?.notice==="blurry"?{key:h("native.scan.blurry"),action:null,blocking:!1}:ne!==null&&ce===0?Ie(ne):null,ft=D.hint===null?null:mt(Ut[D.hint]??`dcv2.${D.hint}`),He=Bt(ht,ft,U||T==="capturing"||P),Y=D.card,N=i;if(!U&&Y!==null&&Y.fill>=.45&&Y.fill<=1.25&&!Kt()){let c=i.w*Y.fill,p=c/te,u=i.x+i.w/2+i.w*Math.max(-.25,Math.min(.25,Y.offsetX)),I=i.y+i.h/2+i.h*Math.max(-.25,Math.min(.25,Y.offsetY));N={x:u-c/2,y:I-p/2,w:c,h:p}}let oe=i.w*.045,pe=28,Oe=Math.min(oe,pe*.6),yt=[[N.x,N.y,1,1],[N.x+N.w,N.y,-1,1],[N.x,N.y+N.h,1,-1],[N.x+N.w,N.y+N.h,-1,-1]],vt=U?"is-locked":He!==null?"is-coaching":"",gt=E?[{side:"single",label:"doc.progressPage"}]:[{side:"recto",label:"doc.progressFront"},{side:"verso",label:"doc.progressBack"}],St=i.y+i.h+16,me={insetInlineStart:i.x,insetBlockStart:i.y,inlineSize:i.w,blockSize:i.h,borderRadius:oe};return n("section",{className:"sekyro-lm","aria-label":ue,"data-testid":"sekyro-document",children:d("div",{ref:g,className:`sekyro-lm-stage${P?" is-reading":""}${le?" is-flip":""}`,style:{"--sekyro-guide-w":`${i.w}px`},children:[n("video",{ref:w,className:"sekyro-lm-video",playsInline:!0,muted:!0,autoPlay:!0,"aria-hidden":"true",onPointerUp:c=>{let p=c.currentTarget,u=p.getBoundingClientRect(),I=Math.max(u.width/(p.videoWidth||1),u.height/(p.videoHeight||1)),_=p.videoWidth*I,$=p.videoHeight*I;_>0&&$>0&&C.current?.focusAt((c.clientX-u.left+(_-u.width)/2)/_,(c.clientY-u.top+($-u.height)/2)/$)}}),v.w>0?d(we,{children:[P&&ze!==null?n("img",{className:"sekyro-lm-scene",src:ze,alt:""}):null,P&&X!==null?n("img",{className:"sekyro-lm-frozen",src:X,alt:"",style:me}):null,d("svg",{className:"sekyro-lm-overlay",viewBox:`0 0 ${v.w} ${v.h}`,"aria-hidden":"true",focusable:"false",children:[d("defs",{children:[d("linearGradient",{id:"sekyro-lm-top",x1:"0",y1:"0",x2:"0",y2:"1",children:[n("stop",{offset:"0",className:"sekyro-lm-ink",stopOpacity:"0.85"}),n("stop",{offset:"1",className:"sekyro-lm-ink",stopOpacity:"0"})]}),d("linearGradient",{id:"sekyro-lm-bottom",x1:"0",y1:"0",x2:"0",y2:"1",children:[n("stop",{offset:"0",className:"sekyro-lm-ink",stopOpacity:"0"}),n("stop",{offset:"1",className:"sekyro-lm-ink",stopOpacity:"0.9"})]})]}),n("path",{className:"sekyro-lm-scrim",fillRule:"evenodd",d:`M0 0H${v.w}V${v.h}H0Z${Gt(i,oe)}`}),n("rect",{width:v.w,height:Math.max(0,i.y),fill:"url(#sekyro-lm-top)"}),n("rect",{y:i.y+i.h,width:v.w,height:Math.max(0,v.h-i.y-i.h),fill:"url(#sekyro-lm-bottom)"}),n("g",{className:`sekyro-lm-brackets ${vt}`,children:yt.map(([c,p,u,I],_)=>n("path",{style:{transform:`translate(${c}px, ${p}px) scale(${u}, ${I})`},d:`M0 ${pe}V${Oe}Q0 0 ${Oe} 0H${pe}`},_))}),U?n("rect",{className:"sekyro-lm-trace",x:i.x,y:i.y,width:i.w,height:i.h,rx:oe,pathLength:"1",style:{animationDuration:`${Nt}ms`}}):null]}),n("div",{className:"sekyro-lm-slot",style:me,"aria-hidden":"true",children:P?n("span",{className:"sekyro-lm-read is-repeating"}):Ne>0?n("span",{className:"sekyro-lm-read"},Ne):null})]}):null,de!==null?n("div",{className:"sekyro-lm-slot",style:me,"aria-hidden":"true",children:n("span",{"data-testid":"sekyro-mrz-strip",className:`sekyro-lm-mrz${E?" is-page":""}${xe?.state==="valid"?" is-valid":""}`})}):null,n("div",{className:"sekyro-lm-instruction",style:{insetBlockStart:i.y-64},children:n("div",{role:"status","aria-live":"polite","data-testid":"sekyro-scan-instruction",children:n(Fe,{swapKey:ue,className:"sekyro-lm-line",children:ue})})}),d("div",{className:"sekyro-lm-below",style:{insetBlockStart:St,inlineSize:i.w,insetInlineStart:i.x},children:[n(Vt,{band:He}),P?d("p",{className:"sekyro-lm-note",children:[n("span",{className:"sekyro-lm-spinner","aria-hidden":"true"}),h("native.scan.putDown")]}):le?n("div",{className:`sekyro-lm-flip${T==="reaskRecto"?" is-toFront":""}`,"data-testid":"sekyro-flip-cue","aria-hidden":"true",children:d("span",{className:"sekyro-lm-flip-card",style:{aspectRatio:String(te)},children:[n("span",{className:"sekyro-lm-flip-front"}),n("span",{className:"sekyro-lm-flip-back"})]})}):null]}),d("div",{className:"sekyro-lm-controls",children:[d("div",{className:"sekyro-lm-bar",children:[n("button",{type:"button",className:"sekyro-glass","aria-label":t.t("native.close"),onClick:a,children:n(A,{name:"close"})}),b?.torchAvailable?n("button",{type:"button",className:`sekyro-glass${b.torch?" is-on":""}`,"aria-label":t.t("doc.torchOn"),"aria-pressed":b.torch,onClick:()=>C.current?.setTorch(!b.torch),children:n(se,{name:"flashlight"})}):null]}),H!==null?d("div",{className:"sekyro-lm-error",role:"alert",children:[n("p",{children:t.t("doc.cameraBlocked")}),n("p",{children:t.t(H.kind==="permission"?"doc.cameraBlockedHint":Re(H.kind))}),n(K,{onClick:()=>{O(null),l.current+=1,C.current?.retry()},children:t.t("doc.retryCamera")})]}):null,D.manualShutter?n("button",{type:"button",className:"sekyro-shutter","aria-label":t.t("doc.shutter"),onClick:()=>C.current?.shutter()}):null,n("ol",{className:"sekyro-lm-tray",children:gt.map(({side:c,label:p})=>{let u=b?.captured.includes(c)??!1;return d("li",{className:u?"is-done":void 0,"aria-current":!u&&(E||b?.expected===c)?"step":void 0,children:[u?d("span",{className:"sekyro-lm-thumb",children:[R[c]!==void 0?n("img",{src:R[c],alt:""}):null,n("svg",{className:"sekyro-lm-check",viewBox:"0 0 18 18","aria-hidden":"true",children:n("path",{d:"M5 9.2l2.6 2.6L13 6.4"})})]}):null,h(p)]},c)})}),S!==void 0?n("button",{type:"button",className:"sekyro-lm-upload",onClick:S,children:G(t).t("doc.uploadInstead")}):null,z==="uploading"||z==="checking"?null:n(Ge,{onStop:a})]}),z==="uploading"||z==="checking"?n("span",{className:"sekyro-visually-hidden",role:"status",children:z==="uploading"?t.t("doc.uploading"):h("native.scan.reading")}):null]})})}s(At,"LumiereScan");function Bt(e,t,o){let r=L(null);r.current??(r.current=new re);let[a,l]=k(null),S=L({problem:e,hint:t,busy:o});S.current={problem:e,hint:t,busy:o};let h=e===null?null:`${e.blocking}|${e.key}|${e.action??""}`;return B(()=>{let f=s(()=>{let{problem:g,hint:w,busy:C}=S.current;l(r.current?.present(g,w,C,performance.now())??null)},"run");f();let y=setInterval(f,250);return()=>clearInterval(y)},[h,t,o]),a}s(Bt,"useNoticeBand");function Vt({band:e}){let[t,o]=k(e);B(()=>{e!==null&&o(e)},[e]);let r=e??t;return n("div",{className:`sekyro-lm-band${e!==null?" is-open":""}`,"data-testid":"sekyro-scan-notice",children:n("div",{role:"status","aria-live":"polite","aria-atomic":"true",children:r!==null?d("div",{className:"sekyro-notice sekyro-notice--warning","data-kind":r.kind,"aria-hidden":e===null||void 0,children:[n("span",{className:"sekyro-notice__icon","aria-hidden":"true",children:n(A,{name:"warning"})}),d("div",{className:"sekyro-notice__body",children:[n("span",{children:r.key}),r.action!==null&&r.action!==""?n("span",{children:r.action}):null]})]}):null})})}s(Vt,"NoticeBandView");function Yt(e,t,o){return t?"single":e==="recto"||e==="verso"?e:o.recto===void 0?"recto":"verso"}s(Yt,"slotOf");function Gt({x:e,y:t,w:o,h:r},a){return`M${e+a} ${t}H${e+o-a}Q${e+o} ${t} ${e+o} ${t+a}V${t+r-a}Q${e+o} ${t+r} ${e+o-a} ${t+r}H${e+a}Q${e} ${t+r} ${e} ${t+r-a}V${t+a}Q${e} ${t} ${e+a} ${t}Z`}s(Gt,"roundedRect");var ke=.004;function Ft(e,t){return e===null||t===null?e===t:Math.abs(e.fill-t.fill)<ke&&Math.abs(e.offsetX-t.offsetX)<ke&&Math.abs(e.offsetY-t.offsetY)<ke}s(Ft,"sameCard");function Xt(e){let t=Math.round(e.videoWidth/4),o=Math.round(e.videoHeight/4);if(t===0||o===0||typeof document>"u")return null;try{let r=document.createElement("canvas");r.width=t,r.height=o;let a=r.getContext("2d");return a===null?null:(a.drawImage(e,0,0,t,o),r.toDataURL("image/jpeg",.7))}catch{return null}}s(Xt,"sceneSnapshot");export{$n as DocumentCaptureView,Nt as LOCK_TRACE_MS,Mt as UPLOAD_ACCEPT,nt as guideRect,xt as introCopy,It as mrzHint,Pt as mrzInstruction,Ft as sameCard,$t as showInsteadKey,Yt as slotOf};
|