@sekyro/react 0.1.0-rc.30 → 0.1.0-rc.31

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (42) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/dist/{chunk-KJT5NUFX.js → chunk-AZF7USGM.js} +1 -1
  3. package/dist/{chunk-23GZ62S2.js → chunk-DYWLZHSM.js} +1 -1
  4. package/dist/{chunk-KK5O6LP4.js → chunk-JEOESSNW.js} +1 -1
  5. package/dist/{chunk-VXMOKB43.js → chunk-K5H7KWEY.js} +1 -1
  6. package/dist/{chunk-XQFVLRIY.js → chunk-M7JKVIGW.js} +1 -1
  7. package/dist/{chunk-U4KOMPUR.js → chunk-MBLJZVNN.js} +1 -1
  8. package/dist/{chunk-TCSAUR2Y.js → chunk-OHNOGFT2.js} +1 -1
  9. package/dist/{chunk-FJ3AON46.js → chunk-PMNUDJWG.js} +1 -1
  10. package/dist/{chunk-QL2NK7GA.js → chunk-Q5BGUJMS.js} +1 -1
  11. package/dist/{chunk-5WLMXBCT.js → chunk-QD66CL7R.js} +1 -1
  12. package/dist/{chunk-OXGWLJ5D.js → chunk-RGI6OVB2.js} +1 -1
  13. package/dist/{chunk-ZOE5QUGI.js → chunk-VNVE5DMF.js} +1 -1
  14. package/dist/chunk-WC4U54LZ.js +2 -0
  15. package/dist/{document-capture-view-2NFKF44N.js → document-capture-view-GENB535Z.js} +1 -1
  16. package/dist/{eid-view-UGYVZ5NM.js → eid-view-IQRZGEMP.js} +1 -1
  17. package/dist/{email-otp-view-ENQVRS66.js → email-otp-view-CL76K5TY.js} +1 -1
  18. package/dist/{flow-views-HNJPDQ63.js → flow-views-C3EIMXME.js} +1 -1
  19. package/dist/{form-view-6ERKUFVD.js → form-view-MEYCK437.js} +1 -1
  20. package/dist/index.cjs +1 -1
  21. package/dist/index.d.cts +2 -2
  22. package/dist/index.d.ts +2 -2
  23. package/dist/index.js +1 -1
  24. package/dist/overlay-de-LOQWEHOH.js +2 -0
  25. package/dist/overlay-es-F54CKFZO.js +2 -0
  26. package/dist/overlay-pt-NHIQY3JB.js +2 -0
  27. package/dist/{portrait-capture-view-ARRN3JW6.js → portrait-capture-view-VTN2VU3E.js} +1 -1
  28. package/dist/portrait-review-view-JTRGDYNV.js +2 -0
  29. package/dist/{proof-of-address-view-46Q6F7H5.js → proof-of-address-view-UQOZZXQO.js} +1 -1
  30. package/dist/{theme-DbHOQCyE.d.ts → theme-BASMEql8.d.cts} +1 -0
  31. package/dist/{theme-DbHOQCyE.d.cts → theme-BASMEql8.d.ts} +1 -0
  32. package/dist/verification/index.cjs +1 -1
  33. package/dist/verification/index.d.cts +2 -2
  34. package/dist/verification/index.d.ts +2 -2
  35. package/dist/verification/index.js +1 -1
  36. package/package.json +2 -2
  37. package/sbom.cdx.json +4 -4
  38. package/dist/chunk-5EPFSWU5.js +0 -2
  39. package/dist/overlay-de-2DL4MNC7.js +0 -2
  40. package/dist/overlay-es-FMHWRKQW.js +0 -2
  41. package/dist/overlay-pt-OGIELLCM.js +0 -2
  42. package/dist/portrait-review-view-JF6TYNBU.js +0 -2
package/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  # @sekyro/react
2
2
 
3
+ ## 0.1.0-rc.31
4
+
5
+ ### Patch Changes
6
+
7
+ - b61c1b7: When the browser check fails because the phone's date and time are wrong (`attestationError: "clock_wrong"`), `<LivenessCapture>` says "Set your phone's date and time to automatic, then try again" (`errors.device_clock`, six languages). After a failed browser check the button reads "Try again" and resubmits the same video instead of starting a new attempt.
8
+ - Updated dependencies [b61c1b7]
9
+ - @sekyro/web@0.1.0-rc.33
10
+
3
11
  ## 0.1.0-rc.30
4
12
 
5
13
  ### Minor Changes
@@ -1,2 +1,2 @@
1
1
  "use client";
2
- import{c as g}from"./chunk-VXMOKB43.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 Geist Fallback", "Sekyro Geist Fallback Roboto", "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(r={}){let e={};for(let o of Object.keys(l))e[l[o]]=r.colors?.[o]??t.colors[o];return e["--sekyro-radius"]=r.radius??t.radius,e["--sekyro-font"]=r.fontFamily??t.fontFamily,e}s(S,"themeToCssVars");var k=/^#[0-9a-f]{6}$/i,m=["brand","brandFg","bg","surface","fg","fgMuted"],b=["danger","success","warning"],u=!1;function p(r){let e=r?.colors;if(r===void 0||e===void 0||!b.some(i=>i in e))return r;!u&&g()&&(u=!0,console.warn("[sekyro] theme.colors.danger/success/warning are ignored: status colours are standard (removed in 1.0)"));let{danger:o,success:a,warning:f,...n}=e;return{...r,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 x(r){let e={};if(!r)return e;let o={},a=r.colors??{};for(let i of m){let d=a[i];d!==void 0&&k.test(d)&&(o[i]=d)}o.brand&&(o.ring=o.brand),Object.keys(o).length&&(e.colors=o);let f=T[r.radius];f&&(e.radius=f);let n=h[r.fontFamily];return n!==void 0&&(e.fontFamily=n?`${n}, ${t.fontFamily}`:t.fontFamily),e}s(x,"brandingToTheme");function I(...r){let e={};for(let o of r)o?.colors&&(e.colors={...e.colors,...o.colors}),o?.radius&&(e.radius=o.radius),o?.fontFamily&&(e.fontFamily=o.fontFamily);return e}s(I,"mergeThemes");function C({theme:r,children:e,className:o}){return y(R,{theme:p(r),...o!==void 0?{className:o}:{},children:e})}s(C,"SekyroThemeProvider");function R({theme:r,children:e,className:o}){let a=S(r);return y("div",{className:o===void 0?"sekyro-root":`sekyro-root ${o}`,style:a,children:e})}s(R,"SekyroThemeRoot");export{c as a,t as b,S as c,p as d,x as e,I as f,C as g,R as h};
2
+ import{c as g}from"./chunk-K5H7KWEY.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 Geist Fallback", "Sekyro Geist Fallback Roboto", "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(r={}){let e={};for(let o of Object.keys(l))e[l[o]]=r.colors?.[o]??t.colors[o];return e["--sekyro-radius"]=r.radius??t.radius,e["--sekyro-font"]=r.fontFamily??t.fontFamily,e}s(S,"themeToCssVars");var k=/^#[0-9a-f]{6}$/i,m=["brand","brandFg","bg","surface","fg","fgMuted"],b=["danger","success","warning"],u=!1;function p(r){let e=r?.colors;if(r===void 0||e===void 0||!b.some(i=>i in e))return r;!u&&g()&&(u=!0,console.warn("[sekyro] theme.colors.danger/success/warning are ignored: status colours are standard (removed in 1.0)"));let{danger:o,success:a,warning:f,...n}=e;return{...r,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 x(r){let e={};if(!r)return e;let o={},a=r.colors??{};for(let i of m){let d=a[i];d!==void 0&&k.test(d)&&(o[i]=d)}o.brand&&(o.ring=o.brand),Object.keys(o).length&&(e.colors=o);let f=T[r.radius];f&&(e.radius=f);let n=h[r.fontFamily];return n!==void 0&&(e.fontFamily=n?`${n}, ${t.fontFamily}`:t.fontFamily),e}s(x,"brandingToTheme");function I(...r){let e={};for(let o of r)o?.colors&&(e.colors={...e.colors,...o.colors}),o?.radius&&(e.radius=o.radius),o?.fontFamily&&(e.fontFamily=o.fontFamily);return e}s(I,"mergeThemes");function C({theme:r,children:e,className:o}){return y(R,{theme:p(r),...o!==void 0?{className:o}:{},children:e})}s(C,"SekyroThemeProvider");function R({theme:r,children:e,className:o}){let a=S(r);return y("div",{className:o===void 0?"sekyro-root":`sekyro-root ${o}`,style:a,children:e})}s(R,"SekyroThemeRoot");export{c as a,t as b,S as c,p as d,x as e,I as f,C as g,R as h};
@@ -1,2 +1,2 @@
1
1
  "use client";
2
- import{b as i,d as u,e as f,f as y,g,h as S,i as l,j as p}from"./chunk-5EPFSWU5.js";import{a as s}from"./chunk-2KED7D2Q.js";import{createContext as m,useContext as x,useEffect as L,useState as v}from"react";var d={ar:f,fr:y,en:i};function T(e,t){let n=S(e),r=n===void 0?d[g(e)]:{...d.en,...n};if(t===void 0)return r;let o={...r};for(let a of Object.keys(t)){let c=t[a];typeof c=="string"&&(o[a]=c)}return u(o,t),o}s(T,"resolveStrings");function w(e){let[,t]=v(0),n=l(e);return L(()=>{if(!n)return;let r=!0;return p(e).then(()=>r&&t(o=>o+1)),()=>{r=!1}},[e,n]),!n}s(w,"useLocaleReady");var k=m(e=>i[e]??""),C=k.Provider;function I(){return x(k)}s(I,"useStrings");export{T as a,w as b,C as c,I as d};
2
+ import{b as i,d as u,e as f,f as y,g,h as S,i as l,j as p}from"./chunk-WC4U54LZ.js";import{a as s}from"./chunk-2KED7D2Q.js";import{createContext as m,useContext as x,useEffect as L,useState as v}from"react";var d={ar:f,fr:y,en:i};function T(e,t){let n=S(e),r=n===void 0?d[g(e)]:{...d.en,...n};if(t===void 0)return r;let o={...r};for(let a of Object.keys(t)){let c=t[a];typeof c=="string"&&(o[a]=c)}return u(o,t),o}s(T,"resolveStrings");function w(e){let[,t]=v(0),n=l(e);return L(()=>{if(!n)return;let r=!0;return p(e).then(()=>r&&t(o=>o+1)),()=>{r=!1}},[e,n]),!n}s(w,"useLocaleReady");var k=m(e=>i[e]??""),C=k.Provider;function I(){return x(k)}s(I,"useStrings");export{T as a,w as b,C as c,I as d};
@@ -1,2 +1,2 @@
1
1
  "use client";
2
- import{c as P}from"./chunk-XQFVLRIY.js";import{a as C,j as L,n as z}from"./chunk-QL2NK7GA.js";import{a as d}from"./chunk-2KED7D2Q.js";import{useLayoutEffect as H,useRef as U,useState as A}from"react";import{jsx as s,jsxs as o}from"react/jsx-runtime";var N=72;function B(c,r){let n=c*.72,a=n*1.32;return{cx:c/2,cy:(r-a)/2.1+a/2,a:n/2,b:a/2}}d(B,"faceOval");function E({cx:c,cy:r,a:n,b:a}){return Array.from({length:N},(R,$)=>{let u=-Math.PI/2+$/N*2*Math.PI,y=Math.cos(u),l=Math.sin(u),f=c+n*y,p=r+a*l,h=Math.hypot(a*y,n*l),k=a*y/h,v=n*l/h,i=d(b=>Math.round(b*10)/10,"r");return`M${i(f+k*16)} ${i(p+v*16)}L${i(f+k*28)} ${i(p+v*28)}`})}d(E,"ticks");function T({video:c,instruction:r,note:n,status:a,busy:R,progress:$,still:u,overlay:y,ramp:l,onClose:f,closeLabel:p,end:h,live:k=!0,children:v,testId:i}){L(k);let b=U(null),[t,F]=A({w:0,h:0});H(()=>{let x=b.current;if(x===null)return;let O=d(()=>F({w:x.clientWidth,h:x.clientHeight}),"measure");if(O(),typeof ResizeObserver>"u")return;let I=new ResizeObserver(O);return I.observe(x),()=>I.disconnect()},[]);let e=B(t.w,t.h),g=t.w>0?E(e):[],M=Math.round(Math.min(1,Math.max(0,$))*N),S=e.cy-e.b,m=Math.max(e.a,e.b)+40,w=70*Math.PI/180;return s("section",{className:"sekyro-lm sekyro-fc","aria-label":r,"data-testid":i,"data-ramp":l?"":void 0,children:o("div",{ref:b,className:"sekyro-lm-stage",children:[c,u?s("img",{className:"sekyro-lm-video sekyro-fc-still",src:u,alt:""}):null,y,s(P,{colour:l??null}),t.w>0?o("svg",{className:"sekyro-lm-overlay",viewBox:`0 0 ${t.w} ${t.h}`,"aria-hidden":"true",focusable:"false",children:[o("defs",{children:[o("linearGradient",{id:"sekyro-fc-fade",gradientUnits:"userSpaceOnUse",x1:e.cx-m*Math.sin(w),y1:e.cy,x2:e.cx,y2:e.cy,children:[s("stop",{offset:"0",className:"sekyro-fc-fade",stopOpacity:"0"}),s("stop",{offset:"1",className:"sekyro-fc-fade"})]}),s("mask",{id:"sekyro-fc-light",maskUnits:"userSpaceOnUse",x:"0",y:"0",width:t.w,height:t.h,children:s("path",{className:"sekyro-fc-sweep",style:{transformOrigin:`${e.cx}px ${e.cy}px`},d:`M${e.cx} ${e.cy}L${e.cx-m*Math.sin(w)} ${e.cy-m*Math.cos(w)}A${m} ${m} 0 0 1 ${e.cx} ${e.cy-m}Z`,fill:"url(#sekyro-fc-fade)"})})]}),s("path",{className:"sekyro-fc-scrim",fillRule:"evenodd",d:`M0 0H${t.w}V${t.h}H0Z M${e.cx-e.a} ${e.cy}a${e.a} ${e.b} 0 1 0 ${2*e.a} 0a${e.a} ${e.b} 0 1 0 ${-2*e.a} 0Z`}),s("ellipse",{className:"sekyro-fc-rim",cx:e.cx,cy:e.cy,rx:e.a,ry:e.b}),s("path",{className:"sekyro-fc-ticks",d:g.join("")}),M>0?s("path",{className:"sekyro-fc-ticks is-done",d:g.slice(0,M).join("")}):null,M<N?s("path",{className:"sekyro-fc-ticks is-light",d:g.join(""),mask:"url(#sekyro-fc-light)"}):null]}):null,s("div",{className:"sekyro-lm-instruction sekyro-fc-instruction",style:{insetBlockStart:S-80},children:s("div",{role:"status","aria-live":"polite",children:s(z,{swapKey:r,className:"sekyro-lm-line",children:r})})}),a!==void 0?s("p",{role:"status",className:"sekyro-visually-hidden","data-testid":"sekyro-camera-status",children:a??""}):null,n?o("p",{className:"sekyro-lm-under sekyro-lm-note",style:{insetBlockStart:S+2*e.b+48},children:[R?s("span",{className:"sekyro-lm-spinner","aria-hidden":"true"}):null,s("span",{children:n})]}):null,o("div",{className:"sekyro-lm-controls",children:[o("div",{className:"sekyro-lm-bar",children:[f!==void 0?s("button",{type:"button",className:"sekyro-glass","aria-label":p,onClick:f,children:s(C,{name:"close"})}):null,h]}),v]})]})})}d(T,"FaceCamera");export{T as a};
2
+ import{c as P}from"./chunk-M7JKVIGW.js";import{a as C,j as L,n as z}from"./chunk-Q5BGUJMS.js";import{a as d}from"./chunk-2KED7D2Q.js";import{useLayoutEffect as H,useRef as U,useState as A}from"react";import{jsx as s,jsxs as o}from"react/jsx-runtime";var N=72;function B(c,r){let n=c*.72,a=n*1.32;return{cx:c/2,cy:(r-a)/2.1+a/2,a:n/2,b:a/2}}d(B,"faceOval");function E({cx:c,cy:r,a:n,b:a}){return Array.from({length:N},(R,$)=>{let u=-Math.PI/2+$/N*2*Math.PI,y=Math.cos(u),l=Math.sin(u),f=c+n*y,p=r+a*l,h=Math.hypot(a*y,n*l),k=a*y/h,v=n*l/h,i=d(b=>Math.round(b*10)/10,"r");return`M${i(f+k*16)} ${i(p+v*16)}L${i(f+k*28)} ${i(p+v*28)}`})}d(E,"ticks");function T({video:c,instruction:r,note:n,status:a,busy:R,progress:$,still:u,overlay:y,ramp:l,onClose:f,closeLabel:p,end:h,live:k=!0,children:v,testId:i}){L(k);let b=U(null),[t,F]=A({w:0,h:0});H(()=>{let x=b.current;if(x===null)return;let O=d(()=>F({w:x.clientWidth,h:x.clientHeight}),"measure");if(O(),typeof ResizeObserver>"u")return;let I=new ResizeObserver(O);return I.observe(x),()=>I.disconnect()},[]);let e=B(t.w,t.h),g=t.w>0?E(e):[],M=Math.round(Math.min(1,Math.max(0,$))*N),S=e.cy-e.b,m=Math.max(e.a,e.b)+40,w=70*Math.PI/180;return s("section",{className:"sekyro-lm sekyro-fc","aria-label":r,"data-testid":i,"data-ramp":l?"":void 0,children:o("div",{ref:b,className:"sekyro-lm-stage",children:[c,u?s("img",{className:"sekyro-lm-video sekyro-fc-still",src:u,alt:""}):null,y,s(P,{colour:l??null}),t.w>0?o("svg",{className:"sekyro-lm-overlay",viewBox:`0 0 ${t.w} ${t.h}`,"aria-hidden":"true",focusable:"false",children:[o("defs",{children:[o("linearGradient",{id:"sekyro-fc-fade",gradientUnits:"userSpaceOnUse",x1:e.cx-m*Math.sin(w),y1:e.cy,x2:e.cx,y2:e.cy,children:[s("stop",{offset:"0",className:"sekyro-fc-fade",stopOpacity:"0"}),s("stop",{offset:"1",className:"sekyro-fc-fade"})]}),s("mask",{id:"sekyro-fc-light",maskUnits:"userSpaceOnUse",x:"0",y:"0",width:t.w,height:t.h,children:s("path",{className:"sekyro-fc-sweep",style:{transformOrigin:`${e.cx}px ${e.cy}px`},d:`M${e.cx} ${e.cy}L${e.cx-m*Math.sin(w)} ${e.cy-m*Math.cos(w)}A${m} ${m} 0 0 1 ${e.cx} ${e.cy-m}Z`,fill:"url(#sekyro-fc-fade)"})})]}),s("path",{className:"sekyro-fc-scrim",fillRule:"evenodd",d:`M0 0H${t.w}V${t.h}H0Z M${e.cx-e.a} ${e.cy}a${e.a} ${e.b} 0 1 0 ${2*e.a} 0a${e.a} ${e.b} 0 1 0 ${-2*e.a} 0Z`}),s("ellipse",{className:"sekyro-fc-rim",cx:e.cx,cy:e.cy,rx:e.a,ry:e.b}),s("path",{className:"sekyro-fc-ticks",d:g.join("")}),M>0?s("path",{className:"sekyro-fc-ticks is-done",d:g.slice(0,M).join("")}):null,M<N?s("path",{className:"sekyro-fc-ticks is-light",d:g.join(""),mask:"url(#sekyro-fc-light)"}):null]}):null,s("div",{className:"sekyro-lm-instruction sekyro-fc-instruction",style:{insetBlockStart:S-80},children:s("div",{role:"status","aria-live":"polite",children:s(z,{swapKey:r,className:"sekyro-lm-line",children:r})})}),a!==void 0?s("p",{role:"status",className:"sekyro-visually-hidden","data-testid":"sekyro-camera-status",children:a??""}):null,n?o("p",{className:"sekyro-lm-under sekyro-lm-note",style:{insetBlockStart:S+2*e.b+48},children:[R?s("span",{className:"sekyro-lm-spinner","aria-hidden":"true"}):null,s("span",{children:n})]}):null,o("div",{className:"sekyro-lm-controls",children:[o("div",{className:"sekyro-lm-bar",children:[f!==void 0?s("button",{type:"button",className:"sekyro-glass","aria-label":p,onClick:f,children:s(C,{name:"close"})}):null,h]}),v]})]})})}d(T,"FaceCamera");export{T as a};
@@ -1,2 +1,2 @@
1
1
  "use client";
2
- import{a as sn,c as cn}from"./chunk-XQFVLRIY.js";import{b as an,c as Qe}from"./chunk-7MMT5M4E.js";import{a as nn,b as rn,c as on,d as $}from"./chunk-23GZ62S2.js";import{a as F,k as Wt,l as Qt,n as Jt,o as Xt,p as en,q as tn,r as D,s as Je}from"./chunk-5EPFSWU5.js";import{a as n}from"./chunk-2KED7D2Q.js";import{useId as Cr}from"react";import{Fragment as vr,jsx as M,jsxs as ee}from"react/jsx-runtime";function te({className:e,children:t}){return M("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(te,"Svg");var gt="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 ln(e){return ee(te,{...e,children:[M("circle",{cx:"12",cy:"12",r:"4"}),M("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(ln,"SunIcon");function un(e){return ee(te,{...e,children:[M("circle",{cx:"12",cy:"12",r:"9"}),M("path",{d:"M9 10h.01M15 10h.01M8.8 14.6a4.2 4.2 0 0 0 6.4 0"})]})}n(un,"FaceUncoveredIcon");function dn(e){return ee(te,{...e,children:[M("rect",{x:"7",y:"2.5",width:"10",height:"19",rx:"2"}),M("path",{d:"M10.5 18.5h3M2.5 9.5h2.5M19 9.5h2.5"}),M("circle",{cx:"12",cy:"9.5",r:"1.6"})]})}n(dn,"PhoneEyeLevelIcon");function pn(e){return ee(te,{...e,children:[M("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"}),M("circle",{cx:"12",cy:"12",r:"2.8"})]})}n(pn,"LookStraightIcon");function fn(e){return ee(te,{...e,children:[M("path",{d:gt}),M("path",{d:"M9 13l2 2 4-4"})]})}n(fn,"CameraCheckIcon");function mn(e){return ee(te,{...e,children:[M("path",{d:gt}),M("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(mn,"CameraAskIcon");function yn(e){return ee(te,{...e,children:[M("path",{d:gt}),M("path",{d:"M3 3l18 18"})]})}n(yn,"CameraBlockedIcon");function Ve({off:e,className:t}){return ee(te,{className:t,children:[M("path",{d:"M4.5 9.5v5H8l4 3.5v-12L8 9.5H4.5Z"}),e?M("path",{d:"M4 4l16 16"}):ee(vr,{children:[M("path",{d:"M15.5 9.7a3.6 3.6 0 0 1 0 4.6"}),M("path",{d:"M18 7.6a6.6 6.6 0 0 1 0 8.8"})]})]})}n(Ve,"SpeakerIcon");function gn(e){return M(te,{...e,children:M("path",{d:"M5 12.5l4.5 4.5L19 7.5"})})}n(gn,"CheckIcon");function hn(e){return ee(te,{className:e.className??"sekyro-spinner",children:[M("circle",{cx:"12",cy:"12",r:"9",opacity:"0.25"}),M("path",{d:"M21 12a9 9 0 0 0-9-9"})]})}n(hn,"SpinnerIcon");import{jsx as pe,jsxs as vn}from"react/jsx-runtime";var Xe=["light","uncover","eyeLevel","straight"],kr={light:{key:"capture.tips.light",icon:n(()=>pe(ln,{}),"icon")},uncover:{key:"capture.tips.uncover",icon:n(()=>pe(un,{}),"icon")},eyeLevel:{key:"capture.tips.eyeLevel",icon:n(()=>pe(dn,{}),"icon")},straight:{key:"capture.tips.straight",icon:n(()=>pe(pn,{}),"icon")}};function Cn({tips:e}){let t=$(),o=Cr();return e.length===0?null:vn("section",{className:"sekyro-tips","aria-labelledby":o,"data-testid":"sekyro-tips",children:[pe("p",{className:"sekyro-tips__title",id:o,children:t("capture.tips.title")}),pe("ul",{className:"sekyro-tips__list",children:e.map(r=>{let s=typeof r=="string"?kr[r]:void 0,c=typeof r=="string"?r:r.id,i=s!==void 0?s.icon():typeof r=="string"?void 0:r.icon,u=s!==void 0?t(s.key):typeof r=="string"?r:r.text;return vn("li",{className:"sekyro-tips__item",children:[i!=null?pe("span",{className:"sekyro-tips__icon","aria-hidden":"true",children:i}):null,pe("span",{children:u})]},c)})})]})}n(Cn,"TipList");import{useEffect as kn,useId as br,useRef as Sr,useState as Rr}from"react";import{jsx as W,jsxs as et}from"react/jsx-runtime";var Vr=220;function bn({title:e,description:t,options:o,busy:r,error:s,focus:c,testId:i,look:u="cards",marked:k,onChoose:b}){let y=br(),w=Je(),[S,d]=Rr(null),C=Sr(null);kn(()=>{s!==null&&d(null)},[s]),kn(()=>()=>{C.current!==null&&clearTimeout(C.current)},[]);let v=n(l=>{r||S!==null||(d(l),C.current=setTimeout(()=>{C.current=null,d(null),b(l)},Vr))},"choose");return et("section",{className:"sekyro-stack sekyro-stack--4 sekyro-choice","aria-labelledby":y,"data-testid":i,children:[et("div",{className:u==="cards"?"sekyro-heading":"sekyro-stack sekyro-stack--1",children:[W("h2",{id:y,ref:c?w:void 0,tabIndex:-1,className:"sekyro-text-body",children:e}),t!==void 0&&t!==""?W("p",{className:"sekyro-text-muted",children:t}):null]}),s!==null?W(D,{tone:"danger",children:W("span",{children:s})}):null,u==="buttons"?W("div",{className:"sekyro-stack sekyro-stack--3",children:o.map((l,L)=>W(F,{kind:L===0?"primary":"ghost",full:!0,disabled:r,"aria-busy":r||void 0,onClick:()=>b(l.id),children:l.label},l.id))}):W("div",{className:"sekyro-choices",children:o.map(l=>et("button",{type:"button",className:"sekyro-card","aria-pressed":(S??k)===l.id,"aria-busy":r||void 0,disabled:r||S!==null&&S!==l.id,onClick:()=>v(l.id),children:[l.glyph!==void 0?W("span",{className:"sekyro-card__tile",children:l.glyph}):null,et("span",{className:"sekyro-card__body",children:[W("span",{className:"sekyro-card__title",children:l.label}),l.sub!==void 0?W("span",{className:"sekyro-card__sub",children:l.sub}):null]}),W("span",{className:"sekyro-radio","aria-hidden":"true"})]},l.id))})]})}n(bn,"ChoiceScreen");var tt=["fcv3.no_face","fcv3.come_closer","fcv3.move_back","fcv3.center_face","fcv3.straighten","fcv3.more_light","fcv3.too_bright","fcv3.hold_still","fcv3.steady_camera","fcv3.hold_upright","fcv3.one_face","capture.tips.summary","capture.lookAtColours"];function he(e){return e!==null&&tt.includes(e)}n(he,"isVoiceKey");import{useCallback as re,useEffect as ve,useLayoutEffect as _r,useMemo as Ir,useRef as we,useState as Oe}from"react";var Mr=n((e,t)=>Object.prototype.hasOwnProperty.call(e,t),"own");function Me(e,t,o){let r;try{if(typeof e=="function")r=e(t,o);else{let s=e[o];r=s!=null&&Mr(s,t)?s[t]:null}}catch{return null}return typeof r=="string"&&r!==""?r:null}n(Me,"resolveClip");var wr="UklGRiQAAABXQVZFZm10IBAAAAABAAEAESsAACJWAAACABAAZGF0YQAAAAA=",Vn={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 Lr(){return ne()!==null&&typeof SpeechSynthesisUtterance=="function"}n(Lr,"speechAvailable");function Sn(e){return(e.split(/[-_]/)[0]??e).toLowerCase()}n(Sn,"baseLang");function Mn(e,t){let o=n(s=>s.replace(/_/g,"-").toLowerCase(),"norm"),r=Sn(t);return e.find(s=>o(s.lang)===o(t))??e.find(s=>Sn(s.lang)===r)}n(Mn,"pickVoice");function wn(e){if(!Lr())return!1;let t=[];try{t=ne()?.getVoices()??[]}catch{return!0}return t.length===0||Mn(t,e)!==void 0}n(wn,"speechUsable");function Ln(e){let t=ne();return t===null||typeof t.addEventListener!="function"?()=>{}:(t.addEventListener("voiceschanged",e),()=>t.removeEventListener?.("voiceschanged",e))}n(Ln,"subscribeVoices");function Ke(e){try{let t=typeof location<"u"?location.href:"http://localhost/",o=new URL(e,t);return`clip:${o.origin}${o.pathname}`}catch{return`clip:${e}`}}n(Ke,"clipIdentity");function Rn(e){e.pause(),e.removeAttribute("src"),e.load()}n(Rn,"release");function _n(){let e=null,t=null,o=0,r=null,s=[],c=new Map,i=n(()=>{s=ne()?.getVoices()??[]},"loadVoices"),u=!1,k=n(()=>{let d=ne();u||d===null||(u=!0,i(),d.addEventListener?.("voiceschanged",i))},"bindVoices"),b=n(()=>(e??(e=new Audio),e),"element"),y=n((d,C,v)=>{let l=ne();if(l!==null&&d!==""&&typeof SpeechSynthesisUtterance=="function"){k();let L=Mn(s,C);if(s.length===0||L!==void 0){l.cancel();let g=new SpeechSynthesisUtterance(d);g.lang=C,L!==void 0&&(g.voice=L),g.rate=.95,v!==void 0&&(g.onend=g.onerror=v),l.speak(g);return}}v?.()},"speak"),w=n(()=>{o+=1,r=null,e!==null&&(e.pause(),e.currentTime=0),ne()?.cancel()},"stop"),S=n(d=>{for(let C of d){let v=Ke(C);if(c.has(v))continue;let l=new Audio;l.preload="auto",l.src=C,c.set(v,l)}},"warmClips");return{say(d){let C=d.url!==null?Ke(d.url):`tts:${d.lang}:${d.text}`;if(C===r)return;r=C,o+=1;let v=o,l=d.onEnd,L=l!==void 0?()=>{v===o&&l()}:void 0;if(ne()?.cancel(),d.url!==null){let g=b();g.pause(),g.muted=!1,g.src=d.url,g.currentTime=0,g.onended=L??null,g.play()?.catch(V=>{v===o&&V?.name!=="AbortError"&&(d.speech?y(d.text,d.lang,L):L?.())});return}d.speech?y(d.text,d.lang,L):L?.()},unlock({lang:d,speech:C,prefetch:v}){let l=b();if(t===null&&typeof Blob=="function"&&typeof URL.createObjectURL=="function"){let V=Uint8Array.from(atob(wr),E=>E.charCodeAt(0));t=URL.createObjectURL(new Blob([V],{type:"audio/wav"}))}let L=l.paused===!1&&t!==null&&l.src!==t;t!==null&&!L&&(l.muted=!0,l.onended=null,l.src=t,l.play()?.catch(()=>{}));let g=ne();if(C&&g!==null&&typeof SpeechSynthesisUtterance=="function"){k();let V=new SpeechSynthesisUtterance(" ");V.volume=0,V.lang=d,g.speak(V)}S(v??[])},prefetch:S,stop:w,dispose(){w(),u&&ne()?.removeEventListener?.("voiceschanged",i),u=!1,t!==null&&URL.revokeObjectURL(t),t=null,e!==null&&Rn(e),e=null;for(let d of c.values())Rn(d);c.clear()}}}n(_n,"createVoicePlayer");var In="sekyro.voiceGuidance";function xn(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(xn,"readVoicePreference");function En(e,t){try{if(typeof window>"u")return;window.localStorage.setItem(e,t?"1":"0")}catch{}}n(En,"writeVoicePreference");var Ue="capture.tips.summary",xr=typeof window<"u"?_r:ve,Er=Object.freeze({});function ht(e,t){let o=new Set,r=[];for(let s of tt){let c=s===Ue?null:Me(e,s,t);c===null||o.has(Ke(c))||(o.add(Ke(c)),r.push(c))}return r}n(ht,"resolvedClipUrls");function vt({locale:e,defaultClips:t,options:o}){let r=o===!1,s=r?{}:o??{},c=s.storageKey===void 0?In:s.storageKey,[i,u]=Oe(s.defaultEnabled??!0),k=we(i),[b,y]=Oe(!1),[w,S]=Oe("none"),[d,C]=Oe(!1),v=we(!1),[l,L]=Oe(0),g=we(null),V=re(()=>(g.current??(g.current=_n()),g.current),[]),E=Vn[e],K=s.speechFallback,p=K===void 0||K===!0?!0:K===!1?!1:K.includes(e),U=s.clips??t??Er,H=we(!1),se=we(U);xr(()=>{se.current=U,k.current=i}),ve(()=>{if(r||c===null)return;let h=xn(c);h!==null&&(k.current=h,u(h))},[r,c]),ve(()=>{if(!(r||!p))return Ln(()=>L(h=>h+1))},[r,p]);let a=s.clips;ve(()=>{if(r)return;let h=p&&wn(E);y(ht(U,e).length>0||h),S(a!==void 0&&Me(a,Ue,e)!==null?"partner":Me(U,Ue,e)!==null||h?"default":"none")},[r,U,a,e,p,E,l]),ve(()=>{if(r||!i||!H.current)return;let h=ht(U,e);h.length>0&&V().prefetch(h)},[r,i,U,e,V]),ve(()=>()=>{g.current?.dispose(),g.current=null,H.current=!1},[]);let P=re(h=>{r||(H.current=!0,V().unlock({lang:E,speech:p,...h?{prefetch:ht(se.current,e)}:{}}))},[r,V,E,p,e]),_=re(()=>P(k.current),[P]),B=re(()=>{v.current=!1,C(!1)},[]),N=re(()=>{B(),g.current?.stop()},[B]),ie=re(()=>{v.current&&N()},[N]),ae=re((h,me)=>{if(r)return;if(v.current){N();return}let ce=V();ce.stop(),v.current=!0,C(!0);let I=me?.clip===!1?null:Me(se.current,Ue,e);ce.say({url:I,text:h,lang:E,speech:p,onEnd:B})},[r,N,V,e,E,p,B]),A=re(h=>{r||(h?P(!0):N(),c!==null&&En(c,h),k.current=h,u(h))},[r,P,N,c]),O=re(()=>A(!k.current),[A]),fe=re((h,me)=>{if(r||!i)return;v.current&&B();let ce=Me(se.current,h,e);V().say({url:ce,text:me,lang:E,speech:p})},[r,i,e,V,E,p,B]);return Ir(()=>({supported:!r&&b,enabled:!r&&i,setEnabled:A,toggle:O,unlock:_,speakKey:fe,stop:N,summary:r?"none":w,summaryPlaying:d,toggleSummary:ae,stopSummary:ie}),[r,b,i,A,O,_,fe,N,w,d,ae,ie])}n(vt,"useVoiceGuidance");function Ct(e,t,o,r){let{speakKey:s,stop:c,enabled:i}=e,u=we(!1);ve(()=>{if(!r||!i){u.current&&c(),u.current=!1;return}u.current=!0,he(t)&&t!==Ue&&o!==""&&s(t,o)},[r,i,t,o,s,c])}n(Ct,"useSpeakGuidance");import{isValidElement as ao,useCallback as it,useContext as co,useEffect as oe,useMemo as Ie,useRef as ke,useState as ir}from"react";import{useEffect as Nr,useRef as Ar}from"react";import{jsx as He,jsxs as An}from"react/jsx-runtime";function Pn(e){switch(e){case"multiple_faces":return"one_face";case"capture_back_camera":return"front_camera";case"capture_front_camera":return"back_camera";case"capture_not_upright":return"upright";case"media_unreadable":case"clip_too_short":return"recording";case"device_integrity_failed":return"device";default:return"face"}}n(Pn,"retryCoachingOf");var Nn={face:{title:"capture.retryCoaching.title",tips:["capture.retryCoaching.light","capture.retryCoaching.eyeLevel","capture.retryCoaching.head"]},one_face:{title:"capture.retryTips.title",tips:["capture.retryOneFace.alone","capture.retryOneFace.screens"]},front_camera:{title:"capture.retryTips.title",tips:["capture.retryFrontCamera.screenSide"]},back_camera:{title:"capture.retryTips.title",tips:["capture.retryBackCamera.backSide","capture.retryBackCamera.circle"]},upright:{title:"capture.retryTips.title",tips:["capture.retryUpright.vertical","capture.retryUpright.untilEnd"]},recording:{title:"capture.retryTips.title",tips:["capture.retryRecording.cameraOn","capture.retryRecording.stay","capture.retryRecording.network"]},device:{title:"capture.retryTips.title",tips:["capture.retryDevice.screenRecording","capture.retryDevice.phone"]}};function Tn({showCoaching:e,coaching:t="face",attemptsText:o,showRetake:r,onRetake:s}){let c=$(),i=Ar(null);return Nr(()=>{r&&i.current?.focus()},[r]),!e&&!r?null:An("div",{className:"sekyro-stack sekyro-stack--3","data-testid":"sekyro-captured-panel",children:[e?An("div",{className:"sekyro-stack sekyro-stack--1",children:[He("p",{className:"sekyro-text-body",children:c(Nn[t].title)}),He("ul",{className:"sekyro-coaching",children:Nn[t].tips.map(u=>He("li",{children:c(u)},u))}),o!==null?He("p",{className:"sekyro-text-muted","data-testid":"sekyro-attempts-remaining",children:o}):null]}):null,r?He(F,{ref:i,className:"sekyro-btn--start",onClick:s,children:c("capture.recordAgain")}):null]})}n(Tn,"CapturedPanel");function nt(){try{return process.env.NODE_ENV!=="production"}catch{return!1}}n(nt,"isDevBuild");import{createContext as Pr}from"react";var Kn=Pr(null);import{useCallback as Bn,useEffect as Gn,useRef as Le}from"react";import{useEffect as Tr,useState as Kr}from"react";import{jsx as Be,jsxs as Or}from"react/jsx-runtime";function On({state:e}){let t=$(),[o,r]=Kr(!1);Tr(()=>{e!=="unknown"&&r(!0)},[e]);let s=e==="granted"?Be(fn,{}):e==="denied"?Be(yn,{}):Be(mn,{});return Or("div",{role:o?"status":void 0,className:`sekyro-permission sekyro-permission--${e}`,"data-testid":"sekyro-permission","data-state":e,children:[Be("span",{className:"sekyro-permission__icon","aria-hidden":"true",children:s}),Be("span",{children:t(`capture.permission.${e}`)})]})}n(On,"PermissionRow");import{jsx as rt,jsxs as Un}from"react/jsx-runtime";function Hn({voice:e}){let t=$();if(!e.supported)return null;let o=e.enabled;return Un("button",{type:"button",role:"switch","aria-checked":o,className:"sekyro-switch","data-testid":"sekyro-voice-switch",onClick:()=>e.toggle(),children:[Un("span",{className:"sekyro-switch__label",children:[rt(Ve,{off:!o}),t("capture.voiceGuidance")]}),rt("span",{className:"sekyro-switch__track","aria-hidden":"true",children:rt("span",{className:"sekyro-switch__thumb",children:o?rt(gn,{className:"sekyro-switch__check"}):null})})]})}n(Hn,"VoiceSwitch");import{Fragment as Hr,jsx as q,jsxs as _e}from"react/jsx-runtime";function Fn({assets:e,onRetryAssets:t,permission:o,captureMode:r="self",voice:s,tips:c,summary:i,startLabel:u,startDisabled:k,onStart:b}){let y=$(),w=Le(i?.stop);w.current=i?.stop,Gn(()=>()=>w.current?.(),[]);let S=Le(null),d=Le(null),C=Le(null),v=Le(e),l=Le(!1);Gn(()=>{let U=v.current;if(v.current=e,U===e)return;let H=l.current;e!=="loading"&&(l.current=!1),Ur(S.current)&&(e==="failed"?C.current?.focus():H&&d.current?.focus())},[e]);let L=Bn(()=>{l.current=!0,t()},[t]),g=e==="loading",V=g||k,E=Bn(()=>{V||(w.current?.(),b())},[V,b]),K;return e==="failed"?K=_e(D,{tone:"danger",testId:"sekyro-assets-error",children:[q("p",{className:"sekyro-text-body",children:y("fcv2.err.models")}),q(F,{kind:"ghost",ref:C,className:"sekyro-btn--start",onClick:L,"data-testid":"sekyro-assets-retry",children:y("common.retry")})]}):K=_e("div",{className:"sekyro-stack sekyro-stack--1",children:[q(F,{ref:d,full:!0,"data-testid":"sekyro-start","aria-disabled":V?"true":void 0,"aria-busy":g?"true":void 0,onClick:E,children:g?_e(Hr,{children:[q(hn,{}),y("capture.preparing.title")]}):u??y("capture.start")}),g?q("p",{className:"sekyro-text-muted",children:y("capture.preparing.hint")}):null]}),_e("div",{ref:S,className:"sekyro-stack sekyro-stack--4","data-testid":"sekyro-intro","data-assets":e,children:[r==="assisted"?_e("div",{className:"sekyro-stack sekyro-stack--1","data-testid":"sekyro-assisted-intro",children:[q("h2",{className:"sekyro-text-body",children:y("capture.assisted.title")}),q("p",{className:"sekyro-text-muted",children:y("capture.assisted.lead")})]}):null,c!==!1?q(Cn,{tips:c}):null,i!==void 0?_e(F,{kind:"ghost",className:"sekyro-btn--start",onClick:i.toggle,"data-testid":"sekyro-tips-listen",children:[q(Ve,{off:!1}),y(i.playing?"capture.tips.stop":"capture.tips.listen")]}):null,q(On,{state:o}),q(Hn,{voice:s}),q("p",{className:"sekyro-text-muted",children:y("capture.securityNote")}),K,q("p",{role:"status",className:"sekyro-visually-hidden","data-testid":"sekyro-intro-status",children:e==="loading"?y("capture.preparing.title"):e==="ready"?y("capture.ready"):""})]})}n(Fn,"PreCaptureScreen");function Ur(e){if(typeof document>"u")return!1;let t=document.activeElement;return t===null||t===document.body||e!==null&&e.contains(t)}n(Ur,"focusIsOurs");import{subscribeCameraPermission as Br}from"@sekyro/web";import{useEffect as Gr,useState as Fr}from"react";function Dn(){let[e,t]=Fr({state:"unknown",settled:!1});return Gr(()=>Br(o=>t({state:o,settled:!0})),[]),{permission:e.state,permissionSettled:e.settled}}n(Dn,"useCameraStatus");import{useCallback as Dr,useEffect as kt,useState as bt}from"react";function qn(e){return Yn(e,"mobileRequired")}n(qn,"useMobileRequired");function jn(e){return Yn(e,"returning").required}n(jn,"useReturning");function Yn(e,t){let[o,r]=bt({required:!1,settled:e===void 0});return kt(()=>{let s=e?.[t];if(e===void 0||typeof s!="function"){r({required:!1,settled:!0});return}let c=!0;return r({required:!1,settled:!1}),Promise.resolve().then(()=>s.call(e)).then(i=>{c&&r({required:i===!0,settled:!0})},()=>{c&&r({required:!1,settled:!0})}),()=>{c=!1}},[e,t]),o}n(Yn,"useFlag");function $n(e){let t=n(()=>e?.captureChoice??null,"initialChoice"),[o,r]=bt(()=>({session:"self",choice:t(),settled:e===void 0}));kt(()=>{let i=e?.captureMode,u=e?.captureChoice??null;if(e===void 0||typeof i!="function"){r({session:"self",choice:u,settled:!0});return}let k=!0;return r({session:"self",choice:u,settled:!1}),Promise.resolve().then(()=>i.call(e)).then(b=>{let y=e.captureChoice??null;k&&r({session:y!==null&&b===y?"choice":b==="assisted"||b==="choice"?b:"self",choice:y,settled:!0})},()=>{k&&r({session:"self",choice:null,settled:!0})}),()=>{k=!1}},[e]);let s=Dr(i=>{e?.chooseCaptureMode?.(i),r(u=>({...u,choice:i}))},[e]);return{mode:o.session==="choice"?o.choice??"self":o.session==="assisted"?"assisted":"self",session:o.session,choice:o.choice,settled:o.settled,choose:s}}n($n,"useCaptureMode");function zn(e){let[t,o]=bt(!1);return kt(()=>{if(o(!1),e===void 0)return;let r=e.on("busy",()=>o(!0)),s=e.on("result",()=>o(!1));return()=>{r(),s()}},[e]),t}n(zn,"useBusy");import{getLivenessAssetsStatus as qr,preloadLivenessAssets as jr,subscribeLivenessAssets as Yr}from"@sekyro/web";import{useCallback as St,useEffect as Zn,useRef as Wn,useState as $r,useSyncExternalStore as zr}from"react";var Zr=n(()=>"idle","serverSnapshot");function Qn(e){return jr(e!==void 0?{assetBaseUrl:e}:{})}n(Qn,"preload");function Jn(e,t=!0){let o=zr(St(w=>Yr(w,e),[e]),()=>qr(e),Zr),[r,s]=$r(null),c=Wn(!1),i=St(()=>{Qn(e).then(w=>{c.current&&w==="idle"&&s({base:e})})},[e]);Zn(()=>(c.current=!0,i(),()=>{c.current=!1}),[i]);let u=Wn(null);Zn(()=>{if(o!=="idle"){u.current={base:e};return}!t||u.current===null||u.current.base!==e||(u.current=null,i())},[o,e,i,t]);let k=St(()=>{Qn(e)},[e]);return{gate:r!==null&&r.base===e&&o==="idle"||o==="ready"?"ready":o==="failed"?"failed":"loading",retry:k}}n(Jn,"useLivenessAssets");import{createLivenessCapture as Wr}from"@sekyro/web";import{useCallback as ot,useEffect as Qr,useRef as Ce,useState as j}from"react";var Xn={progress:0,hint:null,faceDetected:!1};function er(e){let{videoRef:t,assetBaseUrl:o}=e,s=Ce(e.verification).current,c=Ce(!1);e.verification!==s&&!c.current&&nt()&&(c.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 i=Ce(null),[u,k]=j("idle"),[b,y]=j(Xn),[w,S]=j(!1),[d,C]=j(!1),[v,l]=j(null),[L,g]=j(!1),[V,E]=j(null),[K,p]=j(null),[U,H]=j(null),[se,a]=j(null),[P,_]=j(null),[B,N]=j(!1),ie=Ce(null),ae=Ce("idle"),A=Ce(-1),[O,fe]=j(0),h=Ce(e);h.current=e,Qr(()=>{let z=t.current;if(z===null)return;let Q={video:z,...o!==void 0?{assetBaseUrl:o}:{}},x=s!==void 0?s.liveness(Q):Wr(Q);i.current=x;let Ne=n(()=>_(x.facingMode??null),"readFacing");Ne();let Ge=[x.on("state",m=>{m==="mode_switch"?N(!0):m!=="starting"&&m!=="gating"&&N(!1),m==="starting"?(ae.current!=="starting"&&(A.current+=1,fe(Math.max(0,A.current))),p(null),H(null),y(Xn),C(!1),S(!1),l(null),E(null),ie.current=null):m==="gating"&&ae.current==="recording"&&(C(!1),S(!1),l(null),ie.current=null),ae.current=m,Ne(),k(m),h.current.onStateChange?.(m)}),x.on("gate",m=>{let J=ie.current;ie.current=m.progress,S(J!==null&&m.progress<J-.001&&m.progress>0&&m.progress<1),m.progress>=1&&C(!0),y(m)}),x.on("frozen",({previewDataUrl:m})=>l(m)),x.on("profile",({animations:m})=>g(m==="reduced")),x.on("ramp",({colour:m})=>E(m)),x.on("captured",m=>{p(m),a(null),h.current.onCaptured?.(m)}),x.on("error",m=>{H(m);let J=s?.reportCaptureIssue;J!==void 0&&Qe(ye=>J.call(s,ye),an("liveness",m,Math.max(0,A.current))),h.current.onError?.(m)}),s?.on("result",m=>{a(m),h.current.onResult?.(m)})];return()=>{for(let m of Ge)m?.();i.current=null,x.destroy()}},[s,t,o]);let me=ot(()=>{i.current?.start()},[]),ce=ot(()=>{i.current?.retry()},[]),I=ot(async()=>{let z=i.current;return z===null||typeof z.canSwitchCaptureMode!="function"?!1:await z.canSwitchCaptureMode().catch(()=>!1)===!0},[]),Ee=ot(async z=>{let Q=i.current;if(Q===null||typeof Q.setCaptureMode!="function")return!1;let x=await Q.setCaptureMode(z).catch(()=>!1)===!0;return x&&_(Q.facingMode??null),x},[]);return{state:u,gate:b,draining:w,gateLocked:d,frozenPreview:v,reduceMotion:L,rampColour:V,artifacts:K,error:U,result:se,facingMode:P,start:me,retry:ce,canSwitchCaptureMode:I,setCaptureMode:Ee,modeRestarted:B,attempt:O}}n(er,"useLivenessHandle");import{useCallback as Jr,useEffect as Xr,useState as st}from"react";var eo=new Set(["national_number"]);function tr(e){if(e==null||!e.available||e.selected!==null)return null;let t=e.options.filter(o=>eo.has(o));return t.length>0?{...e,options:t}:null}n(tr,"pending");function nr(e){let[t,o]=st(null),[r,s]=st(e===void 0),[c,i]=st(!1),[u,k]=st(!1);Xr(()=>{if(o(null),e===void 0){s(!0);return}let S=!0,d=e.methodChoice;typeof d=="function"?(s(!1),Promise.resolve().then(()=>d.call(e)).then(v=>{S&&o(tr(v))},()=>{}).finally(()=>{S&&s(!0)})):s(!0);let C=e.on("method",v=>o(tr(v)));return()=>{S=!1,C()}},[e]);let b=Jr(async S=>{if(e===void 0)return!1;i(!0),k(!1);try{return await e.selectMethod(S),o(null),!0}catch{return k(!0),!1}finally{i(!1)}},[e]),y=t!==null&&t.options.length===1?t.options[0]:null;return{choice:t,auto:y==="national_number"&&!u?y:null,settled:r,busy:c,failed:u,select:b}}n(nr,"useMethodChoice");import{useEffect as to,useMemo as no,useState as ro}from"react";var oo=["ar","fr","en"];function so(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(so,"isClipUrl");function io(e){let t=e.clips;if(typeof t!="object"||t===null)return null;let o={};for(let r of oo){let s=t[r];if(!(typeof s!="object"||s===null))for(let[c,i]of Object.entries(s))!he(c)||!so(i)||((o[r]??(o[r]={}))[c]=i)}return Object.keys(o).length>0?o:null}n(io,"toVoiceClipMap");function rr(e){let[t,o]=ro(null);to(()=>{if(o(null),e===void 0)return;let s=!0,c=n(u=>{if(!s)return;let k=typeof u=="object"&&u!==null&&typeof u.setId=="string"?u:null;o(b=>b?.setId===k?.setId?b:k)},"take");try{typeof e.voiceClips=="function"&&Promise.resolve(e.voiceClips()).then(c,()=>c(null))}catch{c(null)}let i=e.on("view",u=>c(u.voice));return()=>{s=!1,i()}},[e]);let r=no(()=>t!==null?io(t):null,[t]);return e===void 0?null:r}n(rr,"useServerVoiceClips");import{jsx as or}from"react/jsx-runtime";function sr({voice:e}){let t=$();return or(F,{kind:"chip","aria-pressed":e.enabled,"aria-label":t("capture.voiceGuidance"),"data-testid":"sekyro-voice-toggle",onClick:()=>e.toggle(),children:or(Ve,{off:!e.enabled,className:"sekyro-icon"})})}n(sr,"VoiceChip");import{Fragment as ar,jsx as R,jsxs as xe}from"react/jsx-runtime";var lo=new Set(["abandoned","not_opened","cancelled","superseded"]),uo=800,po="capture.lookAtColours";function fo(e){return e===void 0||e!==!1&&e.length===Xe.length&&Xe.every(t=>e.includes(t))}n(fo,"isDefaultTips");function mo(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(mo,"carriesActivation");function yo(e){return typeof e=="object"&&e!==null&&!ao(e)&&"tone"in e&&"text"in e}n(yo,"isNoticeObject");var go=new Set(["nni_unbound","id_number_unbound","method_required","mobile_required","portrait_required"]);function ho(e){return e==="starting"||e==="gating"||e==="recording"||e==="mode_switch"}n(ho,"isCapturing");function vo(e){return e==="captured"||e==="uploading"||e==="checking"}n(vo,"isPostCapture");function xi({verification:e,locale:t,dir:o,strings:r,slots:s,autoStart:c=!1,notice:i,startDisabled:u=!1,startLabel:k,tips:b,tipsSummary:y,coach:w,voice:S,onGuidance:d,onCaptured:C,onResult:v,onError:l,onStateChange:L,assetBaseUrl:g,className:V}){let E=rn(t),K=Ie(()=>nn(t,r),[t,r,E]),p=Ie(()=>f=>K[f]??"",[K]),U=o??(t==="ar"?"rtl":"ltr"),H=ke(null),se=co(Kn),a=er({verification:e,videoRef:H,assetBaseUrl:g,onCaptured:C,onResult:v,onError:l,onStateChange:L}),P=Jn(g,a.state==="idle"&&a.error===null),_=nr(e),B=_.choice!==null,N=qn(e),ie=jn(e),ae=zn(e),A=Dn(),O=$n(e),fe=O.session==="choice",h=O.mode==="assisted",me=S!==!1&&S?.clips===void 0,ce=rr(me?e:void 0),I=vt({locale:t,defaultClips:ce,options:S}),Ee=h?"environment":"user",z=O.settled,Q=ke(null),x=ke(!1),Ne=ke(I.unlock);Ne.current=I.unlock,oe(()=>{let f=Q.current;if(f===null)return;let Y=["pointerup","touchend","click","keydown"],de=n(()=>{for(let Te of Y)f.removeEventListener(Te,Re,!0)},"disarm");function Re(Te){if(x.current){de();return}mo(Te)&&(x.current=!0,de(),Ne.current())}n(Re,"onGesture");for(let Te of Y)f.addEventListener(Te,Re,{capture:!0,passive:!0});return de},[]);let Ge=it(()=>{x.current||(x.current=!0,I.unlock()),a.start()},[I.unlock,a.start]),m=it(()=>a.start(),[a.start]),J=ke(!1),ye=a.state==="idle"&&a.error===null,Rt=!B&&!N.required&&(c===!0||c==="when-permitted"&&A.permission==="granted"),Vt=Rt&&_.settled&&N.settled&&z,cr=c==="when-permitted"&&!A.permissionSettled&&!J.current,Mt=Rt&&ye&&!J.current,at=(cr||Mt||!z)&&P.gate==="ready"?"loading":P.gate;oe(()=>{!Vt||!ye||P.gate!=="ready"||J.current||(J.current=!0,m())},[Vt,ye,P.gate,m]);let lr=ye&&!B&&!N.required&&!(Mt&&P.gate==="ready"),[wt,Lt]=ir(!1),{canSwitchCaptureMode:_t,setCaptureMode:It}=a;oe(()=>{if(!O.settled||!fe){Lt(!1);return}let f=!0;return _t().then(Y=>{f&&Lt(Y)}),()=>{f=!1}},[O.settled,fe,_t]);let{choose:xt}=O,be=h?"self":"assisted",ur=it(async()=>{await It(be)&&xt(be)},[It,xt,be]),Et=a.state!=="idle"&&a.facingMode!==null?a.facingMode:Ee;oe(()=>{let f=H.current?.style;Et==="user"?f?.removeProperty("transform"):f&&(f.transform="none")},[Et]);let Fe=Ie(()=>a.artifacts!==null&&typeof URL.createObjectURL=="function"?URL.createObjectURL(a.artifacts.keyframe):null,[a.artifacts]);oe(()=>{if(Fe!==null)return()=>URL.revokeObjectURL(Fe)},[Fe]);let Nt=a.frozenPreview??Fe,Se=e!==void 0,T=ho(a.state),le=vo(a.state),De=T||le,Z=a.result,At=a.state==="done"&&Z!==null,qe=T&&a.rampColour!==null,ct=a.state==="recording"&&a.frozenPreview!==null&&!qe,je=se!==null,Pt=wt&&T&&!ct?{to:be,label:p(be==="assisted"?"capture.modeSwitch.toAssisted":"capture.modeSwitch.toSelf"),description:p(be==="assisted"?"capture.modeSwitch.toAssistedLabel":"capture.modeSwitch.toSelfLabel"),onSwitch:n(()=>{ur()},"onSwitch")}:null,Ye=a.modeRestarted&&T?p("capture.modeSwitch.restarted"):null,Ae=le||ct,Tt=le?"checking":ct?"frozen":a.state==="recording"||qe?"recording":a.gateLocked||a.gate.progress>=1?"locked":a.gate.faceDetected?"aligning":"seeking",$e=T?a.gate.hint:null,ze=a.state==="starting"?"capture.preparing.title":$e===null?null:$e==="center"&&!a.gate.faceDetected?"fcv3.no_face":Wt($e),[dr,Kt]=ir(null);oe(()=>{if(ze!=="fcv3.no_face"){Kt(ze);return}if(!T)return;let f=setTimeout(()=>Kt(ze),uo);return()=>clearTimeout(f)},[ze,T]);let lt=T&&!qe&&typeof w=="string"&&w!=="",Ot=h&&T?p("capture.assisted.stage"):null,ge=T&&!lt?qe?po:dr:null,ut=lt?w:ge===null?"":p(ge);Ct(I,ge,ut,T);let Ut=ke(d);Ut.current=d,oe(()=>{if(he(ge))try{Ut.current?.(ge)}catch(f){console.error("[@sekyro/react] onGuidance threw:",f)}},[ge]);let Pe=Ie(()=>({supported:I.supported,enabled:I.enabled,setEnabled:I.setEnabled,toggle:I.toggle}),[I.supported,I.enabled,I.setEnabled,I.toggle]),dt=s?.voicePrompt,Ht=dt!==void 0,Bt=S===void 0,Gt=ke(!1);oe(()=>{!Ht||!Bt||Gt.current||!nt()||(Gt.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."))},[Ht,Bt]);let pr=dt!==void 0?(f,Y,de)=>dt(f,Y,de,Pe):I.supported?()=>R(sr,{voice:Pe}):void 0,{summary:pt,summaryPlaying:Ft,toggleSummary:Dt,stopSummary:qt}=I,Ze=y!==void 0&&y!=="",jt=Ze?y:p("capture.tips.summary"),Yt=Ze?pt!=="none":pt==="partner"||pt==="default"&&fo(b),fr=Ie(()=>Yt?{playing:Ft,toggle:n(()=>Dt(jt,{clip:!Ze}),"toggle"),stop:qt}:void 0,[Yt,Ft,Dt,jt,qt,Ze]),mr=Ie(()=>({assets:at,retryAssets:P.retry,permission:A.permission,permissionSettled:A.permissionSettled,captureMode:O.mode,facing:Ee,voice:Pe}),[at,P.retry,A.permission,A.permissionSettled,O.mode,Ee,Pe]),yr=yo(i)?R(D,{tone:i.tone,testId:"sekyro-host-notice",children:R("span",{children:i.text})}):i??null,X=Z!==null&&Z.status==="retry"?Z:null,G=At&&Z.status==="unavailable"&&!B&&Z.reasonCode!=="portrait_required"?Z:null,ue=At&&(Z.status==="verified"||Z.status==="not_verified"||Z.status==="review")?Z:null,ft=n((f,Y)=>{if(f===void 0)return null;if(f==="device_cooldown"){let Re=en(t,Y);if(Re!==null)return p(Re.key).replace("{time}",Re.time)}let de=Xt(f);return de===null?null:p(de)},"reasonText"),mt=n(f=>{let Y=f.retakeHint===void 0?null:Qt(f.retakeHint);return Y===null?ft(f.reasonCode):p(Y)},"retryText"),$t=ue===null?null:ft(ue.reasonCode,ue.retryAfter)??(ue.status==="not_verified"&&ue.reason!==void 0&&lo.has(ue.reason)?p("errors.session_expired"):null),gr=G!==null&&G.reasonCode!==void 0&&G.reasonCode!=="nni_unbound"&&G.reasonCode!=="id_number_unbound"&&G.reasonCode!=="method_required"&&G.reasonCode!=="mobile_required"&&!(G.reasonCode==="no_recorder"&&a.artifacts?.degraded==="NO_RECORDER"),We=G?.reasonCode,zt=a.attempt;oe(()=>{G===null||We===void 0||e?.reportCaptureIssue===void 0||go.has(We)||Qe(f=>e.reportCaptureIssue?.(f),{check:"liveness",kind:"unavailable",phase:"upload",engineKind:We,attempt:Math.min(1e3,zt)})},[G,We,zt,e]);let Zt=Je(),hr=B&&_.auto===null&&!T&&!le&&a.error===null,yt=it(async f=>{await _.select(f)&&a.state==="done"&&a.retry()},[_.select,a.state,a.retry]);return oe(()=>{_.auto!==null&&!_.busy&&!T&&!le&&yt(_.auto)},[_.auto,_.busy,T,le,yt]),R(on,{value:p,children:xe("div",{ref:Q,className:V===void 0?"sekyro-capture":`sekyro-capture ${V}`,dir:U,lang:t,"data-testid":"sekyro-liveness-capture","data-state":a.state,children:[s?.header,X!==null&&mt(X)!==null&&!(je&&De)?R(D,{tone:"warning",role:"status",testId:"sekyro-retry-notice",children:R("span",{children:mt(X)})}):null,Ye!==null&&!je?R(D,{tone:"info",role:"status",testId:"sekyro-mode-switch-status",children:R("span",{children:Ye})}):null,ae&&le&&!je?R(D,{tone:"info",role:"status",testId:"sekyro-busy-notice",children:R("span",{children:p("capture.busy")})}):null,N.required&&ye?R(D,{tone:"info",role:"status",testId:"sekyro-mobile-required",children:R("span",{children:p("reasons.mobile_required")})}):null,a.error!==null?s?.errorPanel!==void 0?s.errorPanel(a.error,a.retry):xe(D,{tone:"danger",testId:"sekyro-error-notice",children:[R("span",{children:p(Jt(a.error))}),a.error.retryable?R(F,{ref:Zt,kind:"ghost",className:"sekyro-btn--start",onClick:a.retry,children:p("common.retry")}):null]}):null,G!==null?xe(D,{tone:"danger",testId:"sekyro-unavailable-notice",children:[R("span",{children:ft(G.reasonCode)??p(G.reasonCode===void 0?"errors.session_expired":"errors.network_error")}),gr?R(F,{ref:Zt,kind:"ghost",className:"sekyro-btn--start",onClick:a.retry,children:p("capture.recordAgain")}):null]}):null,$t!==null&&ue!==null?R(D,{tone:ue.status==="not_verified"?"danger":"info",testId:"sekyro-result-notice",children:R("span",{children:$t})}):null,R("div",{className:De?void 0:"sekyro-hidden","data-capture-live":De?"":void 0,children:je?se({videoRef:H,guidance:Ae&&Se?p("capture.checking"):ut,coached:lt&&!(Ae&&Se),note:Ae?Se?p(ae?"capture.busy":"capture.checkingHint"):null:Ye??(X!==null?mt(X):Ot),settled:Ae&&Se,progress:a.gate.progress,phase:Tt,still:Ae?Nt:null,live:De,modeSwitch:Pt,...wt?{status:Ye}:{},ramp:a.rampColour===null?null:{colour:a.rampColour}}):R(sn,{videoRef:H,guidanceText:ut,guidanceHint:$e,guidanceKey:ge,progress:a.gate.progress,phase:Tt,draining:a.draining,stillUrl:Nt,showChecking:Se,operatorText:Ot,voicePrompt:pr,overlay:f=>xe(ar,{children:[s?.stageOverlay?.(f),R(cn,{colour:a.rampColour})]}),reduceMotion:a.reduceMotion,modeSwitch:Pt})}),hr&&_.choice!==null?R(bn,{title:p("method.title"),description:p("method.description"),options:_.choice.options.map(f=>({id:f,label:p(`method.${f}`)})),busy:_.busy,error:_.failed?p("errors.network_error"):null,focus:a.state==="done",testId:"sekyro-method",look:"buttons",onChoose:f=>{yt(f)}}):null,lr?xe(ar,{children:[ie&&s?.header===void 0&&s?.intro===void 0?xe("div",{className:"sekyro-stack sekyro-stack--1",children:[R("h2",{className:"sekyro-text-body",children:p("returning.title")}),R("p",{className:"sekyro-text-muted",children:p("returning.description")})]}):null,yr,s?.intro!==void 0?s.intro(Ge,mr):R(Fn,{assets:at,onRetryAssets:P.retry,permission:A.permission,captureMode:O.mode,voice:Pe,tips:b??Xe,summary:fr,startLabel:k,startDisabled:u,onStart:Ge})]}):null,R(Tn,{showCoaching:X!==null,coaching:Pn(X?.reasonCode),attemptsText:X?.attemptsRemaining!==void 0?tn(K,t,X.attemptsRemaining):null,showRetake:X!==null&&!T&&!le||!Se&&a.state==="captured",onRetake:a.retry}),s?.footer]})})}n(xi,"LivenessCapture");export{Pn as a,Nn as b,nt as c,Kn as d,Xe as e,bn as f,$n as g,tt as h,uo as i,xi as j};
2
+ import{a as sn,c as cn}from"./chunk-M7JKVIGW.js";import{b as an,c as Qe}from"./chunk-7MMT5M4E.js";import{a as nn,b as rn,c as on,d as $}from"./chunk-DYWLZHSM.js";import{a as F,k as Wt,l as Qt,n as Jt,o as Xt,p as en,q as tn,r as D,s as Je}from"./chunk-WC4U54LZ.js";import{a as n}from"./chunk-2KED7D2Q.js";import{useId as Cr}from"react";import{Fragment as vr,jsx as M,jsxs as ee}from"react/jsx-runtime";function te({className:e,children:t}){return M("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(te,"Svg");var gt="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 ln(e){return ee(te,{...e,children:[M("circle",{cx:"12",cy:"12",r:"4"}),M("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(ln,"SunIcon");function un(e){return ee(te,{...e,children:[M("circle",{cx:"12",cy:"12",r:"9"}),M("path",{d:"M9 10h.01M15 10h.01M8.8 14.6a4.2 4.2 0 0 0 6.4 0"})]})}n(un,"FaceUncoveredIcon");function dn(e){return ee(te,{...e,children:[M("rect",{x:"7",y:"2.5",width:"10",height:"19",rx:"2"}),M("path",{d:"M10.5 18.5h3M2.5 9.5h2.5M19 9.5h2.5"}),M("circle",{cx:"12",cy:"9.5",r:"1.6"})]})}n(dn,"PhoneEyeLevelIcon");function pn(e){return ee(te,{...e,children:[M("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"}),M("circle",{cx:"12",cy:"12",r:"2.8"})]})}n(pn,"LookStraightIcon");function fn(e){return ee(te,{...e,children:[M("path",{d:gt}),M("path",{d:"M9 13l2 2 4-4"})]})}n(fn,"CameraCheckIcon");function mn(e){return ee(te,{...e,children:[M("path",{d:gt}),M("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(mn,"CameraAskIcon");function yn(e){return ee(te,{...e,children:[M("path",{d:gt}),M("path",{d:"M3 3l18 18"})]})}n(yn,"CameraBlockedIcon");function Ve({off:e,className:t}){return ee(te,{className:t,children:[M("path",{d:"M4.5 9.5v5H8l4 3.5v-12L8 9.5H4.5Z"}),e?M("path",{d:"M4 4l16 16"}):ee(vr,{children:[M("path",{d:"M15.5 9.7a3.6 3.6 0 0 1 0 4.6"}),M("path",{d:"M18 7.6a6.6 6.6 0 0 1 0 8.8"})]})]})}n(Ve,"SpeakerIcon");function gn(e){return M(te,{...e,children:M("path",{d:"M5 12.5l4.5 4.5L19 7.5"})})}n(gn,"CheckIcon");function hn(e){return ee(te,{className:e.className??"sekyro-spinner",children:[M("circle",{cx:"12",cy:"12",r:"9",opacity:"0.25"}),M("path",{d:"M21 12a9 9 0 0 0-9-9"})]})}n(hn,"SpinnerIcon");import{jsx as pe,jsxs as vn}from"react/jsx-runtime";var Xe=["light","uncover","eyeLevel","straight"],kr={light:{key:"capture.tips.light",icon:n(()=>pe(ln,{}),"icon")},uncover:{key:"capture.tips.uncover",icon:n(()=>pe(un,{}),"icon")},eyeLevel:{key:"capture.tips.eyeLevel",icon:n(()=>pe(dn,{}),"icon")},straight:{key:"capture.tips.straight",icon:n(()=>pe(pn,{}),"icon")}};function Cn({tips:e}){let t=$(),o=Cr();return e.length===0?null:vn("section",{className:"sekyro-tips","aria-labelledby":o,"data-testid":"sekyro-tips",children:[pe("p",{className:"sekyro-tips__title",id:o,children:t("capture.tips.title")}),pe("ul",{className:"sekyro-tips__list",children:e.map(r=>{let s=typeof r=="string"?kr[r]:void 0,c=typeof r=="string"?r:r.id,i=s!==void 0?s.icon():typeof r=="string"?void 0:r.icon,u=s!==void 0?t(s.key):typeof r=="string"?r:r.text;return vn("li",{className:"sekyro-tips__item",children:[i!=null?pe("span",{className:"sekyro-tips__icon","aria-hidden":"true",children:i}):null,pe("span",{children:u})]},c)})})]})}n(Cn,"TipList");import{useEffect as kn,useId as br,useRef as Sr,useState as Rr}from"react";import{jsx as W,jsxs as et}from"react/jsx-runtime";var Vr=220;function bn({title:e,description:t,options:o,busy:r,error:s,focus:c,testId:i,look:u="cards",marked:k,onChoose:b}){let y=br(),w=Je(),[S,d]=Rr(null),C=Sr(null);kn(()=>{s!==null&&d(null)},[s]),kn(()=>()=>{C.current!==null&&clearTimeout(C.current)},[]);let v=n(l=>{r||S!==null||(d(l),C.current=setTimeout(()=>{C.current=null,d(null),b(l)},Vr))},"choose");return et("section",{className:"sekyro-stack sekyro-stack--4 sekyro-choice","aria-labelledby":y,"data-testid":i,children:[et("div",{className:u==="cards"?"sekyro-heading":"sekyro-stack sekyro-stack--1",children:[W("h2",{id:y,ref:c?w:void 0,tabIndex:-1,className:"sekyro-text-body",children:e}),t!==void 0&&t!==""?W("p",{className:"sekyro-text-muted",children:t}):null]}),s!==null?W(D,{tone:"danger",children:W("span",{children:s})}):null,u==="buttons"?W("div",{className:"sekyro-stack sekyro-stack--3",children:o.map((l,L)=>W(F,{kind:L===0?"primary":"ghost",full:!0,disabled:r,"aria-busy":r||void 0,onClick:()=>b(l.id),children:l.label},l.id))}):W("div",{className:"sekyro-choices",children:o.map(l=>et("button",{type:"button",className:"sekyro-card","aria-pressed":(S??k)===l.id,"aria-busy":r||void 0,disabled:r||S!==null&&S!==l.id,onClick:()=>v(l.id),children:[l.glyph!==void 0?W("span",{className:"sekyro-card__tile",children:l.glyph}):null,et("span",{className:"sekyro-card__body",children:[W("span",{className:"sekyro-card__title",children:l.label}),l.sub!==void 0?W("span",{className:"sekyro-card__sub",children:l.sub}):null]}),W("span",{className:"sekyro-radio","aria-hidden":"true"})]},l.id))})]})}n(bn,"ChoiceScreen");var tt=["fcv3.no_face","fcv3.come_closer","fcv3.move_back","fcv3.center_face","fcv3.straighten","fcv3.more_light","fcv3.too_bright","fcv3.hold_still","fcv3.steady_camera","fcv3.hold_upright","fcv3.one_face","capture.tips.summary","capture.lookAtColours"];function he(e){return e!==null&&tt.includes(e)}n(he,"isVoiceKey");import{useCallback as re,useEffect as ve,useLayoutEffect as _r,useMemo as Ir,useRef as we,useState as Oe}from"react";var Mr=n((e,t)=>Object.prototype.hasOwnProperty.call(e,t),"own");function Me(e,t,o){let r;try{if(typeof e=="function")r=e(t,o);else{let s=e[o];r=s!=null&&Mr(s,t)?s[t]:null}}catch{return null}return typeof r=="string"&&r!==""?r:null}n(Me,"resolveClip");var wr="UklGRiQAAABXQVZFZm10IBAAAAABAAEAESsAACJWAAACABAAZGF0YQAAAAA=",Vn={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 Lr(){return ne()!==null&&typeof SpeechSynthesisUtterance=="function"}n(Lr,"speechAvailable");function Sn(e){return(e.split(/[-_]/)[0]??e).toLowerCase()}n(Sn,"baseLang");function Mn(e,t){let o=n(s=>s.replace(/_/g,"-").toLowerCase(),"norm"),r=Sn(t);return e.find(s=>o(s.lang)===o(t))??e.find(s=>Sn(s.lang)===r)}n(Mn,"pickVoice");function wn(e){if(!Lr())return!1;let t=[];try{t=ne()?.getVoices()??[]}catch{return!0}return t.length===0||Mn(t,e)!==void 0}n(wn,"speechUsable");function Ln(e){let t=ne();return t===null||typeof t.addEventListener!="function"?()=>{}:(t.addEventListener("voiceschanged",e),()=>t.removeEventListener?.("voiceschanged",e))}n(Ln,"subscribeVoices");function Ke(e){try{let t=typeof location<"u"?location.href:"http://localhost/",o=new URL(e,t);return`clip:${o.origin}${o.pathname}`}catch{return`clip:${e}`}}n(Ke,"clipIdentity");function Rn(e){e.pause(),e.removeAttribute("src"),e.load()}n(Rn,"release");function _n(){let e=null,t=null,o=0,r=null,s=[],c=new Map,i=n(()=>{s=ne()?.getVoices()??[]},"loadVoices"),u=!1,k=n(()=>{let d=ne();u||d===null||(u=!0,i(),d.addEventListener?.("voiceschanged",i))},"bindVoices"),b=n(()=>(e??(e=new Audio),e),"element"),y=n((d,C,v)=>{let l=ne();if(l!==null&&d!==""&&typeof SpeechSynthesisUtterance=="function"){k();let L=Mn(s,C);if(s.length===0||L!==void 0){l.cancel();let g=new SpeechSynthesisUtterance(d);g.lang=C,L!==void 0&&(g.voice=L),g.rate=.95,v!==void 0&&(g.onend=g.onerror=v),l.speak(g);return}}v?.()},"speak"),w=n(()=>{o+=1,r=null,e!==null&&(e.pause(),e.currentTime=0),ne()?.cancel()},"stop"),S=n(d=>{for(let C of d){let v=Ke(C);if(c.has(v))continue;let l=new Audio;l.preload="auto",l.src=C,c.set(v,l)}},"warmClips");return{say(d){let C=d.url!==null?Ke(d.url):`tts:${d.lang}:${d.text}`;if(C===r)return;r=C,o+=1;let v=o,l=d.onEnd,L=l!==void 0?()=>{v===o&&l()}:void 0;if(ne()?.cancel(),d.url!==null){let g=b();g.pause(),g.muted=!1,g.src=d.url,g.currentTime=0,g.onended=L??null,g.play()?.catch(V=>{v===o&&V?.name!=="AbortError"&&(d.speech?y(d.text,d.lang,L):L?.())});return}d.speech?y(d.text,d.lang,L):L?.()},unlock({lang:d,speech:C,prefetch:v}){let l=b();if(t===null&&typeof Blob=="function"&&typeof URL.createObjectURL=="function"){let V=Uint8Array.from(atob(wr),E=>E.charCodeAt(0));t=URL.createObjectURL(new Blob([V],{type:"audio/wav"}))}let L=l.paused===!1&&t!==null&&l.src!==t;t!==null&&!L&&(l.muted=!0,l.onended=null,l.src=t,l.play()?.catch(()=>{}));let g=ne();if(C&&g!==null&&typeof SpeechSynthesisUtterance=="function"){k();let V=new SpeechSynthesisUtterance(" ");V.volume=0,V.lang=d,g.speak(V)}S(v??[])},prefetch:S,stop:w,dispose(){w(),u&&ne()?.removeEventListener?.("voiceschanged",i),u=!1,t!==null&&URL.revokeObjectURL(t),t=null,e!==null&&Rn(e),e=null;for(let d of c.values())Rn(d);c.clear()}}}n(_n,"createVoicePlayer");var In="sekyro.voiceGuidance";function xn(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(xn,"readVoicePreference");function En(e,t){try{if(typeof window>"u")return;window.localStorage.setItem(e,t?"1":"0")}catch{}}n(En,"writeVoicePreference");var Ue="capture.tips.summary",xr=typeof window<"u"?_r:ve,Er=Object.freeze({});function ht(e,t){let o=new Set,r=[];for(let s of tt){let c=s===Ue?null:Me(e,s,t);c===null||o.has(Ke(c))||(o.add(Ke(c)),r.push(c))}return r}n(ht,"resolvedClipUrls");function vt({locale:e,defaultClips:t,options:o}){let r=o===!1,s=r?{}:o??{},c=s.storageKey===void 0?In:s.storageKey,[i,u]=Oe(s.defaultEnabled??!0),k=we(i),[b,y]=Oe(!1),[w,S]=Oe("none"),[d,C]=Oe(!1),v=we(!1),[l,L]=Oe(0),g=we(null),V=re(()=>(g.current??(g.current=_n()),g.current),[]),E=Vn[e],O=s.speechFallback,p=O===void 0||O===!0?!0:O===!1?!1:O.includes(e),H=s.clips??t??Er,B=we(!1),se=we(H);xr(()=>{se.current=H,k.current=i}),ve(()=>{if(r||c===null)return;let h=xn(c);h!==null&&(k.current=h,u(h))},[r,c]),ve(()=>{if(!(r||!p))return Ln(()=>L(h=>h+1))},[r,p]);let a=s.clips;ve(()=>{if(r)return;let h=p&&wn(E);y(ht(H,e).length>0||h),S(a!==void 0&&Me(a,Ue,e)!==null?"partner":Me(H,Ue,e)!==null||h?"default":"none")},[r,H,a,e,p,E,l]),ve(()=>{if(r||!i||!B.current)return;let h=ht(H,e);h.length>0&&V().prefetch(h)},[r,i,H,e,V]),ve(()=>()=>{g.current?.dispose(),g.current=null,B.current=!1},[]);let T=re(h=>{r||(B.current=!0,V().unlock({lang:E,speech:p,...h?{prefetch:ht(se.current,e)}:{}}))},[r,V,E,p,e]),_=re(()=>T(k.current),[T]),G=re(()=>{v.current=!1,C(!1)},[]),N=re(()=>{G(),g.current?.stop()},[G]),ie=re(()=>{v.current&&N()},[N]),ae=re((h,me)=>{if(r)return;if(v.current){N();return}let ce=V();ce.stop(),v.current=!0,C(!0);let I=me?.clip===!1?null:Me(se.current,Ue,e);ce.say({url:I,text:h,lang:E,speech:p,onEnd:G})},[r,N,V,e,E,p,G]),A=re(h=>{r||(h?T(!0):N(),c!==null&&En(c,h),k.current=h,u(h))},[r,T,N,c]),U=re(()=>A(!k.current),[A]),fe=re((h,me)=>{if(r||!i)return;v.current&&G();let ce=Me(se.current,h,e);V().say({url:ce,text:me,lang:E,speech:p})},[r,i,e,V,E,p,G]);return Ir(()=>({supported:!r&&b,enabled:!r&&i,setEnabled:A,toggle:U,unlock:_,speakKey:fe,stop:N,summary:r?"none":w,summaryPlaying:d,toggleSummary:ae,stopSummary:ie}),[r,b,i,A,U,_,fe,N,w,d,ae,ie])}n(vt,"useVoiceGuidance");function Ct(e,t,o,r){let{speakKey:s,stop:c,enabled:i}=e,u=we(!1);ve(()=>{if(!r||!i){u.current&&c(),u.current=!1;return}u.current=!0,he(t)&&t!==Ue&&o!==""&&s(t,o)},[r,i,t,o,s,c])}n(Ct,"useSpeakGuidance");import{isValidElement as ao,useCallback as it,useContext as co,useEffect as oe,useMemo as Ie,useRef as ke,useState as ir}from"react";import{useEffect as Nr,useRef as Ar}from"react";import{jsx as He,jsxs as An}from"react/jsx-runtime";function Pn(e){switch(e){case"multiple_faces":return"one_face";case"capture_back_camera":return"front_camera";case"capture_front_camera":return"back_camera";case"capture_not_upright":return"upright";case"media_unreadable":case"clip_too_short":return"recording";case"device_integrity_failed":return"device";default:return"face"}}n(Pn,"retryCoachingOf");var Nn={face:{title:"capture.retryCoaching.title",tips:["capture.retryCoaching.light","capture.retryCoaching.eyeLevel","capture.retryCoaching.head"]},one_face:{title:"capture.retryTips.title",tips:["capture.retryOneFace.alone","capture.retryOneFace.screens"]},front_camera:{title:"capture.retryTips.title",tips:["capture.retryFrontCamera.screenSide"]},back_camera:{title:"capture.retryTips.title",tips:["capture.retryBackCamera.backSide","capture.retryBackCamera.circle"]},upright:{title:"capture.retryTips.title",tips:["capture.retryUpright.vertical","capture.retryUpright.untilEnd"]},recording:{title:"capture.retryTips.title",tips:["capture.retryRecording.cameraOn","capture.retryRecording.stay","capture.retryRecording.network"]},device:{title:"capture.retryTips.title",tips:["capture.retryDevice.screenRecording","capture.retryDevice.phone"]}};function Tn({showCoaching:e,coaching:t="face",attemptsText:o,showRetake:r,onRetake:s}){let c=$(),i=Ar(null);return Nr(()=>{r&&i.current?.focus()},[r]),!e&&!r?null:An("div",{className:"sekyro-stack sekyro-stack--3","data-testid":"sekyro-captured-panel",children:[e?An("div",{className:"sekyro-stack sekyro-stack--1",children:[He("p",{className:"sekyro-text-body",children:c(Nn[t].title)}),He("ul",{className:"sekyro-coaching",children:Nn[t].tips.map(u=>He("li",{children:c(u)},u))}),o!==null?He("p",{className:"sekyro-text-muted","data-testid":"sekyro-attempts-remaining",children:o}):null]}):null,r?He(F,{ref:i,className:"sekyro-btn--start",onClick:s,children:c("capture.recordAgain")}):null]})}n(Tn,"CapturedPanel");function nt(){try{return process.env.NODE_ENV!=="production"}catch{return!1}}n(nt,"isDevBuild");import{createContext as Pr}from"react";var Kn=Pr(null);import{useCallback as Bn,useEffect as Gn,useRef as Le}from"react";import{useEffect as Tr,useState as Kr}from"react";import{jsx as Be,jsxs as Or}from"react/jsx-runtime";function On({state:e}){let t=$(),[o,r]=Kr(!1);Tr(()=>{e!=="unknown"&&r(!0)},[e]);let s=e==="granted"?Be(fn,{}):e==="denied"?Be(yn,{}):Be(mn,{});return Or("div",{role:o?"status":void 0,className:`sekyro-permission sekyro-permission--${e}`,"data-testid":"sekyro-permission","data-state":e,children:[Be("span",{className:"sekyro-permission__icon","aria-hidden":"true",children:s}),Be("span",{children:t(`capture.permission.${e}`)})]})}n(On,"PermissionRow");import{jsx as rt,jsxs as Un}from"react/jsx-runtime";function Hn({voice:e}){let t=$();if(!e.supported)return null;let o=e.enabled;return Un("button",{type:"button",role:"switch","aria-checked":o,className:"sekyro-switch","data-testid":"sekyro-voice-switch",onClick:()=>e.toggle(),children:[Un("span",{className:"sekyro-switch__label",children:[rt(Ve,{off:!o}),t("capture.voiceGuidance")]}),rt("span",{className:"sekyro-switch__track","aria-hidden":"true",children:rt("span",{className:"sekyro-switch__thumb",children:o?rt(gn,{className:"sekyro-switch__check"}):null})})]})}n(Hn,"VoiceSwitch");import{Fragment as Hr,jsx as q,jsxs as _e}from"react/jsx-runtime";function Fn({assets:e,onRetryAssets:t,permission:o,captureMode:r="self",voice:s,tips:c,summary:i,startLabel:u,startDisabled:k,onStart:b}){let y=$(),w=Le(i?.stop);w.current=i?.stop,Gn(()=>()=>w.current?.(),[]);let S=Le(null),d=Le(null),C=Le(null),v=Le(e),l=Le(!1);Gn(()=>{let H=v.current;if(v.current=e,H===e)return;let B=l.current;e!=="loading"&&(l.current=!1),Ur(S.current)&&(e==="failed"?C.current?.focus():B&&d.current?.focus())},[e]);let L=Bn(()=>{l.current=!0,t()},[t]),g=e==="loading",V=g||k,E=Bn(()=>{V||(w.current?.(),b())},[V,b]),O;return e==="failed"?O=_e(D,{tone:"danger",testId:"sekyro-assets-error",children:[q("p",{className:"sekyro-text-body",children:y("fcv2.err.models")}),q(F,{kind:"ghost",ref:C,className:"sekyro-btn--start",onClick:L,"data-testid":"sekyro-assets-retry",children:y("common.retry")})]}):O=_e("div",{className:"sekyro-stack sekyro-stack--1",children:[q(F,{ref:d,full:!0,"data-testid":"sekyro-start","aria-disabled":V?"true":void 0,"aria-busy":g?"true":void 0,onClick:E,children:g?_e(Hr,{children:[q(hn,{}),y("capture.preparing.title")]}):u??y("capture.start")}),g?q("p",{className:"sekyro-text-muted",children:y("capture.preparing.hint")}):null]}),_e("div",{ref:S,className:"sekyro-stack sekyro-stack--4","data-testid":"sekyro-intro","data-assets":e,children:[r==="assisted"?_e("div",{className:"sekyro-stack sekyro-stack--1","data-testid":"sekyro-assisted-intro",children:[q("h2",{className:"sekyro-text-body",children:y("capture.assisted.title")}),q("p",{className:"sekyro-text-muted",children:y("capture.assisted.lead")})]}):null,c!==!1?q(Cn,{tips:c}):null,i!==void 0?_e(F,{kind:"ghost",className:"sekyro-btn--start",onClick:i.toggle,"data-testid":"sekyro-tips-listen",children:[q(Ve,{off:!1}),y(i.playing?"capture.tips.stop":"capture.tips.listen")]}):null,q(On,{state:o}),q(Hn,{voice:s}),q("p",{className:"sekyro-text-muted",children:y("capture.securityNote")}),O,q("p",{role:"status",className:"sekyro-visually-hidden","data-testid":"sekyro-intro-status",children:e==="loading"?y("capture.preparing.title"):e==="ready"?y("capture.ready"):""})]})}n(Fn,"PreCaptureScreen");function Ur(e){if(typeof document>"u")return!1;let t=document.activeElement;return t===null||t===document.body||e!==null&&e.contains(t)}n(Ur,"focusIsOurs");import{subscribeCameraPermission as Br}from"@sekyro/web";import{useEffect as Gr,useState as Fr}from"react";function Dn(){let[e,t]=Fr({state:"unknown",settled:!1});return Gr(()=>Br(o=>t({state:o,settled:!0})),[]),{permission:e.state,permissionSettled:e.settled}}n(Dn,"useCameraStatus");import{useCallback as Dr,useEffect as kt,useState as bt}from"react";function qn(e){return Yn(e,"mobileRequired")}n(qn,"useMobileRequired");function jn(e){return Yn(e,"returning").required}n(jn,"useReturning");function Yn(e,t){let[o,r]=bt({required:!1,settled:e===void 0});return kt(()=>{let s=e?.[t];if(e===void 0||typeof s!="function"){r({required:!1,settled:!0});return}let c=!0;return r({required:!1,settled:!1}),Promise.resolve().then(()=>s.call(e)).then(i=>{c&&r({required:i===!0,settled:!0})},()=>{c&&r({required:!1,settled:!0})}),()=>{c=!1}},[e,t]),o}n(Yn,"useFlag");function $n(e){let t=n(()=>e?.captureChoice??null,"initialChoice"),[o,r]=bt(()=>({session:"self",choice:t(),settled:e===void 0}));kt(()=>{let i=e?.captureMode,u=e?.captureChoice??null;if(e===void 0||typeof i!="function"){r({session:"self",choice:u,settled:!0});return}let k=!0;return r({session:"self",choice:u,settled:!1}),Promise.resolve().then(()=>i.call(e)).then(b=>{let y=e.captureChoice??null;k&&r({session:y!==null&&b===y?"choice":b==="assisted"||b==="choice"?b:"self",choice:y,settled:!0})},()=>{k&&r({session:"self",choice:null,settled:!0})}),()=>{k=!1}},[e]);let s=Dr(i=>{e?.chooseCaptureMode?.(i),r(u=>({...u,choice:i}))},[e]);return{mode:o.session==="choice"?o.choice??"self":o.session==="assisted"?"assisted":"self",session:o.session,choice:o.choice,settled:o.settled,choose:s}}n($n,"useCaptureMode");function zn(e){let[t,o]=bt(!1);return kt(()=>{if(o(!1),e===void 0)return;let r=e.on("busy",()=>o(!0)),s=e.on("result",()=>o(!1));return()=>{r(),s()}},[e]),t}n(zn,"useBusy");import{getLivenessAssetsStatus as qr,preloadLivenessAssets as jr,subscribeLivenessAssets as Yr}from"@sekyro/web";import{useCallback as St,useEffect as Zn,useRef as Wn,useState as $r,useSyncExternalStore as zr}from"react";var Zr=n(()=>"idle","serverSnapshot");function Qn(e){return jr(e!==void 0?{assetBaseUrl:e}:{})}n(Qn,"preload");function Jn(e,t=!0){let o=zr(St(w=>Yr(w,e),[e]),()=>qr(e),Zr),[r,s]=$r(null),c=Wn(!1),i=St(()=>{Qn(e).then(w=>{c.current&&w==="idle"&&s({base:e})})},[e]);Zn(()=>(c.current=!0,i(),()=>{c.current=!1}),[i]);let u=Wn(null);Zn(()=>{if(o!=="idle"){u.current={base:e};return}!t||u.current===null||u.current.base!==e||(u.current=null,i())},[o,e,i,t]);let k=St(()=>{Qn(e)},[e]);return{gate:r!==null&&r.base===e&&o==="idle"||o==="ready"?"ready":o==="failed"?"failed":"loading",retry:k}}n(Jn,"useLivenessAssets");import{createLivenessCapture as Wr}from"@sekyro/web";import{useCallback as ot,useEffect as Qr,useRef as Ce,useState as j}from"react";var Xn={progress:0,hint:null,faceDetected:!1};function er(e){let{videoRef:t,assetBaseUrl:o}=e,s=Ce(e.verification).current,c=Ce(!1);e.verification!==s&&!c.current&&nt()&&(c.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 i=Ce(null),[u,k]=j("idle"),[b,y]=j(Xn),[w,S]=j(!1),[d,C]=j(!1),[v,l]=j(null),[L,g]=j(!1),[V,E]=j(null),[O,p]=j(null),[H,B]=j(null),[se,a]=j(null),[T,_]=j(null),[G,N]=j(!1),ie=Ce(null),ae=Ce("idle"),A=Ce(-1),[U,fe]=j(0),h=Ce(e);h.current=e,Qr(()=>{let z=t.current;if(z===null)return;let Q={video:z,...o!==void 0?{assetBaseUrl:o}:{}},x=s!==void 0?s.liveness(Q):Wr(Q);i.current=x;let Ne=n(()=>_(x.facingMode??null),"readFacing");Ne();let Ge=[x.on("state",m=>{m==="mode_switch"?N(!0):m!=="starting"&&m!=="gating"&&N(!1),m==="starting"?(ae.current!=="starting"&&(A.current+=1,fe(Math.max(0,A.current))),p(null),B(null),y(Xn),C(!1),S(!1),l(null),E(null),ie.current=null):m==="gating"&&ae.current==="recording"&&(C(!1),S(!1),l(null),ie.current=null),ae.current=m,Ne(),k(m),h.current.onStateChange?.(m)}),x.on("gate",m=>{let J=ie.current;ie.current=m.progress,S(J!==null&&m.progress<J-.001&&m.progress>0&&m.progress<1),m.progress>=1&&C(!0),y(m)}),x.on("frozen",({previewDataUrl:m})=>l(m)),x.on("profile",({animations:m})=>g(m==="reduced")),x.on("ramp",({colour:m})=>E(m)),x.on("captured",m=>{p(m),a(null),h.current.onCaptured?.(m)}),x.on("error",m=>{B(m);let J=s?.reportCaptureIssue;J!==void 0&&Qe(ye=>J.call(s,ye),an("liveness",m,Math.max(0,A.current))),h.current.onError?.(m)}),s?.on("result",m=>{a(m),h.current.onResult?.(m)})];return()=>{for(let m of Ge)m?.();i.current=null,x.destroy()}},[s,t,o]);let me=ot(()=>{i.current?.start()},[]),ce=ot(()=>{i.current?.retry()},[]),I=ot(async()=>{let z=i.current;return z===null||typeof z.canSwitchCaptureMode!="function"?!1:await z.canSwitchCaptureMode().catch(()=>!1)===!0},[]),Ee=ot(async z=>{let Q=i.current;if(Q===null||typeof Q.setCaptureMode!="function")return!1;let x=await Q.setCaptureMode(z).catch(()=>!1)===!0;return x&&_(Q.facingMode??null),x},[]);return{state:u,gate:b,draining:w,gateLocked:d,frozenPreview:v,reduceMotion:L,rampColour:V,artifacts:O,error:H,result:se,facingMode:T,start:me,retry:ce,canSwitchCaptureMode:I,setCaptureMode:Ee,modeRestarted:G,attempt:U}}n(er,"useLivenessHandle");import{useCallback as Jr,useEffect as Xr,useState as st}from"react";var eo=new Set(["national_number"]);function tr(e){if(e==null||!e.available||e.selected!==null)return null;let t=e.options.filter(o=>eo.has(o));return t.length>0?{...e,options:t}:null}n(tr,"pending");function nr(e){let[t,o]=st(null),[r,s]=st(e===void 0),[c,i]=st(!1),[u,k]=st(!1);Xr(()=>{if(o(null),e===void 0){s(!0);return}let S=!0,d=e.methodChoice;typeof d=="function"?(s(!1),Promise.resolve().then(()=>d.call(e)).then(v=>{S&&o(tr(v))},()=>{}).finally(()=>{S&&s(!0)})):s(!0);let C=e.on("method",v=>o(tr(v)));return()=>{S=!1,C()}},[e]);let b=Jr(async S=>{if(e===void 0)return!1;i(!0),k(!1);try{return await e.selectMethod(S),o(null),!0}catch{return k(!0),!1}finally{i(!1)}},[e]),y=t!==null&&t.options.length===1?t.options[0]:null;return{choice:t,auto:y==="national_number"&&!u?y:null,settled:r,busy:c,failed:u,select:b}}n(nr,"useMethodChoice");import{useEffect as to,useMemo as no,useState as ro}from"react";var oo=["ar","fr","en"];function so(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(so,"isClipUrl");function io(e){let t=e.clips;if(typeof t!="object"||t===null)return null;let o={};for(let r of oo){let s=t[r];if(!(typeof s!="object"||s===null))for(let[c,i]of Object.entries(s))!he(c)||!so(i)||((o[r]??(o[r]={}))[c]=i)}return Object.keys(o).length>0?o:null}n(io,"toVoiceClipMap");function rr(e){let[t,o]=ro(null);to(()=>{if(o(null),e===void 0)return;let s=!0,c=n(u=>{if(!s)return;let k=typeof u=="object"&&u!==null&&typeof u.setId=="string"?u:null;o(b=>b?.setId===k?.setId?b:k)},"take");try{typeof e.voiceClips=="function"&&Promise.resolve(e.voiceClips()).then(c,()=>c(null))}catch{c(null)}let i=e.on("view",u=>c(u.voice));return()=>{s=!1,i()}},[e]);let r=no(()=>t!==null?io(t):null,[t]);return e===void 0?null:r}n(rr,"useServerVoiceClips");import{jsx as or}from"react/jsx-runtime";function sr({voice:e}){let t=$();return or(F,{kind:"chip","aria-pressed":e.enabled,"aria-label":t("capture.voiceGuidance"),"data-testid":"sekyro-voice-toggle",onClick:()=>e.toggle(),children:or(Ve,{off:!e.enabled,className:"sekyro-icon"})})}n(sr,"VoiceChip");import{Fragment as ar,jsx as R,jsxs as xe}from"react/jsx-runtime";var lo=new Set(["abandoned","not_opened","cancelled","superseded"]),uo=800,po="capture.lookAtColours";function fo(e){return e===void 0||e!==!1&&e.length===Xe.length&&Xe.every(t=>e.includes(t))}n(fo,"isDefaultTips");function mo(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(mo,"carriesActivation");function yo(e){return typeof e=="object"&&e!==null&&!ao(e)&&"tone"in e&&"text"in e}n(yo,"isNoticeObject");var go=new Set(["nni_unbound","id_number_unbound","method_required","mobile_required","portrait_required"]);function ho(e){return e==="starting"||e==="gating"||e==="recording"||e==="mode_switch"}n(ho,"isCapturing");function vo(e){return e==="captured"||e==="uploading"||e==="checking"}n(vo,"isPostCapture");function xi({verification:e,locale:t,dir:o,strings:r,slots:s,autoStart:c=!1,notice:i,startDisabled:u=!1,startLabel:k,tips:b,tipsSummary:y,coach:w,voice:S,onGuidance:d,onCaptured:C,onResult:v,onError:l,onStateChange:L,assetBaseUrl:g,className:V}){let E=rn(t),O=Ie(()=>nn(t,r),[t,r,E]),p=Ie(()=>f=>O[f]??"",[O]),H=o??(t==="ar"?"rtl":"ltr"),B=ke(null),se=co(Kn),a=er({verification:e,videoRef:B,assetBaseUrl:g,onCaptured:C,onResult:v,onError:l,onStateChange:L}),T=Jn(g,a.state==="idle"&&a.error===null),_=nr(e),G=_.choice!==null,N=qn(e),ie=jn(e),ae=zn(e),A=Dn(),U=$n(e),fe=U.session==="choice",h=U.mode==="assisted",me=S!==!1&&S?.clips===void 0,ce=rr(me?e:void 0),I=vt({locale:t,defaultClips:ce,options:S}),Ee=h?"environment":"user",z=U.settled,Q=ke(null),x=ke(!1),Ne=ke(I.unlock);Ne.current=I.unlock,oe(()=>{let f=Q.current;if(f===null)return;let Y=["pointerup","touchend","click","keydown"],de=n(()=>{for(let Te of Y)f.removeEventListener(Te,Re,!0)},"disarm");function Re(Te){if(x.current){de();return}mo(Te)&&(x.current=!0,de(),Ne.current())}n(Re,"onGesture");for(let Te of Y)f.addEventListener(Te,Re,{capture:!0,passive:!0});return de},[]);let Ge=it(()=>{x.current||(x.current=!0,I.unlock()),a.start()},[I.unlock,a.start]),m=it(()=>a.start(),[a.start]),J=ke(!1),ye=a.state==="idle"&&a.error===null,Rt=!G&&!N.required&&(c===!0||c==="when-permitted"&&A.permission==="granted"),Vt=Rt&&_.settled&&N.settled&&z,cr=c==="when-permitted"&&!A.permissionSettled&&!J.current,Mt=Rt&&ye&&!J.current,at=(cr||Mt||!z)&&T.gate==="ready"?"loading":T.gate;oe(()=>{!Vt||!ye||T.gate!=="ready"||J.current||(J.current=!0,m())},[Vt,ye,T.gate,m]);let lr=ye&&!G&&!N.required&&!(Mt&&T.gate==="ready"),[wt,Lt]=ir(!1),{canSwitchCaptureMode:_t,setCaptureMode:It}=a;oe(()=>{if(!U.settled||!fe){Lt(!1);return}let f=!0;return _t().then(Y=>{f&&Lt(Y)}),()=>{f=!1}},[U.settled,fe,_t]);let{choose:xt}=U,be=h?"self":"assisted",ur=it(async()=>{await It(be)&&xt(be)},[It,xt,be]),Et=a.state!=="idle"&&a.facingMode!==null?a.facingMode:Ee;oe(()=>{let f=B.current?.style;Et==="user"?f?.removeProperty("transform"):f&&(f.transform="none")},[Et]);let Fe=Ie(()=>a.artifacts!==null&&typeof URL.createObjectURL=="function"?URL.createObjectURL(a.artifacts.keyframe):null,[a.artifacts]);oe(()=>{if(Fe!==null)return()=>URL.revokeObjectURL(Fe)},[Fe]);let Nt=a.frozenPreview??Fe,Se=e!==void 0,K=ho(a.state),le=vo(a.state),De=K||le,Z=a.result,At=a.state==="done"&&Z!==null,qe=K&&a.rampColour!==null,ct=a.state==="recording"&&a.frozenPreview!==null&&!qe,je=se!==null,Pt=wt&&K&&!ct?{to:be,label:p(be==="assisted"?"capture.modeSwitch.toAssisted":"capture.modeSwitch.toSelf"),description:p(be==="assisted"?"capture.modeSwitch.toAssistedLabel":"capture.modeSwitch.toSelfLabel"),onSwitch:n(()=>{ur()},"onSwitch")}:null,Ye=a.modeRestarted&&K?p("capture.modeSwitch.restarted"):null,Ae=le||ct,Tt=le?"checking":ct?"frozen":a.state==="recording"||qe?"recording":a.gateLocked||a.gate.progress>=1?"locked":a.gate.faceDetected?"aligning":"seeking",$e=K?a.gate.hint:null,ze=a.state==="starting"?"capture.preparing.title":$e===null?null:$e==="center"&&!a.gate.faceDetected?"fcv3.no_face":Wt($e),[dr,Kt]=ir(null);oe(()=>{if(ze!=="fcv3.no_face"){Kt(ze);return}if(!K)return;let f=setTimeout(()=>Kt(ze),uo);return()=>clearTimeout(f)},[ze,K]);let lt=K&&!qe&&typeof w=="string"&&w!=="",Ot=h&&K?p("capture.assisted.stage"):null,ge=K&&!lt?qe?po:dr:null,ut=lt?w:ge===null?"":p(ge);Ct(I,ge,ut,K);let Ut=ke(d);Ut.current=d,oe(()=>{if(he(ge))try{Ut.current?.(ge)}catch(f){console.error("[@sekyro/react] onGuidance threw:",f)}},[ge]);let Pe=Ie(()=>({supported:I.supported,enabled:I.enabled,setEnabled:I.setEnabled,toggle:I.toggle}),[I.supported,I.enabled,I.setEnabled,I.toggle]),dt=s?.voicePrompt,Ht=dt!==void 0,Bt=S===void 0,Gt=ke(!1);oe(()=>{!Ht||!Bt||Gt.current||!nt()||(Gt.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."))},[Ht,Bt]);let pr=dt!==void 0?(f,Y,de)=>dt(f,Y,de,Pe):I.supported?()=>R(sr,{voice:Pe}):void 0,{summary:pt,summaryPlaying:Ft,toggleSummary:Dt,stopSummary:qt}=I,Ze=y!==void 0&&y!=="",jt=Ze?y:p("capture.tips.summary"),Yt=Ze?pt!=="none":pt==="partner"||pt==="default"&&fo(b),fr=Ie(()=>Yt?{playing:Ft,toggle:n(()=>Dt(jt,{clip:!Ze}),"toggle"),stop:qt}:void 0,[Yt,Ft,Dt,jt,qt,Ze]),mr=Ie(()=>({assets:at,retryAssets:T.retry,permission:A.permission,permissionSettled:A.permissionSettled,captureMode:U.mode,facing:Ee,voice:Pe}),[at,T.retry,A.permission,A.permissionSettled,U.mode,Ee,Pe]),yr=yo(i)?R(D,{tone:i.tone,testId:"sekyro-host-notice",children:R("span",{children:i.text})}):i??null,X=Z!==null&&Z.status==="retry"?Z:null,P=At&&Z.status==="unavailable"&&!G&&Z.reasonCode!=="portrait_required"?Z:null,ue=At&&(Z.status==="verified"||Z.status==="not_verified"||Z.status==="review")?Z:null,ft=n((f,Y)=>{if(f===void 0)return null;if(f==="device_cooldown"){let Re=en(t,Y);if(Re!==null)return p(Re.key).replace("{time}",Re.time)}let de=Xt(f);return de===null?null:p(de)},"reasonText"),mt=n(f=>{let Y=f.retakeHint===void 0?null:Qt(f.retakeHint);return Y===null?ft(f.reasonCode):p(Y)},"retryText"),$t=ue===null?null:ft(ue.reasonCode,ue.retryAfter)??(ue.status==="not_verified"&&ue.reason!==void 0&&lo.has(ue.reason)?p("errors.session_expired"):null),gr=P!==null&&P.reasonCode!==void 0&&P.reasonCode!=="nni_unbound"&&P.reasonCode!=="id_number_unbound"&&P.reasonCode!=="method_required"&&P.reasonCode!=="mobile_required"&&!(P.reasonCode==="no_recorder"&&a.artifacts?.degraded==="NO_RECORDER"),We=P?.reasonCode,zt=a.attempt;oe(()=>{P===null||We===void 0||e?.reportCaptureIssue===void 0||go.has(We)||Qe(f=>e.reportCaptureIssue?.(f),{check:"liveness",kind:"unavailable",phase:"upload",engineKind:We,attempt:Math.min(1e3,zt)})},[P,We,zt,e]);let Zt=Je(),hr=G&&_.auto===null&&!K&&!le&&a.error===null,yt=it(async f=>{await _.select(f)&&a.state==="done"&&a.retry()},[_.select,a.state,a.retry]);return oe(()=>{_.auto!==null&&!_.busy&&!K&&!le&&yt(_.auto)},[_.auto,_.busy,K,le,yt]),R(on,{value:p,children:xe("div",{ref:Q,className:V===void 0?"sekyro-capture":`sekyro-capture ${V}`,dir:H,lang:t,"data-testid":"sekyro-liveness-capture","data-state":a.state,children:[s?.header,X!==null&&mt(X)!==null&&!(je&&De)?R(D,{tone:"warning",role:"status",testId:"sekyro-retry-notice",children:R("span",{children:mt(X)})}):null,Ye!==null&&!je?R(D,{tone:"info",role:"status",testId:"sekyro-mode-switch-status",children:R("span",{children:Ye})}):null,ae&&le&&!je?R(D,{tone:"info",role:"status",testId:"sekyro-busy-notice",children:R("span",{children:p("capture.busy")})}):null,N.required&&ye?R(D,{tone:"info",role:"status",testId:"sekyro-mobile-required",children:R("span",{children:p("reasons.mobile_required")})}):null,a.error!==null?s?.errorPanel!==void 0?s.errorPanel(a.error,a.retry):xe(D,{tone:"danger",testId:"sekyro-error-notice",children:[R("span",{children:p(Jt(a.error))}),a.error.retryable?R(F,{ref:Zt,kind:"ghost",className:"sekyro-btn--start",onClick:a.retry,children:p("common.retry")}):null]}):null,P!==null?xe(D,{tone:"danger",testId:"sekyro-unavailable-notice",children:[R("span",{children:(P.reasonCode==="attestation"&&P.attestationError==="clock_wrong"?p("errors.device_clock"):ft(P.reasonCode))??p(P.reasonCode===void 0?"errors.session_expired":"errors.network_error")}),gr?R(F,{ref:Zt,kind:"ghost",className:"sekyro-btn--start",onClick:a.retry,children:p(P.reasonCode==="attestation"?"common.retry":"capture.recordAgain")}):null]}):null,$t!==null&&ue!==null?R(D,{tone:ue.status==="not_verified"?"danger":"info",testId:"sekyro-result-notice",children:R("span",{children:$t})}):null,R("div",{className:De?void 0:"sekyro-hidden","data-capture-live":De?"":void 0,children:je?se({videoRef:B,guidance:Ae&&Se?p("capture.checking"):ut,coached:lt&&!(Ae&&Se),note:Ae?Se?p(ae?"capture.busy":"capture.checkingHint"):null:Ye??(X!==null?mt(X):Ot),settled:Ae&&Se,progress:a.gate.progress,phase:Tt,still:Ae?Nt:null,live:De,modeSwitch:Pt,...wt?{status:Ye}:{},ramp:a.rampColour===null?null:{colour:a.rampColour}}):R(sn,{videoRef:B,guidanceText:ut,guidanceHint:$e,guidanceKey:ge,progress:a.gate.progress,phase:Tt,draining:a.draining,stillUrl:Nt,showChecking:Se,operatorText:Ot,voicePrompt:pr,overlay:f=>xe(ar,{children:[s?.stageOverlay?.(f),R(cn,{colour:a.rampColour})]}),reduceMotion:a.reduceMotion,modeSwitch:Pt})}),hr&&_.choice!==null?R(bn,{title:p("method.title"),description:p("method.description"),options:_.choice.options.map(f=>({id:f,label:p(`method.${f}`)})),busy:_.busy,error:_.failed?p("errors.network_error"):null,focus:a.state==="done",testId:"sekyro-method",look:"buttons",onChoose:f=>{yt(f)}}):null,lr?xe(ar,{children:[ie&&s?.header===void 0&&s?.intro===void 0?xe("div",{className:"sekyro-stack sekyro-stack--1",children:[R("h2",{className:"sekyro-text-body",children:p("returning.title")}),R("p",{className:"sekyro-text-muted",children:p("returning.description")})]}):null,yr,s?.intro!==void 0?s.intro(Ge,mr):R(Fn,{assets:at,onRetryAssets:T.retry,permission:A.permission,captureMode:U.mode,voice:Pe,tips:b??Xe,summary:fr,startLabel:k,startDisabled:u,onStart:Ge})]}):null,R(Tn,{showCoaching:X!==null,coaching:Pn(X?.reasonCode),attemptsText:X?.attemptsRemaining!==void 0?tn(O,t,X.attemptsRemaining):null,showRetake:X!==null&&!K&&!le||!Se&&a.state==="captured",onRetake:a.retry}),s?.footer]})})}n(xi,"LivenessCapture");export{Pn as a,Nn as b,nt as c,Kn as d,Xe as e,bn as f,$n as g,tt as h,uo as i,xi as j};
@@ -1,2 +1,2 @@
1
1
  "use client";
2
- import{d as I}from"./chunk-23GZ62S2.js";import{a as S}from"./chunk-5EPFSWU5.js";import{a}from"./chunk-2KED7D2Q.js";import{useId as V}from"react";import{jsx as k,jsxs as E}from"react/jsx-runtime";var A=Array.from({length:56},(r,e)=>{let s=e/56*2*Math.PI-Math.PI/2,t=Math.cos(s),i=Math.sin(s);return{id:`tick-${e}`,frac:e/55,x1:150+108*t,y1:150+108*i,x2:150+138*t,y2:150+138*i,style:{transitionDelay:`${e*6}ms`}}});function T(r,e,s,t){return s?"var(--sekyro-color-success)":r?t?"color-mix(in srgb, var(--sekyro-color-warning) 75%, transparent)":e<.33?"color-mix(in srgb, var(--sekyro-color-brand) 55%, transparent)":e<.66?"color-mix(in srgb, var(--sekyro-color-brand) 80%, transparent)":"var(--sekyro-color-brand)":"color-mix(in srgb, var(--sekyro-color-surface) 32%, transparent)"}a(T,"tickColor");var w="M0 -50 H300 V350 H0 Z M50 150 a100,100 0 1 0 200,0 a100,100 0 1 0 -200,0 Z";function x({progress:r,phase:e,draining:s=!1}){let t=Math.min(1,Math.max(0,r)),i=Math.round(t*56),n=e==="checking",l=e==="recording",c=e==="frozen",u=n||c,p=n||l||c,y=e==="locked"||p,f=s&&!y;return E("svg",{"aria-hidden":"true",viewBox:"0 0 300 300",preserveAspectRatio:"xMidYMid meet",className:"sekyro-stage__arc","data-testid":"sekyro-capture-arc","data-phase":e,"data-filled":i,"data-recording":l?"":void 0,"data-draining":f?"":void 0,children:[k("path",{fillRule:"evenodd",d:w,fill:"color-mix(in srgb, var(--sekyro-color-fg) var(--sekyro-scrim, 96%), transparent)",style:{"--sekyro-scrim":u?"100%":"96%"},className:"sekyro-arc__scrim sekyro-capture-fade-in","data-testid":"sekyro-capture-scrim"}),E("g",{className:e==="locked"?"sekyro-capture-settle":void 0,children:[k("g",{className:u?"sekyro-arc__ring sekyro-arc__ring--dim":"sekyro-arc__ring",children:A.map((d,_)=>k("line",{x1:d.x1,y1:d.y1,x2:d.x2,y2:d.y2,stroke:T(_<i,d.frac,y,f),strokeWidth:3,strokeLinecap:"round",style:d.style,className:"sekyro-arc__tick"},d.id))}),k("g",{className:e==="seeking"?"sekyro-capture-breathe":void 0,children:k("circle",{cx:150,cy:150,r:100,fill:"none",stroke:y?"var(--sekyro-color-success)":"var(--sekyro-color-surface)",strokeWidth:y?3.5:2.5,className:p?"sekyro-arc__guide sekyro-arc__guide--spin sekyro-capture-ring-spin":"sekyro-arc__guide sekyro-capture-fade-in","data-testid":"sekyro-capture-guide"})})]})]})}a(x,"CaptureArc");import{Fragment as M,jsx as o,jsxs as m}from"react/jsx-runtime";function ne({videoRef:r,guidanceText:e,guidanceHint:s,guidanceKey:t,progress:i,phase:n,draining:l=!1,stillUrl:c,showChecking:u,operatorText:p=null,voicePrompt:y,overlay:f,reduceMotion:d=!1,modeSwitch:_=null}){let h=I(),b=n==="checking",g=b||n==="frozen",v=g&&u?h("capture.checking"):e,C=y?.(s,v,t);return m("div",{className:d?"sekyro-stage sekyro-capture-reduce":"sekyro-stage","data-testid":"sekyro-capture-stage",children:[o("video",{ref:r,playsInline:!0,muted:!0,className:"sekyro-stage__video","data-testid":"sekyro-capture-video"}),c!==null&&g?o("img",{src:c,alt:h("capture.previewAlt"),className:"sekyro-stage__still sekyro-capture-develop","data-testid":"sekyro-capture-still"}):null,o(x,{progress:i,phase:n,draining:l}),f?.(r),C!=null&&!g?o("div",{className:"sekyro-stage__corner-start","data-testid":"sekyro-voice-slot",children:C}):null,_!==null&&!g?o(H,{view:_,className:"sekyro-stage__corner-end sekyro-stage__mode-switch",kind:"chip"}):null,b&&u?m("span",{className:"sekyro-stage__corner-end sekyro-stage__pill sekyro-capture-pill-in","data-testid":"sekyro-camera-off-pill",children:[o(G,{}),h("capture.cameraOff")]}):null,m("p",{"aria-live":"polite",className:"sekyro-stage__guidance","data-testid":"sekyro-capture-guidance",children:[o("span",{className:"sekyro-stage__guidance-text sekyro-capture-text-in",children:v},v),g&&u?o("span",{className:"sekyro-stage__guidance-hint",children:h("capture.checkingHint")}):p!==null&&!g?o("span",{className:"sekyro-stage__guidance-hint","data-testid":"sekyro-operator-line",children:p}):null]})]})}a(ne,"CaptureStage");function H({view:r,className:e,kind:s}){let t=V(),i=m(M,{children:[o(D,{}),o("span",{children:r.label})]}),n={onClick:r.onSwitch,"aria-describedby":t,"data-testid":"sekyro-capture-mode-switch","data-mode":r.to};return m(M,{children:[s==="chip"?o(S,{kind:"chip",className:e,...n,children:i}):o("button",{type:"button",className:e,...n,children:i}),o("span",{id:t,className:"sekyro-visually-hidden",children:r.description})]})}a(H,"ModeSwitchChip");function D(){return m("svg",{"aria-hidden":"true",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",className:"sekyro-icon",children:[o("path",{d:"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"}),o("path",{d:"M15.4 11.9a3.5 3.5 0 0 0-6.1-1.4M15.4 11.9h-2.1m2.1 0V9.8"}),o("path",{d:"M8.6 13.4a3.5 3.5 0 0 0 6.1 1.4M8.6 13.4h2.1m-2.1 0v2.1"})]})}a(D,"FlipCameraIcon");function G(){return m("svg",{"aria-hidden":"true",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",className:"sekyro-icon sekyro-icon--sm",children:[o("path",{d:"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"}),o("path",{d:"M3 3l18 18"})]})}a(G,"CameraOffIcon");import{screenRampColourValue as P}from"@sekyro/web";import{useEffect as U,useLayoutEffect as $,useRef as L}from"react";import{createPortal as K}from"react-dom";import{Fragment as X,jsx as N,jsxs as Z}from"react/jsx-runtime";var W=typeof window>"u"?U:$,R="data-sekyro-ramp",O=[["background-color","transparent"],["background-image","none"]];function z(r){let e=[],s=r.ownerDocument;for(let n=r;n!==null&&n!==s.documentElement;n=n.parentElement){if(!(n instanceof HTMLElement)&&!(n instanceof SVGElement))continue;let l=n.style;for(let[c,u]of O){let p=l.getPropertyValue(c),y=l.getPropertyPriority(c);l.setProperty(c,u,"important"),e.push(()=>{p===""?l.removeProperty(c):l.setProperty(c,p,y)})}}let t=s.documentElement,i=t.hasAttribute(R);return t.setAttribute(R,""),i||e.push(()=>t.removeAttribute(R)),()=>{for(let n of e.reverse())n()}}a(z,"clearAncestorBackdrops");function B(r){return{position:"fixed",inset:0,minWidth:"100vw",minHeight:"100lvh",margin:0,padding:0,border:0,zIndex:-1,pointerEvents:"none",backgroundColor:P(r)}}a(B,"washStyle");function Y(r){return{position:"absolute",inset:0,pointerEvents:"none",backgroundColor:P(r)}}a(Y,"coverStyle");function de({colour:r}){let e=L(null),s=r!==null;return W(()=>{let t=e.current?.parentElement;if(!(!s||t===null||t===void 0))return z(t)},[s]),r===null||typeof document>"u"?null:Z(X,{children:[N("div",{ref:e,"aria-hidden":"true","data-testid":"sekyro-screen-ramp-cover","data-colour":r,style:Y(r)}),K(N("div",{"aria-hidden":"true","data-testid":"sekyro-screen-ramp","data-colour":r,style:B(r)}),document.body)]})}a(de,"ScreenRampLayer");export{ne as a,H as b,de as c};
2
+ import{d as I}from"./chunk-DYWLZHSM.js";import{a as S}from"./chunk-WC4U54LZ.js";import{a}from"./chunk-2KED7D2Q.js";import{useId as V}from"react";import{jsx as k,jsxs as E}from"react/jsx-runtime";var A=Array.from({length:56},(r,e)=>{let s=e/56*2*Math.PI-Math.PI/2,t=Math.cos(s),i=Math.sin(s);return{id:`tick-${e}`,frac:e/55,x1:150+108*t,y1:150+108*i,x2:150+138*t,y2:150+138*i,style:{transitionDelay:`${e*6}ms`}}});function T(r,e,s,t){return s?"var(--sekyro-color-success)":r?t?"color-mix(in srgb, var(--sekyro-color-warning) 75%, transparent)":e<.33?"color-mix(in srgb, var(--sekyro-color-brand) 55%, transparent)":e<.66?"color-mix(in srgb, var(--sekyro-color-brand) 80%, transparent)":"var(--sekyro-color-brand)":"color-mix(in srgb, var(--sekyro-color-surface) 32%, transparent)"}a(T,"tickColor");var w="M0 -50 H300 V350 H0 Z M50 150 a100,100 0 1 0 200,0 a100,100 0 1 0 -200,0 Z";function x({progress:r,phase:e,draining:s=!1}){let t=Math.min(1,Math.max(0,r)),i=Math.round(t*56),n=e==="checking",l=e==="recording",c=e==="frozen",u=n||c,p=n||l||c,y=e==="locked"||p,f=s&&!y;return E("svg",{"aria-hidden":"true",viewBox:"0 0 300 300",preserveAspectRatio:"xMidYMid meet",className:"sekyro-stage__arc","data-testid":"sekyro-capture-arc","data-phase":e,"data-filled":i,"data-recording":l?"":void 0,"data-draining":f?"":void 0,children:[k("path",{fillRule:"evenodd",d:w,fill:"color-mix(in srgb, var(--sekyro-color-fg) var(--sekyro-scrim, 96%), transparent)",style:{"--sekyro-scrim":u?"100%":"96%"},className:"sekyro-arc__scrim sekyro-capture-fade-in","data-testid":"sekyro-capture-scrim"}),E("g",{className:e==="locked"?"sekyro-capture-settle":void 0,children:[k("g",{className:u?"sekyro-arc__ring sekyro-arc__ring--dim":"sekyro-arc__ring",children:A.map((d,_)=>k("line",{x1:d.x1,y1:d.y1,x2:d.x2,y2:d.y2,stroke:T(_<i,d.frac,y,f),strokeWidth:3,strokeLinecap:"round",style:d.style,className:"sekyro-arc__tick"},d.id))}),k("g",{className:e==="seeking"?"sekyro-capture-breathe":void 0,children:k("circle",{cx:150,cy:150,r:100,fill:"none",stroke:y?"var(--sekyro-color-success)":"var(--sekyro-color-surface)",strokeWidth:y?3.5:2.5,className:p?"sekyro-arc__guide sekyro-arc__guide--spin sekyro-capture-ring-spin":"sekyro-arc__guide sekyro-capture-fade-in","data-testid":"sekyro-capture-guide"})})]})]})}a(x,"CaptureArc");import{Fragment as M,jsx as o,jsxs as m}from"react/jsx-runtime";function ne({videoRef:r,guidanceText:e,guidanceHint:s,guidanceKey:t,progress:i,phase:n,draining:l=!1,stillUrl:c,showChecking:u,operatorText:p=null,voicePrompt:y,overlay:f,reduceMotion:d=!1,modeSwitch:_=null}){let h=I(),b=n==="checking",g=b||n==="frozen",v=g&&u?h("capture.checking"):e,C=y?.(s,v,t);return m("div",{className:d?"sekyro-stage sekyro-capture-reduce":"sekyro-stage","data-testid":"sekyro-capture-stage",children:[o("video",{ref:r,playsInline:!0,muted:!0,className:"sekyro-stage__video","data-testid":"sekyro-capture-video"}),c!==null&&g?o("img",{src:c,alt:h("capture.previewAlt"),className:"sekyro-stage__still sekyro-capture-develop","data-testid":"sekyro-capture-still"}):null,o(x,{progress:i,phase:n,draining:l}),f?.(r),C!=null&&!g?o("div",{className:"sekyro-stage__corner-start","data-testid":"sekyro-voice-slot",children:C}):null,_!==null&&!g?o(H,{view:_,className:"sekyro-stage__corner-end sekyro-stage__mode-switch",kind:"chip"}):null,b&&u?m("span",{className:"sekyro-stage__corner-end sekyro-stage__pill sekyro-capture-pill-in","data-testid":"sekyro-camera-off-pill",children:[o(G,{}),h("capture.cameraOff")]}):null,m("p",{"aria-live":"polite",className:"sekyro-stage__guidance","data-testid":"sekyro-capture-guidance",children:[o("span",{className:"sekyro-stage__guidance-text sekyro-capture-text-in",children:v},v),g&&u?o("span",{className:"sekyro-stage__guidance-hint",children:h("capture.checkingHint")}):p!==null&&!g?o("span",{className:"sekyro-stage__guidance-hint","data-testid":"sekyro-operator-line",children:p}):null]})]})}a(ne,"CaptureStage");function H({view:r,className:e,kind:s}){let t=V(),i=m(M,{children:[o(D,{}),o("span",{children:r.label})]}),n={onClick:r.onSwitch,"aria-describedby":t,"data-testid":"sekyro-capture-mode-switch","data-mode":r.to};return m(M,{children:[s==="chip"?o(S,{kind:"chip",className:e,...n,children:i}):o("button",{type:"button",className:e,...n,children:i}),o("span",{id:t,className:"sekyro-visually-hidden",children:r.description})]})}a(H,"ModeSwitchChip");function D(){return m("svg",{"aria-hidden":"true",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",className:"sekyro-icon",children:[o("path",{d:"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"}),o("path",{d:"M15.4 11.9a3.5 3.5 0 0 0-6.1-1.4M15.4 11.9h-2.1m2.1 0V9.8"}),o("path",{d:"M8.6 13.4a3.5 3.5 0 0 0 6.1 1.4M8.6 13.4h2.1m-2.1 0v2.1"})]})}a(D,"FlipCameraIcon");function G(){return m("svg",{"aria-hidden":"true",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",className:"sekyro-icon sekyro-icon--sm",children:[o("path",{d:"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"}),o("path",{d:"M3 3l18 18"})]})}a(G,"CameraOffIcon");import{screenRampColourValue as P}from"@sekyro/web";import{useEffect as U,useLayoutEffect as $,useRef as L}from"react";import{createPortal as K}from"react-dom";import{Fragment as X,jsx as N,jsxs as Z}from"react/jsx-runtime";var W=typeof window>"u"?U:$,R="data-sekyro-ramp",O=[["background-color","transparent"],["background-image","none"]];function z(r){let e=[],s=r.ownerDocument;for(let n=r;n!==null&&n!==s.documentElement;n=n.parentElement){if(!(n instanceof HTMLElement)&&!(n instanceof SVGElement))continue;let l=n.style;for(let[c,u]of O){let p=l.getPropertyValue(c),y=l.getPropertyPriority(c);l.setProperty(c,u,"important"),e.push(()=>{p===""?l.removeProperty(c):l.setProperty(c,p,y)})}}let t=s.documentElement,i=t.hasAttribute(R);return t.setAttribute(R,""),i||e.push(()=>t.removeAttribute(R)),()=>{for(let n of e.reverse())n()}}a(z,"clearAncestorBackdrops");function B(r){return{position:"fixed",inset:0,minWidth:"100vw",minHeight:"100lvh",margin:0,padding:0,border:0,zIndex:-1,pointerEvents:"none",backgroundColor:P(r)}}a(B,"washStyle");function Y(r){return{position:"absolute",inset:0,pointerEvents:"none",backgroundColor:P(r)}}a(Y,"coverStyle");function de({colour:r}){let e=L(null),s=r!==null;return W(()=>{let t=e.current?.parentElement;if(!(!s||t===null||t===void 0))return z(t)},[s]),r===null||typeof document>"u"?null:Z(X,{children:[N("div",{ref:e,"aria-hidden":"true","data-testid":"sekyro-screen-ramp-cover","data-colour":r,style:Y(r)}),K(N("div",{"aria-hidden":"true","data-testid":"sekyro-screen-ramp","data-colour":r,style:B(r)}),document.body)]})}a(de,"ScreenRampLayer");export{ne as a,H as b,de as c};
@@ -1,2 +1,2 @@
1
1
  "use client";
2
- import{a as v,b as _}from"./chunk-VXMOKB43.js";import{a as x}from"./chunk-VRDPGOXM.js";import{g as S}from"./chunk-FJ3AON46.js";import{a as p,b as y,d as N,k as C,p as b,q as w}from"./chunk-QL2NK7GA.js";import{a as k,l as I,o as R}from"./chunk-5EPFSWU5.js";import{a as i}from"./chunk-2KED7D2Q.js";import{useState as E}from"react";var U={document:"card",population_registry:"id",national_eid:"smartphone",phone_otp:"phone",email_otp:"email"};function Y(e,r){switch(e.service){case"document":return r.t("method.document_photo");case"population_registry":return r.t("method.national_number");case"national_eid":{let a=e.nationalEid?.providerName;return a?r.t("method.national_eid",{provider:a}):r.t("method.national_eidGeneric")}default:return null}}i(Y,"identityLabel");function q(e,r){let[a,n]=E(!1),[c,m]=E(null);return{busy:a,error:c,run:i(u=>{n(!0),m(null),u().then(()=>n(!1),f=>{n(!1),m(e.t(x(f,e.strings))),r?.(f)})},"run")}}i(q,"useChoiceAction");import{useContext as H,useId as L}from"react";import{Fragment as M,jsx as t,jsxs as s}from"react/jsx-runtime";function O(){let e=`sekyro-face-light-${L().replace(/[^A-Za-z0-9_-]/g,"")}`;return s("svg",{className:"sekyro-mark sekyro-mark--face",viewBox:"0 0 168 206","aria-hidden":"true",focusable:"false",children:[t("defs",{children:t("mask",{id:e,children:t("ellipse",{className:"sekyro-mark__arc",cx:"84",cy:"103",rx:"76",ry:"95",pathLength:"1",fill:"none",stroke:"#fff",strokeWidth:"16"})})}),t("ellipse",{cx:"84",cy:"103",rx:"64",ry:"83",fill:"none",className:"sekyro-mark__line"}),t("path",{className:"sekyro-mark__face",d:"M68 64v10M100 64v10M84 66v25q0 2-6 1M60 108q24 18 48 0"}),t("ellipse",{className:"sekyro-mark__ticks",cx:"84",cy:"103",rx:"76",ry:"95",pathLength:"56"}),t("ellipse",{className:"sekyro-mark__ticks sekyro-mark__ticks--light",cx:"84",cy:"103",rx:"76",ry:"95",pathLength:"56",mask:`url(#${e})`})]})}i(O,"FaceMark");var B={glasses:"jGlasses",lighting:"light",faceCamera:"camera"};function te(e){if(!(e?.kind!=="liveness"||e.reason===void 0))return{reason:e.reason,...e.retakeHint!==void 0?{retakeHint:e.retakeHint}:{},attemptsRemaining:e.attemptsRemaining??0,attemptsExhausted:e.attemptsExhausted===!0}}i(te,"faceIntroRetryOf");var F={"capture.retryFrontCamera.screenSide":"camera","capture.retryBackCamera.backSide":"camera","capture.retryUpright.vertical":"smartphone","capture.retryUpright.untilEnd":"smartphone","capture.retryRecording.cameraOn":"camera","capture.retryRecording.stay":"smartphone","capture.retryRecording.network":"smartphone","capture.retryDevice.screenRecording":"smartphone","capture.retryDevice.phone":"smartphone"};function ne({start:e,context:r,tips:a,tipsTitle:n,human:c=!1,returning:m=!1,notice:d,retry:u}){let f=S(),{t:o}=f,g=u===void 0?"face":v(u.reason),h=g==="face"?null:_[g].tips,A=H(C)?.busy===!0;return s("section",{className:"sekyro-step",children:[t(O,{}),r.captureMode==="assisted"?t(y,{title:o("capture.assisted.heading"),lead:o("capture.assisted.lead")}):m?t(y,{title:o("returning.heading"),lead:o("returning.description")}):t(y,{title:o(c?"native.face.humanIntroTitle":"native.face.introTitle"),lead:o(c?"native.face.humanIntroLead":"native.face.introLead")}),u!==void 0?t(T,{retry:u,title:_[g].title}):null,n!==void 0&&h===null?t("p",{className:"sekyro-section-label",children:n}):null,t("ul",{className:"sekyro-tiprows",children:h!==null?h.map(l=>s("li",{children:[t(p,{name:F[l]??"face"}),o(l)]},l)):a!==void 0?a.map(l=>s("li",{children:[t(p,{name:B[l.id]??"face"}),l.text]},l.id)):s(M,{children:[s("li",{children:[t(p,{name:"light"}),o("capture.tips.light")]}),s("li",{children:[t(p,{name:"jGlasses"}),o("capture.tips.uncover")]}),s("li",{children:[t(p,{name:"smartphone"}),o("capture.tips.eyeLevel")]})]})}),d??null,d!==void 0?null:r.assets==="failed"?t(k,{kind:"secondary",full:!0,onClick:r.retryAssets,children:o("common.retry")}):null,d!==void 0?null:t(N,{children:s(k,{full:!0,disabled:r.assets!=="ready"||A,"aria-busy":r.assets==="loading"||void 0,onClick:e,children:[t(p,{name:"camera"}),o("capture.start")]})})]})}i(ne,"FaceIntro");var K=new Set(["match_inconclusive","no_face_source","below_threshold"]);function T({retry:e,title:r}){let a=S(),n=e.retakeHint===void 0?null:I(e.retakeHint),c=e.reason==="probe_not_from_liveness"?"capture.retrySamePerson.message":K.has(e.reason)?"capture.retryMatch.message":R(e.reason);return s(b,{tone:"warning",children:[n!==null?t("span",{children:a.t(n)}):c!==null?t("span",{children:a.t(c)}):null,n===null?t("span",{children:a.t(r)}):null,t("span",{children:w(a,e.attemptsRemaining,e.attemptsExhausted)})]})}i(T,"RetryNotice");import{isInAppBrowser as $}from"@sekyro/web/client";function se(e){return $(e)}i(se,"isInAppBrowser");function ce(e,r){let a=r??(typeof navigator>"u"?"":String(navigator.userAgent??""));if(!/Android/i.test(a))return null;let n;try{n=new URL(e)}catch{return null}if(n.protocol!=="https:"&&n.protocol!=="http:")return null;let c=n.protocol.slice(0,-1);return`intent://${n.host}${n.pathname}${n.search}#Intent;scheme=${c};action=android.intent.action.VIEW;S.browser_fallback_url=${encodeURIComponent(e)};end`}i(ce,"androidBrowserIntent");export{U as a,Y as b,q as c,te as d,ne as e,se as f,ce as g};
2
+ import{a as v,b as _}from"./chunk-K5H7KWEY.js";import{a as x}from"./chunk-VRDPGOXM.js";import{g as S}from"./chunk-PMNUDJWG.js";import{a as p,b as y,d as N,k as C,p as b,q as w}from"./chunk-Q5BGUJMS.js";import{a as k,l as I,o as R}from"./chunk-WC4U54LZ.js";import{a as i}from"./chunk-2KED7D2Q.js";import{useState as E}from"react";var U={document:"card",population_registry:"id",national_eid:"smartphone",phone_otp:"phone",email_otp:"email"};function Y(e,r){switch(e.service){case"document":return r.t("method.document_photo");case"population_registry":return r.t("method.national_number");case"national_eid":{let a=e.nationalEid?.providerName;return a?r.t("method.national_eid",{provider:a}):r.t("method.national_eidGeneric")}default:return null}}i(Y,"identityLabel");function q(e,r){let[a,n]=E(!1),[c,m]=E(null);return{busy:a,error:c,run:i(u=>{n(!0),m(null),u().then(()=>n(!1),f=>{n(!1),m(e.t(x(f,e.strings))),r?.(f)})},"run")}}i(q,"useChoiceAction");import{useContext as H,useId as L}from"react";import{Fragment as M,jsx as t,jsxs as s}from"react/jsx-runtime";function O(){let e=`sekyro-face-light-${L().replace(/[^A-Za-z0-9_-]/g,"")}`;return s("svg",{className:"sekyro-mark sekyro-mark--face",viewBox:"0 0 168 206","aria-hidden":"true",focusable:"false",children:[t("defs",{children:t("mask",{id:e,children:t("ellipse",{className:"sekyro-mark__arc",cx:"84",cy:"103",rx:"76",ry:"95",pathLength:"1",fill:"none",stroke:"#fff",strokeWidth:"16"})})}),t("ellipse",{cx:"84",cy:"103",rx:"64",ry:"83",fill:"none",className:"sekyro-mark__line"}),t("path",{className:"sekyro-mark__face",d:"M68 64v10M100 64v10M84 66v25q0 2-6 1M60 108q24 18 48 0"}),t("ellipse",{className:"sekyro-mark__ticks",cx:"84",cy:"103",rx:"76",ry:"95",pathLength:"56"}),t("ellipse",{className:"sekyro-mark__ticks sekyro-mark__ticks--light",cx:"84",cy:"103",rx:"76",ry:"95",pathLength:"56",mask:`url(#${e})`})]})}i(O,"FaceMark");var B={glasses:"jGlasses",lighting:"light",faceCamera:"camera"};function te(e){if(!(e?.kind!=="liveness"||e.reason===void 0))return{reason:e.reason,...e.retakeHint!==void 0?{retakeHint:e.retakeHint}:{},attemptsRemaining:e.attemptsRemaining??0,attemptsExhausted:e.attemptsExhausted===!0}}i(te,"faceIntroRetryOf");var F={"capture.retryFrontCamera.screenSide":"camera","capture.retryBackCamera.backSide":"camera","capture.retryUpright.vertical":"smartphone","capture.retryUpright.untilEnd":"smartphone","capture.retryRecording.cameraOn":"camera","capture.retryRecording.stay":"smartphone","capture.retryRecording.network":"smartphone","capture.retryDevice.screenRecording":"smartphone","capture.retryDevice.phone":"smartphone"};function ne({start:e,context:r,tips:a,tipsTitle:n,human:c=!1,returning:m=!1,notice:d,retry:u}){let f=S(),{t:o}=f,g=u===void 0?"face":v(u.reason),h=g==="face"?null:_[g].tips,A=H(C)?.busy===!0;return s("section",{className:"sekyro-step",children:[t(O,{}),r.captureMode==="assisted"?t(y,{title:o("capture.assisted.heading"),lead:o("capture.assisted.lead")}):m?t(y,{title:o("returning.heading"),lead:o("returning.description")}):t(y,{title:o(c?"native.face.humanIntroTitle":"native.face.introTitle"),lead:o(c?"native.face.humanIntroLead":"native.face.introLead")}),u!==void 0?t(T,{retry:u,title:_[g].title}):null,n!==void 0&&h===null?t("p",{className:"sekyro-section-label",children:n}):null,t("ul",{className:"sekyro-tiprows",children:h!==null?h.map(l=>s("li",{children:[t(p,{name:F[l]??"face"}),o(l)]},l)):a!==void 0?a.map(l=>s("li",{children:[t(p,{name:B[l.id]??"face"}),l.text]},l.id)):s(M,{children:[s("li",{children:[t(p,{name:"light"}),o("capture.tips.light")]}),s("li",{children:[t(p,{name:"jGlasses"}),o("capture.tips.uncover")]}),s("li",{children:[t(p,{name:"smartphone"}),o("capture.tips.eyeLevel")]})]})}),d??null,d!==void 0?null:r.assets==="failed"?t(k,{kind:"secondary",full:!0,onClick:r.retryAssets,children:o("common.retry")}):null,d!==void 0?null:t(N,{children:s(k,{full:!0,disabled:r.assets!=="ready"||A,"aria-busy":r.assets==="loading"||void 0,onClick:e,children:[t(p,{name:"camera"}),o("capture.start")]})})]})}i(ne,"FaceIntro");var K=new Set(["match_inconclusive","no_face_source","below_threshold"]);function T({retry:e,title:r}){let a=S(),n=e.retakeHint===void 0?null:I(e.retakeHint),c=e.reason==="probe_not_from_liveness"?"capture.retrySamePerson.message":K.has(e.reason)?"capture.retryMatch.message":R(e.reason);return s(b,{tone:"warning",children:[n!==null?t("span",{children:a.t(n)}):c!==null?t("span",{children:a.t(c)}):null,n===null?t("span",{children:a.t(r)}):null,t("span",{children:w(a,e.attemptsRemaining,e.attemptsExhausted)})]})}i(T,"RetryNotice");import{isInAppBrowser as $}from"@sekyro/web/client";function se(e){return $(e)}i(se,"isInAppBrowser");function ce(e,r){let a=r??(typeof navigator>"u"?"":String(navigator.userAgent??""));if(!/Android/i.test(a))return null;let n;try{n=new URL(e)}catch{return null}if(n.protocol!=="https:"&&n.protocol!=="http:")return null;let c=n.protocol.slice(0,-1);return`intent://${n.host}${n.pathname}${n.search}#Intent;scheme=${c};action=android.intent.action.VIEW;S.browser_fallback_url=${encodeURIComponent(e)};end`}i(ce,"androidBrowserIntent");export{U as a,Y as b,q as c,te as d,ne as e,se as f,ce as g};
@@ -1,2 +1,2 @@
1
1
  "use client";
2
- import{a as b}from"./chunk-OXGWLJ5D.js";import{d as I}from"./chunk-5WLMXBCT.js";import{a as _,b as P,d as S,p as x,q as C}from"./chunk-QL2NK7GA.js";import{a as f}from"./chunk-5EPFSWU5.js";import{a as s}from"./chunk-2KED7D2Q.js";import{useRef as E,useState as k}from"react";var N={"portrait.source.title":"كيف تريد إضافة صورتك الشخصية؟","portrait.source.description":"التقط صورة جديدة بالكاميرا، أو ارفع صورة حديثة من هذا الجهاز.","portrait.source.camera":"التقاط صورة","portrait.source.upload":"رفع صورة","portrait.source.uploadInstead":"رفع صورة بدلًا من ذلك","portrait.upload.title":"ارفع صورتك الشخصية","portrait.upload.hint":"صورة حديثة لوجهك، تنظر فيها مباشرة إلى الكاميرا، أمام جدار فاتح وبلون واحد.","portrait.upload.choose":"اختيار صورة","portrait.upload.unsupported":"اختر صورة بصيغة JPEG أو PNG أو HEIC.","portrait.upload.failed":"تعذّر إرسال هذه الصورة. حاول مرة أخرى.","portrait.review.title":"تحقّق من صورتك المعدّلة","portrait.review.description":"عدّلنا صورتك لتطابق قواعد صور الهوية. لم نغيّر وجهك.","portrait.review.original":"صورتك","portrait.review.fixed":"الصورة المعدّلة","portrait.review.fixesTitle":"ما الذي غيّرناه","portrait.review.accept":"استخدام هذه الصورة","portrait.review.retake":"إعادة الالتقاط","portrait.review.uploadAnother":"رفع صورة أخرى","portrait.fixes.crop":"قُصّت","portrait.fixes.scale":"غُيّر حجمها","portrait.fixes.straighten":"عُدّل ميلها","portrait.fixes.background":"استُبدلت الخلفية","portrait.fixes.exposure":"عُدّل السطوع","portrait.fixes.white_balance":"وُزنت الألوان","reasons.portrait_morph_suspected":"لا يمكن استخدام هذه الصورة. التقط صورة جديدة للشخص.","reasons.portrait_reference_mismatch":"لا تطابق الصورة المرجع. التقط صورة جديدة للشخص.","reasons.portrait_declined_fix":"التقط صورة أخرى أو ارفعها."};var g={"portrait.source.title":"How do you want to add your ID photo?","portrait.source.description":"Take a new photo with the camera, or upload a recent photo from this device.","portrait.source.camera":"Take a photo","portrait.source.upload":"Upload a photo","portrait.source.uploadInstead":"Upload a photo instead","portrait.upload.title":"Upload your ID photo","portrait.upload.hint":"A recent photo of your face, looking straight at the camera, in front of a plain, light wall.","portrait.upload.choose":"Choose a photo","portrait.upload.unsupported":"Choose a JPEG, PNG or HEIC photo.","portrait.upload.failed":"We could not send this photo. Try again.","portrait.review.title":"Check your adjusted photo","portrait.review.description":"We adjusted your photo to meet the ID photo rules. Your face was not changed.","portrait.review.original":"Your photo","portrait.review.fixed":"Adjusted photo","portrait.review.fixesTitle":"What we changed","portrait.review.accept":"Use this photo","portrait.review.retake":"Take another","portrait.review.uploadAnother":"Upload another","portrait.fixes.crop":"Cropped","portrait.fixes.scale":"Resized","portrait.fixes.straighten":"Straightened","portrait.fixes.background":"Background replaced","portrait.fixes.exposure":"Brightness adjusted","portrait.fixes.white_balance":"Colours balanced","reasons.portrait_morph_suspected":"This photo cannot be used. Take a new photo of the person.","reasons.portrait_reference_mismatch":"The photo does not match the reference. Take a new photo of the person.","reasons.portrait_declined_fix":"Take or upload another photo."};var T={"portrait.source.title":"Comment voulez-vous ajouter votre photo d'identité ?","portrait.source.description":"Prenez une nouvelle photo avec la caméra, ou importez une photo récente depuis cet appareil.","portrait.source.camera":"Prendre une photo","portrait.source.upload":"Importer une photo","portrait.source.uploadInstead":"Importer une photo à la place","portrait.upload.title":"Importez votre photo d'identité","portrait.upload.hint":"Une photo récente de votre visage, de face, devant un mur clair et uni.","portrait.upload.choose":"Choisir une photo","portrait.upload.unsupported":"Choisissez une photo JPEG, PNG ou HEIC.","portrait.upload.failed":"Nous n'avons pas pu envoyer cette photo. Réessayez.","portrait.review.title":"Vérifiez votre photo ajustée","portrait.review.description":"Nous avons ajusté votre photo pour qu'elle respecte les règles des photos d'identité. Votre visage n'a pas été modifié.","portrait.review.original":"Votre photo","portrait.review.fixed":"Photo ajustée","portrait.review.fixesTitle":"Ce que nous avons modifié","portrait.review.accept":"Utiliser cette photo","portrait.review.retake":"Reprendre","portrait.review.uploadAnother":"Importer une autre","portrait.fixes.crop":"Recadrée","portrait.fixes.scale":"Redimensionnée","portrait.fixes.straighten":"Redressée","portrait.fixes.background":"Fond remplacé","portrait.fixes.exposure":"Luminosité ajustée","portrait.fixes.white_balance":"Couleurs équilibrées","reasons.portrait_morph_suspected":"Cette photo ne peut pas être utilisée. Prenez une nouvelle photo de la personne.","reasons.portrait_reference_mismatch":"La photo ne correspond pas à la référence. Prenez une nouvelle photo de la personne.","reasons.portrait_declined_fix":"Prenez ou importez une autre photo."};import{jsx as t,jsxs as n}from"react/jsx-runtime";var H={en:g,fr:T,ar:N,es:g,pt:g,de:g},V="image/jpeg,image/png,image/heic,image/heif";function v(r){let o=r.strings,i=H[r.locale];return e=>o[e]??i[e]??""}s(v,"portraitCopy");function R({step:r,i18n:o}){if(r.reason===void 0||r.reason==="portrait_fix_review")return null;let i=v(o)(`reasons.${r.reason}`)||o.t("portrait.retryTitle");return n(x,{tone:"warning",children:[t("span",{children:i}),t("span",{children:C(o,r.attemptsRemaining,r.attemptsExhausted)})]})}s(R,"ReasonNotice");function z({step:r,i18n:o,onCamera:i,onUpload:e}){let a=v(o),p=r.photo?.cameraOnPhone===!0;return t(b,{testId:"sekyro-portrait-source",title:a("portrait.source.title"),lead:a("portrait.source.description"),cameraLabel:p?o.t("capture.source.phone"):a("portrait.source.camera"),onPhone:p,uploadLabel:a("portrait.source.upload"),notice:t(R,{step:r,i18n:o}),onCamera:i,onUpload:e})}s(z,"PortraitSourceView");function A({step:r,i18n:o,onCamera:i}){let e=v(o),a=E(null),[p,h]=k("idle"),u=p==="sending",l=r.photo?.uploadOffered===!0,w=s(async c=>{let y=c.currentTarget.files?.[0];if(c.currentTarget.value="",y!==void 0){h("sending");try{await r.uploadPortrait(y),h("idle")}catch(m){h(m instanceof TypeError&&m.message==="unsupported_file"?"unsupported":"failed")}}},"onFile");return n("section",{className:"sekyro-step","data-testid":"sekyro-portrait-upload-screen",children:[t(P,{title:e("portrait.upload.title"),lead:e("portrait.upload.hint")}),p==="idle"||p==="sending"?t(R,{step:r,i18n:o}):null,p==="unsupported"||p==="failed"?t(x,{tone:"warning",children:t("span",{children:e(p==="unsupported"?"portrait.upload.unsupported":"portrait.upload.failed")})}):null,u?t("p",{className:"sekyro-text-muted",role:"status","aria-busy":"true",children:o.t("portrait.uploading")}):null,t("input",{ref:a,type:"file",accept:V,hidden:!0,"data-testid":"sekyro-portrait-upload","aria-label":e("portrait.upload.title"),onChange:c=>{w(c)}}),n(S,{children:[t(f,{full:!0,onClick:()=>a.current?.click(),disabled:u||!l||r.attemptsExhausted,children:e("portrait.upload.choose")}),i!==void 0?n(f,{full:!0,kind:"ghost",onClick:i,disabled:u,children:[t(_,{name:"camera"}),e("portrait.source.camera")]}):null]})]})}s(A,"PortraitUploadView");function j({step:r,i18n:o,onDeclined:i}){let e=v(o),[a,p]=k(!1),[h,u]=k(!1),l=r.pendingFix;if(l==null)return null;let w=s(async d=>{p(!0),u(!1);try{await r.confirmFix(d),d||i?.()}catch{u(!0)}finally{p(!1)}},"answer"),c=r.photo?.source==="upload"?e("portrait.review.uploadAnother"):e("portrait.review.retake"),y=s(d=>e(`portrait.fixes.${d}`)||d,"fixName"),m=e("portrait.review.original"),U=e("portrait.review.fixed");return n("section",{className:"sekyro-step","data-testid":"sekyro-portrait-review",children:[t(P,{title:e("portrait.review.title"),lead:e("portrait.review.description")}),n("div",{className:"sekyro-portrait-pair",children:[n("figure",{className:"sekyro-portrait-pair__item",children:[t("img",{src:l.originalUrl,alt:m}),t("figcaption",{className:"sekyro-text-muted",children:m})]}),n("figure",{className:"sekyro-portrait-pair__item",children:[t("img",{src:l.fixedUrl,alt:U}),t("figcaption",{className:"sekyro-text-muted",children:U})]})]}),l.fixes.length>0?n("div",{className:"sekyro-stack sekyro-stack--1",children:[t("p",{className:"sekyro-text-body",children:e("portrait.review.fixesTitle")}),t("ul",{className:"sekyro-portrait-fixes","data-testid":"sekyro-portrait-fixes",children:l.fixes.map(d=>t("li",{children:y(d)},d))})]}):null,h?t(x,{tone:"danger",children:t("span",{children:o.t("errors.network_error")})}):null,n(S,{children:[t(f,{full:!0,onClick:()=>{w(!0)},disabled:a,"data-testid":"sekyro-portrait-accept",children:e("portrait.review.accept")}),t(f,{full:!0,kind:"ghost",onClick:()=>{w(!1)},disabled:a,"data-testid":"sekyro-portrait-decline",children:c})]})]})}s(j,"PortraitReviewView");function Q({screen:r,step:o,i18n:i,onCamera:e,onUpload:a,onDeclined:p}){return r==="phone"?t(I,{i18n:i,lead:i.t("handoff.lead.portrait"),refresh:o.refresh,actions:t(f,{kind:"ghost",full:!0,onClick:a,children:v(i)("portrait.source.upload")})}):r==="review"?t(j,{step:o,i18n:i,onDeclined:p}):r==="upload"?t(A,{step:o,i18n:i,...e!==void 0?{onCamera:e}:{}}):t(z,{step:o,i18n:i,onCamera:e??a,onUpload:a})}s(Q,"PortraitScreens");export{v as a,z as b,A as c,j as d,Q as e};
2
+ import{a as b}from"./chunk-RGI6OVB2.js";import{d as I}from"./chunk-QD66CL7R.js";import{a as _,b as P,d as S,p as x,q as C}from"./chunk-Q5BGUJMS.js";import{a as f}from"./chunk-WC4U54LZ.js";import{a as s}from"./chunk-2KED7D2Q.js";import{useRef as E,useState as k}from"react";var N={"portrait.source.title":"كيف تريد إضافة صورتك الشخصية؟","portrait.source.description":"التقط صورة جديدة بالكاميرا، أو ارفع صورة حديثة من هذا الجهاز.","portrait.source.camera":"التقاط صورة","portrait.source.upload":"رفع صورة","portrait.source.uploadInstead":"رفع صورة بدلًا من ذلك","portrait.upload.title":"ارفع صورتك الشخصية","portrait.upload.hint":"صورة حديثة لوجهك، تنظر فيها مباشرة إلى الكاميرا، أمام جدار فاتح وبلون واحد.","portrait.upload.choose":"اختيار صورة","portrait.upload.unsupported":"اختر صورة بصيغة JPEG أو PNG أو HEIC.","portrait.upload.failed":"تعذّر إرسال هذه الصورة. حاول مرة أخرى.","portrait.review.title":"تحقّق من صورتك المعدّلة","portrait.review.description":"عدّلنا صورتك لتطابق قواعد صور الهوية. لم نغيّر وجهك.","portrait.review.original":"صورتك","portrait.review.fixed":"الصورة المعدّلة","portrait.review.fixesTitle":"ما الذي غيّرناه","portrait.review.accept":"استخدام هذه الصورة","portrait.review.retake":"إعادة الالتقاط","portrait.review.uploadAnother":"رفع صورة أخرى","portrait.fixes.crop":"قُصّت","portrait.fixes.scale":"غُيّر حجمها","portrait.fixes.straighten":"عُدّل ميلها","portrait.fixes.background":"استُبدلت الخلفية","portrait.fixes.exposure":"عُدّل السطوع","portrait.fixes.white_balance":"وُزنت الألوان","reasons.portrait_morph_suspected":"لا يمكن استخدام هذه الصورة. التقط صورة جديدة للشخص.","reasons.portrait_reference_mismatch":"لا تطابق الصورة المرجع. التقط صورة جديدة للشخص.","reasons.portrait_declined_fix":"التقط صورة أخرى أو ارفعها."};var g={"portrait.source.title":"How do you want to add your ID photo?","portrait.source.description":"Take a new photo with the camera, or upload a recent photo from this device.","portrait.source.camera":"Take a photo","portrait.source.upload":"Upload a photo","portrait.source.uploadInstead":"Upload a photo instead","portrait.upload.title":"Upload your ID photo","portrait.upload.hint":"A recent photo of your face, looking straight at the camera, in front of a plain, light wall.","portrait.upload.choose":"Choose a photo","portrait.upload.unsupported":"Choose a JPEG, PNG or HEIC photo.","portrait.upload.failed":"We could not send this photo. Try again.","portrait.review.title":"Check your adjusted photo","portrait.review.description":"We adjusted your photo to meet the ID photo rules. Your face was not changed.","portrait.review.original":"Your photo","portrait.review.fixed":"Adjusted photo","portrait.review.fixesTitle":"What we changed","portrait.review.accept":"Use this photo","portrait.review.retake":"Take another","portrait.review.uploadAnother":"Upload another","portrait.fixes.crop":"Cropped","portrait.fixes.scale":"Resized","portrait.fixes.straighten":"Straightened","portrait.fixes.background":"Background replaced","portrait.fixes.exposure":"Brightness adjusted","portrait.fixes.white_balance":"Colours balanced","reasons.portrait_morph_suspected":"This photo cannot be used. Take a new photo of the person.","reasons.portrait_reference_mismatch":"The photo does not match the reference. Take a new photo of the person.","reasons.portrait_declined_fix":"Take or upload another photo."};var T={"portrait.source.title":"Comment voulez-vous ajouter votre photo d'identité ?","portrait.source.description":"Prenez une nouvelle photo avec la caméra, ou importez une photo récente depuis cet appareil.","portrait.source.camera":"Prendre une photo","portrait.source.upload":"Importer une photo","portrait.source.uploadInstead":"Importer une photo à la place","portrait.upload.title":"Importez votre photo d'identité","portrait.upload.hint":"Une photo récente de votre visage, de face, devant un mur clair et uni.","portrait.upload.choose":"Choisir une photo","portrait.upload.unsupported":"Choisissez une photo JPEG, PNG ou HEIC.","portrait.upload.failed":"Nous n'avons pas pu envoyer cette photo. Réessayez.","portrait.review.title":"Vérifiez votre photo ajustée","portrait.review.description":"Nous avons ajusté votre photo pour qu'elle respecte les règles des photos d'identité. Votre visage n'a pas été modifié.","portrait.review.original":"Votre photo","portrait.review.fixed":"Photo ajustée","portrait.review.fixesTitle":"Ce que nous avons modifié","portrait.review.accept":"Utiliser cette photo","portrait.review.retake":"Reprendre","portrait.review.uploadAnother":"Importer une autre","portrait.fixes.crop":"Recadrée","portrait.fixes.scale":"Redimensionnée","portrait.fixes.straighten":"Redressée","portrait.fixes.background":"Fond remplacé","portrait.fixes.exposure":"Luminosité ajustée","portrait.fixes.white_balance":"Couleurs équilibrées","reasons.portrait_morph_suspected":"Cette photo ne peut pas être utilisée. Prenez une nouvelle photo de la personne.","reasons.portrait_reference_mismatch":"La photo ne correspond pas à la référence. Prenez une nouvelle photo de la personne.","reasons.portrait_declined_fix":"Prenez ou importez une autre photo."};import{jsx as t,jsxs as n}from"react/jsx-runtime";var H={en:g,fr:T,ar:N,es:g,pt:g,de:g},V="image/jpeg,image/png,image/heic,image/heif";function v(r){let o=r.strings,i=H[r.locale];return e=>o[e]??i[e]??""}s(v,"portraitCopy");function R({step:r,i18n:o}){if(r.reason===void 0||r.reason==="portrait_fix_review")return null;let i=v(o)(`reasons.${r.reason}`)||o.t("portrait.retryTitle");return n(x,{tone:"warning",children:[t("span",{children:i}),t("span",{children:C(o,r.attemptsRemaining,r.attemptsExhausted)})]})}s(R,"ReasonNotice");function z({step:r,i18n:o,onCamera:i,onUpload:e}){let a=v(o),p=r.photo?.cameraOnPhone===!0;return t(b,{testId:"sekyro-portrait-source",title:a("portrait.source.title"),lead:a("portrait.source.description"),cameraLabel:p?o.t("capture.source.phone"):a("portrait.source.camera"),onPhone:p,uploadLabel:a("portrait.source.upload"),notice:t(R,{step:r,i18n:o}),onCamera:i,onUpload:e})}s(z,"PortraitSourceView");function A({step:r,i18n:o,onCamera:i}){let e=v(o),a=E(null),[p,h]=k("idle"),u=p==="sending",l=r.photo?.uploadOffered===!0,w=s(async c=>{let y=c.currentTarget.files?.[0];if(c.currentTarget.value="",y!==void 0){h("sending");try{await r.uploadPortrait(y),h("idle")}catch(m){h(m instanceof TypeError&&m.message==="unsupported_file"?"unsupported":"failed")}}},"onFile");return n("section",{className:"sekyro-step","data-testid":"sekyro-portrait-upload-screen",children:[t(P,{title:e("portrait.upload.title"),lead:e("portrait.upload.hint")}),p==="idle"||p==="sending"?t(R,{step:r,i18n:o}):null,p==="unsupported"||p==="failed"?t(x,{tone:"warning",children:t("span",{children:e(p==="unsupported"?"portrait.upload.unsupported":"portrait.upload.failed")})}):null,u?t("p",{className:"sekyro-text-muted",role:"status","aria-busy":"true",children:o.t("portrait.uploading")}):null,t("input",{ref:a,type:"file",accept:V,hidden:!0,"data-testid":"sekyro-portrait-upload","aria-label":e("portrait.upload.title"),onChange:c=>{w(c)}}),n(S,{children:[t(f,{full:!0,onClick:()=>a.current?.click(),disabled:u||!l||r.attemptsExhausted,children:e("portrait.upload.choose")}),i!==void 0?n(f,{full:!0,kind:"ghost",onClick:i,disabled:u,children:[t(_,{name:"camera"}),e("portrait.source.camera")]}):null]})]})}s(A,"PortraitUploadView");function j({step:r,i18n:o,onDeclined:i}){let e=v(o),[a,p]=k(!1),[h,u]=k(!1),l=r.pendingFix;if(l==null)return null;let w=s(async d=>{p(!0),u(!1);try{await r.confirmFix(d),d||i?.()}catch{u(!0)}finally{p(!1)}},"answer"),c=r.photo?.source==="upload"?e("portrait.review.uploadAnother"):e("portrait.review.retake"),y=s(d=>e(`portrait.fixes.${d}`)||d,"fixName"),m=e("portrait.review.original"),U=e("portrait.review.fixed");return n("section",{className:"sekyro-step","data-testid":"sekyro-portrait-review",children:[t(P,{title:e("portrait.review.title"),lead:e("portrait.review.description")}),n("div",{className:"sekyro-portrait-pair",children:[n("figure",{className:"sekyro-portrait-pair__item",children:[t("img",{src:l.originalUrl,alt:m}),t("figcaption",{className:"sekyro-text-muted",children:m})]}),n("figure",{className:"sekyro-portrait-pair__item",children:[t("img",{src:l.fixedUrl,alt:U}),t("figcaption",{className:"sekyro-text-muted",children:U})]})]}),l.fixes.length>0?n("div",{className:"sekyro-stack sekyro-stack--1",children:[t("p",{className:"sekyro-text-body",children:e("portrait.review.fixesTitle")}),t("ul",{className:"sekyro-portrait-fixes","data-testid":"sekyro-portrait-fixes",children:l.fixes.map(d=>t("li",{children:y(d)},d))})]}):null,h?t(x,{tone:"danger",children:t("span",{children:o.t("errors.network_error")})}):null,n(S,{children:[t(f,{full:!0,onClick:()=>{w(!0)},disabled:a,"data-testid":"sekyro-portrait-accept",children:e("portrait.review.accept")}),t(f,{full:!0,kind:"ghost",onClick:()=>{w(!1)},disabled:a,"data-testid":"sekyro-portrait-decline",children:c})]})]})}s(j,"PortraitReviewView");function Q({screen:r,step:o,i18n:i,onCamera:e,onUpload:a,onDeclined:p}){return r==="phone"?t(I,{i18n:i,lead:i.t("handoff.lead.portrait"),refresh:o.refresh,actions:t(f,{kind:"ghost",full:!0,onClick:a,children:v(i)("portrait.source.upload")})}):r==="review"?t(j,{step:o,i18n:i,onDeclined:p}):r==="upload"?t(A,{step:o,i18n:i,...e!==void 0?{onCamera:e}:{}}):t(z,{step:o,i18n:i,onCamera:e??a,onUpload:a})}s(Q,"PortraitScreens");export{v as a,z as b,A as c,j as d,Q as e};