@sekyro/elements 0.1.0-rc.20 → 0.1.0-rc.21

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 (91) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/dist/cdn/chunks/{capture-session-doc-HIN3YZG2-ZOYOVMIF.js → capture-session-doc-HZJLTWTY-XAP4ZT6R.js} +1 -1
  3. package/dist/cdn/chunks/{chunk-32CNXSJQ.js → chunk-4QUL7TEF.js} +1 -1
  4. package/dist/cdn/chunks/{chunk-PZVVXMQ6.js → chunk-67YJZR73.js} +1 -1
  5. package/dist/cdn/chunks/chunk-AUH3O7Y7.js +1 -0
  6. package/dist/cdn/chunks/{chunk-HPTNANWX.js → chunk-B2KJUHRZ.js} +1 -1
  7. package/dist/cdn/chunks/{chunk-BMTTAXWY.js → chunk-CUFOLAZN.js} +1 -1
  8. package/dist/cdn/chunks/chunk-HHII35OF.js +1 -0
  9. package/dist/cdn/chunks/{chunk-RH466MDF.js → chunk-IBCFJKIO.js} +2 -2
  10. package/dist/cdn/chunks/{chunk-LHYSCL4T.js → chunk-KPGPSJ64.js} +1 -1
  11. package/dist/cdn/chunks/chunk-LSBUNQZU.js +1 -0
  12. package/dist/cdn/chunks/{chunk-FQHV53QQ.js → chunk-MLNUIPVU.js} +1 -1
  13. package/dist/cdn/chunks/chunk-NU2VUYVN.js +1 -0
  14. package/dist/cdn/chunks/{chunk-BO327WCQ.js → chunk-NUIGLBFF.js} +1 -1
  15. package/dist/cdn/chunks/{chunk-L7I27OCG.js → chunk-POVLMWGM.js} +1 -1
  16. package/dist/cdn/chunks/{chunk-BWOTZKA7.js → chunk-QAZ7TATZ.js} +1 -1
  17. package/dist/cdn/chunks/{chunk-K67DQTFL.js → chunk-QE347ZEI.js} +1 -1
  18. package/dist/cdn/chunks/{chunk-2GVFM77I.js → chunk-QESNTWNP.js} +3 -3
  19. package/dist/cdn/chunks/{chunk-CYEDFGUG.js → chunk-QFCNXANK.js} +1 -1
  20. package/dist/cdn/chunks/chunk-VJKFYIPK.js +1 -0
  21. package/dist/cdn/chunks/{chunk-U7QPOSFH.js → chunk-WICQIC37.js} +1 -1
  22. package/dist/cdn/chunks/{chunk-X6LDVTUQ.js → chunk-YI34K4SS.js} +1 -1
  23. package/dist/cdn/chunks/{chunk-677IJRH3.js → chunk-YRZXUDPO.js} +1 -1
  24. package/dist/cdn/chunks/{chunk-ZJNLNYA5.js → chunk-ZPLN3VRG.js} +1 -1
  25. package/dist/cdn/chunks/{chunk-Z6OYPC4S.js → chunk-ZWC7BGLD.js} +1 -1
  26. package/dist/cdn/chunks/create-document-capture-R7KKX6YY-5FG6AKTA.js +1 -0
  27. package/dist/cdn/chunks/document-capture-view-2CSWLQWR-E6PKDMWJ.js +1 -0
  28. package/dist/cdn/chunks/{eid-view-GAIQODI5-AH3LJYP4.js → eid-view-FEJHQBSB-BA27H43Q.js} +1 -1
  29. package/dist/cdn/chunks/{email-otp-view-SM2POPMA-XEEHDST5.js → email-otp-view-4EY5CKR5-LVNJQLG6.js} +1 -1
  30. package/dist/cdn/chunks/{flow-views-NBUWHG7J-HB57IJYX.js → flow-views-Q4Z2BS6Z-MZ4EFAQ6.js} +1 -1
  31. package/dist/cdn/chunks/{form-view-GOFXOQJO-6K34NRBN.js → form-view-GPITA6X5-LAPFWBZM.js} +1 -1
  32. package/dist/cdn/chunks/mrz-band-A6NIHZV3-GJO4UMKB.js +1 -0
  33. package/dist/cdn/chunks/overlay-de-7NCDPEIN-KI2BS6I6.js +1 -0
  34. package/dist/cdn/chunks/overlay-es-6MGCPCFO-CYCUQRCB.js +1 -0
  35. package/dist/cdn/chunks/overlay-pt-VTK6XJDH-VFNANCPU.js +1 -0
  36. package/dist/cdn/chunks/plan-runner-HOMYGD6Y-GMUP34K3.js +1 -0
  37. package/dist/cdn/chunks/{portrait-capture-view-TTUVVA7L-ENQSXXXH.js → portrait-capture-view-5YLRWE4H-EGV5GCSU.js} +1 -1
  38. package/dist/cdn/chunks/{portrait-review-view-BCIENGKR-SHYX5FRE.js → portrait-review-view-ZAJ5TIXP-W6UQWTWP.js} +1 -1
  39. package/dist/cdn/chunks/{proof-of-address-view-SS2TIV3D-GFY3THLT.js → proof-of-address-view-VH573XDT-JJCHDOH4.js} +1 -1
  40. package/dist/cdn/define.js +1 -1
  41. package/dist/cdn/index.js +1 -1
  42. package/dist/{chunk-2TOYHI7F.js → chunk-3CAVDRYH.js} +1 -1
  43. package/dist/{chunk-7FYJ4XL4.js → chunk-3J5LUPKY.js} +1 -1
  44. package/dist/{chunk-HRJ5PESP.js → chunk-5KU4GIMW.js} +1 -1
  45. package/dist/{chunk-3T7JA7T7.js → chunk-APMABLNO.js} +1 -1
  46. package/dist/{chunk-YUZW7NSK.js → chunk-AVSVM522.js} +1 -1
  47. package/dist/{chunk-2ZWLZDO2.js → chunk-BGEGDQXU.js} +1 -1
  48. package/dist/{chunk-V4USJ5ZA.js → chunk-L2F6LQ7G.js} +1 -1
  49. package/dist/{chunk-GXENE4GQ.js → chunk-NHOIIIGP.js} +1 -1
  50. package/dist/{chunk-3NYC5YLB.js → chunk-OAQM45LZ.js} +1 -1
  51. package/dist/{chunk-AUISCZAL.js → chunk-PEFS2JPA.js} +1 -1
  52. package/dist/chunk-QNR2GBZ5.js +1 -0
  53. package/dist/{chunk-IYLMNTY5.js → chunk-TKRB6RXI.js} +3 -3
  54. package/dist/{chunk-47ELGOCA.js → chunk-XZZPJ2FQ.js} +1 -1
  55. package/dist/{chunk-UJM3T4QD.js → chunk-ZBTWLEPS.js} +1 -1
  56. package/dist/define.cjs +5 -5
  57. package/dist/define.js +1 -1
  58. package/dist/document-capture-view-2CSWLQWR-TB6SX3MZ.js +1 -0
  59. package/dist/{eid-view-GAIQODI5-KCEO3AZS.js → eid-view-FEJHQBSB-NDFXLUCN.js} +1 -1
  60. package/dist/{email-otp-view-SM2POPMA-O7WM3ZEZ.js → email-otp-view-4EY5CKR5-PXH6WYZN.js} +1 -1
  61. package/dist/{flow-views-NBUWHG7J-PO2CMTIF.js → flow-views-Q4Z2BS6Z-ZSPSSABE.js} +1 -1
  62. package/dist/{form-view-GOFXOQJO-CRQWOLQA.js → form-view-GPITA6X5-VZF6Y2HM.js} +1 -1
  63. package/dist/index.cjs +5 -5
  64. package/dist/index.d.cts +2 -0
  65. package/dist/index.d.ts +2 -0
  66. package/dist/index.js +1 -1
  67. package/dist/overlay-de-7NCDPEIN-BWTDIED4.js +1 -0
  68. package/dist/overlay-es-6MGCPCFO-SV56NQSV.js +1 -0
  69. package/dist/overlay-pt-VTK6XJDH-IWQLAZ7L.js +1 -0
  70. package/dist/{portrait-capture-view-TTUVVA7L-6BGZEV6C.js → portrait-capture-view-5YLRWE4H-4FZAEZS2.js} +1 -1
  71. package/dist/{portrait-review-view-BCIENGKR-WZ7GCBEX.js → portrait-review-view-ZAJ5TIXP-JKR2R7RK.js} +1 -1
  72. package/dist/{proof-of-address-view-SS2TIV3D-C6YD4BRC.js → proof-of-address-view-VH573XDT-UKGWSGG3.js} +1 -1
  73. package/package.json +2 -2
  74. package/sbom.cdx.json +4 -4
  75. package/dist/cdn/chunks/chunk-FZP5NLDQ.js +0 -1
  76. package/dist/cdn/chunks/chunk-HOBGJOBT.js +0 -1
  77. package/dist/cdn/chunks/chunk-L22GFJQV.js +0 -1
  78. package/dist/cdn/chunks/chunk-MINBJAVX.js +0 -1
  79. package/dist/cdn/chunks/chunk-MXMEO2IW.js +0 -1
  80. package/dist/cdn/chunks/create-document-capture-Z3UK34XH-J7HHUVQU.js +0 -1
  81. package/dist/cdn/chunks/document-capture-view-NI4452T4-UL6ELWE6.js +0 -1
  82. package/dist/cdn/chunks/mrz-band-VYHOTDHY-VEZ2J5IL.js +0 -1
  83. package/dist/cdn/chunks/overlay-de-YLCWZB42-REI3GVKV.js +0 -1
  84. package/dist/cdn/chunks/overlay-es-YIPBOMXT-5DHSESGX.js +0 -1
  85. package/dist/cdn/chunks/overlay-pt-JSDCAYVA-MQHVGOHK.js +0 -1
  86. package/dist/cdn/chunks/plan-runner-JSLWPJ6D-7PE72QOP.js +0 -1
  87. package/dist/chunk-TBECC5OK.js +0 -1
  88. package/dist/document-capture-view-NI4452T4-VZHREVJN.js +0 -1
  89. package/dist/overlay-de-YLCWZB42-XINMWIXZ.js +0 -1
  90. package/dist/overlay-es-YIPBOMXT-MS7EN5ZX.js +0 -1
  91. package/dist/overlay-pt-JSDCAYVA-27WQ3BLB.js +0 -1
@@ -1 +1 @@
1
- import{a as d}from"./chunk-BMTTAXWY.js";import{a as t}from"./chunk-5QL6W6FW.js";import{a as i,c as r}from"./chunk-4FHWXBOB.js";var s=r(d(),1);var u=(0,s.createContext)(null);function c(a,n,o){let e=n.detail;return{check:a,kind:n.kind,...e?.name!==void 0?{name:e.name}:{},...e?.phase!==void 0?{phase:e.phase}:{},...e?.engineKind!==void 0?{engineKind:e.engineKind}:{},attempt:Math.max(0,Math.min(1e3,o))}}i(c,"a");t(c,"captureIssueOf");function m(a,n){if(a!==void 0)try{a(n)}catch{}}i(m,"o");t(m,"sendCaptureIssue");export{u as a,c as b,m as c};
1
+ import{a as d}from"./chunk-CUFOLAZN.js";import{a as t}from"./chunk-5QL6W6FW.js";import{a as i,c as r}from"./chunk-4FHWXBOB.js";var s=r(d(),1);var u=(0,s.createContext)(null);function c(a,n,o){let e=n.detail;return{check:a,kind:n.kind,...e?.name!==void 0?{name:e.name}:{},...e?.phase!==void 0?{phase:e.phase}:{},...e?.engineKind!==void 0?{engineKind:e.engineKind}:{},attempt:Math.max(0,Math.min(1e3,o))}}i(c,"a");t(c,"captureIssueOf");function m(a,n){if(a!==void 0)try{a(n)}catch{}}i(m,"o");t(m,"sendCaptureIssue");export{u as a,c as b,m as c};
@@ -0,0 +1 @@
1
+ import{a as I,b as vt,c as xt,d as B,e as St}from"./chunk-IWZRAEUN.js";import{c as ct,d as ut,e as dt,i as mt,j as gt,k as ft,l as pt,m as yt,p as wt,s as Mt}from"./chunk-LSBUNQZU.js";import{b as kt,c as bt}from"./chunk-F4Q2Q4OC.js";import{b as N}from"./chunk-HHII35OF.js";import{d as et,e as ot,f as nt}from"./chunk-WICQIC37.js";import{a as G,b as q,c as D,d as lt}from"./chunk-P7K7ELYZ.js";import{g as it,i as st,j as at,k as ht,l as rt}from"./chunk-JS2IXPNL.js";import{a as l}from"./chunk-4FHWXBOB.js";var P=Object.freeze({sensing:{key:"sensing",reticle:"searching",minDurationMs:900},too_far:{key:"too_far",reticle:"coaching",minDurationMs:1400},too_close:{key:"too_close",reticle:"coaching",minDurationMs:1400},edge_clipped:{key:"edge_clipped",reticle:"coaching",minDurationMs:1400},wrong_shape:{key:"wrong_shape",reticle:"coaching",minDurationMs:1400},tilted:{key:"tilted",reticle:"coaching",minDurationMs:1400},too_dark:{key:"too_dark",reticle:"coaching",minDurationMs:1400},too_bright:{key:"too_bright",reticle:"coaching",minDurationMs:1400},blurry:{key:"blurry",reticle:"coaching",minDurationMs:1400},focus_far:{key:"focus_far",reticle:"coaching",minDurationMs:1600},glare:{key:"glare",reticle:"coaching",minDurationMs:1400},hold_still:{key:"hold_still",reticle:"locking",minDurationMs:900},processing:{key:"processing",reticle:"processing",minDurationMs:800},side_captured:{key:"side_captured",reticle:"flip",minDurationMs:2600},captured:{key:"captured",reticle:"done",minDurationMs:800}});function Xt(i){return i.framing==="no_document"?"sensing":i.framing==="too_far"?"too_far":i.framing==="too_close"?"too_close":i.framing==="edge_clipped"?"edge_clipped":i.framing==="wrong_shape"?"wrong_shape":i.framing==="tilted"?"tilted":i.lighting==="too_dark"?"too_dark":i.lighting==="too_bright"?"too_bright":i.glare==="glare"?"glare":i.blur==="blurry"?"blurry":"hold_still"}l(Xt,"Ct");var _,Vt=(_=class{constructor(t=2600,e=.35){this.windowMs=t,this.decayPerSecond=e,this.votes=[],this.current=P.sensing,this.currentSinceMs=null}reset(){this.votes=[],this.current=P.sensing,this.currentSinceMs=null}force(t,e){return this.votes=[],this.current=P[t],this.currentSinceMs=e,this.current}tick(t,e){if(this.currentSinceMs===null&&(this.currentSinceMs=e),this.votes.push({key:t,atMs:e}),this.votes=this.votes.filter(r=>e-r.atMs<=this.windowMs),e-this.currentSinceMs<this.current.minDurationMs)return this.current;let s=new Map;for(let r of this.votes){let o=(e-r.atMs)/1e3,n=this.decayPerSecond**o;s.set(r.key,(s.get(r.key)??0)+n)}let a=this.current.key,h=-1;for(let[r,o]of s)o>h&&(h=o,a=r);return a!==this.current.key&&(this.current=P[a],this.currentSinceMs=e),this.current}},l(_,"P"),_),Yt=Object.freeze({MAX_AREA_FRAC:.92,TILT_MAX_SIDE_RATIO:1.3,GLARE_MAX_SPECULAR_FRAC:.025});function Zt(i){let{data:t,width:e,height:s}=i,a=e*s;if(a===0)return 0;let h=0;for(let r=0;r<a;r++){let o=r*4;.299*(t[o]??0)+.587*(t[o+1]??0)+.114*(t[o+2]??0)>=252&&h++}return h/a}l(Zt,"Rt");function Jt(i){let t=l((n,u)=>Math.hypot(u.x-n.x,u.y-n.y),"t"),e=t(i.topLeft,i.topRight),s=t(i.bottomLeft,i.bottomRight),a=t(i.topLeft,i.bottomLeft),h=t(i.topRight,i.bottomRight),r=Math.max(e,s)/Math.max(1e-6,Math.min(e,s)),o=Math.max(a,h)/Math.max(1e-6,Math.min(a,h));return Math.max(r,o)}l(Jt,"he");function $t(i){let t={...vt,...i.thresholds},e=Yt,{quad:s,frameWidth:a,frameHeight:h,measures:r}=i,o=i.format==="ID-3",n="ok";if(s===null)n="no_document";else if(o){let d=B(s),m=a>0?d.width/a:0,y=d.height>0?d.width/d.height:0;m<t.ID3_BAND_MIN_WIDTH_FRAC?n="too_far":Rt(s,a,h,t.EDGE_CLIP_MARGIN_PX)?n="edge_clipped":(y<t.ID3_BAND_ASPECT_MIN||y>t.ID3_BAND_ASPECT_MAX)&&(n="wrong_shape")}else{let d=xt(s,a,h),m=B(s),y=Math.max(m.width,m.height)/Math.max(1e-6,Math.min(m.width,m.height));d<t.MIN_AREA_FRAC?n="too_far":d>e.MAX_AREA_FRAC?n="too_close":Rt(s,a,h,t.EDGE_CLIP_MARGIN_PX)?n="edge_clipped":bt(i.format,y)?Jt(s)>e.TILT_MAX_SIDE_RATIO&&(n="tilted"):n="wrong_shape"}let u=r.exposure>=t.GUIDE_EXPOSURE?"ok":r.meanLuma<(G[0]+G[1])/2?"too_dark":"too_bright",c=r.sharpness>=t.GUIDE_SHARPNESS?"ok":"blurry",g=r.specularFraction>=e.GLARE_MAX_SPECULAR_FRAC?"glare":"ok";return{framing:n,lighting:u,blur:c,glare:g,acceptable:n==="ok"&&u==="ok"&&c==="ok"&&g==="ok"}}l($t,"Ft");function Rt(i,t,e,s){return[i.topLeft,i.topRight,i.bottomRight,i.bottomLeft].some(a=>a.x<=s||a.y<=s||a.x>=t-s||a.y>=e-s)}l(Rt,"Tt");var H=Object.freeze({width:1920,height:1080}),te=Object.freeze({width:3840,height:2160}),Ft=4096,ee=2560,ie=640,E=.15,T=Object.freeze({side:.2,above:.9,below:.3});function R(i){let t=[i.topLeft.x,i.topRight.x,i.bottomRight.x,i.bottomLeft.x],e=[i.topLeft.y,i.topRight.y,i.bottomRight.y,i.bottomLeft.y],s=Math.min(...t),a=Math.min(...e);return{x:s,y:a,width:Math.max(...t)-s,height:Math.max(...e)-a}}l(R,"w");function Wt(i,t){let e=Math.max(0,Math.floor(i.x)),s=Math.max(0,Math.floor(i.y)),a=Math.min(t.width,Math.ceil(i.x+i.width)),h=Math.min(t.height,Math.ceil(i.y+i.height));return a-e<16||h-s<16?null:{x:e,y:s,width:a-e,height:h-s}}l(Wt,"Lt");function se(i,t,e){if(i===null||t.width<=0||t.height<=0)return null;let s=R(i);if(s.width<=0||s.height<=0)return null;let a=e==="ID-3"?{x:s.x-s.width*T.side,y:s.y-s.width*T.above,width:s.width*(1+2*T.side),height:s.height+s.width*(T.above+T.below)}:{x:s.x-s.width*E,y:s.y-s.height*E,width:s.width*(1+2*E),height:s.height*(1+2*E)};return Wt(a,t)}l(se,"de");function Gt(i,t,e){let s=Math.max(i,t);return s>0?Math.min(1,e/s):1}l(Gt,"V");function qt(i,t,e,s,a=ee){let h=t.width>0?e.width/t.width:1,r=t.height>0?e.height/t.height:1,o=i===null?null:{topLeft:{x:i.topLeft.x*h,y:i.topLeft.y*r},topRight:{x:i.topRight.x*h,y:i.topRight.y*r},bottomRight:{x:i.bottomRight.x*h,y:i.bottomRight.y*r},bottomLeft:{x:i.bottomLeft.x*h,y:i.bottomLeft.y*r}},n=se(o,e,s)??{x:0,y:0,width:e.width,height:e.height},u=Gt(n.width,n.height,a),c=Math.max(1,Math.round(n.width*u)),g=Math.max(1,Math.round(n.height*u)),d=null;if(o!==null){let m=R(o);d=Wt({x:(m.x-n.x)*u,y:(m.y-n.y)*u,width:m.width*u,height:m.height*u},{width:c,height:g})}return{crop:n,width:c,height:g,docRegion:d}}l(qt,"X");var ae=960,j=[{width:1920,height:1080},{width:2560,height:1440}];function he(i){let t=Number.isFinite(i)&&i>0?Math.min(1,i):.85;return j.find(e=>e.height*t>=ae)??j[j.length-1]}l(he,"pe");function re(i,t,e,s=te,a){if(e==="LOW")return null;let h=a===void 0?null:he(a.fill),r=h!==null&&Math.max(h.width,h.height)>Math.max(s.width,s.height)?h:s,o=i?.width?.max,n=i?.height?.max;if(typeof o!="number"||typeof n!="number"||o<=0||n<=0)return null;let u=Math.max(o,n),c=Math.min(o,n),g=Math.min(u,Math.max(r.width,r.height)),d=Math.min(c,Math.min(r.width,r.height));return g<=Math.max(t.width,t.height)?null:{width:{ideal:g},height:{ideal:d}}}l(re,"Pt");function oe(i){let t={},e=i?.imageWidth,s=i?.imageHeight;if(typeof e?.max=="number"&&e.max>0){let a=typeof s?.max=="number"&&s.max>0?e.max/s.max:1.3333333333333333,h=a>=1?Ft:Ft*a,r=Math.min(e.max,Math.floor(h)),o=typeof e.step=="number"&&e.step>0?e.step:1,n=typeof e.min=="number"?e.min:0;r=Math.max(n,n+Math.floor((r-n)/o)*o),t.imageWidth=r}return i?.fillLightMode?.includes("off")===!0&&(t.fillLightMode="off"),t}l(oe,"Ot");function ne(i,t){if(i.width<=0||i.height<=0||t.width<=0||t.height<=0)return!1;let e=i.width>i.height,s=t.width>t.height;return e!==s&&i.width!==i.height&&t.width!==t.height?!1:Math.max(i.width,i.height)>=1.2*Math.max(t.width,t.height)}l(ne,"It");function le(i,t,e,s){if(e===null)return!1;let a=R(i),h=R(e);if(t.width<=0||s.width<=0)return!1;let r=a.width/t.width,o=h.width/s.width;return o>0&&r>=.6*o&&r<=1.25*o}l(le,"zt");var _t=3500,ce=.92;function Nt(){let i=globalThis.ImageCapture;return typeof i=="function"?i:null}l(Nt,"Bt");function ue(i){return/AppleWebKit\//.test(i)&&!/(Chrome|Chromium|Edg|OPR)\//.test(i)}l(ue,"ge");function de(i,t=typeof navigator>"u"?"":navigator.userAgent){return Nt()!==null&&!ue(t)&&i!=null&&i.kind==="video"&&i.readyState==="live"}l(de,"Nt");function Dt(i,t){return new Promise((e,s)=>{let a=setTimeout(()=>s(new Error("takePhoto timed out")),t);i.then(h=>{clearTimeout(a),e(h)},h=>{clearTimeout(a),s(h)})})}l(Dt,"Qt");function U(i,t){let e=document.createElement("canvas");return e.width=i,e.height=t,e}l(U,"j");function me(i,t){return new Promise((e,s)=>{i.toBlob(a=>a?e(a):s(new Error("toBlob failed")),"image/jpeg",t)})}l(me,"be");async function Bt(i,t,e,s,a){let h=U(e,s),r=U(1,1);try{let o=h.getContext("2d");if(o===null)throw new Error("2d context unavailable");o.imageSmoothingQuality="high",o.drawImage(i,t.x,t.y,t.width,t.height,0,0,e,s);let n=await me(h,ce),u=a===null?null:ct({topLeft:{x:a.x,y:a.y},topRight:{x:a.x+a.width,y:a.y},bottomRight:{x:a.x+a.width,y:a.y+a.height},bottomLeft:{x:a.x,y:a.y+a.height}},{width:e,height:s},{width:e,height:s}),c=ut(h,u),g=Gt(e,s,ie);return r.width=Math.max(1,Math.round(e*g)),r.height=Math.max(1,Math.round(s*g)),r.getContext("2d")?.drawImage(h,0,0,r.width,r.height),{blob:n,previewDataUrl:r.toDataURL("image/jpeg",.85),sharpness:c}}finally{h.width=0,h.height=0,r.width=0,r.height=0}}l(Bt,"Wt");function ge(i,t){let e=Math.min(1,t/i.width),s=U(Math.max(1,Math.round(i.width*e)),Math.max(1,Math.round(i.height*e)));try{let a=s.getContext("2d",{willReadFrequently:!0});return a===null?null:(a.imageSmoothingQuality="high",a.drawImage(i,0,0,s.width,s.height),a.getImageData(0,0,s.width,s.height))}finally{s.width=0,s.height=0}}l(ge,"ye");async function fe(i,t,e,s){let a={width:Math.max(1,i.videoWidth),height:Math.max(1,i.videoHeight)},h=qt(t,e,a,s);return{...await Bt(i,h.crop,h.width,h.height,h.docRegion),docRegion:h.docRegion,source:"video",width:h.width,height:h.height}}l(fe,"Ut");async function pe(i,t,e,s,a){let h=Nt();if(h===null)return null;let r=null;try{let o=new h(a.track),n=await Dt(o.getPhotoCapabilities?.()??Promise.resolve({}),_t).catch(()=>({})),u=await Dt(o.takePhoto(oe(n)),_t);r=await createImageBitmap(u);let c={width:i.videoWidth,height:i.videoHeight};if(!ne(r,c))return null;let g=ge(r,a.detectWidth),d=null;g!==null&&t!==null&&(d=await a.detect(g).catch(()=>null));let m=g??{width:r.width,height:r.height};d!==null&&!le(d,m,t,e)&&(d=null);let y=qt(d,m,r,s);return{...await Bt(r,y.crop,y.width,y.height,y.docRegion),docRegion:y.docRegion,source:"photo",width:y.width,height:y.height}}catch{return null}finally{r?.close()}}l(pe,"Ht");var Z=Object.freeze({width:3840,height:2160,lensSelection:!0,continuousFocus:!0,refocusBeforePhotoMs:350,zoomMax:2,zoomNoFocusInfo:1.5,zoomMinSourcePx:2160,fillDistanceM:Object.freeze({id1:.11,id3:.15}),focusMarginFrac:.2,stillSharpnessMin:.16,stillRefusalsMax:2,focusFarFillFrac:.45,noDocFarHintMs:1500,zoomFallbackMs:8e3}),M=l((i,t,e)=>typeof i=="number"&&Number.isFinite(i)&&i>=t&&i<=e?i:void 0,"y");function Qe(i){let t=Z,e=i!==null&&typeof i=="object"?i:{},s=e.fillDistanceM!==null&&typeof e.fillDistanceM=="object"?e.fillDistanceM:{},a=l((h,r)=>typeof h=="boolean"?h:r,"o");return{width:M(e.width,640,7680)??t.width,height:M(e.height,480,4320)??t.height,lensSelection:a(e.lensSelection,t.lensSelection),continuousFocus:a(e.continuousFocus,t.continuousFocus),refocusBeforePhotoMs:M(e.refocusBeforePhotoMs,0,2e3)??t.refocusBeforePhotoMs,zoomMax:M(e.zoomMax,1,5)??t.zoomMax,zoomNoFocusInfo:M(e.zoomNoFocusInfo,1,5)??t.zoomNoFocusInfo,zoomMinSourcePx:M(e.zoomMinSourcePx,0,8e3)??t.zoomMinSourcePx,fillDistanceM:{id1:M(s.id1,.03,1)??t.fillDistanceM.id1,id3:M(s.id3,.03,1)??t.fillDistanceM.id3},focusMarginFrac:M(e.focusMarginFrac,0,2)??t.focusMarginFrac,stillSharpnessMin:M(e.stillSharpnessMin,0,10)??t.stillSharpnessMin,stillRefusalsMax:M(e.stillRefusalsMax,0,10)??t.stillRefusalsMax,focusFarFillFrac:M(e.focusFarFillFrac,0,1)??t.focusFarFillFrac,noDocFarHintMs:M(e.noDocFarHintMs,0,6e4)??t.noDocFarHintMs,zoomFallbackMs:M(e.zoomFallbackMs,0,12e4)??t.zoomFallbackMs}}l(Qe,"Xe");var K="sekyro.doc.camera";function ye(){try{let i=globalThis.localStorage?.getItem(K);return typeof i=="string"&&i!==""?i:null}catch{return null}}l(ye,"ke");function Tt(i){try{i===null?globalThis.localStorage?.removeItem(K):globalThis.localStorage?.setItem(K,i)}catch{}}l(Tt,"Kt");var X=l((i,t)=>Array.isArray(i?.focusMode)&&i.focusMode.includes(t),"G");function At(i,t,e){if(!X(i,"single-shot"))return null;let s=l(a=>Math.min(1,Math.max(0,Number.isFinite(a)?a:.5)),"s");return{focusMode:"single-shot",pointsOfInterest:[{x:s(t),y:s(e)}]}}l(At,"J");function we(i,t,e,s=Z){let a=i?.zoom?.min,h=i?.zoom?.max;if(typeof h!="number"||h<=1)return 1;let r=e==="ID-3"?s.fillDistanceM.id3:s.fillDistanceM.id1,o=i?.focusDistance?.min,n;if(typeof o=="number"&&o>0&&o<1){if(n=o*(1+s.focusMarginFrac)/r,n<=1.05)return 1}else{if(Math.min(t.width,t.height)<s.zoomMinSourcePx)return 1;n=s.zoomNoFocusInfo}let u=Math.min(n,s.zoomMax,h);typeof a=="number"&&(u=Math.max(u,a));let c=i?.zoom?.step;return typeof c=="number"&&c>0&&(u=Math.round(u/c)*c),u>1.01?Number(u.toFixed(2)):1}l(we,"Xt");function V(i){try{return i.getVideoTracks?.()[0]}catch{return}}l(V,"Z");function Ct(i){if(i!==null)for(let t of i.getTracks())t.stop()}l(Ct,"Vt");function Me(i){try{let t=V(i)?.getCapabilities?.();return!Array.isArray(t?.focusMode)||t.focusMode.includes("continuous")}catch{return!0}}l(Me,"Me");async function ke(i){let t=l(h=>({audio:!1,video:{...h,width:{ideal:i.base.width},height:{ideal:i.base.height}}}),"t"),e=l(h=>i.getUserMedia(t({deviceId:{exact:h}})),"e"),s=l(()=>i.getUserMedia(t({facingMode:{ideal:"environment"}})),"s");if(i.lensSelection){let h=ye();if(h!==null)try{return{stream:await e(h),lens:"stored"}}catch{Tt(null)}}let a=await s();if(!i.lensSelection||i.enumerateDevices===void 0)return{stream:a,lens:"default"};try{let h=rt(await i.enumerateDevices()).slice(0,3);if(h.length===0)return{stream:a,lens:"default"};let r=null;for(let o of h){let n=a!==null?V(a)?.getSettings?.().deviceId:void 0;if(a===null||n!==o){Ct(a),a=null;try{a=await e(o)}catch{continue}}if(r??(r=o),Me(a))return Tt(o),{stream:a,lens:"selected"}}if(a!==null&&r!==null&&V(a)?.getSettings?.().deviceId===r)return{stream:a,lens:"selected"};if(Ct(a),a=null,r!==null)try{return{stream:await e(r),lens:"selected"}}catch{}return{stream:await s(),lens:"default"}}catch{return{stream:a??await s(),lens:"default"}}}l(ke,"jt");var C=null;async function be(i){return C===null&&(C=(await import("./detector-scanic-P2RTEQUV-A5WTP2Q7.js")).detectQuad),C(i)}l(be,"De");async function ve(i){let t=N(i);return t===null?null:{topLeft:{x:t.x,y:t.y},topRight:{x:t.x+t.width,y:t.y},bottomRight:{x:t.x+t.width,y:t.y+t.height},bottomLeft:{x:t.x,y:t.y+t.height}}}l(ve,"we");function Ue(){C===null&&import("./detector-scanic-P2RTEQUV-A5WTP2Q7.js").then(i=>{C=i.detectQuad}).catch(()=>{})}l(Ue,"fi");var Lt=4e3,xe=2,zt=3,Ot=Object.freeze({LOW:3,MID:5,HIGH:6}),Se=600,Re=8,Fe=3,_e=90,Y=Object.freeze({manualShutterMs:6e3,detectedNoLockMs:1950});function Ke(i){let t=i!==null&&typeof i=="object"?i:{},e=l((s,a,h)=>typeof s=="number"&&Number.isFinite(s)&&s>=a&&s<=h?s:void 0,"e");return{manualShutterMs:e(t.manualShutterMs,1e3,6e4)??Y.manualShutterMs,detectedNoLockMs:e(t.steadyMs,300,3e4)!==void 0?t.steadyMs+(e(t.lockMs,0,1e4)??450):Y.detectedNoLockMs}}l(Ke,"gi");var x,Xe=(x=class{constructor(t){this.upgraded=!1,this.tickCosts=[],this.photoOff=!1,this.demotion=null,this.torchOn=!1,this.stillRefusals=0,this.zoom=1,this.positioningSince=null,this.detectedSince=null,this.lastSeenAt=null,this.lastGuideQuad=null,this.lastGuideCard=null,this.lastStillAt=null,this.probeAt=null,this.lastOcrReady=null,this.shutterOffered=!1,this.stats=x.freshStats(),this.handlers=new Map,this.stream=null,this.timer=null,this.state="idle",this.lastGuidance=null,this.attempt=0,this.capturing=!1,this.feedback=new Vt,this.lastFeedbackKey=null,this.lastQuad=null,this.lastDetect=null,this.frameWatch=null,this.reopened=!1,this.lit=!1,this.blackTicks=0,this.offEnded=null,this.opts=t,this.gate=new St(t.format??"ID-1",t.thresholds);let e=t.deviceClass??nt(ot());this.deviceClass=e,this.camera=t.camera??Z,this.shutterTuning=t.shutter??Y,this.guideTuning=t.guideLock??yt,this.guideLock=new wt(this.guideTuning),this.cadenceMs=1e3/Ot[e]}on(t,e){let s=this.handlers.get(t);return s||(s=new Set,this.handlers.set(t,s)),s.add(e),()=>s?.delete(e)}emit(t,e){for(let s of[...this.handlers.get(t)??[]])s(e)}async start(){let t=this.state==="error"?this.resumePlayback():null,e=++this.attempt;if(this.clearFrameWatch(),this.gate.reset(),this.resetSide(),this.feedback.reset(),this.lastFeedbackKey=null,this.lastGuidance=null,this.capturing=!1,this.lit=!1,this.blackTicks=0,t!==null&&await t&&e===this.attempt){this.setState("positioning"),this.scheduleTick(e),this.watchFrames(e);return}if(e===this.attempt){this.releaseStream(),ht(),this.setState("preflight");try{let s=this.opts.getUserMedia??(r=>navigator.mediaDevices.getUserMedia(r));this.setState("acquiring");let a=this.opts.enumerateDevices??(this.opts.getUserMedia===void 0&&typeof navigator<"u"&&navigator.mediaDevices?.enumerateDevices?()=>navigator.mediaDevices.enumerateDevices():void 0),h=await ke({getUserMedia:s,...a!==void 0?{enumerateDevices:a}:{},lensSelection:this.camera.lensSelection,base:H});if(e!==this.attempt){for(let r of h.stream.getTracks())r.stop();return}if(this.stream=h.stream,et(this.stream),at(this.stream),this.watchEnded(e),this.opts.upgradeResolution!==!1&&await this.upgradeResolution(),e!==this.attempt||(await this.applyFocusAndZoom(),e!==this.attempt)||(this.opts.video.srcObject=this.stream,await this.opts.video.play().catch(()=>{}),e!==this.attempt))return;this.setState("positioning"),this.scheduleTick(e),this.watchFrames(e)}catch(s){if(e!==this.attempt)return;let a=st(s),h=it(s);this.setState("error"),this.emit("error",{kind:a,retryable:!0,detail:h===void 0?{phase:"acquiring"}:{phase:"acquiring",name:h}})}}}resumePlayback(){let t=this.opts.video,e=this.videoTrack();if(this.stream===null||e===null||e.readyState!=="live"||t.srcObject!==this.stream)return null;try{return Promise.resolve(t.play()).then(()=>this.framesNow(),()=>!1)}catch{return null}}framesNow(){let t=this.opts.video;return this.opts.hasFrames!==void 0?this.opts.hasFrames(t):!t.paused&&t.readyState>=2&&t.videoWidth>0}watchFrames(t){let e=this.opts.firstFrameMs??Lt;e<=0||(this.clearFrameWatch(),this.frameWatch=setTimeout(()=>{if(this.frameWatch=null,!(t!==this.attempt||this.state!=="positioning")){if(this.framesNow()&&this.blackTicks<zt){this.reopened=!1;return}this.cameraDead(t)}},e))}clearFrameWatch(){this.frameWatch!==null&&clearTimeout(this.frameWatch),this.frameWatch=null}watchEnded(t){this.offEnded?.(),this.offEnded=null;let e=this.videoTrack();if(e===null||typeof e.addEventListener!="function")return;let s=l(()=>{t===this.attempt&&(this.state==="positioning"||this.state==="acquiring")&&this.cameraDead(t)},"s");e.addEventListener("ended",s),this.offEnded=()=>e.removeEventListener?.("ended",s)}cameraDead(t){if(t!==this.attempt)return;let e=this.videoTrack(),s=e!==null&&e.readyState==="live"&&!e.muted&&this.opts.video.paused&&!this.framesNow();if(!s&&!this.reopened){this.reopened=!0,this.start();return}this.attempt+=1,this.timer!==null&&(this.opts.clearTimer??clearTimeout)(this.timer),this.timer=null,this.clearFrameWatch(),s||this.releaseStream(),this.reopened=!1,this.setState("error"),this.emit("error",{kind:"generic",retryable:!0,detail:{phase:"acquiring"}})}releaseStream(){if(this.offEnded?.(),this.offEnded=null,this.stream)for(let t of this.stream.getTracks())t.stop();this.stream=null,this.opts.video.srcObject!==null&&this.opts.video.srcObject!==void 0&&(this.opts.video.srcObject=null)}rearm(t){t!==void 0&&(this.opts.side=t),this.probeAt=null,this.gate.reset(),this.resetSide(),this.feedback.reset(),this.lastFeedbackKey=null,this.lastGuidance=null,this.capturing=!1,this.stillRefusals=0,this.state==="captured"&&(this.setState("positioning"),this.scheduleTick(this.attempt))}async captureNow(){if(this.state!=="positioning"||this.capturing)return;let t=this.opts.video,e=this.lastDetect?.width??Math.max(1,t.videoWidth),s=this.lastDetect?.height??Math.max(1,t.videoHeight),a=this.lastQuad??this.lastGuideQuad??{topLeft:{x:0,y:0},topRight:{x:e,y:0},bottomRight:{x:e,y:s},bottomLeft:{x:0,y:s}},h=(this.opts.now??(()=>performance.now()))(),r=this.feedback.force("processing",h);this.lastFeedbackKey=r.key,this.emit("feedback",r),await this.fire(this.attempt,this.lastOcrReady!==null?this.lastOcrReady.quad:a,{width:e,height:s,tickSharpness:this.lastDetect?.tickSharpness??0},this.lastOcrReady?.via??"manual")}captureReport(){let t=this.stats;return{...this.opts.side!==void 0?{side:this.opts.side}:{},format:this.opts.format??"ID-1",deviceClass:this.deviceClass,video:{width:this.opts.video.videoWidth||0,height:this.opts.video.videoHeight||0},zoom:this.zoom,...t.zoomFallbackAtMs!==void 0?{zoomFallbackAtMs:t.zoomFallbackAtMs}:{},...t.msToCapture!==void 0?{msToCapture:t.msToCapture}:{},...t.via!==void 0?{via:t.via}:{},...t.shutterAtMs!==void 0?{shutterAtMs:t.shutterAtMs}:{},...t.shutterReason!==void 0?{shutterReason:t.shutterReason}:{},...t.shotGlare!==void 0?{shotGlare:t.shotGlare}:{},...t.shotSharpness!==void 0?{shotSharpness:t.shotSharpness}:{},...t.msSincePrevShot!==void 0?{msSincePrevShot:t.msSincePrevShot}:{},...this.demotion!==null?{demotedFrom:this.demotion.from,demotedBy:this.demotion.by,...this.demotion.tickMedianMs!==void 0?{tickMedianMs:this.demotion.tickMedianMs}:{}}:{},ticks:t.ticks,quadFraming:{...t.quadFraming},qualityBlockers:{...t.qualityBlockers},guideBlockers:{...t.guideBlockers},stillRefusals:t.stillRefusals,...this.ocrReport()}}ocrReport(){let t=this.opts.ocr;if(t===void 0)return{};let e=(this.opts.format??"ID-1")==="ID-3"||this.opts.side==="single"?"single":this.opts.side==="verso"?"verso":"recto",s=t.report(e,this.stats.via,(this.opts.now??(()=>performance.now()))());return s===null?{}:{ocr:s}}static freshStats(){return{ticks:0,quadFraming:{},qualityBlockers:{},guideBlockers:{},stillRefusals:0}}setLockTuning(t){this.guideTuning=t,this.guideLock.setTuning(t)}setGuide(t){t===void 0?delete this.opts.guide:this.opts.guide=t,this.guideLock.reset(),this.probeAt=null}sideProbe(t,e,s,a){if(this.opts.sideProbe!==!0||!e)return;if(this.probeAt===null){this.probeAt=a;return}if(a-this.probeAt<Se)return;this.probeAt=a;let h=this.guideRegion(t),r=h.x*t.width,o=h.y*t.height,n=h.width*t.width,u=h.height*t.height,c={topLeft:{x:r,y:o},topRight:{x:r+n,y:o},bottomRight:{x:r+n,y:o+u},bottomLeft:{x:r,y:o+u}};return dt(N,A(t,c),!0,s)}guideRegion(t){let e=t.width/Math.max(1,t.height),s=this.opts.guide;if(s!==void 0&&s.viewAspect>0){let o={width:s.viewAspect,height:1},n={x:s.rect.x*s.viewAspect,y:s.rect.y,width:s.rect.width*s.viewAspect,height:s.rect.height};return gt(o,n,e,0)}let a=kt(this.opts.format??"ID-1").center,h=.86,r=h*e/a;return r>.84&&(r=.84,h=r*a/e),{x:(1-h)/2,y:(1-r)/2,width:h,height:r}}resetSide(){this.positioningSince=null,this.detectedSince=null,this.lastSeenAt=null,this.guideLock.reset(),this.lastGuideQuad=null,this.lastGuideCard=null,this.lastOcrReady=null,this.opts.ocr?.reset(),this.stats=x.freshStats(),this.shutterOffered&&(this.shutterOffered=!1,this.emit("shutter",{available:!1}))}withdrawShutter(){this.shutterOffered&&(this.shutterOffered=!1,this.emit("shutter",{available:!1}))}zoomFallback(t){let e=this.videoTrack();if(e===null||this.zoom<=1)return;let s=this.focusCaps(),a=typeof s?.zoom?.min=="number"?Math.max(s.zoom.min,1):1;this.zoom=a,this.stats.zoomFallbackAtMs=Math.round(t-(this.positioningSince??t)),this.guideLock.reset(),this.gate.reset(),e.applyConstraints({advanced:[{zoom:a}]}).catch(()=>{})}offerShutter(t,e){this.shutterOffered||(this.shutterOffered=!0,this.stats.shutterAtMs=Math.round(e-(this.positioningSince??e)),this.stats.shutterReason=t,this.emit("shutter",{available:!0,reason:t}))}torchAvailable(){try{return this.stream?.getVideoTracks?.()[0]?.getCapabilities?.()?.torch===!0}catch{return!1}}async setTorch(t){this.torchOn=t;try{await this.stream?.getVideoTracks?.()[0]?.applyConstraints({advanced:[{torch:t}]})}catch{}}destroy(){if(this.attempt+=1,this.timer!==null&&(this.opts.clearTimer??clearTimeout)(this.timer),this.timer=null,this.clearFrameWatch(),this.offEnded?.(),this.offEnded=null,this.stream)for(let t of this.stream.getTracks())t.stop();this.stream=null,this.opts.video.srcObject=null}async upgradeResolution(){try{let t=this.stream?.getVideoTracks?.()[0];if(t===void 0)return;let e=t.getSettings?.()??{},s=re(t.getCapabilities?.(),{width:e.width??0,height:e.height??0},this.deviceClass,{width:this.camera.width,height:this.camera.height},this.opts.ocr?.liveMrzOn===!0?{fill:this.guideRegion({width:1080,height:1920}).width}:void 0);s!==null&&(await t.applyConstraints(s),this.upgraded=!0)}catch{}}demote(t,e){if(this.tickCosts=null,this.deviceClass==="LOW"||(this.demotion={from:this.deviceClass,by:t,...e!==null?{tickMedianMs:Math.round(Math.min(6e4,e))}:{}},this.deviceClass="LOW",this.cadenceMs=1e3/Ot.LOW,!this.upgraded))return;this.upgraded=!1;let s=this.videoTrack();s!==null&&(this.guideLock.reset(),this.gate.reset(),s.applyConstraints({width:{ideal:H.width},height:{ideal:H.height}}).catch(()=>{}))}profileTick(t){if(this.deviceClass!=="LOW"&&this.opts.ocr?.tier==="low"){this.demote("ocr_tier",null);return}let e=this.tickCosts;if(e===null||(e.push(t),e.length<Re))return;let s=[...e].sort((h,r)=>h-r),a=(s[s.length-1>>1]+s[s.length>>1])/2;a>_e?this.demote("tick_cost",a):this.tickCosts=null}focusCaps(){try{return this.videoTrack()?.getCapabilities?.()??null}catch{return null}}async applyFocusAndZoom(){let t=this.videoTrack();if(t===null)return;let e=this.focusCaps();this.camera.continuousFocus&&X(e,"continuous")&&await t.applyConstraints({advanced:[{focusMode:"continuous"}]}).catch(()=>{});let s={width:0,height:0};try{let h=t.getSettings?.()??{};s={width:h.width??0,height:h.height??0}}catch{}let a=we(e,s,this.opts.format??"ID-1",this.camera);if(a>1)try{await t.applyConstraints({advanced:[{zoom:a}]}),this.zoom=a}catch{this.zoom=1}}async focusAt(t,e){let s=this.videoTrack(),a=At(this.focusCaps(),t,e);if(!(s===null||a===null))try{await s.applyConstraints({advanced:[a]}),(this.opts.setTimer??setTimeout)(()=>{this.restoreContinuous()},1500)}catch{}}async restoreContinuous(){let t=this.videoTrack();t===null||!this.camera.continuousFocus||!X(this.focusCaps(),"continuous")||await t.applyConstraints({advanced:[{focusMode:"continuous"}]}).catch(()=>{})}async refocusOn(t,e){let s=this.camera.refocusBeforePhotoMs,a=this.videoTrack();if(s<=0||a===null||e.width<=0||e.height<=0)return;let h=R(t),r=At(this.focusCaps(),(h.x+h.width/2)/e.width,(h.y+h.height/2)/e.height);if(r!==null)try{let o=this.opts.setTimer??setTimeout;await Promise.race([a.applyConstraints({advanced:[r]}),new Promise(n=>{o(()=>n(),Le)})]),await new Promise(n=>{o(()=>n(),s)})}catch{}}videoTrack(){try{return this.stream?.getVideoTracks?.()[0]??null}catch{return null}}async takeStill(t,e,s){if(this.opts.captureStill!==void 0)return this.opts.captureStill(this.opts.video,t,e);let a=this.opts.format??"ID-1",h=this.videoTrack();if(s&&this.opts.photoCapture!==!1&&this.deviceClass!=="LOW"&&!this.photoOff&&!this.torchOn&&h!==null&&de(h)){await this.refocusOn(t,e);let r=await pe(this.opts.video,t,e,a,{track:h,detect:this.detector(),detectWidth:I});if(this.restoreContinuous(),r!==null)return r;this.photoOff=!0}return fe(this.opts.video,t,e,a)}detector(){return this.opts.detect??((this.opts.format??"ID-1")==="ID-3"?ve:be)}setState(t){this.state=t,this.emit("statechange",{state:t})}scheduleTick(t){let e=this.opts.setTimer??setTimeout;this.timer=e(()=>{this.tick(t)},this.cadenceMs)}async tick(t){if(t!==this.attempt||this.state!=="positioning"||this.capturing)return;let e=this.opts.now??(()=>performance.now()),s=this.opts.grabDetectFrame??Et,a=this.detector(),h=this.opts.workClock??(()=>performance.now()),r=h(),o=s(this.opts.video,I);if(o===null){this.scheduleTick(t);return}if(!this.lit){if(q(o)>xe)this.lit=!0,this.blackTicks=0;else if(++this.blackTicks>=zt&&this.frameWatch===null&&(this.opts.firstFrameMs??Lt)>0){this.cameraDead(t);return}}let n=null;try{n=await a(o)}catch{n=null}if(t!==this.attempt)return;let u=n!==null?A(o,n):o,c=e(),g={sharpness:D(u),exposure:lt(u),meanLuma:q(u),specularFraction:Zt(u)},d=$t({format:this.opts.format??"ID-1",quad:n,frameWidth:o.width,frameHeight:o.height,measures:g,...this.opts.thresholds!==void 0?{thresholds:this.opts.thresholds}:{}}),m=this.gate.tick({timestampMs:c,quad:n,quality:g,frameWidth:o.width,frameHeight:o.height}),y=(this.opts.format??"ID-1")!=="ID-3",p=y?ft(o,this.guideRegion(o),{edgePeakFrac:this.guideTuning.edgePeakFrac}):mt,f=this.guideLock.tick(p,c);this.lastGuideQuad=f.detected?pt(p):null,this.lastGuideCard=f.detected?{glare:p.cardGlare,sharpness:p.sharpness}:null;let S=this.sideProbe(o,f.detected,p.fill,c),w=this.capturing?null:this.ocrTick(o,n,p,f.detected,d,c),k=f.detected&&(f.still||f.blocker==="locking")||n!==null&&m.stableTicks>=2;this.lastOcrReady?.via==="live_mrz"&&y&&!k&&(this.lastOcrReady=null),this.positioningSince??(this.positioningSince=c);let b=this.stats;if(b.ticks+=1,b.quadFraming[d.framing]=(b.quadFraming[d.framing]??0)+1,d.framing==="ok"&&!m.ready){let v=d.lighting!=="ok"?d.lighting:d.glare!=="ok"?"glare":d.blur!=="ok"?"blurry":"steadying";b.qualityBlockers[v]=(b.qualityBlockers[v]??0)+1}b.guideBlockers[f.blocker]=(b.guideBlockers[f.blocker]??0)+1,n!==null||f.detected?(this.detectedSince??(this.detectedSince=c),this.lastSeenAt=c):this.detectedSince=null,this.lastSeenAt!==null&&c-this.lastSeenAt<=Ie?c-this.positioningSince>=this.shutterTuning.manualShutterMs?this.offerShutter("timeout",c):w?.suspendQuality!==!0&&this.detectedSince!==null&&c-this.detectedSince>=this.shutterTuning.detectedNoLockMs&&this.offerShutter("detected_no_lock",c):this.withdrawShutter();let J=c-(this.lastSeenAt??this.positioningSince);this.zoom>1&&this.camera.zoomFallbackMs>0&&J>=this.camera.zoomFallbackMs&&this.zoomFallback(c);let $=w?.suspendQuality!==!0&&(m.ready&&n!==null||f.ready&&this.lastGuideQuad!==null)||this.lastOcrReady!==null,Ht=!$&&w?.suspendQuality!==!0&&(f.detected&&f.blocker==="locking"||n!==null&&m.stableTicks>=2);this.emit("checks",{engine:"docv1",p:m.p,plausible:m.plausible,stableTicks:m.stableTicks,quad:m.quad,frameWidth:o.width,frameHeight:o.height,analysis:d,ready:$,locking:Ht,guide:{detected:f.detected,blocker:f.blocker,still:f.still,fill:p.fill,shape:p.shape,content:p.content,offsetX:p.offsetX,offsetY:p.offsetY},...w!==null&&w.mode!=="off"?{ocr:{mode:w.mode,...w.mrz?{mrz:w.mrz}:{},...w.lock?{lock:w.lock}:{}}}:w?.mrz?{ocr:{mode:w.mode,mrz:w.mrz}}:{},...S!==void 0?{side:S}:{}}),this.lastQuad=m.plausible?n:null,this.lastDetect={width:o.width,height:o.height,tickSharpness:g.sharpness};let F=Xt(d);d.framing!=="ok"&&f.detected&&(F=Oe(f.blocker,p.brightness<this.guideTuning.darkBrightness)),F==="blurry"&&n!==null&&Te(n,o,this.opts.format??"ID-1")>=this.camera.focusFarFillFrac&&(F="focus_far"),F==="sensing"&&this.zoom>1&&this.camera.noDocFarHintMs>0&&J>=this.camera.noDocFarHintMs&&(F="focus_far");let W=this.feedback.tick(F,c);W.key!==this.lastFeedbackKey&&(this.lastFeedbackKey=W.key,this.emit("feedback",W)),m.guidanceKey!==this.lastGuidance&&(this.lastGuidance=m.guidanceKey,this.emit("guidance",{key:m.guidanceKey}));let jt=h()-r;if(this.stats.ticks>Fe&&this.profileTick(jt),this.capturing)return;let tt=w?.suspendQuality!==!0,Qt=tt&&m.ready&&n!==null,L=tt&&f.ready&&this.lastGuideQuad!==null,z=this.lastOcrReady;if(z!==null&&this.opts.autoCapture!==!1){let v=this.feedback.force("processing",c);this.lastFeedbackKey=v.key,this.emit("feedback",v);let O=D(A(o,z.quad));await this.fire(t,z.quad,{width:o.width,height:o.height,tickSharpness:O},z.via);return}if((Qt||L)&&this.opts.autoCapture!==!1){let v=this.feedback.force("processing",c);this.lastFeedbackKey=v.key,this.emit("feedback",v);let O=L?this.lastGuideQuad:n,Ut=L?f.via==="steady"?"guide_steady":"guide_good":"quad",Kt=L?D(A(o,O)):g.sharpness;await this.fire(t,O,{width:o.width,height:o.height,tickSharpness:Kt},Ut);return}this.scheduleTick(t)}async fire(t,e,s,a){this.capturing=!0;let h=this.opts.grabDetectFrame??Et,r=this.opts.setTimer??setTimeout,o={width:s.width,height:s.height},n=this.opts.workClock??(()=>performance.now()),u=n();try{let c={still:await this.takeStill(e,o,!0),sharpness:s.tickSharpness};if(t!==this.attempt)return;let g=c.still.source==="photo"||this.deviceClass==="LOW"?0:Ae;for(let p=0;p<g;p++){let f=n()-u;if(f+Pt+f/(p+1)>Ce)break;if(await new Promise(k=>{r(()=>k(),Pt)}),t!==this.attempt)return;let S=h(this.opts.video,I);if(S===null)continue;let w=D(A(S,e));if(w>c.sharpness*ze){let k=await this.takeStill(e,o,!1);if(t!==this.attempt)return;c={still:k,sharpness:w}}}if(t!==this.attempt)return;let d=c.still.sharpness;if(this.opts.autoCapture!==!1&&a!=="manual"&&typeof d=="number"&&d>=0&&d<this.camera.stillSharpnessMin&&this.stillRefusals<this.camera.stillRefusalsMax){this.stillRefusals+=1,this.stats.stillRefusals+=1,this.guideLock.reset(),this.lastOcrReady=null,(a==="text_lock"||a==="live_mrz")&&this.opts.ocr?.rearmFace();let p=(this.opts.now??(()=>performance.now()))(),f=this.feedback.force("focus_far",p);this.lastFeedbackKey=f.key,this.emit("feedback",f),this.capturing=!1,this.gate.reset(),this.scheduleTick(t);return}this.stillRefusals=0;let m=(this.opts.now??(()=>performance.now()))();this.stats.via=a,this.stats.msToCapture=Math.round(m-(this.positioningSince??m));let y=this.lastGuideCard;y!==null&&(this.stats.shotGlare=Math.round(Math.min(1,Math.max(0,y.glare))*1e3)/1e3,this.stats.shotSharpness=Math.round(Math.min(1e6,Math.max(0,y.sharpness)))),this.lastStillAt!==null&&(this.stats.msSincePrevShot=Math.round(Math.min(36e5,Math.max(0,m-this.lastStillAt)))),this.lastStillAt=m,this.shutterOffered&&(this.shutterOffered=!1,this.emit("shutter",{available:!1})),this.setState("captured"),this.emit("artifacts",{keyframe:c.still.blob,previewDataUrl:c.still.previewDataUrl,...this.opts.side!==void 0?{side:this.opts.side}:{},...c.still.docRegion!==void 0?{docRegion:c.still.docRegion}:{},...(()=>{let p=a==="live_mrz"?this.opts.ocr?.liveCapture():null;return p?{liveMrz:p}:{}})()})}catch{if(t!==this.attempt)return;this.capturing=!1,this.gate.reset(),this.guideLock.reset(),this.lastOcrReady=null,(a==="text_lock"||a==="live_mrz")&&this.opts.ocr?.rearmFace(),this.scheduleTick(t)}}ocrTick(t,e,s,a,h,r){let o=this.opts.ocr,n=this.opts.video;if(o===void 0||!o.hasEngine)return this.lastOcrReady=null,null;let u=n.videoWidth,c=n.videoHeight;if(u<=0||c<=0||t.width<=0||t.height<=0)return null;let g=(this.opts.format??"ID-1")==="ID-3",d=this.guideRegion(t),m={x:d.x*u,y:d.y*c,w:d.width*u,h:d.height*c},y=u/t.width,p=c/t.height,f;g&&e!==null?f=De(R(e),y,p,u,c):f=Mt(m,o.bandTop,c);let S=g?h.glare==="ok":s.cardGlare<=this.guideTuning.glareMax,w=g?h.blur==="ok":s.sharpness>=this.guideTuning.sharpnessMin,k=o.tick({atMs:r,video:n,mrzFace:g||this.opts.side==="verso"||this.opts.side==="single",present:g||e!==null||a,card:m,band:f,portrait:c>u,glareOk:S,sharpOk:w});if(k.ready&&k.via!==void 0){let b=g?e??It(d,t):this.lastGuideQuad??It(d,t);this.lastOcrReady={quad:b,via:k.via}}else this.lastOcrReady=null;return k}},l(x,"i"),x);function De(i,t,e,s,a){let h=Math.min(s,i.width*1.06*t),r=Math.min(a,Math.max(i.height*1.6*e,h/5)),o=(i.y+i.height/2)*e,n=Math.max(0,Math.min(s-h,(i.x-i.width*.03)*t)),u=Math.max(0,Math.min(a-r,o-r/2));return{x:n,y:u,w:h,h:r}}l(De,"Te");function It(i,t){let e=i.x*t.width,s=i.y*t.height,a=(i.x+i.width)*t.width,h=(i.y+i.height)*t.height;return{topLeft:{x:e,y:s},topRight:{x:a,y:s},bottomRight:{x:a,y:h},bottomLeft:{x:e,y:h}}}l(It,"$t");function Te(i,t,e){let s=R(i);return t.width<=0||t.height<=0?0:e==="ID-3"?s.width/t.width:s.width*s.height/(t.width*t.height)}l(Te,"Re");var Ae=2,Pt=260,Ce=1200,Le=600,ze=1.08,Q=null;function Et(i,t){let e=i.videoWidth,s=i.videoHeight;if(e===0||s===0)return null;let a=Math.min(1,t/e),h=Math.round(e*a),r=Math.round(s*a);Q??(Q=document.createElement("canvas"));let o=Q;o.width!==h&&(o.width=h),o.height!==r&&(o.height=r);let n=o.getContext("2d",{willReadFrequently:!0});return n===null?null:(n.imageSmoothingQuality=e/Math.max(1,h)>4?"high":"low",n.drawImage(i,0,0,h,r),n.getImageData(0,0,h,r))}l(Et,"ie");function A(i,t){let e=[t.topLeft.x,t.topRight.x,t.bottomRight.x,t.bottomLeft.x],s=[t.topLeft.y,t.topRight.y,t.bottomRight.y,t.bottomLeft.y],a=Math.max(0,Math.floor(Math.min(...e))),h=Math.max(0,Math.floor(Math.min(...s))),r=Math.min(i.width,Math.ceil(Math.max(...e))),o=Math.min(i.height,Math.ceil(Math.max(...s))),n=Math.max(1,r-a),u=Math.max(1,o-h),c=new Uint8ClampedArray(n*u*4);for(let g=0;g<u;g++){let d=((h+g)*i.width+a)*4;c.set(i.data.subarray(d,d+n*4),g*n*4)}return{data:c,width:n,height:u,colorSpace:i.colorSpace}}l(A,"C");function Oe(i,t){return i==="glare"?"glare":i==="too_small"?"too_far":i==="too_big"?"too_close":t?"too_dark":i==="blurry"?"blurry":i==="off_center"?"edge_clipped":i==="no_card"?"sensing":"hold_still"}l(Oe,"Pe");var Ie=1200;export{Qe as a,Ue as b,Lt as c,xe as d,zt as e,Ot as f,Se as g,Re as h,Fe as i,_e as j,Y as k,Ke as l,Xe as m,De as n,Ae as o,Pt as p,Ce as q,Le as r};
@@ -1 +1 @@
1
- import{a as n}from"./chunk-4FHWXBOB.js";var S="0.1.0-rc.41",k=/FBAN|FBAV|FB_IAB|FBIOS|MessengerForiOS|Instagram|WhatsApp|musical_ly|BytedanceWebview|TikTok|Snapchat|\bLine\/|LinkedInApp|Pinterest|MicroMessenger|; wv\)/i;function O(t){let e=t??(typeof navigator>"u"?"":String(navigator.userAgent??""));return k.test(e)}n(O,"p");var f="sekyro.did",C=1e4,w=n(()=>globalThis.process?.versions?.node,"v"),l;function y(){let t=globalThis.crypto;try{if(typeof t?.randomUUID=="function")return t.randomUUID()}catch{}try{if(typeof t?.getRandomValues=="function"){let e=t.getRandomValues(new Uint8Array(16));return Array.from(e,a=>a.toString(16).padStart(2,"0")).join("")}}catch{}}n(y,"b");function H(){try{let t=localStorage.getItem(f);if(t)return t;let e=y();return e!==void 0&&localStorage.setItem(f,e),e}catch{return l??(l=y()),l}}n(H,"I");async function M(){let t=globalThis.crypto?.subtle;if(!t)return"";let e=navigator,a=JSON.stringify([e.userAgent,e.platform,e.hardwareConcurrency??null,e.deviceMemory??null,e.maxTouchPoints??0,screen.width,screen.height,screen.colorDepth,globalThis.devicePixelRatio??1,Intl.DateTimeFormat().resolvedOptions().timeZone,e.languages?.join(",")??e.language]),i=await t.digest("SHA-256",new TextEncoder().encode(a));return Array.from(new Uint8Array(i),s=>s.toString(16).padStart(2,"0")).join("").slice(0,32)}n(M,"w");function x(){try{let t=Number(navigator.maxTouchPoints);return Number.isFinite(t)&&t>=0?{touch:Math.min(64,Math.trunc(t))}:{}}catch{return{}}}n(x,"k");function W(t){let e=new TextEncoder().encode(t),a="";for(let i of e)a+=String.fromCharCode(i);return btoa(a).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}n(W,"x");function j(t){let e,a,i,s,c,d,m=n(()=>d?.readyState==="live","u"),T=n(()=>{c!==void 0||!globalThis.crypto?.subtle||w()||m()||(c=Promise.race([import("./print-DCYX3CZD-DLQCPZZE.js"),new Promise(r=>setTimeout(r,C))]).then(r=>r?.computePrint(m)).then(r=>{r==="busy"?c=void 0:s=r}).catch(()=>{}))},"_");return{timezone(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone?.slice(0,64)||void 0}catch{return}},noteCameraLabel(r){r&&(e=r.slice(0,128))},noteCamera(r){a=r},noteCameraTrack(r){d=r},async deviceHeader(){try{i??(i=M().catch(()=>""));let r=[];navigator.webdriver&&r.push("webdriver"),/HeadlessChrome/.test(navigator.userAgent)&&r.push("headless");let p=await i,g=H(),A={v:1,platform:"web",sdk:t.sdk.slice(0,64),caps:["session_proof"],rampAtArm:!0,ids:[...g?[{kind:"web_local",value:g.slice(0,128)}]:[],...p?[{kind:"web_fp",value:p}]:[]],screen:{w:screen.width,h:screen.height,dpr:globalThis.devicePixelRatio??1},...x(),...e?{cameraLabel:e}:{},...r.length?{signals:r}:{},...s?{print:{v:2,...s,...a?{camera:a}:{}}}:{},...O()?{inApp:!0}:{}},I=W(JSON.stringify(A));return T(),I}catch{return}},printReady(){return c??Promise.resolve()}}}n(j,"A");var v=Symbol.for("sekyro.web.clientContext"),b=globalThis,u=b[v]??(b[v]=j({sdk:`@sekyro/web@${S}`}));function z(t){try{let e=t.getVideoTracks?.()[0];if(e){if(u.noteCameraLabel(e.label),u.noteCameraTrack(e),w())return;import("./camera-trait-DELAK3YN-4I2GHAFU.js").then(a=>a.noteCameraTrait(e,u)).catch(()=>{})}}catch{}}n(z,"M");var P=Object.freeze({LOW:Object.freeze({cadenceHz:5,inputWidth:128,animations:"reduced"}),MID:Object.freeze({cadenceHz:8,inputWidth:160,animations:"full"}),HIGH:Object.freeze({cadenceHz:10,inputWidth:192,animations:"full"})}),L=new Uint8Array([0,97,115,109,1,0,0,0,1,5,1,96,0,1,123,3,2,1,0,10,10,1,8,0,65,0,253,15,253,98,11]);function F(){let t=typeof navigator>"u"?void 0:navigator,e=!1;try{e=typeof WebAssembly<"u"&&WebAssembly.validate(L)}catch{e=!1}return{cores:t?.hardwareConcurrency??2,memGB:t?.deviceMemory??null,simd:e}}n(F,"o");function U(t){let e=t.memGB??4;return t.cores<4||e<3?"LOW":t.cores>=8&&e>=6?"HIGH":"MID"}n(U,"l");var h=["LOW","MID","HIGH"],o,_=(o=class{constructor(e){this.samples=[],this.adjusted=!1,this.current=e}get deviceClass(){return this.current}get profile(){return P[this.current]}record(e){if(this.adjusted||this.samples.length>=10)return this.current;if(this.samples.push(e),this.samples.length<10)return this.current;this.adjusted=!0;let a=this.samples.reduce((i,s)=>i+s,0)/this.samples.length;if(a>70)this.current="LOW";else if(a<25){let i=h.indexOf(this.current);this.current=h[Math.min(h.length-1,i+1)]??this.current}return this.current}},n(o,"i"),o);export{S as a,O as b,u as c,z as d,F as e,U as f,_ as g};
1
+ import{a as n}from"./chunk-4FHWXBOB.js";var S="0.1.0-rc.42",k=/FBAN|FBAV|FB_IAB|FBIOS|MessengerForiOS|Instagram|WhatsApp|musical_ly|BytedanceWebview|TikTok|Snapchat|\bLine\/|LinkedInApp|Pinterest|MicroMessenger|; wv\)/i;function O(t){let e=t??(typeof navigator>"u"?"":String(navigator.userAgent??""));return k.test(e)}n(O,"p");var f="sekyro.did",C=1e4,w=n(()=>globalThis.process?.versions?.node,"v"),l;function y(){let t=globalThis.crypto;try{if(typeof t?.randomUUID=="function")return t.randomUUID()}catch{}try{if(typeof t?.getRandomValues=="function"){let e=t.getRandomValues(new Uint8Array(16));return Array.from(e,a=>a.toString(16).padStart(2,"0")).join("")}}catch{}}n(y,"b");function H(){try{let t=localStorage.getItem(f);if(t)return t;let e=y();return e!==void 0&&localStorage.setItem(f,e),e}catch{return l??(l=y()),l}}n(H,"I");async function M(){let t=globalThis.crypto?.subtle;if(!t)return"";let e=navigator,a=JSON.stringify([e.userAgent,e.platform,e.hardwareConcurrency??null,e.deviceMemory??null,e.maxTouchPoints??0,screen.width,screen.height,screen.colorDepth,globalThis.devicePixelRatio??1,Intl.DateTimeFormat().resolvedOptions().timeZone,e.languages?.join(",")??e.language]),i=await t.digest("SHA-256",new TextEncoder().encode(a));return Array.from(new Uint8Array(i),s=>s.toString(16).padStart(2,"0")).join("").slice(0,32)}n(M,"w");function x(){try{let t=Number(navigator.maxTouchPoints);return Number.isFinite(t)&&t>=0?{touch:Math.min(64,Math.trunc(t))}:{}}catch{return{}}}n(x,"k");function W(t){let e=new TextEncoder().encode(t),a="";for(let i of e)a+=String.fromCharCode(i);return btoa(a).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}n(W,"x");function j(t){let e,a,i,s,c,d,m=n(()=>d?.readyState==="live","u"),T=n(()=>{c!==void 0||!globalThis.crypto?.subtle||w()||m()||(c=Promise.race([import("./print-DCYX3CZD-DLQCPZZE.js"),new Promise(r=>setTimeout(r,C))]).then(r=>r?.computePrint(m)).then(r=>{r==="busy"?c=void 0:s=r}).catch(()=>{}))},"_");return{timezone(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone?.slice(0,64)||void 0}catch{return}},noteCameraLabel(r){r&&(e=r.slice(0,128))},noteCamera(r){a=r},noteCameraTrack(r){d=r},async deviceHeader(){try{i??(i=M().catch(()=>""));let r=[];navigator.webdriver&&r.push("webdriver"),/HeadlessChrome/.test(navigator.userAgent)&&r.push("headless");let p=await i,g=H(),A={v:1,platform:"web",sdk:t.sdk.slice(0,64),caps:["session_proof"],rampAtArm:!0,ids:[...g?[{kind:"web_local",value:g.slice(0,128)}]:[],...p?[{kind:"web_fp",value:p}]:[]],screen:{w:screen.width,h:screen.height,dpr:globalThis.devicePixelRatio??1},...x(),...e?{cameraLabel:e}:{},...r.length?{signals:r}:{},...s?{print:{v:2,...s,...a?{camera:a}:{}}}:{},...O()?{inApp:!0}:{}},I=W(JSON.stringify(A));return T(),I}catch{return}},printReady(){return c??Promise.resolve()}}}n(j,"A");var v=Symbol.for("sekyro.web.clientContext"),b=globalThis,u=b[v]??(b[v]=j({sdk:`@sekyro/web@${S}`}));function z(t){try{let e=t.getVideoTracks?.()[0];if(e){if(u.noteCameraLabel(e.label),u.noteCameraTrack(e),w())return;import("./camera-trait-DELAK3YN-4I2GHAFU.js").then(a=>a.noteCameraTrait(e,u)).catch(()=>{})}}catch{}}n(z,"M");var P=Object.freeze({LOW:Object.freeze({cadenceHz:5,inputWidth:128,animations:"reduced"}),MID:Object.freeze({cadenceHz:8,inputWidth:160,animations:"full"}),HIGH:Object.freeze({cadenceHz:10,inputWidth:192,animations:"full"})}),L=new Uint8Array([0,97,115,109,1,0,0,0,1,5,1,96,0,1,123,3,2,1,0,10,10,1,8,0,65,0,253,15,253,98,11]);function F(){let t=typeof navigator>"u"?void 0:navigator,e=!1;try{e=typeof WebAssembly<"u"&&WebAssembly.validate(L)}catch{e=!1}return{cores:t?.hardwareConcurrency??2,memGB:t?.deviceMemory??null,simd:e}}n(F,"o");function U(t){let e=t.memGB??4;return t.cores<4||e<3?"LOW":t.cores>=8&&e>=6?"HIGH":"MID"}n(U,"l");var h=["LOW","MID","HIGH"],o,_=(o=class{constructor(e){this.samples=[],this.adjusted=!1,this.current=e}get deviceClass(){return this.current}get profile(){return P[this.current]}record(e){if(this.adjusted||this.samples.length>=10)return this.current;if(this.samples.push(e),this.samples.length<10)return this.current;this.adjusted=!0;let a=this.samples.reduce((i,s)=>i+s,0)/this.samples.length;if(a>70)this.current="LOW";else if(a<25){let i=h.indexOf(this.current);this.current=h[Math.min(h.length-1,i+1)]??this.current}return this.current}},n(o,"i"),o);export{S as a,O as b,u as c,z as d,F as e,U as f,_ as g};
@@ -1 +1 @@
1
- import{a as g}from"./chunk-Z6OYPC4S.js";import{L as b,a as k,b as y,c as x}from"./chunk-BMTTAXWY.js";import{a as n}from"./chunk-5QL6W6FW.js";import{a as c,c as f}from"./chunk-4FHWXBOB.js";var l=f(k(),1),t=f(k(),1),w=f(k(),1),r=f(y(),1),e=f(y(),1);var i,C=(i=class extends w.Component{constructor(){super(...arguments),this.state={failed:!1}}static getDerivedStateFromError(){return{failed:!0}}render(){return this.state.failed?this.props.fallback:this.props.children}},c(i,"c"),i);n(C,"LoadBoundary");var j=C,F={load:n(()=>import("./flow-views-NBUWHG7J-HB57IJYX.js"),"load")};function S({view:s,i18n:a,quiet:o,...m}){let[d,h]=(0,t.useState)(0),u=(0,t.useMemo)(()=>(0,t.lazy)(()=>F.load().then(v=>({default:v[s]}))),[s,d]),p=(0,r.jsxs)(b,{tone:"danger",children:[(0,r.jsx)("span",{children:a.t("errors.network_error")}),(0,r.jsx)(x,{kind:"secondary",onClick:c(()=>h(v=>v+1),"onClick"),children:a.t("common.retry")})]});return(0,r.jsx)(j,{fallback:p,children:(0,r.jsx)(t.Suspense,{fallback:o===!0?null:(0,r.jsx)("p",{role:"status","aria-busy":"true",className:"sekyro-text-muted",children:a.t("common.loading")}),children:(0,r.jsx)(u,{...m,i18n:a})})},d)}c(S,"k");n(S,"Flow");var q=(0,l.createContext)(void 0);function B({i18n:s,lead:a,refresh:o,actions:m}){let d=(0,l.useContext)(q),[h,u]=(0,l.useState)(!1);if(d!==void 0)return(0,e.jsx)(S,{view:"HandoffView",i18n:s,url:d,lead:a,...o!==void 0?{refresh:o}:{},footer:m});let p=n(()=>{o!==void 0&&(u(!0),o().catch(()=>{}).finally(()=>u(!1)))},"again");return(0,e.jsx)(g,{tone:"brand",icon:"smartphone",title:s.t("handoff.title"),testId:"sekyro-phone-handoff",actions:(0,e.jsxs)(e.Fragment,{children:[m,o!==void 0?(0,e.jsx)(x,{kind:"secondary",full:!0,disabled:h,onClick:p,children:s.t("common.refresh")}):null]}),children:(0,e.jsx)("p",{children:a})})}c(B,"K");n(B,"PhoneHandoff");export{j as a,S as b,q as c,B as d};
1
+ import{a as g}from"./chunk-ZWC7BGLD.js";import{L as b,a as k,b as y,c as x}from"./chunk-CUFOLAZN.js";import{a as n}from"./chunk-5QL6W6FW.js";import{a as c,c as f}from"./chunk-4FHWXBOB.js";var l=f(k(),1),t=f(k(),1),w=f(k(),1),r=f(y(),1),e=f(y(),1);var i,C=(i=class extends w.Component{constructor(){super(...arguments),this.state={failed:!1}}static getDerivedStateFromError(){return{failed:!0}}render(){return this.state.failed?this.props.fallback:this.props.children}},c(i,"c"),i);n(C,"LoadBoundary");var j=C,F={load:n(()=>import("./flow-views-Q4Z2BS6Z-MZ4EFAQ6.js"),"load")};function S({view:s,i18n:a,quiet:o,...m}){let[d,h]=(0,t.useState)(0),u=(0,t.useMemo)(()=>(0,t.lazy)(()=>F.load().then(v=>({default:v[s]}))),[s,d]),p=(0,r.jsxs)(b,{tone:"danger",children:[(0,r.jsx)("span",{children:a.t("errors.network_error")}),(0,r.jsx)(x,{kind:"secondary",onClick:c(()=>h(v=>v+1),"onClick"),children:a.t("common.retry")})]});return(0,r.jsx)(j,{fallback:p,children:(0,r.jsx)(t.Suspense,{fallback:o===!0?null:(0,r.jsx)("p",{role:"status","aria-busy":"true",className:"sekyro-text-muted",children:a.t("common.loading")}),children:(0,r.jsx)(u,{...m,i18n:a})})},d)}c(S,"k");n(S,"Flow");var q=(0,l.createContext)(void 0);function B({i18n:s,lead:a,refresh:o,actions:m}){let d=(0,l.useContext)(q),[h,u]=(0,l.useState)(!1);if(d!==void 0)return(0,e.jsx)(S,{view:"HandoffView",i18n:s,url:d,lead:a,...o!==void 0?{refresh:o}:{},footer:m});let p=n(()=>{o!==void 0&&(u(!0),o().catch(()=>{}).finally(()=>u(!1)))},"again");return(0,e.jsx)(g,{tone:"brand",icon:"smartphone",title:s.t("handoff.title"),testId:"sekyro-phone-handoff",actions:(0,e.jsxs)(e.Fragment,{children:[m,o!==void 0?(0,e.jsx)(x,{kind:"secondary",full:!0,disabled:h,onClick:p,children:s.t("common.refresh")}):null]}),children:(0,e.jsx)("p",{children:a})})}c(B,"K");n(B,"PhoneHandoff");export{j as a,S as b,q as c,B as d};
@@ -1 +1 @@
1
- import{a as j}from"./chunk-L7I27OCG.js";import{d as U}from"./chunk-X6LDVTUQ.js";import{L as k,M as I,a as A,b as V,c as h,v as T,w as _,y as C}from"./chunk-BMTTAXWY.js";import{a as n}from"./chunk-5QL6W6FW.js";import{a as s,c as N}from"./chunk-4FHWXBOB.js";var f=N(A(),1),e=N(V(),1);var D={"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":"التقط صورة أخرى أو ارفعها."},y={"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."},G={"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."},H={en:y,fr:G,ar:D,es:y,pt:y,de:y},S="image/jpeg,image/png,image/heic,image/heif";function m(r){let o=r.strings,a=H[r.locale];return t=>o[t]??a[t]??""}s(m,"v");n(m,"portraitCopy");function b({step:r,i18n:o}){if(r.reason===void 0||r.reason==="portrait_fix_review")return null;let a=m(o)(`reasons.${r.reason}`)||o.t("portrait.retryTitle");return(0,e.jsxs)(k,{tone:"warning",children:[(0,e.jsx)("span",{children:a}),(0,e.jsx)("span",{children:I(o,r.attemptsRemaining,r.attemptsExhausted)})]})}s(b,"R");n(b,"ReasonNotice");function z({step:r,i18n:o,onCamera:a,onUpload:t}){let i=m(o),p=r.photo?.cameraOnPhone===!0;return(0,e.jsx)(j,{testId:"sekyro-portrait-source",title:i("portrait.source.title"),lead:i("portrait.source.description"),cameraLabel:p?o.t("capture.source.phone"):i("portrait.source.camera"),onPhone:p,uploadLabel:i("portrait.source.upload"),notice:(0,e.jsx)(b,{step:r,i18n:o}),onCamera:a,onUpload:t})}s(z,"z");n(z,"PortraitSourceView");function R({step:r,i18n:o,onCamera:a}){let t=m(o),i=(0,f.useRef)(null),[p,v]=(0,f.useState)("idle"),u=p==="sending",d=r.photo?.uploadOffered===!0,g=n(async c=>{let x=c.currentTarget.files?.[0];if(c.currentTarget.value="",x!==void 0){v("sending");try{await r.uploadPortrait(x),v("idle")}catch(w){v(w instanceof TypeError&&w.message==="unsupported_file"?"unsupported":"failed")}}},"onFile");return(0,e.jsxs)("section",{className:"sekyro-step","data-testid":"sekyro-portrait-upload-screen",children:[(0,e.jsx)(_,{title:t("portrait.upload.title"),lead:t("portrait.upload.hint")}),p==="idle"||p==="sending"?(0,e.jsx)(b,{step:r,i18n:o}):null,p==="unsupported"||p==="failed"?(0,e.jsx)(k,{tone:"warning",children:(0,e.jsx)("span",{children:t(p==="unsupported"?"portrait.upload.unsupported":"portrait.upload.failed")})}):null,u?(0,e.jsx)("p",{className:"sekyro-text-muted",role:"status","aria-busy":"true",children:o.t("portrait.uploading")}):null,(0,e.jsx)("input",{ref:i,type:"file",accept:S,hidden:!0,"data-testid":"sekyro-portrait-upload","aria-label":t("portrait.upload.title"),onChange:s(c=>{g(c)},"onChange")}),(0,e.jsxs)(C,{children:[(0,e.jsx)(h,{full:!0,onClick:s(()=>i.current?.click(),"onClick"),disabled:u||!d||r.attemptsExhausted,children:t("portrait.upload.choose")}),a!==void 0?(0,e.jsxs)(h,{full:!0,kind:"ghost",onClick:a,disabled:u,children:[(0,e.jsx)(T,{name:"camera"}),t("portrait.source.camera")]}):null]})]})}s(R,"A");n(R,"PortraitUploadView");function E({step:r,i18n:o,onDeclined:a}){let t=m(o),[i,p]=(0,f.useState)(!1),[v,u]=(0,f.useState)(!1),d=r.pendingFix;if(d==null)return null;let g=n(async l=>{p(!0),u(!1);try{await r.confirmFix(l),l||a?.()}catch{u(!0)}finally{p(!1)}},"answer"),c=r.photo?.source==="upload"?t("portrait.review.uploadAnother"):t("portrait.review.retake"),x=n(l=>t(`portrait.fixes.${l}`)||l,"fixName"),w=t("portrait.review.original"),P=t("portrait.review.fixed");return(0,e.jsxs)("section",{className:"sekyro-step","data-testid":"sekyro-portrait-review",children:[(0,e.jsx)(_,{title:t("portrait.review.title"),lead:t("portrait.review.description")}),(0,e.jsxs)("div",{className:"sekyro-portrait-pair",children:[(0,e.jsxs)("figure",{className:"sekyro-portrait-pair__item",children:[(0,e.jsx)("img",{src:d.originalUrl,alt:w}),(0,e.jsx)("figcaption",{className:"sekyro-text-muted",children:w})]}),(0,e.jsxs)("figure",{className:"sekyro-portrait-pair__item",children:[(0,e.jsx)("img",{src:d.fixedUrl,alt:P}),(0,e.jsx)("figcaption",{className:"sekyro-text-muted",children:P})]})]}),d.fixes.length>0?(0,e.jsxs)("div",{className:"sekyro-stack sekyro-stack--1",children:[(0,e.jsx)("p",{className:"sekyro-text-body",children:t("portrait.review.fixesTitle")}),(0,e.jsx)("ul",{className:"sekyro-portrait-fixes","data-testid":"sekyro-portrait-fixes",children:d.fixes.map(l=>(0,e.jsx)("li",{children:x(l)},l))})]}):null,v?(0,e.jsx)(k,{tone:"danger",children:(0,e.jsx)("span",{children:o.t("errors.network_error")})}):null,(0,e.jsxs)(C,{children:[(0,e.jsx)(h,{full:!0,onClick:s(()=>{g(!0)},"onClick"),disabled:i,"data-testid":"sekyro-portrait-accept",children:t("portrait.review.accept")}),(0,e.jsx)(h,{full:!0,kind:"ghost",onClick:s(()=>{g(!1)},"onClick"),disabled:i,"data-testid":"sekyro-portrait-decline",children:c})]})]})}s(E,"j");n(E,"PortraitReviewView");function q({screen:r,step:o,i18n:a,onCamera:t,onUpload:i,onDeclined:p}){return r==="phone"?(0,e.jsx)(U,{i18n:a,lead:a.t("handoff.lead.portrait"),refresh:o.refresh,actions:(0,e.jsx)(h,{kind:"ghost",full:!0,onClick:i,children:m(a)("portrait.source.upload")})}):r==="review"?(0,e.jsx)(E,{step:o,i18n:a,onDeclined:p}):r==="upload"?(0,e.jsx)(R,{step:o,i18n:a,...t!==void 0?{onCamera:t}:{}}):(0,e.jsx)(z,{step:o,i18n:a,onCamera:t??i,onUpload:i})}s(q,"Q");n(q,"PortraitScreens");export{m as a,z as b,R as c,E as d,q as e};
1
+ import{a as j}from"./chunk-POVLMWGM.js";import{d as U}from"./chunk-YI34K4SS.js";import{L as k,M as I,a as A,b as V,c as h,v as T,w as _,y as C}from"./chunk-CUFOLAZN.js";import{a as n}from"./chunk-5QL6W6FW.js";import{a as s,c as N}from"./chunk-4FHWXBOB.js";var f=N(A(),1),e=N(V(),1);var D={"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":"التقط صورة أخرى أو ارفعها."},y={"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."},G={"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."},H={en:y,fr:G,ar:D,es:y,pt:y,de:y},S="image/jpeg,image/png,image/heic,image/heif";function m(r){let o=r.strings,a=H[r.locale];return t=>o[t]??a[t]??""}s(m,"v");n(m,"portraitCopy");function b({step:r,i18n:o}){if(r.reason===void 0||r.reason==="portrait_fix_review")return null;let a=m(o)(`reasons.${r.reason}`)||o.t("portrait.retryTitle");return(0,e.jsxs)(k,{tone:"warning",children:[(0,e.jsx)("span",{children:a}),(0,e.jsx)("span",{children:I(o,r.attemptsRemaining,r.attemptsExhausted)})]})}s(b,"R");n(b,"ReasonNotice");function z({step:r,i18n:o,onCamera:a,onUpload:t}){let i=m(o),p=r.photo?.cameraOnPhone===!0;return(0,e.jsx)(j,{testId:"sekyro-portrait-source",title:i("portrait.source.title"),lead:i("portrait.source.description"),cameraLabel:p?o.t("capture.source.phone"):i("portrait.source.camera"),onPhone:p,uploadLabel:i("portrait.source.upload"),notice:(0,e.jsx)(b,{step:r,i18n:o}),onCamera:a,onUpload:t})}s(z,"z");n(z,"PortraitSourceView");function R({step:r,i18n:o,onCamera:a}){let t=m(o),i=(0,f.useRef)(null),[p,v]=(0,f.useState)("idle"),u=p==="sending",d=r.photo?.uploadOffered===!0,g=n(async c=>{let x=c.currentTarget.files?.[0];if(c.currentTarget.value="",x!==void 0){v("sending");try{await r.uploadPortrait(x),v("idle")}catch(w){v(w instanceof TypeError&&w.message==="unsupported_file"?"unsupported":"failed")}}},"onFile");return(0,e.jsxs)("section",{className:"sekyro-step","data-testid":"sekyro-portrait-upload-screen",children:[(0,e.jsx)(_,{title:t("portrait.upload.title"),lead:t("portrait.upload.hint")}),p==="idle"||p==="sending"?(0,e.jsx)(b,{step:r,i18n:o}):null,p==="unsupported"||p==="failed"?(0,e.jsx)(k,{tone:"warning",children:(0,e.jsx)("span",{children:t(p==="unsupported"?"portrait.upload.unsupported":"portrait.upload.failed")})}):null,u?(0,e.jsx)("p",{className:"sekyro-text-muted",role:"status","aria-busy":"true",children:o.t("portrait.uploading")}):null,(0,e.jsx)("input",{ref:i,type:"file",accept:S,hidden:!0,"data-testid":"sekyro-portrait-upload","aria-label":t("portrait.upload.title"),onChange:s(c=>{g(c)},"onChange")}),(0,e.jsxs)(C,{children:[(0,e.jsx)(h,{full:!0,onClick:s(()=>i.current?.click(),"onClick"),disabled:u||!d||r.attemptsExhausted,children:t("portrait.upload.choose")}),a!==void 0?(0,e.jsxs)(h,{full:!0,kind:"ghost",onClick:a,disabled:u,children:[(0,e.jsx)(T,{name:"camera"}),t("portrait.source.camera")]}):null]})]})}s(R,"A");n(R,"PortraitUploadView");function E({step:r,i18n:o,onDeclined:a}){let t=m(o),[i,p]=(0,f.useState)(!1),[v,u]=(0,f.useState)(!1),d=r.pendingFix;if(d==null)return null;let g=n(async l=>{p(!0),u(!1);try{await r.confirmFix(l),l||a?.()}catch{u(!0)}finally{p(!1)}},"answer"),c=r.photo?.source==="upload"?t("portrait.review.uploadAnother"):t("portrait.review.retake"),x=n(l=>t(`portrait.fixes.${l}`)||l,"fixName"),w=t("portrait.review.original"),P=t("portrait.review.fixed");return(0,e.jsxs)("section",{className:"sekyro-step","data-testid":"sekyro-portrait-review",children:[(0,e.jsx)(_,{title:t("portrait.review.title"),lead:t("portrait.review.description")}),(0,e.jsxs)("div",{className:"sekyro-portrait-pair",children:[(0,e.jsxs)("figure",{className:"sekyro-portrait-pair__item",children:[(0,e.jsx)("img",{src:d.originalUrl,alt:w}),(0,e.jsx)("figcaption",{className:"sekyro-text-muted",children:w})]}),(0,e.jsxs)("figure",{className:"sekyro-portrait-pair__item",children:[(0,e.jsx)("img",{src:d.fixedUrl,alt:P}),(0,e.jsx)("figcaption",{className:"sekyro-text-muted",children:P})]})]}),d.fixes.length>0?(0,e.jsxs)("div",{className:"sekyro-stack sekyro-stack--1",children:[(0,e.jsx)("p",{className:"sekyro-text-body",children:t("portrait.review.fixesTitle")}),(0,e.jsx)("ul",{className:"sekyro-portrait-fixes","data-testid":"sekyro-portrait-fixes",children:d.fixes.map(l=>(0,e.jsx)("li",{children:x(l)},l))})]}):null,v?(0,e.jsx)(k,{tone:"danger",children:(0,e.jsx)("span",{children:o.t("errors.network_error")})}):null,(0,e.jsxs)(C,{children:[(0,e.jsx)(h,{full:!0,onClick:s(()=>{g(!0)},"onClick"),disabled:i,"data-testid":"sekyro-portrait-accept",children:t("portrait.review.accept")}),(0,e.jsx)(h,{full:!0,kind:"ghost",onClick:s(()=>{g(!1)},"onClick"),disabled:i,"data-testid":"sekyro-portrait-decline",children:c})]})]})}s(E,"j");n(E,"PortraitReviewView");function q({screen:r,step:o,i18n:a,onCamera:t,onUpload:i,onDeclined:p}){return r==="phone"?(0,e.jsx)(U,{i18n:a,lead:a.t("handoff.lead.portrait"),refresh:o.refresh,actions:(0,e.jsx)(h,{kind:"ghost",full:!0,onClick:i,children:m(a)("portrait.source.upload")})}):r==="review"?(0,e.jsx)(E,{step:o,i18n:a,onDeclined:p}):r==="upload"?(0,e.jsx)(R,{step:o,i18n:a,...t!==void 0?{onCamera:t}:{}}):(0,e.jsx)(z,{step:o,i18n:a,onCamera:t??i,onUpload:i})}s(q,"Q");n(q,"PortraitScreens");export{m as a,z as b,R as c,E as d,q as e};
@@ -1 +1 @@
1
- import{a as Nr}from"./chunk-BWOTZKA7.js";import{c as _t}from"./chunk-MXMEO2IW.js";import{b as kr,d as br}from"./chunk-BO327WCQ.js";import{b as xr,c as Ct}from"./chunk-CYEDFGUG.js";import{a as yr,b as gr,c as vr,d as Me}from"./chunk-FQHV53QQ.js";import{G as _r,L as wr,M as Sr,a as K,b as de,c as te,m as pr,n as Je,p as hr,q as et,r as fr,s as mr,t as bt,u as le,v as Ee,w as tt,y as Cr}from"./chunk-BMTTAXWY.js";import{c as ir,d as cr,e as ur,h as dr}from"./chunk-32CNXSJQ.js";import{b as kt}from"./chunk-U7QPOSFH.js";import{a as s}from"./chunk-5QL6W6FW.js";import{g as lr}from"./chunk-6MYG4HWP.js";import{a as o,c as U}from"./chunk-4FHWXBOB.js";var Ar=U(K(),1),y=U(de(),1),re=U(de(),1),ye=U(K(),1),$=U(de(),1),C=U(K(),1),m=U(K(),1),at=U(K(),1),fe=U(de(),1),Qr=U(K(),1),X=U(K(),1),lt=U(K(),1),we=U(de(),1),Se=U(de(),1),P=U(de(),1);var it=U(K(),1),pe=U(K(),1);var Q=U(K(),1);var E=U(K(),1),me=U(K(),1),Te=U(K(),1),At=U(de(),1),v=U(de(),1);function ce({className:e,children:t}){return(0,y.jsx)("svg",{"aria-hidden":"true",focusable:"false",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",className:e??"sekyro-icon sekyro-icon--sm",children:t})}o(ce,"ne");s(ce,"Svg");var Mt="M4 7.5h2.2l1.4-1.9h8.8l1.4 1.9H20a1.6 1.6 0 0 1 1.6 1.6v8.3A1.6 1.6 0 0 1 20 19H4a1.6 1.6 0 0 1-1.6-1.6V9.1A1.6 1.6 0 0 1 4 7.5Z";function Mr(e){return(0,y.jsxs)(ce,{...e,children:[(0,y.jsx)("circle",{cx:"12",cy:"12",r:"4"}),(0,y.jsx)("path",{d:"M12 2.5v2M12 19.5v2M2.5 12h2M19.5 12h2M5.3 5.3l1.4 1.4M17.3 17.3l1.4 1.4M5.3 18.7l1.4-1.4M17.3 6.7l1.4-1.4"})]})}o(Mr,"ln");s(Mr,"SunIcon");function Er(e){return(0,y.jsxs)(ce,{...e,children:[(0,y.jsx)("circle",{cx:"12",cy:"12",r:"9"}),(0,y.jsx)("path",{d:"M9 10h.01M15 10h.01M8.8 14.6a4.2 4.2 0 0 0 6.4 0"})]})}o(Er,"un");s(Er,"FaceUncoveredIcon");function Lr(e){return(0,y.jsxs)(ce,{...e,children:[(0,y.jsx)("rect",{x:"7",y:"2.5",width:"10",height:"19",rx:"2"}),(0,y.jsx)("path",{d:"M10.5 18.5h3M2.5 9.5h2.5M19 9.5h2.5"}),(0,y.jsx)("circle",{cx:"12",cy:"9.5",r:"1.6"})]})}o(Lr,"dn");s(Lr,"PhoneEyeLevelIcon");function Ir(e){return(0,y.jsxs)(ce,{...e,children:[(0,y.jsx)("path",{d:"M2.5 12S6 5.5 12 5.5 21.5 12 21.5 12 18 18.5 12 18.5 2.5 12 2.5 12Z"}),(0,y.jsx)("circle",{cx:"12",cy:"12",r:"2.8"})]})}o(Ir,"pn");s(Ir,"LookStraightIcon");function Ur(e){return(0,y.jsxs)(ce,{...e,children:[(0,y.jsx)("path",{d:Mt}),(0,y.jsx)("path",{d:"M9 13l2 2 4-4"})]})}o(Ur,"fn");s(Ur,"CameraCheckIcon");function jr(e){return(0,y.jsxs)(ce,{...e,children:[(0,y.jsx)("path",{d:Mt}),(0,y.jsx)("path",{d:"M10.2 11.2a1.9 1.9 0 1 1 2.6 1.8c-.5.2-.8.6-.8 1.1v.3M12 16.4h.01"})]})}o(jr,"mn");s(jr,"CameraAskIcon");function Tr(e){return(0,y.jsxs)(ce,{...e,children:[(0,y.jsx)("path",{d:Mt}),(0,y.jsx)("path",{d:"M3 3l18 18"})]})}o(Tr,"yn");s(Tr,"CameraBlockedIcon");function nt({off:e,className:t}){return(0,y.jsxs)(ce,{className:t,children:[(0,y.jsx)("path",{d:"M4.5 9.5v5H8l4 3.5v-12L8 9.5H4.5Z"}),e?(0,y.jsx)("path",{d:"M4 4l16 16"}):(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)("path",{d:"M15.5 9.7a3.6 3.6 0 0 1 0 4.6"}),(0,y.jsx)("path",{d:"M18 7.6a6.6 6.6 0 0 1 0 8.8"})]})]})}o(nt,"Ve");s(nt,"SpeakerIcon");function Or(e){return(0,y.jsx)(ce,{...e,children:(0,y.jsx)("path",{d:"M5 12.5l4.5 4.5L19 7.5"})})}o(Or,"gn");s(Or,"CheckIcon");function Pr(e){return(0,y.jsxs)(ce,{className:e.className??"sekyro-spinner",children:[(0,y.jsx)("circle",{cx:"12",cy:"12",r:"9",opacity:"0.25"}),(0,y.jsx)("path",{d:"M21 12a9 9 0 0 0-9-9"})]})}o(Pr,"hn");s(Pr,"SpinnerIcon");var wt=["light","uncover","eyeLevel","straight"],In={light:{key:"capture.tips.light",icon:s(()=>(0,re.jsx)(Mr,{}),"icon")},uncover:{key:"capture.tips.uncover",icon:s(()=>(0,re.jsx)(Er,{}),"icon")},eyeLevel:{key:"capture.tips.eyeLevel",icon:s(()=>(0,re.jsx)(Lr,{}),"icon")},straight:{key:"capture.tips.straight",icon:s(()=>(0,re.jsx)(Ir,{}),"icon")}};function Br({tips:e}){let t=Me(),n=(0,Ar.useId)();return e.length===0?null:(0,re.jsxs)("section",{className:"sekyro-tips","aria-labelledby":n,"data-testid":"sekyro-tips",children:[(0,re.jsx)("p",{className:"sekyro-tips__title",id:n,children:t("capture.tips.title")}),(0,re.jsx)("ul",{className:"sekyro-tips__list",children:e.map(r=>{let a=typeof r=="string"?In[r]:void 0,l=typeof r=="string"?r:r.id,c=a!==void 0?a.icon():typeof r=="string"?void 0:r.icon,d=a!==void 0?t(a.key):typeof r=="string"?r:r.text;return(0,re.jsxs)("li",{className:"sekyro-tips__item",children:[c!=null?(0,re.jsx)("span",{className:"sekyro-tips__icon","aria-hidden":"true",children:c}):null,(0,re.jsx)("span",{children:d})]},l)})})]})}o(Br,"Cn");s(Br,"TipList");var Un=220;function qr({title:e,description:t,options:n,busy:r,error:a,focus:l,testId:c,look:d="cards",marked:S,onChoose:p}){let w=(0,ye.useId)(),N=bt(),[j,R]=(0,ye.useState)(null),B=(0,ye.useRef)(null);(0,ye.useEffect)(()=>{a!==null&&R(null)},[a]),(0,ye.useEffect)(()=>()=>{B.current!==null&&clearTimeout(B.current)},[]);let q=s(A=>{r||j!==null||(R(A),B.current=setTimeout(()=>{B.current=null,R(null),p(A)},Un))},"choose");return(0,$.jsxs)("section",{className:"sekyro-stack sekyro-stack--4 sekyro-choice","aria-labelledby":w,"data-testid":c,children:[(0,$.jsxs)("div",{className:d==="cards"?"sekyro-heading":"sekyro-stack sekyro-stack--1",children:[(0,$.jsx)("h2",{id:w,ref:l?N:void 0,tabIndex:-1,className:"sekyro-text-body",children:e}),t!==void 0&&t!==""?(0,$.jsx)("p",{className:"sekyro-text-muted",children:t}):null]}),a!==null?(0,$.jsx)(le,{tone:"danger",children:(0,$.jsx)("span",{children:a})}):null,d==="buttons"?(0,$.jsx)("div",{className:"sekyro-stack sekyro-stack--3",children:n.map((A,J)=>(0,$.jsx)(te,{kind:J===0?"primary":"ghost",full:!0,disabled:r,"aria-busy":r||void 0,onClick:o(()=>p(A.id),"onClick"),children:A.label},A.id))}):(0,$.jsx)("div",{className:"sekyro-choices",children:n.map(A=>(0,$.jsxs)("button",{type:"button",className:"sekyro-card","aria-pressed":(j??S)===A.id,"aria-busy":r||void 0,disabled:r||j!==null&&j!==A.id,onClick:o(()=>q(A.id),"onClick"),children:[A.glyph!==void 0?(0,$.jsx)("span",{className:"sekyro-card__tile",children:A.glyph}):null,(0,$.jsxs)("span",{className:"sekyro-card__body",children:[(0,$.jsx)("span",{className:"sekyro-card__title",children:A.label}),A.sub!==void 0?(0,$.jsx)("span",{className:"sekyro-card__sub",children:A.sub}):null]}),(0,$.jsx)("span",{className:"sekyro-radio","aria-hidden":"true"})]},A.id))})]})}o(qr,"bn");s(qr,"ChoiceScreen");var Vr=["fcv3.no_face","fcv3.come_closer","fcv3.move_back","fcv3.center_face","fcv3.straighten","fcv3.more_light","fcv3.too_bright","fcv3.hold_still","fcv3.steady_camera","fcv3.hold_upright","fcv3.one_face","capture.tips.summary","capture.lookAtColours"];function st(e){return e!==null&&Vr.includes(e)}o(st,"he");s(st,"isVoiceKey");var jn=s((e,t)=>Object.prototype.hasOwnProperty.call(e,t),"own");function je(e,t,n){let r;try{if(typeof e=="function")r=e(t,n);else{let a=e[n];r=a!=null&&jn(a,t)?a[t]:null}}catch{return null}return typeof r=="string"&&r!==""?r:null}o(je,"Me");s(je,"resolveClip");var Tn="UklGRiQAAABXQVZFZm10IBAAAAABAAEAESsAACJWAAACABAAZGF0YQAAAAA=",On={ar:"ar-SA",fr:"fr-FR",en:"en-US",es:"es-ES",pt:"pt-BR",de:"de-DE"};function ie(){return typeof window<"u"&&"speechSynthesis"in window?window.speechSynthesis:null}o(ie,"re");s(ie,"synth");function Dr(){return ie()!==null&&typeof SpeechSynthesisUtterance=="function"}o(Dr,"Lr");s(Dr,"speechAvailable");function St(e){return(e.split(/[-_]/)[0]??e).toLowerCase()}o(St,"Sn");s(St,"baseLang");function Et(e,t){let n=s(a=>a.replace(/_/g,"-").toLowerCase(),"norm"),r=St(t);return e.find(a=>n(a.lang)===n(t))??e.find(a=>St(a.lang)===r)}o(Et,"Mn");s(Et,"pickVoice");function Hr(e){if(!Dr())return!1;let t=[];try{t=ie()?.getVoices()??[]}catch{return!0}return t.length===0||Et(t,e)!==void 0}o(Hr,"wn");s(Hr,"speechUsable");function $r(e){let t=ie();return t===null||typeof t.addEventListener!="function"?()=>{}:(t.addEventListener("voiceschanged",e),()=>t.removeEventListener?.("voiceschanged",e))}o($r,"Ln");s($r,"subscribeVoices");function De(e){try{let t=typeof location<"u"?location.href:"http://localhost/",n=new URL(e,t);return`clip:${n.origin}${n.pathname}`}catch{return`clip:${e}`}}o(De,"Ke");s(De,"clipIdentity");function xt(e){e.pause(),e.removeAttribute("src"),e.load()}o(xt,"Rn");s(xt,"release");function Fr(){let e=null,t=null,n=0,r=null,a=null,l=null,c=!1,d=null,S=[],p=new Map,w=s(()=>{S=ie()?.getVoices()??[]},"loadVoices"),N=!1,j=s(()=>{let h=ie();N||h===null||(N=!0,w(),h.addEventListener?.("voiceschanged",w))},"bindVoices"),R=s(()=>(e??(e=new Audio),e),"element"),B=s((h,x,_,k)=>{let u=ie();if(u!==null&&h!==""&&typeof SpeechSynthesisUtterance=="function"){j();let M=Et(S,x);if(S.length===0||M!==void 0){u.cancel();let I=new SpeechSynthesisUtterance(h);I.lang=x,M!==void 0&&(I.voice=M),I.rate=.95,_!==void 0&&(I.onend=_),(_!==void 0||k!==void 0)&&(I.onerror=D=>{k!==void 0&&D.error==="not-allowed"?k():_?.()}),u.speak(I);return}}_?.()},"speak"),q=s(()=>{n+=1,r=null,a=l=null,e!==null&&(e.pause(),e.currentTime=0),ie()?.cancel()},"stop"),A=s(h=>{for(let x of h){let _=De(x);if(p.has(_))continue;let k=new Audio;k.preload="auto",k.src=x,p.set(_,k)}},"warmClips"),J=s((h,x,_)=>{let k={utterance:h,generation:x,end:_};d=k;let u=s(()=>x===n&&d===k,"live"),M=s(()=>{u()&&(a=k)},"block");if(ie()?.cancel(),h.url!==null){let I=R();I.pause(),I.muted=!1,I.src=h.url,I.currentTime=0,I.onended=_??null;let D=s(()=>{l===k&&(l=null)},"settled"),i=I.play();if(i===void 0)return;l=k,i.then(D,T=>{if(D(),!u())return;let O=T?.name;if(O!=="AbortError"){if(O==="NotAllowedError")return M();h.speech?B(h.text,h.lang,_,M):_?.()}});return}h.speech?B(h.text,h.lang,_,M):_?.()},"start");return{say(h){let x=h.url!==null?De(h.url):`tts:${h.lang}:${h.text}`;if(x===r)return;r=x,a=l=null,n+=1;let _=n,k=h.onEnd;J(h,_,k!==void 0?()=>{_===n&&k()}:void 0)},unlock({lang:h,speech:x,prefetch:_}){let k=a??(c?null:l);c=!0;let u=k!==null&&k.generation===n?k:null;a=l=null,u!==null&&J(u.utterance,u.generation,u.end);let M=R();if(t===null&&typeof Blob=="function"&&typeof URL.createObjectURL=="function"){let T=Uint8Array.from(atob(Tn),O=>O.charCodeAt(0));t=URL.createObjectURL(new Blob([T],{type:"audio/wav"}))}let I=M.paused===!1&&t!==null&&M.src!==t;t!==null&&!I&&(u===null||u.utterance.url===null)&&(M.muted=!0,M.onended=null,M.src=t,M.play()?.catch(()=>{}));let D=ie(),i=u!==null&&u.utterance.url===null;if(x&&!i&&D!==null&&typeof SpeechSynthesisUtterance=="function"){j();let T=new SpeechSynthesisUtterance(" ");T.volume=0,T.lang=h,D.speak(T)}A(_??[])},prefetch:A,stop:q,dispose(){q(),N&&ie()?.removeEventListener?.("voiceschanged",w),N=!1,t!==null&&URL.revokeObjectURL(t),t=null,e!==null&&xt(e),e=null;for(let h of p.values())xt(h);p.clear()}}}o(Fr,"_n");s(Fr,"createVoicePlayer");var Pn="sekyro.voiceGuidance";function Gr(e){try{if(typeof window>"u")return null;let t=window.localStorage.getItem(e);return t==="1"?!0:t==="0"?!1:null}catch{return null}}o(Gr,"xn");s(Gr,"readVoicePreference");function Kr(e,t){try{if(typeof window>"u")return;window.localStorage.setItem(e,t?"1":"0")}catch{}}o(Kr,"En");s(Kr,"writeVoicePreference");var Ve="capture.tips.summary",Bn=typeof window<"u"?C.useLayoutEffect:C.useEffect,qn=Object.freeze({});function rt(e,t){let n=new Set,r=[];for(let a of Vr){let l=a===Ve?null:je(e,a,t);l===null||n.has(De(l))||(n.add(De(l)),r.push(l))}return r}o(rt,"ht");s(rt,"resolvedClipUrls");function Zr({locale:e,defaultClips:t,options:n}){let r=n===!1,a=r?{}:n??{},l=a.storageKey===void 0?Pn:a.storageKey,[c,d]=(0,C.useState)(a.defaultEnabled??!0),S=(0,C.useRef)(c),[p,w]=(0,C.useState)(!1),[N,j]=(0,C.useState)("none"),[R,B]=(0,C.useState)(!1),q=(0,C.useRef)(!1),[A,J]=(0,C.useState)(0),h=(0,C.useRef)(null),x=(0,C.useCallback)(()=>(h.current??(h.current=Fr()),h.current),[]),_=On[e],k=a.speechFallback,u=k===void 0||k===!0?!0:k===!1?!1:k.includes(e),M=a.clips??t??qn,I=(0,C.useRef)(!1),D=(0,C.useRef)(M);Bn(()=>{D.current=M,S.current=c}),(0,C.useEffect)(()=>{if(r||l===null)return;let L=Gr(l);L!==null&&(S.current=L,d(L))},[r,l]),(0,C.useEffect)(()=>{if(!(r||!u))return $r(()=>J(L=>L+1))},[r,u]);let i=a.clips;(0,C.useEffect)(()=>{if(r)return;let L=u&&Hr(_);w(rt(M,e).length>0||L),j(i!==void 0&&je(i,Ve,e)!==null?"partner":je(M,Ve,e)!==null||L?"default":"none")},[r,M,i,e,u,_,A]),(0,C.useEffect)(()=>{if(r||!c||!I.current)return;let L=rt(M,e);L.length>0&&x().prefetch(L)},[r,c,M,e,x]),(0,C.useEffect)(()=>()=>{h.current?.dispose(),h.current=null,I.current=!1},[]);let T=(0,C.useCallback)(L=>{r||(I.current=!0,x().unlock({lang:_,speech:u,...L?{prefetch:rt(D.current,e)}:{}}))},[r,x,_,u,e]),O=(0,C.useCallback)(()=>T(S.current),[T]),z=(0,C.useCallback)(()=>{q.current=!1,B(!1)},[]),H=(0,C.useCallback)(()=>{z(),h.current?.stop()},[z]),ge=(0,C.useCallback)(()=>{q.current&&H()},[H]),he=(0,C.useCallback)((L,xe)=>{if(r)return;if(q.current){H();return}let ve=x();ve.stop(),q.current=!0,B(!0);let V=xe?.clip===!1?null:je(D.current,Ve,e);ve.say({url:V,text:L,lang:_,speech:u,onEnd:z})},[r,H,x,e,_,u,z]),Y=(0,C.useCallback)(L=>{r||(L?T(!0):H(),l!==null&&Kr(l,L),S.current=L,d(L))},[r,T,H,l]),W=(0,C.useCallback)(()=>Y(!S.current),[Y]),ne=(0,C.useCallback)((L,xe)=>{if(r||!c)return;q.current&&z();let ve=je(D.current,L,e);x().say({url:ve,text:xe,lang:_,speech:u})},[r,c,e,x,_,u,z]);return(0,C.useMemo)(()=>({supported:!r&&p,enabled:!r&&c,setEnabled:Y,toggle:W,unlock:O,speakKey:ne,stop:H,summary:r?"none":N,summaryPlaying:R,toggleSummary:he,stopSummary:ge}),[r,p,c,Y,W,O,ne,H,N,R,he,ge])}o(Zr,"vt");s(Zr,"useVoiceGuidance");function zr(e,t,n,r){let{speakKey:a,stop:l,enabled:c}=e,d=(0,C.useRef)(!1);(0,C.useEffect)(()=>{if(!r||!c){d.current&&l(),d.current=!1;return}d.current=!0,st(t)&&t!==Ve&&n!==""&&a(t,n)},[r,c,t,n,a,l])}o(zr,"Ct");s(zr,"useSpeakGuidance");function ot(e,t){let n=Yr(e);return n==="face"&&(t==="lighting"||e==="liveness_inconclusive")?"again":n}o(ot,"Pn");s(ot,"retryCoachingOf");function Yr(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"}}o(Yr,"Pr");s(Yr,"coachingOfReason");var He={face:{title:"capture.retryCoaching.title",tips:["capture.retryCoaching.light","capture.retryCoaching.eyeLevel","capture.retryCoaching.head"]},again:{title:"capture.retryTips.title",tips:["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 Wr({showCoaching:e,coaching:t="face",attemptsText:n,showRetake:r,onRetake:a}){let l=Me(),c=(0,at.useRef)(null);return(0,at.useEffect)(()=>{r&&c.current?.focus()},[r]),!e&&!r?null:(0,fe.jsxs)("div",{className:"sekyro-stack sekyro-stack--3","data-testid":"sekyro-captured-panel",children:[e?(0,fe.jsxs)("div",{className:"sekyro-stack sekyro-stack--1",children:[(0,fe.jsx)("p",{className:"sekyro-text-body",children:l(He[t].title)}),(0,fe.jsx)("ul",{className:"sekyro-coaching",children:He[t].tips.map(d=>(0,fe.jsx)("li",{children:l(d)},d))}),n!==null?(0,fe.jsx)("p",{className:"sekyro-text-muted","data-testid":"sekyro-attempts-remaining",children:n}):null]}):null,r?(0,fe.jsx)(te,{ref:c,className:"sekyro-btn--start",onClick:a,children:l("capture.recordAgain")}):null]})}o(Wr,"Tn");s(Wr,"CapturedPanel");function Lt(){try{return!1}catch{return!1}}o(Lt,"nt");s(Lt,"isDevBuild");var Vn=(0,Qr.createContext)(null);function Xr({state:e}){let t=Me(),[n,r]=(0,lt.useState)(!1);(0,lt.useEffect)(()=>{e!=="unknown"&&r(!0)},[e]);let a=e==="granted"?(0,we.jsx)(Ur,{}):e==="denied"?(0,we.jsx)(Tr,{}):(0,we.jsx)(jr,{});return(0,we.jsxs)("div",{role:n?"status":void 0,className:`sekyro-permission sekyro-permission--${e}`,"data-testid":"sekyro-permission","data-state":e,children:[(0,we.jsx)("span",{className:"sekyro-permission__icon","aria-hidden":"true",children:a}),(0,we.jsx)("span",{children:t(`capture.permission.${e}`)})]})}o(Xr,"On");s(Xr,"PermissionRow");function Jr({voice:e}){let t=Me();if(!e.supported)return null;let n=e.enabled;return(0,Se.jsxs)("button",{type:"button",role:"switch","aria-checked":n,className:"sekyro-switch","data-testid":"sekyro-voice-switch",onClick:o(()=>e.toggle(),"onClick"),children:[(0,Se.jsxs)("span",{className:"sekyro-switch__label",children:[(0,Se.jsx)(nt,{off:!n}),t("capture.voiceGuidance")]}),(0,Se.jsx)("span",{className:"sekyro-switch__track","aria-hidden":"true",children:(0,Se.jsx)("span",{className:"sekyro-switch__thumb",children:n?(0,Se.jsx)(Or,{className:"sekyro-switch__check"}):null})})]})}o(Jr,"Hn");s(Jr,"VoiceSwitch");function en({assets:e,onRetryAssets:t,permission:n,captureMode:r="self",voice:a,tips:l,summary:c,startLabel:d,startDisabled:S,onStart:p}){let w=Me(),N=(0,X.useRef)(c?.stop);N.current=c?.stop,(0,X.useEffect)(()=>()=>N.current?.(),[]);let j=(0,X.useRef)(null),R=(0,X.useRef)(null),B=(0,X.useRef)(null),q=(0,X.useRef)(e),A=(0,X.useRef)(!1);(0,X.useEffect)(()=>{let u=q.current;if(q.current=e,u===e)return;let M=A.current;e!=="loading"&&(A.current=!1),tn(j.current)&&(e==="failed"?B.current?.focus():M&&R.current?.focus())},[e]);let J=(0,X.useCallback)(()=>{A.current=!0,t()},[t]),h=e==="loading",x=h||S,_=(0,X.useCallback)(()=>{x||(N.current?.(),p())},[x,p]),k;return e==="failed"?k=(0,P.jsxs)(le,{tone:"danger",testId:"sekyro-assets-error",children:[(0,P.jsx)("p",{className:"sekyro-text-body",children:w("fcv2.err.models")}),(0,P.jsx)(te,{kind:"ghost",ref:B,className:"sekyro-btn--start",onClick:J,"data-testid":"sekyro-assets-retry",children:w("common.retry")})]}):k=(0,P.jsxs)("div",{className:"sekyro-stack sekyro-stack--1",children:[(0,P.jsx)(te,{ref:R,full:!0,"data-testid":"sekyro-start","aria-disabled":x?"true":void 0,"aria-busy":h?"true":void 0,onClick:_,children:h?(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(Pr,{}),w("capture.preparing.title")]}):d??w("capture.start")}),h?(0,P.jsx)("p",{className:"sekyro-text-muted",children:w("capture.preparing.hint")}):null]}),(0,P.jsxs)("div",{ref:j,className:"sekyro-stack sekyro-stack--4","data-testid":"sekyro-intro","data-assets":e,children:[r==="assisted"?(0,P.jsxs)("div",{className:"sekyro-stack sekyro-stack--1","data-testid":"sekyro-assisted-intro",children:[(0,P.jsx)("h2",{className:"sekyro-text-body",children:w("capture.assisted.title")}),(0,P.jsx)("p",{className:"sekyro-text-muted",children:w("capture.assisted.lead")})]}):null,l!==!1?(0,P.jsx)(Br,{tips:l}):null,c!==void 0?(0,P.jsxs)(te,{kind:"ghost",className:"sekyro-btn--start",onClick:c.toggle,"data-testid":"sekyro-tips-listen",children:[(0,P.jsx)(nt,{off:!1}),w(c.playing?"capture.tips.stop":"capture.tips.listen")]}):null,(0,P.jsx)(Xr,{state:n}),(0,P.jsx)(Jr,{voice:a}),(0,P.jsx)("p",{className:"sekyro-text-muted",children:w("capture.securityNote")}),k,(0,P.jsx)("p",{role:"status",className:"sekyro-visually-hidden","data-testid":"sekyro-intro-status",children:e==="loading"?w("capture.preparing.title"):e==="ready"?w("capture.ready"):""})]})}o(en,"Fn");s(en,"PreCaptureScreen");function tn(e){if(typeof document>"u")return!1;let t=document.activeElement;return t===null||t===document.body||e!==null&&e.contains(t)}o(tn,"Hr");s(tn,"focusIsOurs");function rn(){let[e,t]=(0,it.useState)({state:"unknown",settled:!1});return(0,it.useEffect)(()=>lr(n=>t({state:n,settled:!0})),[]),{permission:e.state,permissionSettled:e.settled}}o(rn,"Dn");s(rn,"useCameraStatus");function nn(e){return It(e,"mobileRequired")}o(nn,"qn");s(nn,"useMobileRequired");function sn(e){return It(e,"returning").required}o(sn,"jn");s(sn,"useReturning");function It(e,t){let[n,r]=(0,pe.useState)({required:!1,settled:e===void 0});return(0,pe.useEffect)(()=>{let a=e?.[t];if(e===void 0||typeof a!="function"){r({required:!1,settled:!0});return}let l=!0;return r({required:!1,settled:!1}),Promise.resolve().then(()=>a.call(e)).then(c=>{l&&r({required:c===!0,settled:!0})},()=>{l&&r({required:!1,settled:!0})}),()=>{l=!1}},[e,t]),n}o(It,"Yn");s(It,"useFlag");function an(e){let t=s(()=>e?.captureChoice??null,"initialChoice"),[n,r]=(0,pe.useState)(()=>({session:"self",choice:t(),settled:e===void 0}));(0,pe.useEffect)(()=>{let l=e?.captureMode,c=e?.captureChoice??null;if(e===void 0||typeof l!="function"){r({session:"self",choice:c,settled:!0});return}let d=!0;return r({session:"self",choice:c,settled:!1}),Promise.resolve().then(()=>l.call(e)).then(S=>{let p=e.captureChoice??null;d&&r({session:p!==null&&S===p?"choice":S==="assisted"||S==="choice"?S:"self",choice:p,settled:!0})},()=>{d&&r({session:"self",choice:null,settled:!0})}),()=>{d=!1}},[e]);let a=(0,pe.useCallback)(l=>{e?.chooseCaptureMode?.(l),r(c=>({...c,choice:l}))},[e]);return{mode:n.session==="choice"?n.choice??"self":n.session==="assisted"?"assisted":"self",session:n.session,choice:n.choice,settled:n.settled,choose:a}}o(an,"$n");s(an,"useCaptureMode");function on(e){let[t,n]=(0,pe.useState)(!1);return(0,pe.useEffect)(()=>{if(n(!1),e===void 0)return;let r=e.on("busy",()=>n(!0)),a=e.on("result",()=>n(!1));return()=>{r(),a()}},[e]),t}o(on,"zn");s(on,"useBusy");var Dn=s(()=>"idle","serverSnapshot");function Nt(e){return ir(e!==void 0?{assetBaseUrl:e}:{})}o(Nt,"Qn");s(Nt,"preload");function ln(e,t=!0){let n=(0,Q.useSyncExternalStore)((0,Q.useCallback)(p=>ur(p,e),[e]),()=>cr(e),Dn),[r,a]=(0,Q.useState)(null),l=(0,Q.useRef)(!1),c=(0,Q.useCallback)(()=>{Nt(e).then(p=>{l.current&&p==="idle"&&a({base:e})})},[e]);(0,Q.useEffect)(()=>(l.current=!0,c(),()=>{l.current=!1}),[c]);let d=(0,Q.useRef)(null);(0,Q.useEffect)(()=>{if(n!=="idle"){d.current={base:e};return}!t||d.current===null||d.current.base!==e||(d.current=null,c())},[n,e,c,t]);let S=(0,Q.useCallback)(()=>{Nt(e)},[e]);return{gate:r!==null&&r.base===e&&n==="idle"||n==="ready"?"ready":n==="failed"?"failed":"loading",retry:S}}o(ln,"Jn");s(ln,"useLivenessAssets");var Rr={progress:0,hint:null,faceDetected:!1};function cn(e){let{videoRef:t,assetBaseUrl:n}=e,r=(0,E.useRef)(e.verification).current,a=(0,E.useRef)(!1);e.verification!==r&&!a.current&&Lt()&&(a.current=!0,console.warn("[@sekyro/react] <LivenessCapture>: the `verification` prop changed identity after mount. The first instance stays bound (the camera is not rebuilt); create the verification once (useMemo / useState / outside render) instead of on every render."));let l=(0,E.useRef)(null),[c,d]=(0,E.useState)("idle"),[S,p]=(0,E.useState)(Rr),[w,N]=(0,E.useState)(!1),[j,R]=(0,E.useState)(!1),[B,q]=(0,E.useState)(null),[A,J]=(0,E.useState)(!1),[h,x]=(0,E.useState)(null),[_,k]=(0,E.useState)(null),[u,M]=(0,E.useState)(null),[I,D]=(0,E.useState)(null),[i,T]=(0,E.useState)(null),[O,z]=(0,E.useState)(!1),H=(0,E.useRef)(null),ge=(0,E.useRef)("idle"),he=(0,E.useRef)(-1),[Y,W]=(0,E.useState)(0),ne=(0,E.useRef)(e);ne.current=e,(0,E.useEffect)(()=>{let ee=t.current;if(ee===null)return;let ue={video:ee,...n!==void 0?{assetBaseUrl:n}:{}},F=r!==void 0?r.liveness(ue):dr(ue);l.current=F;let Ne=s(()=>T(F.facingMode??null),"readFacing");Ne();let $e=[F.on("state",b=>{b==="mode_switch"?z(!0):b!=="starting"&&b!=="gating"&&z(!1),b==="starting"?(ge.current!=="starting"&&(he.current+=1,W(Math.max(0,he.current))),k(null),M(null),p(Rr),R(!1),N(!1),q(null),x(null),H.current=null):b==="gating"&&ge.current==="recording"&&(R(!1),N(!1),q(null),H.current=null),ge.current=b,Ne(),d(b),ne.current.onStateChange?.(b)}),F.on("gate",b=>{let ke=H.current;H.current=b.progress,N(ke!==null&&b.progress<ke-.001&&b.progress>0&&b.progress<1),b.progress>=1&&R(!0),p(b)}),F.on("frozen",({previewDataUrl:b})=>q(b)),F.on("profile",({animations:b})=>J(b==="reduced")),F.on("ramp",({colour:b})=>x(b)),F.on("captured",b=>{k(b),D(null),ne.current.onCaptured?.(b)}),F.on("error",b=>{M(b);let ke=r?.reportCaptureIssue;ke!==void 0&&Ct(Le=>ke.call(r,Le),xr("liveness",b,Math.max(0,he.current))),ne.current.onError?.(b)}),r?.on("result",b=>{D(b),ne.current.onResult?.(b)})];return()=>{for(let b of $e)b?.();l.current=null,F.destroy()}},[r,t,n]);let L=(0,E.useCallback)(()=>{l.current?.start()},[]),xe=(0,E.useCallback)(()=>{l.current?.retry()},[]),ve=(0,E.useCallback)(async()=>{let ee=l.current;return ee===null||typeof ee.canSwitchCaptureMode!="function"?!1:await ee.canSwitchCaptureMode().catch(()=>!1)===!0},[]),V=(0,E.useCallback)(async ee=>{let ue=l.current;if(ue===null||typeof ue.setCaptureMode!="function")return!1;let F=await ue.setCaptureMode(ee).catch(()=>!1)===!0;return F&&T(ue.facingMode??null),F},[]);return{state:c,gate:S,draining:w,gateLocked:j,frozenPreview:B,reduceMotion:A,rampColour:h,artifacts:_,error:u,result:I,facingMode:i,start:L,retry:xe,canSwitchCaptureMode:ve,setCaptureMode:V,modeRestarted:O,attempt:Y}}o(cn,"er");s(cn,"useLivenessHandle");var Hn=new Set(["national_number"]);function Rt(e){if(e==null||!e.available||e.selected!==null)return null;let t=e.options.filter(n=>Hn.has(n));return t.length>0?{...e,options:t}:null}o(Rt,"tr");s(Rt,"pending");function un(e){let[t,n]=(0,me.useState)(null),[r,a]=(0,me.useState)(e===void 0),[l,c]=(0,me.useState)(!1),[d,S]=(0,me.useState)(!1);(0,me.useEffect)(()=>{if(n(null),e===void 0){a(!0);return}let N=!0,j=e.methodChoice;typeof j=="function"?(a(!1),Promise.resolve().then(()=>j.call(e)).then(B=>{N&&n(Rt(B))},()=>{}).finally(()=>{N&&a(!0)})):a(!0);let R=e.on("method",B=>n(Rt(B)));return()=>{N=!1,R()}},[e]);let p=(0,me.useCallback)(async N=>{if(e===void 0)return!1;c(!0),S(!1);try{return await e.selectMethod(N),n(null),!0}catch{return S(!0),!1}finally{c(!1)}},[e]),w=t!==null&&t.options.length===1?t.options[0]:null;return{choice:t,auto:w==="national_number"&&!d?w:null,settled:r,busy:l,failed:d,select:p}}o(un,"nr");s(un,"useMethodChoice");var $n=["ar","fr","en"];function dn(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}}o(dn,"io");s(dn,"isClipUrl");function pn(e){let t=e.clips;if(typeof t!="object"||t===null)return null;let n={};for(let r of $n){let a=t[r];if(!(typeof a!="object"||a===null))for(let[l,c]of Object.entries(a))!st(l)||!dn(c)||((n[r]??(n[r]={}))[l]=c)}return Object.keys(n).length>0?n:null}o(pn,"ao");s(pn,"toVoiceClipMap");function hn(e){let[t,n]=(0,Te.useState)(null);(0,Te.useEffect)(()=>{if(n(null),e===void 0)return;let a=!0,l=s(d=>{if(!a)return;let S=typeof d=="object"&&d!==null&&typeof d.setId=="string"?d:null;n(p=>p?.setId===S?.setId?p:S)},"take");try{typeof e.voiceClips=="function"&&Promise.resolve(e.voiceClips()).then(l,()=>l(null))}catch{l(null)}let c=e.on("view",d=>l(d.voice));return()=>{a=!1,c()}},[e]);let r=(0,Te.useMemo)(()=>t!==null?pn(t):null,[t]);return e===void 0?null:r}o(hn,"rr");s(hn,"useServerVoiceClips");function fn({voice:e}){let t=Me();return(0,At.jsx)(te,{kind:"chip","aria-pressed":e.enabled,"aria-label":t("capture.voiceGuidance"),"data-testid":"sekyro-voice-toggle",onClick:o(()=>e.toggle(),"onClick"),children:(0,At.jsx)(nt,{off:!e.enabled,className:"sekyro-icon"})})}o(fn,"sr");s(fn,"VoiceChip");var Fn=new Set(["abandoned","not_opened","cancelled","superseded"]),Gn=800,Kn="capture.lookAtColours";function mn(e){return e===void 0||e!==!1&&e.length===wt.length&&wt.every(t=>e.includes(t))}o(mn,"mo");s(mn,"isDefaultTips");function yn(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}o(yn,"yo");s(yn,"carriesActivation");function gn(e){return typeof e=="object"&&e!==null&&!(0,m.isValidElement)(e)&&"tone"in e&&"text"in e}o(gn,"go");s(gn,"isNoticeObject");var Zn=new Set(["nni_unbound","id_number_unbound","method_required","mobile_required","portrait_required"]);function vn(e){return e==="starting"||e==="gating"||e==="recording"||e==="mode_switch"}o(vn,"vo");s(vn,"isCapturing");function kn(e){return e==="captured"||e==="uploading"||e==="checking"}o(kn,"Co");s(kn,"isPostCapture");function zn({verification:e,locale:t,dir:n,strings:r,slots:a,autoStart:l=!1,notice:c,startDisabled:d=!1,startLabel:S,tips:p,tipsSummary:w,coach:N,voice:j,onGuidance:R,onCaptured:B,onResult:q,onError:A,onStateChange:J,assetBaseUrl:h,className:x}){let _=gr(t),k=(0,m.useMemo)(()=>yr(t,r),[t,r,_]),u=(0,m.useMemo)(()=>g=>k[g]??"",[k]),M=n??(t==="ar"?"rtl":"ltr"),I=(0,m.useRef)(null),D=(0,m.useContext)(Vn),i=cn({verification:e,videoRef:I,assetBaseUrl:h,onCaptured:B,onResult:q,onError:A,onStateChange:J}),T=ln(h,i.state==="idle"&&i.error===null),O=un(e),z=O.choice!==null,H=nn(e),ge=sn(e),he=on(e),Y=rn(),W=an(e),ne=W.session==="choice",L=W.mode==="assisted",xe=j!==!1&&j?.clips===void 0,ve=hn(xe?e:void 0),V=Zr({locale:t,defaultClips:ve,options:j}),ee=L?"environment":"user",ue=W.settled,F=(0,m.useRef)(null),Ne=(0,m.useRef)(!1),$e=(0,m.useRef)(V.unlock);$e.current=V.unlock,(0,m.useEffect)(()=>{let g=F.current;if(g===null)return;let oe=["pointerup","touchend","click","keydown"],_e=s(()=>{for(let qe of oe)g.removeEventListener(qe,Ae,!0)},"disarm");function Ae(qe){if(Ne.current){_e();return}yn(qe)&&(Ne.current=!0,_e(),$e.current())}o(Ae,"Re"),s(Ae,"onGesture");for(let qe of oe)g.addEventListener(qe,Ae,{capture:!0,passive:!0});return _e},[]);let b=(0,m.useCallback)(()=>{Ne.current||(Ne.current=!0,V.unlock()),i.start()},[V.unlock,i.start]),ke=(0,m.useCallback)(()=>i.start(),[i.start]),Le=(0,m.useRef)(!1),Oe=i.state==="idle"&&i.error===null,jt=!z&&!H.required&&(l===!0||l==="when-permitted"&&Y.permission==="granted"),Tt=jt&&O.settled&&H.settled&&ue,_n=l==="when-permitted"&&!Y.permissionSettled&&!Le.current,Ot=jt&&Oe&&!Le.current,ut=(_n||Ot||!ue)&&T.gate==="ready"?"loading":T.gate;(0,m.useEffect)(()=>{!Tt||!Oe||T.gate!=="ready"||Le.current||(Le.current=!0,ke())},[Tt,Oe,T.gate,ke]);let wn=Oe&&!z&&!H.required&&!(Ot&&T.gate==="ready"),[Pt,Bt]=(0,m.useState)(!1),{canSwitchCaptureMode:qt,setCaptureMode:Vt}=i;(0,m.useEffect)(()=>{if(!W.settled||!ne){Bt(!1);return}let g=!0;return qt().then(oe=>{g&&Bt(oe)}),()=>{g=!1}},[W.settled,ne,qt]);let{choose:Dt}=W,Ie=L?"self":"assisted",Sn=(0,m.useCallback)(async()=>{await Vt(Ie)&&Dt(Ie)},[Vt,Dt,Ie]),Ht=i.state!=="idle"&&i.facingMode!==null?i.facingMode:ee;(0,m.useEffect)(()=>{let g=I.current?.style;Ht==="user"?g?.removeProperty("transform"):g&&(g.transform="none")},[Ht]);let Fe=(0,m.useMemo)(()=>i.artifacts!==null&&typeof URL.createObjectURL=="function"?URL.createObjectURL(i.artifacts.keyframe):null,[i.artifacts]);(0,m.useEffect)(()=>{if(Fe!==null)return()=>URL.revokeObjectURL(Fe)},[Fe]);let $t=i.frozenPreview??Fe,Ue=e!==void 0,Z=vn(i.state),be=kn(i.state),Ge=Z||be,se=i.result,Ft=i.state==="done"&&se!==null,Ke=Z&&i.rampColour!==null,dt=i.state==="recording"&&i.frozenPreview!==null&&!Ke,Ze=D!==null,Gt=Pt&&Z&&!dt?{to:Ie,label:u(Ie==="assisted"?"capture.modeSwitch.toAssisted":"capture.modeSwitch.toSelf"),description:u(Ie==="assisted"?"capture.modeSwitch.toAssistedLabel":"capture.modeSwitch.toSelfLabel"),onSwitch:s(()=>{Sn()},"onSwitch")}:null,ze=i.modeRestarted&&Z?u("capture.modeSwitch.restarted"):null,Pe=be||dt,Kt=be?"checking":dt?"frozen":i.state==="recording"||Ke?"recording":i.gateLocked||i.gate.progress>=1?"locked":i.gate.faceDetected?"aligning":"seeking",Ye=Z?i.gate.hint:null,We=i.state==="starting"?"capture.preparing.title":Ye===null?null:Ye==="center"&&!i.gate.faceDetected?"fcv3.no_face":pr(Ye),[xn,Zt]=(0,m.useState)(null);(0,m.useEffect)(()=>{if(We!=="fcv3.no_face"){Zt(We);return}if(!Z)return;let g=setTimeout(()=>Zt(We),Gn);return()=>clearTimeout(g)},[We,Z]);let pt=Z&&!Ke&&typeof N=="string"&&N!=="",zt=L&&Z?u("capture.assisted.stage"):null,Re=Z&&!pt?Ke?Kn:xn:null,ht=pt?N:Re===null?"":u(Re);zr(V,Re,ht,Z);let Yt=(0,m.useRef)(R);Yt.current=R,(0,m.useEffect)(()=>{if(st(Re))try{Yt.current?.(Re)}catch(g){console.error("[@sekyro/react] onGuidance threw:",g)}},[Re]);let Be=(0,m.useMemo)(()=>({supported:V.supported,enabled:V.enabled,setEnabled:V.setEnabled,toggle:V.toggle}),[V.supported,V.enabled,V.setEnabled,V.toggle]),ft=a?.voicePrompt,Wt=ft!==void 0,Qt=j===void 0,Xt=(0,m.useRef)(!1);(0,m.useEffect)(()=>{!Wt||!Qt||Xt.current||!Lt()||(Xt.current=!0,console.warn("[@sekyro/react] <LivenessCapture>: `slots.voicePrompt` is set and `voice` is undefined, so the component speaks the guidance itself. If your slot plays audio, pass voice={false} or the person hears every hint twice; pass voice={{}} to keep the built-in voice and silence this warning."))},[Wt,Qt]);let Nn=ft!==void 0?(g,oe,_e)=>ft(g,oe,_e,Be):V.supported?()=>(0,v.jsx)(fn,{voice:Be}):void 0,{summary:mt,summaryPlaying:Jt,toggleSummary:er,stopSummary:tr}=V,Qe=w!==void 0&&w!=="",rr=Qe?w:u("capture.tips.summary"),nr=Qe?mt!=="none":mt==="partner"||mt==="default"&&mn(p),Rn=(0,m.useMemo)(()=>nr?{playing:Jt,toggle:s(()=>er(rr,{clip:!Qe}),"toggle"),stop:tr}:void 0,[nr,Jt,er,rr,tr,Qe]),An=(0,m.useMemo)(()=>({assets:ut,retryAssets:T.retry,permission:Y.permission,permissionSettled:Y.permissionSettled,captureMode:W.mode,facing:ee,voice:Be}),[ut,T.retry,Y.permission,Y.permissionSettled,W.mode,ee,Be]),Mn=gn(c)?(0,v.jsx)(le,{tone:c.tone,testId:"sekyro-host-notice",children:(0,v.jsx)("span",{children:c.text})}):c??null,ae=se!==null&&se.status==="retry"?se:null,G=Ft&&se.status==="unavailable"&&!z&&se.reasonCode!=="portrait_required"?se:null,Ce=Ft&&(se.status==="verified"||se.status==="not_verified"||se.status==="review")?se:null,yt=s((g,oe)=>{if(g===void 0)return null;if(g==="device_cooldown"){let Ae=fr(t,oe);if(Ae!==null)return u(Ae.key).replace("{time}",Ae.time)}let _e=et(g);return _e===null?null:u(_e)},"reasonText"),gt=s(g=>{let oe=g.retakeHint===void 0?null:Je(g.retakeHint);return oe===null?yt(g.reasonCode):u(oe)},"retryText"),sr=Ce===null?null:yt(Ce.reasonCode,Ce.retryAfter)??(Ce.status==="not_verified"&&Ce.reason!==void 0&&Fn.has(Ce.reason)?u("errors.session_expired"):null),En=G!==null&&G.reasonCode!==void 0&&G.reasonCode!=="nni_unbound"&&G.reasonCode!=="id_number_unbound"&&G.reasonCode!=="method_required"&&G.reasonCode!=="mobile_required"&&!(G.reasonCode==="no_recorder"&&i.artifacts?.degraded==="NO_RECORDER"),Xe=G?.reasonCode,ar=i.attempt;(0,m.useEffect)(()=>{G===null||Xe===void 0||e?.reportCaptureIssue===void 0||Zn.has(Xe)||Ct(g=>e.reportCaptureIssue?.(g),{check:"liveness",kind:"unavailable",phase:"upload",engineKind:Xe,attempt:Math.min(1e3,ar)})},[G,Xe,ar,e]);let or=bt(),Ln=z&&O.auto===null&&!Z&&!be&&i.error===null,vt=(0,m.useCallback)(async g=>{await O.select(g)&&i.state==="done"&&i.retry()},[O.select,i.state,i.retry]);return(0,m.useEffect)(()=>{O.auto!==null&&!O.busy&&!Z&&!be&&vt(O.auto)},[O.auto,O.busy,Z,be,vt]),(0,v.jsx)(vr,{value:u,children:(0,v.jsxs)("div",{ref:F,className:x===void 0?"sekyro-capture":`sekyro-capture ${x}`,dir:M,lang:t,"data-testid":"sekyro-liveness-capture","data-state":i.state,children:[a?.header,ae!==null&&gt(ae)!==null&&!(Ze&&Ge)?(0,v.jsx)(le,{tone:"warning",role:"status",testId:"sekyro-retry-notice",children:(0,v.jsx)("span",{children:gt(ae)})}):null,ze!==null&&!Ze?(0,v.jsx)(le,{tone:"info",role:"status",testId:"sekyro-mode-switch-status",children:(0,v.jsx)("span",{children:ze})}):null,he&&be&&!Ze?(0,v.jsx)(le,{tone:"info",role:"status",testId:"sekyro-busy-notice",children:(0,v.jsx)("span",{children:u("capture.busy")})}):null,H.required&&Oe?(0,v.jsx)(le,{tone:"info",role:"status",testId:"sekyro-mobile-required",children:(0,v.jsx)("span",{children:u("reasons.mobile_required")})}):null,i.error!==null?a?.errorPanel!==void 0?a.errorPanel(i.error,i.retry):(0,v.jsxs)(le,{tone:"danger",testId:"sekyro-error-notice",children:[(0,v.jsx)("span",{children:u(hr(i.error))}),i.error.retryable?(0,v.jsx)(te,{ref:or,kind:"ghost",className:"sekyro-btn--start",onClick:i.retry,children:u("common.retry")}):null]}):null,G!==null?(0,v.jsxs)(le,{tone:"danger",testId:"sekyro-unavailable-notice",children:[(0,v.jsx)("span",{children:(G.reasonCode==="attestation"&&G.attestationError==="clock_wrong"?u("errors.device_clock"):yt(G.reasonCode))??u(G.reasonCode===void 0?"errors.session_expired":"errors.network_error")}),En?(0,v.jsx)(te,{ref:or,kind:"ghost",className:"sekyro-btn--start",onClick:i.retry,children:u(G.reasonCode==="attestation"?"common.retry":"capture.recordAgain")}):null]}):null,sr!==null&&Ce!==null?(0,v.jsx)(le,{tone:Ce.status==="not_verified"?"danger":"info",testId:"sekyro-result-notice",children:(0,v.jsx)("span",{children:sr})}):null,(0,v.jsx)("div",{className:Ge?void 0:"sekyro-hidden","data-capture-live":Ge?"":void 0,children:Ze?D({videoRef:I,guidance:Pe&&Ue?u("capture.checking"):ht,coached:pt&&!(Pe&&Ue),note:Pe?Ue?u(he?"capture.busy":"capture.checkingHint"):null:ze??(ae!==null?gt(ae):zt),settled:Pe&&Ue,progress:i.gate.progress,phase:Kt,still:Pe?$t:null,live:Ge,modeSwitch:Gt,...Pt?{status:ze}:{},ramp:i.rampColour===null?null:{colour:i.rampColour}}):(0,v.jsx)(kr,{videoRef:I,guidanceText:ht,guidanceHint:Ye,guidanceKey:Re,progress:i.gate.progress,phase:Kt,draining:i.draining,stillUrl:$t,showChecking:Ue,operatorText:zt,voicePrompt:Nn,overlay:o(g=>(0,v.jsxs)(v.Fragment,{children:[a?.stageOverlay?.(g),(0,v.jsx)(br,{colour:i.rampColour})]}),"overlay"),reduceMotion:i.reduceMotion,modeSwitch:Gt})}),Ln&&O.choice!==null?(0,v.jsx)(qr,{title:u("method.title"),description:u("method.description"),options:O.choice.options.map(g=>({id:g,label:u(`method.${g}`)})),busy:O.busy,error:O.failed?u("errors.network_error"):null,focus:i.state==="done",testId:"sekyro-method",look:"buttons",onChoose:o(g=>{vt(g)},"onChoose")}):null,wn?(0,v.jsxs)(v.Fragment,{children:[ge&&a?.header===void 0&&a?.intro===void 0?(0,v.jsxs)("div",{className:"sekyro-stack sekyro-stack--1",children:[(0,v.jsx)("h2",{className:"sekyro-text-body",children:u("returning.title")}),(0,v.jsx)("p",{className:"sekyro-text-muted",children:u("returning.description")})]}):null,Mn,a?.intro!==void 0?a.intro(b,An):(0,v.jsx)(en,{assets:ut,onRetryAssets:T.retry,permission:Y.permission,captureMode:W.mode,voice:Be,tips:p??wt,summary:Rn,startLabel:S,startDisabled:d,onStart:b})]}):null,(0,v.jsx)(Wr,{showCoaching:ae!==null,coaching:ot(ae?.reasonCode,ae?.retakeHint),attemptsText:ae?.attemptsRemaining!==void 0?mr(k,t,ae.attemptsRemaining):null,showRetake:ae!==null&&!Z&&!be||!Ue&&i.state==="captured",onRetake:i.retry}),a?.footer]})})}o(zn,"Ei");s(zn,"LivenessCapture");var Ut=U(K(),1),ct=U(K(),1),f=U(de(),1);var _s={document:"card",population_registry:"id",national_eid:"smartphone",phone_otp:"phone",email_otp:"email"},ws={population_registry:"hashtag",national_eid:"key"};function Yn(e,t){switch(e.service){case"document":return t.t("method.document_photo");case"population_registry":return t.t("method.national_number");case"national_eid":{let n=e.nationalEid?.providerName;return n?t.t("method.national_eid",{provider:n}):t.t("method.national_eidGeneric")}default:return null}}o(Yn,"D");s(Yn,"identityLabel");function Wn(e,t){let[n,r]=(0,Ut.useState)(!1),[a,l]=(0,Ut.useState)(null);return{busy:n,error:a,run:s(c=>{r(!0),l(null),c().then(()=>r(!1),d=>{r(!1),l(e.t(Nr(d,e.strings))),t?.(d)})},"run")}}o(Wn,"q");s(Wn,"useChoiceAction");function bn(){let e=`sekyro-face-light-${(0,ct.useId)().replace(/[^A-Za-z0-9_-]/g,"")}`;return(0,f.jsxs)("svg",{className:"sekyro-mark sekyro-mark--face",viewBox:"0 0 168 206","aria-hidden":"true",focusable:"false",children:[(0,f.jsx)("defs",{children:(0,f.jsx)("mask",{id:e,children:(0,f.jsx)("ellipse",{className:"sekyro-mark__arc",cx:"84",cy:"103",rx:"76",ry:"95",pathLength:"1",fill:"none",stroke:"#fff",strokeWidth:"16"})})}),(0,f.jsx)("ellipse",{cx:"84",cy:"103",rx:"64",ry:"83",fill:"none",className:"sekyro-mark__line"}),(0,f.jsx)("path",{className:"sekyro-mark__face",d:"M68 64v10M100 64v10M84 66v25q0 2-6 1M60 108q24 18 48 0"}),(0,f.jsx)("ellipse",{className:"sekyro-mark__ticks",cx:"84",cy:"103",rx:"76",ry:"95",pathLength:"56"}),(0,f.jsx)("ellipse",{className:"sekyro-mark__ticks sekyro-mark__ticks--light",cx:"84",cy:"103",rx:"76",ry:"95",pathLength:"56",mask:`url(#${e})`})]})}o(bn,"O");s(bn,"FaceMark");var Qn={glasses:"jGlasses",lighting:"light",faceCamera:"camera"};function Xn(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}}o(Xn,"ne");s(Xn,"faceIntroRetryOf");var Jn={"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 es({start:e,context:t,tips:n,tipsTitle:r,human:a=!1,returning:l=!1,notice:c,retry:d}){let S=_t(),{t:p}=S,w=d===void 0?"face":ot(d.reason,d.retakeHint),N=w==="face"?null:He[w].tips,j=(0,ct.useContext)(_r)?.busy===!0;return(0,f.jsxs)("section",{className:"sekyro-step",children:[(0,f.jsx)(bn,{}),t.captureMode==="assisted"?(0,f.jsx)(tt,{title:p("capture.assisted.heading"),lead:p("capture.assisted.lead")}):l?(0,f.jsx)(tt,{title:p("returning.heading"),lead:p("returning.description")}):(0,f.jsx)(tt,{title:p(a?"native.face.humanIntroTitle":"native.face.introTitle"),lead:p(a?"native.face.humanIntroLead":"native.face.introLead")}),d!==void 0?(0,f.jsx)(Cn,{retry:d,title:He[w].title}):null,r!==void 0&&N===null?(0,f.jsx)("p",{className:"sekyro-section-label",children:r}):null,(0,f.jsx)("ul",{className:"sekyro-tiprows",children:N!==null?N.map(R=>(0,f.jsxs)("li",{children:[(0,f.jsx)(Ee,{name:Jn[R]??"face"}),p(R)]},R)):n!==void 0?n.map(R=>(0,f.jsxs)("li",{children:[(0,f.jsx)(Ee,{name:Qn[R.id]??"face"}),R.text]},R.id)):(0,f.jsxs)(f.Fragment,{children:[(0,f.jsxs)("li",{children:[(0,f.jsx)(Ee,{name:"light"}),p("capture.tips.light")]}),(0,f.jsxs)("li",{children:[(0,f.jsx)(Ee,{name:"jGlasses"}),p("capture.tips.uncover")]}),(0,f.jsxs)("li",{children:[(0,f.jsx)(Ee,{name:"smartphone"}),p("capture.tips.eyeLevel")]})]})}),c??null,c!==void 0?null:t.assets==="failed"?(0,f.jsx)(te,{kind:"secondary",full:!0,onClick:t.retryAssets,children:p("common.retry")}):null,c!==void 0?null:(0,f.jsx)(Cr,{children:(0,f.jsxs)(te,{full:!0,disabled:t.assets!=="ready"||j,"aria-busy":t.assets==="loading"||void 0,onClick:e,children:[(0,f.jsx)(Ee,{name:"camera"}),p("capture.start")]})})]})}o(es,"re");s(es,"FaceIntro");var ts=new Set(["match_inconclusive","no_face_source","below_threshold"]);function Cn({retry:e,title:t}){let n=_t(),r=e.retakeHint===void 0?null:Je(e.retakeHint),a=e.reason==="probe_not_from_liveness"?"capture.retrySamePerson.message":ts.has(e.reason)?"capture.retryMatch.message":et(e.reason);return(0,f.jsxs)(wr,{tone:"warning",children:[r!==null?(0,f.jsx)("span",{children:n.t(r)}):a!==null?(0,f.jsx)("span",{children:n.t(a)}):null,r===null?(0,f.jsx)("span",{children:n.t(t)}):null,(0,f.jsx)("span",{children:Sr(n,e.attemptsRemaining,e.attemptsExhausted)})]})}o(Cn,"K");s(Cn,"RetryNotice");function rs(e){return kt(e)}o(rs,"ce");s(rs,"isInAppBrowser");function ns(e,t){let n=t??(typeof navigator>"u"?"":String(navigator.userAgent??""));if(!/Android/i.test(n))return null;let r;try{r=new URL(e)}catch{return null}if(r.protocol!=="https:"&&r.protocol!=="http:")return null;let a=r.protocol.slice(0,-1);return`intent://${r.host}${r.pathname}${r.search}#Intent;scheme=${a};action=android.intent.action.VIEW;S.browser_fallback_url=${encodeURIComponent(e)};end`}o(ns,"le");s(ns,"androidBrowserIntent");export{qr as a,Lt as b,Vn as c,an as d,zn as e,_s as f,ws as g,Yn as h,Wn as i,Xn as j,es as k,rs as l,ns as m};
1
+ import{a as Nr}from"./chunk-QAZ7TATZ.js";import{c as _t}from"./chunk-NU2VUYVN.js";import{b as kr,d as br}from"./chunk-NUIGLBFF.js";import{b as xr,c as Ct}from"./chunk-QFCNXANK.js";import{a as yr,b as gr,c as vr,d as Me}from"./chunk-MLNUIPVU.js";import{G as _r,L as wr,M as Sr,a as K,b as de,c as te,m as pr,n as Je,p as hr,q as et,r as fr,s as mr,t as bt,u as le,v as Ee,w as tt,y as Cr}from"./chunk-CUFOLAZN.js";import{c as ir,d as cr,e as ur,h as dr}from"./chunk-4QUL7TEF.js";import{b as kt}from"./chunk-WICQIC37.js";import{a as s}from"./chunk-5QL6W6FW.js";import{g as lr}from"./chunk-6MYG4HWP.js";import{a as o,c as U}from"./chunk-4FHWXBOB.js";var Ar=U(K(),1),y=U(de(),1),re=U(de(),1),ye=U(K(),1),$=U(de(),1),C=U(K(),1),m=U(K(),1),at=U(K(),1),fe=U(de(),1),Qr=U(K(),1),X=U(K(),1),lt=U(K(),1),we=U(de(),1),Se=U(de(),1),P=U(de(),1);var it=U(K(),1),pe=U(K(),1);var Q=U(K(),1);var E=U(K(),1),me=U(K(),1),Te=U(K(),1),At=U(de(),1),v=U(de(),1);function ce({className:e,children:t}){return(0,y.jsx)("svg",{"aria-hidden":"true",focusable:"false",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",className:e??"sekyro-icon sekyro-icon--sm",children:t})}o(ce,"ne");s(ce,"Svg");var Mt="M4 7.5h2.2l1.4-1.9h8.8l1.4 1.9H20a1.6 1.6 0 0 1 1.6 1.6v8.3A1.6 1.6 0 0 1 20 19H4a1.6 1.6 0 0 1-1.6-1.6V9.1A1.6 1.6 0 0 1 4 7.5Z";function Mr(e){return(0,y.jsxs)(ce,{...e,children:[(0,y.jsx)("circle",{cx:"12",cy:"12",r:"4"}),(0,y.jsx)("path",{d:"M12 2.5v2M12 19.5v2M2.5 12h2M19.5 12h2M5.3 5.3l1.4 1.4M17.3 17.3l1.4 1.4M5.3 18.7l1.4-1.4M17.3 6.7l1.4-1.4"})]})}o(Mr,"ln");s(Mr,"SunIcon");function Er(e){return(0,y.jsxs)(ce,{...e,children:[(0,y.jsx)("circle",{cx:"12",cy:"12",r:"9"}),(0,y.jsx)("path",{d:"M9 10h.01M15 10h.01M8.8 14.6a4.2 4.2 0 0 0 6.4 0"})]})}o(Er,"un");s(Er,"FaceUncoveredIcon");function Lr(e){return(0,y.jsxs)(ce,{...e,children:[(0,y.jsx)("rect",{x:"7",y:"2.5",width:"10",height:"19",rx:"2"}),(0,y.jsx)("path",{d:"M10.5 18.5h3M2.5 9.5h2.5M19 9.5h2.5"}),(0,y.jsx)("circle",{cx:"12",cy:"9.5",r:"1.6"})]})}o(Lr,"dn");s(Lr,"PhoneEyeLevelIcon");function Ir(e){return(0,y.jsxs)(ce,{...e,children:[(0,y.jsx)("path",{d:"M2.5 12S6 5.5 12 5.5 21.5 12 21.5 12 18 18.5 12 18.5 2.5 12 2.5 12Z"}),(0,y.jsx)("circle",{cx:"12",cy:"12",r:"2.8"})]})}o(Ir,"pn");s(Ir,"LookStraightIcon");function Ur(e){return(0,y.jsxs)(ce,{...e,children:[(0,y.jsx)("path",{d:Mt}),(0,y.jsx)("path",{d:"M9 13l2 2 4-4"})]})}o(Ur,"fn");s(Ur,"CameraCheckIcon");function jr(e){return(0,y.jsxs)(ce,{...e,children:[(0,y.jsx)("path",{d:Mt}),(0,y.jsx)("path",{d:"M10.2 11.2a1.9 1.9 0 1 1 2.6 1.8c-.5.2-.8.6-.8 1.1v.3M12 16.4h.01"})]})}o(jr,"mn");s(jr,"CameraAskIcon");function Tr(e){return(0,y.jsxs)(ce,{...e,children:[(0,y.jsx)("path",{d:Mt}),(0,y.jsx)("path",{d:"M3 3l18 18"})]})}o(Tr,"yn");s(Tr,"CameraBlockedIcon");function nt({off:e,className:t}){return(0,y.jsxs)(ce,{className:t,children:[(0,y.jsx)("path",{d:"M4.5 9.5v5H8l4 3.5v-12L8 9.5H4.5Z"}),e?(0,y.jsx)("path",{d:"M4 4l16 16"}):(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)("path",{d:"M15.5 9.7a3.6 3.6 0 0 1 0 4.6"}),(0,y.jsx)("path",{d:"M18 7.6a6.6 6.6 0 0 1 0 8.8"})]})]})}o(nt,"Ve");s(nt,"SpeakerIcon");function Or(e){return(0,y.jsx)(ce,{...e,children:(0,y.jsx)("path",{d:"M5 12.5l4.5 4.5L19 7.5"})})}o(Or,"gn");s(Or,"CheckIcon");function Pr(e){return(0,y.jsxs)(ce,{className:e.className??"sekyro-spinner",children:[(0,y.jsx)("circle",{cx:"12",cy:"12",r:"9",opacity:"0.25"}),(0,y.jsx)("path",{d:"M21 12a9 9 0 0 0-9-9"})]})}o(Pr,"hn");s(Pr,"SpinnerIcon");var wt=["light","uncover","eyeLevel","straight"],In={light:{key:"capture.tips.light",icon:s(()=>(0,re.jsx)(Mr,{}),"icon")},uncover:{key:"capture.tips.uncover",icon:s(()=>(0,re.jsx)(Er,{}),"icon")},eyeLevel:{key:"capture.tips.eyeLevel",icon:s(()=>(0,re.jsx)(Lr,{}),"icon")},straight:{key:"capture.tips.straight",icon:s(()=>(0,re.jsx)(Ir,{}),"icon")}};function Br({tips:e}){let t=Me(),n=(0,Ar.useId)();return e.length===0?null:(0,re.jsxs)("section",{className:"sekyro-tips","aria-labelledby":n,"data-testid":"sekyro-tips",children:[(0,re.jsx)("p",{className:"sekyro-tips__title",id:n,children:t("capture.tips.title")}),(0,re.jsx)("ul",{className:"sekyro-tips__list",children:e.map(r=>{let a=typeof r=="string"?In[r]:void 0,l=typeof r=="string"?r:r.id,c=a!==void 0?a.icon():typeof r=="string"?void 0:r.icon,d=a!==void 0?t(a.key):typeof r=="string"?r:r.text;return(0,re.jsxs)("li",{className:"sekyro-tips__item",children:[c!=null?(0,re.jsx)("span",{className:"sekyro-tips__icon","aria-hidden":"true",children:c}):null,(0,re.jsx)("span",{children:d})]},l)})})]})}o(Br,"Cn");s(Br,"TipList");var Un=220;function qr({title:e,description:t,options:n,busy:r,error:a,focus:l,testId:c,look:d="cards",marked:S,onChoose:p}){let w=(0,ye.useId)(),N=bt(),[j,R]=(0,ye.useState)(null),B=(0,ye.useRef)(null);(0,ye.useEffect)(()=>{a!==null&&R(null)},[a]),(0,ye.useEffect)(()=>()=>{B.current!==null&&clearTimeout(B.current)},[]);let q=s(A=>{r||j!==null||(R(A),B.current=setTimeout(()=>{B.current=null,R(null),p(A)},Un))},"choose");return(0,$.jsxs)("section",{className:"sekyro-stack sekyro-stack--4 sekyro-choice","aria-labelledby":w,"data-testid":c,children:[(0,$.jsxs)("div",{className:d==="cards"?"sekyro-heading":"sekyro-stack sekyro-stack--1",children:[(0,$.jsx)("h2",{id:w,ref:l?N:void 0,tabIndex:-1,className:"sekyro-text-body",children:e}),t!==void 0&&t!==""?(0,$.jsx)("p",{className:"sekyro-text-muted",children:t}):null]}),a!==null?(0,$.jsx)(le,{tone:"danger",children:(0,$.jsx)("span",{children:a})}):null,d==="buttons"?(0,$.jsx)("div",{className:"sekyro-stack sekyro-stack--3",children:n.map((A,J)=>(0,$.jsx)(te,{kind:J===0?"primary":"ghost",full:!0,disabled:r,"aria-busy":r||void 0,onClick:o(()=>p(A.id),"onClick"),children:A.label},A.id))}):(0,$.jsx)("div",{className:"sekyro-choices",children:n.map(A=>(0,$.jsxs)("button",{type:"button",className:"sekyro-card","aria-pressed":(j??S)===A.id,"aria-busy":r||void 0,disabled:r||j!==null&&j!==A.id,onClick:o(()=>q(A.id),"onClick"),children:[A.glyph!==void 0?(0,$.jsx)("span",{className:"sekyro-card__tile",children:A.glyph}):null,(0,$.jsxs)("span",{className:"sekyro-card__body",children:[(0,$.jsx)("span",{className:"sekyro-card__title",children:A.label}),A.sub!==void 0?(0,$.jsx)("span",{className:"sekyro-card__sub",children:A.sub}):null]}),(0,$.jsx)("span",{className:"sekyro-radio","aria-hidden":"true"})]},A.id))})]})}o(qr,"bn");s(qr,"ChoiceScreen");var Vr=["fcv3.no_face","fcv3.come_closer","fcv3.move_back","fcv3.center_face","fcv3.straighten","fcv3.more_light","fcv3.too_bright","fcv3.hold_still","fcv3.steady_camera","fcv3.hold_upright","fcv3.one_face","capture.tips.summary","capture.lookAtColours"];function st(e){return e!==null&&Vr.includes(e)}o(st,"he");s(st,"isVoiceKey");var jn=s((e,t)=>Object.prototype.hasOwnProperty.call(e,t),"own");function je(e,t,n){let r;try{if(typeof e=="function")r=e(t,n);else{let a=e[n];r=a!=null&&jn(a,t)?a[t]:null}}catch{return null}return typeof r=="string"&&r!==""?r:null}o(je,"Me");s(je,"resolveClip");var Tn="UklGRiQAAABXQVZFZm10IBAAAAABAAEAESsAACJWAAACABAAZGF0YQAAAAA=",On={ar:"ar-SA",fr:"fr-FR",en:"en-US",es:"es-ES",pt:"pt-BR",de:"de-DE"};function ie(){return typeof window<"u"&&"speechSynthesis"in window?window.speechSynthesis:null}o(ie,"re");s(ie,"synth");function Dr(){return ie()!==null&&typeof SpeechSynthesisUtterance=="function"}o(Dr,"Lr");s(Dr,"speechAvailable");function St(e){return(e.split(/[-_]/)[0]??e).toLowerCase()}o(St,"Sn");s(St,"baseLang");function Et(e,t){let n=s(a=>a.replace(/_/g,"-").toLowerCase(),"norm"),r=St(t);return e.find(a=>n(a.lang)===n(t))??e.find(a=>St(a.lang)===r)}o(Et,"Mn");s(Et,"pickVoice");function Hr(e){if(!Dr())return!1;let t=[];try{t=ie()?.getVoices()??[]}catch{return!0}return t.length===0||Et(t,e)!==void 0}o(Hr,"wn");s(Hr,"speechUsable");function $r(e){let t=ie();return t===null||typeof t.addEventListener!="function"?()=>{}:(t.addEventListener("voiceschanged",e),()=>t.removeEventListener?.("voiceschanged",e))}o($r,"Ln");s($r,"subscribeVoices");function De(e){try{let t=typeof location<"u"?location.href:"http://localhost/",n=new URL(e,t);return`clip:${n.origin}${n.pathname}`}catch{return`clip:${e}`}}o(De,"Ke");s(De,"clipIdentity");function xt(e){e.pause(),e.removeAttribute("src"),e.load()}o(xt,"Rn");s(xt,"release");function Fr(){let e=null,t=null,n=0,r=null,a=null,l=null,c=!1,d=null,S=[],p=new Map,w=s(()=>{S=ie()?.getVoices()??[]},"loadVoices"),N=!1,j=s(()=>{let h=ie();N||h===null||(N=!0,w(),h.addEventListener?.("voiceschanged",w))},"bindVoices"),R=s(()=>(e??(e=new Audio),e),"element"),B=s((h,x,_,k)=>{let u=ie();if(u!==null&&h!==""&&typeof SpeechSynthesisUtterance=="function"){j();let M=Et(S,x);if(S.length===0||M!==void 0){u.cancel();let I=new SpeechSynthesisUtterance(h);I.lang=x,M!==void 0&&(I.voice=M),I.rate=.95,_!==void 0&&(I.onend=_),(_!==void 0||k!==void 0)&&(I.onerror=D=>{k!==void 0&&D.error==="not-allowed"?k():_?.()}),u.speak(I);return}}_?.()},"speak"),q=s(()=>{n+=1,r=null,a=l=null,e!==null&&(e.pause(),e.currentTime=0),ie()?.cancel()},"stop"),A=s(h=>{for(let x of h){let _=De(x);if(p.has(_))continue;let k=new Audio;k.preload="auto",k.src=x,p.set(_,k)}},"warmClips"),J=s((h,x,_)=>{let k={utterance:h,generation:x,end:_};d=k;let u=s(()=>x===n&&d===k,"live"),M=s(()=>{u()&&(a=k)},"block");if(ie()?.cancel(),h.url!==null){let I=R();I.pause(),I.muted=!1,I.src=h.url,I.currentTime=0,I.onended=_??null;let D=s(()=>{l===k&&(l=null)},"settled"),i=I.play();if(i===void 0)return;l=k,i.then(D,T=>{if(D(),!u())return;let O=T?.name;if(O!=="AbortError"){if(O==="NotAllowedError")return M();h.speech?B(h.text,h.lang,_,M):_?.()}});return}h.speech?B(h.text,h.lang,_,M):_?.()},"start");return{say(h){let x=h.url!==null?De(h.url):`tts:${h.lang}:${h.text}`;if(x===r)return;r=x,a=l=null,n+=1;let _=n,k=h.onEnd;J(h,_,k!==void 0?()=>{_===n&&k()}:void 0)},unlock({lang:h,speech:x,prefetch:_}){let k=a??(c?null:l);c=!0;let u=k!==null&&k.generation===n?k:null;a=l=null,u!==null&&J(u.utterance,u.generation,u.end);let M=R();if(t===null&&typeof Blob=="function"&&typeof URL.createObjectURL=="function"){let T=Uint8Array.from(atob(Tn),O=>O.charCodeAt(0));t=URL.createObjectURL(new Blob([T],{type:"audio/wav"}))}let I=M.paused===!1&&t!==null&&M.src!==t;t!==null&&!I&&(u===null||u.utterance.url===null)&&(M.muted=!0,M.onended=null,M.src=t,M.play()?.catch(()=>{}));let D=ie(),i=u!==null&&u.utterance.url===null;if(x&&!i&&D!==null&&typeof SpeechSynthesisUtterance=="function"){j();let T=new SpeechSynthesisUtterance(" ");T.volume=0,T.lang=h,D.speak(T)}A(_??[])},prefetch:A,stop:q,dispose(){q(),N&&ie()?.removeEventListener?.("voiceschanged",w),N=!1,t!==null&&URL.revokeObjectURL(t),t=null,e!==null&&xt(e),e=null;for(let h of p.values())xt(h);p.clear()}}}o(Fr,"_n");s(Fr,"createVoicePlayer");var Pn="sekyro.voiceGuidance";function Gr(e){try{if(typeof window>"u")return null;let t=window.localStorage.getItem(e);return t==="1"?!0:t==="0"?!1:null}catch{return null}}o(Gr,"xn");s(Gr,"readVoicePreference");function Kr(e,t){try{if(typeof window>"u")return;window.localStorage.setItem(e,t?"1":"0")}catch{}}o(Kr,"En");s(Kr,"writeVoicePreference");var Ve="capture.tips.summary",Bn=typeof window<"u"?C.useLayoutEffect:C.useEffect,qn=Object.freeze({});function rt(e,t){let n=new Set,r=[];for(let a of Vr){let l=a===Ve?null:je(e,a,t);l===null||n.has(De(l))||(n.add(De(l)),r.push(l))}return r}o(rt,"ht");s(rt,"resolvedClipUrls");function Zr({locale:e,defaultClips:t,options:n}){let r=n===!1,a=r?{}:n??{},l=a.storageKey===void 0?Pn:a.storageKey,[c,d]=(0,C.useState)(a.defaultEnabled??!0),S=(0,C.useRef)(c),[p,w]=(0,C.useState)(!1),[N,j]=(0,C.useState)("none"),[R,B]=(0,C.useState)(!1),q=(0,C.useRef)(!1),[A,J]=(0,C.useState)(0),h=(0,C.useRef)(null),x=(0,C.useCallback)(()=>(h.current??(h.current=Fr()),h.current),[]),_=On[e],k=a.speechFallback,u=k===void 0||k===!0?!0:k===!1?!1:k.includes(e),M=a.clips??t??qn,I=(0,C.useRef)(!1),D=(0,C.useRef)(M);Bn(()=>{D.current=M,S.current=c}),(0,C.useEffect)(()=>{if(r||l===null)return;let L=Gr(l);L!==null&&(S.current=L,d(L))},[r,l]),(0,C.useEffect)(()=>{if(!(r||!u))return $r(()=>J(L=>L+1))},[r,u]);let i=a.clips;(0,C.useEffect)(()=>{if(r)return;let L=u&&Hr(_);w(rt(M,e).length>0||L),j(i!==void 0&&je(i,Ve,e)!==null?"partner":je(M,Ve,e)!==null||L?"default":"none")},[r,M,i,e,u,_,A]),(0,C.useEffect)(()=>{if(r||!c||!I.current)return;let L=rt(M,e);L.length>0&&x().prefetch(L)},[r,c,M,e,x]),(0,C.useEffect)(()=>()=>{h.current?.dispose(),h.current=null,I.current=!1},[]);let T=(0,C.useCallback)(L=>{r||(I.current=!0,x().unlock({lang:_,speech:u,...L?{prefetch:rt(D.current,e)}:{}}))},[r,x,_,u,e]),O=(0,C.useCallback)(()=>T(S.current),[T]),z=(0,C.useCallback)(()=>{q.current=!1,B(!1)},[]),H=(0,C.useCallback)(()=>{z(),h.current?.stop()},[z]),ge=(0,C.useCallback)(()=>{q.current&&H()},[H]),he=(0,C.useCallback)((L,xe)=>{if(r)return;if(q.current){H();return}let ve=x();ve.stop(),q.current=!0,B(!0);let V=xe?.clip===!1?null:je(D.current,Ve,e);ve.say({url:V,text:L,lang:_,speech:u,onEnd:z})},[r,H,x,e,_,u,z]),Y=(0,C.useCallback)(L=>{r||(L?T(!0):H(),l!==null&&Kr(l,L),S.current=L,d(L))},[r,T,H,l]),W=(0,C.useCallback)(()=>Y(!S.current),[Y]),ne=(0,C.useCallback)((L,xe)=>{if(r||!c)return;q.current&&z();let ve=je(D.current,L,e);x().say({url:ve,text:xe,lang:_,speech:u})},[r,c,e,x,_,u,z]);return(0,C.useMemo)(()=>({supported:!r&&p,enabled:!r&&c,setEnabled:Y,toggle:W,unlock:O,speakKey:ne,stop:H,summary:r?"none":N,summaryPlaying:R,toggleSummary:he,stopSummary:ge}),[r,p,c,Y,W,O,ne,H,N,R,he,ge])}o(Zr,"vt");s(Zr,"useVoiceGuidance");function zr(e,t,n,r){let{speakKey:a,stop:l,enabled:c}=e,d=(0,C.useRef)(!1);(0,C.useEffect)(()=>{if(!r||!c){d.current&&l(),d.current=!1;return}d.current=!0,st(t)&&t!==Ve&&n!==""&&a(t,n)},[r,c,t,n,a,l])}o(zr,"Ct");s(zr,"useSpeakGuidance");function ot(e,t){let n=Yr(e);return n==="face"&&(t==="lighting"||e==="liveness_inconclusive")?"again":n}o(ot,"Pn");s(ot,"retryCoachingOf");function Yr(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"}}o(Yr,"Pr");s(Yr,"coachingOfReason");var He={face:{title:"capture.retryCoaching.title",tips:["capture.retryCoaching.light","capture.retryCoaching.eyeLevel","capture.retryCoaching.head"]},again:{title:"capture.retryTips.title",tips:["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 Wr({showCoaching:e,coaching:t="face",attemptsText:n,showRetake:r,onRetake:a}){let l=Me(),c=(0,at.useRef)(null);return(0,at.useEffect)(()=>{r&&c.current?.focus()},[r]),!e&&!r?null:(0,fe.jsxs)("div",{className:"sekyro-stack sekyro-stack--3","data-testid":"sekyro-captured-panel",children:[e?(0,fe.jsxs)("div",{className:"sekyro-stack sekyro-stack--1",children:[(0,fe.jsx)("p",{className:"sekyro-text-body",children:l(He[t].title)}),(0,fe.jsx)("ul",{className:"sekyro-coaching",children:He[t].tips.map(d=>(0,fe.jsx)("li",{children:l(d)},d))}),n!==null?(0,fe.jsx)("p",{className:"sekyro-text-muted","data-testid":"sekyro-attempts-remaining",children:n}):null]}):null,r?(0,fe.jsx)(te,{ref:c,className:"sekyro-btn--start",onClick:a,children:l("capture.recordAgain")}):null]})}o(Wr,"Tn");s(Wr,"CapturedPanel");function Lt(){try{return!1}catch{return!1}}o(Lt,"nt");s(Lt,"isDevBuild");var Vn=(0,Qr.createContext)(null);function Xr({state:e}){let t=Me(),[n,r]=(0,lt.useState)(!1);(0,lt.useEffect)(()=>{e!=="unknown"&&r(!0)},[e]);let a=e==="granted"?(0,we.jsx)(Ur,{}):e==="denied"?(0,we.jsx)(Tr,{}):(0,we.jsx)(jr,{});return(0,we.jsxs)("div",{role:n?"status":void 0,className:`sekyro-permission sekyro-permission--${e}`,"data-testid":"sekyro-permission","data-state":e,children:[(0,we.jsx)("span",{className:"sekyro-permission__icon","aria-hidden":"true",children:a}),(0,we.jsx)("span",{children:t(`capture.permission.${e}`)})]})}o(Xr,"On");s(Xr,"PermissionRow");function Jr({voice:e}){let t=Me();if(!e.supported)return null;let n=e.enabled;return(0,Se.jsxs)("button",{type:"button",role:"switch","aria-checked":n,className:"sekyro-switch","data-testid":"sekyro-voice-switch",onClick:o(()=>e.toggle(),"onClick"),children:[(0,Se.jsxs)("span",{className:"sekyro-switch__label",children:[(0,Se.jsx)(nt,{off:!n}),t("capture.voiceGuidance")]}),(0,Se.jsx)("span",{className:"sekyro-switch__track","aria-hidden":"true",children:(0,Se.jsx)("span",{className:"sekyro-switch__thumb",children:n?(0,Se.jsx)(Or,{className:"sekyro-switch__check"}):null})})]})}o(Jr,"Hn");s(Jr,"VoiceSwitch");function en({assets:e,onRetryAssets:t,permission:n,captureMode:r="self",voice:a,tips:l,summary:c,startLabel:d,startDisabled:S,onStart:p}){let w=Me(),N=(0,X.useRef)(c?.stop);N.current=c?.stop,(0,X.useEffect)(()=>()=>N.current?.(),[]);let j=(0,X.useRef)(null),R=(0,X.useRef)(null),B=(0,X.useRef)(null),q=(0,X.useRef)(e),A=(0,X.useRef)(!1);(0,X.useEffect)(()=>{let u=q.current;if(q.current=e,u===e)return;let M=A.current;e!=="loading"&&(A.current=!1),tn(j.current)&&(e==="failed"?B.current?.focus():M&&R.current?.focus())},[e]);let J=(0,X.useCallback)(()=>{A.current=!0,t()},[t]),h=e==="loading",x=h||S,_=(0,X.useCallback)(()=>{x||(N.current?.(),p())},[x,p]),k;return e==="failed"?k=(0,P.jsxs)(le,{tone:"danger",testId:"sekyro-assets-error",children:[(0,P.jsx)("p",{className:"sekyro-text-body",children:w("fcv2.err.models")}),(0,P.jsx)(te,{kind:"ghost",ref:B,className:"sekyro-btn--start",onClick:J,"data-testid":"sekyro-assets-retry",children:w("common.retry")})]}):k=(0,P.jsxs)("div",{className:"sekyro-stack sekyro-stack--1",children:[(0,P.jsx)(te,{ref:R,full:!0,"data-testid":"sekyro-start","aria-disabled":x?"true":void 0,"aria-busy":h?"true":void 0,onClick:_,children:h?(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(Pr,{}),w("capture.preparing.title")]}):d??w("capture.start")}),h?(0,P.jsx)("p",{className:"sekyro-text-muted",children:w("capture.preparing.hint")}):null]}),(0,P.jsxs)("div",{ref:j,className:"sekyro-stack sekyro-stack--4","data-testid":"sekyro-intro","data-assets":e,children:[r==="assisted"?(0,P.jsxs)("div",{className:"sekyro-stack sekyro-stack--1","data-testid":"sekyro-assisted-intro",children:[(0,P.jsx)("h2",{className:"sekyro-text-body",children:w("capture.assisted.title")}),(0,P.jsx)("p",{className:"sekyro-text-muted",children:w("capture.assisted.lead")})]}):null,l!==!1?(0,P.jsx)(Br,{tips:l}):null,c!==void 0?(0,P.jsxs)(te,{kind:"ghost",className:"sekyro-btn--start",onClick:c.toggle,"data-testid":"sekyro-tips-listen",children:[(0,P.jsx)(nt,{off:!1}),w(c.playing?"capture.tips.stop":"capture.tips.listen")]}):null,(0,P.jsx)(Xr,{state:n}),(0,P.jsx)(Jr,{voice:a}),(0,P.jsx)("p",{className:"sekyro-text-muted",children:w("capture.securityNote")}),k,(0,P.jsx)("p",{role:"status",className:"sekyro-visually-hidden","data-testid":"sekyro-intro-status",children:e==="loading"?w("capture.preparing.title"):e==="ready"?w("capture.ready"):""})]})}o(en,"Fn");s(en,"PreCaptureScreen");function tn(e){if(typeof document>"u")return!1;let t=document.activeElement;return t===null||t===document.body||e!==null&&e.contains(t)}o(tn,"Hr");s(tn,"focusIsOurs");function rn(){let[e,t]=(0,it.useState)({state:"unknown",settled:!1});return(0,it.useEffect)(()=>lr(n=>t({state:n,settled:!0})),[]),{permission:e.state,permissionSettled:e.settled}}o(rn,"Dn");s(rn,"useCameraStatus");function nn(e){return It(e,"mobileRequired")}o(nn,"qn");s(nn,"useMobileRequired");function sn(e){return It(e,"returning").required}o(sn,"jn");s(sn,"useReturning");function It(e,t){let[n,r]=(0,pe.useState)({required:!1,settled:e===void 0});return(0,pe.useEffect)(()=>{let a=e?.[t];if(e===void 0||typeof a!="function"){r({required:!1,settled:!0});return}let l=!0;return r({required:!1,settled:!1}),Promise.resolve().then(()=>a.call(e)).then(c=>{l&&r({required:c===!0,settled:!0})},()=>{l&&r({required:!1,settled:!0})}),()=>{l=!1}},[e,t]),n}o(It,"Yn");s(It,"useFlag");function an(e){let t=s(()=>e?.captureChoice??null,"initialChoice"),[n,r]=(0,pe.useState)(()=>({session:"self",choice:t(),settled:e===void 0}));(0,pe.useEffect)(()=>{let l=e?.captureMode,c=e?.captureChoice??null;if(e===void 0||typeof l!="function"){r({session:"self",choice:c,settled:!0});return}let d=!0;return r({session:"self",choice:c,settled:!1}),Promise.resolve().then(()=>l.call(e)).then(S=>{let p=e.captureChoice??null;d&&r({session:p!==null&&S===p?"choice":S==="assisted"||S==="choice"?S:"self",choice:p,settled:!0})},()=>{d&&r({session:"self",choice:null,settled:!0})}),()=>{d=!1}},[e]);let a=(0,pe.useCallback)(l=>{e?.chooseCaptureMode?.(l),r(c=>({...c,choice:l}))},[e]);return{mode:n.session==="choice"?n.choice??"self":n.session==="assisted"?"assisted":"self",session:n.session,choice:n.choice,settled:n.settled,choose:a}}o(an,"$n");s(an,"useCaptureMode");function on(e){let[t,n]=(0,pe.useState)(!1);return(0,pe.useEffect)(()=>{if(n(!1),e===void 0)return;let r=e.on("busy",()=>n(!0)),a=e.on("result",()=>n(!1));return()=>{r(),a()}},[e]),t}o(on,"zn");s(on,"useBusy");var Dn=s(()=>"idle","serverSnapshot");function Nt(e){return ir(e!==void 0?{assetBaseUrl:e}:{})}o(Nt,"Qn");s(Nt,"preload");function ln(e,t=!0){let n=(0,Q.useSyncExternalStore)((0,Q.useCallback)(p=>ur(p,e),[e]),()=>cr(e),Dn),[r,a]=(0,Q.useState)(null),l=(0,Q.useRef)(!1),c=(0,Q.useCallback)(()=>{Nt(e).then(p=>{l.current&&p==="idle"&&a({base:e})})},[e]);(0,Q.useEffect)(()=>(l.current=!0,c(),()=>{l.current=!1}),[c]);let d=(0,Q.useRef)(null);(0,Q.useEffect)(()=>{if(n!=="idle"){d.current={base:e};return}!t||d.current===null||d.current.base!==e||(d.current=null,c())},[n,e,c,t]);let S=(0,Q.useCallback)(()=>{Nt(e)},[e]);return{gate:r!==null&&r.base===e&&n==="idle"||n==="ready"?"ready":n==="failed"?"failed":"loading",retry:S}}o(ln,"Jn");s(ln,"useLivenessAssets");var Rr={progress:0,hint:null,faceDetected:!1};function cn(e){let{videoRef:t,assetBaseUrl:n}=e,r=(0,E.useRef)(e.verification).current,a=(0,E.useRef)(!1);e.verification!==r&&!a.current&&Lt()&&(a.current=!0,console.warn("[@sekyro/react] <LivenessCapture>: the `verification` prop changed identity after mount. The first instance stays bound (the camera is not rebuilt); create the verification once (useMemo / useState / outside render) instead of on every render."));let l=(0,E.useRef)(null),[c,d]=(0,E.useState)("idle"),[S,p]=(0,E.useState)(Rr),[w,N]=(0,E.useState)(!1),[j,R]=(0,E.useState)(!1),[B,q]=(0,E.useState)(null),[A,J]=(0,E.useState)(!1),[h,x]=(0,E.useState)(null),[_,k]=(0,E.useState)(null),[u,M]=(0,E.useState)(null),[I,D]=(0,E.useState)(null),[i,T]=(0,E.useState)(null),[O,z]=(0,E.useState)(!1),H=(0,E.useRef)(null),ge=(0,E.useRef)("idle"),he=(0,E.useRef)(-1),[Y,W]=(0,E.useState)(0),ne=(0,E.useRef)(e);ne.current=e,(0,E.useEffect)(()=>{let ee=t.current;if(ee===null)return;let ue={video:ee,...n!==void 0?{assetBaseUrl:n}:{}},F=r!==void 0?r.liveness(ue):dr(ue);l.current=F;let Ne=s(()=>T(F.facingMode??null),"readFacing");Ne();let $e=[F.on("state",b=>{b==="mode_switch"?z(!0):b!=="starting"&&b!=="gating"&&z(!1),b==="starting"?(ge.current!=="starting"&&(he.current+=1,W(Math.max(0,he.current))),k(null),M(null),p(Rr),R(!1),N(!1),q(null),x(null),H.current=null):b==="gating"&&ge.current==="recording"&&(R(!1),N(!1),q(null),H.current=null),ge.current=b,Ne(),d(b),ne.current.onStateChange?.(b)}),F.on("gate",b=>{let ke=H.current;H.current=b.progress,N(ke!==null&&b.progress<ke-.001&&b.progress>0&&b.progress<1),b.progress>=1&&R(!0),p(b)}),F.on("frozen",({previewDataUrl:b})=>q(b)),F.on("profile",({animations:b})=>J(b==="reduced")),F.on("ramp",({colour:b})=>x(b)),F.on("captured",b=>{k(b),D(null),ne.current.onCaptured?.(b)}),F.on("error",b=>{M(b);let ke=r?.reportCaptureIssue;ke!==void 0&&Ct(Le=>ke.call(r,Le),xr("liveness",b,Math.max(0,he.current))),ne.current.onError?.(b)}),r?.on("result",b=>{D(b),ne.current.onResult?.(b)})];return()=>{for(let b of $e)b?.();l.current=null,F.destroy()}},[r,t,n]);let L=(0,E.useCallback)(()=>{l.current?.start()},[]),xe=(0,E.useCallback)(()=>{l.current?.retry()},[]),ve=(0,E.useCallback)(async()=>{let ee=l.current;return ee===null||typeof ee.canSwitchCaptureMode!="function"?!1:await ee.canSwitchCaptureMode().catch(()=>!1)===!0},[]),V=(0,E.useCallback)(async ee=>{let ue=l.current;if(ue===null||typeof ue.setCaptureMode!="function")return!1;let F=await ue.setCaptureMode(ee).catch(()=>!1)===!0;return F&&T(ue.facingMode??null),F},[]);return{state:c,gate:S,draining:w,gateLocked:j,frozenPreview:B,reduceMotion:A,rampColour:h,artifacts:_,error:u,result:I,facingMode:i,start:L,retry:xe,canSwitchCaptureMode:ve,setCaptureMode:V,modeRestarted:O,attempt:Y}}o(cn,"er");s(cn,"useLivenessHandle");var Hn=new Set(["national_number"]);function Rt(e){if(e==null||!e.available||e.selected!==null)return null;let t=e.options.filter(n=>Hn.has(n));return t.length>0?{...e,options:t}:null}o(Rt,"tr");s(Rt,"pending");function un(e){let[t,n]=(0,me.useState)(null),[r,a]=(0,me.useState)(e===void 0),[l,c]=(0,me.useState)(!1),[d,S]=(0,me.useState)(!1);(0,me.useEffect)(()=>{if(n(null),e===void 0){a(!0);return}let N=!0,j=e.methodChoice;typeof j=="function"?(a(!1),Promise.resolve().then(()=>j.call(e)).then(B=>{N&&n(Rt(B))},()=>{}).finally(()=>{N&&a(!0)})):a(!0);let R=e.on("method",B=>n(Rt(B)));return()=>{N=!1,R()}},[e]);let p=(0,me.useCallback)(async N=>{if(e===void 0)return!1;c(!0),S(!1);try{return await e.selectMethod(N),n(null),!0}catch{return S(!0),!1}finally{c(!1)}},[e]),w=t!==null&&t.options.length===1?t.options[0]:null;return{choice:t,auto:w==="national_number"&&!d?w:null,settled:r,busy:l,failed:d,select:p}}o(un,"nr");s(un,"useMethodChoice");var $n=["ar","fr","en"];function dn(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}}o(dn,"io");s(dn,"isClipUrl");function pn(e){let t=e.clips;if(typeof t!="object"||t===null)return null;let n={};for(let r of $n){let a=t[r];if(!(typeof a!="object"||a===null))for(let[l,c]of Object.entries(a))!st(l)||!dn(c)||((n[r]??(n[r]={}))[l]=c)}return Object.keys(n).length>0?n:null}o(pn,"ao");s(pn,"toVoiceClipMap");function hn(e){let[t,n]=(0,Te.useState)(null);(0,Te.useEffect)(()=>{if(n(null),e===void 0)return;let a=!0,l=s(d=>{if(!a)return;let S=typeof d=="object"&&d!==null&&typeof d.setId=="string"?d:null;n(p=>p?.setId===S?.setId?p:S)},"take");try{typeof e.voiceClips=="function"&&Promise.resolve(e.voiceClips()).then(l,()=>l(null))}catch{l(null)}let c=e.on("view",d=>l(d.voice));return()=>{a=!1,c()}},[e]);let r=(0,Te.useMemo)(()=>t!==null?pn(t):null,[t]);return e===void 0?null:r}o(hn,"rr");s(hn,"useServerVoiceClips");function fn({voice:e}){let t=Me();return(0,At.jsx)(te,{kind:"chip","aria-pressed":e.enabled,"aria-label":t("capture.voiceGuidance"),"data-testid":"sekyro-voice-toggle",onClick:o(()=>e.toggle(),"onClick"),children:(0,At.jsx)(nt,{off:!e.enabled,className:"sekyro-icon"})})}o(fn,"sr");s(fn,"VoiceChip");var Fn=new Set(["abandoned","not_opened","cancelled","superseded"]),Gn=800,Kn="capture.lookAtColours";function mn(e){return e===void 0||e!==!1&&e.length===wt.length&&wt.every(t=>e.includes(t))}o(mn,"mo");s(mn,"isDefaultTips");function yn(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}o(yn,"yo");s(yn,"carriesActivation");function gn(e){return typeof e=="object"&&e!==null&&!(0,m.isValidElement)(e)&&"tone"in e&&"text"in e}o(gn,"go");s(gn,"isNoticeObject");var Zn=new Set(["nni_unbound","id_number_unbound","method_required","mobile_required","portrait_required"]);function vn(e){return e==="starting"||e==="gating"||e==="recording"||e==="mode_switch"}o(vn,"vo");s(vn,"isCapturing");function kn(e){return e==="captured"||e==="uploading"||e==="checking"}o(kn,"Co");s(kn,"isPostCapture");function zn({verification:e,locale:t,dir:n,strings:r,slots:a,autoStart:l=!1,notice:c,startDisabled:d=!1,startLabel:S,tips:p,tipsSummary:w,coach:N,voice:j,onGuidance:R,onCaptured:B,onResult:q,onError:A,onStateChange:J,assetBaseUrl:h,className:x}){let _=gr(t),k=(0,m.useMemo)(()=>yr(t,r),[t,r,_]),u=(0,m.useMemo)(()=>g=>k[g]??"",[k]),M=n??(t==="ar"?"rtl":"ltr"),I=(0,m.useRef)(null),D=(0,m.useContext)(Vn),i=cn({verification:e,videoRef:I,assetBaseUrl:h,onCaptured:B,onResult:q,onError:A,onStateChange:J}),T=ln(h,i.state==="idle"&&i.error===null),O=un(e),z=O.choice!==null,H=nn(e),ge=sn(e),he=on(e),Y=rn(),W=an(e),ne=W.session==="choice",L=W.mode==="assisted",xe=j!==!1&&j?.clips===void 0,ve=hn(xe?e:void 0),V=Zr({locale:t,defaultClips:ve,options:j}),ee=L?"environment":"user",ue=W.settled,F=(0,m.useRef)(null),Ne=(0,m.useRef)(!1),$e=(0,m.useRef)(V.unlock);$e.current=V.unlock,(0,m.useEffect)(()=>{let g=F.current;if(g===null)return;let oe=["pointerup","touchend","click","keydown"],_e=s(()=>{for(let qe of oe)g.removeEventListener(qe,Ae,!0)},"disarm");function Ae(qe){if(Ne.current){_e();return}yn(qe)&&(Ne.current=!0,_e(),$e.current())}o(Ae,"Re"),s(Ae,"onGesture");for(let qe of oe)g.addEventListener(qe,Ae,{capture:!0,passive:!0});return _e},[]);let b=(0,m.useCallback)(()=>{Ne.current||(Ne.current=!0,V.unlock()),i.start()},[V.unlock,i.start]),ke=(0,m.useCallback)(()=>i.start(),[i.start]),Le=(0,m.useRef)(!1),Oe=i.state==="idle"&&i.error===null,jt=!z&&!H.required&&(l===!0||l==="when-permitted"&&Y.permission==="granted"),Tt=jt&&O.settled&&H.settled&&ue,_n=l==="when-permitted"&&!Y.permissionSettled&&!Le.current,Ot=jt&&Oe&&!Le.current,ut=(_n||Ot||!ue)&&T.gate==="ready"?"loading":T.gate;(0,m.useEffect)(()=>{!Tt||!Oe||T.gate!=="ready"||Le.current||(Le.current=!0,ke())},[Tt,Oe,T.gate,ke]);let wn=Oe&&!z&&!H.required&&!(Ot&&T.gate==="ready"),[Pt,Bt]=(0,m.useState)(!1),{canSwitchCaptureMode:qt,setCaptureMode:Vt}=i;(0,m.useEffect)(()=>{if(!W.settled||!ne){Bt(!1);return}let g=!0;return qt().then(oe=>{g&&Bt(oe)}),()=>{g=!1}},[W.settled,ne,qt]);let{choose:Dt}=W,Ie=L?"self":"assisted",Sn=(0,m.useCallback)(async()=>{await Vt(Ie)&&Dt(Ie)},[Vt,Dt,Ie]),Ht=i.state!=="idle"&&i.facingMode!==null?i.facingMode:ee;(0,m.useEffect)(()=>{let g=I.current?.style;Ht==="user"?g?.removeProperty("transform"):g&&(g.transform="none")},[Ht]);let Fe=(0,m.useMemo)(()=>i.artifacts!==null&&typeof URL.createObjectURL=="function"?URL.createObjectURL(i.artifacts.keyframe):null,[i.artifacts]);(0,m.useEffect)(()=>{if(Fe!==null)return()=>URL.revokeObjectURL(Fe)},[Fe]);let $t=i.frozenPreview??Fe,Ue=e!==void 0,Z=vn(i.state),be=kn(i.state),Ge=Z||be,se=i.result,Ft=i.state==="done"&&se!==null,Ke=Z&&i.rampColour!==null,dt=i.state==="recording"&&i.frozenPreview!==null&&!Ke,Ze=D!==null,Gt=Pt&&Z&&!dt?{to:Ie,label:u(Ie==="assisted"?"capture.modeSwitch.toAssisted":"capture.modeSwitch.toSelf"),description:u(Ie==="assisted"?"capture.modeSwitch.toAssistedLabel":"capture.modeSwitch.toSelfLabel"),onSwitch:s(()=>{Sn()},"onSwitch")}:null,ze=i.modeRestarted&&Z?u("capture.modeSwitch.restarted"):null,Pe=be||dt,Kt=be?"checking":dt?"frozen":i.state==="recording"||Ke?"recording":i.gateLocked||i.gate.progress>=1?"locked":i.gate.faceDetected?"aligning":"seeking",Ye=Z?i.gate.hint:null,We=i.state==="starting"?"capture.preparing.title":Ye===null?null:Ye==="center"&&!i.gate.faceDetected?"fcv3.no_face":pr(Ye),[xn,Zt]=(0,m.useState)(null);(0,m.useEffect)(()=>{if(We!=="fcv3.no_face"){Zt(We);return}if(!Z)return;let g=setTimeout(()=>Zt(We),Gn);return()=>clearTimeout(g)},[We,Z]);let pt=Z&&!Ke&&typeof N=="string"&&N!=="",zt=L&&Z?u("capture.assisted.stage"):null,Re=Z&&!pt?Ke?Kn:xn:null,ht=pt?N:Re===null?"":u(Re);zr(V,Re,ht,Z);let Yt=(0,m.useRef)(R);Yt.current=R,(0,m.useEffect)(()=>{if(st(Re))try{Yt.current?.(Re)}catch(g){console.error("[@sekyro/react] onGuidance threw:",g)}},[Re]);let Be=(0,m.useMemo)(()=>({supported:V.supported,enabled:V.enabled,setEnabled:V.setEnabled,toggle:V.toggle}),[V.supported,V.enabled,V.setEnabled,V.toggle]),ft=a?.voicePrompt,Wt=ft!==void 0,Qt=j===void 0,Xt=(0,m.useRef)(!1);(0,m.useEffect)(()=>{!Wt||!Qt||Xt.current||!Lt()||(Xt.current=!0,console.warn("[@sekyro/react] <LivenessCapture>: `slots.voicePrompt` is set and `voice` is undefined, so the component speaks the guidance itself. If your slot plays audio, pass voice={false} or the person hears every hint twice; pass voice={{}} to keep the built-in voice and silence this warning."))},[Wt,Qt]);let Nn=ft!==void 0?(g,oe,_e)=>ft(g,oe,_e,Be):V.supported?()=>(0,v.jsx)(fn,{voice:Be}):void 0,{summary:mt,summaryPlaying:Jt,toggleSummary:er,stopSummary:tr}=V,Qe=w!==void 0&&w!=="",rr=Qe?w:u("capture.tips.summary"),nr=Qe?mt!=="none":mt==="partner"||mt==="default"&&mn(p),Rn=(0,m.useMemo)(()=>nr?{playing:Jt,toggle:s(()=>er(rr,{clip:!Qe}),"toggle"),stop:tr}:void 0,[nr,Jt,er,rr,tr,Qe]),An=(0,m.useMemo)(()=>({assets:ut,retryAssets:T.retry,permission:Y.permission,permissionSettled:Y.permissionSettled,captureMode:W.mode,facing:ee,voice:Be}),[ut,T.retry,Y.permission,Y.permissionSettled,W.mode,ee,Be]),Mn=gn(c)?(0,v.jsx)(le,{tone:c.tone,testId:"sekyro-host-notice",children:(0,v.jsx)("span",{children:c.text})}):c??null,ae=se!==null&&se.status==="retry"?se:null,G=Ft&&se.status==="unavailable"&&!z&&se.reasonCode!=="portrait_required"?se:null,Ce=Ft&&(se.status==="verified"||se.status==="not_verified"||se.status==="review")?se:null,yt=s((g,oe)=>{if(g===void 0)return null;if(g==="device_cooldown"){let Ae=fr(t,oe);if(Ae!==null)return u(Ae.key).replace("{time}",Ae.time)}let _e=et(g);return _e===null?null:u(_e)},"reasonText"),gt=s(g=>{let oe=g.retakeHint===void 0?null:Je(g.retakeHint);return oe===null?yt(g.reasonCode):u(oe)},"retryText"),sr=Ce===null?null:yt(Ce.reasonCode,Ce.retryAfter)??(Ce.status==="not_verified"&&Ce.reason!==void 0&&Fn.has(Ce.reason)?u("errors.session_expired"):null),En=G!==null&&G.reasonCode!==void 0&&G.reasonCode!=="nni_unbound"&&G.reasonCode!=="id_number_unbound"&&G.reasonCode!=="method_required"&&G.reasonCode!=="mobile_required"&&!(G.reasonCode==="no_recorder"&&i.artifacts?.degraded==="NO_RECORDER"),Xe=G?.reasonCode,ar=i.attempt;(0,m.useEffect)(()=>{G===null||Xe===void 0||e?.reportCaptureIssue===void 0||Zn.has(Xe)||Ct(g=>e.reportCaptureIssue?.(g),{check:"liveness",kind:"unavailable",phase:"upload",engineKind:Xe,attempt:Math.min(1e3,ar)})},[G,Xe,ar,e]);let or=bt(),Ln=z&&O.auto===null&&!Z&&!be&&i.error===null,vt=(0,m.useCallback)(async g=>{await O.select(g)&&i.state==="done"&&i.retry()},[O.select,i.state,i.retry]);return(0,m.useEffect)(()=>{O.auto!==null&&!O.busy&&!Z&&!be&&vt(O.auto)},[O.auto,O.busy,Z,be,vt]),(0,v.jsx)(vr,{value:u,children:(0,v.jsxs)("div",{ref:F,className:x===void 0?"sekyro-capture":`sekyro-capture ${x}`,dir:M,lang:t,"data-testid":"sekyro-liveness-capture","data-state":i.state,children:[a?.header,ae!==null&&gt(ae)!==null&&!(Ze&&Ge)?(0,v.jsx)(le,{tone:"warning",role:"status",testId:"sekyro-retry-notice",children:(0,v.jsx)("span",{children:gt(ae)})}):null,ze!==null&&!Ze?(0,v.jsx)(le,{tone:"info",role:"status",testId:"sekyro-mode-switch-status",children:(0,v.jsx)("span",{children:ze})}):null,he&&be&&!Ze?(0,v.jsx)(le,{tone:"info",role:"status",testId:"sekyro-busy-notice",children:(0,v.jsx)("span",{children:u("capture.busy")})}):null,H.required&&Oe?(0,v.jsx)(le,{tone:"info",role:"status",testId:"sekyro-mobile-required",children:(0,v.jsx)("span",{children:u("reasons.mobile_required")})}):null,i.error!==null?a?.errorPanel!==void 0?a.errorPanel(i.error,i.retry):(0,v.jsxs)(le,{tone:"danger",testId:"sekyro-error-notice",children:[(0,v.jsx)("span",{children:u(hr(i.error))}),i.error.retryable?(0,v.jsx)(te,{ref:or,kind:"ghost",className:"sekyro-btn--start",onClick:i.retry,children:u("common.retry")}):null]}):null,G!==null?(0,v.jsxs)(le,{tone:"danger",testId:"sekyro-unavailable-notice",children:[(0,v.jsx)("span",{children:(G.reasonCode==="attestation"&&G.attestationError==="clock_wrong"?u("errors.device_clock"):yt(G.reasonCode))??u(G.reasonCode===void 0?"errors.session_expired":"errors.network_error")}),En?(0,v.jsx)(te,{ref:or,kind:"ghost",className:"sekyro-btn--start",onClick:i.retry,children:u(G.reasonCode==="attestation"?"common.retry":"capture.recordAgain")}):null]}):null,sr!==null&&Ce!==null?(0,v.jsx)(le,{tone:Ce.status==="not_verified"?"danger":"info",testId:"sekyro-result-notice",children:(0,v.jsx)("span",{children:sr})}):null,(0,v.jsx)("div",{className:Ge?void 0:"sekyro-hidden","data-capture-live":Ge?"":void 0,children:Ze?D({videoRef:I,guidance:Pe&&Ue?u("capture.checking"):ht,coached:pt&&!(Pe&&Ue),note:Pe?Ue?u(he?"capture.busy":"capture.checkingHint"):null:ze??(ae!==null?gt(ae):zt),settled:Pe&&Ue,progress:i.gate.progress,phase:Kt,still:Pe?$t:null,live:Ge,modeSwitch:Gt,...Pt?{status:ze}:{},ramp:i.rampColour===null?null:{colour:i.rampColour}}):(0,v.jsx)(kr,{videoRef:I,guidanceText:ht,guidanceHint:Ye,guidanceKey:Re,progress:i.gate.progress,phase:Kt,draining:i.draining,stillUrl:$t,showChecking:Ue,operatorText:zt,voicePrompt:Nn,overlay:o(g=>(0,v.jsxs)(v.Fragment,{children:[a?.stageOverlay?.(g),(0,v.jsx)(br,{colour:i.rampColour})]}),"overlay"),reduceMotion:i.reduceMotion,modeSwitch:Gt})}),Ln&&O.choice!==null?(0,v.jsx)(qr,{title:u("method.title"),description:u("method.description"),options:O.choice.options.map(g=>({id:g,label:u(`method.${g}`)})),busy:O.busy,error:O.failed?u("errors.network_error"):null,focus:i.state==="done",testId:"sekyro-method",look:"buttons",onChoose:o(g=>{vt(g)},"onChoose")}):null,wn?(0,v.jsxs)(v.Fragment,{children:[ge&&a?.header===void 0&&a?.intro===void 0?(0,v.jsxs)("div",{className:"sekyro-stack sekyro-stack--1",children:[(0,v.jsx)("h2",{className:"sekyro-text-body",children:u("returning.title")}),(0,v.jsx)("p",{className:"sekyro-text-muted",children:u("returning.description")})]}):null,Mn,a?.intro!==void 0?a.intro(b,An):(0,v.jsx)(en,{assets:ut,onRetryAssets:T.retry,permission:Y.permission,captureMode:W.mode,voice:Be,tips:p??wt,summary:Rn,startLabel:S,startDisabled:d,onStart:b})]}):null,(0,v.jsx)(Wr,{showCoaching:ae!==null,coaching:ot(ae?.reasonCode,ae?.retakeHint),attemptsText:ae?.attemptsRemaining!==void 0?mr(k,t,ae.attemptsRemaining):null,showRetake:ae!==null&&!Z&&!be||!Ue&&i.state==="captured",onRetake:i.retry}),a?.footer]})})}o(zn,"Ei");s(zn,"LivenessCapture");var Ut=U(K(),1),ct=U(K(),1),f=U(de(),1);var _s={document:"card",population_registry:"id",national_eid:"smartphone",phone_otp:"phone",email_otp:"email"},ws={population_registry:"hashtag",national_eid:"key"};function Yn(e,t){switch(e.service){case"document":return t.t("method.document_photo");case"population_registry":return t.t("method.national_number");case"national_eid":{let n=e.nationalEid?.providerName;return n?t.t("method.national_eid",{provider:n}):t.t("method.national_eidGeneric")}default:return null}}o(Yn,"D");s(Yn,"identityLabel");function Wn(e,t){let[n,r]=(0,Ut.useState)(!1),[a,l]=(0,Ut.useState)(null);return{busy:n,error:a,run:s(c=>{r(!0),l(null),c().then(()=>r(!1),d=>{r(!1),l(e.t(Nr(d,e.strings))),t?.(d)})},"run")}}o(Wn,"q");s(Wn,"useChoiceAction");function bn(){let e=`sekyro-face-light-${(0,ct.useId)().replace(/[^A-Za-z0-9_-]/g,"")}`;return(0,f.jsxs)("svg",{className:"sekyro-mark sekyro-mark--face",viewBox:"0 0 168 206","aria-hidden":"true",focusable:"false",children:[(0,f.jsx)("defs",{children:(0,f.jsx)("mask",{id:e,children:(0,f.jsx)("ellipse",{className:"sekyro-mark__arc",cx:"84",cy:"103",rx:"76",ry:"95",pathLength:"1",fill:"none",stroke:"#fff",strokeWidth:"16"})})}),(0,f.jsx)("ellipse",{cx:"84",cy:"103",rx:"64",ry:"83",fill:"none",className:"sekyro-mark__line"}),(0,f.jsx)("path",{className:"sekyro-mark__face",d:"M68 64v10M100 64v10M84 66v25q0 2-6 1M60 108q24 18 48 0"}),(0,f.jsx)("ellipse",{className:"sekyro-mark__ticks",cx:"84",cy:"103",rx:"76",ry:"95",pathLength:"56"}),(0,f.jsx)("ellipse",{className:"sekyro-mark__ticks sekyro-mark__ticks--light",cx:"84",cy:"103",rx:"76",ry:"95",pathLength:"56",mask:`url(#${e})`})]})}o(bn,"O");s(bn,"FaceMark");var Qn={glasses:"jGlasses",lighting:"light",faceCamera:"camera"};function Xn(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}}o(Xn,"ne");s(Xn,"faceIntroRetryOf");var Jn={"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 es({start:e,context:t,tips:n,tipsTitle:r,human:a=!1,returning:l=!1,notice:c,retry:d}){let S=_t(),{t:p}=S,w=d===void 0?"face":ot(d.reason,d.retakeHint),N=w==="face"?null:He[w].tips,j=(0,ct.useContext)(_r)?.busy===!0;return(0,f.jsxs)("section",{className:"sekyro-step",children:[(0,f.jsx)(bn,{}),t.captureMode==="assisted"?(0,f.jsx)(tt,{title:p("capture.assisted.heading"),lead:p("capture.assisted.lead")}):l?(0,f.jsx)(tt,{title:p("returning.heading"),lead:p("returning.description")}):(0,f.jsx)(tt,{title:p(a?"native.face.humanIntroTitle":"native.face.introTitle"),lead:p(a?"native.face.humanIntroLead":"native.face.introLead")}),d!==void 0?(0,f.jsx)(Cn,{retry:d,title:He[w].title}):null,r!==void 0&&N===null?(0,f.jsx)("p",{className:"sekyro-section-label",children:r}):null,(0,f.jsx)("ul",{className:"sekyro-tiprows",children:N!==null?N.map(R=>(0,f.jsxs)("li",{children:[(0,f.jsx)(Ee,{name:Jn[R]??"face"}),p(R)]},R)):n!==void 0?n.map(R=>(0,f.jsxs)("li",{children:[(0,f.jsx)(Ee,{name:Qn[R.id]??"face"}),R.text]},R.id)):(0,f.jsxs)(f.Fragment,{children:[(0,f.jsxs)("li",{children:[(0,f.jsx)(Ee,{name:"light"}),p("capture.tips.light")]}),(0,f.jsxs)("li",{children:[(0,f.jsx)(Ee,{name:"jGlasses"}),p("capture.tips.uncover")]}),(0,f.jsxs)("li",{children:[(0,f.jsx)(Ee,{name:"smartphone"}),p("capture.tips.eyeLevel")]})]})}),c??null,c!==void 0?null:t.assets==="failed"?(0,f.jsx)(te,{kind:"secondary",full:!0,onClick:t.retryAssets,children:p("common.retry")}):null,c!==void 0?null:(0,f.jsx)(Cr,{children:(0,f.jsxs)(te,{full:!0,disabled:t.assets!=="ready"||j,"aria-busy":t.assets==="loading"||void 0,onClick:e,children:[(0,f.jsx)(Ee,{name:"camera"}),p("capture.start")]})})]})}o(es,"re");s(es,"FaceIntro");var ts=new Set(["match_inconclusive","no_face_source","below_threshold"]);function Cn({retry:e,title:t}){let n=_t(),r=e.retakeHint===void 0?null:Je(e.retakeHint),a=e.reason==="probe_not_from_liveness"?"capture.retrySamePerson.message":ts.has(e.reason)?"capture.retryMatch.message":et(e.reason);return(0,f.jsxs)(wr,{tone:"warning",children:[r!==null?(0,f.jsx)("span",{children:n.t(r)}):a!==null?(0,f.jsx)("span",{children:n.t(a)}):null,r===null?(0,f.jsx)("span",{children:n.t(t)}):null,(0,f.jsx)("span",{children:Sr(n,e.attemptsRemaining,e.attemptsExhausted)})]})}o(Cn,"K");s(Cn,"RetryNotice");function rs(e){return kt(e)}o(rs,"ce");s(rs,"isInAppBrowser");function ns(e,t){let n=t??(typeof navigator>"u"?"":String(navigator.userAgent??""));if(!/Android/i.test(n))return null;let r;try{r=new URL(e)}catch{return null}if(r.protocol!=="https:"&&r.protocol!=="http:")return null;let a=r.protocol.slice(0,-1);return`intent://${r.host}${r.pathname}${r.search}#Intent;scheme=${a};action=android.intent.action.VIEW;S.browser_fallback_url=${encodeURIComponent(e)};end`}o(ns,"le");s(ns,"androidBrowserIntent");export{qr as a,Lt as b,Vn as c,an as d,zn as e,_s as f,ws as g,Yn as h,Wn as i,Xn as j,es as k,rs as l,ns as m};
@@ -1 +1 @@
1
- import{b,t as r,v as l,y as o}from"./chunk-BMTTAXWY.js";import{a as i}from"./chunk-5QL6W6FW.js";import{a,c as p}from"./chunk-4FHWXBOB.js";var s=p(b(),1);function f({tone:d,icon:n,busy:c,title:m,titleId:e,children:u,actions:t,live:y,testId:h}){let k=r();return(0,s.jsxs)("section",{className:"sekyro-step sekyro-status",...e!==void 0?{"aria-labelledby":e}:{},...y?{role:"status","aria-live":"polite"}:{},"data-testid":h,children:[(0,s.jsxs)("div",{className:"sekyro-status__body",children:[(0,s.jsx)("span",{className:`sekyro-tile sekyro-tile--${d}${c?" is-busy":""}`,"aria-hidden":"true",children:(0,s.jsx)(l,{name:n})}),(0,s.jsxs)("div",{className:"sekyro-heading sekyro-status__text",children:[(0,s.jsx)("h2",{id:e,ref:k,tabIndex:-1,className:"sekyro-text-body",children:m}),u]})]}),t!=null&&t!==!1?(0,s.jsx)(o,{children:t}):null]})}a(f,"g");i(f,"StatusPage");export{f as a};
1
+ import{b,t as r,v as l,y as o}from"./chunk-CUFOLAZN.js";import{a as i}from"./chunk-5QL6W6FW.js";import{a,c as p}from"./chunk-4FHWXBOB.js";var s=p(b(),1);function f({tone:d,icon:n,busy:c,title:m,titleId:e,children:u,actions:t,live:y,testId:h}){let k=r();return(0,s.jsxs)("section",{className:"sekyro-step sekyro-status",...e!==void 0?{"aria-labelledby":e}:{},...y?{role:"status","aria-live":"polite"}:{},"data-testid":h,children:[(0,s.jsxs)("div",{className:"sekyro-status__body",children:[(0,s.jsx)("span",{className:`sekyro-tile sekyro-tile--${d}${c?" is-busy":""}`,"aria-hidden":"true",children:(0,s.jsx)(l,{name:n})}),(0,s.jsxs)("div",{className:"sekyro-heading sekyro-status__text",children:[(0,s.jsx)("h2",{id:e,ref:k,tabIndex:-1,className:"sekyro-text-body",children:m}),u]})]}),t!=null&&t!==!1?(0,s.jsx)(o,{children:t}):null]})}a(f,"g");i(f,"StatusPage");export{f as a};
@@ -0,0 +1 @@
1
+ import{a as t,b as r,c as m,d as o,e as a,f as p}from"./chunk-AUH3O7Y7.js";import"./chunk-LSBUNQZU.js";import"./chunk-F4Q2Q4OC.js";import"./chunk-4QUL7TEF.js";import"./chunk-WICQIC37.js";import"./chunk-P7K7ELYZ.js";import"./chunk-6MYG4HWP.js";import"./chunk-JS2IXPNL.js";import"./chunk-SLLJX5QK.js";import"./chunk-4FHWXBOB.js";export{r as BARCODE_BUDGET_MS,m as FACE_CONFIRM_BUDGET_MS,t as SAME_FACE_MAX_DROPS,a as createDocumentCapture,p as createDocumentCaptureInternal,o as warmDocumentCapture};