@sekyro/react 0.1.0-rc.12 → 0.1.0-rc.13

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,14 @@
1
1
  # @sekyro/react
2
2
 
3
+ ## 0.1.0-rc.13
4
+
5
+ ### Patch Changes
6
+
7
+ - 705cd00: Status colours are standard. `<SekyroVerification>` paints the Sekyro status colours and picks the set that stays readable on the partner's page colours (a dark partner page in the light scheme gets the dark set; notices sit on its soft surfaces). `danger`, `success` and `warning` in a runtime theme are deprecated and ignored, with one warning in development builds; they will be removed in 1.0. Status keys from an older server's branding are ignored.
8
+ - Updated dependencies [7eddbf1]
9
+ - Updated dependencies [ff5cc35]
10
+ - @sekyro/web@0.1.0-rc.15
11
+
3
12
  ## 0.1.0-rc.12
4
13
 
5
14
  ### Patch Changes
package/README.md CHANGED
@@ -177,6 +177,11 @@ is a `blob:` URL, no `data:` needed); add your clip host if `clips` points off-o
177
177
  defaults apply (`DEFAULT_THEME`). You can also set the variables yourself on any
178
178
  ancestor.
179
179
 
180
+ Status colours are standard. Since 0.1.0-rc.13, `colors.danger`, `success` and
181
+ `warning` in a theme you pass are deprecated and ignored (one warning in
182
+ development builds); they will be removed in 1.0. The component picks the
183
+ Sekyro status set that stays readable on your page colours.
184
+
180
185
  Contrast rules the component relies on (checked for the default theme in
181
186
  `test/contrast.test.ts`):
182
187
 
@@ -0,0 +1,2 @@
1
+ "use client";
2
+ import{a as g}from"./chunk-Z5UFPMM6.js";import{a as s}from"./chunk-2KED7D2Q.js";var c={light:{brand:"#0d3b66",brandFg:"#ffffff",fg:"#13141f",fgMuted:"#4e5270",bg:"#f6f7fb",surface:"#ffffff",ring:"#0d3b66",danger:"#ca0f07",success:"#007a5e",warning:"#735003"},dark:{brand:"#6ea2d3",brandFg:"#051a2e",fg:"#f6f7fb",fgMuted:"#cbcedc",bg:"#13141f",surface:"#1d1e2c",ring:"#6ea2d3",danger:"#ff7c7c",success:"#00c897",warning:"#ffd98a"},roles:{light:{brandSoft:"#eaf2fa",line:"#cbcedc",lineSubtle:"#e2e4ee",lineStrong:"#8c91a9",sunken:"#eeeff5",fgSubtle:"#686d8a"},dark:{brandSoft:"#092b4b",line:"#4e5270",lineSubtle:"#2b2d40",lineStrong:"#686d8a",sunken:"#0b0c14",fgSubtle:"#8c91a9"}},stage:"#051a2e",stageAccent:"#69dfef",radius:"10px",radiusLg:"16px",font:'"Sekyro Inter", Inter, system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans Arabic", "Noto Sans", sans-serif',fontDisplay:'"Sekyro Geist", Geist, "Sekyro Inter", Inter, system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans Arabic", "Noto Sans", sans-serif',fontArabic:'"Sekyro Cairo", Cairo, "Sekyro Inter", "Noto Sans Arabic", system-ui, -apple-system, "Segoe UI", sans-serif'};import{jsx as y}from"react/jsx-runtime";var t={colors:{...c.light},radius:c.radiusLg,fontFamily:c.font},l={brand:"--sekyro-color-brand",brandFg:"--sekyro-color-brand-fg",fg:"--sekyro-color-fg",fgMuted:"--sekyro-color-fg-muted",bg:"--sekyro-color-bg",surface:"--sekyro-color-surface",ring:"--sekyro-color-ring",danger:"--sekyro-color-danger",success:"--sekyro-color-success",warning:"--sekyro-color-warning"};function S(o={}){let e={};for(let r of Object.keys(l))e[l[r]]=o.colors?.[r]??t.colors[r];return e["--sekyro-radius"]=o.radius??t.radius,e["--sekyro-font"]=o.fontFamily??t.fontFamily,e}s(S,"themeToCssVars");var m=/^#[0-9a-f]{6}$/i,k=["brand","brandFg","bg","surface","fg","fgMuted"],b=["danger","success","warning"],u=!1;function p(o){let e=o?.colors;if(o===void 0||e===void 0||!b.some(i=>i in e))return o;!u&&g()&&(u=!0,console.warn("[sekyro] theme.colors.danger/success/warning are ignored: status colours are standard (removed in 1.0)"));let{danger:r,success:a,warning:f,...n}=e;return{...o,colors:n}}s(p,"stripDeprecatedStatusColors");var T={none:"0px",sm:"6px",md:"10px",lg:"16px",full:"9999px"},h={system:"",inter:"Inter","ibm-plex-sans-arabic":'"IBM Plex Sans Arabic"',"noto-sans-arabic":'"Noto Sans Arabic"',roboto:"Roboto"};function F(o){let e={};if(!o)return e;let r={},a=o.colors??{};for(let i of k){let d=a[i];d!==void 0&&m.test(d)&&(r[i]=d)}r.brand&&(r.ring=r.brand),Object.keys(r).length&&(e.colors=r);let f=T[o.radius];f&&(e.radius=f);let n=h[o.fontFamily];return n!==void 0&&(e.fontFamily=n?`${n}, ${t.fontFamily}`:t.fontFamily),e}s(F,"brandingToTheme");function I(...o){let e={};for(let r of o)r?.colors&&(e.colors={...e.colors,...r.colors}),r?.radius&&(e.radius=r.radius),r?.fontFamily&&(e.fontFamily=r.fontFamily);return e}s(I,"mergeThemes");function C({theme:o,children:e,className:r}){return y(R,{theme:p(o),...r!==void 0?{className:r}:{},children:e})}s(C,"SekyroThemeProvider");function R({theme:o,children:e,className:r}){let a=S(o);return y("div",{className:r===void 0?"sekyro-root":`sekyro-root ${r}`,style:a,children:e})}s(R,"SekyroThemeRoot");export{c as a,t as b,S as c,p as d,F as e,I as f,C as g,R as h};
@@ -1,2 +1,2 @@
1
1
  "use client";
2
- import{a as Jt,c as Xt,d as en}from"./chunk-LNZR3RXG.js";import{a as D,j as Dt,k as qt,l as jt,m as $t,n as zt,o as Yt,p as Zt,q as Wt,r as Qt,s as U,t as j,u as qe}from"./chunk-34326C2I.js";import{a as n}from"./chunk-2KED7D2Q.js";import{useId as cr}from"react";import{Fragment as ar,jsx as V,jsxs as X}from"react/jsx-runtime";function ee({className:e,children:t}){return V("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})}n(ee,"Svg");var at="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 tn(e){return X(ee,{...e,children:[V("circle",{cx:"12",cy:"12",r:"4"}),V("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"})]})}n(tn,"SunIcon");function nn(e){return X(ee,{...e,children:[V("circle",{cx:"12",cy:"12",r:"9"}),V("path",{d:"M9 10h.01M15 10h.01M8.8 14.6a4.2 4.2 0 0 0 6.4 0"})]})}n(nn,"FaceUncoveredIcon");function rn(e){return X(ee,{...e,children:[V("rect",{x:"7",y:"2.5",width:"10",height:"19",rx:"2"}),V("path",{d:"M10.5 18.5h3M2.5 9.5h2.5M19 9.5h2.5"}),V("circle",{cx:"12",cy:"9.5",r:"1.6"})]})}n(rn,"PhoneEyeLevelIcon");function on(e){return X(ee,{...e,children:[V("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"}),V("circle",{cx:"12",cy:"12",r:"2.8"})]})}n(on,"LookStraightIcon");function sn(e){return X(ee,{...e,children:[V("path",{d:at}),V("path",{d:"M9 13l2 2 4-4"})]})}n(sn,"CameraCheckIcon");function an(e){return X(ee,{...e,children:[V("path",{d:at}),V("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"})]})}n(an,"CameraAskIcon");function cn(e){return X(ee,{...e,children:[V("path",{d:at}),V("path",{d:"M3 3l18 18"})]})}n(cn,"CameraBlockedIcon");function ve({off:e,className:t}){return X(ee,{className:t,children:[V("path",{d:"M4.5 9.5v5H8l4 3.5v-12L8 9.5H4.5Z"}),e?V("path",{d:"M4 4l16 16"}):X(ar,{children:[V("path",{d:"M15.5 9.7a3.6 3.6 0 0 1 0 4.6"}),V("path",{d:"M18 7.6a6.6 6.6 0 0 1 0 8.8"})]})]})}n(ve,"SpeakerIcon");function ln(e){return V(ee,{...e,children:V("path",{d:"M5 12.5l4.5 4.5L19 7.5"})})}n(ln,"CheckIcon");function un(e){return X(ee,{className:e.className??"sekyro-spinner",children:[V("circle",{cx:"12",cy:"12",r:"9",opacity:"0.25"}),V("path",{d:"M21 12a9 9 0 0 0-9-9"})]})}n(un,"SpinnerIcon");import{jsx as ce,jsxs as dn}from"react/jsx-runtime";var je=["light","uncover","eyeLevel","straight"],lr={light:{key:"capture.tips.light",icon:n(()=>ce(tn,{}),"icon")},uncover:{key:"capture.tips.uncover",icon:n(()=>ce(nn,{}),"icon")},eyeLevel:{key:"capture.tips.eyeLevel",icon:n(()=>ce(rn,{}),"icon")},straight:{key:"capture.tips.straight",icon:n(()=>ce(on,{}),"icon")}};function pn({tips:e}){let t=U(),s=cr();return e.length===0?null:dn("section",{className:"sekyro-tips","aria-labelledby":s,"data-testid":"sekyro-tips",children:[ce("p",{className:"sekyro-tips__title",id:s,children:t("capture.tips.title")}),ce("ul",{className:"sekyro-tips__list",children:e.map(o=>{let r=typeof o=="string"?lr[o]:void 0,a=typeof o=="string"?o:o.id,l=r!==void 0?r.icon():typeof o=="string"?void 0:o.icon,p=r!==void 0?t(r.key):typeof o=="string"?o:o.text;return dn("li",{className:"sekyro-tips__item",children:[l!=null?ce("span",{className:"sekyro-tips__icon","aria-hidden":"true",children:l}):null,ce("span",{children:p})]},a)})})]})}n(pn,"TipList");import{useEffect as fn,useId as ur,useRef as dr,useState as pr}from"react";import{jsx as te,jsxs as $e}from"react/jsx-runtime";var fr=220;function mn({title:e,description:t,options:s,busy:o,error:r,focus:a,testId:l,look:p="cards",marked:C,onChoose:b}){let w=ur(),M=qe(),[k,c]=pr(null),g=dr(null);fn(()=>{r!==null&&c(null)},[r]),fn(()=>()=>{g.current!==null&&clearTimeout(g.current)},[]);let v=n(u=>{o||k!==null||(c(u),g.current=setTimeout(()=>{g.current=null,c(null),b(u)},fr))},"choose");return $e("section",{className:"sekyro-stack sekyro-stack--4 sekyro-choice","aria-labelledby":w,"data-testid":l,children:[$e("div",{className:"sekyro-stack sekyro-stack--1",children:[te("h2",{id:w,ref:a?M:void 0,tabIndex:-1,className:"sekyro-text-body",children:e}),t!==void 0&&t!==""?te("p",{className:"sekyro-text-muted",children:t}):null]}),r!==null?te(j,{tone:"danger",children:te("span",{children:r})}):null,p==="buttons"?te("div",{className:"sekyro-stack sekyro-stack--3",children:s.map((u,L)=>te(D,{kind:L===0?"primary":"ghost",full:!0,disabled:o,"aria-busy":o||void 0,onClick:()=>b(u.id),children:u.label},u.id))}):te("div",{className:"sekyro-choices",children:s.map(u=>$e("button",{type:"button",className:"sekyro-card","aria-pressed":(k??C)===u.id,"aria-busy":o||void 0,disabled:o||k!==null&&k!==u.id,onClick:()=>v(u.id),children:[u.glyph,$e("span",{className:"sekyro-card__body",children:[te("span",{className:"sekyro-card__title",children:u.label}),u.sub!==void 0?te("span",{className:"sekyro-card__sub",children:u.sub}):null]}),te("span",{className:"sekyro-radio","aria-hidden":"true"})]},u.id))})]})}n(mn,"ChoiceScreen");var ze=["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","capture.tips.summary"];function pe(e){return e!==null&&ze.includes(e)}n(pe,"isVoiceKey");import{useCallback as re,useEffect as fe,useLayoutEffect as hr,useMemo as vr,useRef as Ce,useState as Pe}from"react";var mr=n((e,t)=>Object.prototype.hasOwnProperty.call(e,t),"own");function ke(e,t,s){let o;try{if(typeof e=="function")o=e(t,s);else{let r=e[s];o=r!=null&&mr(r,t)?r[t]:null}}catch{return null}return typeof o=="string"&&o!==""?o:null}n(ke,"resolveClip");var yr="UklGRiQAAABXQVZFZm10IBAAAAABAAEAESsAACJWAAACABAAZGF0YQAAAAA=",hn={ar:"ar-SA",fr:"fr-FR",en:"en-US",es:"es-ES",pt:"pt-BR",de:"de-DE"};function ne(){return typeof window<"u"&&"speechSynthesis"in window?window.speechSynthesis:null}n(ne,"synth");function gr(){return ne()!==null&&typeof SpeechSynthesisUtterance=="function"}n(gr,"speechAvailable");function yn(e){return(e.split(/[-_]/)[0]??e).toLowerCase()}n(yn,"baseLang");function vn(e,t){let s=n(r=>r.replace(/_/g,"-").toLowerCase(),"norm"),o=yn(t);return e.find(r=>s(r.lang)===s(t))??e.find(r=>yn(r.lang)===o)}n(vn,"pickVoice");function kn(e){if(!gr())return!1;let t=[];try{t=ne()?.getVoices()??[]}catch{return!0}return t.length===0||vn(t,e)!==void 0}n(kn,"speechUsable");function Cn(e){let t=ne();return t===null||typeof t.addEventListener!="function"?()=>{}:(t.addEventListener("voiceschanged",e),()=>t.removeEventListener?.("voiceschanged",e))}n(Cn,"subscribeVoices");function _e(e){try{let t=typeof location<"u"?location.href:"http://localhost/",s=new URL(e,t);return`clip:${s.origin}${s.pathname}`}catch{return`clip:${e}`}}n(_e,"clipIdentity");function gn(e){e.pause(),e.removeAttribute("src"),e.load()}n(gn,"release");function bn(){let e=null,t=null,s=0,o=null,r=[],a=new Map,l=n(()=>{r=ne()?.getVoices()??[]},"loadVoices"),p=!1,C=n(()=>{let c=ne();p||c===null||(p=!0,l(),c.addEventListener?.("voiceschanged",l))},"bindVoices"),b=n(()=>(e??(e=new Audio),e),"element"),w=n((c,g,v)=>{let u=ne();if(u!==null&&c!==""&&typeof SpeechSynthesisUtterance=="function"){C();let L=vn(r,g);if(r.length===0||L!==void 0){u.cancel();let m=new SpeechSynthesisUtterance(c);m.lang=g,L!==void 0&&(m.voice=L),m.rate=.95,v!==void 0&&(m.onend=m.onerror=v),u.speak(m);return}}v?.()},"speak"),M=n(()=>{s+=1,o=null,e!==null&&(e.pause(),e.currentTime=0),ne()?.cancel()},"stop"),k=n(c=>{for(let g of c){let v=_e(g);if(a.has(v))continue;let u=new Audio;u.preload="auto",u.src=g,a.set(v,u)}},"warmClips");return{say(c){let g=c.url!==null?_e(c.url):`tts:${c.lang}:${c.text}`;if(g===o)return;o=g,s+=1;let v=s,u=c.onEnd,L=u!==void 0?()=>{v===s&&u()}:void 0;if(ne()?.cancel(),c.url!==null){let m=b();m.pause(),m.muted=!1,m.src=c.url,m.currentTime=0,m.onended=L??null,m.play()?.catch(S=>{v===s&&S?.name!=="AbortError"&&(c.speech?w(c.text,c.lang,L):L?.())});return}c.speech?w(c.text,c.lang,L):L?.()},unlock({lang:c,speech:g,prefetch:v}){let u=b();if(t===null&&typeof Blob=="function"&&typeof URL.createObjectURL=="function"){let S=Uint8Array.from(atob(yr),N=>N.charCodeAt(0));t=URL.createObjectURL(new Blob([S],{type:"audio/wav"}))}let L=u.paused===!1&&t!==null&&u.src!==t;t!==null&&!L&&(u.muted=!0,u.onended=null,u.src=t,u.play()?.catch(()=>{}));let m=ne();if(g&&m!==null&&typeof SpeechSynthesisUtterance=="function"){C();let S=new SpeechSynthesisUtterance(" ");S.volume=0,S.lang=c,m.speak(S)}k(v??[])},prefetch:k,stop:M,dispose(){M(),p&&ne()?.removeEventListener?.("voiceschanged",l),p=!1,t!==null&&URL.revokeObjectURL(t),t=null,e!==null&&gn(e),e=null;for(let c of a.values())gn(c);a.clear()}}}n(bn,"createVoicePlayer");var Sn="sekyro.voiceGuidance";function Vn(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}}n(Vn,"readVoicePreference");function Rn(e,t){try{if(typeof window>"u")return;window.localStorage.setItem(e,t?"1":"0")}catch{}}n(Rn,"writeVoicePreference");var Ae="capture.tips.summary",kr=typeof window<"u"?hr:fe,Cr=Object.freeze({});function ct(e,t){let s=new Set,o=[];for(let r of ze){let a=r===Ae?null:ke(e,r,t);a===null||s.has(_e(a))||(s.add(_e(a)),o.push(a))}return o}n(ct,"resolvedClipUrls");function lt({locale:e,defaultClips:t,options:s}){let o=s===!1,r=o?{}:s??{},a=r.storageKey===void 0?Sn:r.storageKey,[l,p]=Pe(r.defaultEnabled??!0),C=Ce(l),[b,w]=Pe(!1),[M,k]=Pe("none"),[c,g]=Pe(!1),v=Ce(!1),[u,L]=Pe(0),m=Ce(null),S=re(()=>(m.current??(m.current=bn()),m.current),[]),N=hn[e],O=r.speechFallback,d=O===void 0||O===!0?!0:O===!1?!1:O.includes(e),G=r.clips??t??Cr,F=Ce(!1),q=Ce(G);kr(()=>{q.current=G,C.current=l}),fe(()=>{if(o||a===null)return;let f=Vn(a);f!==null&&(C.current=f,p(f))},[o,a]),fe(()=>{if(!(o||!d))return Cn(()=>L(f=>f+1))},[o,d]);let i=r.clips;fe(()=>{if(o)return;let f=d&&kn(N);w(ct(G,e).length>0||f),k(i!==void 0&&ke(i,Ae,e)!==null?"partner":ke(G,Ae,e)!==null||f?"default":"none")},[o,G,i,e,d,N,u]),fe(()=>{if(o||!l||!F.current)return;let f=ct(G,e);f.length>0&&S().prefetch(f)},[o,l,G,e,S]),fe(()=>()=>{m.current?.dispose(),m.current=null,F.current=!1},[]);let E=re(f=>{o||(F.current=!0,S().unlock({lang:N,speech:d,...f?{prefetch:ct(q.current,e)}:{}}))},[o,S,N,d,e]),I=re(()=>E(C.current),[E]),_=re(()=>{v.current=!1,g(!1)},[]),A=re(()=>{_(),m.current?.stop()},[_]),Y=re(()=>{v.current&&A()},[A]),ue=re((f,K)=>{if(o)return;if(v.current){A();return}let oe=S();oe.stop(),v.current=!0,g(!0);let x=K?.clip===!1?null:ke(q.current,Ae,e);oe.say({url:x,text:f,lang:N,speech:d,onEnd:_})},[o,A,S,e,N,d,_]),P=re(f=>{o||(f?E(!0):A(),a!==null&&Rn(a,f),C.current=f,p(f))},[o,E,A,a]),Z=re(()=>P(!C.current),[P]),T=re((f,K)=>{if(o||!l)return;v.current&&_();let oe=ke(q.current,f,e);S().say({url:oe,text:K,lang:N,speech:d})},[o,l,e,S,N,d,_]);return vr(()=>({supported:!o&&b,enabled:!o&&l,setEnabled:P,toggle:Z,unlock:I,speakKey:T,stop:A,summary:o?"none":M,summaryPlaying:c,toggleSummary:ue,stopSummary:Y}),[o,b,l,P,Z,I,T,A,M,c,ue,Y])}n(lt,"useVoiceGuidance");function ut(e,t,s,o){let{speakKey:r,stop:a,enabled:l}=e,p=Ce(!1);fe(()=>{if(!o||!l){p.current&&a(),p.current=!1;return}p.current=!0,pe(t)&&t!==Ae&&s!==""&&r(t,s)},[o,l,t,s,r,a])}n(ut,"useSpeakGuidance");import{isValidElement as Yr,useCallback as Je,useContext as Zr,useEffect as le,useMemo as Le,useRef as me,useState as Wn}from"react";import{useEffect as br,useRef as Sr}from"react";import{jsx as be,jsxs as dt}from"react/jsx-runtime";function Ln({showCoaching:e,attemptsText:t,showRetake:s,onRetake:o}){let r=U(),a=Sr(null);return br(()=>{s&&a.current?.focus()},[s]),!e&&!s?null:dt("div",{className:"sekyro-stack sekyro-stack--3","data-testid":"sekyro-captured-panel",children:[e?dt("div",{className:"sekyro-stack sekyro-stack--1",children:[be("p",{className:"sekyro-text-body",children:r("capture.retryCoaching.title")}),dt("ul",{className:"sekyro-coaching",children:[be("li",{children:r("capture.retryCoaching.light")}),be("li",{children:r("capture.retryCoaching.eyeLevel")}),be("li",{children:r("capture.retryCoaching.head")})]}),t!==null?be("p",{className:"sekyro-text-muted","data-testid":"sekyro-attempts-remaining",children:t}):null]}):null,s?be(D,{ref:a,className:"sekyro-btn--start",onClick:o,children:r("capture.recordAgain")}):null]})}n(Ln,"CapturedPanel");function Ye(){try{return process.env.NODE_ENV!=="production"}catch{return!1}}n(Ye,"isDevBuild");import{createContext as Vr}from"react";var wn=Vr(null);import{useCallback as En,useEffect as _n,useRef as Se}from"react";import{useId as Rr}from"react";import{jsx as Ze,jsxs as pt}from"react/jsx-runtime";var Lr=["user","environment"];function Mn({value:e,onChange:t}){let s=U(),o=Rr();return pt("fieldset",{className:"sekyro-segmented","data-testid":"sekyro-facing",children:[Ze("legend",{className:"sekyro-segmented__legend",children:s("capture.cameraLabel")}),Ze("div",{className:"sekyro-segmented__options",children:Lr.map(r=>pt("label",{className:"sekyro-segmented__option",children:[Ze("input",{type:"radio",className:"sekyro-segmented__input",name:o,value:r,checked:e===r,onChange:()=>t(r)}),pt("span",{className:"sekyro-segmented__face",children:[Ze("span",{className:"sekyro-segmented__dot","aria-hidden":"true"}),s(`capture.facing.${r}`)]})]},r))})]})}n(Mn,"FacingPicker");import{useEffect as wr,useState as Mr}from"react";import{jsx as Te,jsxs as Ir}from"react/jsx-runtime";function In({state:e}){let t=U(),[s,o]=Mr(!1);wr(()=>{e!=="unknown"&&o(!0)},[e]);let r=e==="granted"?Te(sn,{}):e==="denied"?Te(cn,{}):Te(an,{});return Ir("div",{role:s?"status":void 0,className:`sekyro-permission sekyro-permission--${e}`,"data-testid":"sekyro-permission","data-state":e,children:[Te("span",{className:"sekyro-permission__icon","aria-hidden":"true",children:r}),Te("span",{children:t(`capture.permission.${e}`)})]})}n(In,"PermissionRow");import{jsx as We,jsxs as xn}from"react/jsx-runtime";function Nn({voice:e}){let t=U();if(!e.supported)return null;let s=e.enabled;return xn("button",{type:"button",role:"switch","aria-checked":s,className:"sekyro-switch","data-testid":"sekyro-voice-switch",onClick:()=>e.toggle(),children:[xn("span",{className:"sekyro-switch__label",children:[We(ve,{off:!s}),t("capture.voiceGuidance")]}),We("span",{className:"sekyro-switch__track","aria-hidden":"true",children:We("span",{className:"sekyro-switch__thumb",children:s?We(ln,{className:"sekyro-switch__check"}):null})})]})}n(Nn,"VoiceSwitch");import{Fragment as Nr,jsx as B,jsxs as Ve}from"react/jsx-runtime";function Pn({assets:e,onRetryAssets:t,permission:s,captureMode:o="self",canChooseFacing:r,facing:a,onFacingChange:l,voice:p,tips:C,summary:b,startLabel:w,startDisabled:M,onStart:k}){let c=U(),g=Se(b?.stop);g.current=b?.stop,_n(()=>()=>g.current?.(),[]);let v=Se(null),u=Se(null),L=Se(null),m=Se(e),S=Se(!1);_n(()=>{let i=m.current;if(m.current=e,i===e)return;let E=S.current;e!=="loading"&&(S.current=!1),xr(v.current)&&(e==="failed"?L.current?.focus():E&&u.current?.focus())},[e]);let N=En(()=>{S.current=!0,t()},[t]),O=e==="loading",d=O||M,G=En(()=>{d||(g.current?.(),k())},[d,k]),F;e==="failed"?F=Ve(j,{tone:"danger",testId:"sekyro-assets-error",children:[B("p",{className:"sekyro-text-body",children:c("fcv2.err.models")}),B(D,{kind:"ghost",ref:L,className:"sekyro-btn--start",onClick:N,"data-testid":"sekyro-assets-retry",children:c("common.retry")})]}):F=Ve("div",{className:"sekyro-stack sekyro-stack--1",children:[B(D,{ref:u,full:!0,"data-testid":"sekyro-start","aria-disabled":d?"true":void 0,"aria-busy":O?"true":void 0,onClick:G,children:O?Ve(Nr,{children:[B(un,{}),c("capture.preparing.title")]}):w??c("capture.start")}),O?B("p",{className:"sekyro-text-muted",children:c("capture.preparing.hint")}):null]});let q=o==="assisted";return Ve("div",{ref:v,className:"sekyro-stack sekyro-stack--4","data-testid":"sekyro-intro","data-assets":e,children:[q?Ve("div",{className:"sekyro-stack sekyro-stack--1","data-testid":"sekyro-assisted-intro",children:[B("h2",{className:"sekyro-text-body",children:c("capture.assisted.title")}),B("p",{className:"sekyro-text-muted",children:c("capture.assisted.lead")})]}):null,C!==!1?B(pn,{tips:C}):null,b!==void 0?Ve(D,{kind:"ghost",className:"sekyro-btn--start",onClick:b.toggle,"data-testid":"sekyro-tips-listen",children:[B(ve,{off:!1}),c(b.playing?"capture.tips.stop":"capture.tips.listen")]}):null,B(In,{state:s}),q&&r?B(Mn,{value:a,onChange:l}):null,B(Nn,{voice:p}),B("p",{className:"sekyro-text-muted",children:c("capture.securityNote")}),F,B("p",{role:"status",className:"sekyro-visually-hidden","data-testid":"sekyro-intro-status",children:e==="loading"?c("capture.preparing.title"):e==="ready"?c("capture.ready"):""})]})}n(Pn,"PreCaptureScreen");function xr(e){if(typeof document>"u")return!1;let t=document.activeElement;return t===null||t===document.body||e!==null&&e.contains(t)}n(xr,"focusIsOurs");import{useEffect as ft,useState as mt}from"react";function An(e){return Kn(e,"mobileRequired")}n(An,"useMobileRequired");function Tn(e){return Kn(e,"returning").required}n(Tn,"useReturning");function Kn(e,t){let[s,o]=mt({required:!1,settled:e===void 0});return ft(()=>{let r=e?.[t];if(e===void 0||typeof r!="function"){o({required:!1,settled:!0});return}let a=!0;return o({required:!1,settled:!1}),Promise.resolve().then(()=>r.call(e)).then(l=>{a&&o({required:l===!0,settled:!0})},()=>{a&&o({required:!1,settled:!0})}),()=>{a=!1}},[e,t]),s}n(Kn,"useFlag");function On(e){let[t,s]=mt({mode:"self",settled:e===void 0});return ft(()=>{let o=e?.captureMode;if(e===void 0||typeof o!="function"){s({mode:"self",settled:!0});return}let r=!0;return s({mode:"self",settled:!1}),Promise.resolve().then(()=>o.call(e)).then(a=>{r&&s({mode:a==="assisted"?"assisted":"self",settled:!0})},()=>{r&&s({mode:"self",settled:!0})}),()=>{r=!1}},[e]),t}n(On,"useCaptureMode");function Fn(e){let[t,s]=mt(!1);return ft(()=>{if(s(!1),e===void 0)return;let o=e.on("busy",()=>s(!0)),r=e.on("result",()=>s(!1));return()=>{o(),r()}},[e]),t}n(Fn,"useBusy");import{getLivenessAssetsStatus as Er,preloadLivenessAssets as _r,subscribeLivenessAssets as Pr}from"@sekyro/web";import{useCallback as yt,useEffect as Hn,useRef as Un,useState as Ar,useSyncExternalStore as Tr}from"react";var Kr=n(()=>"idle","serverSnapshot");function Bn(e){return _r(e!==void 0?{assetBaseUrl:e}:{})}n(Bn,"preload");function Gn(e,t=!0){let s=Tr(yt(M=>Pr(M,e),[e]),()=>Er(e),Kr),[o,r]=Ar(null),a=Un(!1),l=yt(()=>{Bn(e).then(M=>{a.current&&M==="idle"&&r({base:e})})},[e]);Hn(()=>(a.current=!0,l(),()=>{a.current=!1}),[l]);let p=Un(null);Hn(()=>{if(s!=="idle"){p.current={base:e};return}!t||p.current===null||p.current.base!==e||(p.current=null,l())},[s,e,l,t]);let C=yt(()=>{Bn(e)},[e]);return{gate:o!==null&&o.base===e&&s==="idle"||s==="ready"?"ready":s==="failed"?"failed":"loading",retry:C}}n(Gn,"useLivenessAssets");import{createLivenessCapture as Or}from"@sekyro/web";import{useCallback as gt,useEffect as Fr,useRef as Re,useState as z}from"react";var Dn={progress:0,hint:null,faceDetected:!1};function qn(e){let{videoRef:t,assetBaseUrl:s}=e,r=Re(e.verification).current,a=Re(!1);e.verification!==r&&!a.current&&Ye()&&(a.current=!0,console.warn("[@sekyro/react] <LivenessCapture>: the `verification` prop changed identity after mount. The first instance stays bound (the camera is not rebuilt); create the verification once (useMemo / useState / outside render) instead of on every render."));let l=Re(null),[p,C]=z("idle"),[b,w]=z(Dn),[M,k]=z(!1),[c,g]=z(!1),[v,u]=z(null),[L,m]=z(!1),[S,N]=z(null),[O,d]=z(null),[G,F]=z(null),[q,i]=z(null),[E,I]=z(null),_=Re(null),A=Re("idle"),Y=Re(e);Y.current=e,Fr(()=>{let T=t.current;if(T===null)return;let f={video:T,...s!==void 0?{assetBaseUrl:s}:{}},K=r!==void 0?r.liveness(f):Or(f);l.current=K;let oe=n(()=>I(K.facingMode??null),"readFacing");oe();let x=[K.on("state",h=>{h==="starting"?(d(null),F(null),w(Dn),g(!1),k(!1),u(null),N(null),_.current=null):h==="gating"&&A.current==="recording"&&(g(!1),k(!1),u(null),_.current=null),A.current=h,oe(),C(h),Y.current.onStateChange?.(h)}),K.on("gate",h=>{let ye=_.current;_.current=h.progress,k(ye!==null&&h.progress<ye-.001&&h.progress>0&&h.progress<1),h.progress>=1&&g(!0),w(h)}),K.on("frozen",({previewDataUrl:h})=>u(h)),K.on("profile",({animations:h})=>m(h==="reduced")),K.on("ramp",({colour:h})=>N(h)),K.on("captured",h=>{d(h),i(null),Y.current.onCaptured?.(h)}),K.on("error",h=>{F(h),Y.current.onError?.(h)}),r?.on("result",h=>{i(h),Y.current.onResult?.(h)})];return()=>{for(let h of x)h?.();l.current=null,K.destroy()}},[r,t,s]);let ue=gt(T=>{l.current?.start(T)},[]),P=gt(()=>{l.current?.retry()},[]),Z=gt(()=>{let T=l.current,f=T?.switchCamera()===!0;return f&&(I(T?.facingMode??null),g(!1),k(!1),u(null),_.current=null),f},[]);return{state:p,gate:b,draining:M,gateLocked:c,frozenPreview:v,reduceMotion:L,rampColour:S,artifacts:O,error:G,result:q,facingMode:E,start:ue,retry:P,switchCamera:Z}}n(qn,"useLivenessHandle");import{useCallback as Hr,useEffect as Ur,useState as Qe}from"react";var Br=new Set(["national_number"]);function jn(e){if(e==null||!e.available||e.selected!==null)return null;let t=e.options.filter(s=>Br.has(s));return t.length>0?{...e,options:t}:null}n(jn,"pending");function $n(e){let[t,s]=Qe(null),[o,r]=Qe(e===void 0),[a,l]=Qe(!1),[p,C]=Qe(!1);Ur(()=>{if(s(null),e===void 0){r(!0);return}let k=!0,c=e.methodChoice;typeof c=="function"?(r(!1),Promise.resolve().then(()=>c.call(e)).then(v=>{k&&s(jn(v))},()=>{}).finally(()=>{k&&r(!0)})):r(!0);let g=e.on("method",v=>s(jn(v)));return()=>{k=!1,g()}},[e]);let b=Hr(async k=>{if(e===void 0)return!1;l(!0),C(!1);try{return await e.selectMethod(k),s(null),!0}catch{return C(!0),!1}finally{l(!1)}},[e]),w=t!==null&&t.options.length===1?t.options[0]:null;return{choice:t,auto:w==="national_number"&&!p?w:null,settled:o,busy:a,failed:p,select:b}}n($n,"useMethodChoice");import{useEffect as Gr,useMemo as Dr,useState as qr}from"react";var jr=["ar","fr","en"];function $r(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}}n($r,"isClipUrl");function zr(e){let t=e.clips;if(typeof t!="object"||t===null)return null;let s={};for(let o of jr){let r=t[o];if(!(typeof r!="object"||r===null))for(let[a,l]of Object.entries(r))!pe(a)||!$r(l)||((s[o]??(s[o]={}))[a]=l)}return Object.keys(s).length>0?s:null}n(zr,"toVoiceClipMap");function zn(e){let[t,s]=qr(null);Gr(()=>{if(s(null),e===void 0)return;let r=!0,a=n(p=>{if(!r)return;let C=typeof p=="object"&&p!==null&&typeof p.setId=="string"?p:null;s(b=>b?.setId===C?.setId?b:C)},"take");try{typeof e.voiceClips=="function"&&Promise.resolve(e.voiceClips()).then(a,()=>a(null))}catch{a(null)}let l=e.on("view",p=>a(p.voice));return()=>{r=!1,l()}},[e]);let o=Dr(()=>t!==null?zr(t):null,[t]);return e===void 0?null:o}n(zn,"useServerVoiceClips");import{jsx as Yn}from"react/jsx-runtime";function Zn({voice:e}){let t=U();return Yn(D,{kind:"chip","aria-pressed":e.enabled,"aria-label":t("capture.voiceGuidance"),"data-testid":"sekyro-voice-toggle",onClick:()=>e.toggle(),children:Yn(ve,{off:!e.enabled,className:"sekyro-icon"})})}n(Zn,"VoiceChip");import{Fragment as Qn,jsx as R,jsxs as we}from"react/jsx-runtime";var Wr=800;function Qr(e){return e===void 0||e!==!1&&e.length===je.length&&je.every(t=>e.includes(t))}n(Qr,"isDefaultTips");function Jr(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}n(Jr,"carriesActivation");function Xr(e){return typeof e=="object"&&e!==null&&!Yr(e)&&"tone"in e&&"text"in e}n(Xr,"isNoticeObject");function eo(e){return e==="starting"||e==="gating"||e==="recording"}n(eo,"isCapturing");function to(e){return e==="captured"||e==="uploading"||e==="checking"}n(to,"isPostCapture");function mi({verification:e,locale:t,dir:s,strings:o,slots:r,autoStart:a=!1,notice:l,startDisabled:p=!1,startLabel:C,tips:b,tipsSummary:w,coach:M,voice:k,onGuidance:c,onCaptured:g,onResult:v,onError:u,onStateChange:L,assetBaseUrl:m,className:S}){let N=Wt(t),O=Le(()=>Zt(t,o),[t,o,N]),d=Le(()=>y=>O[y]??"",[O]),G=s??(t==="ar"?"rtl":"ltr"),F=me(null),q=Zr(wn),i=qn({verification:e,videoRef:F,assetBaseUrl:m,onCaptured:g,onResult:v,onError:u,onStateChange:L}),E=Gn(m,i.state==="idle"&&i.error===null),I=$n(e),_=I.choice!==null,A=An(e),Y=Tn(e),ue=Fn(e),P=Xt(),Z=On(e),T=Z.mode==="assisted",f=T&&P.canChooseFacing,K=k!==!1&&k?.clips===void 0,oe=zn(K?e:void 0),x=lt({locale:t,defaultClips:oe,options:k}),[h,ye]=Wn(null),W=T?h??(P.canChooseFacing?"environment":"user"):"user",ht=Z.settled&&(!T||P.facingSettled),vt=me(null),Ke=me(!1),kt=me(x.unlock);kt.current=x.unlock,le(()=>{let y=vt.current;if(y===null)return;let J=["pointerup","touchend","click","keydown"],ae=n(()=>{for(let Ee of J)y.removeEventListener(Ee,he,!0)},"disarm");function he(Ee){if(Ke.current){ae();return}Jr(Ee)&&(Ke.current=!0,ae(),kt.current())}n(he,"onGesture");for(let Ee of J)y.addEventListener(Ee,he,{capture:!0,passive:!0});return ae},[]);let Ct=Je(()=>{Ke.current||(Ke.current=!0,x.unlock()),i.start({facing:W})},[x.unlock,i.start,W]),bt=Je(()=>i.start({facing:W}),[i.start,W]),Oe=me(!1),Me=i.state==="idle"&&i.error===null,St=!_&&!A.required&&(a===!0||a==="when-permitted"&&P.permission==="granted"),Vt=St&&I.settled&&A.settled&&ht,Jn=a==="when-permitted"&&!P.permissionSettled&&!Oe.current,Rt=St&&Me&&!Oe.current,Xe=(Jn||Rt||!ht)&&E.gate==="ready"?"loading":E.gate;le(()=>{!Vt||!Me||E.gate!=="ready"||Oe.current||(Oe.current=!0,bt())},[Vt,Me,E.gate,bt]);let Xn=Me&&!_&&!A.required&&!(Rt&&E.gate==="ready"),Lt=Je(()=>{i.switchCamera()&&ye(W==="user"?"environment":"user")},[i.switchCamera,W]),wt=i.state!=="idle"&&i.facingMode!==null?i.facingMode:W;le(()=>{let y=F.current?.style;wt==="user"?y?.removeProperty("transform"):y&&(y.transform="none")},[wt]);let Fe=Le(()=>i.artifacts!==null&&typeof URL.createObjectURL=="function"?URL.createObjectURL(i.artifacts.keyframe):null,[i.artifacts]);le(()=>{if(Fe!==null)return()=>URL.revokeObjectURL(Fe)},[Fe]);let Mt=i.frozenPreview??Fe,ge=e!==void 0,H=eo(i.state),ie=to(i.state),He=H||ie,$=i.result,It=i.state==="done"&&$!==null,xt=i.state==="recording"&&i.frozenPreview!==null,et=q!==null,Ie=ie||xt,Nt=ie?"checking":xt?"frozen":i.state==="recording"?"recording":i.gateLocked||i.gate.progress>=1?"locked":i.gate.faceDetected?"aligning":"seeking",Ue=H?i.gate.hint:null,Be=i.state==="starting"?"capture.preparing.title":Ue===null?null:Ue==="center"&&!i.gate.faceDetected?"fcv3.no_face":Dt(Ue),[er,Et]=Wn(null);le(()=>{if(Be!=="fcv3.no_face"){Et(Be);return}if(!H)return;let y=setTimeout(()=>Et(Be),Wr);return()=>clearTimeout(y)},[Be,H]);let tt=H&&typeof M=="string"&&M!=="",_t=T&&H?d("capture.assisted.stage"):null,de=H&&!tt?er:null,nt=tt?M:de===null?"":d(de);ut(x,de,nt,H);let Pt=me(c);Pt.current=c,le(()=>{if(pe(de))try{Pt.current?.(de)}catch(y){console.error("[@sekyro/react] onGuidance threw:",y)}},[de]);let xe=Le(()=>({supported:x.supported,enabled:x.enabled,setEnabled:x.setEnabled,toggle:x.toggle}),[x.supported,x.enabled,x.setEnabled,x.toggle]),rt=r?.voicePrompt,At=rt!==void 0,Tt=k===void 0,Kt=me(!1);le(()=>{!At||!Tt||Kt.current||!Ye()||(Kt.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."))},[At,Tt]);let tr=rt!==void 0?(y,J,ae)=>rt(y,J,ae,xe):x.supported?()=>R(Zn,{voice:xe}):void 0,{summary:ot,summaryPlaying:Ot,toggleSummary:Ft,stopSummary:Ht}=x,Ge=w!==void 0&&w!=="",Ut=Ge?w:d("capture.tips.summary"),Bt=Ge?ot!=="none":ot==="partner"||ot==="default"&&Qr(b),nr=Le(()=>Bt?{playing:Ot,toggle:n(()=>Ft(Ut,{clip:!Ge}),"toggle"),stop:Ht}:void 0,[Bt,Ot,Ft,Ut,Ht,Ge]),rr=Le(()=>({assets:Xe,retryAssets:E.retry,permission:P.permission,permissionSettled:P.permissionSettled,captureMode:Z.mode,facing:W,setFacing:ye,canChooseFacing:f,voice:xe}),[Xe,E.retry,P.permission,P.permissionSettled,Z.mode,f,W,xe]),or=Xr(l)?R(j,{tone:l.tone,testId:"sekyro-host-notice",children:R("span",{children:l.text})}):l??null,se=$!==null&&$.status==="retry"?$:null,Q=It&&$.status==="unavailable"&&!_&&$.reason!=="portrait_required"?$:null,Ne=It&&($.status==="approved"||$.status==="rejected"||$.status==="review")?$:null,De=n((y,J)=>{if(y===void 0)return null;if(y==="device_cooldown"){let he=zt(t,J);if(he!==null)return d(he.key).replace("{time}",he.time)}let ae=$t(y);return ae===null?null:d(ae)},"reasonText"),st=n(y=>{let J=y.retakeHint===void 0?null:qt(y.retakeHint);return J===null?De(y.reason):d(J)},"retryText"),sr=Q!==null&&Q.reason!==void 0&&Q.reason!=="nni_unbound"&&Q.reason!=="id_number_unbound"&&Q.reason!=="method_required"&&Q.reason!=="mobile_required"&&!(Q.reason==="no_recorder"&&i.artifacts?.degraded==="NO_RECORDER"),Gt=qe(),ir=_&&I.auto===null&&!H&&!ie&&i.error===null,it=Je(async y=>{await I.select(y)&&i.state==="done"&&i.retry()},[I.select,i.state,i.retry]);return le(()=>{I.auto!==null&&!I.busy&&!H&&!ie&&it(I.auto)},[I.auto,I.busy,H,ie,it]),R(Qt,{value:d,children:we("div",{ref:vt,className:S===void 0?"sekyro-capture":`sekyro-capture ${S}`,dir:G,lang:t,"data-testid":"sekyro-liveness-capture","data-state":i.state,children:[r?.header,se!==null&&st(se)!==null&&!(et&&He)?R(j,{tone:"warning",role:"status",testId:"sekyro-retry-notice",children:R("span",{children:st(se)})}):null,ue&&ie&&!et?R(j,{tone:"info",role:"status",testId:"sekyro-busy-notice",children:R("span",{children:d("capture.busy")})}):null,A.required&&Me?R(j,{tone:"info",role:"status",testId:"sekyro-mobile-required",children:R("span",{children:d("reasons.mobile_required")})}):null,i.error!==null?r?.errorPanel!==void 0?r.errorPanel(i.error,i.retry):we(j,{tone:"danger",testId:"sekyro-error-notice",children:[R("span",{children:d(jt(i.error.kind))}),i.error.retryable?R(D,{ref:Gt,kind:"ghost",className:"sekyro-btn--start",onClick:i.retry,children:d("common.retry")}):null]}):null,Q!==null?we(j,{tone:"danger",testId:"sekyro-unavailable-notice",children:[R("span",{children:De(Q.reason)??d(Q.reason===void 0?"errors.session_expired":"errors.network_error")}),sr?R(D,{ref:Gt,kind:"ghost",className:"sekyro-btn--start",onClick:i.retry,children:d("capture.recordAgain")}):null]}):null,Ne!==null&&De(Ne.reason)!==null?R(j,{tone:Ne.status==="rejected"?"danger":"info",testId:"sekyro-result-notice",children:R("span",{children:De(Ne.reason,Ne.retryAfter)})}):null,R("div",{className:He?void 0:"sekyro-hidden","data-capture-live":He?"":void 0,children:et?q({videoRef:F,guidance:Ie&&ge?d("capture.checking"):nt,coached:tt&&!(Ie&&ge),note:Ie?ge?d(ue?"capture.busy":"capture.checkingHint"):null:se!==null?st(se):_t,settled:Ie&&ge,progress:i.gate.progress,phase:Nt,still:Ie?Mt:null,live:He,switchCamera:H&&i.state!=="recording"&&f&&Lt,ramp:i.rampColour===null?null:{colour:i.rampColour}}):R(Jt,{videoRef:F,guidanceText:nt,guidanceHint:Ue,guidanceKey:de,progress:i.gate.progress,phase:Nt,draining:i.draining,stillUrl:Mt,showChecking:ge,onSwitchCamera:Lt,canSwitchCamera:T&&H&&i.state!=="recording",operatorText:_t,voicePrompt:tr,overlay:y=>we(Qn,{children:[r?.stageOverlay?.(y),R(en,{colour:i.rampColour})]}),reduceMotion:i.reduceMotion})}),ir&&I.choice!==null?R(mn,{title:d("method.title"),description:d("method.description"),options:I.choice.options.map(y=>({id:y,label:d(`method.${y}`)})),busy:I.busy,error:I.failed?d("errors.network_error"):null,focus:i.state==="done",testId:"sekyro-method",look:"buttons",onChoose:y=>{it(y)}}):null,Xn?we(Qn,{children:[Y&&r?.header===void 0?we("div",{className:"sekyro-stack sekyro-stack--1",children:[R("h2",{className:"sekyro-text-body",children:d("returning.title")}),R("p",{className:"sekyro-text-muted",children:d("returning.description")})]}):null,or,r?.intro!==void 0?r.intro(Ct,rr):R(Pn,{assets:Xe,onRetryAssets:E.retry,permission:P.permission,captureMode:Z.mode,canChooseFacing:f,facing:W,onFacingChange:ye,voice:xe,tips:b??je,summary:nr,startLabel:C,startDisabled:p,onStart:Ct})]}):null,R(Ln,{showCoaching:se!==null,attemptsText:se?.attemptsRemaining!==void 0?Yt(O,t,se.attemptsRemaining):null,showRetake:se!==null&&!H&&!ie||!ge&&i.state==="captured",onRetake:i.retry}),r?.footer]})})}n(mi,"LivenessCapture");export{wn as a,Mn as b,je as c,mn as d,ze as e,Wr as f,mi as g};
2
+ import{a as Jt,c as Xt,d as en}from"./chunk-LNZR3RXG.js";import{a as D,j as Dt,k as qt,l as jt,m as $t,n as zt,o as Yt,p as Zt,q as Wt,r as Qt,s as U,t as j,u as qe}from"./chunk-34326C2I.js";import{a as n}from"./chunk-2KED7D2Q.js";import{useId as cr}from"react";import{Fragment as ar,jsx as V,jsxs as X}from"react/jsx-runtime";function ee({className:e,children:t}){return V("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})}n(ee,"Svg");var at="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 tn(e){return X(ee,{...e,children:[V("circle",{cx:"12",cy:"12",r:"4"}),V("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"})]})}n(tn,"SunIcon");function nn(e){return X(ee,{...e,children:[V("circle",{cx:"12",cy:"12",r:"9"}),V("path",{d:"M9 10h.01M15 10h.01M8.8 14.6a4.2 4.2 0 0 0 6.4 0"})]})}n(nn,"FaceUncoveredIcon");function rn(e){return X(ee,{...e,children:[V("rect",{x:"7",y:"2.5",width:"10",height:"19",rx:"2"}),V("path",{d:"M10.5 18.5h3M2.5 9.5h2.5M19 9.5h2.5"}),V("circle",{cx:"12",cy:"9.5",r:"1.6"})]})}n(rn,"PhoneEyeLevelIcon");function on(e){return X(ee,{...e,children:[V("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"}),V("circle",{cx:"12",cy:"12",r:"2.8"})]})}n(on,"LookStraightIcon");function sn(e){return X(ee,{...e,children:[V("path",{d:at}),V("path",{d:"M9 13l2 2 4-4"})]})}n(sn,"CameraCheckIcon");function an(e){return X(ee,{...e,children:[V("path",{d:at}),V("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"})]})}n(an,"CameraAskIcon");function cn(e){return X(ee,{...e,children:[V("path",{d:at}),V("path",{d:"M3 3l18 18"})]})}n(cn,"CameraBlockedIcon");function ve({off:e,className:t}){return X(ee,{className:t,children:[V("path",{d:"M4.5 9.5v5H8l4 3.5v-12L8 9.5H4.5Z"}),e?V("path",{d:"M4 4l16 16"}):X(ar,{children:[V("path",{d:"M15.5 9.7a3.6 3.6 0 0 1 0 4.6"}),V("path",{d:"M18 7.6a6.6 6.6 0 0 1 0 8.8"})]})]})}n(ve,"SpeakerIcon");function ln(e){return V(ee,{...e,children:V("path",{d:"M5 12.5l4.5 4.5L19 7.5"})})}n(ln,"CheckIcon");function un(e){return X(ee,{className:e.className??"sekyro-spinner",children:[V("circle",{cx:"12",cy:"12",r:"9",opacity:"0.25"}),V("path",{d:"M21 12a9 9 0 0 0-9-9"})]})}n(un,"SpinnerIcon");import{jsx as ce,jsxs as dn}from"react/jsx-runtime";var je=["light","uncover","eyeLevel","straight"],lr={light:{key:"capture.tips.light",icon:n(()=>ce(tn,{}),"icon")},uncover:{key:"capture.tips.uncover",icon:n(()=>ce(nn,{}),"icon")},eyeLevel:{key:"capture.tips.eyeLevel",icon:n(()=>ce(rn,{}),"icon")},straight:{key:"capture.tips.straight",icon:n(()=>ce(on,{}),"icon")}};function pn({tips:e}){let t=U(),s=cr();return e.length===0?null:dn("section",{className:"sekyro-tips","aria-labelledby":s,"data-testid":"sekyro-tips",children:[ce("p",{className:"sekyro-tips__title",id:s,children:t("capture.tips.title")}),ce("ul",{className:"sekyro-tips__list",children:e.map(o=>{let r=typeof o=="string"?lr[o]:void 0,a=typeof o=="string"?o:o.id,l=r!==void 0?r.icon():typeof o=="string"?void 0:o.icon,p=r!==void 0?t(r.key):typeof o=="string"?o:o.text;return dn("li",{className:"sekyro-tips__item",children:[l!=null?ce("span",{className:"sekyro-tips__icon","aria-hidden":"true",children:l}):null,ce("span",{children:p})]},a)})})]})}n(pn,"TipList");import{useEffect as fn,useId as ur,useRef as dr,useState as pr}from"react";import{jsx as te,jsxs as $e}from"react/jsx-runtime";var fr=220;function mn({title:e,description:t,options:s,busy:o,error:r,focus:a,testId:l,look:p="cards",marked:C,onChoose:b}){let w=ur(),M=qe(),[k,c]=pr(null),g=dr(null);fn(()=>{r!==null&&c(null)},[r]),fn(()=>()=>{g.current!==null&&clearTimeout(g.current)},[]);let v=n(u=>{o||k!==null||(c(u),g.current=setTimeout(()=>{g.current=null,c(null),b(u)},fr))},"choose");return $e("section",{className:"sekyro-stack sekyro-stack--4 sekyro-choice","aria-labelledby":w,"data-testid":l,children:[$e("div",{className:"sekyro-stack sekyro-stack--1",children:[te("h2",{id:w,ref:a?M:void 0,tabIndex:-1,className:"sekyro-text-body",children:e}),t!==void 0&&t!==""?te("p",{className:"sekyro-text-muted",children:t}):null]}),r!==null?te(j,{tone:"danger",children:te("span",{children:r})}):null,p==="buttons"?te("div",{className:"sekyro-stack sekyro-stack--3",children:s.map((u,L)=>te(D,{kind:L===0?"primary":"ghost",full:!0,disabled:o,"aria-busy":o||void 0,onClick:()=>b(u.id),children:u.label},u.id))}):te("div",{className:"sekyro-choices",children:s.map(u=>$e("button",{type:"button",className:"sekyro-card","aria-pressed":(k??C)===u.id,"aria-busy":o||void 0,disabled:o||k!==null&&k!==u.id,onClick:()=>v(u.id),children:[u.glyph,$e("span",{className:"sekyro-card__body",children:[te("span",{className:"sekyro-card__title",children:u.label}),u.sub!==void 0?te("span",{className:"sekyro-card__sub",children:u.sub}):null]}),te("span",{className:"sekyro-radio","aria-hidden":"true"})]},u.id))})]})}n(mn,"ChoiceScreen");var ze=["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","capture.tips.summary"];function pe(e){return e!==null&&ze.includes(e)}n(pe,"isVoiceKey");import{useCallback as re,useEffect as fe,useLayoutEffect as hr,useMemo as vr,useRef as Ce,useState as Pe}from"react";var mr=n((e,t)=>Object.prototype.hasOwnProperty.call(e,t),"own");function ke(e,t,s){let o;try{if(typeof e=="function")o=e(t,s);else{let r=e[s];o=r!=null&&mr(r,t)?r[t]:null}}catch{return null}return typeof o=="string"&&o!==""?o:null}n(ke,"resolveClip");var yr="UklGRiQAAABXQVZFZm10IBAAAAABAAEAESsAACJWAAACABAAZGF0YQAAAAA=",hn={ar:"ar-SA",fr:"fr-FR",en:"en-US",es:"es-ES",pt:"pt-BR",de:"de-DE"};function ne(){return typeof window<"u"&&"speechSynthesis"in window?window.speechSynthesis:null}n(ne,"synth");function gr(){return ne()!==null&&typeof SpeechSynthesisUtterance=="function"}n(gr,"speechAvailable");function yn(e){return(e.split(/[-_]/)[0]??e).toLowerCase()}n(yn,"baseLang");function vn(e,t){let s=n(r=>r.replace(/_/g,"-").toLowerCase(),"norm"),o=yn(t);return e.find(r=>s(r.lang)===s(t))??e.find(r=>yn(r.lang)===o)}n(vn,"pickVoice");function kn(e){if(!gr())return!1;let t=[];try{t=ne()?.getVoices()??[]}catch{return!0}return t.length===0||vn(t,e)!==void 0}n(kn,"speechUsable");function Cn(e){let t=ne();return t===null||typeof t.addEventListener!="function"?()=>{}:(t.addEventListener("voiceschanged",e),()=>t.removeEventListener?.("voiceschanged",e))}n(Cn,"subscribeVoices");function _e(e){try{let t=typeof location<"u"?location.href:"http://localhost/",s=new URL(e,t);return`clip:${s.origin}${s.pathname}`}catch{return`clip:${e}`}}n(_e,"clipIdentity");function gn(e){e.pause(),e.removeAttribute("src"),e.load()}n(gn,"release");function bn(){let e=null,t=null,s=0,o=null,r=[],a=new Map,l=n(()=>{r=ne()?.getVoices()??[]},"loadVoices"),p=!1,C=n(()=>{let c=ne();p||c===null||(p=!0,l(),c.addEventListener?.("voiceschanged",l))},"bindVoices"),b=n(()=>(e??(e=new Audio),e),"element"),w=n((c,g,v)=>{let u=ne();if(u!==null&&c!==""&&typeof SpeechSynthesisUtterance=="function"){C();let L=vn(r,g);if(r.length===0||L!==void 0){u.cancel();let m=new SpeechSynthesisUtterance(c);m.lang=g,L!==void 0&&(m.voice=L),m.rate=.95,v!==void 0&&(m.onend=m.onerror=v),u.speak(m);return}}v?.()},"speak"),M=n(()=>{s+=1,o=null,e!==null&&(e.pause(),e.currentTime=0),ne()?.cancel()},"stop"),k=n(c=>{for(let g of c){let v=_e(g);if(a.has(v))continue;let u=new Audio;u.preload="auto",u.src=g,a.set(v,u)}},"warmClips");return{say(c){let g=c.url!==null?_e(c.url):`tts:${c.lang}:${c.text}`;if(g===o)return;o=g,s+=1;let v=s,u=c.onEnd,L=u!==void 0?()=>{v===s&&u()}:void 0;if(ne()?.cancel(),c.url!==null){let m=b();m.pause(),m.muted=!1,m.src=c.url,m.currentTime=0,m.onended=L??null,m.play()?.catch(S=>{v===s&&S?.name!=="AbortError"&&(c.speech?w(c.text,c.lang,L):L?.())});return}c.speech?w(c.text,c.lang,L):L?.()},unlock({lang:c,speech:g,prefetch:v}){let u=b();if(t===null&&typeof Blob=="function"&&typeof URL.createObjectURL=="function"){let S=Uint8Array.from(atob(yr),N=>N.charCodeAt(0));t=URL.createObjectURL(new Blob([S],{type:"audio/wav"}))}let L=u.paused===!1&&t!==null&&u.src!==t;t!==null&&!L&&(u.muted=!0,u.onended=null,u.src=t,u.play()?.catch(()=>{}));let m=ne();if(g&&m!==null&&typeof SpeechSynthesisUtterance=="function"){C();let S=new SpeechSynthesisUtterance(" ");S.volume=0,S.lang=c,m.speak(S)}k(v??[])},prefetch:k,stop:M,dispose(){M(),p&&ne()?.removeEventListener?.("voiceschanged",l),p=!1,t!==null&&URL.revokeObjectURL(t),t=null,e!==null&&gn(e),e=null;for(let c of a.values())gn(c);a.clear()}}}n(bn,"createVoicePlayer");var Sn="sekyro.voiceGuidance";function Vn(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}}n(Vn,"readVoicePreference");function Rn(e,t){try{if(typeof window>"u")return;window.localStorage.setItem(e,t?"1":"0")}catch{}}n(Rn,"writeVoicePreference");var Ae="capture.tips.summary",kr=typeof window<"u"?hr:fe,Cr=Object.freeze({});function ct(e,t){let s=new Set,o=[];for(let r of ze){let a=r===Ae?null:ke(e,r,t);a===null||s.has(_e(a))||(s.add(_e(a)),o.push(a))}return o}n(ct,"resolvedClipUrls");function lt({locale:e,defaultClips:t,options:s}){let o=s===!1,r=o?{}:s??{},a=r.storageKey===void 0?Sn:r.storageKey,[l,p]=Pe(r.defaultEnabled??!0),C=Ce(l),[b,w]=Pe(!1),[M,k]=Pe("none"),[c,g]=Pe(!1),v=Ce(!1),[u,L]=Pe(0),m=Ce(null),S=re(()=>(m.current??(m.current=bn()),m.current),[]),N=hn[e],O=r.speechFallback,d=O===void 0||O===!0?!0:O===!1?!1:O.includes(e),G=r.clips??t??Cr,F=Ce(!1),q=Ce(G);kr(()=>{q.current=G,C.current=l}),fe(()=>{if(o||a===null)return;let f=Vn(a);f!==null&&(C.current=f,p(f))},[o,a]),fe(()=>{if(!(o||!d))return Cn(()=>L(f=>f+1))},[o,d]);let i=r.clips;fe(()=>{if(o)return;let f=d&&kn(N);w(ct(G,e).length>0||f),k(i!==void 0&&ke(i,Ae,e)!==null?"partner":ke(G,Ae,e)!==null||f?"default":"none")},[o,G,i,e,d,N,u]),fe(()=>{if(o||!l||!F.current)return;let f=ct(G,e);f.length>0&&S().prefetch(f)},[o,l,G,e,S]),fe(()=>()=>{m.current?.dispose(),m.current=null,F.current=!1},[]);let E=re(f=>{o||(F.current=!0,S().unlock({lang:N,speech:d,...f?{prefetch:ct(q.current,e)}:{}}))},[o,S,N,d,e]),I=re(()=>E(C.current),[E]),_=re(()=>{v.current=!1,g(!1)},[]),A=re(()=>{_(),m.current?.stop()},[_]),Y=re(()=>{v.current&&A()},[A]),ue=re((f,K)=>{if(o)return;if(v.current){A();return}let oe=S();oe.stop(),v.current=!0,g(!0);let x=K?.clip===!1?null:ke(q.current,Ae,e);oe.say({url:x,text:f,lang:N,speech:d,onEnd:_})},[o,A,S,e,N,d,_]),P=re(f=>{o||(f?E(!0):A(),a!==null&&Rn(a,f),C.current=f,p(f))},[o,E,A,a]),Z=re(()=>P(!C.current),[P]),T=re((f,K)=>{if(o||!l)return;v.current&&_();let oe=ke(q.current,f,e);S().say({url:oe,text:K,lang:N,speech:d})},[o,l,e,S,N,d,_]);return vr(()=>({supported:!o&&b,enabled:!o&&l,setEnabled:P,toggle:Z,unlock:I,speakKey:T,stop:A,summary:o?"none":M,summaryPlaying:c,toggleSummary:ue,stopSummary:Y}),[o,b,l,P,Z,I,T,A,M,c,ue,Y])}n(lt,"useVoiceGuidance");function ut(e,t,s,o){let{speakKey:r,stop:a,enabled:l}=e,p=Ce(!1);fe(()=>{if(!o||!l){p.current&&a(),p.current=!1;return}p.current=!0,pe(t)&&t!==Ae&&s!==""&&r(t,s)},[o,l,t,s,r,a])}n(ut,"useSpeakGuidance");import{isValidElement as Yr,useCallback as Je,useContext as Zr,useEffect as le,useMemo as Le,useRef as me,useState as Wn}from"react";import{useEffect as br,useRef as Sr}from"react";import{jsx as be,jsxs as dt}from"react/jsx-runtime";function Ln({showCoaching:e,attemptsText:t,showRetake:s,onRetake:o}){let r=U(),a=Sr(null);return br(()=>{s&&a.current?.focus()},[s]),!e&&!s?null:dt("div",{className:"sekyro-stack sekyro-stack--3","data-testid":"sekyro-captured-panel",children:[e?dt("div",{className:"sekyro-stack sekyro-stack--1",children:[be("p",{className:"sekyro-text-body",children:r("capture.retryCoaching.title")}),dt("ul",{className:"sekyro-coaching",children:[be("li",{children:r("capture.retryCoaching.light")}),be("li",{children:r("capture.retryCoaching.eyeLevel")}),be("li",{children:r("capture.retryCoaching.head")})]}),t!==null?be("p",{className:"sekyro-text-muted","data-testid":"sekyro-attempts-remaining",children:t}):null]}):null,s?be(D,{ref:a,className:"sekyro-btn--start",onClick:o,children:r("capture.recordAgain")}):null]})}n(Ln,"CapturedPanel");function Ye(){try{return process.env.NODE_ENV!=="production"}catch{return!1}}n(Ye,"isDevBuild");import{createContext as Vr}from"react";var wn=Vr(null);import{useCallback as En,useEffect as _n,useRef as Se}from"react";import{useId as Rr}from"react";import{jsx as Ze,jsxs as pt}from"react/jsx-runtime";var Lr=["user","environment"];function Mn({value:e,onChange:t}){let s=U(),o=Rr();return pt("fieldset",{className:"sekyro-segmented","data-testid":"sekyro-facing",children:[Ze("legend",{className:"sekyro-segmented__legend",children:s("capture.cameraLabel")}),Ze("div",{className:"sekyro-segmented__options",children:Lr.map(r=>pt("label",{className:"sekyro-segmented__option",children:[Ze("input",{type:"radio",className:"sekyro-segmented__input",name:o,value:r,checked:e===r,onChange:()=>t(r)}),pt("span",{className:"sekyro-segmented__face",children:[Ze("span",{className:"sekyro-segmented__dot","aria-hidden":"true"}),s(`capture.facing.${r}`)]})]},r))})]})}n(Mn,"FacingPicker");import{useEffect as wr,useState as Mr}from"react";import{jsx as Te,jsxs as Ir}from"react/jsx-runtime";function In({state:e}){let t=U(),[s,o]=Mr(!1);wr(()=>{e!=="unknown"&&o(!0)},[e]);let r=e==="granted"?Te(sn,{}):e==="denied"?Te(cn,{}):Te(an,{});return Ir("div",{role:s?"status":void 0,className:`sekyro-permission sekyro-permission--${e}`,"data-testid":"sekyro-permission","data-state":e,children:[Te("span",{className:"sekyro-permission__icon","aria-hidden":"true",children:r}),Te("span",{children:t(`capture.permission.${e}`)})]})}n(In,"PermissionRow");import{jsx as We,jsxs as xn}from"react/jsx-runtime";function Nn({voice:e}){let t=U();if(!e.supported)return null;let s=e.enabled;return xn("button",{type:"button",role:"switch","aria-checked":s,className:"sekyro-switch","data-testid":"sekyro-voice-switch",onClick:()=>e.toggle(),children:[xn("span",{className:"sekyro-switch__label",children:[We(ve,{off:!s}),t("capture.voiceGuidance")]}),We("span",{className:"sekyro-switch__track","aria-hidden":"true",children:We("span",{className:"sekyro-switch__thumb",children:s?We(ln,{className:"sekyro-switch__check"}):null})})]})}n(Nn,"VoiceSwitch");import{Fragment as Nr,jsx as B,jsxs as Ve}from"react/jsx-runtime";function Pn({assets:e,onRetryAssets:t,permission:s,captureMode:o="self",canChooseFacing:r,facing:a,onFacingChange:l,voice:p,tips:C,summary:b,startLabel:w,startDisabled:M,onStart:k}){let c=U(),g=Se(b?.stop);g.current=b?.stop,_n(()=>()=>g.current?.(),[]);let v=Se(null),u=Se(null),L=Se(null),m=Se(e),S=Se(!1);_n(()=>{let i=m.current;if(m.current=e,i===e)return;let E=S.current;e!=="loading"&&(S.current=!1),xr(v.current)&&(e==="failed"?L.current?.focus():E&&u.current?.focus())},[e]);let N=En(()=>{S.current=!0,t()},[t]),O=e==="loading",d=O||M,G=En(()=>{d||(g.current?.(),k())},[d,k]),F;e==="failed"?F=Ve(j,{tone:"danger",testId:"sekyro-assets-error",children:[B("p",{className:"sekyro-text-body",children:c("fcv2.err.models")}),B(D,{kind:"ghost",ref:L,className:"sekyro-btn--start",onClick:N,"data-testid":"sekyro-assets-retry",children:c("common.retry")})]}):F=Ve("div",{className:"sekyro-stack sekyro-stack--1",children:[B(D,{ref:u,full:!0,"data-testid":"sekyro-start","aria-disabled":d?"true":void 0,"aria-busy":O?"true":void 0,onClick:G,children:O?Ve(Nr,{children:[B(un,{}),c("capture.preparing.title")]}):w??c("capture.start")}),O?B("p",{className:"sekyro-text-muted",children:c("capture.preparing.hint")}):null]});let q=o==="assisted";return Ve("div",{ref:v,className:"sekyro-stack sekyro-stack--4","data-testid":"sekyro-intro","data-assets":e,children:[q?Ve("div",{className:"sekyro-stack sekyro-stack--1","data-testid":"sekyro-assisted-intro",children:[B("h2",{className:"sekyro-text-body",children:c("capture.assisted.title")}),B("p",{className:"sekyro-text-muted",children:c("capture.assisted.lead")})]}):null,C!==!1?B(pn,{tips:C}):null,b!==void 0?Ve(D,{kind:"ghost",className:"sekyro-btn--start",onClick:b.toggle,"data-testid":"sekyro-tips-listen",children:[B(ve,{off:!1}),c(b.playing?"capture.tips.stop":"capture.tips.listen")]}):null,B(In,{state:s}),q&&r?B(Mn,{value:a,onChange:l}):null,B(Nn,{voice:p}),B("p",{className:"sekyro-text-muted",children:c("capture.securityNote")}),F,B("p",{role:"status",className:"sekyro-visually-hidden","data-testid":"sekyro-intro-status",children:e==="loading"?c("capture.preparing.title"):e==="ready"?c("capture.ready"):""})]})}n(Pn,"PreCaptureScreen");function xr(e){if(typeof document>"u")return!1;let t=document.activeElement;return t===null||t===document.body||e!==null&&e.contains(t)}n(xr,"focusIsOurs");import{useEffect as ft,useState as mt}from"react";function An(e){return Kn(e,"mobileRequired")}n(An,"useMobileRequired");function Tn(e){return Kn(e,"returning").required}n(Tn,"useReturning");function Kn(e,t){let[s,o]=mt({required:!1,settled:e===void 0});return ft(()=>{let r=e?.[t];if(e===void 0||typeof r!="function"){o({required:!1,settled:!0});return}let a=!0;return o({required:!1,settled:!1}),Promise.resolve().then(()=>r.call(e)).then(l=>{a&&o({required:l===!0,settled:!0})},()=>{a&&o({required:!1,settled:!0})}),()=>{a=!1}},[e,t]),s}n(Kn,"useFlag");function On(e){let[t,s]=mt({mode:"self",settled:e===void 0});return ft(()=>{let o=e?.captureMode;if(e===void 0||typeof o!="function"){s({mode:"self",settled:!0});return}let r=!0;return s({mode:"self",settled:!1}),Promise.resolve().then(()=>o.call(e)).then(a=>{r&&s({mode:a==="assisted"?"assisted":"self",settled:!0})},()=>{r&&s({mode:"self",settled:!0})}),()=>{r=!1}},[e]),t}n(On,"useCaptureMode");function Fn(e){let[t,s]=mt(!1);return ft(()=>{if(s(!1),e===void 0)return;let o=e.on("busy",()=>s(!0)),r=e.on("result",()=>s(!1));return()=>{o(),r()}},[e]),t}n(Fn,"useBusy");import{getLivenessAssetsStatus as Er,preloadLivenessAssets as _r,subscribeLivenessAssets as Pr}from"@sekyro/web";import{useCallback as yt,useEffect as Hn,useRef as Un,useState as Ar,useSyncExternalStore as Tr}from"react";var Kr=n(()=>"idle","serverSnapshot");function Bn(e){return _r(e!==void 0?{assetBaseUrl:e}:{})}n(Bn,"preload");function Gn(e,t=!0){let s=Tr(yt(M=>Pr(M,e),[e]),()=>Er(e),Kr),[o,r]=Ar(null),a=Un(!1),l=yt(()=>{Bn(e).then(M=>{a.current&&M==="idle"&&r({base:e})})},[e]);Hn(()=>(a.current=!0,l(),()=>{a.current=!1}),[l]);let p=Un(null);Hn(()=>{if(s!=="idle"){p.current={base:e};return}!t||p.current===null||p.current.base!==e||(p.current=null,l())},[s,e,l,t]);let C=yt(()=>{Bn(e)},[e]);return{gate:o!==null&&o.base===e&&s==="idle"||s==="ready"?"ready":s==="failed"?"failed":"loading",retry:C}}n(Gn,"useLivenessAssets");import{createLivenessCapture as Or}from"@sekyro/web";import{useCallback as gt,useEffect as Fr,useRef as Re,useState as z}from"react";var Dn={progress:0,hint:null,faceDetected:!1};function qn(e){let{videoRef:t,assetBaseUrl:s}=e,r=Re(e.verification).current,a=Re(!1);e.verification!==r&&!a.current&&Ye()&&(a.current=!0,console.warn("[@sekyro/react] <LivenessCapture>: the `verification` prop changed identity after mount. The first instance stays bound (the camera is not rebuilt); create the verification once (useMemo / useState / outside render) instead of on every render."));let l=Re(null),[p,C]=z("idle"),[b,w]=z(Dn),[M,k]=z(!1),[c,g]=z(!1),[v,u]=z(null),[L,m]=z(!1),[S,N]=z(null),[O,d]=z(null),[G,F]=z(null),[q,i]=z(null),[E,I]=z(null),_=Re(null),A=Re("idle"),Y=Re(e);Y.current=e,Fr(()=>{let T=t.current;if(T===null)return;let f={video:T,...s!==void 0?{assetBaseUrl:s}:{}},K=r!==void 0?r.liveness(f):Or(f);l.current=K;let oe=n(()=>I(K.facingMode??null),"readFacing");oe();let x=[K.on("state",h=>{h==="starting"?(d(null),F(null),w(Dn),g(!1),k(!1),u(null),N(null),_.current=null):h==="gating"&&A.current==="recording"&&(g(!1),k(!1),u(null),_.current=null),A.current=h,oe(),C(h),Y.current.onStateChange?.(h)}),K.on("gate",h=>{let ye=_.current;_.current=h.progress,k(ye!==null&&h.progress<ye-.001&&h.progress>0&&h.progress<1),h.progress>=1&&g(!0),w(h)}),K.on("frozen",({previewDataUrl:h})=>u(h)),K.on("profile",({animations:h})=>m(h==="reduced")),K.on("ramp",({colour:h})=>N(h)),K.on("captured",h=>{d(h),i(null),Y.current.onCaptured?.(h)}),K.on("error",h=>{F(h),Y.current.onError?.(h)}),r?.on("result",h=>{i(h),Y.current.onResult?.(h)})];return()=>{for(let h of x)h?.();l.current=null,K.destroy()}},[r,t,s]);let ue=gt(T=>{l.current?.start(T)},[]),P=gt(()=>{l.current?.retry()},[]),Z=gt(()=>{let T=l.current,f=T?.switchCamera()===!0;return f&&(I(T?.facingMode??null),g(!1),k(!1),u(null),_.current=null),f},[]);return{state:p,gate:b,draining:M,gateLocked:c,frozenPreview:v,reduceMotion:L,rampColour:S,artifacts:O,error:G,result:q,facingMode:E,start:ue,retry:P,switchCamera:Z}}n(qn,"useLivenessHandle");import{useCallback as Hr,useEffect as Ur,useState as Qe}from"react";var Br=new Set(["national_number"]);function jn(e){if(e==null||!e.available||e.selected!==null)return null;let t=e.options.filter(s=>Br.has(s));return t.length>0?{...e,options:t}:null}n(jn,"pending");function $n(e){let[t,s]=Qe(null),[o,r]=Qe(e===void 0),[a,l]=Qe(!1),[p,C]=Qe(!1);Ur(()=>{if(s(null),e===void 0){r(!0);return}let k=!0,c=e.methodChoice;typeof c=="function"?(r(!1),Promise.resolve().then(()=>c.call(e)).then(v=>{k&&s(jn(v))},()=>{}).finally(()=>{k&&r(!0)})):r(!0);let g=e.on("method",v=>s(jn(v)));return()=>{k=!1,g()}},[e]);let b=Hr(async k=>{if(e===void 0)return!1;l(!0),C(!1);try{return await e.selectMethod(k),s(null),!0}catch{return C(!0),!1}finally{l(!1)}},[e]),w=t!==null&&t.options.length===1?t.options[0]:null;return{choice:t,auto:w==="national_number"&&!p?w:null,settled:o,busy:a,failed:p,select:b}}n($n,"useMethodChoice");import{useEffect as Gr,useMemo as Dr,useState as qr}from"react";var jr=["ar","fr","en"];function $r(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}}n($r,"isClipUrl");function zr(e){let t=e.clips;if(typeof t!="object"||t===null)return null;let s={};for(let o of jr){let r=t[o];if(!(typeof r!="object"||r===null))for(let[a,l]of Object.entries(r))!pe(a)||!$r(l)||((s[o]??(s[o]={}))[a]=l)}return Object.keys(s).length>0?s:null}n(zr,"toVoiceClipMap");function zn(e){let[t,s]=qr(null);Gr(()=>{if(s(null),e===void 0)return;let r=!0,a=n(p=>{if(!r)return;let C=typeof p=="object"&&p!==null&&typeof p.setId=="string"?p:null;s(b=>b?.setId===C?.setId?b:C)},"take");try{typeof e.voiceClips=="function"&&Promise.resolve(e.voiceClips()).then(a,()=>a(null))}catch{a(null)}let l=e.on("view",p=>a(p.voice));return()=>{r=!1,l()}},[e]);let o=Dr(()=>t!==null?zr(t):null,[t]);return e===void 0?null:o}n(zn,"useServerVoiceClips");import{jsx as Yn}from"react/jsx-runtime";function Zn({voice:e}){let t=U();return Yn(D,{kind:"chip","aria-pressed":e.enabled,"aria-label":t("capture.voiceGuidance"),"data-testid":"sekyro-voice-toggle",onClick:()=>e.toggle(),children:Yn(ve,{off:!e.enabled,className:"sekyro-icon"})})}n(Zn,"VoiceChip");import{Fragment as Qn,jsx as R,jsxs as we}from"react/jsx-runtime";var Wr=800;function Qr(e){return e===void 0||e!==!1&&e.length===je.length&&je.every(t=>e.includes(t))}n(Qr,"isDefaultTips");function Jr(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}n(Jr,"carriesActivation");function Xr(e){return typeof e=="object"&&e!==null&&!Yr(e)&&"tone"in e&&"text"in e}n(Xr,"isNoticeObject");function eo(e){return e==="starting"||e==="gating"||e==="recording"}n(eo,"isCapturing");function to(e){return e==="captured"||e==="uploading"||e==="checking"}n(to,"isPostCapture");function mi({verification:e,locale:t,dir:s,strings:o,slots:r,autoStart:a=!1,notice:l,startDisabled:p=!1,startLabel:C,tips:b,tipsSummary:w,coach:M,voice:k,onGuidance:c,onCaptured:g,onResult:v,onError:u,onStateChange:L,assetBaseUrl:m,className:S}){let N=Wt(t),O=Le(()=>Zt(t,o),[t,o,N]),d=Le(()=>y=>O[y]??"",[O]),G=s??(t==="ar"?"rtl":"ltr"),F=me(null),q=Zr(wn),i=qn({verification:e,videoRef:F,assetBaseUrl:m,onCaptured:g,onResult:v,onError:u,onStateChange:L}),E=Gn(m,i.state==="idle"&&i.error===null),I=$n(e),_=I.choice!==null,A=An(e),Y=Tn(e),ue=Fn(e),P=Xt(),Z=On(e),T=Z.mode==="assisted",f=T&&P.canChooseFacing,K=k!==!1&&k?.clips===void 0,oe=zn(K?e:void 0),x=lt({locale:t,defaultClips:oe,options:k}),[h,ye]=Wn(null),W=T?h??(P.canChooseFacing?"environment":"user"):"user",ht=Z.settled&&(!T||P.facingSettled),vt=me(null),Ke=me(!1),kt=me(x.unlock);kt.current=x.unlock,le(()=>{let y=vt.current;if(y===null)return;let J=["pointerup","touchend","click","keydown"],ae=n(()=>{for(let Ee of J)y.removeEventListener(Ee,he,!0)},"disarm");function he(Ee){if(Ke.current){ae();return}Jr(Ee)&&(Ke.current=!0,ae(),kt.current())}n(he,"onGesture");for(let Ee of J)y.addEventListener(Ee,he,{capture:!0,passive:!0});return ae},[]);let Ct=Je(()=>{Ke.current||(Ke.current=!0,x.unlock()),i.start({facing:W})},[x.unlock,i.start,W]),bt=Je(()=>i.start({facing:W}),[i.start,W]),Oe=me(!1),Me=i.state==="idle"&&i.error===null,St=!_&&!A.required&&(a===!0||a==="when-permitted"&&P.permission==="granted"),Vt=St&&I.settled&&A.settled&&ht,Jn=a==="when-permitted"&&!P.permissionSettled&&!Oe.current,Rt=St&&Me&&!Oe.current,Xe=(Jn||Rt||!ht)&&E.gate==="ready"?"loading":E.gate;le(()=>{!Vt||!Me||E.gate!=="ready"||Oe.current||(Oe.current=!0,bt())},[Vt,Me,E.gate,bt]);let Xn=Me&&!_&&!A.required&&!(Rt&&E.gate==="ready"),Lt=Je(()=>{i.switchCamera()&&ye(W==="user"?"environment":"user")},[i.switchCamera,W]),wt=i.state!=="idle"&&i.facingMode!==null?i.facingMode:W;le(()=>{let y=F.current?.style;wt==="user"?y?.removeProperty("transform"):y&&(y.transform="none")},[wt]);let Fe=Le(()=>i.artifacts!==null&&typeof URL.createObjectURL=="function"?URL.createObjectURL(i.artifacts.keyframe):null,[i.artifacts]);le(()=>{if(Fe!==null)return()=>URL.revokeObjectURL(Fe)},[Fe]);let Mt=i.frozenPreview??Fe,ge=e!==void 0,H=eo(i.state),ie=to(i.state),He=H||ie,$=i.result,It=i.state==="done"&&$!==null,xt=i.state==="recording"&&i.frozenPreview!==null,et=q!==null,Ie=ie||xt,Nt=ie?"checking":xt?"frozen":i.state==="recording"?"recording":i.gateLocked||i.gate.progress>=1?"locked":i.gate.faceDetected?"aligning":"seeking",Ue=H?i.gate.hint:null,Be=i.state==="starting"?"capture.preparing.title":Ue===null?null:Ue==="center"&&!i.gate.faceDetected?"fcv3.no_face":Dt(Ue),[er,Et]=Wn(null);le(()=>{if(Be!=="fcv3.no_face"){Et(Be);return}if(!H)return;let y=setTimeout(()=>Et(Be),Wr);return()=>clearTimeout(y)},[Be,H]);let tt=H&&typeof M=="string"&&M!=="",_t=T&&H?d("capture.assisted.stage"):null,de=H&&!tt?er:null,nt=tt?M:de===null?"":d(de);ut(x,de,nt,H);let Pt=me(c);Pt.current=c,le(()=>{if(pe(de))try{Pt.current?.(de)}catch(y){console.error("[@sekyro/react] onGuidance threw:",y)}},[de]);let xe=Le(()=>({supported:x.supported,enabled:x.enabled,setEnabled:x.setEnabled,toggle:x.toggle}),[x.supported,x.enabled,x.setEnabled,x.toggle]),rt=r?.voicePrompt,At=rt!==void 0,Tt=k===void 0,Kt=me(!1);le(()=>{!At||!Tt||Kt.current||!Ye()||(Kt.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."))},[At,Tt]);let tr=rt!==void 0?(y,J,ae)=>rt(y,J,ae,xe):x.supported?()=>R(Zn,{voice:xe}):void 0,{summary:ot,summaryPlaying:Ot,toggleSummary:Ft,stopSummary:Ht}=x,Ge=w!==void 0&&w!=="",Ut=Ge?w:d("capture.tips.summary"),Bt=Ge?ot!=="none":ot==="partner"||ot==="default"&&Qr(b),nr=Le(()=>Bt?{playing:Ot,toggle:n(()=>Ft(Ut,{clip:!Ge}),"toggle"),stop:Ht}:void 0,[Bt,Ot,Ft,Ut,Ht,Ge]),rr=Le(()=>({assets:Xe,retryAssets:E.retry,permission:P.permission,permissionSettled:P.permissionSettled,captureMode:Z.mode,facing:W,setFacing:ye,canChooseFacing:f,voice:xe}),[Xe,E.retry,P.permission,P.permissionSettled,Z.mode,f,W,xe]),or=Xr(l)?R(j,{tone:l.tone,testId:"sekyro-host-notice",children:R("span",{children:l.text})}):l??null,se=$!==null&&$.status==="retry"?$:null,Q=It&&$.status==="unavailable"&&!_&&$.reason!=="portrait_required"?$:null,Ne=It&&($.status==="approved"||$.status==="rejected"||$.status==="review")?$:null,De=n((y,J)=>{if(y===void 0)return null;if(y==="device_cooldown"){let he=zt(t,J);if(he!==null)return d(he.key).replace("{time}",he.time)}let ae=$t(y);return ae===null?null:d(ae)},"reasonText"),st=n(y=>{let J=y.retakeHint===void 0?null:qt(y.retakeHint);return J===null?De(y.reason):d(J)},"retryText"),sr=Q!==null&&Q.reason!==void 0&&Q.reason!=="nni_unbound"&&Q.reason!=="id_number_unbound"&&Q.reason!=="method_required"&&Q.reason!=="mobile_required"&&!(Q.reason==="no_recorder"&&i.artifacts?.degraded==="NO_RECORDER"),Gt=qe(),ir=_&&I.auto===null&&!H&&!ie&&i.error===null,it=Je(async y=>{await I.select(y)&&i.state==="done"&&i.retry()},[I.select,i.state,i.retry]);return le(()=>{I.auto!==null&&!I.busy&&!H&&!ie&&it(I.auto)},[I.auto,I.busy,H,ie,it]),R(Qt,{value:d,children:we("div",{ref:vt,className:S===void 0?"sekyro-capture":`sekyro-capture ${S}`,dir:G,lang:t,"data-testid":"sekyro-liveness-capture","data-state":i.state,children:[r?.header,se!==null&&st(se)!==null&&!(et&&He)?R(j,{tone:"warning",role:"status",testId:"sekyro-retry-notice",children:R("span",{children:st(se)})}):null,ue&&ie&&!et?R(j,{tone:"info",role:"status",testId:"sekyro-busy-notice",children:R("span",{children:d("capture.busy")})}):null,A.required&&Me?R(j,{tone:"info",role:"status",testId:"sekyro-mobile-required",children:R("span",{children:d("reasons.mobile_required")})}):null,i.error!==null?r?.errorPanel!==void 0?r.errorPanel(i.error,i.retry):we(j,{tone:"danger",testId:"sekyro-error-notice",children:[R("span",{children:d(jt(i.error.kind))}),i.error.retryable?R(D,{ref:Gt,kind:"ghost",className:"sekyro-btn--start",onClick:i.retry,children:d("common.retry")}):null]}):null,Q!==null?we(j,{tone:"danger",testId:"sekyro-unavailable-notice",children:[R("span",{children:De(Q.reason)??d(Q.reason===void 0?"errors.session_expired":"errors.network_error")}),sr?R(D,{ref:Gt,kind:"ghost",className:"sekyro-btn--start",onClick:i.retry,children:d("capture.recordAgain")}):null]}):null,Ne!==null&&De(Ne.reason)!==null?R(j,{tone:Ne.status==="rejected"?"danger":"info",testId:"sekyro-result-notice",children:R("span",{children:De(Ne.reason,Ne.retryAfter)})}):null,R("div",{className:He?void 0:"sekyro-hidden","data-capture-live":He?"":void 0,children:et?q({videoRef:F,guidance:Ie&&ge?d("capture.checking"):nt,coached:tt&&!(Ie&&ge),note:Ie?ge?d(ue?"capture.busy":"capture.checkingHint"):null:se!==null?st(se):_t,settled:Ie&&ge,progress:i.gate.progress,phase:Nt,still:Ie?Mt:null,live:He,switchCamera:H&&i.state!=="recording"&&f&&Lt,ramp:i.rampColour===null?null:{colour:i.rampColour}}):R(Jt,{videoRef:F,guidanceText:nt,guidanceHint:Ue,guidanceKey:de,progress:i.gate.progress,phase:Nt,draining:i.draining,stillUrl:Mt,showChecking:ge,onSwitchCamera:Lt,canSwitchCamera:T&&H&&i.state!=="recording",operatorText:_t,voicePrompt:tr,overlay:y=>we(Qn,{children:[r?.stageOverlay?.(y),R(en,{colour:i.rampColour})]}),reduceMotion:i.reduceMotion})}),ir&&I.choice!==null?R(mn,{title:d("method.title"),description:d("method.description"),options:I.choice.options.map(y=>({id:y,label:d(`method.${y}`)})),busy:I.busy,error:I.failed?d("errors.network_error"):null,focus:i.state==="done",testId:"sekyro-method",look:"buttons",onChoose:y=>{it(y)}}):null,Xn?we(Qn,{children:[Y&&r?.header===void 0?we("div",{className:"sekyro-stack sekyro-stack--1",children:[R("h2",{className:"sekyro-text-body",children:d("returning.title")}),R("p",{className:"sekyro-text-muted",children:d("returning.description")})]}):null,or,r?.intro!==void 0?r.intro(Ct,rr):R(Pn,{assets:Xe,onRetryAssets:E.retry,permission:P.permission,captureMode:Z.mode,canChooseFacing:f,facing:W,onFacingChange:ye,voice:xe,tips:b??je,summary:nr,startLabel:C,startDisabled:p,onStart:Ct})]}):null,R(Ln,{showCoaching:se!==null,attemptsText:se?.attemptsRemaining!==void 0?Yt(O,t,se.attemptsRemaining):null,showRetake:se!==null&&!H&&!ie||!ge&&i.state==="captured",onRetake:i.retry}),r?.footer]})})}n(mi,"LivenessCapture");export{Ye as a,wn as b,Mn as c,je as d,mn as e,ze as f,Wr as g,mi as h};
@@ -1,2 +1,2 @@
1
1
  "use client";
2
- import{a as U,b as R,c as N,d as Y}from"./chunk-IDZNOWTO.js";import{a as K}from"./chunk-PYAJMHZH.js";import{d as M,g as B}from"./chunk-ALUF2O22.js";import"./chunk-LNZR3RXG.js";import"./chunk-PTPTDOWD.js";import{a as E,b as I,c as H}from"./chunk-H2KIOYQU.js";import"./chunk-VRDPGOXM.js";import{d as P}from"./chunk-WAVBS3GL.js";import{a as x}from"./chunk-K7YYCJUR.js";import{a as w,u as S}from"./chunk-34326C2I.js";import{a as m}from"./chunk-2KED7D2Q.js";import{HostedApiError as fe}from"@sekyro/web";import{detectIsMobile as J}from"@sekyro/web/core";import{useEffect as q,useId as F,useMemo as C,useRef as ye,useState as _}from"react";var $={"consent.human.terms.intro":"تؤكد Sekyro AI أن شخصًا حقيقيًا يُجري هذه الخطوة، نيابةً عن الجهة التي طلبتها.","consent.human.terms.data":"تلتقط Sekyro AI تسجيلًا قصيرًا لوجهك.","consent.human.terms.processing":"يُفحص هذا التسجيل للتأكد من أنك شخص حقيقي وحاضر، وقد يُقارَن بالوجوه التي سبق التحقق منها لدى هذه الجهة.","consent.human.terms.sharing":"تُبلَّغ الجهة التي طلبت هذا التحقق بنتيجته.","consent.human.terms.retention":"تُخزَّن بياناتك مشفّرة ولا يُحتفظ بها إلا للمدة التي يقتضيها القانون وإعدادات الجهة. لممارسة حقوقك المتعلقة بحماية البيانات، تواصل مع الجهة التي طلبت هذا التحقق.","capture.noCamera.title":"تتطلب هذه الخطوة كاميرا","capture.noCamera.body":"اسمح بالوصول إلى الكاميرا وحاول مرة أخرى، أو تابع على هاتف مزوّد بكاميرا.","capture.noCamera.continue":"المتابعة بدون كاميرا","capture.noCamera.deniedTitle":"اسمح بالوصول إلى الكاميرا للمتابعة","capture.noCamera.deniedBody":"حظر متصفحك الوصول إلى الكاميرا في هذه الصفحة. اسمح به من إعدادات الموقع ثم أعد المحاولة.","choice.title":"كيف تريد المتابعة؟","choice.description":"اختر خيارًا واحدًا.","choice.switch":"استخدم خيارًا آخر","contact.title":"كيف تريد استلام الرمز؟","contact.description":"اختر خيارًا واحدًا.","contact.phone":"عبر الهاتف (واتساب أو رسالة نصية)","contact.email":"عبر البريد الإلكتروني","contact.switch":"استخدم خيارًا آخر","summary.title":"تحقق من بياناتك","summary.description":"تأكد من أن هذه بياناتك قبل الصورة الحية.","summary.fullName":"الاسم الكامل","summary.birthDate":"تاريخ الميلاد","summary.nationality":"الجنسية","summary.documentType":"الوثيقة","summary.documentNumber":"رقم الوثيقة","summary.nni":"الرقم الوطني للتعريف الموريتاني (NNI)","summary.id_number":"رقم الهوية","summary.expiryDate":"تاريخ الانتهاء","summary.portraitAlt":"الصورة المسجلة","summary.source.registry":"من سجل الحالة المدنية","summary.source.document":"مقروءة من وثيقتك","summary.source.chip":"مقروءة من شريحة وثيقتك","summary.name":"الاسم","summary.birthYear":"سنة الميلاد","summary.confirm":"تأكيد ومتابعة","summary.retakeDocument":"مسح وثيقتي مرة أخرى","summary.retakeNationalNumber":"إدخال رقمي مرة أخرى","summary.noRetake":"لم يعد بإمكانك إعادة المحاولة. تواصل مع {org} إذا كانت هذه البيانات غير صحيحة","capture.tipsIcao.title":"لصورة الهوية:","capture.tipsIcao.glasses":"انزع نظارتك","capture.tipsIcao.headwear":"انزع القبعة. يُقبل غطاء الرأس الديني إذا كان الوجه ظاهرًا بالكامل","capture.tipsIcao.expression":"حافظ على تعبير محايد وفمك مغلق","capture.tipsIcao.faceCamera":"انظر مباشرة إلى الكاميرا وعيناك مفتوحتان","capture.tipsIcao.background":"قف أمام خلفية سادة فاتحة اللون","capture.tipsIcao.lighting":"استخدم إضاءة متساوية على وجهك: دون ظلال","capture.tipsIcao.hair":"أبعد شعرك عن وجهك وعينيك","capture.tipsIcao.summary":"قف أمام جدار سادة فاتح اللون مع إضاءة متساوية على وجهك. انزع نظارتك وأي قبعة. أبعد شعرك عن وجهك، وانظر مباشرة إلى الكاميرا وعيناك مفتوحتان، وحافظ على تعبير محايد وفمك مغلق، وابقَ ثابتًا.","portrait.retakeOnly":"نجح التحقق الحي. الصورة فقط تحتاج إلى محاولة أخرى","portrait.keepCamera":"ابقَ أمام الكاميرا","handoff.description":"امسح الرمز بهاتفك للمتابعة","handoff.qrAlt":"رمز QR يفتح عملية التحقق هذه على هاتفك","handoff.copyLink":"نسخ الرابط","handoff.copyFailed":"تعذّر نسخ الرابط. انسخ عنوان هذه الصفحة من متصفحك بدلًا من ذلك","handoff.waiting":"ستنتقل هذه الصفحة تلقائيًا بعد أن تُكمل الخطوة على هاتفك","inApp.title":"افتح هذه الصفحة في متصفحك","inApp.description":"لا تعمل الكاميرا جيدًا داخل هذا التطبيق. افتح الرابط في Chrome أو Safari للمتابعة.","inApp.copyLink":"نسخ الرابط","inApp.copied":"تم نسخ الرابط. الصقه في متصفحك","inApp.copyFailed":"تعذّر نسخ الرابط. انسخ عنوان هذه الصفحة بدلًا من ذلك","inApp.continueAnyway":"المتابعة هنا على أي حال"};var A={"consent.human.terms.intro":"Sekyro AI confirms that a real person is completing this step, on behalf of the organization that asked for it.","consent.human.terms.data":"Sekyro AI collects a short capture of your face.","consent.human.terms.processing":"The capture is checked to confirm that you are a real person who is present. It may be compared with faces already verified for this organization.","consent.human.terms.sharing":"The organization that requested this verification learns its outcome.","consent.human.terms.retention":"Your data is stored encrypted and kept only as long as the law and the organization's settings require. To exercise your data-protection rights, contact the organization that requested this verification.","capture.noCamera.title":"This step needs a camera","capture.noCamera.body":"Allow camera access and try again, or continue on a phone with a camera.","capture.noCamera.continue":"Continue without a camera","capture.noCamera.deniedTitle":"Allow camera access to continue","capture.noCamera.deniedBody":"Your browser blocked the camera for this page. Allow it in the site settings, then try again.","choice.title":"How do you want to continue?","choice.description":"Choose one option.","choice.switch":"Use another option","contact.title":"How do you want to get your code?","contact.description":"Choose one option.","contact.phone":"By phone (WhatsApp or SMS)","contact.email":"By email","contact.switch":"Use another option","summary.title":"Check your details","summary.description":"Make sure this is you before the live photo.","summary.fullName":"Full name","summary.birthDate":"Date of birth","summary.nationality":"Nationality","summary.documentType":"Document","summary.documentNumber":"Document number","summary.nni":"Mauritanian national ID number (NNI)","summary.id_number":"ID number","summary.expiryDate":"Expiry date","summary.portraitAlt":"Photo on record","summary.source.registry":"From the civil registry","summary.source.document":"Read from your document","summary.source.chip":"Read from your document's chip","summary.name":"Name","summary.birthYear":"Year of birth","summary.confirm":"Confirm and continue","summary.retakeDocument":"Scan my document again","summary.retakeNationalNumber":"Enter my number again","summary.noRetake":"You can't try again. Contact {org} if these details are wrong","capture.tipsIcao.title":"For your ID photo:","capture.tipsIcao.glasses":"Remove your glasses","capture.tipsIcao.headwear":"Remove hats and caps. A religious head covering is fine if your whole face shows","capture.tipsIcao.expression":"Keep a neutral expression with your mouth closed","capture.tipsIcao.faceCamera":"Look straight at the camera with your eyes open","capture.tipsIcao.background":"Stand in front of a plain, light background","capture.tipsIcao.lighting":"Use even light on your face: no shadows","capture.tipsIcao.hair":"Keep your hair away from your face and eyes","capture.tipsIcao.summary":"Stand in front of a plain, light wall with even light on your face. Remove your glasses and any hat. Keep your hair off your face, look straight at the camera with your eyes open, keep a neutral expression with your mouth closed, and hold still.","portrait.retakeOnly":"Your live check passed. Only the photo needs another try","portrait.keepCamera":"Stay in front of the camera","handoff.description":"Scan with your phone to continue","handoff.qrAlt":"QR code that opens this verification on your phone","handoff.copyLink":"Copy link","handoff.copyFailed":"We couldn't copy the link. Copy this page's address from your browser instead","handoff.waiting":"This page moves on by itself once you finish on your phone","inApp.title":"Open this page in your browser","inApp.description":"The camera doesn't work well inside this app. Open the link in Chrome or Safari to continue.","inApp.copyLink":"Copy link","inApp.copied":"Link copied. Paste it in your browser","inApp.copyFailed":"We couldn't copy the link. Copy this page's address instead","inApp.continueAnyway":"Continue here anyway"};var G={"consent.human.terms.intro":"Sekyro AI confirme qu'une personne réelle effectue cette étape, pour le compte de l'organisme qui l'a demandée.","consent.human.terms.data":"Sekyro AI recueille une courte capture de votre visage.","consent.human.terms.processing":"La capture est analysée pour confirmer que vous êtes une personne réelle et présente. Elle peut être comparée aux visages déjà vérifiés pour cet organisme.","consent.human.terms.sharing":"L'organisme qui a demandé cette vérification est informé de son résultat.","consent.human.terms.retention":"Vos données sont stockées chiffrées et conservées uniquement pendant la durée exigée par la loi et les paramètres de l'organisme. Pour exercer vos droits en matière de protection des données, contactez l'organisme qui a demandé cette vérification.","capture.noCamera.title":"Cette étape nécessite une caméra","capture.noCamera.body":"Autorisez l'accès à la caméra et réessayez, ou continuez sur un téléphone équipé d'une caméra.","capture.noCamera.continue":"Continuer sans caméra","capture.noCamera.deniedTitle":"Autorisez l'accès à la caméra pour continuer","capture.noCamera.deniedBody":"Votre navigateur a bloqué la caméra pour cette page. Autorisez-la dans les paramètres du site, puis réessayez.","choice.title":"Comment voulez-vous continuer ?","choice.description":"Choisissez une option.","choice.switch":"Utiliser une autre option","contact.title":"Comment voulez-vous recevoir votre code ?","contact.description":"Choisissez une option.","contact.phone":"Par téléphone (WhatsApp ou SMS)","contact.email":"Par e-mail","contact.switch":"Utiliser une autre option","summary.title":"Vérifiez vos informations","summary.description":"Assurez-vous qu'il s'agit bien de vous avant la photo en direct.","summary.fullName":"Nom complet","summary.birthDate":"Date de naissance","summary.nationality":"Nationalité","summary.documentType":"Document","summary.documentNumber":"Numéro du document","summary.nni":"Numéro national d'identification mauritanien (NNI)","summary.id_number":"Numéro d'identité","summary.expiryDate":"Date d'expiration","summary.portraitAlt":"Photo enregistrée","summary.source.registry":"Issu de l'état civil","summary.source.document":"Lu sur votre document","summary.source.chip":"Lu sur la puce de votre document","summary.name":"Nom","summary.birthYear":"Année de naissance","summary.confirm":"Confirmer et continuer","summary.retakeDocument":"Scanner à nouveau mon document","summary.retakeNationalNumber":"Saisir à nouveau mon numéro","summary.noRetake":"Vous ne pouvez plus réessayer. Contactez {org} si ces informations sont incorrectes","capture.tipsIcao.title":"Pour votre photo d'identité :","capture.tipsIcao.glasses":"Retirez vos lunettes","capture.tipsIcao.headwear":"Retirez chapeau et casquette. Un couvre-chef religieux est accepté si tout le visage est visible","capture.tipsIcao.expression":"Gardez une expression neutre, la bouche fermée","capture.tipsIcao.faceCamera":"Regardez la caméra bien en face, les yeux ouverts","capture.tipsIcao.background":"Placez-vous devant un fond uni et clair","capture.tipsIcao.lighting":"Éclairez votre visage de façon uniforme : sans ombres","capture.tipsIcao.hair":"Dégagez vos cheveux du visage et des yeux","capture.tipsIcao.summary":"Placez-vous devant un mur uni et clair, le visage éclairé de façon uniforme. Retirez vos lunettes et tout chapeau. Dégagez vos cheveux du visage, regardez la caméra bien en face, les yeux ouverts, gardez une expression neutre, la bouche fermée, et ne bougez plus.","portrait.retakeOnly":"Votre vérification en direct est validée. Seule la photo est à refaire","portrait.keepCamera":"Restez face à la caméra","handoff.description":"Scannez avec votre téléphone pour continuer","handoff.qrAlt":"Code QR qui ouvre cette vérification sur votre téléphone","handoff.copyLink":"Copier le lien","handoff.copyFailed":"Nous n'avons pas pu copier le lien. Copiez plutôt l'adresse de cette page depuis votre navigateur","handoff.waiting":"Cette page avancera d’elle-même une fois l’étape terminée sur votre téléphone","inApp.title":"Ouvrez cette page dans votre navigateur","inApp.description":"La caméra fonctionne mal dans cette application. Ouvrez le lien dans Chrome ou Safari pour continuer.","inApp.copyLink":"Copier le lien","inApp.copied":"Lien copié. Collez-le dans votre navigateur","inApp.copyFailed":"Impossible de copier le lien. Copiez plutôt l'adresse de cette page","inApp.continueAnyway":"Continuer ici quand même"};var D=[[10,[[1,16]]],[16,[[1,28]]],[26,[[1,44]]],[18,[[2,32]]],[24,[[2,43]]],[16,[[4,27]]],[18,[[4,31]]],[22,[[2,38],[2,39]]],[22,[[3,36],[2,37]]],[26,[[4,43],[1,44]]],[30,[[1,50],[4,51]]],[22,[[6,36],[2,37]]],[22,[[8,37],[1,38]]],[24,[[4,40],[5,41]]],[24,[[5,41],[5,42]]],[28,[[7,45],[3,46]]],[28,[[10,46],[1,47]]],[26,[[9,43],[4,44]]],[26,[[3,44],[11,45]]],[26,[[3,41],[13,42]]]],Q=D.length,re=0,L=m(e=>(D[e-1]?.[1]??[]).reduce((t,[n,o])=>t+n*o,0),"dataCapacity");function T(e,t){let n=0;for(let o=7;o>=0;o-=1)n=n<<1^(n>>>7)*285,n^=(t>>>o&1)*e;return n&255}m(T,"gfMul");function ae(e){let t=new Array(e).fill(0);t[e-1]=1;let n=1;for(let o=0;o<e;o+=1){for(let a=0;a<e;a+=1)t[a]=T(t[a],n),a+1<e&&(t[a]=t[a]^t[a+1]);n=T(n,2)}return t}m(ae,"rsDivisor");function ie(e,t){let n=t.map(()=>0);for(let o of e){let a=o^n.shift();n.push(0),t.forEach((i,s)=>{n[s]=n[s]^T(i,a)})}return n}m(ie,"rsRemainder");function se(e,t){let n=[],o=m((p,d)=>{for(let b=d-1;b>=0;b-=1)n.push(p>>>b&1)},"put");o(4,4),o(e.length,t<10?8:16);for(let p of e)o(p,8);let a=L(t)*8;o(0,Math.min(4,a-n.length)),o(0,(8-n.length%8)%8);let i=[];for(let p=0;p<n.length;p+=8)i.push(n.slice(p,p+8).reduce((d,b)=>d<<1|b,0));for(let p=236;i.length<L(t);p^=253)i.push(p);let[s,r]=D[t-1],c=ae(s),u=[],f=0;for(let[p,d]of r)for(let b=0;b<p;b+=1){let v=i.slice(f,f+d);f+=d,u.push({data:v,ec:ie(v,c)})}let h=[],y=Math.max(...u.map(p=>p.data.length));for(let p=0;p<y;p+=1)for(let d of u)p<d.data.length&&h.push(d.data[p]);for(let p=0;p<s;p+=1)for(let d of u)h.push(d.ec[p]);return h}m(se,"codewords");function ce(e){if(e===1)return[];let t=Math.floor(e/7)+2,n=Math.ceil((e*4+4)/(t*2-2))*2,o=[6];for(let a=e*4+10;o.length<t;a-=n)o.splice(1,0,a);return o}m(ce,"alignmentPositions");var ue=[(e,t)=>(e+t)%2===0,e=>e%2===0,(e,t)=>t%3===0,(e,t)=>(e+t)%3===0,(e,t)=>(Math.floor(e/2)+Math.floor(t/3))%2===0,(e,t)=>e*t%2+e*t%3===0,(e,t)=>(e*t%2+e*t%3)%2===0,(e,t)=>((e+t)%2+e*t%3)%2===0],O=class O{constructor(t){this.size=t,this.dark=new Array(t*t).fill(!1),this.fixed=new Array(t*t).fill(!1)}set(t,n,o){this.dark[t*this.size+n]=o,this.fixed[t*this.size+n]=!0}get(t,n){return this.dark[t*this.size+n]===!0}};m(O,"Grid");var V=O;function le(e,t){let n=e.size;for(let i=0;i<n;i+=1)e.set(6,i,i%2===0),e.set(i,6,i%2===0);for(let[i,s]of[[3,3],[3,n-4],[n-4,3]])for(let r=-4;r<=4;r+=1)for(let c=-4;c<=4;c+=1){let u=i+r,f=s+c;if(u<0||u>=n||f<0||f>=n)continue;let h=Math.max(Math.abs(r),Math.abs(c));e.set(u,f,h!==2&&h!==4)}let o=ce(t),a=o.length-1;if(o.forEach((i,s)=>o.forEach((r,c)=>{if(!(s===0&&c===0||s===0&&c===a||s===a&&c===0))for(let u=-2;u<=2;u+=1)for(let f=-2;f<=2;f+=1)e.set(i+u,r+f,Math.max(Math.abs(u),Math.abs(f))!==1)})),W(e,0),t>=7){let i=t;for(let r=0;r<12;r+=1)i=i<<1^(i>>>11)*7973;let s=t<<12|i;for(let r=0;r<18;r+=1){let c=(s>>>r&1)===1,u=n-11+r%3,f=Math.floor(r/3);e.set(u,f,c),e.set(f,u,c)}}}m(le,"drawFunctionPatterns");function W(e,t){let n=e.size,o=re<<3|t,a=o;for(let r=0;r<10;r+=1)a=a<<1^(a>>>9)*1335;let i=(o<<10|a)^21522,s=m(r=>(i>>>r&1)===1,"bit");for(let r=0;r<=5;r+=1)e.set(r,8,s(r));e.set(7,8,s(6)),e.set(8,8,s(7)),e.set(8,7,s(8));for(let r=9;r<15;r+=1)e.set(8,14-r,s(r));for(let r=0;r<8;r+=1)e.set(8,n-1-r,s(r));for(let r=8;r<15;r+=1)e.set(n-15+r,8,s(r));e.set(n-8,8,!0)}m(W,"drawFormat");function me(e,t){let n=e.size,o=0;for(let a=n-1;a>=1;a-=2){a===6&&(a=5);for(let i=0;i<n;i+=1)for(let s=0;s<2;s+=1){let r=a-s,u=(a+1&2)===0?n-1-i:i;e.fixed[u*n+r]!==!0&&(o<t.length*8&&(e.dark[u*n+r]=(t[o>>>3]>>>7-(o&7)&1)===1),o+=1)}}}m(me,"placeData");function pe(e,t){let n=ue[t];for(let o=0;o<e.size;o+=1)for(let a=0;a<e.size;a+=1)e.fixed[o*e.size+a]!==!0&&n(o,a)&&(e.dark[o*e.size+a]=!e.dark[o*e.size+a])}m(pe,"applyMask");function de(e){let t=e.size,n=0,o=m(i=>{let s=1;for(let r=1;r<=t;r+=1)r<t&&i(r)===i(r-1)?s+=1:(s>=5&&(n+=3+(s-5)),s=1);for(let r=0;r+10<t;r+=1){let c=[!0,!1,!0,!0,!0,!1,!0];if(!(c.every((y,p)=>i(r+p)===y)||c.every((y,p)=>i(r+4+p)===y)))continue;let f=[0,1,2,3].every(y=>!i(r+y))&&c.every((y,p)=>i(r+4+p)===y),h=c.every((y,p)=>i(r+p)===y)&&[7,8,9,10].every(y=>!i(r+y));f&&(n+=40),h&&(n+=40)}},"line");for(let i=0;i<t;i+=1)o(s=>e.get(i,s));for(let i=0;i<t;i+=1)o(s=>e.get(s,i));for(let i=0;i+1<t;i+=1)for(let s=0;s+1<t;s+=1){let r=e.get(i,s);r===e.get(i,s+1)&&r===e.get(i+1,s)&&r===e.get(i+1,s+1)&&(n+=3)}let a=e.dark.filter(Boolean).length;return n+=Math.floor(Math.abs(a*20-t*t*10)/(t*t))*10,n}m(de,"penalty");function j(e,t={}){let n=new TextEncoder().encode(e),o=1;for(;o<=Q&&!(4+(o<10?8:16)+n.length*8<=L(o)*8);o+=1);if(o>Q)throw new RangeError("text too long for a QR code");let a=se(n,o),i=m(c=>{let u=new V(o*4+17);return le(u,o),me(u,a),pe(u,c),W(u,c),u},"build"),s=null;if(t.mask!==void 0)s=i(t.mask);else{let c=Number.POSITIVE_INFINITY;for(let u=0;u<8;u+=1){let f=i(u),h=de(f);h<c&&(c=h,s=f)}}let r=s;return{size:r.size,get:m((c,u)=>r.get(c,u),"get")}}m(j,"encodeQr");function X(e,t=4){let n=[];for(let o=0;o<e.size;o+=1)for(let a=0;a<e.size;a+=1)e.get(o,a)&&n.push(`M${a+t} ${o+t}h1v1h-1z`);return{size:e.size+t*2,d:n.join("")}}m(X,"qrPath");import{Fragment as Ce,jsx as l,jsxs as k}from"react/jsx-runtime";var he={en:A,fr:G,ar:$,es:A,pt:A,de:A},Z={en:I,fr:H,ar:E,es:I,pt:I,de:I};function g(e){let t=e.strings;return(n,o)=>P(t[n]??he[e.locale][n]??"",o)}m(g,"flowT");function ee(e,t){let n=g(t);return e.flatMap(o=>{let a=o.service==="phone_otp"?n("contact.phone"):o.service==="email_otp"?n("contact.email"):R(o,t),i=U[o.service];return a===null?[]:[{id:o.id,label:a,...i!==void 0?{glyph:l(K,{name:i})}:{}}]})}m(ee,"labelled");function te({step:e,i18n:t,onError:n}){let o=g(t),{busy:a,error:i,run:s}=N(t,n),r=e.kind==="contact_choice";return l(M,{title:o(r?"contact.title":"choice.title"),description:o(r?"contact.description":"choice.description"),options:ee(e.choice.options,t),busy:a,error:i,focus:!0,testId:r?"sekyro-contact-choice":"sekyro-choice",onChoose:c=>s(()=>e.choose(c))})}m(te,"PlanChoiceView");var Ge=te,Qe=te;function We({step:e,i18n:t,onError:n,onOpen:o}){let a=g(t),{busy:i,error:s,run:r}=N(t,n),c=e,u=e.context.switchable,f=u===void 0?[]:u.options.filter(v=>v.id!==u.current),h=c.kind==="registry"&&(c.reason==="nni_not_found"||c.reason==="registry_record_not_found")&&c.canUseDocument||c.kind==="eid"&&c.reason?.startsWith("eid_")&&c.canUseCamera,y=f.length===1?f[0]:void 0,p=y!==void 0&&(y.service==="phone_otp"||y.service==="email_otp"),d=p&&c.canSwitch&&c.switchTo!==void 0?()=>c.switchTo.call(e):c.chooseOption===void 0||y===void 0?void 0:()=>c.chooseOption.call(e,y.id);if(f.length===0||h||y!==void 0&&(d===void 0||b()===null)||y===void 0&&c.chooseOption===void 0)return null;function b(){return y===void 0?a("choice.switch"):y.service==="phone_otp"||y.service==="email_otp"?a("contact.switch"):c.kind==="registry"&&y.service==="document"?t.t("population.useDocument"):c.kind==="eid"?t.strings["eid.useCamera"]??Z[t.locale]["eid.useCamera"]:R(y,t)}return m(b,"labelOf"),k("div",{className:"sekyro-stack sekyro-stack--1",children:[s!==null?l(x,{tone:"danger",children:l("span",{children:s})}):null,l(w,{kind:"ghost",disabled:i,"aria-busy":i||void 0,onClick:()=>d===void 0?o():r(d),"data-testid":p?"sekyro-contact-switch":"sekyro-lane-switch",children:b()})]})}m(We,"LaneSwitch");function je({step:e,i18n:t,onError:n,onClose:o}){let a=g(t),{busy:i,error:s,run:r}=N(t,n),c=e.context.switchable,u=e.chooseOption;return c===void 0||u===void 0?null:l(M,{title:a("choice.title"),description:a("choice.description"),options:ee(c.options,t),...c.current!==null?{marked:c.current}:{},busy:i,error:s,focus:!0,testId:"sekyro-lane-choice",onChoose:f=>f===c.current?o():r(()=>u.call(e,f))})}m(je,"LaneChoiceView");var be=[["fullName","summary.fullName",!1],["birthDate","summary.birthDate",!0],["birthYear","summary.birthYear",!0],["nationality","summary.nationality",!0],["documentType","summary.documentType",!1],["documentNumberMasked","summary.documentNumber",!0],["idNumberMasked","summary.id_number",!0],["expiryDate","summary.expiryDate",!0]];function ke(e){let[t,n]=_(null);return q(()=>{if(!e.portraitAvailable)return;let o=!0,a=null;return e.portrait().then(i=>{!o||i===null||!i.type.startsWith("image/")||typeof URL.createObjectURL!="function"||(a=URL.createObjectURL(i),n(a))}),()=>{o=!1,a!==null&&URL.revokeObjectURL(a)}},[e.portraitAvailable]),t}m(ke,"usePortraitUrl");function Xe({step:e,i18n:t,onError:n}){let o=g(t),a=F(),i=S(),s=ke(e),{busy:r,error:c,run:u}=N(t,n),f=e.context.orgName,h=["registry","document","chip"].find(d=>d===e.source),y=e.summaryKind==="partial",p=m(d=>t.strings[`doc.type.${d}`]??d,"documentLabel");return k("section",{className:"sekyro-stack sekyro-stack--4","aria-labelledby":a,"data-testid":"sekyro-identity-summary",children:[k("div",{className:"sekyro-stack sekyro-stack--1",children:[l("h2",{id:a,ref:i,tabIndex:-1,className:"sekyro-text-body",children:o("summary.title")}),l("p",{className:"sekyro-text-muted",children:o("summary.description")}),h!==void 0?l("p",{className:"sekyro-text-muted",children:o(`summary.source.${h}`)}):null]}),k("div",{className:"sekyro-summary",children:[s!==null?l("img",{className:"sekyro-summary__portrait",src:s,alt:o("summary.portraitAlt")}):null,l("dl",{className:"sekyro-summary__list",children:be.map(([d,b,v])=>{let z=d==="idNumberMasked"?e.idNumberMasked??e.nniMasked:e[d];return z===void 0?null:k("div",{className:"sekyro-summary__row",children:[l("dt",{className:"sekyro-text-muted",children:o(d==="fullName"&&y?"summary.name":b)}),l("dd",{children:v?l("bdi",{dir:"ltr",children:z}):d==="documentType"?p(z):z})]},d)})})]}),c!==null?l(x,{tone:"danger",children:l("span",{children:c})}):null,k("div",{className:"sekyro-stack sekyro-stack--3",children:[l(w,{full:!0,disabled:r,"aria-busy":r||void 0,onClick:()=>u(()=>e.confirm()),children:o("summary.confirm")}),e.retakeAvailable?l(w,{kind:"ghost",full:!0,disabled:r,onClick:()=>u(()=>e.retake()),children:o(e.retakeTarget==="national_number"?"summary.retakeNationalNumber":"summary.retakeDocument")}):l("p",{className:"sekyro-text-muted",children:o("summary.noRetake",{org:f})})]})]})}m(Xe,"IdentitySummaryView");var ge=["glasses","headwear","expression","faceCamera","background","lighting","hair"];function Je({step:e,i18n:t,livenessProps:n,sekyroIntro:o}){let a=g(t),[i,s]=_(null);q(()=>e.onLivePhoto(d=>{let b=d.update?.coach;s(d.holding||b===void 0?null:t.t(`portrait.coach.${b}`))}),[e,t]);let r=e.instructions==="icao",c=e.icao?.profile==="selfie",u=C(()=>r?ge.filter(d=>!c||d!=="background").map(d=>({id:d,text:a(`capture.tipsIcao.${d}`)})):void 0,[r,c,t]),f=C(()=>r&&!c?{...n.strings,"capture.tips.title":a("capture.tipsIcao.title")}:n.strings,[r,c,n.strings,t]),h=c?void 0:a("capture.tipsIcao.title"),y=C(()=>o===!0&&u!==void 0?{...n.slots,intro:m((d,b)=>l(Y,{start:d,context:b,tips:u,...h!==void 0?{tipsTitle:h}:{}}),"intro")}:n.slots,[o,u,h,n.slots,t]),p=c?`${(u??[]).map(d=>d.text).join(". ")}.`:a("capture.tipsIcao.summary");return l(B,{...n,...y!==void 0?{slots:y}:{},...f!==void 0?{strings:f}:{},...u!==void 0?{tips:u,tipsSummary:p}:{},coach:i})}m(Je,"LivePhotoLiveness");function Ze({i18n:e}){let t=g(e);return k(x,{tone:"info",children:[l("strong",{children:t("portrait.retakeOnly")}),l("span",{children:t("portrait.keepCamera")})]})}m(Ze,"PortraitRetakeNotice");function et({i18n:e,provider:t}){let n=e.strings,o=m(a=>n[a]??Z[e.locale][a]??"","pick");return l("p",{className:"sekyro-text-muted","data-testid":"sekyro-eid-continue",children:t?P(o("eid.continueHint"),{provider:t}):o("eid.continueHintGeneric")})}m(et,"EidContinueHint");async function we(e){try{return await navigator.clipboard.writeText(e),!0}catch{return!1}}m(we,"copy");function oe({url:e,i18n:t,label:n}){let o=g(t),[a,i]=_("idle"),s=n.startsWith("inApp.")?"inApp":"handoff";return k("div",{className:"sekyro-stack sekyro-stack--1",children:[l(w,{kind:"ghost",onClick:()=>{we(e).then(r=>i(r?"copied":"failed"))},children:o(n)}),l("p",{role:"status","aria-live":"polite",className:"sekyro-text-muted",children:a==="idle"?"":o(`${s}.${a==="copied"?"copied":"copyFailed"}`)})]})}m(oe,"CopyLink");function ne({url:e,i18n:t,refresh:n,footer:o}){let a=g(t),i=F(),s=C(()=>{try{return X(j(e))}catch{return null}},[e]),r=ye(n);r.current=n;let c=S();return q(()=>{let u=setInterval(()=>{(typeof document>"u"||document.visibilityState!=="hidden")&&r.current?.().catch(()=>{})},5e3);return()=>clearInterval(u)},[]),k("section",{className:"sekyro-stack sekyro-stack--3","aria-labelledby":i,"data-testid":"sekyro-handoff",children:[l("h2",{id:i,ref:c,tabIndex:-1,className:"sekyro-text-body",children:t.t("handoff.title")}),l("p",{className:"sekyro-text-muted",children:a("handoff.description")}),s!==null?k("svg",{className:"sekyro-qr",viewBox:`0 0 ${s.size} ${s.size}`,role:"img","aria-label":a("handoff.qrAlt"),shapeRendering:"crispEdges",children:[l("rect",{width:s.size,height:s.size,className:"sekyro-qr__bg"}),l("path",{d:s.d,className:"sekyro-qr__fg"})]}):null,l(oe,{url:e,i18n:t,label:"handoff.copyLink"}),l("p",{className:"sekyro-text-muted",children:a("handoff.waiting")}),o??null]})}m(ne,"HandoffView");var ve=["intro","data","processing","sharing","retention"];function tt({i18n:e}){let t=g(e);return l(Ce,{children:ve.map(n=>l("p",{children:t(`consent.human.terms.${n}`)},n))})}m(tt,"HumanConsentTerms");function ot({url:e,i18n:t}){return C(()=>!J(),[])?l(ne,{url:e,i18n:t}):null}m(ot,"DesktopHandoffView");function nt({i18n:e,cause:t,onRetry:n,onContinue:o,handoffUrl:a}){let i=g(e),s=F(),r=S(),[c,u]=_("idle"),f=C(()=>a!==void 0&&!J(),[a]),h=t==="denied",y=m(()=>{o!==void 0&&(u("busy"),o(t).then(()=>u("idle"),p=>u(p instanceof fe&&p.code==="check_out_of_order"?"idle":"failed")))},"end");return k("section",{className:"sekyro-stack sekyro-stack--3","aria-labelledby":s,"data-testid":"sekyro-no-camera","data-cause":t,children:[f&&a!==void 0?l(ne,{url:a,i18n:e}):null,l("h2",{id:s,ref:r,tabIndex:-1,className:"sekyro-text-body",children:i(h?"capture.noCamera.deniedTitle":"capture.noCamera.title")}),l("p",{className:"sekyro-text-muted",children:i(h?"capture.noCamera.deniedBody":"capture.noCamera.body")}),c==="failed"?l(x,{tone:"danger",children:l("span",{children:e.t("errors.network_error")})}):null,l(w,{kind:h?"primary":"ghost",onClick:n,children:e.t("common.retry")}),o!==void 0?l(w,{kind:"ghost",disabled:c==="busy","aria-busy":c==="busy"||void 0,onClick:y,children:i("capture.noCamera.continue")}):null]})}m(nt,"NoCameraView");function rt({url:e,i18n:t,onContinue:n}){let o=g(t),a=F(),i=S();return k("section",{className:"sekyro-stack sekyro-stack--3","aria-labelledby":a,"data-testid":"sekyro-in-app",children:[l("h2",{id:a,ref:i,tabIndex:-1,className:"sekyro-text-body",children:o("inApp.title")}),l("p",{className:"sekyro-text-muted",children:o("inApp.description")}),l(oe,{url:e,i18n:t,label:"inApp.copyLink"}),l(w,{kind:"ghost",onClick:n,children:o("inApp.continueAnyway")})]})}m(rt,"InAppBrowserPrompt");export{Ge as ContactChoiceView,ot as DesktopHandoffView,et as EidContinueHint,Qe as GenericChoiceView,ne as HandoffView,tt as HumanConsentTerms,Xe as IdentitySummaryView,rt as InAppBrowserPrompt,je as LaneChoiceView,We as LaneSwitch,Je as LivePhotoLiveness,nt as NoCameraView,Ze as PortraitRetakeNotice};
2
+ import{a as U,b as R,c as N,d as Y}from"./chunk-IDZNOWTO.js";import{a as K}from"./chunk-PYAJMHZH.js";import{e as M,h as B}from"./chunk-Z5UFPMM6.js";import"./chunk-LNZR3RXG.js";import"./chunk-PTPTDOWD.js";import{a as E,b as I,c as H}from"./chunk-H2KIOYQU.js";import"./chunk-VRDPGOXM.js";import{d as P}from"./chunk-WAVBS3GL.js";import{a as x}from"./chunk-K7YYCJUR.js";import{a as w,u as S}from"./chunk-34326C2I.js";import{a as m}from"./chunk-2KED7D2Q.js";import{HostedApiError as fe}from"@sekyro/web";import{detectIsMobile as J}from"@sekyro/web/core";import{useEffect as q,useId as F,useMemo as C,useRef as ye,useState as _}from"react";var $={"consent.human.terms.intro":"تؤكد Sekyro AI أن شخصًا حقيقيًا يُجري هذه الخطوة، نيابةً عن الجهة التي طلبتها.","consent.human.terms.data":"تلتقط Sekyro AI تسجيلًا قصيرًا لوجهك.","consent.human.terms.processing":"يُفحص هذا التسجيل للتأكد من أنك شخص حقيقي وحاضر، وقد يُقارَن بالوجوه التي سبق التحقق منها لدى هذه الجهة.","consent.human.terms.sharing":"تُبلَّغ الجهة التي طلبت هذا التحقق بنتيجته.","consent.human.terms.retention":"تُخزَّن بياناتك مشفّرة ولا يُحتفظ بها إلا للمدة التي يقتضيها القانون وإعدادات الجهة. لممارسة حقوقك المتعلقة بحماية البيانات، تواصل مع الجهة التي طلبت هذا التحقق.","capture.noCamera.title":"تتطلب هذه الخطوة كاميرا","capture.noCamera.body":"اسمح بالوصول إلى الكاميرا وحاول مرة أخرى، أو تابع على هاتف مزوّد بكاميرا.","capture.noCamera.continue":"المتابعة بدون كاميرا","capture.noCamera.deniedTitle":"اسمح بالوصول إلى الكاميرا للمتابعة","capture.noCamera.deniedBody":"حظر متصفحك الوصول إلى الكاميرا في هذه الصفحة. اسمح به من إعدادات الموقع ثم أعد المحاولة.","choice.title":"كيف تريد المتابعة؟","choice.description":"اختر خيارًا واحدًا.","choice.switch":"استخدم خيارًا آخر","contact.title":"كيف تريد استلام الرمز؟","contact.description":"اختر خيارًا واحدًا.","contact.phone":"عبر الهاتف (واتساب أو رسالة نصية)","contact.email":"عبر البريد الإلكتروني","contact.switch":"استخدم خيارًا آخر","summary.title":"تحقق من بياناتك","summary.description":"تأكد من أن هذه بياناتك قبل الصورة الحية.","summary.fullName":"الاسم الكامل","summary.birthDate":"تاريخ الميلاد","summary.nationality":"الجنسية","summary.documentType":"الوثيقة","summary.documentNumber":"رقم الوثيقة","summary.nni":"الرقم الوطني للتعريف الموريتاني (NNI)","summary.id_number":"رقم الهوية","summary.expiryDate":"تاريخ الانتهاء","summary.portraitAlt":"الصورة المسجلة","summary.source.registry":"من سجل الحالة المدنية","summary.source.document":"مقروءة من وثيقتك","summary.source.chip":"مقروءة من شريحة وثيقتك","summary.name":"الاسم","summary.birthYear":"سنة الميلاد","summary.confirm":"تأكيد ومتابعة","summary.retakeDocument":"مسح وثيقتي مرة أخرى","summary.retakeNationalNumber":"إدخال رقمي مرة أخرى","summary.noRetake":"لم يعد بإمكانك إعادة المحاولة. تواصل مع {org} إذا كانت هذه البيانات غير صحيحة","capture.tipsIcao.title":"لصورة الهوية:","capture.tipsIcao.glasses":"انزع نظارتك","capture.tipsIcao.headwear":"انزع القبعة. يُقبل غطاء الرأس الديني إذا كان الوجه ظاهرًا بالكامل","capture.tipsIcao.expression":"حافظ على تعبير محايد وفمك مغلق","capture.tipsIcao.faceCamera":"انظر مباشرة إلى الكاميرا وعيناك مفتوحتان","capture.tipsIcao.background":"قف أمام خلفية سادة فاتحة اللون","capture.tipsIcao.lighting":"استخدم إضاءة متساوية على وجهك: دون ظلال","capture.tipsIcao.hair":"أبعد شعرك عن وجهك وعينيك","capture.tipsIcao.summary":"قف أمام جدار سادة فاتح اللون مع إضاءة متساوية على وجهك. انزع نظارتك وأي قبعة. أبعد شعرك عن وجهك، وانظر مباشرة إلى الكاميرا وعيناك مفتوحتان، وحافظ على تعبير محايد وفمك مغلق، وابقَ ثابتًا.","portrait.retakeOnly":"نجح التحقق الحي. الصورة فقط تحتاج إلى محاولة أخرى","portrait.keepCamera":"ابقَ أمام الكاميرا","handoff.description":"امسح الرمز بهاتفك للمتابعة","handoff.qrAlt":"رمز QR يفتح عملية التحقق هذه على هاتفك","handoff.copyLink":"نسخ الرابط","handoff.copyFailed":"تعذّر نسخ الرابط. انسخ عنوان هذه الصفحة من متصفحك بدلًا من ذلك","handoff.waiting":"ستنتقل هذه الصفحة تلقائيًا بعد أن تُكمل الخطوة على هاتفك","inApp.title":"افتح هذه الصفحة في متصفحك","inApp.description":"لا تعمل الكاميرا جيدًا داخل هذا التطبيق. افتح الرابط في Chrome أو Safari للمتابعة.","inApp.copyLink":"نسخ الرابط","inApp.copied":"تم نسخ الرابط. الصقه في متصفحك","inApp.copyFailed":"تعذّر نسخ الرابط. انسخ عنوان هذه الصفحة بدلًا من ذلك","inApp.continueAnyway":"المتابعة هنا على أي حال"};var A={"consent.human.terms.intro":"Sekyro AI confirms that a real person is completing this step, on behalf of the organization that asked for it.","consent.human.terms.data":"Sekyro AI collects a short capture of your face.","consent.human.terms.processing":"The capture is checked to confirm that you are a real person who is present. It may be compared with faces already verified for this organization.","consent.human.terms.sharing":"The organization that requested this verification learns its outcome.","consent.human.terms.retention":"Your data is stored encrypted and kept only as long as the law and the organization's settings require. To exercise your data-protection rights, contact the organization that requested this verification.","capture.noCamera.title":"This step needs a camera","capture.noCamera.body":"Allow camera access and try again, or continue on a phone with a camera.","capture.noCamera.continue":"Continue without a camera","capture.noCamera.deniedTitle":"Allow camera access to continue","capture.noCamera.deniedBody":"Your browser blocked the camera for this page. Allow it in the site settings, then try again.","choice.title":"How do you want to continue?","choice.description":"Choose one option.","choice.switch":"Use another option","contact.title":"How do you want to get your code?","contact.description":"Choose one option.","contact.phone":"By phone (WhatsApp or SMS)","contact.email":"By email","contact.switch":"Use another option","summary.title":"Check your details","summary.description":"Make sure this is you before the live photo.","summary.fullName":"Full name","summary.birthDate":"Date of birth","summary.nationality":"Nationality","summary.documentType":"Document","summary.documentNumber":"Document number","summary.nni":"Mauritanian national ID number (NNI)","summary.id_number":"ID number","summary.expiryDate":"Expiry date","summary.portraitAlt":"Photo on record","summary.source.registry":"From the civil registry","summary.source.document":"Read from your document","summary.source.chip":"Read from your document's chip","summary.name":"Name","summary.birthYear":"Year of birth","summary.confirm":"Confirm and continue","summary.retakeDocument":"Scan my document again","summary.retakeNationalNumber":"Enter my number again","summary.noRetake":"You can't try again. Contact {org} if these details are wrong","capture.tipsIcao.title":"For your ID photo:","capture.tipsIcao.glasses":"Remove your glasses","capture.tipsIcao.headwear":"Remove hats and caps. A religious head covering is fine if your whole face shows","capture.tipsIcao.expression":"Keep a neutral expression with your mouth closed","capture.tipsIcao.faceCamera":"Look straight at the camera with your eyes open","capture.tipsIcao.background":"Stand in front of a plain, light background","capture.tipsIcao.lighting":"Use even light on your face: no shadows","capture.tipsIcao.hair":"Keep your hair away from your face and eyes","capture.tipsIcao.summary":"Stand in front of a plain, light wall with even light on your face. Remove your glasses and any hat. Keep your hair off your face, look straight at the camera with your eyes open, keep a neutral expression with your mouth closed, and hold still.","portrait.retakeOnly":"Your live check passed. Only the photo needs another try","portrait.keepCamera":"Stay in front of the camera","handoff.description":"Scan with your phone to continue","handoff.qrAlt":"QR code that opens this verification on your phone","handoff.copyLink":"Copy link","handoff.copyFailed":"We couldn't copy the link. Copy this page's address from your browser instead","handoff.waiting":"This page moves on by itself once you finish on your phone","inApp.title":"Open this page in your browser","inApp.description":"The camera doesn't work well inside this app. Open the link in Chrome or Safari to continue.","inApp.copyLink":"Copy link","inApp.copied":"Link copied. Paste it in your browser","inApp.copyFailed":"We couldn't copy the link. Copy this page's address instead","inApp.continueAnyway":"Continue here anyway"};var G={"consent.human.terms.intro":"Sekyro AI confirme qu'une personne réelle effectue cette étape, pour le compte de l'organisme qui l'a demandée.","consent.human.terms.data":"Sekyro AI recueille une courte capture de votre visage.","consent.human.terms.processing":"La capture est analysée pour confirmer que vous êtes une personne réelle et présente. Elle peut être comparée aux visages déjà vérifiés pour cet organisme.","consent.human.terms.sharing":"L'organisme qui a demandé cette vérification est informé de son résultat.","consent.human.terms.retention":"Vos données sont stockées chiffrées et conservées uniquement pendant la durée exigée par la loi et les paramètres de l'organisme. Pour exercer vos droits en matière de protection des données, contactez l'organisme qui a demandé cette vérification.","capture.noCamera.title":"Cette étape nécessite une caméra","capture.noCamera.body":"Autorisez l'accès à la caméra et réessayez, ou continuez sur un téléphone équipé d'une caméra.","capture.noCamera.continue":"Continuer sans caméra","capture.noCamera.deniedTitle":"Autorisez l'accès à la caméra pour continuer","capture.noCamera.deniedBody":"Votre navigateur a bloqué la caméra pour cette page. Autorisez-la dans les paramètres du site, puis réessayez.","choice.title":"Comment voulez-vous continuer ?","choice.description":"Choisissez une option.","choice.switch":"Utiliser une autre option","contact.title":"Comment voulez-vous recevoir votre code ?","contact.description":"Choisissez une option.","contact.phone":"Par téléphone (WhatsApp ou SMS)","contact.email":"Par e-mail","contact.switch":"Utiliser une autre option","summary.title":"Vérifiez vos informations","summary.description":"Assurez-vous qu'il s'agit bien de vous avant la photo en direct.","summary.fullName":"Nom complet","summary.birthDate":"Date de naissance","summary.nationality":"Nationalité","summary.documentType":"Document","summary.documentNumber":"Numéro du document","summary.nni":"Numéro national d'identification mauritanien (NNI)","summary.id_number":"Numéro d'identité","summary.expiryDate":"Date d'expiration","summary.portraitAlt":"Photo enregistrée","summary.source.registry":"Issu de l'état civil","summary.source.document":"Lu sur votre document","summary.source.chip":"Lu sur la puce de votre document","summary.name":"Nom","summary.birthYear":"Année de naissance","summary.confirm":"Confirmer et continuer","summary.retakeDocument":"Scanner à nouveau mon document","summary.retakeNationalNumber":"Saisir à nouveau mon numéro","summary.noRetake":"Vous ne pouvez plus réessayer. Contactez {org} si ces informations sont incorrectes","capture.tipsIcao.title":"Pour votre photo d'identité :","capture.tipsIcao.glasses":"Retirez vos lunettes","capture.tipsIcao.headwear":"Retirez chapeau et casquette. Un couvre-chef religieux est accepté si tout le visage est visible","capture.tipsIcao.expression":"Gardez une expression neutre, la bouche fermée","capture.tipsIcao.faceCamera":"Regardez la caméra bien en face, les yeux ouverts","capture.tipsIcao.background":"Placez-vous devant un fond uni et clair","capture.tipsIcao.lighting":"Éclairez votre visage de façon uniforme : sans ombres","capture.tipsIcao.hair":"Dégagez vos cheveux du visage et des yeux","capture.tipsIcao.summary":"Placez-vous devant un mur uni et clair, le visage éclairé de façon uniforme. Retirez vos lunettes et tout chapeau. Dégagez vos cheveux du visage, regardez la caméra bien en face, les yeux ouverts, gardez une expression neutre, la bouche fermée, et ne bougez plus.","portrait.retakeOnly":"Votre vérification en direct est validée. Seule la photo est à refaire","portrait.keepCamera":"Restez face à la caméra","handoff.description":"Scannez avec votre téléphone pour continuer","handoff.qrAlt":"Code QR qui ouvre cette vérification sur votre téléphone","handoff.copyLink":"Copier le lien","handoff.copyFailed":"Nous n'avons pas pu copier le lien. Copiez plutôt l'adresse de cette page depuis votre navigateur","handoff.waiting":"Cette page avancera d’elle-même une fois l’étape terminée sur votre téléphone","inApp.title":"Ouvrez cette page dans votre navigateur","inApp.description":"La caméra fonctionne mal dans cette application. Ouvrez le lien dans Chrome ou Safari pour continuer.","inApp.copyLink":"Copier le lien","inApp.copied":"Lien copié. Collez-le dans votre navigateur","inApp.copyFailed":"Impossible de copier le lien. Copiez plutôt l'adresse de cette page","inApp.continueAnyway":"Continuer ici quand même"};var D=[[10,[[1,16]]],[16,[[1,28]]],[26,[[1,44]]],[18,[[2,32]]],[24,[[2,43]]],[16,[[4,27]]],[18,[[4,31]]],[22,[[2,38],[2,39]]],[22,[[3,36],[2,37]]],[26,[[4,43],[1,44]]],[30,[[1,50],[4,51]]],[22,[[6,36],[2,37]]],[22,[[8,37],[1,38]]],[24,[[4,40],[5,41]]],[24,[[5,41],[5,42]]],[28,[[7,45],[3,46]]],[28,[[10,46],[1,47]]],[26,[[9,43],[4,44]]],[26,[[3,44],[11,45]]],[26,[[3,41],[13,42]]]],Q=D.length,re=0,L=m(e=>(D[e-1]?.[1]??[]).reduce((t,[n,o])=>t+n*o,0),"dataCapacity");function T(e,t){let n=0;for(let o=7;o>=0;o-=1)n=n<<1^(n>>>7)*285,n^=(t>>>o&1)*e;return n&255}m(T,"gfMul");function ae(e){let t=new Array(e).fill(0);t[e-1]=1;let n=1;for(let o=0;o<e;o+=1){for(let a=0;a<e;a+=1)t[a]=T(t[a],n),a+1<e&&(t[a]=t[a]^t[a+1]);n=T(n,2)}return t}m(ae,"rsDivisor");function ie(e,t){let n=t.map(()=>0);for(let o of e){let a=o^n.shift();n.push(0),t.forEach((i,s)=>{n[s]=n[s]^T(i,a)})}return n}m(ie,"rsRemainder");function se(e,t){let n=[],o=m((p,d)=>{for(let b=d-1;b>=0;b-=1)n.push(p>>>b&1)},"put");o(4,4),o(e.length,t<10?8:16);for(let p of e)o(p,8);let a=L(t)*8;o(0,Math.min(4,a-n.length)),o(0,(8-n.length%8)%8);let i=[];for(let p=0;p<n.length;p+=8)i.push(n.slice(p,p+8).reduce((d,b)=>d<<1|b,0));for(let p=236;i.length<L(t);p^=253)i.push(p);let[s,r]=D[t-1],c=ae(s),u=[],f=0;for(let[p,d]of r)for(let b=0;b<p;b+=1){let v=i.slice(f,f+d);f+=d,u.push({data:v,ec:ie(v,c)})}let h=[],y=Math.max(...u.map(p=>p.data.length));for(let p=0;p<y;p+=1)for(let d of u)p<d.data.length&&h.push(d.data[p]);for(let p=0;p<s;p+=1)for(let d of u)h.push(d.ec[p]);return h}m(se,"codewords");function ce(e){if(e===1)return[];let t=Math.floor(e/7)+2,n=Math.ceil((e*4+4)/(t*2-2))*2,o=[6];for(let a=e*4+10;o.length<t;a-=n)o.splice(1,0,a);return o}m(ce,"alignmentPositions");var ue=[(e,t)=>(e+t)%2===0,e=>e%2===0,(e,t)=>t%3===0,(e,t)=>(e+t)%3===0,(e,t)=>(Math.floor(e/2)+Math.floor(t/3))%2===0,(e,t)=>e*t%2+e*t%3===0,(e,t)=>(e*t%2+e*t%3)%2===0,(e,t)=>((e+t)%2+e*t%3)%2===0],O=class O{constructor(t){this.size=t,this.dark=new Array(t*t).fill(!1),this.fixed=new Array(t*t).fill(!1)}set(t,n,o){this.dark[t*this.size+n]=o,this.fixed[t*this.size+n]=!0}get(t,n){return this.dark[t*this.size+n]===!0}};m(O,"Grid");var V=O;function le(e,t){let n=e.size;for(let i=0;i<n;i+=1)e.set(6,i,i%2===0),e.set(i,6,i%2===0);for(let[i,s]of[[3,3],[3,n-4],[n-4,3]])for(let r=-4;r<=4;r+=1)for(let c=-4;c<=4;c+=1){let u=i+r,f=s+c;if(u<0||u>=n||f<0||f>=n)continue;let h=Math.max(Math.abs(r),Math.abs(c));e.set(u,f,h!==2&&h!==4)}let o=ce(t),a=o.length-1;if(o.forEach((i,s)=>o.forEach((r,c)=>{if(!(s===0&&c===0||s===0&&c===a||s===a&&c===0))for(let u=-2;u<=2;u+=1)for(let f=-2;f<=2;f+=1)e.set(i+u,r+f,Math.max(Math.abs(u),Math.abs(f))!==1)})),W(e,0),t>=7){let i=t;for(let r=0;r<12;r+=1)i=i<<1^(i>>>11)*7973;let s=t<<12|i;for(let r=0;r<18;r+=1){let c=(s>>>r&1)===1,u=n-11+r%3,f=Math.floor(r/3);e.set(u,f,c),e.set(f,u,c)}}}m(le,"drawFunctionPatterns");function W(e,t){let n=e.size,o=re<<3|t,a=o;for(let r=0;r<10;r+=1)a=a<<1^(a>>>9)*1335;let i=(o<<10|a)^21522,s=m(r=>(i>>>r&1)===1,"bit");for(let r=0;r<=5;r+=1)e.set(r,8,s(r));e.set(7,8,s(6)),e.set(8,8,s(7)),e.set(8,7,s(8));for(let r=9;r<15;r+=1)e.set(8,14-r,s(r));for(let r=0;r<8;r+=1)e.set(8,n-1-r,s(r));for(let r=8;r<15;r+=1)e.set(n-15+r,8,s(r));e.set(n-8,8,!0)}m(W,"drawFormat");function me(e,t){let n=e.size,o=0;for(let a=n-1;a>=1;a-=2){a===6&&(a=5);for(let i=0;i<n;i+=1)for(let s=0;s<2;s+=1){let r=a-s,u=(a+1&2)===0?n-1-i:i;e.fixed[u*n+r]!==!0&&(o<t.length*8&&(e.dark[u*n+r]=(t[o>>>3]>>>7-(o&7)&1)===1),o+=1)}}}m(me,"placeData");function pe(e,t){let n=ue[t];for(let o=0;o<e.size;o+=1)for(let a=0;a<e.size;a+=1)e.fixed[o*e.size+a]!==!0&&n(o,a)&&(e.dark[o*e.size+a]=!e.dark[o*e.size+a])}m(pe,"applyMask");function de(e){let t=e.size,n=0,o=m(i=>{let s=1;for(let r=1;r<=t;r+=1)r<t&&i(r)===i(r-1)?s+=1:(s>=5&&(n+=3+(s-5)),s=1);for(let r=0;r+10<t;r+=1){let c=[!0,!1,!0,!0,!0,!1,!0];if(!(c.every((y,p)=>i(r+p)===y)||c.every((y,p)=>i(r+4+p)===y)))continue;let f=[0,1,2,3].every(y=>!i(r+y))&&c.every((y,p)=>i(r+4+p)===y),h=c.every((y,p)=>i(r+p)===y)&&[7,8,9,10].every(y=>!i(r+y));f&&(n+=40),h&&(n+=40)}},"line");for(let i=0;i<t;i+=1)o(s=>e.get(i,s));for(let i=0;i<t;i+=1)o(s=>e.get(s,i));for(let i=0;i+1<t;i+=1)for(let s=0;s+1<t;s+=1){let r=e.get(i,s);r===e.get(i,s+1)&&r===e.get(i+1,s)&&r===e.get(i+1,s+1)&&(n+=3)}let a=e.dark.filter(Boolean).length;return n+=Math.floor(Math.abs(a*20-t*t*10)/(t*t))*10,n}m(de,"penalty");function j(e,t={}){let n=new TextEncoder().encode(e),o=1;for(;o<=Q&&!(4+(o<10?8:16)+n.length*8<=L(o)*8);o+=1);if(o>Q)throw new RangeError("text too long for a QR code");let a=se(n,o),i=m(c=>{let u=new V(o*4+17);return le(u,o),me(u,a),pe(u,c),W(u,c),u},"build"),s=null;if(t.mask!==void 0)s=i(t.mask);else{let c=Number.POSITIVE_INFINITY;for(let u=0;u<8;u+=1){let f=i(u),h=de(f);h<c&&(c=h,s=f)}}let r=s;return{size:r.size,get:m((c,u)=>r.get(c,u),"get")}}m(j,"encodeQr");function X(e,t=4){let n=[];for(let o=0;o<e.size;o+=1)for(let a=0;a<e.size;a+=1)e.get(o,a)&&n.push(`M${a+t} ${o+t}h1v1h-1z`);return{size:e.size+t*2,d:n.join("")}}m(X,"qrPath");import{Fragment as Ce,jsx as l,jsxs as k}from"react/jsx-runtime";var he={en:A,fr:G,ar:$,es:A,pt:A,de:A},Z={en:I,fr:H,ar:E,es:I,pt:I,de:I};function g(e){let t=e.strings;return(n,o)=>P(t[n]??he[e.locale][n]??"",o)}m(g,"flowT");function ee(e,t){let n=g(t);return e.flatMap(o=>{let a=o.service==="phone_otp"?n("contact.phone"):o.service==="email_otp"?n("contact.email"):R(o,t),i=U[o.service];return a===null?[]:[{id:o.id,label:a,...i!==void 0?{glyph:l(K,{name:i})}:{}}]})}m(ee,"labelled");function te({step:e,i18n:t,onError:n}){let o=g(t),{busy:a,error:i,run:s}=N(t,n),r=e.kind==="contact_choice";return l(M,{title:o(r?"contact.title":"choice.title"),description:o(r?"contact.description":"choice.description"),options:ee(e.choice.options,t),busy:a,error:i,focus:!0,testId:r?"sekyro-contact-choice":"sekyro-choice",onChoose:c=>s(()=>e.choose(c))})}m(te,"PlanChoiceView");var Ge=te,Qe=te;function We({step:e,i18n:t,onError:n,onOpen:o}){let a=g(t),{busy:i,error:s,run:r}=N(t,n),c=e,u=e.context.switchable,f=u===void 0?[]:u.options.filter(v=>v.id!==u.current),h=c.kind==="registry"&&(c.reason==="nni_not_found"||c.reason==="registry_record_not_found")&&c.canUseDocument||c.kind==="eid"&&c.reason?.startsWith("eid_")&&c.canUseCamera,y=f.length===1?f[0]:void 0,p=y!==void 0&&(y.service==="phone_otp"||y.service==="email_otp"),d=p&&c.canSwitch&&c.switchTo!==void 0?()=>c.switchTo.call(e):c.chooseOption===void 0||y===void 0?void 0:()=>c.chooseOption.call(e,y.id);if(f.length===0||h||y!==void 0&&(d===void 0||b()===null)||y===void 0&&c.chooseOption===void 0)return null;function b(){return y===void 0?a("choice.switch"):y.service==="phone_otp"||y.service==="email_otp"?a("contact.switch"):c.kind==="registry"&&y.service==="document"?t.t("population.useDocument"):c.kind==="eid"?t.strings["eid.useCamera"]??Z[t.locale]["eid.useCamera"]:R(y,t)}return m(b,"labelOf"),k("div",{className:"sekyro-stack sekyro-stack--1",children:[s!==null?l(x,{tone:"danger",children:l("span",{children:s})}):null,l(w,{kind:"ghost",disabled:i,"aria-busy":i||void 0,onClick:()=>d===void 0?o():r(d),"data-testid":p?"sekyro-contact-switch":"sekyro-lane-switch",children:b()})]})}m(We,"LaneSwitch");function je({step:e,i18n:t,onError:n,onClose:o}){let a=g(t),{busy:i,error:s,run:r}=N(t,n),c=e.context.switchable,u=e.chooseOption;return c===void 0||u===void 0?null:l(M,{title:a("choice.title"),description:a("choice.description"),options:ee(c.options,t),...c.current!==null?{marked:c.current}:{},busy:i,error:s,focus:!0,testId:"sekyro-lane-choice",onChoose:f=>f===c.current?o():r(()=>u.call(e,f))})}m(je,"LaneChoiceView");var be=[["fullName","summary.fullName",!1],["birthDate","summary.birthDate",!0],["birthYear","summary.birthYear",!0],["nationality","summary.nationality",!0],["documentType","summary.documentType",!1],["documentNumberMasked","summary.documentNumber",!0],["idNumberMasked","summary.id_number",!0],["expiryDate","summary.expiryDate",!0]];function ke(e){let[t,n]=_(null);return q(()=>{if(!e.portraitAvailable)return;let o=!0,a=null;return e.portrait().then(i=>{!o||i===null||!i.type.startsWith("image/")||typeof URL.createObjectURL!="function"||(a=URL.createObjectURL(i),n(a))}),()=>{o=!1,a!==null&&URL.revokeObjectURL(a)}},[e.portraitAvailable]),t}m(ke,"usePortraitUrl");function Xe({step:e,i18n:t,onError:n}){let o=g(t),a=F(),i=S(),s=ke(e),{busy:r,error:c,run:u}=N(t,n),f=e.context.orgName,h=["registry","document","chip"].find(d=>d===e.source),y=e.summaryKind==="partial",p=m(d=>t.strings[`doc.type.${d}`]??d,"documentLabel");return k("section",{className:"sekyro-stack sekyro-stack--4","aria-labelledby":a,"data-testid":"sekyro-identity-summary",children:[k("div",{className:"sekyro-stack sekyro-stack--1",children:[l("h2",{id:a,ref:i,tabIndex:-1,className:"sekyro-text-body",children:o("summary.title")}),l("p",{className:"sekyro-text-muted",children:o("summary.description")}),h!==void 0?l("p",{className:"sekyro-text-muted",children:o(`summary.source.${h}`)}):null]}),k("div",{className:"sekyro-summary",children:[s!==null?l("img",{className:"sekyro-summary__portrait",src:s,alt:o("summary.portraitAlt")}):null,l("dl",{className:"sekyro-summary__list",children:be.map(([d,b,v])=>{let z=d==="idNumberMasked"?e.idNumberMasked??e.nniMasked:e[d];return z===void 0?null:k("div",{className:"sekyro-summary__row",children:[l("dt",{className:"sekyro-text-muted",children:o(d==="fullName"&&y?"summary.name":b)}),l("dd",{children:v?l("bdi",{dir:"ltr",children:z}):d==="documentType"?p(z):z})]},d)})})]}),c!==null?l(x,{tone:"danger",children:l("span",{children:c})}):null,k("div",{className:"sekyro-stack sekyro-stack--3",children:[l(w,{full:!0,disabled:r,"aria-busy":r||void 0,onClick:()=>u(()=>e.confirm()),children:o("summary.confirm")}),e.retakeAvailable?l(w,{kind:"ghost",full:!0,disabled:r,onClick:()=>u(()=>e.retake()),children:o(e.retakeTarget==="national_number"?"summary.retakeNationalNumber":"summary.retakeDocument")}):l("p",{className:"sekyro-text-muted",children:o("summary.noRetake",{org:f})})]})]})}m(Xe,"IdentitySummaryView");var ge=["glasses","headwear","expression","faceCamera","background","lighting","hair"];function Je({step:e,i18n:t,livenessProps:n,sekyroIntro:o}){let a=g(t),[i,s]=_(null);q(()=>e.onLivePhoto(d=>{let b=d.update?.coach;s(d.holding||b===void 0?null:t.t(`portrait.coach.${b}`))}),[e,t]);let r=e.instructions==="icao",c=e.icao?.profile==="selfie",u=C(()=>r?ge.filter(d=>!c||d!=="background").map(d=>({id:d,text:a(`capture.tipsIcao.${d}`)})):void 0,[r,c,t]),f=C(()=>r&&!c?{...n.strings,"capture.tips.title":a("capture.tipsIcao.title")}:n.strings,[r,c,n.strings,t]),h=c?void 0:a("capture.tipsIcao.title"),y=C(()=>o===!0&&u!==void 0?{...n.slots,intro:m((d,b)=>l(Y,{start:d,context:b,tips:u,...h!==void 0?{tipsTitle:h}:{}}),"intro")}:n.slots,[o,u,h,n.slots,t]),p=c?`${(u??[]).map(d=>d.text).join(". ")}.`:a("capture.tipsIcao.summary");return l(B,{...n,...y!==void 0?{slots:y}:{},...f!==void 0?{strings:f}:{},...u!==void 0?{tips:u,tipsSummary:p}:{},coach:i})}m(Je,"LivePhotoLiveness");function Ze({i18n:e}){let t=g(e);return k(x,{tone:"info",children:[l("strong",{children:t("portrait.retakeOnly")}),l("span",{children:t("portrait.keepCamera")})]})}m(Ze,"PortraitRetakeNotice");function et({i18n:e,provider:t}){let n=e.strings,o=m(a=>n[a]??Z[e.locale][a]??"","pick");return l("p",{className:"sekyro-text-muted","data-testid":"sekyro-eid-continue",children:t?P(o("eid.continueHint"),{provider:t}):o("eid.continueHintGeneric")})}m(et,"EidContinueHint");async function we(e){try{return await navigator.clipboard.writeText(e),!0}catch{return!1}}m(we,"copy");function oe({url:e,i18n:t,label:n}){let o=g(t),[a,i]=_("idle"),s=n.startsWith("inApp.")?"inApp":"handoff";return k("div",{className:"sekyro-stack sekyro-stack--1",children:[l(w,{kind:"ghost",onClick:()=>{we(e).then(r=>i(r?"copied":"failed"))},children:o(n)}),l("p",{role:"status","aria-live":"polite",className:"sekyro-text-muted",children:a==="idle"?"":o(`${s}.${a==="copied"?"copied":"copyFailed"}`)})]})}m(oe,"CopyLink");function ne({url:e,i18n:t,refresh:n,footer:o}){let a=g(t),i=F(),s=C(()=>{try{return X(j(e))}catch{return null}},[e]),r=ye(n);r.current=n;let c=S();return q(()=>{let u=setInterval(()=>{(typeof document>"u"||document.visibilityState!=="hidden")&&r.current?.().catch(()=>{})},5e3);return()=>clearInterval(u)},[]),k("section",{className:"sekyro-stack sekyro-stack--3","aria-labelledby":i,"data-testid":"sekyro-handoff",children:[l("h2",{id:i,ref:c,tabIndex:-1,className:"sekyro-text-body",children:t.t("handoff.title")}),l("p",{className:"sekyro-text-muted",children:a("handoff.description")}),s!==null?k("svg",{className:"sekyro-qr",viewBox:`0 0 ${s.size} ${s.size}`,role:"img","aria-label":a("handoff.qrAlt"),shapeRendering:"crispEdges",children:[l("rect",{width:s.size,height:s.size,className:"sekyro-qr__bg"}),l("path",{d:s.d,className:"sekyro-qr__fg"})]}):null,l(oe,{url:e,i18n:t,label:"handoff.copyLink"}),l("p",{className:"sekyro-text-muted",children:a("handoff.waiting")}),o??null]})}m(ne,"HandoffView");var ve=["intro","data","processing","sharing","retention"];function tt({i18n:e}){let t=g(e);return l(Ce,{children:ve.map(n=>l("p",{children:t(`consent.human.terms.${n}`)},n))})}m(tt,"HumanConsentTerms");function ot({url:e,i18n:t}){return C(()=>!J(),[])?l(ne,{url:e,i18n:t}):null}m(ot,"DesktopHandoffView");function nt({i18n:e,cause:t,onRetry:n,onContinue:o,handoffUrl:a}){let i=g(e),s=F(),r=S(),[c,u]=_("idle"),f=C(()=>a!==void 0&&!J(),[a]),h=t==="denied",y=m(()=>{o!==void 0&&(u("busy"),o(t).then(()=>u("idle"),p=>u(p instanceof fe&&p.code==="check_out_of_order"?"idle":"failed")))},"end");return k("section",{className:"sekyro-stack sekyro-stack--3","aria-labelledby":s,"data-testid":"sekyro-no-camera","data-cause":t,children:[f&&a!==void 0?l(ne,{url:a,i18n:e}):null,l("h2",{id:s,ref:r,tabIndex:-1,className:"sekyro-text-body",children:i(h?"capture.noCamera.deniedTitle":"capture.noCamera.title")}),l("p",{className:"sekyro-text-muted",children:i(h?"capture.noCamera.deniedBody":"capture.noCamera.body")}),c==="failed"?l(x,{tone:"danger",children:l("span",{children:e.t("errors.network_error")})}):null,l(w,{kind:h?"primary":"ghost",onClick:n,children:e.t("common.retry")}),o!==void 0?l(w,{kind:"ghost",disabled:c==="busy","aria-busy":c==="busy"||void 0,onClick:y,children:i("capture.noCamera.continue")}):null]})}m(nt,"NoCameraView");function rt({url:e,i18n:t,onContinue:n}){let o=g(t),a=F(),i=S();return k("section",{className:"sekyro-stack sekyro-stack--3","aria-labelledby":a,"data-testid":"sekyro-in-app",children:[l("h2",{id:a,ref:i,tabIndex:-1,className:"sekyro-text-body",children:o("inApp.title")}),l("p",{className:"sekyro-text-muted",children:o("inApp.description")}),l(oe,{url:e,i18n:t,label:"inApp.copyLink"}),l(w,{kind:"ghost",onClick:n,children:o("inApp.continueAnyway")})]})}m(rt,"InAppBrowserPrompt");export{Ge as ContactChoiceView,ot as DesktopHandoffView,et as EidContinueHint,Qe as GenericChoiceView,ne as HandoffView,tt as HumanConsentTerms,Xe as IdentitySummaryView,rt as InAppBrowserPrompt,je as LaneChoiceView,We as LaneSwitch,Je as LivePhotoLiveness,nt as NoCameraView,Ze as PortraitRetakeNotice};