@sekyro/elements 0.1.0-rc.12 → 0.1.0-rc.14
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 +18 -0
- package/dist/cdn/chunks/{capture-session-doc-FAMDLRRZ-QPOFTNTG.js → capture-session-doc-OT5L7P2W-27S5FD3I.js} +1 -1
- package/dist/cdn/chunks/chunk-3HWXZNEO.js +1 -0
- package/dist/cdn/chunks/chunk-3NOBU7TE.js +1 -0
- package/dist/cdn/chunks/{chunk-JI5WT66H.js → chunk-4UHFOHD4.js} +1 -1
- package/dist/cdn/chunks/chunk-6OVZIUQG.js +1 -0
- package/dist/cdn/chunks/{chunk-SDK2YXFV.js → chunk-7NYZYJ65.js} +1 -1
- package/dist/cdn/chunks/chunk-A5SXWFOO.js +1 -0
- package/dist/cdn/chunks/{chunk-YFJBTK3L.js → chunk-ARUBIBVG.js} +1 -1
- package/dist/cdn/chunks/{chunk-CVFJQIMW.js → chunk-CK3CQAFP.js} +1 -1
- package/dist/cdn/chunks/{chunk-GPGK6XZM.js → chunk-DKZUKWGP.js} +1 -1
- package/dist/cdn/chunks/{chunk-4YBL75VD.js → chunk-F7DKVXQW.js} +1 -1
- package/dist/cdn/chunks/{chunk-UN4V3UNQ.js → chunk-FKKDPSQW.js} +1 -1
- package/dist/cdn/chunks/{chunk-LBZCFEU4.js → chunk-IZOPN3L7.js} +2 -2
- package/dist/cdn/chunks/{chunk-BMUUDLFA.js → chunk-PYUD6W3P.js} +1 -1
- package/dist/cdn/chunks/chunk-RUUVQMYA.js +1 -0
- package/dist/cdn/chunks/{chunk-VHNWBOKW.js → chunk-SHOVUF5C.js} +1 -1
- package/dist/cdn/chunks/chunk-SSNEIJXI.js +3 -0
- package/dist/cdn/chunks/{chunk-7JUL7AKT.js → chunk-VI6GYKFP.js} +1 -1
- package/dist/cdn/chunks/chunk-YLKAOH5O.js +1 -0
- package/dist/cdn/chunks/{create-document-capture-WFTNVMCE-QOCPJSAU.js → create-document-capture-UWIOYOJN-HGOY7QHE.js} +1 -1
- package/dist/cdn/chunks/{detector-scanic-S4PB2RNW-3KSM3MW5.js → detector-scanic-F2PZUPJ5-LJIJE4EQ.js} +1 -1
- package/dist/cdn/chunks/{document-capture-view-GENB535Z-YBRM7NWN.js → document-capture-view-57N5YWTH-PK233SM3.js} +1 -1
- package/dist/cdn/chunks/{eid-view-IQRZGEMP-SPGYQDQP.js → eid-view-IQRZGEMP-S4CA2XHE.js} +1 -1
- package/dist/cdn/chunks/{email-otp-view-CL76K5TY-TJMSLYLZ.js → email-otp-view-CL76K5TY-TBSVRBPS.js} +1 -1
- package/dist/cdn/chunks/{flow-views-C3EIMXME-ODOF67JZ.js → flow-views-IAR45I3I-532HULEY.js} +1 -1
- package/dist/cdn/chunks/{form-view-MEYCK437-JBO5DNG5.js → form-view-MEYCK437-HEBYLC2O.js} +1 -1
- package/dist/cdn/chunks/plan-runner-T32MAX5F-UMGOSLJM.js +1 -0
- package/dist/cdn/chunks/{portrait-capture-view-VTN2VU3E-JH34ISLI.js → portrait-capture-view-ZF4YAMA6-ZBYYEIH5.js} +1 -1
- package/dist/cdn/chunks/{portrait-review-view-JTRGDYNV-C2O6OFYY.js → portrait-review-view-LOS5AYBI-XHDB2V3K.js} +1 -1
- package/dist/cdn/chunks/{proof-of-address-view-UQOZZXQO-T3QOIQNE.js → proof-of-address-view-X2EVWZBX-KTHPWCWT.js} +1 -1
- package/dist/cdn/define.js +1 -1
- package/dist/cdn/index.js +1 -1
- package/dist/chunk-43Y4MKKF.js +1 -0
- package/dist/{chunk-753PBLDK.js → chunk-C7AP2EMK.js} +1 -1
- package/dist/{chunk-LGFZBFVB.js → chunk-NYLIZY4Y.js} +2 -2
- package/dist/{chunk-PYQREZ33.js → chunk-PHI7KVJY.js} +1 -1
- package/dist/define.cjs +4 -4
- package/dist/define.js +1 -1
- package/dist/{document-capture-view-GENB535Z-L5V7YSPP.js → document-capture-view-57N5YWTH-BFPOD3RA.js} +1 -1
- package/dist/{flow-views-C3EIMXME-GGE4OUEO.js → flow-views-IAR45I3I-IFHB5BCY.js} +1 -1
- package/dist/index.cjs +4 -4
- package/dist/index.js +1 -1
- package/dist/{portrait-capture-view-VTN2VU3E-2HKWLWRG.js → portrait-capture-view-ZF4YAMA6-XC2X56PD.js} +1 -1
- package/dist/{portrait-review-view-JTRGDYNV-TNR7WBYD.js → portrait-review-view-LOS5AYBI-RP6TNHLA.js} +1 -1
- package/dist/{proof-of-address-view-UQOZZXQO-XJTGU3G6.js → proof-of-address-view-X2EVWZBX-SIJUQ4SR.js} +1 -1
- package/package.json +2 -2
- package/sbom.cdx.json +4 -4
- package/dist/cdn/chunks/chunk-2FETDQV5.js +0 -1
- package/dist/cdn/chunks/chunk-FVWYONHZ.js +0 -1
- package/dist/cdn/chunks/chunk-K4BLQMYZ.js +0 -1
- package/dist/cdn/chunks/chunk-Q5BUNNRN.js +0 -3
- package/dist/cdn/chunks/chunk-XDRH4VWV.js +0 -1
- package/dist/cdn/chunks/chunk-XSGZY4JI.js +0 -1
- package/dist/cdn/chunks/chunk-YLH3WX7Y.js +0 -1
- package/dist/cdn/chunks/plan-runner-LSQTIO6L-XZJIKXPZ.js +0 -1
- package/dist/chunk-ZUVOUGIA.js +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,23 @@
|
|
|
1
1
|
# @sekyro/elements
|
|
2
2
|
|
|
3
|
+
## 0.1.0-rc.14
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 9a15ded: Voice guidance now plays its first prompt when the capture starts on its own, before the person has tapped the page. Browsers refuse audio until the first tap. Before, that first prompt was counted as spoken and never played, so a cold page load stayed silent until the guidance changed. Now the refused prompt plays on the first tap, once. Prompts still play one at a time, a newer prompt replaces a waiting one, and a prompt never repeats.
|
|
8
|
+
|
|
9
|
+
## 0.1.0-rc.13
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- Carries the @sekyro/react release of this version: the changes in its changelog reach the element.
|
|
14
|
+
- Updated dependencies [e38c7e2]
|
|
15
|
+
- Updated dependencies [5c2b1fa]
|
|
16
|
+
- Updated dependencies [24c87ef]
|
|
17
|
+
- Updated dependencies [ea2bd51]
|
|
18
|
+
- Updated dependencies [b3a1018]
|
|
19
|
+
- @sekyro/web@0.1.0-rc.34
|
|
20
|
+
|
|
3
21
|
## 0.1.0-rc.12
|
|
4
22
|
|
|
5
23
|
### Patch Changes
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as a,d as s,e as o,f as r,g as _,h as t,i as A,j as C,k as D,l as p,m as i}from"./chunk-
|
|
1
|
+
import{c as a,d as s,e as o,f as r,g as _,h as t,i as A,j as C,k as D,l as p,m as i}from"./chunk-YLKAOH5O.js";import"./chunk-4UHFOHD4.js";import"./chunk-3NOBU7TE.js";import"./chunk-6OVZIUQG.js";import"./chunk-L22GFJQV.js";import"./chunk-F7DKVXQW.js";import"./chunk-P7K7ELYZ.js";import"./chunk-JS2IXPNL.js";import"./chunk-4FHWXBOB.js";export{i as CAPTURE_CANDIDATE_SPACING_MS,p as CAPTURE_EXTRA_CANDIDATES,C as CaptureSessionDoc,o as DOC_BLACK_FRAME_LUMA,r as DOC_BLACK_FRAME_TICKS,_ as DOC_CADENCE_HZ,s as DOC_FIRST_FRAME_MS,t as DOC_SHUTTER_DEFAULTS,D as passportBandOf,A as resolveDocShutterTuning,a as warmDocDetector};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as Nr}from"./chunk-CK3CQAFP.js";import{c as _t}from"./chunk-3DDOCOIB.js";import{b as kr,d as br}from"./chunk-PYUD6W3P.js";import{b as xr,c as Ct}from"./chunk-GZOBS7KG.js";import{a as yr,b as gr,c as vr,d as Me}from"./chunk-AARN2MG7.js";import{F as _r,K as wr,L as Sr,a as K,b as de,c as te,m as pr,n as Xe,p as hr,q as et,r as fr,s as mr,t as bt,u as le,v as Ee,w as tt,y as Cr}from"./chunk-JJ3Q52P3.js";import{b as ir,c as cr,d as ur,g as dr}from"./chunk-DKZUKWGP.js";import{b as kt}from"./chunk-F7DKVXQW.js";import{a as s}from"./chunk-5QL6W6FW.js";import{g as or}from"./chunk-6MYG4HWP.js";import{a as l,c as U}from"./chunk-4FHWXBOB.js";var Ar=U(K(),1),y=U(de(),1),re=U(de(),1),ye=U(K(),1),F=U(de(),1),C=U(K(),1),m=U(K(),1),at=U(K(),1),fe=U(de(),1),Wr=U(K(),1),Q=U(K(),1),ot=U(K(),1),we=U(de(),1),Se=U(de(),1),P=U(de(),1);var it=U(K(),1),pe=U(K(),1);var J=U(K(),1);var E=U(K(),1),me=U(K(),1),Te=U(K(),1),At=U(de(),1),v=U(de(),1);function ie({className:e,children:t}){return(0,y.jsx)("svg",{"aria-hidden":"true",focusable:"false",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",className:e??"sekyro-icon sekyro-icon--sm",children:t})}l(ie,"ne");s(ie,"Svg");var Mt="M4 7.5h2.2l1.4-1.9h8.8l1.4 1.9H20a1.6 1.6 0 0 1 1.6 1.6v8.3A1.6 1.6 0 0 1 20 19H4a1.6 1.6 0 0 1-1.6-1.6V9.1A1.6 1.6 0 0 1 4 7.5Z";function Mr(e){return(0,y.jsxs)(ie,{...e,children:[(0,y.jsx)("circle",{cx:"12",cy:"12",r:"4"}),(0,y.jsx)("path",{d:"M12 2.5v2M12 19.5v2M2.5 12h2M19.5 12h2M5.3 5.3l1.4 1.4M17.3 17.3l1.4 1.4M5.3 18.7l1.4-1.4M17.3 6.7l1.4-1.4"})]})}l(Mr,"ln");s(Mr,"SunIcon");function Er(e){return(0,y.jsxs)(ie,{...e,children:[(0,y.jsx)("circle",{cx:"12",cy:"12",r:"9"}),(0,y.jsx)("path",{d:"M9 10h.01M15 10h.01M8.8 14.6a4.2 4.2 0 0 0 6.4 0"})]})}l(Er,"un");s(Er,"FaceUncoveredIcon");function Lr(e){return(0,y.jsxs)(ie,{...e,children:[(0,y.jsx)("rect",{x:"7",y:"2.5",width:"10",height:"19",rx:"2"}),(0,y.jsx)("path",{d:"M10.5 18.5h3M2.5 9.5h2.5M19 9.5h2.5"}),(0,y.jsx)("circle",{cx:"12",cy:"9.5",r:"1.6"})]})}l(Lr,"dn");s(Lr,"PhoneEyeLevelIcon");function Ir(e){return(0,y.jsxs)(ie,{...e,children:[(0,y.jsx)("path",{d:"M2.5 12S6 5.5 12 5.5 21.5 12 21.5 12 18 18.5 12 18.5 2.5 12 2.5 12Z"}),(0,y.jsx)("circle",{cx:"12",cy:"12",r:"2.8"})]})}l(Ir,"pn");s(Ir,"LookStraightIcon");function Ur(e){return(0,y.jsxs)(ie,{...e,children:[(0,y.jsx)("path",{d:Mt}),(0,y.jsx)("path",{d:"M9 13l2 2 4-4"})]})}l(Ur,"fn");s(Ur,"CameraCheckIcon");function jr(e){return(0,y.jsxs)(ie,{...e,children:[(0,y.jsx)("path",{d:Mt}),(0,y.jsx)("path",{d:"M10.2 11.2a1.9 1.9 0 1 1 2.6 1.8c-.5.2-.8.6-.8 1.1v.3M12 16.4h.01"})]})}l(jr,"mn");s(jr,"CameraAskIcon");function Tr(e){return(0,y.jsxs)(ie,{...e,children:[(0,y.jsx)("path",{d:Mt}),(0,y.jsx)("path",{d:"M3 3l18 18"})]})}l(Tr,"yn");s(Tr,"CameraBlockedIcon");function nt({off:e,className:t}){return(0,y.jsxs)(ie,{className:t,children:[(0,y.jsx)("path",{d:"M4.5 9.5v5H8l4 3.5v-12L8 9.5H4.5Z"}),e?(0,y.jsx)("path",{d:"M4 4l16 16"}):(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)("path",{d:"M15.5 9.7a3.6 3.6 0 0 1 0 4.6"}),(0,y.jsx)("path",{d:"M18 7.6a6.6 6.6 0 0 1 0 8.8"})]})]})}l(nt,"Ve");s(nt,"SpeakerIcon");function Or(e){return(0,y.jsx)(ie,{...e,children:(0,y.jsx)("path",{d:"M5 12.5l4.5 4.5L19 7.5"})})}l(Or,"gn");s(Or,"CheckIcon");function Pr(e){return(0,y.jsxs)(ie,{className:e.className??"sekyro-spinner",children:[(0,y.jsx)("circle",{cx:"12",cy:"12",r:"9",opacity:"0.25"}),(0,y.jsx)("path",{d:"M21 12a9 9 0 0 0-9-9"})]})}l(Pr,"hn");s(Pr,"SpinnerIcon");var wt=["light","uncover","eyeLevel","straight"],Ln={light:{key:"capture.tips.light",icon:s(()=>(0,re.jsx)(Mr,{}),"icon")},uncover:{key:"capture.tips.uncover",icon:s(()=>(0,re.jsx)(Er,{}),"icon")},eyeLevel:{key:"capture.tips.eyeLevel",icon:s(()=>(0,re.jsx)(Lr,{}),"icon")},straight:{key:"capture.tips.straight",icon:s(()=>(0,re.jsx)(Ir,{}),"icon")}};function Br({tips:e}){let t=Me(),n=(0,Ar.useId)();return e.length===0?null:(0,re.jsxs)("section",{className:"sekyro-tips","aria-labelledby":n,"data-testid":"sekyro-tips",children:[(0,re.jsx)("p",{className:"sekyro-tips__title",id:n,children:t("capture.tips.title")}),(0,re.jsx)("ul",{className:"sekyro-tips__list",children:e.map(r=>{let a=typeof r=="string"?Ln[r]:void 0,o=typeof r=="string"?r:r.id,c=a!==void 0?a.icon():typeof r=="string"?void 0:r.icon,d=a!==void 0?t(a.key):typeof r=="string"?r:r.text;return(0,re.jsxs)("li",{className:"sekyro-tips__item",children:[c!=null?(0,re.jsx)("span",{className:"sekyro-tips__icon","aria-hidden":"true",children:c}):null,(0,re.jsx)("span",{children:d})]},o)})})]})}l(Br,"Cn");s(Br,"TipList");var In=220;function qr({title:e,description:t,options:n,busy:r,error:a,focus:o,testId:c,look:d="cards",marked:S,onChoose:p}){let w=(0,ye.useId)(),N=bt(),[j,R]=(0,ye.useState)(null),B=(0,ye.useRef)(null);(0,ye.useEffect)(()=>{a!==null&&R(null)},[a]),(0,ye.useEffect)(()=>()=>{B.current!==null&&clearTimeout(B.current)},[]);let q=s(A=>{r||j!==null||(R(A),B.current=setTimeout(()=>{B.current=null,R(null),p(A)},In))},"choose");return(0,F.jsxs)("section",{className:"sekyro-stack sekyro-stack--4 sekyro-choice","aria-labelledby":w,"data-testid":c,children:[(0,F.jsxs)("div",{className:d==="cards"?"sekyro-heading":"sekyro-stack sekyro-stack--1",children:[(0,F.jsx)("h2",{id:w,ref:o?N:void 0,tabIndex:-1,className:"sekyro-text-body",children:e}),t!==void 0&&t!==""?(0,F.jsx)("p",{className:"sekyro-text-muted",children:t}):null]}),a!==null?(0,F.jsx)(le,{tone:"danger",children:(0,F.jsx)("span",{children:a})}):null,d==="buttons"?(0,F.jsx)("div",{className:"sekyro-stack sekyro-stack--3",children:n.map((A,X)=>(0,F.jsx)(te,{kind:X===0?"primary":"ghost",full:!0,disabled:r,"aria-busy":r||void 0,onClick:l(()=>p(A.id),"onClick"),children:A.label},A.id))}):(0,F.jsx)("div",{className:"sekyro-choices",children:n.map(A=>(0,F.jsxs)("button",{type:"button",className:"sekyro-card","aria-pressed":(j??S)===A.id,"aria-busy":r||void 0,disabled:r||j!==null&&j!==A.id,onClick:l(()=>q(A.id),"onClick"),children:[A.glyph!==void 0?(0,F.jsx)("span",{className:"sekyro-card__tile",children:A.glyph}):null,(0,F.jsxs)("span",{className:"sekyro-card__body",children:[(0,F.jsx)("span",{className:"sekyro-card__title",children:A.label}),A.sub!==void 0?(0,F.jsx)("span",{className:"sekyro-card__sub",children:A.sub}):null]}),(0,F.jsx)("span",{className:"sekyro-radio","aria-hidden":"true"})]},A.id))})]})}l(qr,"bn");s(qr,"ChoiceScreen");var Vr=["fcv3.no_face","fcv3.come_closer","fcv3.move_back","fcv3.center_face","fcv3.straighten","fcv3.more_light","fcv3.too_bright","fcv3.hold_still","fcv3.steady_camera","fcv3.hold_upright","fcv3.one_face","capture.tips.summary","capture.lookAtColours"];function st(e){return e!==null&&Vr.includes(e)}l(st,"he");s(st,"isVoiceKey");var Un=s((e,t)=>Object.prototype.hasOwnProperty.call(e,t),"own");function je(e,t,n){let r;try{if(typeof e=="function")r=e(t,n);else{let a=e[n];r=a!=null&&Un(a,t)?a[t]:null}}catch{return null}return typeof r=="string"&&r!==""?r:null}l(je,"Me");s(je,"resolveClip");var jn="UklGRiQAAABXQVZFZm10IBAAAAABAAEAESsAACJWAAACABAAZGF0YQAAAAA=",Tn={ar:"ar-SA",fr:"fr-FR",en:"en-US",es:"es-ES",pt:"pt-BR",de:"de-DE"};function oe(){return typeof window<"u"&&"speechSynthesis"in window?window.speechSynthesis:null}l(oe,"re");s(oe,"synth");function Dr(){return oe()!==null&&typeof SpeechSynthesisUtterance=="function"}l(Dr,"Lr");s(Dr,"speechAvailable");function St(e){return(e.split(/[-_]/)[0]??e).toLowerCase()}l(St,"Sn");s(St,"baseLang");function Et(e,t){let n=s(a=>a.replace(/_/g,"-").toLowerCase(),"norm"),r=St(t);return e.find(a=>n(a.lang)===n(t))??e.find(a=>St(a.lang)===r)}l(Et,"Mn");s(Et,"pickVoice");function $r(e){if(!Dr())return!1;let t=[];try{t=oe()?.getVoices()??[]}catch{return!0}return t.length===0||Et(t,e)!==void 0}l($r,"wn");s($r,"speechUsable");function Fr(e){let t=oe();return t===null||typeof t.addEventListener!="function"?()=>{}:(t.addEventListener("voiceschanged",e),()=>t.removeEventListener?.("voiceschanged",e))}l(Fr,"Ln");s(Fr,"subscribeVoices");function De(e){try{let t=typeof location<"u"?location.href:"http://localhost/",n=new URL(e,t);return`clip:${n.origin}${n.pathname}`}catch{return`clip:${e}`}}l(De,"Ke");s(De,"clipIdentity");function xt(e){e.pause(),e.removeAttribute("src"),e.load()}l(xt,"Rn");s(xt,"release");function Hr(){let e=null,t=null,n=0,r=null,a=null,o=null,c=!1,d=null,S=[],p=new Map,w=s(()=>{S=oe()?.getVoices()??[]},"loadVoices"),N=!1,j=s(()=>{let h=oe();N||h===null||(N=!0,w(),h.addEventListener?.("voiceschanged",w))},"bindVoices"),R=s(()=>(e??(e=new Audio),e),"element"),B=s((h,x,_,k)=>{let u=oe();if(u!==null&&h!==""&&typeof SpeechSynthesisUtterance=="function"){j();let M=Et(S,x);if(S.length===0||M!==void 0){u.cancel();let I=new SpeechSynthesisUtterance(h);I.lang=x,M!==void 0&&(I.voice=M),I.rate=.95,_!==void 0&&(I.onend=_),(_!==void 0||k!==void 0)&&(I.onerror=D=>{k!==void 0&&D.error==="not-allowed"?k():_?.()}),u.speak(I);return}}_?.()},"speak"),q=s(()=>{n+=1,r=null,a=o=null,e!==null&&(e.pause(),e.currentTime=0),oe()?.cancel()},"stop"),A=s(h=>{for(let x of h){let _=De(x);if(p.has(_))continue;let k=new Audio;k.preload="auto",k.src=x,p.set(_,k)}},"warmClips"),X=s((h,x,_)=>{let k={utterance:h,generation:x,end:_};d=k;let u=s(()=>x===n&&d===k,"live"),M=s(()=>{u()&&(a=k)},"block");if(oe()?.cancel(),h.url!==null){let I=R();I.pause(),I.muted=!1,I.src=h.url,I.currentTime=0,I.onended=_??null;let D=s(()=>{o===k&&(o=null)},"settled"),i=I.play();if(i===void 0)return;o=k,i.then(D,T=>{if(D(),!u())return;let O=T?.name;if(O!=="AbortError"){if(O==="NotAllowedError")return M();h.speech?B(h.text,h.lang,_,M):_?.()}});return}h.speech?B(h.text,h.lang,_,M):_?.()},"start");return{say(h){let x=h.url!==null?De(h.url):`tts:${h.lang}:${h.text}`;if(x===r)return;r=x,a=o=null,n+=1;let _=n,k=h.onEnd;X(h,_,k!==void 0?()=>{_===n&&k()}:void 0)},unlock({lang:h,speech:x,prefetch:_}){let k=a??(c?null:o);c=!0;let u=k!==null&&k.generation===n?k:null;a=o=null,u!==null&&X(u.utterance,u.generation,u.end);let M=R();if(t===null&&typeof Blob=="function"&&typeof URL.createObjectURL=="function"){let T=Uint8Array.from(atob(jn),O=>O.charCodeAt(0));t=URL.createObjectURL(new Blob([T],{type:"audio/wav"}))}let I=M.paused===!1&&t!==null&&M.src!==t;t!==null&&!I&&(u===null||u.utterance.url===null)&&(M.muted=!0,M.onended=null,M.src=t,M.play()?.catch(()=>{}));let D=oe(),i=u!==null&&u.utterance.url===null;if(x&&!i&&D!==null&&typeof SpeechSynthesisUtterance=="function"){j();let T=new SpeechSynthesisUtterance(" ");T.volume=0,T.lang=h,D.speak(T)}A(_??[])},prefetch:A,stop:q,dispose(){q(),N&&oe()?.removeEventListener?.("voiceschanged",w),N=!1,t!==null&&URL.revokeObjectURL(t),t=null,e!==null&&xt(e),e=null;for(let h of p.values())xt(h);p.clear()}}}l(Hr,"_n");s(Hr,"createVoicePlayer");var On="sekyro.voiceGuidance";function Gr(e){try{if(typeof window>"u")return null;let t=window.localStorage.getItem(e);return t==="1"?!0:t==="0"?!1:null}catch{return null}}l(Gr,"xn");s(Gr,"readVoicePreference");function Kr(e,t){try{if(typeof window>"u")return;window.localStorage.setItem(e,t?"1":"0")}catch{}}l(Kr,"En");s(Kr,"writeVoicePreference");var Ve="capture.tips.summary",Pn=typeof window<"u"?C.useLayoutEffect:C.useEffect,Bn=Object.freeze({});function rt(e,t){let n=new Set,r=[];for(let a of Vr){let o=a===Ve?null:je(e,a,t);o===null||n.has(De(o))||(n.add(De(o)),r.push(o))}return r}l(rt,"ht");s(rt,"resolvedClipUrls");function Zr({locale:e,defaultClips:t,options:n}){let r=n===!1,a=r?{}:n??{},o=a.storageKey===void 0?On:a.storageKey,[c,d]=(0,C.useState)(a.defaultEnabled??!0),S=(0,C.useRef)(c),[p,w]=(0,C.useState)(!1),[N,j]=(0,C.useState)("none"),[R,B]=(0,C.useState)(!1),q=(0,C.useRef)(!1),[A,X]=(0,C.useState)(0),h=(0,C.useRef)(null),x=(0,C.useCallback)(()=>(h.current??(h.current=Hr()),h.current),[]),_=Tn[e],k=a.speechFallback,u=k===void 0||k===!0?!0:k===!1?!1:k.includes(e),M=a.clips??t??Bn,I=(0,C.useRef)(!1),D=(0,C.useRef)(M);Pn(()=>{D.current=M,S.current=c}),(0,C.useEffect)(()=>{if(r||o===null)return;let L=Gr(o);L!==null&&(S.current=L,d(L))},[r,o]),(0,C.useEffect)(()=>{if(!(r||!u))return Fr(()=>X(L=>L+1))},[r,u]);let i=a.clips;(0,C.useEffect)(()=>{if(r)return;let L=u&&$r(_);w(rt(M,e).length>0||L),j(i!==void 0&&je(i,Ve,e)!==null?"partner":je(M,Ve,e)!==null||L?"default":"none")},[r,M,i,e,u,_,A]),(0,C.useEffect)(()=>{if(r||!c||!I.current)return;let L=rt(M,e);L.length>0&&x().prefetch(L)},[r,c,M,e,x]),(0,C.useEffect)(()=>()=>{h.current?.dispose(),h.current=null,I.current=!1},[]);let T=(0,C.useCallback)(L=>{r||(I.current=!0,x().unlock({lang:_,speech:u,...L?{prefetch:rt(D.current,e)}:{}}))},[r,x,_,u,e]),O=(0,C.useCallback)(()=>T(S.current),[T]),z=(0,C.useCallback)(()=>{q.current=!1,B(!1)},[]),$=(0,C.useCallback)(()=>{z(),h.current?.stop()},[z]),ge=(0,C.useCallback)(()=>{q.current&&$()},[$]),he=(0,C.useCallback)((L,xe)=>{if(r)return;if(q.current){$();return}let ve=x();ve.stop(),q.current=!0,B(!0);let V=xe?.clip===!1?null:je(D.current,Ve,e);ve.say({url:V,text:L,lang:_,speech:u,onEnd:z})},[r,$,x,e,_,u,z]),Y=(0,C.useCallback)(L=>{r||(L?T(!0):$(),o!==null&&Kr(o,L),S.current=L,d(L))},[r,T,$,o]),W=(0,C.useCallback)(()=>Y(!S.current),[Y]),ne=(0,C.useCallback)((L,xe)=>{if(r||!c)return;q.current&&z();let ve=je(D.current,L,e);x().say({url:ve,text:xe,lang:_,speech:u})},[r,c,e,x,_,u,z]);return(0,C.useMemo)(()=>({supported:!r&&p,enabled:!r&&c,setEnabled:Y,toggle:W,unlock:O,speakKey:ne,stop:$,summary:r?"none":N,summaryPlaying:R,toggleSummary:he,stopSummary:ge}),[r,p,c,Y,W,O,ne,$,N,R,he,ge])}l(Zr,"vt");s(Zr,"useVoiceGuidance");function zr(e,t,n,r){let{speakKey:a,stop:o,enabled:c}=e,d=(0,C.useRef)(!1);(0,C.useEffect)(()=>{if(!r||!c){d.current&&o(),d.current=!1;return}d.current=!0,st(t)&&t!==Ve&&n!==""&&a(t,n)},[r,c,t,n,a,o])}l(zr,"Ct");s(zr,"useSpeakGuidance");function lt(e){switch(e){case"multiple_faces":return"one_face";case"capture_back_camera":return"front_camera";case"capture_front_camera":return"back_camera";case"capture_not_upright":return"upright";case"media_unreadable":case"clip_too_short":return"recording";case"device_integrity_failed":return"device";default:return"face"}}l(lt,"Pn");s(lt,"retryCoachingOf");var $e={face:{title:"capture.retryCoaching.title",tips:["capture.retryCoaching.light","capture.retryCoaching.eyeLevel","capture.retryCoaching.head"]},one_face:{title:"capture.retryTips.title",tips:["capture.retryOneFace.alone","capture.retryOneFace.screens"]},front_camera:{title:"capture.retryTips.title",tips:["capture.retryFrontCamera.screenSide"]},back_camera:{title:"capture.retryTips.title",tips:["capture.retryBackCamera.backSide","capture.retryBackCamera.circle"]},upright:{title:"capture.retryTips.title",tips:["capture.retryUpright.vertical","capture.retryUpright.untilEnd"]},recording:{title:"capture.retryTips.title",tips:["capture.retryRecording.cameraOn","capture.retryRecording.stay","capture.retryRecording.network"]},device:{title:"capture.retryTips.title",tips:["capture.retryDevice.screenRecording","capture.retryDevice.phone"]}};function Yr({showCoaching:e,coaching:t="face",attemptsText:n,showRetake:r,onRetake:a}){let o=Me(),c=(0,at.useRef)(null);return(0,at.useEffect)(()=>{r&&c.current?.focus()},[r]),!e&&!r?null:(0,fe.jsxs)("div",{className:"sekyro-stack sekyro-stack--3","data-testid":"sekyro-captured-panel",children:[e?(0,fe.jsxs)("div",{className:"sekyro-stack sekyro-stack--1",children:[(0,fe.jsx)("p",{className:"sekyro-text-body",children:o($e[t].title)}),(0,fe.jsx)("ul",{className:"sekyro-coaching",children:$e[t].tips.map(d=>(0,fe.jsx)("li",{children:o(d)},d))}),n!==null?(0,fe.jsx)("p",{className:"sekyro-text-muted","data-testid":"sekyro-attempts-remaining",children:n}):null]}):null,r?(0,fe.jsx)(te,{ref:c,className:"sekyro-btn--start",onClick:a,children:o("capture.recordAgain")}):null]})}l(Yr,"Tn");s(Yr,"CapturedPanel");function Lt(){try{return!1}catch{return!1}}l(Lt,"nt");s(Lt,"isDevBuild");var qn=(0,Wr.createContext)(null);function Jr({state:e}){let t=Me(),[n,r]=(0,ot.useState)(!1);(0,ot.useEffect)(()=>{e!=="unknown"&&r(!0)},[e]);let a=e==="granted"?(0,we.jsx)(Ur,{}):e==="denied"?(0,we.jsx)(Tr,{}):(0,we.jsx)(jr,{});return(0,we.jsxs)("div",{role:n?"status":void 0,className:`sekyro-permission sekyro-permission--${e}`,"data-testid":"sekyro-permission","data-state":e,children:[(0,we.jsx)("span",{className:"sekyro-permission__icon","aria-hidden":"true",children:a}),(0,we.jsx)("span",{children:t(`capture.permission.${e}`)})]})}l(Jr,"On");s(Jr,"PermissionRow");function Qr({voice:e}){let t=Me();if(!e.supported)return null;let n=e.enabled;return(0,Se.jsxs)("button",{type:"button",role:"switch","aria-checked":n,className:"sekyro-switch","data-testid":"sekyro-voice-switch",onClick:l(()=>e.toggle(),"onClick"),children:[(0,Se.jsxs)("span",{className:"sekyro-switch__label",children:[(0,Se.jsx)(nt,{off:!n}),t("capture.voiceGuidance")]}),(0,Se.jsx)("span",{className:"sekyro-switch__track","aria-hidden":"true",children:(0,Se.jsx)("span",{className:"sekyro-switch__thumb",children:n?(0,Se.jsx)(Or,{className:"sekyro-switch__check"}):null})})]})}l(Qr,"Hn");s(Qr,"VoiceSwitch");function Xr({assets:e,onRetryAssets:t,permission:n,captureMode:r="self",voice:a,tips:o,summary:c,startLabel:d,startDisabled:S,onStart:p}){let w=Me(),N=(0,Q.useRef)(c?.stop);N.current=c?.stop,(0,Q.useEffect)(()=>()=>N.current?.(),[]);let j=(0,Q.useRef)(null),R=(0,Q.useRef)(null),B=(0,Q.useRef)(null),q=(0,Q.useRef)(e),A=(0,Q.useRef)(!1);(0,Q.useEffect)(()=>{let u=q.current;if(q.current=e,u===e)return;let M=A.current;e!=="loading"&&(A.current=!1),en(j.current)&&(e==="failed"?B.current?.focus():M&&R.current?.focus())},[e]);let X=(0,Q.useCallback)(()=>{A.current=!0,t()},[t]),h=e==="loading",x=h||S,_=(0,Q.useCallback)(()=>{x||(N.current?.(),p())},[x,p]),k;return e==="failed"?k=(0,P.jsxs)(le,{tone:"danger",testId:"sekyro-assets-error",children:[(0,P.jsx)("p",{className:"sekyro-text-body",children:w("fcv2.err.models")}),(0,P.jsx)(te,{kind:"ghost",ref:B,className:"sekyro-btn--start",onClick:X,"data-testid":"sekyro-assets-retry",children:w("common.retry")})]}):k=(0,P.jsxs)("div",{className:"sekyro-stack sekyro-stack--1",children:[(0,P.jsx)(te,{ref:R,full:!0,"data-testid":"sekyro-start","aria-disabled":x?"true":void 0,"aria-busy":h?"true":void 0,onClick:_,children:h?(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(Pr,{}),w("capture.preparing.title")]}):d??w("capture.start")}),h?(0,P.jsx)("p",{className:"sekyro-text-muted",children:w("capture.preparing.hint")}):null]}),(0,P.jsxs)("div",{ref:j,className:"sekyro-stack sekyro-stack--4","data-testid":"sekyro-intro","data-assets":e,children:[r==="assisted"?(0,P.jsxs)("div",{className:"sekyro-stack sekyro-stack--1","data-testid":"sekyro-assisted-intro",children:[(0,P.jsx)("h2",{className:"sekyro-text-body",children:w("capture.assisted.title")}),(0,P.jsx)("p",{className:"sekyro-text-muted",children:w("capture.assisted.lead")})]}):null,o!==!1?(0,P.jsx)(Br,{tips:o}):null,c!==void 0?(0,P.jsxs)(te,{kind:"ghost",className:"sekyro-btn--start",onClick:c.toggle,"data-testid":"sekyro-tips-listen",children:[(0,P.jsx)(nt,{off:!1}),w(c.playing?"capture.tips.stop":"capture.tips.listen")]}):null,(0,P.jsx)(Jr,{state:n}),(0,P.jsx)(Qr,{voice:a}),(0,P.jsx)("p",{className:"sekyro-text-muted",children:w("capture.securityNote")}),k,(0,P.jsx)("p",{role:"status",className:"sekyro-visually-hidden","data-testid":"sekyro-intro-status",children:e==="loading"?w("capture.preparing.title"):e==="ready"?w("capture.ready"):""})]})}l(Xr,"Fn");s(Xr,"PreCaptureScreen");function en(e){if(typeof document>"u")return!1;let t=document.activeElement;return t===null||t===document.body||e!==null&&e.contains(t)}l(en,"Ur");s(en,"focusIsOurs");function tn(){let[e,t]=(0,it.useState)({state:"unknown",settled:!1});return(0,it.useEffect)(()=>or(n=>t({state:n,settled:!0})),[]),{permission:e.state,permissionSettled:e.settled}}l(tn,"Dn");s(tn,"useCameraStatus");function rn(e){return It(e,"mobileRequired")}l(rn,"qn");s(rn,"useMobileRequired");function nn(e){return It(e,"returning").required}l(nn,"jn");s(nn,"useReturning");function It(e,t){let[n,r]=(0,pe.useState)({required:!1,settled:e===void 0});return(0,pe.useEffect)(()=>{let a=e?.[t];if(e===void 0||typeof a!="function"){r({required:!1,settled:!0});return}let o=!0;return r({required:!1,settled:!1}),Promise.resolve().then(()=>a.call(e)).then(c=>{o&&r({required:c===!0,settled:!0})},()=>{o&&r({required:!1,settled:!0})}),()=>{o=!1}},[e,t]),n}l(It,"Yn");s(It,"useFlag");function sn(e){let t=s(()=>e?.captureChoice??null,"initialChoice"),[n,r]=(0,pe.useState)(()=>({session:"self",choice:t(),settled:e===void 0}));(0,pe.useEffect)(()=>{let o=e?.captureMode,c=e?.captureChoice??null;if(e===void 0||typeof o!="function"){r({session:"self",choice:c,settled:!0});return}let d=!0;return r({session:"self",choice:c,settled:!1}),Promise.resolve().then(()=>o.call(e)).then(S=>{let p=e.captureChoice??null;d&&r({session:p!==null&&S===p?"choice":S==="assisted"||S==="choice"?S:"self",choice:p,settled:!0})},()=>{d&&r({session:"self",choice:null,settled:!0})}),()=>{d=!1}},[e]);let a=(0,pe.useCallback)(o=>{e?.chooseCaptureMode?.(o),r(c=>({...c,choice:o}))},[e]);return{mode:n.session==="choice"?n.choice??"self":n.session==="assisted"?"assisted":"self",session:n.session,choice:n.choice,settled:n.settled,choose:a}}l(sn,"$n");s(sn,"useCaptureMode");function an(e){let[t,n]=(0,pe.useState)(!1);return(0,pe.useEffect)(()=>{if(n(!1),e===void 0)return;let r=e.on("busy",()=>n(!0)),a=e.on("result",()=>n(!1));return()=>{r(),a()}},[e]),t}l(an,"zn");s(an,"useBusy");var Vn=s(()=>"idle","serverSnapshot");function Nt(e){return ir(e!==void 0?{assetBaseUrl:e}:{})}l(Nt,"Qn");s(Nt,"preload");function ln(e,t=!0){let n=(0,J.useSyncExternalStore)((0,J.useCallback)(p=>ur(p,e),[e]),()=>cr(e),Vn),[r,a]=(0,J.useState)(null),o=(0,J.useRef)(!1),c=(0,J.useCallback)(()=>{Nt(e).then(p=>{o.current&&p==="idle"&&a({base:e})})},[e]);(0,J.useEffect)(()=>(o.current=!0,c(),()=>{o.current=!1}),[c]);let d=(0,J.useRef)(null);(0,J.useEffect)(()=>{if(n!=="idle"){d.current={base:e};return}!t||d.current===null||d.current.base!==e||(d.current=null,c())},[n,e,c,t]);let S=(0,J.useCallback)(()=>{Nt(e)},[e]);return{gate:r!==null&&r.base===e&&n==="idle"||n==="ready"?"ready":n==="failed"?"failed":"loading",retry:S}}l(ln,"Jn");s(ln,"useLivenessAssets");var Rr={progress:0,hint:null,faceDetected:!1};function on(e){let{videoRef:t,assetBaseUrl:n}=e,r=(0,E.useRef)(e.verification).current,a=(0,E.useRef)(!1);e.verification!==r&&!a.current&&Lt()&&(a.current=!0,console.warn("[@sekyro/react] <LivenessCapture>: the `verification` prop changed identity after mount. The first instance stays bound (the camera is not rebuilt); create the verification once (useMemo / useState / outside render) instead of on every render."));let o=(0,E.useRef)(null),[c,d]=(0,E.useState)("idle"),[S,p]=(0,E.useState)(Rr),[w,N]=(0,E.useState)(!1),[j,R]=(0,E.useState)(!1),[B,q]=(0,E.useState)(null),[A,X]=(0,E.useState)(!1),[h,x]=(0,E.useState)(null),[_,k]=(0,E.useState)(null),[u,M]=(0,E.useState)(null),[I,D]=(0,E.useState)(null),[i,T]=(0,E.useState)(null),[O,z]=(0,E.useState)(!1),$=(0,E.useRef)(null),ge=(0,E.useRef)("idle"),he=(0,E.useRef)(-1),[Y,W]=(0,E.useState)(0),ne=(0,E.useRef)(e);ne.current=e,(0,E.useEffect)(()=>{let ee=t.current;if(ee===null)return;let ce={video:ee,...n!==void 0?{assetBaseUrl:n}:{}},H=r!==void 0?r.liveness(ce):dr(ce);o.current=H;let Ne=s(()=>T(H.facingMode??null),"readFacing");Ne();let Fe=[H.on("state",b=>{b==="mode_switch"?z(!0):b!=="starting"&&b!=="gating"&&z(!1),b==="starting"?(ge.current!=="starting"&&(he.current+=1,W(Math.max(0,he.current))),k(null),M(null),p(Rr),R(!1),N(!1),q(null),x(null),$.current=null):b==="gating"&&ge.current==="recording"&&(R(!1),N(!1),q(null),$.current=null),ge.current=b,Ne(),d(b),ne.current.onStateChange?.(b)}),H.on("gate",b=>{let ke=$.current;$.current=b.progress,N(ke!==null&&b.progress<ke-.001&&b.progress>0&&b.progress<1),b.progress>=1&&R(!0),p(b)}),H.on("frozen",({previewDataUrl:b})=>q(b)),H.on("profile",({animations:b})=>X(b==="reduced")),H.on("ramp",({colour:b})=>x(b)),H.on("captured",b=>{k(b),D(null),ne.current.onCaptured?.(b)}),H.on("error",b=>{M(b);let ke=r?.reportCaptureIssue;ke!==void 0&&Ct(Le=>ke.call(r,Le),xr("liveness",b,Math.max(0,he.current))),ne.current.onError?.(b)}),r?.on("result",b=>{D(b),ne.current.onResult?.(b)})];return()=>{for(let b of Fe)b?.();o.current=null,H.destroy()}},[r,t,n]);let L=(0,E.useCallback)(()=>{o.current?.start()},[]),xe=(0,E.useCallback)(()=>{o.current?.retry()},[]),ve=(0,E.useCallback)(async()=>{let ee=o.current;return ee===null||typeof ee.canSwitchCaptureMode!="function"?!1:await ee.canSwitchCaptureMode().catch(()=>!1)===!0},[]),V=(0,E.useCallback)(async ee=>{let ce=o.current;if(ce===null||typeof ce.setCaptureMode!="function")return!1;let H=await ce.setCaptureMode(ee).catch(()=>!1)===!0;return H&&T(ce.facingMode??null),H},[]);return{state:c,gate:S,draining:w,gateLocked:j,frozenPreview:B,reduceMotion:A,rampColour:h,artifacts:_,error:u,result:I,facingMode:i,start:L,retry:xe,canSwitchCaptureMode:ve,setCaptureMode:V,modeRestarted:O,attempt:Y}}l(on,"er");s(on,"useLivenessHandle");var Dn=new Set(["national_number"]);function Rt(e){if(e==null||!e.available||e.selected!==null)return null;let t=e.options.filter(n=>Dn.has(n));return t.length>0?{...e,options:t}:null}l(Rt,"tr");s(Rt,"pending");function cn(e){let[t,n]=(0,me.useState)(null),[r,a]=(0,me.useState)(e===void 0),[o,c]=(0,me.useState)(!1),[d,S]=(0,me.useState)(!1);(0,me.useEffect)(()=>{if(n(null),e===void 0){a(!0);return}let N=!0,j=e.methodChoice;typeof j=="function"?(a(!1),Promise.resolve().then(()=>j.call(e)).then(B=>{N&&n(Rt(B))},()=>{}).finally(()=>{N&&a(!0)})):a(!0);let R=e.on("method",B=>n(Rt(B)));return()=>{N=!1,R()}},[e]);let p=(0,me.useCallback)(async N=>{if(e===void 0)return!1;c(!0),S(!1);try{return await e.selectMethod(N),n(null),!0}catch{return S(!0),!1}finally{c(!1)}},[e]),w=t!==null&&t.options.length===1?t.options[0]:null;return{choice:t,auto:w==="national_number"&&!d?w:null,settled:r,busy:o,failed:d,select:p}}l(cn,"nr");s(cn,"useMethodChoice");var $n=["ar","fr","en"];function un(e){if(typeof e!="string")return!1;try{let t=new URL(e);return t.protocol==="https:"||t.protocol==="http:"&&/^(localhost|127\.0\.0\.1)$/.test(t.hostname)}catch{return!1}}l(un,"so");s(un,"isClipUrl");function dn(e){let t=e.clips;if(typeof t!="object"||t===null)return null;let n={};for(let r of $n){let a=t[r];if(!(typeof a!="object"||a===null))for(let[o,c]of Object.entries(a))!st(o)||!un(c)||((n[r]??(n[r]={}))[o]=c)}return Object.keys(n).length>0?n:null}l(dn,"io");s(dn,"toVoiceClipMap");function pn(e){let[t,n]=(0,Te.useState)(null);(0,Te.useEffect)(()=>{if(n(null),e===void 0)return;let a=!0,o=s(d=>{if(!a)return;let S=typeof d=="object"&&d!==null&&typeof d.setId=="string"?d:null;n(p=>p?.setId===S?.setId?p:S)},"take");try{typeof e.voiceClips=="function"&&Promise.resolve(e.voiceClips()).then(o,()=>o(null))}catch{o(null)}let c=e.on("view",d=>o(d.voice));return()=>{a=!1,c()}},[e]);let r=(0,Te.useMemo)(()=>t!==null?dn(t):null,[t]);return e===void 0?null:r}l(pn,"rr");s(pn,"useServerVoiceClips");function hn({voice:e}){let t=Me();return(0,At.jsx)(te,{kind:"chip","aria-pressed":e.enabled,"aria-label":t("capture.voiceGuidance"),"data-testid":"sekyro-voice-toggle",onClick:l(()=>e.toggle(),"onClick"),children:(0,At.jsx)(nt,{off:!e.enabled,className:"sekyro-icon"})})}l(hn,"sr");s(hn,"VoiceChip");var Fn=new Set(["abandoned","not_opened","cancelled","superseded"]),Hn=800,Gn="capture.lookAtColours";function fn(e){return e===void 0||e!==!1&&e.length===wt.length&&wt.every(t=>e.includes(t))}l(fn,"fo");s(fn,"isDefaultTips");function mn(e){if(e.type==="keydown"&&e.key==="Escape")return!1;let t=globalThis.navigator?.userActivation;return t===void 0?!(e.type==="pointerup"&&e.pointerType==="touch"):t.isActive}l(mn,"mo");s(mn,"carriesActivation");function yn(e){return typeof e=="object"&&e!==null&&!(0,m.isValidElement)(e)&&"tone"in e&&"text"in e}l(yn,"yo");s(yn,"isNoticeObject");var Kn=new Set(["nni_unbound","id_number_unbound","method_required","mobile_required","portrait_required"]);function gn(e){return e==="starting"||e==="gating"||e==="recording"||e==="mode_switch"}l(gn,"ho");s(gn,"isCapturing");function vn(e){return e==="captured"||e==="uploading"||e==="checking"}l(vn,"vo");s(vn,"isPostCapture");function Zn({verification:e,locale:t,dir:n,strings:r,slots:a,autoStart:o=!1,notice:c,startDisabled:d=!1,startLabel:S,tips:p,tipsSummary:w,coach:N,voice:j,onGuidance:R,onCaptured:B,onResult:q,onError:A,onStateChange:X,assetBaseUrl:h,className:x}){let _=gr(t),k=(0,m.useMemo)(()=>yr(t,r),[t,r,_]),u=(0,m.useMemo)(()=>g=>k[g]??"",[k]),M=n??(t==="ar"?"rtl":"ltr"),I=(0,m.useRef)(null),D=(0,m.useContext)(qn),i=on({verification:e,videoRef:I,assetBaseUrl:h,onCaptured:B,onResult:q,onError:A,onStateChange:X}),T=ln(h,i.state==="idle"&&i.error===null),O=cn(e),z=O.choice!==null,$=rn(e),ge=nn(e),he=an(e),Y=tn(),W=sn(e),ne=W.session==="choice",L=W.mode==="assisted",xe=j!==!1&&j?.clips===void 0,ve=pn(xe?e:void 0),V=Zr({locale:t,defaultClips:ve,options:j}),ee=L?"environment":"user",ce=W.settled,H=(0,m.useRef)(null),Ne=(0,m.useRef)(!1),Fe=(0,m.useRef)(V.unlock);Fe.current=V.unlock,(0,m.useEffect)(()=>{let g=H.current;if(g===null)return;let ae=["pointerup","touchend","click","keydown"],_e=s(()=>{for(let qe of ae)g.removeEventListener(qe,Ae,!0)},"disarm");function Ae(qe){if(Ne.current){_e();return}mn(qe)&&(Ne.current=!0,_e(),Fe.current())}l(Ae,"Re"),s(Ae,"onGesture");for(let qe of ae)g.addEventListener(qe,Ae,{capture:!0,passive:!0});return _e},[]);let b=(0,m.useCallback)(()=>{Ne.current||(Ne.current=!0,V.unlock()),i.start()},[V.unlock,i.start]),ke=(0,m.useCallback)(()=>i.start(),[i.start]),Le=(0,m.useRef)(!1),Oe=i.state==="idle"&&i.error===null,jt=!z&&!$.required&&(o===!0||o==="when-permitted"&&Y.permission==="granted"),Tt=jt&&O.settled&&$.settled&&ce,Cn=o==="when-permitted"&&!Y.permissionSettled&&!Le.current,Ot=jt&&Oe&&!Le.current,ut=(Cn||Ot||!ce)&&T.gate==="ready"?"loading":T.gate;(0,m.useEffect)(()=>{!Tt||!Oe||T.gate!=="ready"||Le.current||(Le.current=!0,ke())},[Tt,Oe,T.gate,ke]);let _n=Oe&&!z&&!$.required&&!(Ot&&T.gate==="ready"),[Pt,Bt]=(0,m.useState)(!1),{canSwitchCaptureMode:qt,setCaptureMode:Vt}=i;(0,m.useEffect)(()=>{if(!W.settled||!ne){Bt(!1);return}let g=!0;return qt().then(ae=>{g&&Bt(ae)}),()=>{g=!1}},[W.settled,ne,qt]);let{choose:Dt}=W,Ie=L?"self":"assisted",wn=(0,m.useCallback)(async()=>{await Vt(Ie)&&Dt(Ie)},[Vt,Dt,Ie]),$t=i.state!=="idle"&&i.facingMode!==null?i.facingMode:ee;(0,m.useEffect)(()=>{let g=I.current?.style;$t==="user"?g?.removeProperty("transform"):g&&(g.transform="none")},[$t]);let He=(0,m.useMemo)(()=>i.artifacts!==null&&typeof URL.createObjectURL=="function"?URL.createObjectURL(i.artifacts.keyframe):null,[i.artifacts]);(0,m.useEffect)(()=>{if(He!==null)return()=>URL.revokeObjectURL(He)},[He]);let Ft=i.frozenPreview??He,Ue=e!==void 0,Z=gn(i.state),be=vn(i.state),Ge=Z||be,se=i.result,Ht=i.state==="done"&&se!==null,Ke=Z&&i.rampColour!==null,dt=i.state==="recording"&&i.frozenPreview!==null&&!Ke,Ze=D!==null,Gt=Pt&&Z&&!dt?{to:Ie,label:u(Ie==="assisted"?"capture.modeSwitch.toAssisted":"capture.modeSwitch.toSelf"),description:u(Ie==="assisted"?"capture.modeSwitch.toAssistedLabel":"capture.modeSwitch.toSelfLabel"),onSwitch:s(()=>{wn()},"onSwitch")}:null,ze=i.modeRestarted&&Z?u("capture.modeSwitch.restarted"):null,Pe=be||dt,Kt=be?"checking":dt?"frozen":i.state==="recording"||Ke?"recording":i.gateLocked||i.gate.progress>=1?"locked":i.gate.faceDetected?"aligning":"seeking",Ye=Z?i.gate.hint:null,We=i.state==="starting"?"capture.preparing.title":Ye===null?null:Ye==="center"&&!i.gate.faceDetected?"fcv3.no_face":pr(Ye),[Sn,Zt]=(0,m.useState)(null);(0,m.useEffect)(()=>{if(We!=="fcv3.no_face"){Zt(We);return}if(!Z)return;let g=setTimeout(()=>Zt(We),Hn);return()=>clearTimeout(g)},[We,Z]);let pt=Z&&!Ke&&typeof N=="string"&&N!=="",zt=L&&Z?u("capture.assisted.stage"):null,Re=Z&&!pt?Ke?Gn:Sn:null,ht=pt?N:Re===null?"":u(Re);zr(V,Re,ht,Z);let Yt=(0,m.useRef)(R);Yt.current=R,(0,m.useEffect)(()=>{if(st(Re))try{Yt.current?.(Re)}catch(g){console.error("[@sekyro/react] onGuidance threw:",g)}},[Re]);let Be=(0,m.useMemo)(()=>({supported:V.supported,enabled:V.enabled,setEnabled:V.setEnabled,toggle:V.toggle}),[V.supported,V.enabled,V.setEnabled,V.toggle]),ft=a?.voicePrompt,Wt=ft!==void 0,Jt=j===void 0,Qt=(0,m.useRef)(!1);(0,m.useEffect)(()=>{!Wt||!Jt||Qt.current||!Lt()||(Qt.current=!0,console.warn("[@sekyro/react] <LivenessCapture>: `slots.voicePrompt` is set and `voice` is undefined, so the component speaks the guidance itself. If your slot plays audio, pass voice={false} or the person hears every hint twice; pass voice={{}} to keep the built-in voice and silence this warning."))},[Wt,Jt]);let xn=ft!==void 0?(g,ae,_e)=>ft(g,ae,_e,Be):V.supported?()=>(0,v.jsx)(hn,{voice:Be}):void 0,{summary:mt,summaryPlaying:Xt,toggleSummary:er,stopSummary:tr}=V,Je=w!==void 0&&w!=="",rr=Je?w:u("capture.tips.summary"),nr=Je?mt!=="none":mt==="partner"||mt==="default"&&fn(p),Nn=(0,m.useMemo)(()=>nr?{playing:Xt,toggle:s(()=>er(rr,{clip:!Je}),"toggle"),stop:tr}:void 0,[nr,Xt,er,rr,tr,Je]),Rn=(0,m.useMemo)(()=>({assets:ut,retryAssets:T.retry,permission:Y.permission,permissionSettled:Y.permissionSettled,captureMode:W.mode,facing:ee,voice:Be}),[ut,T.retry,Y.permission,Y.permissionSettled,W.mode,ee,Be]),An=yn(c)?(0,v.jsx)(le,{tone:c.tone,testId:"sekyro-host-notice",children:(0,v.jsx)("span",{children:c.text})}):c??null,ue=se!==null&&se.status==="retry"?se:null,G=Ht&&se.status==="unavailable"&&!z&&se.reasonCode!=="portrait_required"?se:null,Ce=Ht&&(se.status==="verified"||se.status==="not_verified"||se.status==="review")?se:null,yt=s((g,ae)=>{if(g===void 0)return null;if(g==="device_cooldown"){let Ae=fr(t,ae);if(Ae!==null)return u(Ae.key).replace("{time}",Ae.time)}let _e=et(g);return _e===null?null:u(_e)},"reasonText"),gt=s(g=>{let ae=g.retakeHint===void 0?null:Xe(g.retakeHint);return ae===null?yt(g.reasonCode):u(ae)},"retryText"),sr=Ce===null?null:yt(Ce.reasonCode,Ce.retryAfter)??(Ce.status==="not_verified"&&Ce.reason!==void 0&&Fn.has(Ce.reason)?u("errors.session_expired"):null),Mn=G!==null&&G.reasonCode!==void 0&&G.reasonCode!=="nni_unbound"&&G.reasonCode!=="id_number_unbound"&&G.reasonCode!=="method_required"&&G.reasonCode!=="mobile_required"&&!(G.reasonCode==="no_recorder"&&i.artifacts?.degraded==="NO_RECORDER"),Qe=G?.reasonCode,ar=i.attempt;(0,m.useEffect)(()=>{G===null||Qe===void 0||e?.reportCaptureIssue===void 0||Kn.has(Qe)||Ct(g=>e.reportCaptureIssue?.(g),{check:"liveness",kind:"unavailable",phase:"upload",engineKind:Qe,attempt:Math.min(1e3,ar)})},[G,Qe,ar,e]);let lr=bt(),En=z&&O.auto===null&&!Z&&!be&&i.error===null,vt=(0,m.useCallback)(async g=>{await O.select(g)&&i.state==="done"&&i.retry()},[O.select,i.state,i.retry]);return(0,m.useEffect)(()=>{O.auto!==null&&!O.busy&&!Z&&!be&&vt(O.auto)},[O.auto,O.busy,Z,be,vt]),(0,v.jsx)(vr,{value:u,children:(0,v.jsxs)("div",{ref:H,className:x===void 0?"sekyro-capture":`sekyro-capture ${x}`,dir:M,lang:t,"data-testid":"sekyro-liveness-capture","data-state":i.state,children:[a?.header,ue!==null&>(ue)!==null&&!(Ze&&Ge)?(0,v.jsx)(le,{tone:"warning",role:"status",testId:"sekyro-retry-notice",children:(0,v.jsx)("span",{children:gt(ue)})}):null,ze!==null&&!Ze?(0,v.jsx)(le,{tone:"info",role:"status",testId:"sekyro-mode-switch-status",children:(0,v.jsx)("span",{children:ze})}):null,he&&be&&!Ze?(0,v.jsx)(le,{tone:"info",role:"status",testId:"sekyro-busy-notice",children:(0,v.jsx)("span",{children:u("capture.busy")})}):null,$.required&&Oe?(0,v.jsx)(le,{tone:"info",role:"status",testId:"sekyro-mobile-required",children:(0,v.jsx)("span",{children:u("reasons.mobile_required")})}):null,i.error!==null?a?.errorPanel!==void 0?a.errorPanel(i.error,i.retry):(0,v.jsxs)(le,{tone:"danger",testId:"sekyro-error-notice",children:[(0,v.jsx)("span",{children:u(hr(i.error))}),i.error.retryable?(0,v.jsx)(te,{ref:lr,kind:"ghost",className:"sekyro-btn--start",onClick:i.retry,children:u("common.retry")}):null]}):null,G!==null?(0,v.jsxs)(le,{tone:"danger",testId:"sekyro-unavailable-notice",children:[(0,v.jsx)("span",{children:(G.reasonCode==="attestation"&&G.attestationError==="clock_wrong"?u("errors.device_clock"):yt(G.reasonCode))??u(G.reasonCode===void 0?"errors.session_expired":"errors.network_error")}),Mn?(0,v.jsx)(te,{ref:lr,kind:"ghost",className:"sekyro-btn--start",onClick:i.retry,children:u(G.reasonCode==="attestation"?"common.retry":"capture.recordAgain")}):null]}):null,sr!==null&&Ce!==null?(0,v.jsx)(le,{tone:Ce.status==="not_verified"?"danger":"info",testId:"sekyro-result-notice",children:(0,v.jsx)("span",{children:sr})}):null,(0,v.jsx)("div",{className:Ge?void 0:"sekyro-hidden","data-capture-live":Ge?"":void 0,children:Ze?D({videoRef:I,guidance:Pe&&Ue?u("capture.checking"):ht,coached:pt&&!(Pe&&Ue),note:Pe?Ue?u(he?"capture.busy":"capture.checkingHint"):null:ze??(ue!==null?gt(ue):zt),settled:Pe&&Ue,progress:i.gate.progress,phase:Kt,still:Pe?Ft:null,live:Ge,modeSwitch:Gt,...Pt?{status:ze}:{},ramp:i.rampColour===null?null:{colour:i.rampColour}}):(0,v.jsx)(kr,{videoRef:I,guidanceText:ht,guidanceHint:Ye,guidanceKey:Re,progress:i.gate.progress,phase:Kt,draining:i.draining,stillUrl:Ft,showChecking:Ue,operatorText:zt,voicePrompt:xn,overlay:l(g=>(0,v.jsxs)(v.Fragment,{children:[a?.stageOverlay?.(g),(0,v.jsx)(br,{colour:i.rampColour})]}),"overlay"),reduceMotion:i.reduceMotion,modeSwitch:Gt})}),En&&O.choice!==null?(0,v.jsx)(qr,{title:u("method.title"),description:u("method.description"),options:O.choice.options.map(g=>({id:g,label:u(`method.${g}`)})),busy:O.busy,error:O.failed?u("errors.network_error"):null,focus:i.state==="done",testId:"sekyro-method",look:"buttons",onChoose:l(g=>{vt(g)},"onChoose")}):null,_n?(0,v.jsxs)(v.Fragment,{children:[ge&&a?.header===void 0&&a?.intro===void 0?(0,v.jsxs)("div",{className:"sekyro-stack sekyro-stack--1",children:[(0,v.jsx)("h2",{className:"sekyro-text-body",children:u("returning.title")}),(0,v.jsx)("p",{className:"sekyro-text-muted",children:u("returning.description")})]}):null,An,a?.intro!==void 0?a.intro(b,Rn):(0,v.jsx)(Xr,{assets:ut,onRetryAssets:T.retry,permission:Y.permission,captureMode:W.mode,voice:Be,tips:p??wt,summary:Nn,startLabel:S,startDisabled:d,onStart:b})]}):null,(0,v.jsx)(Yr,{showCoaching:ue!==null,coaching:lt(ue?.reasonCode),attemptsText:ue?.attemptsRemaining!==void 0?mr(k,t,ue.attemptsRemaining):null,showRetake:ue!==null&&!Z&&!be||!Ue&&i.state==="captured",onRetake:i.retry}),a?.footer]})})}l(Zn,"xi");s(Zn,"LivenessCapture");var Ut=U(K(),1),ct=U(K(),1),f=U(de(),1);var Cs={document:"card",population_registry:"id",national_eid:"smartphone",phone_otp:"phone",email_otp:"email"};function zn(e,t){switch(e.service){case"document":return t.t("method.document_photo");case"population_registry":return t.t("method.national_number");case"national_eid":{let n=e.nationalEid?.providerName;return n?t.t("method.national_eid",{provider:n}):t.t("method.national_eidGeneric")}default:return null}}l(zn,"Y");s(zn,"identityLabel");function Yn(e,t){let[n,r]=(0,Ut.useState)(!1),[a,o]=(0,Ut.useState)(null);return{busy:n,error:a,run:s(c=>{r(!0),o(null),c().then(()=>r(!1),d=>{r(!1),o(e.t(Nr(d,e.strings))),t?.(d)})},"run")}}l(Yn,"q");s(Yn,"useChoiceAction");function kn(){let e=`sekyro-face-light-${(0,ct.useId)().replace(/[^A-Za-z0-9_-]/g,"")}`;return(0,f.jsxs)("svg",{className:"sekyro-mark sekyro-mark--face",viewBox:"0 0 168 206","aria-hidden":"true",focusable:"false",children:[(0,f.jsx)("defs",{children:(0,f.jsx)("mask",{id:e,children:(0,f.jsx)("ellipse",{className:"sekyro-mark__arc",cx:"84",cy:"103",rx:"76",ry:"95",pathLength:"1",fill:"none",stroke:"#fff",strokeWidth:"16"})})}),(0,f.jsx)("ellipse",{cx:"84",cy:"103",rx:"64",ry:"83",fill:"none",className:"sekyro-mark__line"}),(0,f.jsx)("path",{className:"sekyro-mark__face",d:"M68 64v10M100 64v10M84 66v25q0 2-6 1M60 108q24 18 48 0"}),(0,f.jsx)("ellipse",{className:"sekyro-mark__ticks",cx:"84",cy:"103",rx:"76",ry:"95",pathLength:"56"}),(0,f.jsx)("ellipse",{className:"sekyro-mark__ticks sekyro-mark__ticks--light",cx:"84",cy:"103",rx:"76",ry:"95",pathLength:"56",mask:`url(#${e})`})]})}l(kn,"O");s(kn,"FaceMark");var Wn={glasses:"jGlasses",lighting:"light",faceCamera:"camera"};function Jn(e){if(!(e?.kind!=="liveness"||e.reason===void 0))return{reason:e.reason,...e.retakeHint!==void 0?{retakeHint:e.retakeHint}:{},attemptsRemaining:e.attemptsRemaining??0,attemptsExhausted:e.attemptsExhausted===!0}}l(Jn,"te");s(Jn,"faceIntroRetryOf");var Qn={"capture.retryFrontCamera.screenSide":"camera","capture.retryBackCamera.backSide":"camera","capture.retryUpright.vertical":"smartphone","capture.retryUpright.untilEnd":"smartphone","capture.retryRecording.cameraOn":"camera","capture.retryRecording.stay":"smartphone","capture.retryRecording.network":"smartphone","capture.retryDevice.screenRecording":"smartphone","capture.retryDevice.phone":"smartphone"};function Xn({start:e,context:t,tips:n,tipsTitle:r,human:a=!1,returning:o=!1,notice:c,retry:d}){let S=_t(),{t:p}=S,w=d===void 0?"face":lt(d.reason),N=w==="face"?null:$e[w].tips,j=(0,ct.useContext)(_r)?.busy===!0;return(0,f.jsxs)("section",{className:"sekyro-step",children:[(0,f.jsx)(kn,{}),t.captureMode==="assisted"?(0,f.jsx)(tt,{title:p("capture.assisted.heading"),lead:p("capture.assisted.lead")}):o?(0,f.jsx)(tt,{title:p("returning.heading"),lead:p("returning.description")}):(0,f.jsx)(tt,{title:p(a?"native.face.humanIntroTitle":"native.face.introTitle"),lead:p(a?"native.face.humanIntroLead":"native.face.introLead")}),d!==void 0?(0,f.jsx)(bn,{retry:d,title:$e[w].title}):null,r!==void 0&&N===null?(0,f.jsx)("p",{className:"sekyro-section-label",children:r}):null,(0,f.jsx)("ul",{className:"sekyro-tiprows",children:N!==null?N.map(R=>(0,f.jsxs)("li",{children:[(0,f.jsx)(Ee,{name:Qn[R]??"face"}),p(R)]},R)):n!==void 0?n.map(R=>(0,f.jsxs)("li",{children:[(0,f.jsx)(Ee,{name:Wn[R.id]??"face"}),R.text]},R.id)):(0,f.jsxs)(f.Fragment,{children:[(0,f.jsxs)("li",{children:[(0,f.jsx)(Ee,{name:"light"}),p("capture.tips.light")]}),(0,f.jsxs)("li",{children:[(0,f.jsx)(Ee,{name:"jGlasses"}),p("capture.tips.uncover")]}),(0,f.jsxs)("li",{children:[(0,f.jsx)(Ee,{name:"smartphone"}),p("capture.tips.eyeLevel")]})]})}),c??null,c!==void 0?null:t.assets==="failed"?(0,f.jsx)(te,{kind:"secondary",full:!0,onClick:t.retryAssets,children:p("common.retry")}):null,c!==void 0?null:(0,f.jsx)(Cr,{children:(0,f.jsxs)(te,{full:!0,disabled:t.assets!=="ready"||j,"aria-busy":t.assets==="loading"||void 0,onClick:e,children:[(0,f.jsx)(Ee,{name:"camera"}),p("capture.start")]})})]})}l(Xn,"ne");s(Xn,"FaceIntro");var es=new Set(["match_inconclusive","no_face_source","below_threshold"]);function bn({retry:e,title:t}){let n=_t(),r=e.retakeHint===void 0?null:Xe(e.retakeHint),a=e.reason==="probe_not_from_liveness"?"capture.retrySamePerson.message":es.has(e.reason)?"capture.retryMatch.message":et(e.reason);return(0,f.jsxs)(wr,{tone:"warning",children:[r!==null?(0,f.jsx)("span",{children:n.t(r)}):a!==null?(0,f.jsx)("span",{children:n.t(a)}):null,r===null?(0,f.jsx)("span",{children:n.t(t)}):null,(0,f.jsx)("span",{children:Sr(n,e.attemptsRemaining,e.attemptsExhausted)})]})}l(bn,"T");s(bn,"RetryNotice");function ts(e){return kt(e)}l(ts,"se");s(ts,"isInAppBrowser");function rs(e,t){let n=t??(typeof navigator>"u"?"":String(navigator.userAgent??""));if(!/Android/i.test(n))return null;let r;try{r=new URL(e)}catch{return null}if(r.protocol!=="https:"&&r.protocol!=="http:")return null;let a=r.protocol.slice(0,-1);return`intent://${r.host}${r.pathname}${r.search}#Intent;scheme=${a};action=android.intent.action.VIEW;S.browser_fallback_url=${encodeURIComponent(e)};end`}l(rs,"ce");s(rs,"androidBrowserIntent");export{qr as a,Lt as b,qn as c,sn as d,Zn as e,Cs as f,zn as g,Yn as h,Jn as i,Xn as j,ts as k,rs as l};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as o}from"./chunk-4FHWXBOB.js";var z=Object.freeze({minLines:4,fillMin:.55,fillMax:.98,offsetMax:.12,steadyFillDelta:.04,steadyOffsetDelta:.03,layoutShiftMax:.025,lineCountDelta:1,lockMs:600,steadyMs:900,minFrames:3});function _(h,t){let e=h.lineBoxes;if(e.length===0)return{lineCount:0,detected:!1,fill:0,offsetX:0,offsetY:0,centers:[]};let l=Math.min(...e.map(s=>s[0])),i=Math.max(...e.map(s=>s[0]+s[2])),a=Math.min(...e.map(s=>s[1])),r=Math.max(...e.map(s=>s[1]+s[3]));return{lineCount:e.length,detected:e.length>=t.minLines,fill:i-l,offsetX:(l+i)/2-.5,offsetY:(a+r)/2-.5,centers:e.map(s=>[s[0]+s[2]/2,s[1]+s[3]/2])}}o(_,"M");function P(h,t){if(h.centers.length===0||t.centers.length===0)return Number.POSITIVE_INFINITY;let e=0;for(let[l,i]of t.centers){let a=Number.POSITIVE_INFINITY;for(let[r,s]of h.centers)a=Math.min(a,Math.hypot(l-r,i-s));e+=a}return e/t.centers.length}o(P,"p");var b,O=(b=class{constructor(t=z){this.t=t,this.last=null,this.goodSince=null,this.steadySince=null,this.frames=0}offer(t,e,l={glareOk:!0,sharpOk:!0}){let i=this.t,a=_(t,i),r=this.last;this.last=a;let s=a.fill>=i.fillMin&&a.fill<=i.fillMax,n=Math.abs(a.offsetX)<=i.offsetMax&&Math.abs(a.offsetY)<=i.offsetMax,c=r!==null&&r.detected&&Math.abs(a.lineCount-r.lineCount)<=i.lineCountDelta&&P(r,a)<=i.layoutShiftMax,m=a.detected&&l.glareOk&&l.sharpOk&&s&&c&&r!==null&&Math.abs(a.fill-r.fill)<=i.steadyFillDelta&&Math.abs(a.offsetX-r.offsetX)<=i.steadyOffsetDelta&&Math.abs(a.offsetY-r.offsetY)<=i.steadyOffsetDelta,g=m&&n,u=a.detected?l.glareOk?a.fill<i.fillMin?"closer":a.fill>i.fillMax?"farther":n?l.sharpOk?void 0:"blurry":"center":"glare":void 0;return m?(this.frames++,this.steadySince??(this.steadySince=e),this.goodSince=g?this.goodSince??e:null,(this.goodSince!==null&&e-this.goodSince>=i.lockMs||e-this.steadySince>=i.steadyMs)&&this.frames>=i.minFrames?{state:"locked"}:{state:"locking",...u?{hint:u}:{}}):(this.goodSince=null,this.steadySince=null,this.frames=a.detected?1:0,{state:a.detected?"locking":"searching",...u?{hint:u}:{}})}reset(){this.last=null,this.goodSince=null,this.steadySince=null,this.frames=0}},o(b,"y"),b);function D(h,t){if(!Number.isFinite(h)||h<0)return"low";if(h<=150)return"high";let e=typeof t!="number"||!Number.isFinite(t)||t>3;return h<=400&&e?"mid":"low"}o(D,"S");var N=Object.freeze({low:Object.freeze({stride:1,bandWidthPx:960}),mid:Object.freeze({stride:2,bandWidthPx:1280}),high:Object.freeze({stride:1,bandWidthPx:1280})});function j(h=globalThis){let t=h.navigator?.deviceMemory;return typeof t=="number"&&Number.isFinite(t)&&t>0?t:null}o(j,"O");var C=[[1,0],[0,1],[1,1],[1,-1]];function E(h){let{width:t,height:e,data:l}=h;if(t<16||e<16)return-1;let i=new Uint8Array(t*e);for(let r=0,s=0;r<i.length;r+=1,s+=4)i[r]=Math.round(.299*(l[s]??0)+.587*(l[s+1]??0)+.114*(l[s+2]??0));let a=-1;for(let[r,s]of C){let n=new Uint32Array(256),c=new Float64Array(256),m=0;for(let d=1;d<e-1;d+=1){let f=d*t,F=(d+s)*t,R=(d-s)*t;for(let y=1;y<t-1;y+=1){let I=i[F+y+r]??0,T=i[R+y-r]??0,p=Math.abs(I-T);n[p]=(n[p]??0)+1,c[p]=(c[p]??0)+Math.abs(I+T-2*(i[f+y]??0)),m+=1}}let g=Math.max(1,Math.floor(m/20)),u=0,M=0,k=0;for(let d=255;d>=0&&u<g;d-=1){let f=n[d]??0;u+=f,M+=f*d,k+=c[d]??0}if(M===0)return 0;let S=k/M;a=a<0?S:Math.min(a,S)}return a}o(E,"L");var A=.06;function q(h,t,e,l=A){if(h===null||t.width<=0||t.height<=0)return null;let i=[h.topLeft,h.topRight,h.bottomRight,h.bottomLeft],a=e.width/t.width,r=e.height/t.height,s=Math.min(...i.map(f=>f.x))*a,n=Math.max(...i.map(f=>f.x))*a,c=Math.min(...i.map(f=>f.y))*r,m=Math.max(...i.map(f=>f.y))*r,g=(n-s)*l,u=(m-c)*l,M=Math.max(0,Math.floor(s-g)),k=Math.max(0,Math.floor(c-u)),S=Math.min(e.width,Math.ceil(n+g)),d=Math.min(e.height,Math.ceil(m+u));return S-M<16||d-k<16?null:{x:M,y:k,width:S-M,height:d-k}}o(q,"W");function Z(h,t){let e=t??{x:0,y:0,width:h.width,height:h.height},l=Math.min(1,1e3/Math.max(e.width,e.height)),i=Math.max(1,Math.round(e.width*l)),a=Math.max(1,Math.round(e.height*l)),r=document.createElement("canvas");r.width=i,r.height=a;try{let s=r.getContext("2d",{willReadFrequently:!0});return s===null?-1:(s.imageSmoothingQuality="high",s.drawImage(h,e.x,e.y,e.width,e.height,0,0,i,a),E(s.getImageData(0,0,i,a)))}catch{return-1}finally{r.width=0,r.height=0}}o(Z,"Q");var v,G=(v=class{constructor(t=2){this.stableReads=t,this.last=null,this.run=0}offer(t){return t===null?(this.reset(),!1):(this.run=t===this.last?this.run+1:1,this.last=t,this.run>=this.stableReads)}reset(){this.last=null,this.run=0}},o(v,"g"),v),W=Object.freeze({...z,minIntervalMs:150,maxWidthPx:480,detectorLimit:960,searchTimeoutMs:12e3}),L=Object.freeze({detectorLimit:960,bandMaxWidthPx:1280,minBandWidthPx:900,bandTop:.55,minIntervalMs:150,stableReads:2,profileReads:5,maxReadMs:1200,searchTimeoutMs:12e3}),V=o(()=>typeof document>"u"||document.visibilityState!=="hidden","P"),Y=o((h,t,e)=>createImageBitmap(h,Math.round(t.x),Math.round(t.y),Math.max(1,Math.round(t.w)),Math.max(1,Math.round(t.h)),{resizeWidth:Math.max(1,Math.round(Math.min(t.w,e))),resizeQuality:"high"}),"C"),w=o((h,t)=>{if(h.length===0)return 0;let e=[...h].sort((l,i)=>l-i);return e[Math.min(e.length-1,Math.floor(e.length*t))]},"x");function Q(h){return h<=250?"fast":h<=600?"mid":"slow"}o(Q,"G");function H(h,t,e){let l=h.y+h.h*t,i=Math.min(e,h.y+h.h*1.05);return{x:h.x,y:l,w:h.w,h:Math.max(1,i-l)}}o(H,"Z");var x,J=(x=class{constructor(t){this.o=t,this.engine=null,this.tier=null,this.gen=0,this.ticksSinceRead=Number.POSITIVE_INFINITY,this.hiddenSince=null,this.inFlight=!1,this.lastReadAt=Number.NEGATIVE_INFINITY,this.firstSeen=null,this.reads=0,this.times=[],this.mrzState={state:"searching"},this.lockState={state:"searching"},this.fallback=null,this.lockOff=!1,this.lockError=!1,this.fired=null,this.valid=null,this.faceMode="off",this.disabled=!1,this.crop=t.crop??Y,this.visible=t.visible??V,this.mrzGate=new G(t.liveMrz?.stableReads??2),this.lockGate=new O(t.textLock??W)}setEngine(t,e){this.engine=t,e!==void 0&&(this.tier=e)}liveCadence(t){let e=this.tier===null?null:N[this.tier];return{stride:e?.stride??1,bandWidthPx:Math.min(t.bandMaxWidthPx,e?.bandWidthPx??t.bandMaxWidthPx)}}get bandTop(){return this.o.liveMrz?.bandTop??L.bandTop}get liveMrzOn(){return this.o.liveMrz!==null}get hasEngine(){return this.engine!==null&&!this.disabled}reset(){this.gen++,this.inFlight=!1,this.lastReadAt=Number.NEGATIVE_INFINITY,this.ticksSinceRead=Number.POSITIVE_INFINITY,this.hiddenSince=null,this.firstSeen=null,this.reads=0,this.times=[],this.mrzGate.reset(),this.lockGate.reset(),this.mrzState={state:"searching"},this.lockState={state:"searching"},this.fallback=null,this.lockOff=!1,this.lockError=!1,this.fired=null,this.valid=null,this.faceMode="off"}rearmFace(){this.gen++,this.inFlight=!1,this.lastReadAt=Number.NEGATIVE_INFINITY,this.ticksSinceRead=Number.POSITIVE_INFINITY,this.mrzGate.reset(),this.lockGate.reset(),this.fired=null,this.valid=null,this.fallback===null&&(this.mrzState={state:"searching"}),this.lockOff||(this.lockState={state:"searching"})}liveCapture(){return this.fired?.via==="live_mrz"?this.valid:null}modeFor(t){return this.engine===null||this.disabled?"off":t.mrzFace&&this.o.liveMrz!==null&&this.fallback===null?"live_mrz":this.o.textLock!==null&&!this.lockOff?"text_lock":"off"}tick(t){let e=this.modeFor(t);return e!=="off"&&(this.faceMode=e),this.fired!==null?{ready:!0,via:this.fired.via,suspendQuality:this.fired.via==="live_mrz",mode:e,...this.states()}:e!=="off"&&!this.visible()?(this.hiddenSince??(this.hiddenSince=t.atMs),this.mrzGate.reset(),{ready:!1,suspendQuality:e==="live_mrz"&&this.fallback===null,mode:e,...this.states()}):(this.hiddenSince!==null&&(this.firstSeen!==null&&(this.firstSeen+=t.atMs-this.hiddenSince),this.hiddenSince=null),e==="live_mrz"?this.liveTick(t,this.o.liveMrz):e==="text_lock"?this.lockTick(t,this.o.textLock):{ready:!1,suspendQuality:!1,mode:e,...this.states()})}states(){return{...this.faceMode==="live_mrz"||this.fallback!==null?{mrz:this.fallback!==null?{state:"fallback",reason:this.fallback}:this.mrzState}:{},...this.faceMode==="text_lock"?{lock:this.lockState}:{}}}canRead(t,e){let l=this.engine;return l!==null&&!this.inFlight&&!l.busy&&t-this.lastReadAt>=e}fall(t){this.fallback=t,this.mrzGate.reset()}liveTick(t,e){let l=o(()=>this.fallback!==null?{ready:!1,suspendQuality:!1,mode:"live_mrz",mrz:{state:"fallback",reason:this.fallback}}:{ready:!1,suspendQuality:!0,mode:"live_mrz",mrz:this.mrzState},"r");if(!t.present||t.band===null)return this.mrzGate.reset(),this.mrzState={state:"searching"},l();if(this.firstSeen??(this.firstSeen=t.atMs),t.atMs-this.firstSeen>e.searchTimeoutMs)return this.fall("timeout"),l();if(t.band.w<e.minBandWidthPx)return t.card!==null&&t.card.w<e.minBandWidthPx?(this.fall("unsupported"),l()):(this.mrzState={state:"reading",coach:t.portrait?"turnSideways":"moveCloser"},{ready:!1,suspendQuality:!1,mode:"live_mrz",mrz:this.mrzState});let i=this.liveCadence(e);if(this.ticksSinceRead++,this.ticksSinceRead<i.stride||!this.canRead(t.atMs,e.minIntervalMs))return l();this.inFlight=!0,this.lastReadAt=t.atMs,this.ticksSinceRead=0;let a=this.gen,r=this.engine,s=t.glareOk?t.sharpOk?void 0:"holdStill":"glare";return this.crop(t.video,t.band,i.bandWidthPx).then(n=>r.bandRead(n,e.detectorLimit)).then(n=>{if(a===this.gen){if(this.reads++,this.times.push(n.ms),this.times.length>8&&this.times.shift(),this.reads>=e.profileReads&&w(this.times,.5)>e.maxReadMs)return this.fall("slow");if(this.mrzGate.offer(n.valid?n.digest??null:null)&&n.format&&n.digest){this.valid={format:n.format,...n.documentCode!==void 0?{documentCode:n.documentCode}:{},digest:n.digest,lineCount:n.lineCount,framesToValid:this.reads,msToValid:Math.round(t.atMs-(this.firstSeen??t.atMs))},this.mrzState={state:"valid",format:n.format},this.fired={via:"live_mrz",at:t.atMs};return}this.mrzState={state:"reading",...s?{coach:s}:{},...n.format?{format:n.format}:{}}}}).catch(()=>{a===this.gen&&this.fall("error")}).finally(()=>{a===this.gen&&(this.inFlight=!1)}),l()}lockTick(t,e){let l=o(()=>({ready:!1,suspendQuality:!1,mode:"text_lock",lock:this.lockState,...this.fallback!==null?{mrz:{state:"fallback",reason:this.fallback}}:{}}),"r");if(!t.present||t.card===null)return this.lockGate.reset(),this.lockState={state:"searching"},l();if(this.firstSeen??(this.firstSeen=t.atMs),t.atMs-this.firstSeen>e.searchTimeoutMs)return this.lockOff=!0,l();if(!this.canRead(t.atMs,e.minIntervalMs))return l();this.inFlight=!0,this.lastReadAt=t.atMs;let i=this.gen,a=this.engine,r={glareOk:t.glareOk,sharpOk:t.sharpOk};return this.crop(t.video,t.card,e.maxWidthPx).then(s=>a.layoutRead(s,e.detectorLimit)).then(s=>{if(i!==this.gen)return;this.reads++,this.times.push(s.ms),this.times.length>8&&this.times.shift();let n=this.lockGate.offer(s,t.atMs,r);this.lockState=n.state==="locked"?{state:"locked"}:{state:n.state,...n.hint?{hint:n.hint}:{}},n.state==="locked"&&(this.fired={via:"text_lock",at:t.atMs})}).catch(()=>{i===this.gen&&(this.lockOff=!0,this.lockError=!0)}).finally(()=>{i===this.gen&&(this.inFlight=!1)}),l()}disable(){this.disabled=!0,this.reset()}report(t,e,l){let i=this.faceMode;if(i==="off")return null;let a=w(this.times,.5),r={capture:t,mode:i,reads:this.reads,...this.times.length>0?{readP50Ms:Math.round(a),readP90Ms:Math.round(w(this.times,.9)),deviceClass:Q(a)}:{}};return i==="live_mrz"?this.fired?.via==="live_mrz"&&this.valid!==null&&e==="live_mrz"?{...r,outcome:"valid",format:this.valid.format,framesToValid:this.valid.framesToValid,msToValid:this.valid.msToValid}:this.fallback!==null?{...r,outcome:this.fallback}:{...r,outcome:l-(this.firstSeen??l)>=(this.o.liveMrz?.searchTimeoutMs??1/0)?"timeout":"off"}:this.fired?.via==="text_lock"?{...r,outcome:"locked",framesToLock:Math.max(1,this.reads),msToLock:Math.round(this.fired.at-(this.firstSeen??this.fired.at))}:{...r,outcome:this.lockError?"error":this.lockOff?"timeout":"off"}}},o(x,"w"),x);export{D as a,j as b,q as c,Z as d,W as e,L as f,H as g,J as h};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as M}from"./chunk-
|
|
1
|
+
import{c as M}from"./chunk-6OVZIUQG.js";import{a as c}from"./chunk-P7K7ELYZ.js";import{a as r}from"./chunk-4FHWXBOB.js";var T=480,I=Object.freeze({MIN_AREA_FRAC:.15,EDGE_CLIP_MARGIN_PX:4,STABLE_TICKS:3,IOU_STABLE_MIN:.85,RISE_PER_S:.9,FALL_PER_S:.25,GUIDE_EXPOSURE:.6,GUIDE_SHARPNESS:.35,ID3_BAND_MIN_WIDTH_FRAC:.55,ID3_BAND_ASPECT_MIN:4,ID3_BAND_ASPECT_MAX:40}),x=r(i=>Math.min(1,Math.max(0,i)),"p");function E(i,h,t){let s=[i.topLeft,i.topRight,i.bottomRight,i.bottomLeft],e=0;for(let a=0;a<4;a++){let l=s[a],_=s[(a+1)%4];e+=l.x*_.y-_.x*l.y}let o=h*t;return o>0?Math.abs(e/2)/o:0}r(E,"E");function g(i,h){let t=A(i),s=A(h),e=Math.max(t.x1,s.x1),o=Math.max(t.y1,s.y1),a=Math.min(t.x2,s.x2),l=Math.min(t.y2,s.y2),_=Math.max(0,a-e)*Math.max(0,l-o),d=(t.x2-t.x1)*(t.y2-t.y1),u=(s.x2-s.x1)*(s.y2-s.y1),p=d+u-_;return p>0?_/p:0}r(g,"I");function L(i){let h=A(i);return{width:h.x2-h.x1,height:h.y2-h.y1}}r(L,"R");function A(i){let h=[i.topLeft,i.topRight,i.bottomRight,i.bottomLeft];return{x1:Math.min(...h.map(t=>t.x)),y1:Math.min(...h.map(t=>t.y)),x2:Math.max(...h.map(t=>t.x)),y2:Math.max(...h.map(t=>t.y))}}r(A,"D");function S(i){let h=Math.hypot(i.topRight.x-i.topLeft.x,i.topRight.y-i.topLeft.y),t=Math.hypot(i.bottomRight.x-i.bottomLeft.x,i.bottomRight.y-i.bottomLeft.y),s=Math.hypot(i.bottomLeft.x-i.topLeft.x,i.bottomLeft.y-i.topLeft.y),e=Math.hypot(i.bottomRight.x-i.topRight.x,i.bottomRight.y-i.topRight.y),o=(h+t)/2,a=(s+e)/2;return o<=0||a<=0?0:Math.max(o,a)/Math.min(o,a)}r(S,"M");var n,N=(n=class{constructor(h,t={}){this.p=0,this.lastTickAt=null,this.lastQuad=null,this.streak=0,this.format=h,this.t={...I,...t}}reset(){this.p=0,this.lastTickAt=null,this.lastQuad=null,this.streak=0}tick(h){let{quad:t,quality:s,timestampMs:e}=h,o=this.lastTickAt===null?0:Math.max(0,(e-this.lastTickAt)/1e3);this.lastTickAt=e;let a=null;if(t===null)a="dcv1.no_doc";else if(this.format==="ID-3"){let m=L(t),y=m.height>0?m.width/m.height:0;m.width<this.t.ID3_BAND_MIN_WIDTH_FRAC*h.frameWidth?a="dcv1.come_closer":this.edgeClipped(t,h.frameWidth,h.frameHeight)?a="dcv1.fit_document":(y<this.t.ID3_BAND_ASPECT_MIN||y>this.t.ID3_BAND_ASPECT_MAX)&&(a="dcv1.wrong_shape")}else E(t,h.frameWidth,h.frameHeight)<this.t.MIN_AREA_FRAC?a="dcv1.come_closer":this.edgeClipped(t,h.frameWidth,h.frameHeight)?a="dcv1.fit_document":M(this.format,S(t))||(a="dcv1.wrong_shape");let l=a===null,_=x(s.exposure)>=this.t.GUIDE_EXPOSURE,d=x(s.sharpness)>=this.t.GUIDE_SHARPNESS,u=_&&d;if(l&&u&&t!==null){let m=this.lastQuad===null||g(t,this.lastQuad)>=this.t.IOU_STABLE_MIN;this.streak=m?this.streak+1:1}else this.streak=0;this.lastQuad=t;let p=l&&u;this.p=x(this.p+(p?this.t.RISE_PER_S:-this.t.FALL_PER_S)*o);let R=p&&this.streak>=this.t.STABLE_TICKS,f;if(a!==null)f=a;else if(_)d?f="dcv1.hold_still":f="dcv1.steady";else{let m=(c[0]+c[1])/2;f=s.meanLuma<m?"dcv1.more_light":"dcv1.too_bright"}return{at:e,quad:t,plausible:l,p:this.p,guidanceKey:f,ready:R,stableTicks:this.streak}}edgeClipped(h,t,s){let e=this.t.EDGE_CLIP_MARGIN_PX;return[h.topLeft,h.topRight,h.bottomRight,h.bottomLeft].some(o=>o.x<=e||o.y<=e||o.x>=t-e||o.y>=s-e)}},r(n,"d"),n);export{T as a,I as b,E as c,L as d,N as e};
|