@sekyro/elements 0.1.0-rc.17 → 0.1.0-rc.18

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 (90) hide show
  1. package/CHANGELOG.md +9 -0
  2. package/dist/cdn/chunks/{capture-session-doc-MGDYUASI-LYQ23KS6.js → capture-session-doc-J4MIDQOS-DYA3TI2D.js} +1 -1
  3. package/dist/cdn/chunks/{chunk-QR7XWTXK.js → chunk-3XCA56FW.js} +1 -1
  4. package/dist/cdn/chunks/{chunk-SI6GIBVC.js → chunk-4QPD5ZMB.js} +1 -1
  5. package/dist/cdn/chunks/{chunk-PRMQUJTM.js → chunk-62FWEZDF.js} +1 -1
  6. package/dist/cdn/chunks/{chunk-3DAULGZ2.js → chunk-C5LJ5ZHE.js} +1 -1
  7. package/dist/cdn/chunks/chunk-CH3JN7FV.js +1 -0
  8. package/dist/cdn/chunks/{chunk-BR5RW4XZ.js → chunk-ECAWI75T.js} +1 -1
  9. package/dist/cdn/chunks/{chunk-3APQX7OW.js → chunk-EHIN4Z6H.js} +1 -1
  10. package/dist/cdn/chunks/{chunk-3S7YMUPU.js → chunk-F4Q2Q4OC.js} +1 -1
  11. package/dist/cdn/chunks/{chunk-IGZCP7OY.js → chunk-IWZRAEUN.js} +1 -1
  12. package/dist/cdn/chunks/{chunk-Z5QOJL3W.js → chunk-KOTLQOUY.js} +1 -1
  13. package/dist/cdn/chunks/{chunk-HM65LKWB.js → chunk-MK5WGJZO.js} +1 -1
  14. package/dist/cdn/chunks/{chunk-NPTVQXUW.js → chunk-NPEJKEWK.js} +1 -1
  15. package/dist/cdn/chunks/chunk-PP4PZVFR.js +3 -0
  16. package/dist/cdn/chunks/chunk-QWBHA4YX.js +33 -0
  17. package/dist/cdn/chunks/{chunk-DCTDTKG7.js → chunk-SYZUFSPK.js} +1 -1
  18. package/dist/cdn/chunks/{chunk-RPMVDYDV.js → chunk-TODKCK6A.js} +1 -1
  19. package/dist/cdn/chunks/{chunk-DHMC5D6M.js → chunk-UE6IZTZA.js} +1 -1
  20. package/dist/cdn/chunks/{chunk-Z6KNLRUW.js → chunk-VYFRJNC5.js} +1 -1
  21. package/dist/cdn/chunks/{chunk-2MJOW3FG.js → chunk-WVDCPIC3.js} +1 -1
  22. package/dist/cdn/chunks/{chunk-E5YZMFCZ.js → chunk-WZFFQZE2.js} +1 -1
  23. package/dist/cdn/chunks/{chunk-6TIQ2463.js → chunk-Y6VKSYVY.js} +1 -1
  24. package/dist/cdn/chunks/{chunk-6L4TYBV7.js → chunk-YZE7YZVV.js} +1 -1
  25. package/dist/cdn/chunks/{chunk-E5JQU363.js → chunk-ZF7TAXXU.js} +1 -1
  26. package/dist/cdn/chunks/{create-document-capture-KISF6XD3-R6PFAJU6.js → create-document-capture-SMEKDBGF-DISVYLXM.js} +1 -1
  27. package/dist/cdn/chunks/{detector-scanic-JC25DD3A-YZ3NPKMQ.js → detector-scanic-P2RTEQUV-A5WTP2Q7.js} +1 -1
  28. package/dist/cdn/chunks/document-capture-view-TV2VKLPV-6ZFRPTO3.js +1 -0
  29. package/dist/cdn/chunks/{eid-view-ZM7QAEME-DIL3UVBB.js → eid-view-VC3DHQWV-IBAI3YPF.js} +1 -1
  30. package/dist/cdn/chunks/{email-otp-view-EYS26ZZM-UNGUBHFI.js → email-otp-view-QCELBL7U-XSYVFDW7.js} +1 -1
  31. package/dist/cdn/chunks/flow-views-VCE6CEBN-Y6VVTJPN.js +1 -0
  32. package/dist/cdn/chunks/{form-view-Y5KA6R5T-KUDCNJNS.js → form-view-P2GVOYAC-ZWBQXCK3.js} +1 -1
  33. package/dist/cdn/chunks/overlay-de-EMTSLK3M-LA7EI7SW.js +1 -0
  34. package/dist/cdn/chunks/overlay-es-6WMAHH33-66DPI2L6.js +1 -0
  35. package/dist/cdn/chunks/overlay-pt-WBGMJQTQ-IOBB3HFB.js +1 -0
  36. package/dist/cdn/chunks/plan-runner-ZVYJ3UI3-PDRZPFOE.js +1 -0
  37. package/dist/cdn/chunks/{portrait-capture-view-E5LKQQ5Y-3HNPCMBJ.js → portrait-capture-view-QYEEV2D6-XMKA6YZR.js} +1 -1
  38. package/dist/cdn/chunks/{portrait-review-view-NJHH2E4W-B3RFT2PG.js → portrait-review-view-E3SBOU4F-QVDIDUCS.js} +1 -1
  39. package/dist/cdn/chunks/{proof-of-address-view-LS3JZUTD-MDTXER25.js → proof-of-address-view-NIAKWB6B-43ZQX5T6.js} +1 -1
  40. package/dist/cdn/define.js +1 -1
  41. package/dist/cdn/index.js +1 -1
  42. package/dist/{chunk-MWTOWGEI.js → chunk-46JFMIK7.js} +1 -1
  43. package/dist/{chunk-6NNMOFMF.js → chunk-5S5OC2EE.js} +1 -1
  44. package/dist/{chunk-WLCS5VAA.js → chunk-77AEILD6.js} +1 -1
  45. package/dist/chunk-BMRETLHG.js +33 -0
  46. package/dist/chunk-C3WB5BAA.js +1 -0
  47. package/dist/{chunk-5NSMKCTW.js → chunk-ELSYMAAW.js} +1 -1
  48. package/dist/{chunk-734Y6RUV.js → chunk-ENXYUW3S.js} +1 -1
  49. package/dist/{chunk-VJZANYM3.js → chunk-FKGVTX2Y.js} +1 -1
  50. package/dist/{chunk-D3TZZ4SI.js → chunk-IBMR3ZXU.js} +1 -1
  51. package/dist/{chunk-2WYXQYNY.js → chunk-JKDI3DQD.js} +1 -1
  52. package/dist/{chunk-ICJ544T4.js → chunk-N5JOXWJJ.js} +1 -1
  53. package/dist/{chunk-AJHRPKD4.js → chunk-SBLFJ2MR.js} +1 -1
  54. package/dist/{chunk-YVGOUZ7T.js → chunk-VFLMBXU5.js} +1 -1
  55. package/dist/{chunk-ZUFN5VIE.js → chunk-X2RZOTUB.js} +1 -1
  56. package/dist/define.cjs +5 -5
  57. package/dist/define.js +1 -1
  58. package/dist/document-capture-view-TV2VKLPV-7EOLXSFW.js +1 -0
  59. package/dist/{eid-view-ZM7QAEME-7FRC3TV6.js → eid-view-VC3DHQWV-IB3JCWRI.js} +1 -1
  60. package/dist/{email-otp-view-EYS26ZZM-EESWRHKM.js → email-otp-view-QCELBL7U-K6OU6CWG.js} +1 -1
  61. package/dist/flow-views-VCE6CEBN-EYXMVPZI.js +1 -0
  62. package/dist/{form-view-Y5KA6R5T-DOZFYGBK.js → form-view-P2GVOYAC-R5HGNTAJ.js} +1 -1
  63. package/dist/index.cjs +5 -5
  64. package/dist/index.d.cts +1 -0
  65. package/dist/index.d.ts +1 -0
  66. package/dist/index.js +1 -1
  67. package/dist/overlay-de-EMTSLK3M-KNNEJ2DR.js +1 -0
  68. package/dist/overlay-es-6WMAHH33-YZN2JC7A.js +1 -0
  69. package/dist/overlay-pt-WBGMJQTQ-Y6AG6QUZ.js +1 -0
  70. package/dist/{portrait-capture-view-E5LKQQ5Y-E3BRULLL.js → portrait-capture-view-QYEEV2D6-OD3VHIKE.js} +1 -1
  71. package/dist/{portrait-review-view-NJHH2E4W-CKMVD7ME.js → portrait-review-view-E3SBOU4F-DJAWJV6V.js} +1 -1
  72. package/dist/{proof-of-address-view-LS3JZUTD-ZQ4BDFNP.js → proof-of-address-view-NIAKWB6B-4ZP6SD46.js} +1 -1
  73. package/package.json +2 -2
  74. package/sbom.cdx.json +4 -4
  75. package/dist/cdn/chunks/chunk-4RGDPCRE.js +0 -33
  76. package/dist/cdn/chunks/chunk-BDRBGJA3.js +0 -3
  77. package/dist/cdn/chunks/chunk-Q7ACZDU4.js +0 -1
  78. package/dist/cdn/chunks/document-capture-view-7ZSM7YTT-UHYBVOQI.js +0 -1
  79. package/dist/cdn/chunks/flow-views-7SAYQQ62-2TENAJ6C.js +0 -1
  80. package/dist/cdn/chunks/overlay-de-4OISTBDL-WWT74VG7.js +0 -1
  81. package/dist/cdn/chunks/overlay-es-YO5UCAO2-U3OAELIS.js +0 -1
  82. package/dist/cdn/chunks/overlay-pt-E7PSFLLQ-ZPN4CLS4.js +0 -1
  83. package/dist/cdn/chunks/plan-runner-NWK4LZFI-CDXUYVEW.js +0 -1
  84. package/dist/chunk-2EMXU2MG.js +0 -33
  85. package/dist/chunk-XI37ATRU.js +0 -1
  86. package/dist/document-capture-view-7ZSM7YTT-GLHWVI3B.js +0 -1
  87. package/dist/flow-views-7SAYQQ62-3NIWXTDB.js +0 -1
  88. package/dist/overlay-de-4OISTBDL-TH46LT3S.js +0 -1
  89. package/dist/overlay-es-YO5UCAO2-NBICE576.js +0 -1
  90. package/dist/overlay-pt-E7PSFLLQ-NCA5NABT.js +0 -1
@@ -1 +1 @@
1
- import{c as M}from"./chunk-3S7YMUPU.js";import{a as c}from"./chunk-P7K7ELYZ.js";import{a as r}from"./chunk-4FHWXBOB.js";var T=480,I=Object.freeze({MIN_AREA_FRAC:.15,EDGE_CLIP_MARGIN_PX:4,STABLE_TICKS:3,IOU_STABLE_MIN:.85,RISE_PER_S:.9,FALL_PER_S:.25,GUIDE_EXPOSURE:.6,GUIDE_SHARPNESS:.35,ID3_BAND_MIN_WIDTH_FRAC:.55,ID3_BAND_ASPECT_MIN:4,ID3_BAND_ASPECT_MAX:40}),x=r(i=>Math.min(1,Math.max(0,i)),"p");function E(i,h,t){let s=[i.topLeft,i.topRight,i.bottomRight,i.bottomLeft],e=0;for(let a=0;a<4;a++){let l=s[a],_=s[(a+1)%4];e+=l.x*_.y-_.x*l.y}let o=h*t;return o>0?Math.abs(e/2)/o:0}r(E,"E");function g(i,h){let t=A(i),s=A(h),e=Math.max(t.x1,s.x1),o=Math.max(t.y1,s.y1),a=Math.min(t.x2,s.x2),l=Math.min(t.y2,s.y2),_=Math.max(0,a-e)*Math.max(0,l-o),d=(t.x2-t.x1)*(t.y2-t.y1),u=(s.x2-s.x1)*(s.y2-s.y1),p=d+u-_;return p>0?_/p:0}r(g,"I");function L(i){let h=A(i);return{width:h.x2-h.x1,height:h.y2-h.y1}}r(L,"R");function A(i){let h=[i.topLeft,i.topRight,i.bottomRight,i.bottomLeft];return{x1:Math.min(...h.map(t=>t.x)),y1:Math.min(...h.map(t=>t.y)),x2:Math.max(...h.map(t=>t.x)),y2:Math.max(...h.map(t=>t.y))}}r(A,"D");function S(i){let h=Math.hypot(i.topRight.x-i.topLeft.x,i.topRight.y-i.topLeft.y),t=Math.hypot(i.bottomRight.x-i.bottomLeft.x,i.bottomRight.y-i.bottomLeft.y),s=Math.hypot(i.bottomLeft.x-i.topLeft.x,i.bottomLeft.y-i.topLeft.y),e=Math.hypot(i.bottomRight.x-i.topRight.x,i.bottomRight.y-i.topRight.y),o=(h+t)/2,a=(s+e)/2;return o<=0||a<=0?0:Math.max(o,a)/Math.min(o,a)}r(S,"M");var n,N=(n=class{constructor(h,t={}){this.p=0,this.lastTickAt=null,this.lastQuad=null,this.streak=0,this.format=h,this.t={...I,...t}}reset(){this.p=0,this.lastTickAt=null,this.lastQuad=null,this.streak=0}tick(h){let{quad:t,quality:s,timestampMs:e}=h,o=this.lastTickAt===null?0:Math.max(0,(e-this.lastTickAt)/1e3);this.lastTickAt=e;let a=null;if(t===null)a="dcv1.no_doc";else if(this.format==="ID-3"){let m=L(t),y=m.height>0?m.width/m.height:0;m.width<this.t.ID3_BAND_MIN_WIDTH_FRAC*h.frameWidth?a="dcv1.come_closer":this.edgeClipped(t,h.frameWidth,h.frameHeight)?a="dcv1.fit_document":(y<this.t.ID3_BAND_ASPECT_MIN||y>this.t.ID3_BAND_ASPECT_MAX)&&(a="dcv1.wrong_shape")}else E(t,h.frameWidth,h.frameHeight)<this.t.MIN_AREA_FRAC?a="dcv1.come_closer":this.edgeClipped(t,h.frameWidth,h.frameHeight)?a="dcv1.fit_document":M(this.format,S(t))||(a="dcv1.wrong_shape");let l=a===null,_=x(s.exposure)>=this.t.GUIDE_EXPOSURE,d=x(s.sharpness)>=this.t.GUIDE_SHARPNESS,u=_&&d;if(l&&u&&t!==null){let m=this.lastQuad===null||g(t,this.lastQuad)>=this.t.IOU_STABLE_MIN;this.streak=m?this.streak+1:1}else this.streak=0;this.lastQuad=t;let p=l&&u;this.p=x(this.p+(p?this.t.RISE_PER_S:-this.t.FALL_PER_S)*o);let R=p&&this.streak>=this.t.STABLE_TICKS,f;if(a!==null)f=a;else if(_)d?f="dcv1.hold_still":f="dcv1.steady";else{let m=(c[0]+c[1])/2;f=s.meanLuma<m?"dcv1.more_light":"dcv1.too_bright"}return{at:e,quad:t,plausible:l,p:this.p,guidanceKey:f,ready:R,stableTicks:this.streak}}edgeClipped(h,t,s){let e=this.t.EDGE_CLIP_MARGIN_PX;return[h.topLeft,h.topRight,h.bottomRight,h.bottomLeft].some(o=>o.x<=e||o.y<=e||o.x>=t-e||o.y>=s-e)}},r(n,"d"),n);export{T as a,I as b,E as c,L as d,N as e};
1
+ import{c as M}from"./chunk-F4Q2Q4OC.js";import{a as c}from"./chunk-P7K7ELYZ.js";import{a as r}from"./chunk-4FHWXBOB.js";var T=480,I=Object.freeze({MIN_AREA_FRAC:.15,EDGE_CLIP_MARGIN_PX:4,STABLE_TICKS:3,IOU_STABLE_MIN:.85,RISE_PER_S:.9,FALL_PER_S:.25,GUIDE_EXPOSURE:.6,GUIDE_SHARPNESS:.35,ID3_BAND_MIN_WIDTH_FRAC:.55,ID3_BAND_ASPECT_MIN:4,ID3_BAND_ASPECT_MAX:40}),x=r(i=>Math.min(1,Math.max(0,i)),"p");function E(i,h,t){let s=[i.topLeft,i.topRight,i.bottomRight,i.bottomLeft],e=0;for(let a=0;a<4;a++){let l=s[a],_=s[(a+1)%4];e+=l.x*_.y-_.x*l.y}let o=h*t;return o>0?Math.abs(e/2)/o:0}r(E,"E");function g(i,h){let t=A(i),s=A(h),e=Math.max(t.x1,s.x1),o=Math.max(t.y1,s.y1),a=Math.min(t.x2,s.x2),l=Math.min(t.y2,s.y2),_=Math.max(0,a-e)*Math.max(0,l-o),d=(t.x2-t.x1)*(t.y2-t.y1),u=(s.x2-s.x1)*(s.y2-s.y1),p=d+u-_;return p>0?_/p:0}r(g,"I");function L(i){let h=A(i);return{width:h.x2-h.x1,height:h.y2-h.y1}}r(L,"R");function A(i){let h=[i.topLeft,i.topRight,i.bottomRight,i.bottomLeft];return{x1:Math.min(...h.map(t=>t.x)),y1:Math.min(...h.map(t=>t.y)),x2:Math.max(...h.map(t=>t.x)),y2:Math.max(...h.map(t=>t.y))}}r(A,"D");function S(i){let h=Math.hypot(i.topRight.x-i.topLeft.x,i.topRight.y-i.topLeft.y),t=Math.hypot(i.bottomRight.x-i.bottomLeft.x,i.bottomRight.y-i.bottomLeft.y),s=Math.hypot(i.bottomLeft.x-i.topLeft.x,i.bottomLeft.y-i.topLeft.y),e=Math.hypot(i.bottomRight.x-i.topRight.x,i.bottomRight.y-i.topRight.y),o=(h+t)/2,a=(s+e)/2;return o<=0||a<=0?0:Math.max(o,a)/Math.min(o,a)}r(S,"M");var n,N=(n=class{constructor(h,t={}){this.p=0,this.lastTickAt=null,this.lastQuad=null,this.streak=0,this.format=h,this.t={...I,...t}}reset(){this.p=0,this.lastTickAt=null,this.lastQuad=null,this.streak=0}tick(h){let{quad:t,quality:s,timestampMs:e}=h,o=this.lastTickAt===null?0:Math.max(0,(e-this.lastTickAt)/1e3);this.lastTickAt=e;let a=null;if(t===null)a="dcv1.no_doc";else if(this.format==="ID-3"){let m=L(t),y=m.height>0?m.width/m.height:0;m.width<this.t.ID3_BAND_MIN_WIDTH_FRAC*h.frameWidth?a="dcv1.come_closer":this.edgeClipped(t,h.frameWidth,h.frameHeight)?a="dcv1.fit_document":(y<this.t.ID3_BAND_ASPECT_MIN||y>this.t.ID3_BAND_ASPECT_MAX)&&(a="dcv1.wrong_shape")}else E(t,h.frameWidth,h.frameHeight)<this.t.MIN_AREA_FRAC?a="dcv1.come_closer":this.edgeClipped(t,h.frameWidth,h.frameHeight)?a="dcv1.fit_document":M(this.format,S(t))||(a="dcv1.wrong_shape");let l=a===null,_=x(s.exposure)>=this.t.GUIDE_EXPOSURE,d=x(s.sharpness)>=this.t.GUIDE_SHARPNESS,u=_&&d;if(l&&u&&t!==null){let m=this.lastQuad===null||g(t,this.lastQuad)>=this.t.IOU_STABLE_MIN;this.streak=m?this.streak+1:1}else this.streak=0;this.lastQuad=t;let p=l&&u;this.p=x(this.p+(p?this.t.RISE_PER_S:-this.t.FALL_PER_S)*o);let R=p&&this.streak>=this.t.STABLE_TICKS,f;if(a!==null)f=a;else if(_)d?f="dcv1.hold_still":f="dcv1.steady";else{let m=(c[0]+c[1])/2;f=s.meanLuma<m?"dcv1.more_light":"dcv1.too_bright"}return{at:e,quad:t,plausible:l,p:this.p,guidanceKey:f,ready:R,stableTicks:this.streak}}edgeClipped(h,t,s){let e=this.t.EDGE_CLIP_MARGIN_PX;return[h.topLeft,h.topRight,h.bottomRight,h.bottomLeft].some(o=>o.x<=e||o.y<=e||o.x>=t-e||o.y>=s-e)}},r(n,"d"),n);export{T as a,I as b,E as c,L as d,N as e};
@@ -1 +1 @@
1
- import{a as Nr}from"./chunk-HM65LKWB.js";import{c as _t}from"./chunk-Q7ACZDU4.js";import{b as kr,d as br}from"./chunk-E5JQU363.js";import{b as xr,c as Ct}from"./chunk-BR5RW4XZ.js";import{a as yr,b as gr,c as vr,d as Me}from"./chunk-DHMC5D6M.js";import{F as _r,K as wr,L as Sr,a as K,b as de,c as te,m as pr,n as Xe,p as hr,q as et,r as fr,s as mr,t as bt,u as oe,v as Ee,w as tt,y as Cr}from"./chunk-Z6KNLRUW.js";import{c as ir,d as cr,e as ur,h as dr}from"./chunk-E5YZMFCZ.js";import{b as kt}from"./chunk-RPMVDYDV.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),F=U(de(),1),C=U(K(),1),m=U(K(),1),at=U(K(),1),fe=U(de(),1),Wr=U(K(),1),Q=U(K(),1),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 J=U(K(),1);var E=U(K(),1),me=U(K(),1),Te=U(K(),1),At=U(de(),1),v=U(de(),1);function ie({className:e,children:t}){return(0,y.jsx)("svg",{"aria-hidden":"true",focusable:"false",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",className:e??"sekyro-icon sekyro-icon--sm",children:t})}o(ie,"ne");s(ie,"Svg");var Mt="M4 7.5h2.2l1.4-1.9h8.8l1.4 1.9H20a1.6 1.6 0 0 1 1.6 1.6v8.3A1.6 1.6 0 0 1 20 19H4a1.6 1.6 0 0 1-1.6-1.6V9.1A1.6 1.6 0 0 1 4 7.5Z";function Mr(e){return(0,y.jsxs)(ie,{...e,children:[(0,y.jsx)("circle",{cx:"12",cy:"12",r:"4"}),(0,y.jsx)("path",{d:"M12 2.5v2M12 19.5v2M2.5 12h2M19.5 12h2M5.3 5.3l1.4 1.4M17.3 17.3l1.4 1.4M5.3 18.7l1.4-1.4M17.3 6.7l1.4-1.4"})]})}o(Mr,"ln");s(Mr,"SunIcon");function Er(e){return(0,y.jsxs)(ie,{...e,children:[(0,y.jsx)("circle",{cx:"12",cy:"12",r:"9"}),(0,y.jsx)("path",{d:"M9 10h.01M15 10h.01M8.8 14.6a4.2 4.2 0 0 0 6.4 0"})]})}o(Er,"un");s(Er,"FaceUncoveredIcon");function Lr(e){return(0,y.jsxs)(ie,{...e,children:[(0,y.jsx)("rect",{x:"7",y:"2.5",width:"10",height:"19",rx:"2"}),(0,y.jsx)("path",{d:"M10.5 18.5h3M2.5 9.5h2.5M19 9.5h2.5"}),(0,y.jsx)("circle",{cx:"12",cy:"9.5",r:"1.6"})]})}o(Lr,"dn");s(Lr,"PhoneEyeLevelIcon");function Ir(e){return(0,y.jsxs)(ie,{...e,children:[(0,y.jsx)("path",{d:"M2.5 12S6 5.5 12 5.5 21.5 12 21.5 12 18 18.5 12 18.5 2.5 12 2.5 12Z"}),(0,y.jsx)("circle",{cx:"12",cy:"12",r:"2.8"})]})}o(Ir,"pn");s(Ir,"LookStraightIcon");function Ur(e){return(0,y.jsxs)(ie,{...e,children:[(0,y.jsx)("path",{d:Mt}),(0,y.jsx)("path",{d:"M9 13l2 2 4-4"})]})}o(Ur,"fn");s(Ur,"CameraCheckIcon");function jr(e){return(0,y.jsxs)(ie,{...e,children:[(0,y.jsx)("path",{d:Mt}),(0,y.jsx)("path",{d:"M10.2 11.2a1.9 1.9 0 1 1 2.6 1.8c-.5.2-.8.6-.8 1.1v.3M12 16.4h.01"})]})}o(jr,"mn");s(jr,"CameraAskIcon");function Tr(e){return(0,y.jsxs)(ie,{...e,children:[(0,y.jsx)("path",{d:Mt}),(0,y.jsx)("path",{d:"M3 3l18 18"})]})}o(Tr,"yn");s(Tr,"CameraBlockedIcon");function nt({off:e,className:t}){return(0,y.jsxs)(ie,{className:t,children:[(0,y.jsx)("path",{d:"M4.5 9.5v5H8l4 3.5v-12L8 9.5H4.5Z"}),e?(0,y.jsx)("path",{d:"M4 4l16 16"}):(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)("path",{d:"M15.5 9.7a3.6 3.6 0 0 1 0 4.6"}),(0,y.jsx)("path",{d:"M18 7.6a6.6 6.6 0 0 1 0 8.8"})]})]})}o(nt,"Ve");s(nt,"SpeakerIcon");function Or(e){return(0,y.jsx)(ie,{...e,children:(0,y.jsx)("path",{d:"M5 12.5l4.5 4.5L19 7.5"})})}o(Or,"gn");s(Or,"CheckIcon");function Pr(e){return(0,y.jsxs)(ie,{className:e.className??"sekyro-spinner",children:[(0,y.jsx)("circle",{cx:"12",cy:"12",r:"9",opacity:"0.25"}),(0,y.jsx)("path",{d:"M21 12a9 9 0 0 0-9-9"})]})}o(Pr,"hn");s(Pr,"SpinnerIcon");var wt=["light","uncover","eyeLevel","straight"],Ln={light:{key:"capture.tips.light",icon:s(()=>(0,re.jsx)(Mr,{}),"icon")},uncover:{key:"capture.tips.uncover",icon:s(()=>(0,re.jsx)(Er,{}),"icon")},eyeLevel:{key:"capture.tips.eyeLevel",icon:s(()=>(0,re.jsx)(Lr,{}),"icon")},straight:{key:"capture.tips.straight",icon:s(()=>(0,re.jsx)(Ir,{}),"icon")}};function Br({tips:e}){let t=Me(),n=(0,Ar.useId)();return e.length===0?null:(0,re.jsxs)("section",{className:"sekyro-tips","aria-labelledby":n,"data-testid":"sekyro-tips",children:[(0,re.jsx)("p",{className:"sekyro-tips__title",id:n,children:t("capture.tips.title")}),(0,re.jsx)("ul",{className:"sekyro-tips__list",children:e.map(r=>{let a=typeof r=="string"?Ln[r]:void 0,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 In=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)},In))},"choose");return(0,F.jsxs)("section",{className:"sekyro-stack sekyro-stack--4 sekyro-choice","aria-labelledby":w,"data-testid":c,children:[(0,F.jsxs)("div",{className:d==="cards"?"sekyro-heading":"sekyro-stack sekyro-stack--1",children:[(0,F.jsx)("h2",{id:w,ref:l?N:void 0,tabIndex:-1,className:"sekyro-text-body",children:e}),t!==void 0&&t!==""?(0,F.jsx)("p",{className:"sekyro-text-muted",children:t}):null]}),a!==null?(0,F.jsx)(oe,{tone:"danger",children:(0,F.jsx)("span",{children:a})}):null,d==="buttons"?(0,F.jsx)("div",{className:"sekyro-stack sekyro-stack--3",children:n.map((A,X)=>(0,F.jsx)(te,{kind:X===0?"primary":"ghost",full:!0,disabled:r,"aria-busy":r||void 0,onClick:o(()=>p(A.id),"onClick"),children:A.label},A.id))}):(0,F.jsx)("div",{className:"sekyro-choices",children:n.map(A=>(0,F.jsxs)("button",{type:"button",className:"sekyro-card","aria-pressed":(j??S)===A.id,"aria-busy":r||void 0,disabled:r||j!==null&&j!==A.id,onClick:o(()=>q(A.id),"onClick"),children:[A.glyph!==void 0?(0,F.jsx)("span",{className:"sekyro-card__tile",children:A.glyph}):null,(0,F.jsxs)("span",{className:"sekyro-card__body",children:[(0,F.jsx)("span",{className:"sekyro-card__title",children:A.label}),A.sub!==void 0?(0,F.jsx)("span",{className:"sekyro-card__sub",children:A.sub}):null]}),(0,F.jsx)("span",{className:"sekyro-radio","aria-hidden":"true"})]},A.id))})]})}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 Un=s((e,t)=>Object.prototype.hasOwnProperty.call(e,t),"own");function je(e,t,n){let r;try{if(typeof e=="function")r=e(t,n);else{let a=e[n];r=a!=null&&Un(a,t)?a[t]:null}}catch{return null}return typeof r=="string"&&r!==""?r:null}o(je,"Me");s(je,"resolveClip");var jn="UklGRiQAAABXQVZFZm10IBAAAAABAAEAESsAACJWAAACABAAZGF0YQAAAAA=",Tn={ar:"ar-SA",fr:"fr-FR",en:"en-US",es:"es-ES",pt:"pt-BR",de:"de-DE"};function le(){return typeof window<"u"&&"speechSynthesis"in window?window.speechSynthesis:null}o(le,"re");s(le,"synth");function Dr(){return le()!==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 $r(e){if(!Dr())return!1;let t=[];try{t=le()?.getVoices()??[]}catch{return!0}return t.length===0||Et(t,e)!==void 0}o($r,"wn");s($r,"speechUsable");function Fr(e){let t=le();return t===null||typeof t.addEventListener!="function"?()=>{}:(t.addEventListener("voiceschanged",e),()=>t.removeEventListener?.("voiceschanged",e))}o(Fr,"Ln");s(Fr,"subscribeVoices");function De(e){try{let t=typeof location<"u"?location.href:"http://localhost/",n=new URL(e,t);return`clip:${n.origin}${n.pathname}`}catch{return`clip:${e}`}}o(De,"Ke");s(De,"clipIdentity");function xt(e){e.pause(),e.removeAttribute("src"),e.load()}o(xt,"Rn");s(xt,"release");function Hr(){let e=null,t=null,n=0,r=null,a=null,l=null,c=!1,d=null,S=[],p=new Map,w=s(()=>{S=le()?.getVoices()??[]},"loadVoices"),N=!1,j=s(()=>{let h=le();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=le();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),le()?.cancel()},"stop"),A=s(h=>{for(let x of h){let _=De(x);if(p.has(_))continue;let k=new Audio;k.preload="auto",k.src=x,p.set(_,k)}},"warmClips"),X=s((h,x,_)=>{let k={utterance:h,generation:x,end:_};d=k;let u=s(()=>x===n&&d===k,"live"),M=s(()=>{u()&&(a=k)},"block");if(le()?.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;X(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&&X(u.utterance,u.generation,u.end);let M=R();if(t===null&&typeof Blob=="function"&&typeof URL.createObjectURL=="function"){let T=Uint8Array.from(atob(jn),O=>O.charCodeAt(0));t=URL.createObjectURL(new Blob([T],{type:"audio/wav"}))}let I=M.paused===!1&&t!==null&&M.src!==t;t!==null&&!I&&(u===null||u.utterance.url===null)&&(M.muted=!0,M.onended=null,M.src=t,M.play()?.catch(()=>{}));let D=le(),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&&le()?.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(Hr,"_n");s(Hr,"createVoicePlayer");var On="sekyro.voiceGuidance";function Gr(e){try{if(typeof window>"u")return null;let t=window.localStorage.getItem(e);return t==="1"?!0:t==="0"?!1:null}catch{return null}}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",Pn=typeof window<"u"?C.useLayoutEffect:C.useEffect,Bn=Object.freeze({});function rt(e,t){let n=new Set,r=[];for(let a of Vr){let 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?On:a.storageKey,[c,d]=(0,C.useState)(a.defaultEnabled??!0),S=(0,C.useRef)(c),[p,w]=(0,C.useState)(!1),[N,j]=(0,C.useState)("none"),[R,B]=(0,C.useState)(!1),q=(0,C.useRef)(!1),[A,X]=(0,C.useState)(0),h=(0,C.useRef)(null),x=(0,C.useCallback)(()=>(h.current??(h.current=Hr()),h.current),[]),_=Tn[e],k=a.speechFallback,u=k===void 0||k===!0?!0:k===!1?!1:k.includes(e),M=a.clips??t??Bn,I=(0,C.useRef)(!1),D=(0,C.useRef)(M);Pn(()=>{D.current=M,S.current=c}),(0,C.useEffect)(()=>{if(r||l===null)return;let L=Gr(l);L!==null&&(S.current=L,d(L))},[r,l]),(0,C.useEffect)(()=>{if(!(r||!u))return Fr(()=>X(L=>L+1))},[r,u]);let i=a.clips;(0,C.useEffect)(()=>{if(r)return;let L=u&&$r(_);w(rt(M,e).length>0||L),j(i!==void 0&&je(i,Ve,e)!==null?"partner":je(M,Ve,e)!==null||L?"default":"none")},[r,M,i,e,u,_,A]),(0,C.useEffect)(()=>{if(r||!c||!I.current)return;let L=rt(M,e);L.length>0&&x().prefetch(L)},[r,c,M,e,x]),(0,C.useEffect)(()=>()=>{h.current?.dispose(),h.current=null,I.current=!1},[]);let T=(0,C.useCallback)(L=>{r||(I.current=!0,x().unlock({lang:_,speech:u,...L?{prefetch:rt(D.current,e)}:{}}))},[r,x,_,u,e]),O=(0,C.useCallback)(()=>T(S.current),[T]),z=(0,C.useCallback)(()=>{q.current=!1,B(!1)},[]),$=(0,C.useCallback)(()=>{z(),h.current?.stop()},[z]),ge=(0,C.useCallback)(()=>{q.current&&$()},[$]),he=(0,C.useCallback)((L,xe)=>{if(r)return;if(q.current){$();return}let ve=x();ve.stop(),q.current=!0,B(!0);let V=xe?.clip===!1?null:je(D.current,Ve,e);ve.say({url:V,text:L,lang:_,speech:u,onEnd:z})},[r,$,x,e,_,u,z]),Y=(0,C.useCallback)(L=>{r||(L?T(!0):$(),l!==null&&Kr(l,L),S.current=L,d(L))},[r,T,$,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:$,summary:r?"none":N,summaryPlaying:R,toggleSummary:he,stopSummary:ge}),[r,p,c,Y,W,O,ne,$,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){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(ot,"Pn");s(ot,"retryCoachingOf");var $e={face:{title:"capture.retryCoaching.title",tips:["capture.retryCoaching.light","capture.retryCoaching.eyeLevel","capture.retryCoaching.head"]},one_face:{title:"capture.retryTips.title",tips:["capture.retryOneFace.alone","capture.retryOneFace.screens"]},front_camera:{title:"capture.retryTips.title",tips:["capture.retryFrontCamera.screenSide"]},back_camera:{title:"capture.retryTips.title",tips:["capture.retryBackCamera.backSide","capture.retryBackCamera.circle"]},upright:{title:"capture.retryTips.title",tips:["capture.retryUpright.vertical","capture.retryUpright.untilEnd"]},recording:{title:"capture.retryTips.title",tips:["capture.retryRecording.cameraOn","capture.retryRecording.stay","capture.retryRecording.network"]},device:{title:"capture.retryTips.title",tips:["capture.retryDevice.screenRecording","capture.retryDevice.phone"]}};function Yr({showCoaching:e,coaching:t="face",attemptsText:n,showRetake:r,onRetake:a}){let 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($e[t].title)}),(0,fe.jsx)("ul",{className:"sekyro-coaching",children:$e[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(Yr,"Tn");s(Yr,"CapturedPanel");function Lt(){try{return!1}catch{return!1}}o(Lt,"nt");s(Lt,"isDevBuild");var qn=(0,Wr.createContext)(null);function Jr({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(Jr,"On");s(Jr,"PermissionRow");function Qr({voice:e}){let t=Me();if(!e.supported)return null;let n=e.enabled;return(0,Se.jsxs)("button",{type:"button",role:"switch","aria-checked":n,className:"sekyro-switch","data-testid":"sekyro-voice-switch",onClick: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(Qr,"Hn");s(Qr,"VoiceSwitch");function Xr({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,Q.useRef)(c?.stop);N.current=c?.stop,(0,Q.useEffect)(()=>()=>N.current?.(),[]);let j=(0,Q.useRef)(null),R=(0,Q.useRef)(null),B=(0,Q.useRef)(null),q=(0,Q.useRef)(e),A=(0,Q.useRef)(!1);(0,Q.useEffect)(()=>{let u=q.current;if(q.current=e,u===e)return;let M=A.current;e!=="loading"&&(A.current=!1),en(j.current)&&(e==="failed"?B.current?.focus():M&&R.current?.focus())},[e]);let X=(0,Q.useCallback)(()=>{A.current=!0,t()},[t]),h=e==="loading",x=h||S,_=(0,Q.useCallback)(()=>{x||(N.current?.(),p())},[x,p]),k;return e==="failed"?k=(0,P.jsxs)(oe,{tone:"danger",testId:"sekyro-assets-error",children:[(0,P.jsx)("p",{className:"sekyro-text-body",children:w("fcv2.err.models")}),(0,P.jsx)(te,{kind:"ghost",ref:B,className:"sekyro-btn--start",onClick:X,"data-testid":"sekyro-assets-retry",children:w("common.retry")})]}):k=(0,P.jsxs)("div",{className:"sekyro-stack sekyro-stack--1",children:[(0,P.jsx)(te,{ref:R,full:!0,"data-testid":"sekyro-start","aria-disabled":x?"true":void 0,"aria-busy":h?"true":void 0,onClick:_,children:h?(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(Pr,{}),w("capture.preparing.title")]}):d??w("capture.start")}),h?(0,P.jsx)("p",{className:"sekyro-text-muted",children:w("capture.preparing.hint")}):null]}),(0,P.jsxs)("div",{ref:j,className:"sekyro-stack sekyro-stack--4","data-testid":"sekyro-intro","data-assets":e,children:[r==="assisted"?(0,P.jsxs)("div",{className:"sekyro-stack sekyro-stack--1","data-testid":"sekyro-assisted-intro",children:[(0,P.jsx)("h2",{className:"sekyro-text-body",children:w("capture.assisted.title")}),(0,P.jsx)("p",{className:"sekyro-text-muted",children:w("capture.assisted.lead")})]}):null,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)(Jr,{state:n}),(0,P.jsx)(Qr,{voice:a}),(0,P.jsx)("p",{className:"sekyro-text-muted",children:w("capture.securityNote")}),k,(0,P.jsx)("p",{role:"status",className:"sekyro-visually-hidden","data-testid":"sekyro-intro-status",children:e==="loading"?w("capture.preparing.title"):e==="ready"?w("capture.ready"):""})]})}o(Xr,"Fn");s(Xr,"PreCaptureScreen");function en(e){if(typeof document>"u")return!1;let t=document.activeElement;return t===null||t===document.body||e!==null&&e.contains(t)}o(en,"Ur");s(en,"focusIsOurs");function tn(){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(tn,"Dn");s(tn,"useCameraStatus");function rn(e){return It(e,"mobileRequired")}o(rn,"qn");s(rn,"useMobileRequired");function nn(e){return It(e,"returning").required}o(nn,"jn");s(nn,"useReturning");function It(e,t){let[n,r]=(0,pe.useState)({required:!1,settled:e===void 0});return(0,pe.useEffect)(()=>{let a=e?.[t];if(e===void 0||typeof a!="function"){r({required:!1,settled:!0});return}let 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 sn(e){let t=s(()=>e?.captureChoice??null,"initialChoice"),[n,r]=(0,pe.useState)(()=>({session:"self",choice:t(),settled:e===void 0}));(0,pe.useEffect)(()=>{let 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(sn,"$n");s(sn,"useCaptureMode");function an(e){let[t,n]=(0,pe.useState)(!1);return(0,pe.useEffect)(()=>{if(n(!1),e===void 0)return;let r=e.on("busy",()=>n(!0)),a=e.on("result",()=>n(!1));return()=>{r(),a()}},[e]),t}o(an,"zn");s(an,"useBusy");var Vn=s(()=>"idle","serverSnapshot");function Nt(e){return ir(e!==void 0?{assetBaseUrl:e}:{})}o(Nt,"Qn");s(Nt,"preload");function on(e,t=!0){let n=(0,J.useSyncExternalStore)((0,J.useCallback)(p=>ur(p,e),[e]),()=>cr(e),Vn),[r,a]=(0,J.useState)(null),l=(0,J.useRef)(!1),c=(0,J.useCallback)(()=>{Nt(e).then(p=>{l.current&&p==="idle"&&a({base:e})})},[e]);(0,J.useEffect)(()=>(l.current=!0,c(),()=>{l.current=!1}),[c]);let d=(0,J.useRef)(null);(0,J.useEffect)(()=>{if(n!=="idle"){d.current={base:e};return}!t||d.current===null||d.current.base!==e||(d.current=null,c())},[n,e,c,t]);let S=(0,J.useCallback)(()=>{Nt(e)},[e]);return{gate:r!==null&&r.base===e&&n==="idle"||n==="ready"?"ready":n==="failed"?"failed":"loading",retry:S}}o(on,"Jn");s(on,"useLivenessAssets");var Rr={progress:0,hint:null,faceDetected:!1};function ln(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,X]=(0,E.useState)(!1),[h,x]=(0,E.useState)(null),[_,k]=(0,E.useState)(null),[u,M]=(0,E.useState)(null),[I,D]=(0,E.useState)(null),[i,T]=(0,E.useState)(null),[O,z]=(0,E.useState)(!1),$=(0,E.useRef)(null),ge=(0,E.useRef)("idle"),he=(0,E.useRef)(-1),[Y,W]=(0,E.useState)(0),ne=(0,E.useRef)(e);ne.current=e,(0,E.useEffect)(()=>{let ee=t.current;if(ee===null)return;let ce={video:ee,...n!==void 0?{assetBaseUrl:n}:{}},H=r!==void 0?r.liveness(ce):dr(ce);l.current=H;let Ne=s(()=>T(H.facingMode??null),"readFacing");Ne();let Fe=[H.on("state",b=>{b==="mode_switch"?z(!0):b!=="starting"&&b!=="gating"&&z(!1),b==="starting"?(ge.current!=="starting"&&(he.current+=1,W(Math.max(0,he.current))),k(null),M(null),p(Rr),R(!1),N(!1),q(null),x(null),$.current=null):b==="gating"&&ge.current==="recording"&&(R(!1),N(!1),q(null),$.current=null),ge.current=b,Ne(),d(b),ne.current.onStateChange?.(b)}),H.on("gate",b=>{let ke=$.current;$.current=b.progress,N(ke!==null&&b.progress<ke-.001&&b.progress>0&&b.progress<1),b.progress>=1&&R(!0),p(b)}),H.on("frozen",({previewDataUrl:b})=>q(b)),H.on("profile",({animations:b})=>X(b==="reduced")),H.on("ramp",({colour:b})=>x(b)),H.on("captured",b=>{k(b),D(null),ne.current.onCaptured?.(b)}),H.on("error",b=>{M(b);let ke=r?.reportCaptureIssue;ke!==void 0&&Ct(Le=>ke.call(r,Le),xr("liveness",b,Math.max(0,he.current))),ne.current.onError?.(b)}),r?.on("result",b=>{D(b),ne.current.onResult?.(b)})];return()=>{for(let b of Fe)b?.();l.current=null,H.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 ce=l.current;if(ce===null||typeof ce.setCaptureMode!="function")return!1;let H=await ce.setCaptureMode(ee).catch(()=>!1)===!0;return H&&T(ce.facingMode??null),H},[]);return{state:c,gate:S,draining:w,gateLocked:j,frozenPreview:B,reduceMotion:A,rampColour:h,artifacts:_,error:u,result:I,facingMode:i,start:L,retry:xe,canSwitchCaptureMode:ve,setCaptureMode:V,modeRestarted:O,attempt:Y}}o(ln,"er");s(ln,"useLivenessHandle");var Dn=new Set(["national_number"]);function Rt(e){if(e==null||!e.available||e.selected!==null)return null;let t=e.options.filter(n=>Dn.has(n));return t.length>0?{...e,options:t}:null}o(Rt,"tr");s(Rt,"pending");function cn(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(cn,"nr");s(cn,"useMethodChoice");var $n=["ar","fr","en"];function un(e){if(typeof e!="string")return!1;try{let t=new URL(e);return t.protocol==="https:"||t.protocol==="http:"&&/^(localhost|127\.0\.0\.1)$/.test(t.hostname)}catch{return!1}}o(un,"so");s(un,"isClipUrl");function dn(e){let t=e.clips;if(typeof t!="object"||t===null)return null;let n={};for(let r of $n){let a=t[r];if(!(typeof a!="object"||a===null))for(let[l,c]of Object.entries(a))!st(l)||!un(c)||((n[r]??(n[r]={}))[l]=c)}return Object.keys(n).length>0?n:null}o(dn,"io");s(dn,"toVoiceClipMap");function pn(e){let[t,n]=(0,Te.useState)(null);(0,Te.useEffect)(()=>{if(n(null),e===void 0)return;let a=!0,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?dn(t):null,[t]);return e===void 0?null:r}o(pn,"rr");s(pn,"useServerVoiceClips");function hn({voice:e}){let t=Me();return(0,At.jsx)(te,{kind:"chip","aria-pressed":e.enabled,"aria-label":t("capture.voiceGuidance"),"data-testid":"sekyro-voice-toggle",onClick:o(()=>e.toggle(),"onClick"),children:(0,At.jsx)(nt,{off:!e.enabled,className:"sekyro-icon"})})}o(hn,"sr");s(hn,"VoiceChip");var Fn=new Set(["abandoned","not_opened","cancelled","superseded"]),Hn=800,Gn="capture.lookAtColours";function fn(e){return e===void 0||e!==!1&&e.length===wt.length&&wt.every(t=>e.includes(t))}o(fn,"fo");s(fn,"isDefaultTips");function mn(e){if(e.type==="keydown"&&e.key==="Escape")return!1;let t=globalThis.navigator?.userActivation;return t===void 0?!(e.type==="pointerup"&&e.pointerType==="touch"):t.isActive}o(mn,"mo");s(mn,"carriesActivation");function yn(e){return typeof e=="object"&&e!==null&&!(0,m.isValidElement)(e)&&"tone"in e&&"text"in e}o(yn,"yo");s(yn,"isNoticeObject");var Kn=new Set(["nni_unbound","id_number_unbound","method_required","mobile_required","portrait_required"]);function gn(e){return e==="starting"||e==="gating"||e==="recording"||e==="mode_switch"}o(gn,"ho");s(gn,"isCapturing");function vn(e){return e==="captured"||e==="uploading"||e==="checking"}o(vn,"vo");s(vn,"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:X,assetBaseUrl:h,className:x}){let _=gr(t),k=(0,m.useMemo)(()=>yr(t,r),[t,r,_]),u=(0,m.useMemo)(()=>g=>k[g]??"",[k]),M=n??(t==="ar"?"rtl":"ltr"),I=(0,m.useRef)(null),D=(0,m.useContext)(qn),i=ln({verification:e,videoRef:I,assetBaseUrl:h,onCaptured:B,onResult:q,onError:A,onStateChange:X}),T=on(h,i.state==="idle"&&i.error===null),O=cn(e),z=O.choice!==null,$=rn(e),ge=nn(e),he=an(e),Y=tn(),W=sn(e),ne=W.session==="choice",L=W.mode==="assisted",xe=j!==!1&&j?.clips===void 0,ve=pn(xe?e:void 0),V=Zr({locale:t,defaultClips:ve,options:j}),ee=L?"environment":"user",ce=W.settled,H=(0,m.useRef)(null),Ne=(0,m.useRef)(!1),Fe=(0,m.useRef)(V.unlock);Fe.current=V.unlock,(0,m.useEffect)(()=>{let g=H.current;if(g===null)return;let ae=["pointerup","touchend","click","keydown"],_e=s(()=>{for(let qe of ae)g.removeEventListener(qe,Ae,!0)},"disarm");function Ae(qe){if(Ne.current){_e();return}mn(qe)&&(Ne.current=!0,_e(),Fe.current())}o(Ae,"Re"),s(Ae,"onGesture");for(let qe of ae)g.addEventListener(qe,Ae,{capture:!0,passive:!0});return _e},[]);let b=(0,m.useCallback)(()=>{Ne.current||(Ne.current=!0,V.unlock()),i.start()},[V.unlock,i.start]),ke=(0,m.useCallback)(()=>i.start(),[i.start]),Le=(0,m.useRef)(!1),Oe=i.state==="idle"&&i.error===null,jt=!z&&!$.required&&(l===!0||l==="when-permitted"&&Y.permission==="granted"),Tt=jt&&O.settled&&$.settled&&ce,Cn=l==="when-permitted"&&!Y.permissionSettled&&!Le.current,Ot=jt&&Oe&&!Le.current,ut=(Cn||Ot||!ce)&&T.gate==="ready"?"loading":T.gate;(0,m.useEffect)(()=>{!Tt||!Oe||T.gate!=="ready"||Le.current||(Le.current=!0,ke())},[Tt,Oe,T.gate,ke]);let _n=Oe&&!z&&!$.required&&!(Ot&&T.gate==="ready"),[Pt,Bt]=(0,m.useState)(!1),{canSwitchCaptureMode:qt,setCaptureMode:Vt}=i;(0,m.useEffect)(()=>{if(!W.settled||!ne){Bt(!1);return}let g=!0;return qt().then(ae=>{g&&Bt(ae)}),()=>{g=!1}},[W.settled,ne,qt]);let{choose:Dt}=W,Ie=L?"self":"assisted",wn=(0,m.useCallback)(async()=>{await Vt(Ie)&&Dt(Ie)},[Vt,Dt,Ie]),$t=i.state!=="idle"&&i.facingMode!==null?i.facingMode:ee;(0,m.useEffect)(()=>{let g=I.current?.style;$t==="user"?g?.removeProperty("transform"):g&&(g.transform="none")},[$t]);let He=(0,m.useMemo)(()=>i.artifacts!==null&&typeof URL.createObjectURL=="function"?URL.createObjectURL(i.artifacts.keyframe):null,[i.artifacts]);(0,m.useEffect)(()=>{if(He!==null)return()=>URL.revokeObjectURL(He)},[He]);let Ft=i.frozenPreview??He,Ue=e!==void 0,Z=gn(i.state),be=vn(i.state),Ge=Z||be,se=i.result,Ht=i.state==="done"&&se!==null,Ke=Z&&i.rampColour!==null,dt=i.state==="recording"&&i.frozenPreview!==null&&!Ke,Ze=D!==null,Gt=Pt&&Z&&!dt?{to:Ie,label:u(Ie==="assisted"?"capture.modeSwitch.toAssisted":"capture.modeSwitch.toSelf"),description:u(Ie==="assisted"?"capture.modeSwitch.toAssistedLabel":"capture.modeSwitch.toSelfLabel"),onSwitch:s(()=>{wn()},"onSwitch")}:null,ze=i.modeRestarted&&Z?u("capture.modeSwitch.restarted"):null,Pe=be||dt,Kt=be?"checking":dt?"frozen":i.state==="recording"||Ke?"recording":i.gateLocked||i.gate.progress>=1?"locked":i.gate.faceDetected?"aligning":"seeking",Ye=Z?i.gate.hint:null,We=i.state==="starting"?"capture.preparing.title":Ye===null?null:Ye==="center"&&!i.gate.faceDetected?"fcv3.no_face":pr(Ye),[Sn,Zt]=(0,m.useState)(null);(0,m.useEffect)(()=>{if(We!=="fcv3.no_face"){Zt(We);return}if(!Z)return;let g=setTimeout(()=>Zt(We),Hn);return()=>clearTimeout(g)},[We,Z]);let pt=Z&&!Ke&&typeof N=="string"&&N!=="",zt=L&&Z?u("capture.assisted.stage"):null,Re=Z&&!pt?Ke?Gn:Sn:null,ht=pt?N:Re===null?"":u(Re);zr(V,Re,ht,Z);let Yt=(0,m.useRef)(R);Yt.current=R,(0,m.useEffect)(()=>{if(st(Re))try{Yt.current?.(Re)}catch(g){console.error("[@sekyro/react] onGuidance threw:",g)}},[Re]);let Be=(0,m.useMemo)(()=>({supported:V.supported,enabled:V.enabled,setEnabled:V.setEnabled,toggle:V.toggle}),[V.supported,V.enabled,V.setEnabled,V.toggle]),ft=a?.voicePrompt,Wt=ft!==void 0,Jt=j===void 0,Qt=(0,m.useRef)(!1);(0,m.useEffect)(()=>{!Wt||!Jt||Qt.current||!Lt()||(Qt.current=!0,console.warn("[@sekyro/react] <LivenessCapture>: `slots.voicePrompt` is set and `voice` is undefined, so the component speaks the guidance itself. If your slot plays audio, pass voice={false} or the person hears every hint twice; pass voice={{}} to keep the built-in voice and silence this warning."))},[Wt,Jt]);let xn=ft!==void 0?(g,ae,_e)=>ft(g,ae,_e,Be):V.supported?()=>(0,v.jsx)(hn,{voice:Be}):void 0,{summary:mt,summaryPlaying:Xt,toggleSummary:er,stopSummary:tr}=V,Je=w!==void 0&&w!=="",rr=Je?w:u("capture.tips.summary"),nr=Je?mt!=="none":mt==="partner"||mt==="default"&&fn(p),Nn=(0,m.useMemo)(()=>nr?{playing:Xt,toggle:s(()=>er(rr,{clip:!Je}),"toggle"),stop:tr}:void 0,[nr,Xt,er,rr,tr,Je]),Rn=(0,m.useMemo)(()=>({assets:ut,retryAssets:T.retry,permission:Y.permission,permissionSettled:Y.permissionSettled,captureMode:W.mode,facing:ee,voice:Be}),[ut,T.retry,Y.permission,Y.permissionSettled,W.mode,ee,Be]),An=yn(c)?(0,v.jsx)(oe,{tone:c.tone,testId:"sekyro-host-notice",children:(0,v.jsx)("span",{children:c.text})}):c??null,ue=se!==null&&se.status==="retry"?se:null,G=Ht&&se.status==="unavailable"&&!z&&se.reasonCode!=="portrait_required"?se:null,Ce=Ht&&(se.status==="verified"||se.status==="not_verified"||se.status==="review")?se:null,yt=s((g,ae)=>{if(g===void 0)return null;if(g==="device_cooldown"){let Ae=fr(t,ae);if(Ae!==null)return u(Ae.key).replace("{time}",Ae.time)}let _e=et(g);return _e===null?null:u(_e)},"reasonText"),gt=s(g=>{let ae=g.retakeHint===void 0?null:Xe(g.retakeHint);return ae===null?yt(g.reasonCode):u(ae)},"retryText"),sr=Ce===null?null:yt(Ce.reasonCode,Ce.retryAfter)??(Ce.status==="not_verified"&&Ce.reason!==void 0&&Fn.has(Ce.reason)?u("errors.session_expired"):null),Mn=G!==null&&G.reasonCode!==void 0&&G.reasonCode!=="nni_unbound"&&G.reasonCode!=="id_number_unbound"&&G.reasonCode!=="method_required"&&G.reasonCode!=="mobile_required"&&!(G.reasonCode==="no_recorder"&&i.artifacts?.degraded==="NO_RECORDER"),Qe=G?.reasonCode,ar=i.attempt;(0,m.useEffect)(()=>{G===null||Qe===void 0||e?.reportCaptureIssue===void 0||Kn.has(Qe)||Ct(g=>e.reportCaptureIssue?.(g),{check:"liveness",kind:"unavailable",phase:"upload",engineKind:Qe,attempt:Math.min(1e3,ar)})},[G,Qe,ar,e]);let or=bt(),En=z&&O.auto===null&&!Z&&!be&&i.error===null,vt=(0,m.useCallback)(async g=>{await O.select(g)&&i.state==="done"&&i.retry()},[O.select,i.state,i.retry]);return(0,m.useEffect)(()=>{O.auto!==null&&!O.busy&&!Z&&!be&&vt(O.auto)},[O.auto,O.busy,Z,be,vt]),(0,v.jsx)(vr,{value:u,children:(0,v.jsxs)("div",{ref:H,className:x===void 0?"sekyro-capture":`sekyro-capture ${x}`,dir:M,lang:t,"data-testid":"sekyro-liveness-capture","data-state":i.state,children:[a?.header,ue!==null&&gt(ue)!==null&&!(Ze&&Ge)?(0,v.jsx)(oe,{tone:"warning",role:"status",testId:"sekyro-retry-notice",children:(0,v.jsx)("span",{children:gt(ue)})}):null,ze!==null&&!Ze?(0,v.jsx)(oe,{tone:"info",role:"status",testId:"sekyro-mode-switch-status",children:(0,v.jsx)("span",{children:ze})}):null,he&&be&&!Ze?(0,v.jsx)(oe,{tone:"info",role:"status",testId:"sekyro-busy-notice",children:(0,v.jsx)("span",{children:u("capture.busy")})}):null,$.required&&Oe?(0,v.jsx)(oe,{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)(oe,{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)(oe,{tone:"danger",testId:"sekyro-unavailable-notice",children:[(0,v.jsx)("span",{children:(G.reasonCode==="attestation"&&G.attestationError==="clock_wrong"?u("errors.device_clock"):yt(G.reasonCode))??u(G.reasonCode===void 0?"errors.session_expired":"errors.network_error")}),Mn?(0,v.jsx)(te,{ref: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)(oe,{tone:Ce.status==="not_verified"?"danger":"info",testId:"sekyro-result-notice",children:(0,v.jsx)("span",{children:sr})}):null,(0,v.jsx)("div",{className:Ge?void 0:"sekyro-hidden","data-capture-live":Ge?"":void 0,children:Ze?D({videoRef:I,guidance:Pe&&Ue?u("capture.checking"):ht,coached:pt&&!(Pe&&Ue),note:Pe?Ue?u(he?"capture.busy":"capture.checkingHint"):null:ze??(ue!==null?gt(ue):zt),settled:Pe&&Ue,progress:i.gate.progress,phase:Kt,still:Pe?Ft:null,live:Ge,modeSwitch:Gt,...Pt?{status:ze}:{},ramp:i.rampColour===null?null:{colour:i.rampColour}}):(0,v.jsx)(kr,{videoRef:I,guidanceText:ht,guidanceHint:Ye,guidanceKey:Re,progress:i.gate.progress,phase:Kt,draining:i.draining,stillUrl:Ft,showChecking:Ue,operatorText:zt,voicePrompt:xn,overlay:o(g=>(0,v.jsxs)(v.Fragment,{children:[a?.stageOverlay?.(g),(0,v.jsx)(br,{colour:i.rampColour})]}),"overlay"),reduceMotion:i.reduceMotion,modeSwitch:Gt})}),En&&O.choice!==null?(0,v.jsx)(qr,{title:u("method.title"),description:u("method.description"),options:O.choice.options.map(g=>({id:g,label:u(`method.${g}`)})),busy:O.busy,error:O.failed?u("errors.network_error"):null,focus:i.state==="done",testId:"sekyro-method",look:"buttons",onChoose:o(g=>{vt(g)},"onChoose")}):null,_n?(0,v.jsxs)(v.Fragment,{children:[ge&&a?.header===void 0&&a?.intro===void 0?(0,v.jsxs)("div",{className:"sekyro-stack sekyro-stack--1",children:[(0,v.jsx)("h2",{className:"sekyro-text-body",children:u("returning.title")}),(0,v.jsx)("p",{className:"sekyro-text-muted",children:u("returning.description")})]}):null,An,a?.intro!==void 0?a.intro(b,Rn):(0,v.jsx)(Xr,{assets:ut,onRetryAssets:T.retry,permission:Y.permission,captureMode:W.mode,voice:Be,tips:p??wt,summary:Nn,startLabel:S,startDisabled:d,onStart:b})]}):null,(0,v.jsx)(Yr,{showCoaching:ue!==null,coaching:ot(ue?.reasonCode),attemptsText:ue?.attemptsRemaining!==void 0?mr(k,t,ue.attemptsRemaining):null,showRetake:ue!==null&&!Z&&!be||!Ue&&i.state==="captured",onRetake:i.retry}),a?.footer]})})}o(Zn,"xi");s(Zn,"LivenessCapture");var Ut=U(K(),1),ct=U(K(),1),f=U(de(),1);var Cs={document:"card",population_registry:"id",national_eid:"smartphone",phone_otp:"phone",email_otp:"email"};function zn(e,t){switch(e.service){case"document":return t.t("method.document_photo");case"population_registry":return t.t("method.national_number");case"national_eid":{let n=e.nationalEid?.providerName;return n?t.t("method.national_eid",{provider:n}):t.t("method.national_eidGeneric")}default:return null}}o(zn,"Y");s(zn,"identityLabel");function Yn(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(Yn,"q");s(Yn,"useChoiceAction");function kn(){let e=`sekyro-face-light-${(0,ct.useId)().replace(/[^A-Za-z0-9_-]/g,"")}`;return(0,f.jsxs)("svg",{className:"sekyro-mark sekyro-mark--face",viewBox:"0 0 168 206","aria-hidden":"true",focusable:"false",children:[(0,f.jsx)("defs",{children:(0,f.jsx)("mask",{id:e,children:(0,f.jsx)("ellipse",{className:"sekyro-mark__arc",cx:"84",cy:"103",rx:"76",ry:"95",pathLength:"1",fill:"none",stroke:"#fff",strokeWidth:"16"})})}),(0,f.jsx)("ellipse",{cx:"84",cy:"103",rx:"64",ry:"83",fill:"none",className:"sekyro-mark__line"}),(0,f.jsx)("path",{className:"sekyro-mark__face",d:"M68 64v10M100 64v10M84 66v25q0 2-6 1M60 108q24 18 48 0"}),(0,f.jsx)("ellipse",{className:"sekyro-mark__ticks",cx:"84",cy:"103",rx:"76",ry:"95",pathLength:"56"}),(0,f.jsx)("ellipse",{className:"sekyro-mark__ticks sekyro-mark__ticks--light",cx:"84",cy:"103",rx:"76",ry:"95",pathLength:"56",mask:`url(#${e})`})]})}o(kn,"O");s(kn,"FaceMark");var Wn={glasses:"jGlasses",lighting:"light",faceCamera:"camera"};function Jn(e){if(!(e?.kind!=="liveness"||e.reason===void 0))return{reason:e.reason,...e.retakeHint!==void 0?{retakeHint:e.retakeHint}:{},attemptsRemaining:e.attemptsRemaining??0,attemptsExhausted:e.attemptsExhausted===!0}}o(Jn,"te");s(Jn,"faceIntroRetryOf");var Qn={"capture.retryFrontCamera.screenSide":"camera","capture.retryBackCamera.backSide":"camera","capture.retryUpright.vertical":"smartphone","capture.retryUpright.untilEnd":"smartphone","capture.retryRecording.cameraOn":"camera","capture.retryRecording.stay":"smartphone","capture.retryRecording.network":"smartphone","capture.retryDevice.screenRecording":"smartphone","capture.retryDevice.phone":"smartphone"};function Xn({start:e,context:t,tips:n,tipsTitle:r,human:a=!1,returning:l=!1,notice:c,retry:d}){let S=_t(),{t:p}=S,w=d===void 0?"face":ot(d.reason),N=w==="face"?null:$e[w].tips,j=(0,ct.useContext)(_r)?.busy===!0;return(0,f.jsxs)("section",{className:"sekyro-step",children:[(0,f.jsx)(kn,{}),t.captureMode==="assisted"?(0,f.jsx)(tt,{title:p("capture.assisted.heading"),lead:p("capture.assisted.lead")}):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)(bn,{retry:d,title:$e[w].title}):null,r!==void 0&&N===null?(0,f.jsx)("p",{className:"sekyro-section-label",children:r}):null,(0,f.jsx)("ul",{className:"sekyro-tiprows",children:N!==null?N.map(R=>(0,f.jsxs)("li",{children:[(0,f.jsx)(Ee,{name:Qn[R]??"face"}),p(R)]},R)):n!==void 0?n.map(R=>(0,f.jsxs)("li",{children:[(0,f.jsx)(Ee,{name:Wn[R.id]??"face"}),R.text]},R.id)):(0,f.jsxs)(f.Fragment,{children:[(0,f.jsxs)("li",{children:[(0,f.jsx)(Ee,{name:"light"}),p("capture.tips.light")]}),(0,f.jsxs)("li",{children:[(0,f.jsx)(Ee,{name:"jGlasses"}),p("capture.tips.uncover")]}),(0,f.jsxs)("li",{children:[(0,f.jsx)(Ee,{name:"smartphone"}),p("capture.tips.eyeLevel")]})]})}),c??null,c!==void 0?null:t.assets==="failed"?(0,f.jsx)(te,{kind:"secondary",full:!0,onClick:t.retryAssets,children:p("common.retry")}):null,c!==void 0?null:(0,f.jsx)(Cr,{children:(0,f.jsxs)(te,{full:!0,disabled:t.assets!=="ready"||j,"aria-busy":t.assets==="loading"||void 0,onClick:e,children:[(0,f.jsx)(Ee,{name:"camera"}),p("capture.start")]})})]})}o(Xn,"ne");s(Xn,"FaceIntro");var es=new Set(["match_inconclusive","no_face_source","below_threshold"]);function bn({retry:e,title:t}){let n=_t(),r=e.retakeHint===void 0?null:Xe(e.retakeHint),a=e.reason==="probe_not_from_liveness"?"capture.retrySamePerson.message":es.has(e.reason)?"capture.retryMatch.message":et(e.reason);return(0,f.jsxs)(wr,{tone:"warning",children:[r!==null?(0,f.jsx)("span",{children:n.t(r)}):a!==null?(0,f.jsx)("span",{children:n.t(a)}):null,r===null?(0,f.jsx)("span",{children:n.t(t)}):null,(0,f.jsx)("span",{children:Sr(n,e.attemptsRemaining,e.attemptsExhausted)})]})}o(bn,"T");s(bn,"RetryNotice");function ts(e){return kt(e)}o(ts,"se");s(ts,"isInAppBrowser");function rs(e,t){let n=t??(typeof navigator>"u"?"":String(navigator.userAgent??""));if(!/Android/i.test(n))return null;let r;try{r=new URL(e)}catch{return null}if(r.protocol!=="https:"&&r.protocol!=="http:")return null;let a=r.protocol.slice(0,-1);return`intent://${r.host}${r.pathname}${r.search}#Intent;scheme=${a};action=android.intent.action.VIEW;S.browser_fallback_url=${encodeURIComponent(e)};end`}o(rs,"ce");s(rs,"androidBrowserIntent");export{qr as a,Lt as b,qn as c,sn as d,Zn as e,Cs as f,zn as g,Yn as h,Jn as i,Xn as j,ts as k,rs as l};
1
+ import{a as Nr}from"./chunk-MK5WGJZO.js";import{c as Ct}from"./chunk-CH3JN7FV.js";import{b as kr,d as br}from"./chunk-ZF7TAXXU.js";import{b as xr,c as _t}from"./chunk-ECAWI75T.js";import{a as yr,b as gr,c as vr,d as Me}from"./chunk-UE6IZTZA.js";import{G as Cr,L as wr,M as Sr,a as K,b as de,c as te,m as pr,n as Xe,p as hr,q as et,r as fr,s as mr,t as bt,u as le,v as Ee,w as tt,y as _r}from"./chunk-VYFRJNC5.js";import{c as ir,d as cr,e as ur,h as dr}from"./chunk-WZFFQZE2.js";import{b as kt}from"./chunk-TODKCK6A.js";import{a as s}from"./chunk-5QL6W6FW.js";import{g as or}from"./chunk-6MYG4HWP.js";import{a as l,c as U}from"./chunk-4FHWXBOB.js";var Ar=U(K(),1),y=U(de(),1),re=U(de(),1),ye=U(K(),1),F=U(de(),1),_=U(K(),1),m=U(K(),1),at=U(K(),1),fe=U(de(),1),Wr=U(K(),1),Q=U(K(),1),ot=U(K(),1),we=U(de(),1),Se=U(de(),1),P=U(de(),1);var it=U(K(),1),pe=U(K(),1);var J=U(K(),1);var E=U(K(),1),me=U(K(),1),Te=U(K(),1),At=U(de(),1),v=U(de(),1);function ie({className:e,children:t}){return(0,y.jsx)("svg",{"aria-hidden":"true",focusable:"false",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",className:e??"sekyro-icon sekyro-icon--sm",children:t})}l(ie,"ne");s(ie,"Svg");var Mt="M4 7.5h2.2l1.4-1.9h8.8l1.4 1.9H20a1.6 1.6 0 0 1 1.6 1.6v8.3A1.6 1.6 0 0 1 20 19H4a1.6 1.6 0 0 1-1.6-1.6V9.1A1.6 1.6 0 0 1 4 7.5Z";function Mr(e){return(0,y.jsxs)(ie,{...e,children:[(0,y.jsx)("circle",{cx:"12",cy:"12",r:"4"}),(0,y.jsx)("path",{d:"M12 2.5v2M12 19.5v2M2.5 12h2M19.5 12h2M5.3 5.3l1.4 1.4M17.3 17.3l1.4 1.4M5.3 18.7l1.4-1.4M17.3 6.7l1.4-1.4"})]})}l(Mr,"ln");s(Mr,"SunIcon");function Er(e){return(0,y.jsxs)(ie,{...e,children:[(0,y.jsx)("circle",{cx:"12",cy:"12",r:"9"}),(0,y.jsx)("path",{d:"M9 10h.01M15 10h.01M8.8 14.6a4.2 4.2 0 0 0 6.4 0"})]})}l(Er,"un");s(Er,"FaceUncoveredIcon");function Lr(e){return(0,y.jsxs)(ie,{...e,children:[(0,y.jsx)("rect",{x:"7",y:"2.5",width:"10",height:"19",rx:"2"}),(0,y.jsx)("path",{d:"M10.5 18.5h3M2.5 9.5h2.5M19 9.5h2.5"}),(0,y.jsx)("circle",{cx:"12",cy:"9.5",r:"1.6"})]})}l(Lr,"dn");s(Lr,"PhoneEyeLevelIcon");function Ir(e){return(0,y.jsxs)(ie,{...e,children:[(0,y.jsx)("path",{d:"M2.5 12S6 5.5 12 5.5 21.5 12 21.5 12 18 18.5 12 18.5 2.5 12 2.5 12Z"}),(0,y.jsx)("circle",{cx:"12",cy:"12",r:"2.8"})]})}l(Ir,"pn");s(Ir,"LookStraightIcon");function Ur(e){return(0,y.jsxs)(ie,{...e,children:[(0,y.jsx)("path",{d:Mt}),(0,y.jsx)("path",{d:"M9 13l2 2 4-4"})]})}l(Ur,"fn");s(Ur,"CameraCheckIcon");function jr(e){return(0,y.jsxs)(ie,{...e,children:[(0,y.jsx)("path",{d:Mt}),(0,y.jsx)("path",{d:"M10.2 11.2a1.9 1.9 0 1 1 2.6 1.8c-.5.2-.8.6-.8 1.1v.3M12 16.4h.01"})]})}l(jr,"mn");s(jr,"CameraAskIcon");function Tr(e){return(0,y.jsxs)(ie,{...e,children:[(0,y.jsx)("path",{d:Mt}),(0,y.jsx)("path",{d:"M3 3l18 18"})]})}l(Tr,"yn");s(Tr,"CameraBlockedIcon");function nt({off:e,className:t}){return(0,y.jsxs)(ie,{className:t,children:[(0,y.jsx)("path",{d:"M4.5 9.5v5H8l4 3.5v-12L8 9.5H4.5Z"}),e?(0,y.jsx)("path",{d:"M4 4l16 16"}):(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)("path",{d:"M15.5 9.7a3.6 3.6 0 0 1 0 4.6"}),(0,y.jsx)("path",{d:"M18 7.6a6.6 6.6 0 0 1 0 8.8"})]})]})}l(nt,"Ve");s(nt,"SpeakerIcon");function Or(e){return(0,y.jsx)(ie,{...e,children:(0,y.jsx)("path",{d:"M5 12.5l4.5 4.5L19 7.5"})})}l(Or,"gn");s(Or,"CheckIcon");function Pr(e){return(0,y.jsxs)(ie,{className:e.className??"sekyro-spinner",children:[(0,y.jsx)("circle",{cx:"12",cy:"12",r:"9",opacity:"0.25"}),(0,y.jsx)("path",{d:"M21 12a9 9 0 0 0-9-9"})]})}l(Pr,"hn");s(Pr,"SpinnerIcon");var wt=["light","uncover","eyeLevel","straight"],Ln={light:{key:"capture.tips.light",icon:s(()=>(0,re.jsx)(Mr,{}),"icon")},uncover:{key:"capture.tips.uncover",icon:s(()=>(0,re.jsx)(Er,{}),"icon")},eyeLevel:{key:"capture.tips.eyeLevel",icon:s(()=>(0,re.jsx)(Lr,{}),"icon")},straight:{key:"capture.tips.straight",icon:s(()=>(0,re.jsx)(Ir,{}),"icon")}};function Br({tips:e}){let t=Me(),n=(0,Ar.useId)();return e.length===0?null:(0,re.jsxs)("section",{className:"sekyro-tips","aria-labelledby":n,"data-testid":"sekyro-tips",children:[(0,re.jsx)("p",{className:"sekyro-tips__title",id:n,children:t("capture.tips.title")}),(0,re.jsx)("ul",{className:"sekyro-tips__list",children:e.map(r=>{let a=typeof r=="string"?Ln[r]:void 0,o=typeof r=="string"?r:r.id,c=a!==void 0?a.icon():typeof r=="string"?void 0:r.icon,d=a!==void 0?t(a.key):typeof r=="string"?r:r.text;return(0,re.jsxs)("li",{className:"sekyro-tips__item",children:[c!=null?(0,re.jsx)("span",{className:"sekyro-tips__icon","aria-hidden":"true",children:c}):null,(0,re.jsx)("span",{children:d})]},o)})})]})}l(Br,"Cn");s(Br,"TipList");var In=220;function qr({title:e,description:t,options:n,busy:r,error:a,focus:o,testId:c,look:d="cards",marked:S,onChoose:p}){let w=(0,ye.useId)(),N=bt(),[j,R]=(0,ye.useState)(null),B=(0,ye.useRef)(null);(0,ye.useEffect)(()=>{a!==null&&R(null)},[a]),(0,ye.useEffect)(()=>()=>{B.current!==null&&clearTimeout(B.current)},[]);let q=s(A=>{r||j!==null||(R(A),B.current=setTimeout(()=>{B.current=null,R(null),p(A)},In))},"choose");return(0,F.jsxs)("section",{className:"sekyro-stack sekyro-stack--4 sekyro-choice","aria-labelledby":w,"data-testid":c,children:[(0,F.jsxs)("div",{className:d==="cards"?"sekyro-heading":"sekyro-stack sekyro-stack--1",children:[(0,F.jsx)("h2",{id:w,ref:o?N:void 0,tabIndex:-1,className:"sekyro-text-body",children:e}),t!==void 0&&t!==""?(0,F.jsx)("p",{className:"sekyro-text-muted",children:t}):null]}),a!==null?(0,F.jsx)(le,{tone:"danger",children:(0,F.jsx)("span",{children:a})}):null,d==="buttons"?(0,F.jsx)("div",{className:"sekyro-stack sekyro-stack--3",children:n.map((A,X)=>(0,F.jsx)(te,{kind:X===0?"primary":"ghost",full:!0,disabled:r,"aria-busy":r||void 0,onClick:l(()=>p(A.id),"onClick"),children:A.label},A.id))}):(0,F.jsx)("div",{className:"sekyro-choices",children:n.map(A=>(0,F.jsxs)("button",{type:"button",className:"sekyro-card","aria-pressed":(j??S)===A.id,"aria-busy":r||void 0,disabled:r||j!==null&&j!==A.id,onClick:l(()=>q(A.id),"onClick"),children:[A.glyph!==void 0?(0,F.jsx)("span",{className:"sekyro-card__tile",children:A.glyph}):null,(0,F.jsxs)("span",{className:"sekyro-card__body",children:[(0,F.jsx)("span",{className:"sekyro-card__title",children:A.label}),A.sub!==void 0?(0,F.jsx)("span",{className:"sekyro-card__sub",children:A.sub}):null]}),(0,F.jsx)("span",{className:"sekyro-radio","aria-hidden":"true"})]},A.id))})]})}l(qr,"bn");s(qr,"ChoiceScreen");var Vr=["fcv3.no_face","fcv3.come_closer","fcv3.move_back","fcv3.center_face","fcv3.straighten","fcv3.more_light","fcv3.too_bright","fcv3.hold_still","fcv3.steady_camera","fcv3.hold_upright","fcv3.one_face","capture.tips.summary","capture.lookAtColours"];function st(e){return e!==null&&Vr.includes(e)}l(st,"he");s(st,"isVoiceKey");var Un=s((e,t)=>Object.prototype.hasOwnProperty.call(e,t),"own");function je(e,t,n){let r;try{if(typeof e=="function")r=e(t,n);else{let a=e[n];r=a!=null&&Un(a,t)?a[t]:null}}catch{return null}return typeof r=="string"&&r!==""?r:null}l(je,"Me");s(je,"resolveClip");var jn="UklGRiQAAABXQVZFZm10IBAAAAABAAEAESsAACJWAAACABAAZGF0YQAAAAA=",Tn={ar:"ar-SA",fr:"fr-FR",en:"en-US",es:"es-ES",pt:"pt-BR",de:"de-DE"};function oe(){return typeof window<"u"&&"speechSynthesis"in window?window.speechSynthesis:null}l(oe,"re");s(oe,"synth");function Dr(){return oe()!==null&&typeof SpeechSynthesisUtterance=="function"}l(Dr,"Lr");s(Dr,"speechAvailable");function St(e){return(e.split(/[-_]/)[0]??e).toLowerCase()}l(St,"Sn");s(St,"baseLang");function Et(e,t){let n=s(a=>a.replace(/_/g,"-").toLowerCase(),"norm"),r=St(t);return e.find(a=>n(a.lang)===n(t))??e.find(a=>St(a.lang)===r)}l(Et,"Mn");s(Et,"pickVoice");function $r(e){if(!Dr())return!1;let t=[];try{t=oe()?.getVoices()??[]}catch{return!0}return t.length===0||Et(t,e)!==void 0}l($r,"wn");s($r,"speechUsable");function Fr(e){let t=oe();return t===null||typeof t.addEventListener!="function"?()=>{}:(t.addEventListener("voiceschanged",e),()=>t.removeEventListener?.("voiceschanged",e))}l(Fr,"Ln");s(Fr,"subscribeVoices");function De(e){try{let t=typeof location<"u"?location.href:"http://localhost/",n=new URL(e,t);return`clip:${n.origin}${n.pathname}`}catch{return`clip:${e}`}}l(De,"Ke");s(De,"clipIdentity");function xt(e){e.pause(),e.removeAttribute("src"),e.load()}l(xt,"Rn");s(xt,"release");function Hr(){let e=null,t=null,n=0,r=null,a=null,o=null,c=!1,d=null,S=[],p=new Map,w=s(()=>{S=oe()?.getVoices()??[]},"loadVoices"),N=!1,j=s(()=>{let h=oe();N||h===null||(N=!0,w(),h.addEventListener?.("voiceschanged",w))},"bindVoices"),R=s(()=>(e??(e=new Audio),e),"element"),B=s((h,x,C,k)=>{let u=oe();if(u!==null&&h!==""&&typeof SpeechSynthesisUtterance=="function"){j();let M=Et(S,x);if(S.length===0||M!==void 0){u.cancel();let I=new SpeechSynthesisUtterance(h);I.lang=x,M!==void 0&&(I.voice=M),I.rate=.95,C!==void 0&&(I.onend=C),(C!==void 0||k!==void 0)&&(I.onerror=D=>{k!==void 0&&D.error==="not-allowed"?k():C?.()}),u.speak(I);return}}C?.()},"speak"),q=s(()=>{n+=1,r=null,a=o=null,e!==null&&(e.pause(),e.currentTime=0),oe()?.cancel()},"stop"),A=s(h=>{for(let x of h){let C=De(x);if(p.has(C))continue;let k=new Audio;k.preload="auto",k.src=x,p.set(C,k)}},"warmClips"),X=s((h,x,C)=>{let k={utterance:h,generation:x,end:C};d=k;let u=s(()=>x===n&&d===k,"live"),M=s(()=>{u()&&(a=k)},"block");if(oe()?.cancel(),h.url!==null){let I=R();I.pause(),I.muted=!1,I.src=h.url,I.currentTime=0,I.onended=C??null;let D=s(()=>{o===k&&(o=null)},"settled"),i=I.play();if(i===void 0)return;o=k,i.then(D,T=>{if(D(),!u())return;let O=T?.name;if(O!=="AbortError"){if(O==="NotAllowedError")return M();h.speech?B(h.text,h.lang,C,M):C?.()}});return}h.speech?B(h.text,h.lang,C,M):C?.()},"start");return{say(h){let x=h.url!==null?De(h.url):`tts:${h.lang}:${h.text}`;if(x===r)return;r=x,a=o=null,n+=1;let C=n,k=h.onEnd;X(h,C,k!==void 0?()=>{C===n&&k()}:void 0)},unlock({lang:h,speech:x,prefetch:C}){let k=a??(c?null:o);c=!0;let u=k!==null&&k.generation===n?k:null;a=o=null,u!==null&&X(u.utterance,u.generation,u.end);let M=R();if(t===null&&typeof Blob=="function"&&typeof URL.createObjectURL=="function"){let T=Uint8Array.from(atob(jn),O=>O.charCodeAt(0));t=URL.createObjectURL(new Blob([T],{type:"audio/wav"}))}let I=M.paused===!1&&t!==null&&M.src!==t;t!==null&&!I&&(u===null||u.utterance.url===null)&&(M.muted=!0,M.onended=null,M.src=t,M.play()?.catch(()=>{}));let D=oe(),i=u!==null&&u.utterance.url===null;if(x&&!i&&D!==null&&typeof SpeechSynthesisUtterance=="function"){j();let T=new SpeechSynthesisUtterance(" ");T.volume=0,T.lang=h,D.speak(T)}A(C??[])},prefetch:A,stop:q,dispose(){q(),N&&oe()?.removeEventListener?.("voiceschanged",w),N=!1,t!==null&&URL.revokeObjectURL(t),t=null,e!==null&&xt(e),e=null;for(let h of p.values())xt(h);p.clear()}}}l(Hr,"_n");s(Hr,"createVoicePlayer");var On="sekyro.voiceGuidance";function Gr(e){try{if(typeof window>"u")return null;let t=window.localStorage.getItem(e);return t==="1"?!0:t==="0"?!1:null}catch{return null}}l(Gr,"xn");s(Gr,"readVoicePreference");function Kr(e,t){try{if(typeof window>"u")return;window.localStorage.setItem(e,t?"1":"0")}catch{}}l(Kr,"En");s(Kr,"writeVoicePreference");var Ve="capture.tips.summary",Pn=typeof window<"u"?_.useLayoutEffect:_.useEffect,Bn=Object.freeze({});function rt(e,t){let n=new Set,r=[];for(let a of Vr){let o=a===Ve?null:je(e,a,t);o===null||n.has(De(o))||(n.add(De(o)),r.push(o))}return r}l(rt,"ht");s(rt,"resolvedClipUrls");function Zr({locale:e,defaultClips:t,options:n}){let r=n===!1,a=r?{}:n??{},o=a.storageKey===void 0?On:a.storageKey,[c,d]=(0,_.useState)(a.defaultEnabled??!0),S=(0,_.useRef)(c),[p,w]=(0,_.useState)(!1),[N,j]=(0,_.useState)("none"),[R,B]=(0,_.useState)(!1),q=(0,_.useRef)(!1),[A,X]=(0,_.useState)(0),h=(0,_.useRef)(null),x=(0,_.useCallback)(()=>(h.current??(h.current=Hr()),h.current),[]),C=Tn[e],k=a.speechFallback,u=k===void 0||k===!0?!0:k===!1?!1:k.includes(e),M=a.clips??t??Bn,I=(0,_.useRef)(!1),D=(0,_.useRef)(M);Pn(()=>{D.current=M,S.current=c}),(0,_.useEffect)(()=>{if(r||o===null)return;let L=Gr(o);L!==null&&(S.current=L,d(L))},[r,o]),(0,_.useEffect)(()=>{if(!(r||!u))return Fr(()=>X(L=>L+1))},[r,u]);let i=a.clips;(0,_.useEffect)(()=>{if(r)return;let L=u&&$r(C);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,C,A]),(0,_.useEffect)(()=>{if(r||!c||!I.current)return;let L=rt(M,e);L.length>0&&x().prefetch(L)},[r,c,M,e,x]),(0,_.useEffect)(()=>()=>{h.current?.dispose(),h.current=null,I.current=!1},[]);let T=(0,_.useCallback)(L=>{r||(I.current=!0,x().unlock({lang:C,speech:u,...L?{prefetch:rt(D.current,e)}:{}}))},[r,x,C,u,e]),O=(0,_.useCallback)(()=>T(S.current),[T]),z=(0,_.useCallback)(()=>{q.current=!1,B(!1)},[]),$=(0,_.useCallback)(()=>{z(),h.current?.stop()},[z]),ge=(0,_.useCallback)(()=>{q.current&&$()},[$]),he=(0,_.useCallback)((L,xe)=>{if(r)return;if(q.current){$();return}let ve=x();ve.stop(),q.current=!0,B(!0);let V=xe?.clip===!1?null:je(D.current,Ve,e);ve.say({url:V,text:L,lang:C,speech:u,onEnd:z})},[r,$,x,e,C,u,z]),Y=(0,_.useCallback)(L=>{r||(L?T(!0):$(),o!==null&&Kr(o,L),S.current=L,d(L))},[r,T,$,o]),W=(0,_.useCallback)(()=>Y(!S.current),[Y]),ne=(0,_.useCallback)((L,xe)=>{if(r||!c)return;q.current&&z();let ve=je(D.current,L,e);x().say({url:ve,text:xe,lang:C,speech:u})},[r,c,e,x,C,u,z]);return(0,_.useMemo)(()=>({supported:!r&&p,enabled:!r&&c,setEnabled:Y,toggle:W,unlock:O,speakKey:ne,stop:$,summary:r?"none":N,summaryPlaying:R,toggleSummary:he,stopSummary:ge}),[r,p,c,Y,W,O,ne,$,N,R,he,ge])}l(Zr,"vt");s(Zr,"useVoiceGuidance");function zr(e,t,n,r){let{speakKey:a,stop:o,enabled:c}=e,d=(0,_.useRef)(!1);(0,_.useEffect)(()=>{if(!r||!c){d.current&&o(),d.current=!1;return}d.current=!0,st(t)&&t!==Ve&&n!==""&&a(t,n)},[r,c,t,n,a,o])}l(zr,"Ct");s(zr,"useSpeakGuidance");function lt(e){switch(e){case"multiple_faces":return"one_face";case"capture_back_camera":return"front_camera";case"capture_front_camera":return"back_camera";case"capture_not_upright":return"upright";case"media_unreadable":case"clip_too_short":return"recording";case"device_integrity_failed":return"device";default:return"face"}}l(lt,"Pn");s(lt,"retryCoachingOf");var $e={face:{title:"capture.retryCoaching.title",tips:["capture.retryCoaching.light","capture.retryCoaching.eyeLevel","capture.retryCoaching.head"]},one_face:{title:"capture.retryTips.title",tips:["capture.retryOneFace.alone","capture.retryOneFace.screens"]},front_camera:{title:"capture.retryTips.title",tips:["capture.retryFrontCamera.screenSide"]},back_camera:{title:"capture.retryTips.title",tips:["capture.retryBackCamera.backSide","capture.retryBackCamera.circle"]},upright:{title:"capture.retryTips.title",tips:["capture.retryUpright.vertical","capture.retryUpright.untilEnd"]},recording:{title:"capture.retryTips.title",tips:["capture.retryRecording.cameraOn","capture.retryRecording.stay","capture.retryRecording.network"]},device:{title:"capture.retryTips.title",tips:["capture.retryDevice.screenRecording","capture.retryDevice.phone"]}};function Yr({showCoaching:e,coaching:t="face",attemptsText:n,showRetake:r,onRetake:a}){let o=Me(),c=(0,at.useRef)(null);return(0,at.useEffect)(()=>{r&&c.current?.focus()},[r]),!e&&!r?null:(0,fe.jsxs)("div",{className:"sekyro-stack sekyro-stack--3","data-testid":"sekyro-captured-panel",children:[e?(0,fe.jsxs)("div",{className:"sekyro-stack sekyro-stack--1",children:[(0,fe.jsx)("p",{className:"sekyro-text-body",children:o($e[t].title)}),(0,fe.jsx)("ul",{className:"sekyro-coaching",children:$e[t].tips.map(d=>(0,fe.jsx)("li",{children:o(d)},d))}),n!==null?(0,fe.jsx)("p",{className:"sekyro-text-muted","data-testid":"sekyro-attempts-remaining",children:n}):null]}):null,r?(0,fe.jsx)(te,{ref:c,className:"sekyro-btn--start",onClick:a,children:o("capture.recordAgain")}):null]})}l(Yr,"Tn");s(Yr,"CapturedPanel");function Lt(){try{return!1}catch{return!1}}l(Lt,"nt");s(Lt,"isDevBuild");var qn=(0,Wr.createContext)(null);function Jr({state:e}){let t=Me(),[n,r]=(0,ot.useState)(!1);(0,ot.useEffect)(()=>{e!=="unknown"&&r(!0)},[e]);let a=e==="granted"?(0,we.jsx)(Ur,{}):e==="denied"?(0,we.jsx)(Tr,{}):(0,we.jsx)(jr,{});return(0,we.jsxs)("div",{role:n?"status":void 0,className:`sekyro-permission sekyro-permission--${e}`,"data-testid":"sekyro-permission","data-state":e,children:[(0,we.jsx)("span",{className:"sekyro-permission__icon","aria-hidden":"true",children:a}),(0,we.jsx)("span",{children:t(`capture.permission.${e}`)})]})}l(Jr,"On");s(Jr,"PermissionRow");function Qr({voice:e}){let t=Me();if(!e.supported)return null;let n=e.enabled;return(0,Se.jsxs)("button",{type:"button",role:"switch","aria-checked":n,className:"sekyro-switch","data-testid":"sekyro-voice-switch",onClick:l(()=>e.toggle(),"onClick"),children:[(0,Se.jsxs)("span",{className:"sekyro-switch__label",children:[(0,Se.jsx)(nt,{off:!n}),t("capture.voiceGuidance")]}),(0,Se.jsx)("span",{className:"sekyro-switch__track","aria-hidden":"true",children:(0,Se.jsx)("span",{className:"sekyro-switch__thumb",children:n?(0,Se.jsx)(Or,{className:"sekyro-switch__check"}):null})})]})}l(Qr,"Hn");s(Qr,"VoiceSwitch");function Xr({assets:e,onRetryAssets:t,permission:n,captureMode:r="self",voice:a,tips:o,summary:c,startLabel:d,startDisabled:S,onStart:p}){let w=Me(),N=(0,Q.useRef)(c?.stop);N.current=c?.stop,(0,Q.useEffect)(()=>()=>N.current?.(),[]);let j=(0,Q.useRef)(null),R=(0,Q.useRef)(null),B=(0,Q.useRef)(null),q=(0,Q.useRef)(e),A=(0,Q.useRef)(!1);(0,Q.useEffect)(()=>{let u=q.current;if(q.current=e,u===e)return;let M=A.current;e!=="loading"&&(A.current=!1),en(j.current)&&(e==="failed"?B.current?.focus():M&&R.current?.focus())},[e]);let X=(0,Q.useCallback)(()=>{A.current=!0,t()},[t]),h=e==="loading",x=h||S,C=(0,Q.useCallback)(()=>{x||(N.current?.(),p())},[x,p]),k;return e==="failed"?k=(0,P.jsxs)(le,{tone:"danger",testId:"sekyro-assets-error",children:[(0,P.jsx)("p",{className:"sekyro-text-body",children:w("fcv2.err.models")}),(0,P.jsx)(te,{kind:"ghost",ref:B,className:"sekyro-btn--start",onClick:X,"data-testid":"sekyro-assets-retry",children:w("common.retry")})]}):k=(0,P.jsxs)("div",{className:"sekyro-stack sekyro-stack--1",children:[(0,P.jsx)(te,{ref:R,full:!0,"data-testid":"sekyro-start","aria-disabled":x?"true":void 0,"aria-busy":h?"true":void 0,onClick:C,children:h?(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(Pr,{}),w("capture.preparing.title")]}):d??w("capture.start")}),h?(0,P.jsx)("p",{className:"sekyro-text-muted",children:w("capture.preparing.hint")}):null]}),(0,P.jsxs)("div",{ref:j,className:"sekyro-stack sekyro-stack--4","data-testid":"sekyro-intro","data-assets":e,children:[r==="assisted"?(0,P.jsxs)("div",{className:"sekyro-stack sekyro-stack--1","data-testid":"sekyro-assisted-intro",children:[(0,P.jsx)("h2",{className:"sekyro-text-body",children:w("capture.assisted.title")}),(0,P.jsx)("p",{className:"sekyro-text-muted",children:w("capture.assisted.lead")})]}):null,o!==!1?(0,P.jsx)(Br,{tips:o}):null,c!==void 0?(0,P.jsxs)(te,{kind:"ghost",className:"sekyro-btn--start",onClick:c.toggle,"data-testid":"sekyro-tips-listen",children:[(0,P.jsx)(nt,{off:!1}),w(c.playing?"capture.tips.stop":"capture.tips.listen")]}):null,(0,P.jsx)(Jr,{state:n}),(0,P.jsx)(Qr,{voice:a}),(0,P.jsx)("p",{className:"sekyro-text-muted",children:w("capture.securityNote")}),k,(0,P.jsx)("p",{role:"status",className:"sekyro-visually-hidden","data-testid":"sekyro-intro-status",children:e==="loading"?w("capture.preparing.title"):e==="ready"?w("capture.ready"):""})]})}l(Xr,"Fn");s(Xr,"PreCaptureScreen");function en(e){if(typeof document>"u")return!1;let t=document.activeElement;return t===null||t===document.body||e!==null&&e.contains(t)}l(en,"Ur");s(en,"focusIsOurs");function tn(){let[e,t]=(0,it.useState)({state:"unknown",settled:!1});return(0,it.useEffect)(()=>or(n=>t({state:n,settled:!0})),[]),{permission:e.state,permissionSettled:e.settled}}l(tn,"Dn");s(tn,"useCameraStatus");function rn(e){return It(e,"mobileRequired")}l(rn,"qn");s(rn,"useMobileRequired");function nn(e){return It(e,"returning").required}l(nn,"jn");s(nn,"useReturning");function It(e,t){let[n,r]=(0,pe.useState)({required:!1,settled:e===void 0});return(0,pe.useEffect)(()=>{let a=e?.[t];if(e===void 0||typeof a!="function"){r({required:!1,settled:!0});return}let o=!0;return r({required:!1,settled:!1}),Promise.resolve().then(()=>a.call(e)).then(c=>{o&&r({required:c===!0,settled:!0})},()=>{o&&r({required:!1,settled:!0})}),()=>{o=!1}},[e,t]),n}l(It,"Yn");s(It,"useFlag");function sn(e){let t=s(()=>e?.captureChoice??null,"initialChoice"),[n,r]=(0,pe.useState)(()=>({session:"self",choice:t(),settled:e===void 0}));(0,pe.useEffect)(()=>{let o=e?.captureMode,c=e?.captureChoice??null;if(e===void 0||typeof o!="function"){r({session:"self",choice:c,settled:!0});return}let d=!0;return r({session:"self",choice:c,settled:!1}),Promise.resolve().then(()=>o.call(e)).then(S=>{let p=e.captureChoice??null;d&&r({session:p!==null&&S===p?"choice":S==="assisted"||S==="choice"?S:"self",choice:p,settled:!0})},()=>{d&&r({session:"self",choice:null,settled:!0})}),()=>{d=!1}},[e]);let a=(0,pe.useCallback)(o=>{e?.chooseCaptureMode?.(o),r(c=>({...c,choice:o}))},[e]);return{mode:n.session==="choice"?n.choice??"self":n.session==="assisted"?"assisted":"self",session:n.session,choice:n.choice,settled:n.settled,choose:a}}l(sn,"$n");s(sn,"useCaptureMode");function an(e){let[t,n]=(0,pe.useState)(!1);return(0,pe.useEffect)(()=>{if(n(!1),e===void 0)return;let r=e.on("busy",()=>n(!0)),a=e.on("result",()=>n(!1));return()=>{r(),a()}},[e]),t}l(an,"zn");s(an,"useBusy");var Vn=s(()=>"idle","serverSnapshot");function Nt(e){return ir(e!==void 0?{assetBaseUrl:e}:{})}l(Nt,"Qn");s(Nt,"preload");function ln(e,t=!0){let n=(0,J.useSyncExternalStore)((0,J.useCallback)(p=>ur(p,e),[e]),()=>cr(e),Vn),[r,a]=(0,J.useState)(null),o=(0,J.useRef)(!1),c=(0,J.useCallback)(()=>{Nt(e).then(p=>{o.current&&p==="idle"&&a({base:e})})},[e]);(0,J.useEffect)(()=>(o.current=!0,c(),()=>{o.current=!1}),[c]);let d=(0,J.useRef)(null);(0,J.useEffect)(()=>{if(n!=="idle"){d.current={base:e};return}!t||d.current===null||d.current.base!==e||(d.current=null,c())},[n,e,c,t]);let S=(0,J.useCallback)(()=>{Nt(e)},[e]);return{gate:r!==null&&r.base===e&&n==="idle"||n==="ready"?"ready":n==="failed"?"failed":"loading",retry:S}}l(ln,"Jn");s(ln,"useLivenessAssets");var Rr={progress:0,hint:null,faceDetected:!1};function on(e){let{videoRef:t,assetBaseUrl:n}=e,r=(0,E.useRef)(e.verification).current,a=(0,E.useRef)(!1);e.verification!==r&&!a.current&&Lt()&&(a.current=!0,console.warn("[@sekyro/react] <LivenessCapture>: the `verification` prop changed identity after mount. The first instance stays bound (the camera is not rebuilt); create the verification once (useMemo / useState / outside render) instead of on every render."));let o=(0,E.useRef)(null),[c,d]=(0,E.useState)("idle"),[S,p]=(0,E.useState)(Rr),[w,N]=(0,E.useState)(!1),[j,R]=(0,E.useState)(!1),[B,q]=(0,E.useState)(null),[A,X]=(0,E.useState)(!1),[h,x]=(0,E.useState)(null),[C,k]=(0,E.useState)(null),[u,M]=(0,E.useState)(null),[I,D]=(0,E.useState)(null),[i,T]=(0,E.useState)(null),[O,z]=(0,E.useState)(!1),$=(0,E.useRef)(null),ge=(0,E.useRef)("idle"),he=(0,E.useRef)(-1),[Y,W]=(0,E.useState)(0),ne=(0,E.useRef)(e);ne.current=e,(0,E.useEffect)(()=>{let ee=t.current;if(ee===null)return;let ce={video:ee,...n!==void 0?{assetBaseUrl:n}:{}},H=r!==void 0?r.liveness(ce):dr(ce);o.current=H;let Ne=s(()=>T(H.facingMode??null),"readFacing");Ne();let Fe=[H.on("state",b=>{b==="mode_switch"?z(!0):b!=="starting"&&b!=="gating"&&z(!1),b==="starting"?(ge.current!=="starting"&&(he.current+=1,W(Math.max(0,he.current))),k(null),M(null),p(Rr),R(!1),N(!1),q(null),x(null),$.current=null):b==="gating"&&ge.current==="recording"&&(R(!1),N(!1),q(null),$.current=null),ge.current=b,Ne(),d(b),ne.current.onStateChange?.(b)}),H.on("gate",b=>{let ke=$.current;$.current=b.progress,N(ke!==null&&b.progress<ke-.001&&b.progress>0&&b.progress<1),b.progress>=1&&R(!0),p(b)}),H.on("frozen",({previewDataUrl:b})=>q(b)),H.on("profile",({animations:b})=>X(b==="reduced")),H.on("ramp",({colour:b})=>x(b)),H.on("captured",b=>{k(b),D(null),ne.current.onCaptured?.(b)}),H.on("error",b=>{M(b);let ke=r?.reportCaptureIssue;ke!==void 0&&_t(Le=>ke.call(r,Le),xr("liveness",b,Math.max(0,he.current))),ne.current.onError?.(b)}),r?.on("result",b=>{D(b),ne.current.onResult?.(b)})];return()=>{for(let b of Fe)b?.();o.current=null,H.destroy()}},[r,t,n]);let L=(0,E.useCallback)(()=>{o.current?.start()},[]),xe=(0,E.useCallback)(()=>{o.current?.retry()},[]),ve=(0,E.useCallback)(async()=>{let ee=o.current;return ee===null||typeof ee.canSwitchCaptureMode!="function"?!1:await ee.canSwitchCaptureMode().catch(()=>!1)===!0},[]),V=(0,E.useCallback)(async ee=>{let ce=o.current;if(ce===null||typeof ce.setCaptureMode!="function")return!1;let H=await ce.setCaptureMode(ee).catch(()=>!1)===!0;return H&&T(ce.facingMode??null),H},[]);return{state:c,gate:S,draining:w,gateLocked:j,frozenPreview:B,reduceMotion:A,rampColour:h,artifacts:C,error:u,result:I,facingMode:i,start:L,retry:xe,canSwitchCaptureMode:ve,setCaptureMode:V,modeRestarted:O,attempt:Y}}l(on,"er");s(on,"useLivenessHandle");var Dn=new Set(["national_number"]);function Rt(e){if(e==null||!e.available||e.selected!==null)return null;let t=e.options.filter(n=>Dn.has(n));return t.length>0?{...e,options:t}:null}l(Rt,"tr");s(Rt,"pending");function cn(e){let[t,n]=(0,me.useState)(null),[r,a]=(0,me.useState)(e===void 0),[o,c]=(0,me.useState)(!1),[d,S]=(0,me.useState)(!1);(0,me.useEffect)(()=>{if(n(null),e===void 0){a(!0);return}let N=!0,j=e.methodChoice;typeof j=="function"?(a(!1),Promise.resolve().then(()=>j.call(e)).then(B=>{N&&n(Rt(B))},()=>{}).finally(()=>{N&&a(!0)})):a(!0);let R=e.on("method",B=>n(Rt(B)));return()=>{N=!1,R()}},[e]);let p=(0,me.useCallback)(async N=>{if(e===void 0)return!1;c(!0),S(!1);try{return await e.selectMethod(N),n(null),!0}catch{return S(!0),!1}finally{c(!1)}},[e]),w=t!==null&&t.options.length===1?t.options[0]:null;return{choice:t,auto:w==="national_number"&&!d?w:null,settled:r,busy:o,failed:d,select:p}}l(cn,"nr");s(cn,"useMethodChoice");var $n=["ar","fr","en"];function un(e){if(typeof e!="string")return!1;try{let t=new URL(e);return t.protocol==="https:"||t.protocol==="http:"&&/^(localhost|127\.0\.0\.1)$/.test(t.hostname)}catch{return!1}}l(un,"so");s(un,"isClipUrl");function dn(e){let t=e.clips;if(typeof t!="object"||t===null)return null;let n={};for(let r of $n){let a=t[r];if(!(typeof a!="object"||a===null))for(let[o,c]of Object.entries(a))!st(o)||!un(c)||((n[r]??(n[r]={}))[o]=c)}return Object.keys(n).length>0?n:null}l(dn,"io");s(dn,"toVoiceClipMap");function pn(e){let[t,n]=(0,Te.useState)(null);(0,Te.useEffect)(()=>{if(n(null),e===void 0)return;let a=!0,o=s(d=>{if(!a)return;let S=typeof d=="object"&&d!==null&&typeof d.setId=="string"?d:null;n(p=>p?.setId===S?.setId?p:S)},"take");try{typeof e.voiceClips=="function"&&Promise.resolve(e.voiceClips()).then(o,()=>o(null))}catch{o(null)}let c=e.on("view",d=>o(d.voice));return()=>{a=!1,c()}},[e]);let r=(0,Te.useMemo)(()=>t!==null?dn(t):null,[t]);return e===void 0?null:r}l(pn,"rr");s(pn,"useServerVoiceClips");function hn({voice:e}){let t=Me();return(0,At.jsx)(te,{kind:"chip","aria-pressed":e.enabled,"aria-label":t("capture.voiceGuidance"),"data-testid":"sekyro-voice-toggle",onClick:l(()=>e.toggle(),"onClick"),children:(0,At.jsx)(nt,{off:!e.enabled,className:"sekyro-icon"})})}l(hn,"sr");s(hn,"VoiceChip");var Fn=new Set(["abandoned","not_opened","cancelled","superseded"]),Hn=800,Gn="capture.lookAtColours";function fn(e){return e===void 0||e!==!1&&e.length===wt.length&&wt.every(t=>e.includes(t))}l(fn,"fo");s(fn,"isDefaultTips");function mn(e){if(e.type==="keydown"&&e.key==="Escape")return!1;let t=globalThis.navigator?.userActivation;return t===void 0?!(e.type==="pointerup"&&e.pointerType==="touch"):t.isActive}l(mn,"mo");s(mn,"carriesActivation");function yn(e){return typeof e=="object"&&e!==null&&!(0,m.isValidElement)(e)&&"tone"in e&&"text"in e}l(yn,"yo");s(yn,"isNoticeObject");var Kn=new Set(["nni_unbound","id_number_unbound","method_required","mobile_required","portrait_required"]);function gn(e){return e==="starting"||e==="gating"||e==="recording"||e==="mode_switch"}l(gn,"ho");s(gn,"isCapturing");function vn(e){return e==="captured"||e==="uploading"||e==="checking"}l(vn,"vo");s(vn,"isPostCapture");function Zn({verification:e,locale:t,dir:n,strings:r,slots:a,autoStart:o=!1,notice:c,startDisabled:d=!1,startLabel:S,tips:p,tipsSummary:w,coach:N,voice:j,onGuidance:R,onCaptured:B,onResult:q,onError:A,onStateChange:X,assetBaseUrl:h,className:x}){let C=gr(t),k=(0,m.useMemo)(()=>yr(t,r),[t,r,C]),u=(0,m.useMemo)(()=>g=>k[g]??"",[k]),M=n??(t==="ar"?"rtl":"ltr"),I=(0,m.useRef)(null),D=(0,m.useContext)(qn),i=on({verification:e,videoRef:I,assetBaseUrl:h,onCaptured:B,onResult:q,onError:A,onStateChange:X}),T=ln(h,i.state==="idle"&&i.error===null),O=cn(e),z=O.choice!==null,$=rn(e),ge=nn(e),he=an(e),Y=tn(),W=sn(e),ne=W.session==="choice",L=W.mode==="assisted",xe=j!==!1&&j?.clips===void 0,ve=pn(xe?e:void 0),V=Zr({locale:t,defaultClips:ve,options:j}),ee=L?"environment":"user",ce=W.settled,H=(0,m.useRef)(null),Ne=(0,m.useRef)(!1),Fe=(0,m.useRef)(V.unlock);Fe.current=V.unlock,(0,m.useEffect)(()=>{let g=H.current;if(g===null)return;let ae=["pointerup","touchend","click","keydown"],Ce=s(()=>{for(let qe of ae)g.removeEventListener(qe,Ae,!0)},"disarm");function Ae(qe){if(Ne.current){Ce();return}mn(qe)&&(Ne.current=!0,Ce(),Fe.current())}l(Ae,"Re"),s(Ae,"onGesture");for(let qe of ae)g.addEventListener(qe,Ae,{capture:!0,passive:!0});return Ce},[]);let b=(0,m.useCallback)(()=>{Ne.current||(Ne.current=!0,V.unlock()),i.start()},[V.unlock,i.start]),ke=(0,m.useCallback)(()=>i.start(),[i.start]),Le=(0,m.useRef)(!1),Oe=i.state==="idle"&&i.error===null,jt=!z&&!$.required&&(o===!0||o==="when-permitted"&&Y.permission==="granted"),Tt=jt&&O.settled&&$.settled&&ce,_n=o==="when-permitted"&&!Y.permissionSettled&&!Le.current,Ot=jt&&Oe&&!Le.current,ut=(_n||Ot||!ce)&&T.gate==="ready"?"loading":T.gate;(0,m.useEffect)(()=>{!Tt||!Oe||T.gate!=="ready"||Le.current||(Le.current=!0,ke())},[Tt,Oe,T.gate,ke]);let Cn=Oe&&!z&&!$.required&&!(Ot&&T.gate==="ready"),[Pt,Bt]=(0,m.useState)(!1),{canSwitchCaptureMode:qt,setCaptureMode:Vt}=i;(0,m.useEffect)(()=>{if(!W.settled||!ne){Bt(!1);return}let g=!0;return qt().then(ae=>{g&&Bt(ae)}),()=>{g=!1}},[W.settled,ne,qt]);let{choose:Dt}=W,Ie=L?"self":"assisted",wn=(0,m.useCallback)(async()=>{await Vt(Ie)&&Dt(Ie)},[Vt,Dt,Ie]),$t=i.state!=="idle"&&i.facingMode!==null?i.facingMode:ee;(0,m.useEffect)(()=>{let g=I.current?.style;$t==="user"?g?.removeProperty("transform"):g&&(g.transform="none")},[$t]);let He=(0,m.useMemo)(()=>i.artifacts!==null&&typeof URL.createObjectURL=="function"?URL.createObjectURL(i.artifacts.keyframe):null,[i.artifacts]);(0,m.useEffect)(()=>{if(He!==null)return()=>URL.revokeObjectURL(He)},[He]);let Ft=i.frozenPreview??He,Ue=e!==void 0,Z=gn(i.state),be=vn(i.state),Ge=Z||be,se=i.result,Ht=i.state==="done"&&se!==null,Ke=Z&&i.rampColour!==null,dt=i.state==="recording"&&i.frozenPreview!==null&&!Ke,Ze=D!==null,Gt=Pt&&Z&&!dt?{to:Ie,label:u(Ie==="assisted"?"capture.modeSwitch.toAssisted":"capture.modeSwitch.toSelf"),description:u(Ie==="assisted"?"capture.modeSwitch.toAssistedLabel":"capture.modeSwitch.toSelfLabel"),onSwitch:s(()=>{wn()},"onSwitch")}:null,ze=i.modeRestarted&&Z?u("capture.modeSwitch.restarted"):null,Pe=be||dt,Kt=be?"checking":dt?"frozen":i.state==="recording"||Ke?"recording":i.gateLocked||i.gate.progress>=1?"locked":i.gate.faceDetected?"aligning":"seeking",Ye=Z?i.gate.hint:null,We=i.state==="starting"?"capture.preparing.title":Ye===null?null:Ye==="center"&&!i.gate.faceDetected?"fcv3.no_face":pr(Ye),[Sn,Zt]=(0,m.useState)(null);(0,m.useEffect)(()=>{if(We!=="fcv3.no_face"){Zt(We);return}if(!Z)return;let g=setTimeout(()=>Zt(We),Hn);return()=>clearTimeout(g)},[We,Z]);let pt=Z&&!Ke&&typeof N=="string"&&N!=="",zt=L&&Z?u("capture.assisted.stage"):null,Re=Z&&!pt?Ke?Gn:Sn:null,ht=pt?N:Re===null?"":u(Re);zr(V,Re,ht,Z);let Yt=(0,m.useRef)(R);Yt.current=R,(0,m.useEffect)(()=>{if(st(Re))try{Yt.current?.(Re)}catch(g){console.error("[@sekyro/react] onGuidance threw:",g)}},[Re]);let Be=(0,m.useMemo)(()=>({supported:V.supported,enabled:V.enabled,setEnabled:V.setEnabled,toggle:V.toggle}),[V.supported,V.enabled,V.setEnabled,V.toggle]),ft=a?.voicePrompt,Wt=ft!==void 0,Jt=j===void 0,Qt=(0,m.useRef)(!1);(0,m.useEffect)(()=>{!Wt||!Jt||Qt.current||!Lt()||(Qt.current=!0,console.warn("[@sekyro/react] <LivenessCapture>: `slots.voicePrompt` is set and `voice` is undefined, so the component speaks the guidance itself. If your slot plays audio, pass voice={false} or the person hears every hint twice; pass voice={{}} to keep the built-in voice and silence this warning."))},[Wt,Jt]);let xn=ft!==void 0?(g,ae,Ce)=>ft(g,ae,Ce,Be):V.supported?()=>(0,v.jsx)(hn,{voice:Be}):void 0,{summary:mt,summaryPlaying:Xt,toggleSummary:er,stopSummary:tr}=V,Je=w!==void 0&&w!=="",rr=Je?w:u("capture.tips.summary"),nr=Je?mt!=="none":mt==="partner"||mt==="default"&&fn(p),Nn=(0,m.useMemo)(()=>nr?{playing:Xt,toggle:s(()=>er(rr,{clip:!Je}),"toggle"),stop:tr}:void 0,[nr,Xt,er,rr,tr,Je]),Rn=(0,m.useMemo)(()=>({assets:ut,retryAssets:T.retry,permission:Y.permission,permissionSettled:Y.permissionSettled,captureMode:W.mode,facing:ee,voice:Be}),[ut,T.retry,Y.permission,Y.permissionSettled,W.mode,ee,Be]),An=yn(c)?(0,v.jsx)(le,{tone:c.tone,testId:"sekyro-host-notice",children:(0,v.jsx)("span",{children:c.text})}):c??null,ue=se!==null&&se.status==="retry"?se:null,G=Ht&&se.status==="unavailable"&&!z&&se.reasonCode!=="portrait_required"?se:null,_e=Ht&&(se.status==="verified"||se.status==="not_verified"||se.status==="review")?se:null,yt=s((g,ae)=>{if(g===void 0)return null;if(g==="device_cooldown"){let Ae=fr(t,ae);if(Ae!==null)return u(Ae.key).replace("{time}",Ae.time)}let Ce=et(g);return Ce===null?null:u(Ce)},"reasonText"),gt=s(g=>{let ae=g.retakeHint===void 0?null:Xe(g.retakeHint);return ae===null?yt(g.reasonCode):u(ae)},"retryText"),sr=_e===null?null:yt(_e.reasonCode,_e.retryAfter)??(_e.status==="not_verified"&&_e.reason!==void 0&&Fn.has(_e.reason)?u("errors.session_expired"):null),Mn=G!==null&&G.reasonCode!==void 0&&G.reasonCode!=="nni_unbound"&&G.reasonCode!=="id_number_unbound"&&G.reasonCode!=="method_required"&&G.reasonCode!=="mobile_required"&&!(G.reasonCode==="no_recorder"&&i.artifacts?.degraded==="NO_RECORDER"),Qe=G?.reasonCode,ar=i.attempt;(0,m.useEffect)(()=>{G===null||Qe===void 0||e?.reportCaptureIssue===void 0||Kn.has(Qe)||_t(g=>e.reportCaptureIssue?.(g),{check:"liveness",kind:"unavailable",phase:"upload",engineKind:Qe,attempt:Math.min(1e3,ar)})},[G,Qe,ar,e]);let lr=bt(),En=z&&O.auto===null&&!Z&&!be&&i.error===null,vt=(0,m.useCallback)(async g=>{await O.select(g)&&i.state==="done"&&i.retry()},[O.select,i.state,i.retry]);return(0,m.useEffect)(()=>{O.auto!==null&&!O.busy&&!Z&&!be&&vt(O.auto)},[O.auto,O.busy,Z,be,vt]),(0,v.jsx)(vr,{value:u,children:(0,v.jsxs)("div",{ref:H,className:x===void 0?"sekyro-capture":`sekyro-capture ${x}`,dir:M,lang:t,"data-testid":"sekyro-liveness-capture","data-state":i.state,children:[a?.header,ue!==null&&gt(ue)!==null&&!(Ze&&Ge)?(0,v.jsx)(le,{tone:"warning",role:"status",testId:"sekyro-retry-notice",children:(0,v.jsx)("span",{children:gt(ue)})}):null,ze!==null&&!Ze?(0,v.jsx)(le,{tone:"info",role:"status",testId:"sekyro-mode-switch-status",children:(0,v.jsx)("span",{children:ze})}):null,he&&be&&!Ze?(0,v.jsx)(le,{tone:"info",role:"status",testId:"sekyro-busy-notice",children:(0,v.jsx)("span",{children:u("capture.busy")})}):null,$.required&&Oe?(0,v.jsx)(le,{tone:"info",role:"status",testId:"sekyro-mobile-required",children:(0,v.jsx)("span",{children:u("reasons.mobile_required")})}):null,i.error!==null?a?.errorPanel!==void 0?a.errorPanel(i.error,i.retry):(0,v.jsxs)(le,{tone:"danger",testId:"sekyro-error-notice",children:[(0,v.jsx)("span",{children:u(hr(i.error))}),i.error.retryable?(0,v.jsx)(te,{ref:lr,kind:"ghost",className:"sekyro-btn--start",onClick:i.retry,children:u("common.retry")}):null]}):null,G!==null?(0,v.jsxs)(le,{tone:"danger",testId:"sekyro-unavailable-notice",children:[(0,v.jsx)("span",{children:(G.reasonCode==="attestation"&&G.attestationError==="clock_wrong"?u("errors.device_clock"):yt(G.reasonCode))??u(G.reasonCode===void 0?"errors.session_expired":"errors.network_error")}),Mn?(0,v.jsx)(te,{ref:lr,kind:"ghost",className:"sekyro-btn--start",onClick:i.retry,children:u(G.reasonCode==="attestation"?"common.retry":"capture.recordAgain")}):null]}):null,sr!==null&&_e!==null?(0,v.jsx)(le,{tone:_e.status==="not_verified"?"danger":"info",testId:"sekyro-result-notice",children:(0,v.jsx)("span",{children:sr})}):null,(0,v.jsx)("div",{className:Ge?void 0:"sekyro-hidden","data-capture-live":Ge?"":void 0,children:Ze?D({videoRef:I,guidance:Pe&&Ue?u("capture.checking"):ht,coached:pt&&!(Pe&&Ue),note:Pe?Ue?u(he?"capture.busy":"capture.checkingHint"):null:ze??(ue!==null?gt(ue):zt),settled:Pe&&Ue,progress:i.gate.progress,phase:Kt,still:Pe?Ft:null,live:Ge,modeSwitch:Gt,...Pt?{status:ze}:{},ramp:i.rampColour===null?null:{colour:i.rampColour}}):(0,v.jsx)(kr,{videoRef:I,guidanceText:ht,guidanceHint:Ye,guidanceKey:Re,progress:i.gate.progress,phase:Kt,draining:i.draining,stillUrl:Ft,showChecking:Ue,operatorText:zt,voicePrompt:xn,overlay:l(g=>(0,v.jsxs)(v.Fragment,{children:[a?.stageOverlay?.(g),(0,v.jsx)(br,{colour:i.rampColour})]}),"overlay"),reduceMotion:i.reduceMotion,modeSwitch:Gt})}),En&&O.choice!==null?(0,v.jsx)(qr,{title:u("method.title"),description:u("method.description"),options:O.choice.options.map(g=>({id:g,label:u(`method.${g}`)})),busy:O.busy,error:O.failed?u("errors.network_error"):null,focus:i.state==="done",testId:"sekyro-method",look:"buttons",onChoose:l(g=>{vt(g)},"onChoose")}):null,Cn?(0,v.jsxs)(v.Fragment,{children:[ge&&a?.header===void 0&&a?.intro===void 0?(0,v.jsxs)("div",{className:"sekyro-stack sekyro-stack--1",children:[(0,v.jsx)("h2",{className:"sekyro-text-body",children:u("returning.title")}),(0,v.jsx)("p",{className:"sekyro-text-muted",children:u("returning.description")})]}):null,An,a?.intro!==void 0?a.intro(b,Rn):(0,v.jsx)(Xr,{assets:ut,onRetryAssets:T.retry,permission:Y.permission,captureMode:W.mode,voice:Be,tips:p??wt,summary:Nn,startLabel:S,startDisabled:d,onStart:b})]}):null,(0,v.jsx)(Yr,{showCoaching:ue!==null,coaching:lt(ue?.reasonCode),attemptsText:ue?.attemptsRemaining!==void 0?mr(k,t,ue.attemptsRemaining):null,showRetake:ue!==null&&!Z&&!be||!Ue&&i.state==="captured",onRetake:i.retry}),a?.footer]})})}l(Zn,"xi");s(Zn,"LivenessCapture");var Ut=U(K(),1),ct=U(K(),1),f=U(de(),1);var _s={document:"card",population_registry:"id",national_eid:"smartphone",phone_otp:"phone",email_otp:"email"},Cs={population_registry:"hashtag",national_eid:"key"};function zn(e,t){switch(e.service){case"document":return t.t("method.document_photo");case"population_registry":return t.t("method.national_number");case"national_eid":{let n=e.nationalEid?.providerName;return n?t.t("method.national_eid",{provider:n}):t.t("method.national_eidGeneric")}default:return null}}l(zn,"D");s(zn,"identityLabel");function Yn(e,t){let[n,r]=(0,Ut.useState)(!1),[a,o]=(0,Ut.useState)(null);return{busy:n,error:a,run:s(c=>{r(!0),o(null),c().then(()=>r(!1),d=>{r(!1),o(e.t(Nr(d,e.strings))),t?.(d)})},"run")}}l(Yn,"q");s(Yn,"useChoiceAction");function kn(){let e=`sekyro-face-light-${(0,ct.useId)().replace(/[^A-Za-z0-9_-]/g,"")}`;return(0,f.jsxs)("svg",{className:"sekyro-mark sekyro-mark--face",viewBox:"0 0 168 206","aria-hidden":"true",focusable:"false",children:[(0,f.jsx)("defs",{children:(0,f.jsx)("mask",{id:e,children:(0,f.jsx)("ellipse",{className:"sekyro-mark__arc",cx:"84",cy:"103",rx:"76",ry:"95",pathLength:"1",fill:"none",stroke:"#fff",strokeWidth:"16"})})}),(0,f.jsx)("ellipse",{cx:"84",cy:"103",rx:"64",ry:"83",fill:"none",className:"sekyro-mark__line"}),(0,f.jsx)("path",{className:"sekyro-mark__face",d:"M68 64v10M100 64v10M84 66v25q0 2-6 1M60 108q24 18 48 0"}),(0,f.jsx)("ellipse",{className:"sekyro-mark__ticks",cx:"84",cy:"103",rx:"76",ry:"95",pathLength:"56"}),(0,f.jsx)("ellipse",{className:"sekyro-mark__ticks sekyro-mark__ticks--light",cx:"84",cy:"103",rx:"76",ry:"95",pathLength:"56",mask:`url(#${e})`})]})}l(kn,"O");s(kn,"FaceMark");var Wn={glasses:"jGlasses",lighting:"light",faceCamera:"camera"};function Jn(e){if(!(e?.kind!=="liveness"||e.reason===void 0))return{reason:e.reason,...e.retakeHint!==void 0?{retakeHint:e.retakeHint}:{},attemptsRemaining:e.attemptsRemaining??0,attemptsExhausted:e.attemptsExhausted===!0}}l(Jn,"ne");s(Jn,"faceIntroRetryOf");var Qn={"capture.retryFrontCamera.screenSide":"camera","capture.retryBackCamera.backSide":"camera","capture.retryUpright.vertical":"smartphone","capture.retryUpright.untilEnd":"smartphone","capture.retryRecording.cameraOn":"camera","capture.retryRecording.stay":"smartphone","capture.retryRecording.network":"smartphone","capture.retryDevice.screenRecording":"smartphone","capture.retryDevice.phone":"smartphone"};function Xn({start:e,context:t,tips:n,tipsTitle:r,human:a=!1,returning:o=!1,notice:c,retry:d}){let S=Ct(),{t:p}=S,w=d===void 0?"face":lt(d.reason),N=w==="face"?null:$e[w].tips,j=(0,ct.useContext)(Cr)?.busy===!0;return(0,f.jsxs)("section",{className:"sekyro-step",children:[(0,f.jsx)(kn,{}),t.captureMode==="assisted"?(0,f.jsx)(tt,{title:p("capture.assisted.heading"),lead:p("capture.assisted.lead")}):o?(0,f.jsx)(tt,{title:p("returning.heading"),lead:p("returning.description")}):(0,f.jsx)(tt,{title:p(a?"native.face.humanIntroTitle":"native.face.introTitle"),lead:p(a?"native.face.humanIntroLead":"native.face.introLead")}),d!==void 0?(0,f.jsx)(bn,{retry:d,title:$e[w].title}):null,r!==void 0&&N===null?(0,f.jsx)("p",{className:"sekyro-section-label",children:r}):null,(0,f.jsx)("ul",{className:"sekyro-tiprows",children:N!==null?N.map(R=>(0,f.jsxs)("li",{children:[(0,f.jsx)(Ee,{name:Qn[R]??"face"}),p(R)]},R)):n!==void 0?n.map(R=>(0,f.jsxs)("li",{children:[(0,f.jsx)(Ee,{name:Wn[R.id]??"face"}),R.text]},R.id)):(0,f.jsxs)(f.Fragment,{children:[(0,f.jsxs)("li",{children:[(0,f.jsx)(Ee,{name:"light"}),p("capture.tips.light")]}),(0,f.jsxs)("li",{children:[(0,f.jsx)(Ee,{name:"jGlasses"}),p("capture.tips.uncover")]}),(0,f.jsxs)("li",{children:[(0,f.jsx)(Ee,{name:"smartphone"}),p("capture.tips.eyeLevel")]})]})}),c??null,c!==void 0?null:t.assets==="failed"?(0,f.jsx)(te,{kind:"secondary",full:!0,onClick:t.retryAssets,children:p("common.retry")}):null,c!==void 0?null:(0,f.jsx)(_r,{children:(0,f.jsxs)(te,{full:!0,disabled:t.assets!=="ready"||j,"aria-busy":t.assets==="loading"||void 0,onClick:e,children:[(0,f.jsx)(Ee,{name:"camera"}),p("capture.start")]})})]})}l(Xn,"re");s(Xn,"FaceIntro");var es=new Set(["match_inconclusive","no_face_source","below_threshold"]);function bn({retry:e,title:t}){let n=Ct(),r=e.retakeHint===void 0?null:Xe(e.retakeHint),a=e.reason==="probe_not_from_liveness"?"capture.retrySamePerson.message":es.has(e.reason)?"capture.retryMatch.message":et(e.reason);return(0,f.jsxs)(wr,{tone:"warning",children:[r!==null?(0,f.jsx)("span",{children:n.t(r)}):a!==null?(0,f.jsx)("span",{children:n.t(a)}):null,r===null?(0,f.jsx)("span",{children:n.t(t)}):null,(0,f.jsx)("span",{children:Sr(n,e.attemptsRemaining,e.attemptsExhausted)})]})}l(bn,"K");s(bn,"RetryNotice");function ts(e){return kt(e)}l(ts,"ce");s(ts,"isInAppBrowser");function rs(e,t){let n=t??(typeof navigator>"u"?"":String(navigator.userAgent??""));if(!/Android/i.test(n))return null;let r;try{r=new URL(e)}catch{return null}if(r.protocol!=="https:"&&r.protocol!=="http:")return null;let a=r.protocol.slice(0,-1);return`intent://${r.host}${r.pathname}${r.search}#Intent;scheme=${a};action=android.intent.action.VIEW;S.browser_fallback_url=${encodeURIComponent(e)};end`}l(rs,"le");s(rs,"androidBrowserIntent");export{qr as a,Lt as b,qn as c,sn as d,Zn as e,_s as f,Cs as g,zn as h,Yn as i,Jn as j,Xn as k,ts as l,rs as m};
@@ -1 +1 @@
1
- import{D as n,E as a,a as i}from"./chunk-6TIQ2463.js";import{a as t}from"./chunk-5QL6W6FW.js";import{a as o}from"./chunk-4FHWXBOB.js";function d(r,p){if(r instanceof n)return r.field==="phone"?"otp.phoneInvalid":r.field==="code"?"otp.codeInvalid":r.kind==="check_digit"?"population.reason_id_number_invalid":"population.invalid";if(r instanceof a&&r.field==="channel")return"otp.reason_otp_channel_unavailable";if(r instanceof i){let e=`errors.${r.code}`;if(Object.hasOwn(p,e))return e}return"errors.network_error"}o(d,"d");t(d,"errorKey");export{d as a};
1
+ import{D as n,E as a,a as i}from"./chunk-Y6VKSYVY.js";import{a as t}from"./chunk-5QL6W6FW.js";import{a as o}from"./chunk-4FHWXBOB.js";function d(r,p){if(r instanceof n)return r.field==="phone"?"otp.phoneInvalid":r.field==="code"?"otp.codeInvalid":r.kind==="check_digit"?"population.reason_id_number_invalid":"population.invalid";if(r instanceof a&&r.field==="channel")return"otp.reason_otp_channel_unavailable";if(r instanceof i){let e=`errors.${r.code}`;if(Object.hasOwn(p,e))return e}return"errors.network_error"}o(d,"d");t(d,"errorKey");export{d as a};
@@ -1 +1 @@
1
- import{a as Ae,b as Le,c as ne,d as Pe,e as Re,f as ze,h as De}from"./chunk-2TFK736S.js";import{a as le,d as Ee,e as qe}from"./chunk-3S7YMUPU.js";import{f as Z}from"./chunk-E5YZMFCZ.js";import{e as Te,k as Ce}from"./chunk-6MYG4HWP.js";import{g as oe}from"./chunk-JS2IXPNL.js";import{a as o}from"./chunk-4FHWXBOB.js";function We(e,t){let r=new Set(e.flatMap(i=>i.sides.filter(l=>l[t]!==null).map(l=>l.side)));return r.size===1?[...r][0]:null}o(We,"Fe");function $e(e){let t=Ee.find(i=>i.docType===e),r=t.mrz==="none"?null:t.mrz==="td3"?"single":"verso";return{sides:t.sides,format:qe(e),mrz:t.mrz==="none"?"none":"required",mrzSide:r,barcodeSide:null,portraitSide:t.portraitSide,scripts:null}}o($e,"pt");function et(e){let t=[];for(let r of e)for(let i of r.sides){if(!Array.isArray(i.scripts))return null;for(let l of i.scripts)t.includes(l)||t.push(l)}return t}o(et,"ft");function tt(e,t){if(t.length===0)return $e(e);let r=t.some(d=>d.sides.length>1),i=new Set(t.map(d=>d.format)),l=i.size===1?[...i][0]:"card",u=t.filter(d=>d.sides.some(p=>p.mrz!==null)).length,s=t.find(d=>d.sides.length>1===r)?.sides.find(d=>d.portrait)?.side;return{sides:r?["recto","verso"]:["single"],format:l,mrz:u===t.length?"required":u===0?"none":"optional",mrzSide:We(t,"mrz"),barcodeSide:We(t,"barcode"),portraitSide:s??(r?"recto":"single"),scripts:et(t)}}o(tt,"We");function rt(e,t){if(e===void 0)return[];let r=e.toUpperCase();return Object.prototype.hasOwnProperty.call(le,r)?le[r]?.[t]??[]:[]}o(rt,"ze");async function at(e,t,r){return await e(t)?r:r==="recto"?"verso":"recto"}o(at,"Ue");function it(e,t,r){return e!==t&&t==="verso"&&r.recto!==void 0&&r.verso===void 0?"verso":e}o(it,"Ne");var ot={low:{maxLongEdge:1920,payloadTargetBytes:7e5,qMin:.7,qMax:.92},mid:{maxLongEdge:2240,payloadTargetBytes:12e5,qMin:.7,qMax:.92},good:{maxLongEdge:2560,payloadTargetBytes:16e5,qMin:.7,qMax:.92}};function nt(e){let{deviceMemory:t,effectiveType:r,saveData:i,downlinkMbps:l,sourceLongEdge:u}=e,s=i===!0||r==="slow-2g"||r==="2g"||l!=null&&l>0&&l<1,d=t!=null&&t<=2,p=r==="4g"||l!=null&&l>=5,c=t!=null&&t>=6,M;s||d?M="low":p&&c?M="good":M="mid";let f=ot[M],P=u&&u>0?Math.min(f.maxLongEdge,u):f.maxLongEdge;return{tier:M,...f,maxLongEdge:P}}o(nt,"ht");function lt(e){let t={};try{let r=navigator;typeof r.deviceMemory=="number"&&(t.deviceMemory=r.deviceMemory);let i=r.connection;i&&(t.effectiveType=i.effectiveType,t.saveData=i.saveData,t.downlinkMbps=i.downlink)}catch{}return typeof e=="number"&&e>0&&(t.sourceLongEdge=e),nt(t)}o(lt,"Ge");function st(e,t,r){let i=Math.min(1,Math.max(0,(e-.28)/.21999999999999997)),l=(t+r)/2;return Math.max(t,r-i*(r-l))}o(st,"bt");function dt(e,t,r){let i=Math.max(e,t),l=i>0?Math.min(1,r/i):1;return{width:Math.max(1,Math.round(e*l)),height:Math.max(1,Math.round(t*l))}}o(dt,"St");async function ut(e,t){let r=t.startQ,i=await e(r);for(let l=0;l<4&&!(i.size<=t.budgetBytes||r<=t.qMin);l++)r=Math.max(t.qMin,r-.08),i=await e(r);return{blob:i,quality:r}}o(ut,"yt");async function ct(e,t,r,i,l){if(t<=0||r<=0)return null;let{width:u,height:s}=dt(t,r,i.maxLongEdge),d=document.createElement("canvas");d.width=u,d.height=s;let p=d.getContext("2d");if(!p)return null;p.drawImage(e,0,0,u,s);let c=o(x=>new Promise((y,h)=>{d.toBlob(g=>g?y(g):h(new Error("canvas toBlob returned null")),"image/jpeg",x)}),"c"),M=st(l,i.qMin,i.qMax),{blob:f,quality:P}=await ut(c,{startQ:M,qMin:i.qMin,budgetBytes:i.payloadTargetBytes}).finally(()=>{d.width=0,d.height=0});if(f.size>5242880)throw new Error("encoded document exceeds the 5242880-byte media cap");return{blob:f,quality:P,width:u,height:s}}o(ct,"qe");async function mt(e){let t=lt(Math.max(e.width,e.height)),r=await ct(e,e.width,e.height,t,.5);if(r===null)throw new Error("canvas encode unavailable");return{blob:r.blob,width:r.width,height:r.height}}o(mt,"ie");function je(e,t){return{layout:e,phase:"framing",captured:{},pending:[],lastCaptureAt:t,lastReportAt:t,manualShutter:!1,restPhase:"framing",readSides:[],needFlip:!1,flipped:!1,flipTimeoutSpent:!1,timeoutCapture:!1,lastShotByTimeout:!1}}o(je,"ue");var Ne=o(e=>e==="recto"?"verso":"recto","Xe"),Ve=o(e=>e.phase==="framing"||e.phase==="locking"||e.phase==="flipCue"||e.phase==="reaskRecto","Ye"),me=o(e=>(e.captured.recto!==void 0?1:0)+(e.captured.verso!==void 0?1:0)+e.pending.length,"le");function se(e,t){return e.lastCaptureAt>=0&&e.lastReportAt>=0?e:{...e,lastCaptureAt:e.lastCaptureAt<0?t:e.lastCaptureAt,lastReportAt:e.lastReportAt<0?t:e.lastReportAt}}o(se,"se");function pt(e,t,r){if(e.phase==="result")return{...e,lastReportAt:r};let i=!t.present||e.captureArea!==void 0&&t.areaFrac<.6*e.captureArea,{flipped:l,awaySince:u}=e;i&&(u=u??r),u!==void 0&&r-u>=250&&(l=!0),i||(u=void 0);let s=e.flipTimeoutSpent&&!(l&&!e.flipped),d=e.notice==="same_face"&&l&&!e.flipped?void 0:e.notice,p={...e,lastReportAt:r,flipped:l,awaySince:u,flipTimeoutSpent:s,notice:d,lastArea:t.areaFrac};if(!Ve(e))return p;if(e.needFlip&&!l){if(!t.ready)return{...p,phase:e.restPhase,goodSince:void 0};let c=e.lastShot!==void 0&&e.pending.includes(e.lastShot);if(s||c)return{...p,goodSince:void 0,phase:e.restPhase};let M=e.goodSince??r;return r-M>=1800?{...p,goodSince:M,phase:"capturing",flipTimeoutSpent:!0,timeoutCapture:!0}:{...p,goodSince:M,phase:e.restPhase}}return t.ready?{...p,phase:"capturing",goodSince:e.goodSince??r}:{...p,goodSince:void 0,phase:t.locking?"locking":e.restPhase}}o(pt,"Mt");function ht(e,t){if(!Ve(e)||e.manualShutter)return e;let r=t-e.lastReportAt>=2e3,i=t-e.lastCaptureAt>=6e3;return r||i?{...e,manualShutter:!0}:e}o(ht,"Dt");function ft(e,t,r){let i=e.layout==="singlePage",l=i?{recto:t}:e.captured,u=i?[]:[...e.pending,t],s={...e,captured:l,pending:u,lastShot:t,lastCaptureAt:r,lastReportAt:-1,manualShutter:!1,goodSince:void 0,notice:void 0,awaySince:void 0,flipped:!1,lastShotByTimeout:e.timeoutCapture,timeoutCapture:!1,captureArea:e.lastArea};return i||me({captured:l,pending:u})>=2?{...s,phase:"reading",restPhase:"framing",current:void 0,needFlip:!1}:{...s,phase:"flipCue",restPhase:"flipCue",current:void 0,needFlip:!0}}o(ft,"wt");function He(e,t,r){return e.pending.includes(t)?{...e,pending:e.pending.filter(i=>i!==t),lastShot:e.lastShot===t?void 0:e.lastShot,phase:e.phase==="capturing"?e.phase:"flipCue",restPhase:"flipCue",current:Ne(r),needFlip:!0,flipTimeoutSpent:!1,goodSince:void 0,manualShutter:!0,notice:"same_face",lastCaptureAt:-1,lastReportAt:-1}:e}o(He,"Ve");function gt(e,t,r){if(!e.pending.includes(t))return e;if(e.captured[r]!==void 0)return He(e,t,r);let i=e.pending.filter(p=>p!==t),l={...e,pending:i,captured:{...e.captured,[r]:t}};if(me(l)!==1||e.layout==="singlePage")return l;let u=Ne(r),s=u==="recto"&&e.restPhase==="reaskRecto"?"reaskRecto":"flipCue",d=e.phase==="flipCue"||e.phase==="reaskRecto"||e.phase==="framing";return{...l,restPhase:s,current:u,phase:d?s:e.phase}}o(gt,"kt");function vt(e,t){let r=t.id??e.captured[t.side],i={...e.captured};(t.id===void 0||i[t.side]===t.id)&&delete i[t.side];let l=e.pending.filter(c=>c!==r),u=e.layout==="twoSided"&&me({captured:i,pending:l})>0,s=e.lastShotByTimeout||r===e.lastShot!==e.flipped,d=u&&!s,p=d?t.side==="recto"?"reaskRecto":"flipCue":"framing";return{...e,captured:i,pending:l,readSides:e.readSides.filter(c=>c!==t.side),lastShot:e.lastShot===r?void 0:e.lastShot,notice:t.issue,goodSince:void 0,manualShutter:!1,phase:p,restPhase:p,current:t.side,needFlip:d,flipped:!1,flipTimeoutSpent:!1,awaySince:void 0,lastCaptureAt:-1,lastReportAt:-1}}o(vt,"Ct");function yt(e,t){switch(t.type){case"report":return pt(se(e,t.at),t.report,t.at);case"tick":return ht(se(e,t.at),t.at);case"captured":return ft(se(e,t.at),t.id,t.at);case"captureFailed":return{...e,phase:e.restPhase,goodSince:void 0,lastCaptureAt:t.at,manualShutter:!0,timeoutCapture:!1};case"classified":return gt(e,t.id,t.side);case"duplicate":return He(e,t.id,t.side);case"readOk":{let r=e.readSides.includes(t.side)?e.readSides:[...e.readSides,t.side],i=["recto","verso"].filter(u=>e.captured[u]!==void 0),l=e.phase==="reading"&&e.pending.length===0&&i.every(u=>r.includes(u));return{...e,readSides:r,flipTimeoutSpent:!1,phase:l?"result":e.phase}}case"readFailed":return vt(e,t);case"clockRestart":return e.lastCaptureAt<0&&e.lastReportAt<0&&e.awaySince===void 0?e:{...e,awaySince:void 0,lastCaptureAt:-1,lastReportAt:-1};case"retake":return{...je(e.layout,-1),lastCaptureAt:-1,lastReportAt:-1};default:return e}}o(yt,"Qe");function wt(e,t,r=!1){let i=e(t);return i===null?"recto":!r||i.y+i.height/2>=t.height/2?"verso":"recto"}o(wt,"xt");async function Mt(e,t=!1){let{detectMrzBand:r}=await import("./mrz-band-VYHOTDHY-VEZ2J5IL.js");return wt(r,e,t)}o(Mt,"vt");async function Fe(e,t=480,r,i=r!=null){let l=r??{x:0,y:0,width:e.width,height:e.height},u=Math.max(1,Math.round(l.height/l.width*t)),s=document.createElement("canvas");s.width=t,s.height=u;try{let d=s.getContext("2d");return d===null?"recto":(d.drawImage(e,l.x,l.y,l.width,l.height,0,0,t,u),await Mt(d.getImageData(0,0,t,u),i))}finally{s.width=0,s.height=0}}o(Fe,"ce");var de=o((e,t,r)=>Math.min(r,Math.max(t,Math.round(e))),"de"),$=o(e=>Math.round(Math.min(1,Math.max(0,e))*1e4)/1e4,"Z");async function bt(e,t,r,i){let l=i.decode??(p=>createImageBitmap(p)),u=o(async()=>e.stillRead(await l(t),i.region??[0,0,1,1],i.detectorLimit),"l"),s;try{s=await u()}catch{try{await new Promise(p=>setTimeout(p,i.retryMs??300)),s=await u()}catch{return null}}let d=s.mrzBox;return d===void 0?null:{engine:i.engine,source:"live_mrz",format:r.format,lineCount:de(r.lineCount,2,3),checkDigitsValid:!0,stillConfirmed:s.valid&&s.digest===r.digest,band:[$(d[0]),$(d[1]),$(Math.min(d[2],1-d[0])),$(Math.min(d[3],1-d[1]))],digest:r.digest,framesToValid:de(r.framesToValid,1,1e3),msToValid:de(r.msToValid,0,12e4)}}o(bt,"Ke");var kt=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]),St=new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,2,1,0,10,7,1,5,0,6,64,11,11]);function xt(e=globalThis){let t=e.WebAssembly?.validate;if(typeof t!="function")return{ok:!1,reason:"simd"};try{if(!t.call(e.WebAssembly,kt)||!t.call(e.WebAssembly,St))return{ok:!1,reason:"simd"}}catch{return{ok:!1,reason:"simd"}}return typeof e.Worker!="function"?{ok:!1,reason:"worker"}:typeof e.createImageBitmap!="function"?{ok:!1,reason:"bitmap"}:{ok:!0}}o(xt,"je");function Tt(e=globalThis){let t=e.navigator?.connection;return t?.saveData===!0||["slow-2g","2g","3g"].includes(t?.effectiveType??"")}o(Tt,"$e");var H,W=(H=class extends Error{constructor(t){super(t),this.name="OcrEngineError",this.code=t}},o(H,"E"),H);function Ie(){let e=o(t=>(t.close(),Promise.reject(new W("unsupported"))),"e");return{ready:Promise.resolve("unsupported"),busy:!1,bandRead:e,stillRead:e,layoutRead:e,dispose:o(()=>{},"dispose")}}o(Ie,"Je");function Ct(e){let t;try{if(e.createWorker)t=e.createWorker();else if(e.workerUrl!==void 0)t=new Worker(e.workerUrl,{type:"module",name:"sekyro-ocr"});else return Ie()}catch{return Ie()}let r=new Map,i=0,l=!1,u=!1,s=!1;t.addEventListener("message",h=>{let g=h.data,w=r.get(g.id);w&&(r.delete(g.id),w.resolve(g))});let d=o(()=>{for(let h of r.values())h.reject(new W("error"));r.clear(),c()},"u");t.addEventListener("error",d),t.addEventListener("messageerror",d);function p(h,g=[]){if(l)return Promise.reject(new W("disposed"));let w=++i;return new Promise((E,U)=>{r.set(w,{resolve:E,reject:U});try{t.postMessage({...h,id:w},g)}catch{r.delete(w),U(new W("error"))}})}o(p,"m");function c(){if(!l){l=!0;try{t.postMessage({id:++i,kind:"dispose"})}catch{}t.terminate();for(let h of r.values())h.reject(new W("disposed"));r.clear()}}o(c,"c");let M=(async()=>{let h=await p({kind:"init",baseUrl:e.baseUrl,salt:e.salt,detectorLimit:e.tuning.detectorLimit,maxDownloadMs:e.tuning.maxDownloadMs});if(h.kind==="failed")return h.reason;if(h.kind!=="ready")return"error";let g=await p({kind:"warmup"});if(g.kind!=="ready")return"error";let w=g.benchMs??g.warmupMs,E=e.deviceMemoryGb===void 0?Le():e.deviceMemoryGb;return{warmupMs:g.warmupMs,downloadMs:h.downloadMs,cached:h.cached,benchMs:w,tier:Ae(w,E)}})().catch(()=>"error"),f,P=new Promise(h=>{f=setTimeout(()=>h("timeout"),e.tuning.loadTimeoutMs)}),x=Promise.race([M,P]).then(h=>(clearTimeout(f),typeof h=="string"?c():s=!0,l&&typeof h!="string"?"error":h));(e.page===void 0?globalThis.addEventListener?globalThis:null:e.page)?.addEventListener("pagehide",c,{once:!0});async function y(h,g,w){if(l)throw g.close(),new W("disposed");if(!s)throw g.close(),new W("not_ready");if(u)throw g.close(),new W("busy");u=!0;let E;try{let U=new Promise((_,B)=>{E=setTimeout(()=>{B(new W("timeout")),c()},e.tuning.readTimeoutMs??1e4)}),F=await Promise.race([p(h,[g]),U]);if(F.kind===w){let{id:_,...B}=F;return B}throw new W(F.kind==="error"?F.code:F.kind==="failed"?F.reason:"error")}finally{clearTimeout(E),u=!1}}return o(y,"v"),{ready:x,get busy(){return u},bandRead:o((h,g=e.tuning.detectorLimit)=>y({kind:"band",bitmap:h,detectorLimit:g},h,"band"),"bandRead"),stillRead:o((h,g,w=e.tuning.detectorLimit)=>y({kind:"still",bitmap:h,region:g,detectorLimit:w},h,"band"),"stillRead"),layoutRead:o((h,g)=>y({kind:"layout",bitmap:h,detectorLimit:g},h,"layout"),"layoutRead"),dispose:c}}o(Ct,"Ze");var ee="sekyro-ocr-1",ue=o(e=>e!==null&&typeof e=="object"?e:{},"me"),D=o((e,t,r,i)=>typeof e=="number"&&Number.isFinite(e)&&e>=t&&e<=r?e:i,"O"),Be=o((e,t)=>typeof e=="boolean"?e:t,"et"),Oe=o(e=>{let t=typeof e=="string"?/^sekyro-ocr-(\d{1,4})$/.exec(e):null;return t?Number(t[1]):Number.POSITIVE_INFINITY},"tt");function At(e,t={}){let r=ue(e),i=ue(r.liveMrz),l=ue(r.frontLock),u=Oe(t.engine??ee),s=t.mode==="off",d=o(g=>g.enabled===!0?g.arm==="live"?"live":"control":null,"u"),p=d(i),c=d(l),M=o((g,w)=>!s&&w==="live"&&Oe(g.minEngine??ee)<=u,"b"),f=ze,P=M(i,p)?{detectorLimit:D(i.detectorLimit,320,1600,f.detectorLimit),bandMaxWidthPx:D(i.bandMaxWidthPx,320,4096,f.bandMaxWidthPx),minBandWidthPx:D(i.minBandWidthPx,0,4096,f.minBandWidthPx),bandTop:D(i.bandTop,0,.95,f.bandTop),minIntervalMs:D(i.minIntervalMs,0,5e3,f.minIntervalMs),stableReads:Math.round(D(i.stableReads,1,10,f.stableReads)),profileReads:Math.round(D(i.profileReads,1,100,f.profileReads)),maxReadMs:D(i.maxReadMs,50,6e4,f.maxReadMs),searchTimeoutMs:D(i.searchTimeoutMs,1e3,12e4,f.searchTimeoutMs),hint:Be(i.hint,!0),stillConfirm:Be(i.stillConfirm,!0)}:null,x=Re,y=o((g,w,E)=>D(l[g],w,E,x[g]),"S"),h=M(l,c)?{minLines:Math.round(y("minLines",1,50)),fillMin:y("fillMin",0,1),fillMax:y("fillMax",0,2),offsetMax:y("offsetMax",0,1),steadyFillDelta:y("steadyFillDelta",0,1),steadyOffsetDelta:y("steadyOffsetDelta",0,1),layoutShiftMax:y("layoutShiftMax",0,1),lineCountDelta:Math.round(y("lineCountDelta",0,50)),lockMs:y("lockMs",0,3e4),steadyMs:y("steadyMs",0,3e4),minFrames:Math.round(y("minFrames",1,100)),minIntervalMs:y("minIntervalMs",0,5e3),maxWidthPx:y("maxWidthPx",160,2048),detectorLimit:y("detectorLimit",320,1600),searchTimeoutMs:y("searchTimeoutMs",1e3,12e4)}:null;return{enabled:P!==null||h!==null,liveMrz:P,textLock:h,liveMrzArm:p,frontLockArm:c,load:{detectorLimit:P?.detectorLimit??h?.detectorLimit??f.detectorLimit,loadTimeoutMs:D(i.loadTimeoutMs,1e3,12e4,2e4),maxDownloadMs:D(i.maxDownloadMs,1e3,12e4,2e4)},reportSampleRate:D(i.reportSampleRate,0,1,1)}}o(At,"nt");function Lt(e,t){return e.enabled?!(t.probe??xt)().ok||(t.slow??Tt)()?{ok:!1,reason:"unsupported"}:{ok:!0,engine:Ct({baseUrl:t.baseUrl,salt:t.salt,tuning:{detectorLimit:e.load.detectorLimit,maxDownloadMs:e.load.maxDownloadMs,loadTimeoutMs:e.load.loadTimeoutMs},...t.workerUrl!==void 0?{workerUrl:t.workerUrl}:{},...t.createWorker!==void 0?{createWorker:t.createWorker}:{},...t.page!==void 0?{page:t.page}:{},...t.deviceMemoryGb!==void 0?{deviceMemoryGb:t.deviceMemoryGb}:{}})}:{ok:!1,reason:"off"}}o(Lt,"rt");function Pt(e=typeof navigator<"u"?navigator.userAgent:""){return/SamsungBrowser\//.test(e)?"samsung":/Firefox\/|FxiOS\//.test(e)?"firefox":/Chrome\/|CriOS\/|Chromium\//.test(e)&&!/Edg\/|OPR\//.test(e)?"chrome":/Safari\//.test(e)&&/Version\/|Mobile\//.test(e)&&!/Chrome\/|CriOS\//.test(e)?"safari":"other"}o(Pt,"Tt");var O=o(e=>e===void 0||!Number.isFinite(e)?void 0:Math.min(6e5,Math.max(0,Math.round(e))),"W"),ce=o((e,t,r)=>e===void 0||!Number.isFinite(e)?void 0:Math.min(r,Math.max(t,Math.round(e))),"pe");function Rt(e){let t=e.assist??null,r=e.load!==null&&e.load!==void 0&&typeof e.load=="object"?e.load:null,i=typeof e.load=="string"?e.load:null,l=t!==null?t.outcome:i==="unsupported"||i==="download"||i==="integrity"?i:i==="error"||i==="timeout"?"error":"off",u={kind:"live_mrz",platform:"web",engine:e.engine??ee,arm:e.arm,capture:e.capture,outcome:l,reads:ce(t?.reads??0,0,1e4)??0,browser:e.browser??Pt()},s=o((d,p)=>{p!==void 0&&(u[d]=p)},"s");return s("format",t?.format),s("framesToValid",ce(t?.framesToValid,1,1e4)),s("msToValid",O(t?.msToValid)),s("framesToLock",ce(t?.framesToLock,1,1e4)),s("msToLock",O(t?.msToLock)),s("msToCapture",O(e.msToCapture)),s("readP50Ms",O(t?.readP50Ms)),s("readP90Ms",O(t?.readP90Ms)),s("deviceClass",t?.deviceClass),r!==null&&(s("warmupMs",O(r.warmupMs)),s("downloadMs",O(r.downloadMs)),s("cached",r.cached),s("tier",r.tier),s("benchMs",O(r.benchMs))),s("stillConfirmed",e.stillConfirmed),s("typeMismatch",e.typeMismatch),u}o(Rt,"ot");function Ue(e,t){return e===void 0?!1:t==="passport"?e!=="TD3":e==="TD3"}o(Ue,"fe");var zt=2,Dt=1500;async function Et(e){let t=await import("./capture-session-doc-MGDYUASI-LYQ23KS6.js");return new t.CaptureSessionDoc(e)}o(Et,"Ot");function qt(e){return{topLeft:{x:e.x,y:e.y},topRight:{x:e.x+e.width,y:e.y},bottomRight:{x:e.x+e.width,y:e.y+e.height},bottomLeft:{x:e.x,y:e.y+e.height}}}o(qt,"Et");function Wt(e,t,r){let i=[e.topLeft,e.topRight,e.bottomRight,e.bottomLeft],l=0;for(let u=0;u<i.length;u+=1){let s=i[u],d=i[(u+1)%i.length];l+=s.x*d.y-d.x*s.y}return t>0&&r>0?Math.abs(l)/2/(t*r):0}o(Wt,"At");function Vt(){import("./capture-session-doc-MGDYUASI-LYQ23KS6.js").then(e=>e.warmDocDetector()).catch(()=>{})}o(Vt,"kn");function Ht(e){return Ft(e,{}).handle}o(Ht,"Cn");function Ft(e,t){let r=Te(),i=Ce({enabled:e.keepScreenAwake!==!1}),l=t.decode??(a=>createImageBitmap(a)),u=t.blurRefuseSharpnessMax??.16,s=t.now??(()=>performance.now()),d=tt(e.documentType,t.catalogCapture===!0?t.captureSeries??rt(e.issuer,e.documentType):[]),p=d.sides.length===1||e.side==="single",c=je(p?"singlePage":"twoSided",s());if(!p&&(e.side==="recto"||e.side==="verso")){let a=e.side==="recto"?"verso":"recto";c={...c,captured:{[a]:"server"},readSides:[a],current:e.side,phase:"flipCue",restPhase:"flipCue"}}let M="idle",f=null,P=null,x=!0,y=0,h=0,g=null,w=!1,E=!1,U="",F=null,_,B=null,pe=[],he=d.mrz==="none",_e=d.barcodeSide==="recto"||d.barcodeSide==="verso"?d.barcodeSide:null,N=he&&!p?t.barcode?.side??_e:null,fe=e.barcodeAssetBaseUrl??t.barcode?.assetBaseUrl,te=null,ge=o(()=>N===null||fe===void 0||t.barcode?.seen!==void 0?Promise.resolve(null):(te??(te=import("./barcode-detect-C5IOXMKI-ZOZ2WOWU.js").then(a=>a.loadBarcodeDetect(fe)).catch(()=>null)),te),"Se"),Ge=o((a,n)=>{if(N===null)return Promise.resolve(null);let m,v=new Promise(k=>{m=setTimeout(()=>k(null),t.barcode?.budgetMs??Dt)});return Promise.race([Ye(a,n,N),v]).finally(()=>clearTimeout(m))},"it"),Ye=o(async(a,n,m)=>{let v=m==="recto"?"verso":"recto";try{let k=t.barcode?.seen;if(k!==void 0)return await k(a)?m:v;let[z,C]=await Promise.all([ge(),n()]);if(z===null||C===null)return null;let b=Math.min(1600,C.width),S=document.createElement("canvas");S.width=b,S.height=Math.max(1,Math.round(C.height/C.width*b));try{let q=S.getContext("2d");return q===null?null:(q.drawImage(C,0,0,S.width,S.height),await at(z,q.getImageData(0,0,S.width,S.height),m))}finally{S.width=0,S.height=0}}catch{return null}},"st"),T=t.webOcr!==void 0&&!he?At(t.webOcr.captureDocument,{mode:e.liveMrz?.mode??"auto"}):null,G=null,I=T===null||!T.enabled?"off":null,J=null,Q=null,ve=new WeakMap,re="";if(T!==null&&T.enabled&&t.webOcr!==void 0){let a=t.webOcr,n=Lt(T,{baseUrl:e.liveMrz?.assetBaseUrl??a.baseUrl,salt:a.salt,...e.liveMrz?.workerUrl!==void 0?{workerUrl:e.liveMrz.workerUrl}:{},...a.createWorker!==void 0?{createWorker:a.createWorker}:{}});if(n.ok){G=n.engine;let m=new De({textLock:T.textLock,liveMrz:T.liveMrz});J=m;let v=n.engine;v.ready.then(k=>{I=k,typeof k!="string"&&x&&m.setEngine(v,k.tier)})}else I=n.reason}let V=o(a=>{let n=JSON.stringify(a);n!==re&&(re=n,r.emit("mrz",a))},"H"),ye=o((a,n)=>{let m=t.webOcr?.reports;if(m===void 0||T===null||a===void 0)return;let v=a.format==="ID-3"||a.side==="single"?"single":a.side==="verso"?"verso":"recto",k=v!=="recto"?T.liveMrzArm??T.frontLockArm:T.frontLockArm;if(k===null||Math.random()>=T.reportSampleRate)return;let z=a.via==="live_mrz"?Q:null,C=o(()=>{let b=z?.value??null;m([Rt({arm:k,capture:v,assist:a.ocr??null,load:k==="control"?"off":I,...a.msToCapture!==void 0?{msToCapture:a.msToCapture}:{},...b!==null&&b.stillConfirmed!==void 0?{stillConfirmed:b.stillConfirmed}:{},...n!==void 0?{typeMismatch:Ue(n.format,d.format==="ID-3"?"passport":"card")}:{}})])},"x");z!==null&&z.value===null?Promise.race([z.promise,new Promise(b=>setTimeout(b,3e3))]).then(C):C()},"Me"),j=o(a=>{!x||a===M||(M=a,i.setActive(a==="starting"||a==="scanning"),r.emit("state",a))},"U"),Je=o((a,n)=>n===void 0?null:p?"single":a.captured.recto===n?"recto":a.captured.verso===n?"verso":null,"ut"),Qe=o(a=>({phase:a.phase,captured:p?a.captured.recto!==void 0?["single"]:[]:["recto","verso"].filter(n=>a.captured[n]!==void 0),expected:p?null:a.current??null,notice:a.notice??null,lastShot:Je(a,a.lastShot),manualShutter:a.manualShutter,torchAvailable:f?.torchAvailable()??!1,torch:E}),"lt"),we=o(()=>{let a=f;a!==null&&a.captureNow().catch(()=>A({type:"captureFailed",at:s()}))},"De");function A(a){if(!x)return;let n=c;c=yt(c,a),c.phase==="capturing"&&n.phase!=="capturing"&&Promise.resolve().then(we),c.phase==="result"&&n.phase!=="result"&&(j("done"),Me());let m=Qe(c),v=JSON.stringify(m);v!==U&&(U=v,r.emit("scan",m))}o(A,"R");function Me(){B!==null&&clearInterval(B),B=null;for(let a of pe.splice(0))a();f?.destroy(),f=null,i.setActive(!1)}o(Me,"we");let be=o(()=>f?.captureReport?.(),"ke"),ae=!1,ke=o((a,n)=>{if(!(a===void 0||t.onFaceReport===void 0))try{t.onFaceReport(a,n)}catch{}},"Ce"),X=o(a=>{re="",!(f===null||c.phase==="reading"||c.phase==="result")&&(ae=!1,g=p?"single":c.current??a,f.rearm(g))},"j"),Xe=o(async(a,n,m,v)=>{Q=null;let k=I!==null&&typeof I=="object"&&I.tier==="low";if(v!==void 0&&G!==null&&T?.liveMrz?.hint===!0&&!k){let q={promise:bt(G,a,v,{engine:ee,detectorLimit:T.liveMrz.detectorLimit}).catch(()=>null),value:null};q.promise.then(L=>{q.value=L}),Q=q}v!==void 0&&Ue(v.format,d.format==="ID-3"?"passport":"card")&&V({state:"mismatch",format:v.format});let z=be();ke(z,"captured"),ae=!0,ye(z,v);let C=m===void 0?F:m===null?null:{quad:qt(m),frameWidth:0,frameHeight:0,inStill:!0},b={decoded:null},S=o(()=>(b.decoded??(b.decoded=Promise.resolve().then(()=>l(a)).catch(()=>null)),b.decoded),"w");try{await Ke(a,n,C,S,Q,v)}finally{b.decoded!==null&&(await b.decoded)?.close()}},"ct"),Ke=o(async(a,n,m,v,k,z)=>{let C=`shot-${y+=1}`,b=c.current;if(A({type:"captured",id:C,at:s()}),e.haptics!==!1)try{globalThis.navigator?.vibrate?.(30)}catch{}if(!w&&u>0){let L=await(t.measureSharpness!==void 0?t.measureSharpness(a,m):v().then(R=>R===null?-1:Pe(R,ne(m?.quad??null,m?.inStill===!0?R:{width:m?.frameWidth??0,height:m?.frameHeight??0},R)))).catch(()=>-1);if(!x)return;if(Number.isFinite(L)&&L>=0&&L<u){w=!0;let R=p?"recto":c.current??(c.captured.recto===void 0?"recto":"verso");A({type:"readFailed",side:R,id:C,issue:"blurry"}),X(R);return}}w=!1;let S;if(p)S="single";else{let L=z!==void 0&&z.format!=="TD3"&&(d.mrzSide==="recto"||d.mrzSide==="verso")?d.mrzSide:null,R=L===null&&t.classify===void 0?await Ge(a,v):null,Se=R===null||N===null?R:it(R,N,c.captured),Y=L??Se??(Se===null&&N!==null&&b!==void 0?b:null)??await(t.classify!==void 0?t.classify(a):v().then(K=>K===null?b??"recto":m?.inStill===!0?Fe(K,480,null,!0):Fe(K,480,ne(m?.quad??null,{width:m?.frameWidth??0,height:m?.frameHeight??0},K)))).catch(()=>b??"recto");if(!x)return;if(c.captured[Y]!==void 0&&h<zt){h+=1,A({type:"duplicate",id:C,side:Y}),X(Y==="recto"?"verso":"recto");return}let xe=c.captured.recto===void 0?"recto":c.captured.verso===void 0?"verso":void 0;S=c.captured[Y]!==void 0&&xe!==void 0?xe:Y,h=0,A({type:"classified",id:C,side:S})}let q=S==="verso"?"verso":"recto";try{let L=t.encode!==void 0?await t.encode(a):await v().then(R=>{if(R===null)throw new Error("the still could not be decoded");return mt(R)});if(!x)return;k!==null&&ve.set(L.blob,k),r.emit("captured",{image:L.blob,side:S,documentType:e.documentType,...e.issuer!==void 0?{issuer:e.issuer}:{},width:L.width,height:L.height,previewDataUrl:n}),t.deferRead!==!0&&A({type:"readOk",side:q})}catch(L){A({type:"readFailed",side:q,id:C,issue:"technical"}),r.emit("error",Z("generic",!0,{phase:"keyframes",name:oe(L)}))}X(q==="recto"?"verso":"recto")},"dt"),Ze=o(a=>{pe.push(a.on("statechange",({state:n})=>{n==="preflight"||n==="acquiring"?j("starting"):n==="positioning"?j("scanning"):n==="captured"?j("captured"):n==="error"&&j("error")}),a.on("feedback",({key:n,reticle:m})=>r.emit("feedback",{key:n,reticle:m})),a.on("checks",n=>{r.emit("gate",{progress:n.p,quad:n.quad,frameWidth:n.frameWidth,frameHeight:n.frameHeight,...n.guide!==void 0?{guide:{detected:n.guide.detected,fill:n.guide.fill,offsetX:n.guide.offsetX??0,offsetY:n.guide.offsetY??0}}:{}});let m=n.ocr?.mrz;m!==void 0&&(m.state==="fallback"?V({state:"fallback",reason:m.reason}):m.state==="valid"?V({state:"valid",format:m.format}):m.state==="reading"?V({state:"reading",...m.format?{format:m.format}:{},...m.coach?{coach:m.coach}:{}}):V({state:"searching"}));let v=n.quad===null?0:Wt(n.quad,n.frameWidth,n.frameHeight);F=n.quad===null?null:{quad:n.quad,frameWidth:n.frameWidth,frameHeight:n.frameHeight},A({type:"report",report:{present:n.quad!==null&&n.plausible||n.guide?.detected===!0,ready:n.ready===!0,locking:n.p>=.5,areaFrac:v},at:s()})}),a.on("error",({kind:n,retryable:m,detail:v})=>r.emit("error",Z(n,m,v))),a.on("artifacts",n=>{Xe(n.keyframe,n.previewDataUrl,n.docRegion,n.liveMrz)}))},"mt"),ie=o(()=>(P??(P=(async()=>{if(x){if(ge(),f===null){let a;try{a=await(t.createEngine??Et)({...t.engineOptions??{},..._!==void 0?{guide:_}:{},video:e.video,format:d.format,side:p?"single":e.side??"recto",autoCapture:!1,...J!==null?{ocr:J}:{}})}catch(m){j("error"),r.emit("error",Z("models",!0,{phase:"models",name:oe(m)}));return}if(!x){a.destroy();return}f=a,g=p?"single":e.side??"recto",Ze(a);let n=t.tickMs??500;n>0&&(B=setInterval(()=>A({type:"tick",at:s()}),n))}A({type:"clockRestart"}),T!==null&&T.liveMrzArm==="live"&&(I==="unsupported"||I==="off")&&V({state:"fallback",reason:I}),await f.start()}})().finally(()=>{P=null})),P),"ne");return{handle:{get state(){return M},on:o((a,n)=>r.on(a,n),"on"),start:ie,retry:o(()=>{if(f===null&&c.phase==="result"){A({type:"retake"}),h=0,w=!1,ie();return}if(f!==null&&M!=="error"){A({type:"retake"}),h=0,w=!1,g=p?"single":null,f.rearm(p?"single":void 0);return}ie()},"retry"),setSide:o(a=>{p||a==="single"||f!==null&&c.current===a&&g===a&&c.phase!=="reading"&&c.phase!=="result"||(c.current!==a&&(c={...c,current:a}),A({type:"clockRestart"}),c.phase!=="reading"&&c.phase!=="result"&&f!==null&&(g=a,f.rearm(a)))},"setSide"),shutter:we,focusAt:o((a,n)=>{f?.focusAt?.(a,n)},"focusAt"),setGuide:o(a=>{_=a,f?.setGuide?.(a)},"setGuide"),setTorch:o(a=>{E=a,f?.setTorch(a),A({type:"tick",at:s()})},"setTorch"),destroy:o(()=>{if(x&&f!==null&&M!=="done"){let a=be();!ae&&a!==void 0&&a.ticks>0&&ke(a,"abandoned"),ye(a,void 0)}x=!1,Me(),J?.setEngine(null),G?.dispose(),G=null,r.clear()},"destroy")},plan:d,setFlowState:o(a=>{(c.phase==="reading"||c.phase==="result")&&j(a==="done"&&c.phase!=="result"?"scanning":a)},"setFlowState"),settle:o((a,n)=>{let m=a==="verso"?"verso":"recto";A(n.ok?{type:"readOk",side:m}:{type:"readFailed",side:m,issue:n.issue}),n.ok||X(m)},"settle"),takeDeviceRead:o(a=>ve.get(a.image)?.value??null,"takeDeviceRead")}}o(Ft,"Bt");export{zt as a,Dt as b,Vt as c,Ht as d,Ft as e};
1
+ import{a as Ae,b as Le,c as ne,d as Pe,e as Re,f as ze,h as De}from"./chunk-2TFK736S.js";import{a as le,d as Ee,e as qe}from"./chunk-F4Q2Q4OC.js";import{f as Z}from"./chunk-WZFFQZE2.js";import{e as Te,k as Ce}from"./chunk-6MYG4HWP.js";import{g as oe}from"./chunk-JS2IXPNL.js";import{a as o}from"./chunk-4FHWXBOB.js";function We(e,t){let r=new Set(e.flatMap(i=>i.sides.filter(l=>l[t]!==null).map(l=>l.side)));return r.size===1?[...r][0]:null}o(We,"Fe");function $e(e){let t=Ee.find(i=>i.docType===e),r=t.mrz==="none"?null:t.mrz==="td3"?"single":"verso";return{sides:t.sides,format:qe(e),mrz:t.mrz==="none"?"none":"required",mrzSide:r,barcodeSide:null,portraitSide:t.portraitSide,scripts:null}}o($e,"pt");function et(e){let t=[];for(let r of e)for(let i of r.sides){if(!Array.isArray(i.scripts))return null;for(let l of i.scripts)t.includes(l)||t.push(l)}return t}o(et,"ft");function tt(e,t){if(t.length===0)return $e(e);let r=t.some(d=>d.sides.length>1),i=new Set(t.map(d=>d.format)),l=i.size===1?[...i][0]:"card",u=t.filter(d=>d.sides.some(p=>p.mrz!==null)).length,s=t.find(d=>d.sides.length>1===r)?.sides.find(d=>d.portrait)?.side;return{sides:r?["recto","verso"]:["single"],format:l,mrz:u===t.length?"required":u===0?"none":"optional",mrzSide:We(t,"mrz"),barcodeSide:We(t,"barcode"),portraitSide:s??(r?"recto":"single"),scripts:et(t)}}o(tt,"We");function rt(e,t){if(e===void 0)return[];let r=e.toUpperCase();return Object.prototype.hasOwnProperty.call(le,r)?le[r]?.[t]??[]:[]}o(rt,"ze");async function at(e,t,r){return await e(t)?r:r==="recto"?"verso":"recto"}o(at,"Ue");function it(e,t,r){return e!==t&&t==="verso"&&r.recto!==void 0&&r.verso===void 0?"verso":e}o(it,"Ne");var ot={low:{maxLongEdge:1920,payloadTargetBytes:7e5,qMin:.7,qMax:.92},mid:{maxLongEdge:2240,payloadTargetBytes:12e5,qMin:.7,qMax:.92},good:{maxLongEdge:2560,payloadTargetBytes:16e5,qMin:.7,qMax:.92}};function nt(e){let{deviceMemory:t,effectiveType:r,saveData:i,downlinkMbps:l,sourceLongEdge:u}=e,s=i===!0||r==="slow-2g"||r==="2g"||l!=null&&l>0&&l<1,d=t!=null&&t<=2,p=r==="4g"||l!=null&&l>=5,c=t!=null&&t>=6,M;s||d?M="low":p&&c?M="good":M="mid";let f=ot[M],P=u&&u>0?Math.min(f.maxLongEdge,u):f.maxLongEdge;return{tier:M,...f,maxLongEdge:P}}o(nt,"ht");function lt(e){let t={};try{let r=navigator;typeof r.deviceMemory=="number"&&(t.deviceMemory=r.deviceMemory);let i=r.connection;i&&(t.effectiveType=i.effectiveType,t.saveData=i.saveData,t.downlinkMbps=i.downlink)}catch{}return typeof e=="number"&&e>0&&(t.sourceLongEdge=e),nt(t)}o(lt,"Ge");function st(e,t,r){let i=Math.min(1,Math.max(0,(e-.28)/.21999999999999997)),l=(t+r)/2;return Math.max(t,r-i*(r-l))}o(st,"bt");function dt(e,t,r){let i=Math.max(e,t),l=i>0?Math.min(1,r/i):1;return{width:Math.max(1,Math.round(e*l)),height:Math.max(1,Math.round(t*l))}}o(dt,"St");async function ut(e,t){let r=t.startQ,i=await e(r);for(let l=0;l<4&&!(i.size<=t.budgetBytes||r<=t.qMin);l++)r=Math.max(t.qMin,r-.08),i=await e(r);return{blob:i,quality:r}}o(ut,"yt");async function ct(e,t,r,i,l){if(t<=0||r<=0)return null;let{width:u,height:s}=dt(t,r,i.maxLongEdge),d=document.createElement("canvas");d.width=u,d.height=s;let p=d.getContext("2d");if(!p)return null;p.drawImage(e,0,0,u,s);let c=o(x=>new Promise((y,h)=>{d.toBlob(g=>g?y(g):h(new Error("canvas toBlob returned null")),"image/jpeg",x)}),"c"),M=st(l,i.qMin,i.qMax),{blob:f,quality:P}=await ut(c,{startQ:M,qMin:i.qMin,budgetBytes:i.payloadTargetBytes}).finally(()=>{d.width=0,d.height=0});if(f.size>5242880)throw new Error("encoded document exceeds the 5242880-byte media cap");return{blob:f,quality:P,width:u,height:s}}o(ct,"qe");async function mt(e){let t=lt(Math.max(e.width,e.height)),r=await ct(e,e.width,e.height,t,.5);if(r===null)throw new Error("canvas encode unavailable");return{blob:r.blob,width:r.width,height:r.height}}o(mt,"ie");function je(e,t){return{layout:e,phase:"framing",captured:{},pending:[],lastCaptureAt:t,lastReportAt:t,manualShutter:!1,restPhase:"framing",readSides:[],needFlip:!1,flipped:!1,flipTimeoutSpent:!1,timeoutCapture:!1,lastShotByTimeout:!1}}o(je,"ue");var Ne=o(e=>e==="recto"?"verso":"recto","Xe"),Ve=o(e=>e.phase==="framing"||e.phase==="locking"||e.phase==="flipCue"||e.phase==="reaskRecto","Ye"),me=o(e=>(e.captured.recto!==void 0?1:0)+(e.captured.verso!==void 0?1:0)+e.pending.length,"le");function se(e,t){return e.lastCaptureAt>=0&&e.lastReportAt>=0?e:{...e,lastCaptureAt:e.lastCaptureAt<0?t:e.lastCaptureAt,lastReportAt:e.lastReportAt<0?t:e.lastReportAt}}o(se,"se");function pt(e,t,r){if(e.phase==="result")return{...e,lastReportAt:r};let i=!t.present||e.captureArea!==void 0&&t.areaFrac<.6*e.captureArea,{flipped:l,awaySince:u}=e;i&&(u=u??r),u!==void 0&&r-u>=250&&(l=!0),i||(u=void 0);let s=e.flipTimeoutSpent&&!(l&&!e.flipped),d=e.notice==="same_face"&&l&&!e.flipped?void 0:e.notice,p={...e,lastReportAt:r,flipped:l,awaySince:u,flipTimeoutSpent:s,notice:d,lastArea:t.areaFrac};if(!Ve(e))return p;if(e.needFlip&&!l){if(!t.ready)return{...p,phase:e.restPhase,goodSince:void 0};let c=e.lastShot!==void 0&&e.pending.includes(e.lastShot);if(s||c)return{...p,goodSince:void 0,phase:e.restPhase};let M=e.goodSince??r;return r-M>=1800?{...p,goodSince:M,phase:"capturing",flipTimeoutSpent:!0,timeoutCapture:!0}:{...p,goodSince:M,phase:e.restPhase}}return t.ready?{...p,phase:"capturing",goodSince:e.goodSince??r}:{...p,goodSince:void 0,phase:t.locking?"locking":e.restPhase}}o(pt,"Mt");function ht(e,t){if(!Ve(e)||e.manualShutter)return e;let r=t-e.lastReportAt>=2e3,i=t-e.lastCaptureAt>=6e3;return r||i?{...e,manualShutter:!0}:e}o(ht,"Dt");function ft(e,t,r){let i=e.layout==="singlePage",l=i?{recto:t}:e.captured,u=i?[]:[...e.pending,t],s={...e,captured:l,pending:u,lastShot:t,lastCaptureAt:r,lastReportAt:-1,manualShutter:!1,goodSince:void 0,notice:void 0,awaySince:void 0,flipped:!1,lastShotByTimeout:e.timeoutCapture,timeoutCapture:!1,captureArea:e.lastArea};return i||me({captured:l,pending:u})>=2?{...s,phase:"reading",restPhase:"framing",current:void 0,needFlip:!1}:{...s,phase:"flipCue",restPhase:"flipCue",current:void 0,needFlip:!0}}o(ft,"wt");function He(e,t,r){return e.pending.includes(t)?{...e,pending:e.pending.filter(i=>i!==t),lastShot:e.lastShot===t?void 0:e.lastShot,phase:e.phase==="capturing"?e.phase:"flipCue",restPhase:"flipCue",current:Ne(r),needFlip:!0,flipTimeoutSpent:!1,goodSince:void 0,manualShutter:!0,notice:"same_face",lastCaptureAt:-1,lastReportAt:-1}:e}o(He,"Ve");function gt(e,t,r){if(!e.pending.includes(t))return e;if(e.captured[r]!==void 0)return He(e,t,r);let i=e.pending.filter(p=>p!==t),l={...e,pending:i,captured:{...e.captured,[r]:t}};if(me(l)!==1||e.layout==="singlePage")return l;let u=Ne(r),s=u==="recto"&&e.restPhase==="reaskRecto"?"reaskRecto":"flipCue",d=e.phase==="flipCue"||e.phase==="reaskRecto"||e.phase==="framing";return{...l,restPhase:s,current:u,phase:d?s:e.phase}}o(gt,"kt");function vt(e,t){let r=t.id??e.captured[t.side],i={...e.captured};(t.id===void 0||i[t.side]===t.id)&&delete i[t.side];let l=e.pending.filter(c=>c!==r),u=e.layout==="twoSided"&&me({captured:i,pending:l})>0,s=e.lastShotByTimeout||r===e.lastShot!==e.flipped,d=u&&!s,p=d?t.side==="recto"?"reaskRecto":"flipCue":"framing";return{...e,captured:i,pending:l,readSides:e.readSides.filter(c=>c!==t.side),lastShot:e.lastShot===r?void 0:e.lastShot,notice:t.issue,goodSince:void 0,manualShutter:!1,phase:p,restPhase:p,current:t.side,needFlip:d,flipped:!1,flipTimeoutSpent:!1,awaySince:void 0,lastCaptureAt:-1,lastReportAt:-1}}o(vt,"Ct");function yt(e,t){switch(t.type){case"report":return pt(se(e,t.at),t.report,t.at);case"tick":return ht(se(e,t.at),t.at);case"captured":return ft(se(e,t.at),t.id,t.at);case"captureFailed":return{...e,phase:e.restPhase,goodSince:void 0,lastCaptureAt:t.at,manualShutter:!0,timeoutCapture:!1};case"classified":return gt(e,t.id,t.side);case"duplicate":return He(e,t.id,t.side);case"readOk":{let r=e.readSides.includes(t.side)?e.readSides:[...e.readSides,t.side],i=["recto","verso"].filter(u=>e.captured[u]!==void 0),l=e.phase==="reading"&&e.pending.length===0&&i.every(u=>r.includes(u));return{...e,readSides:r,flipTimeoutSpent:!1,phase:l?"result":e.phase}}case"readFailed":return vt(e,t);case"clockRestart":return e.lastCaptureAt<0&&e.lastReportAt<0&&e.awaySince===void 0?e:{...e,awaySince:void 0,lastCaptureAt:-1,lastReportAt:-1};case"retake":return{...je(e.layout,-1),lastCaptureAt:-1,lastReportAt:-1};default:return e}}o(yt,"Qe");function wt(e,t,r=!1){let i=e(t);return i===null?"recto":!r||i.y+i.height/2>=t.height/2?"verso":"recto"}o(wt,"xt");async function Mt(e,t=!1){let{detectMrzBand:r}=await import("./mrz-band-VYHOTDHY-VEZ2J5IL.js");return wt(r,e,t)}o(Mt,"vt");async function Fe(e,t=480,r,i=r!=null){let l=r??{x:0,y:0,width:e.width,height:e.height},u=Math.max(1,Math.round(l.height/l.width*t)),s=document.createElement("canvas");s.width=t,s.height=u;try{let d=s.getContext("2d");return d===null?"recto":(d.drawImage(e,l.x,l.y,l.width,l.height,0,0,t,u),await Mt(d.getImageData(0,0,t,u),i))}finally{s.width=0,s.height=0}}o(Fe,"ce");var de=o((e,t,r)=>Math.min(r,Math.max(t,Math.round(e))),"de"),$=o(e=>Math.round(Math.min(1,Math.max(0,e))*1e4)/1e4,"Z");async function bt(e,t,r,i){let l=i.decode??(p=>createImageBitmap(p)),u=o(async()=>e.stillRead(await l(t),i.region??[0,0,1,1],i.detectorLimit),"l"),s;try{s=await u()}catch{try{await new Promise(p=>setTimeout(p,i.retryMs??300)),s=await u()}catch{return null}}let d=s.mrzBox;return d===void 0?null:{engine:i.engine,source:"live_mrz",format:r.format,lineCount:de(r.lineCount,2,3),checkDigitsValid:!0,stillConfirmed:s.valid&&s.digest===r.digest,band:[$(d[0]),$(d[1]),$(Math.min(d[2],1-d[0])),$(Math.min(d[3],1-d[1]))],digest:r.digest,framesToValid:de(r.framesToValid,1,1e3),msToValid:de(r.msToValid,0,12e4)}}o(bt,"Ke");var kt=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]),St=new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,2,1,0,10,7,1,5,0,6,64,11,11]);function xt(e=globalThis){let t=e.WebAssembly?.validate;if(typeof t!="function")return{ok:!1,reason:"simd"};try{if(!t.call(e.WebAssembly,kt)||!t.call(e.WebAssembly,St))return{ok:!1,reason:"simd"}}catch{return{ok:!1,reason:"simd"}}return typeof e.Worker!="function"?{ok:!1,reason:"worker"}:typeof e.createImageBitmap!="function"?{ok:!1,reason:"bitmap"}:{ok:!0}}o(xt,"je");function Tt(e=globalThis){let t=e.navigator?.connection;return t?.saveData===!0||["slow-2g","2g","3g"].includes(t?.effectiveType??"")}o(Tt,"$e");var H,W=(H=class extends Error{constructor(t){super(t),this.name="OcrEngineError",this.code=t}},o(H,"E"),H);function Ie(){let e=o(t=>(t.close(),Promise.reject(new W("unsupported"))),"e");return{ready:Promise.resolve("unsupported"),busy:!1,bandRead:e,stillRead:e,layoutRead:e,dispose:o(()=>{},"dispose")}}o(Ie,"Je");function Ct(e){let t;try{if(e.createWorker)t=e.createWorker();else if(e.workerUrl!==void 0)t=new Worker(e.workerUrl,{type:"module",name:"sekyro-ocr"});else return Ie()}catch{return Ie()}let r=new Map,i=0,l=!1,u=!1,s=!1;t.addEventListener("message",h=>{let g=h.data,w=r.get(g.id);w&&(r.delete(g.id),w.resolve(g))});let d=o(()=>{for(let h of r.values())h.reject(new W("error"));r.clear(),c()},"u");t.addEventListener("error",d),t.addEventListener("messageerror",d);function p(h,g=[]){if(l)return Promise.reject(new W("disposed"));let w=++i;return new Promise((E,U)=>{r.set(w,{resolve:E,reject:U});try{t.postMessage({...h,id:w},g)}catch{r.delete(w),U(new W("error"))}})}o(p,"m");function c(){if(!l){l=!0;try{t.postMessage({id:++i,kind:"dispose"})}catch{}t.terminate();for(let h of r.values())h.reject(new W("disposed"));r.clear()}}o(c,"c");let M=(async()=>{let h=await p({kind:"init",baseUrl:e.baseUrl,salt:e.salt,detectorLimit:e.tuning.detectorLimit,maxDownloadMs:e.tuning.maxDownloadMs});if(h.kind==="failed")return h.reason;if(h.kind!=="ready")return"error";let g=await p({kind:"warmup"});if(g.kind!=="ready")return"error";let w=g.benchMs??g.warmupMs,E=e.deviceMemoryGb===void 0?Le():e.deviceMemoryGb;return{warmupMs:g.warmupMs,downloadMs:h.downloadMs,cached:h.cached,benchMs:w,tier:Ae(w,E)}})().catch(()=>"error"),f,P=new Promise(h=>{f=setTimeout(()=>h("timeout"),e.tuning.loadTimeoutMs)}),x=Promise.race([M,P]).then(h=>(clearTimeout(f),typeof h=="string"?c():s=!0,l&&typeof h!="string"?"error":h));(e.page===void 0?globalThis.addEventListener?globalThis:null:e.page)?.addEventListener("pagehide",c,{once:!0});async function y(h,g,w){if(l)throw g.close(),new W("disposed");if(!s)throw g.close(),new W("not_ready");if(u)throw g.close(),new W("busy");u=!0;let E;try{let U=new Promise((_,B)=>{E=setTimeout(()=>{B(new W("timeout")),c()},e.tuning.readTimeoutMs??1e4)}),F=await Promise.race([p(h,[g]),U]);if(F.kind===w){let{id:_,...B}=F;return B}throw new W(F.kind==="error"?F.code:F.kind==="failed"?F.reason:"error")}finally{clearTimeout(E),u=!1}}return o(y,"v"),{ready:x,get busy(){return u},bandRead:o((h,g=e.tuning.detectorLimit)=>y({kind:"band",bitmap:h,detectorLimit:g},h,"band"),"bandRead"),stillRead:o((h,g,w=e.tuning.detectorLimit)=>y({kind:"still",bitmap:h,region:g,detectorLimit:w},h,"band"),"stillRead"),layoutRead:o((h,g)=>y({kind:"layout",bitmap:h,detectorLimit:g},h,"layout"),"layoutRead"),dispose:c}}o(Ct,"Ze");var ee="sekyro-ocr-1",ue=o(e=>e!==null&&typeof e=="object"?e:{},"me"),D=o((e,t,r,i)=>typeof e=="number"&&Number.isFinite(e)&&e>=t&&e<=r?e:i,"O"),Be=o((e,t)=>typeof e=="boolean"?e:t,"et"),Oe=o(e=>{let t=typeof e=="string"?/^sekyro-ocr-(\d{1,4})$/.exec(e):null;return t?Number(t[1]):Number.POSITIVE_INFINITY},"tt");function At(e,t={}){let r=ue(e),i=ue(r.liveMrz),l=ue(r.frontLock),u=Oe(t.engine??ee),s=t.mode==="off",d=o(g=>g.enabled===!0?g.arm==="live"?"live":"control":null,"u"),p=d(i),c=d(l),M=o((g,w)=>!s&&w==="live"&&Oe(g.minEngine??ee)<=u,"b"),f=ze,P=M(i,p)?{detectorLimit:D(i.detectorLimit,320,1600,f.detectorLimit),bandMaxWidthPx:D(i.bandMaxWidthPx,320,4096,f.bandMaxWidthPx),minBandWidthPx:D(i.minBandWidthPx,0,4096,f.minBandWidthPx),bandTop:D(i.bandTop,0,.95,f.bandTop),minIntervalMs:D(i.minIntervalMs,0,5e3,f.minIntervalMs),stableReads:Math.round(D(i.stableReads,1,10,f.stableReads)),profileReads:Math.round(D(i.profileReads,1,100,f.profileReads)),maxReadMs:D(i.maxReadMs,50,6e4,f.maxReadMs),searchTimeoutMs:D(i.searchTimeoutMs,1e3,12e4,f.searchTimeoutMs),hint:Be(i.hint,!0),stillConfirm:Be(i.stillConfirm,!0)}:null,x=Re,y=o((g,w,E)=>D(l[g],w,E,x[g]),"S"),h=M(l,c)?{minLines:Math.round(y("minLines",1,50)),fillMin:y("fillMin",0,1),fillMax:y("fillMax",0,2),offsetMax:y("offsetMax",0,1),steadyFillDelta:y("steadyFillDelta",0,1),steadyOffsetDelta:y("steadyOffsetDelta",0,1),layoutShiftMax:y("layoutShiftMax",0,1),lineCountDelta:Math.round(y("lineCountDelta",0,50)),lockMs:y("lockMs",0,3e4),steadyMs:y("steadyMs",0,3e4),minFrames:Math.round(y("minFrames",1,100)),minIntervalMs:y("minIntervalMs",0,5e3),maxWidthPx:y("maxWidthPx",160,2048),detectorLimit:y("detectorLimit",320,1600),searchTimeoutMs:y("searchTimeoutMs",1e3,12e4)}:null;return{enabled:P!==null||h!==null,liveMrz:P,textLock:h,liveMrzArm:p,frontLockArm:c,load:{detectorLimit:P?.detectorLimit??h?.detectorLimit??f.detectorLimit,loadTimeoutMs:D(i.loadTimeoutMs,1e3,12e4,2e4),maxDownloadMs:D(i.maxDownloadMs,1e3,12e4,2e4)},reportSampleRate:D(i.reportSampleRate,0,1,1)}}o(At,"nt");function Lt(e,t){return e.enabled?!(t.probe??xt)().ok||(t.slow??Tt)()?{ok:!1,reason:"unsupported"}:{ok:!0,engine:Ct({baseUrl:t.baseUrl,salt:t.salt,tuning:{detectorLimit:e.load.detectorLimit,maxDownloadMs:e.load.maxDownloadMs,loadTimeoutMs:e.load.loadTimeoutMs},...t.workerUrl!==void 0?{workerUrl:t.workerUrl}:{},...t.createWorker!==void 0?{createWorker:t.createWorker}:{},...t.page!==void 0?{page:t.page}:{},...t.deviceMemoryGb!==void 0?{deviceMemoryGb:t.deviceMemoryGb}:{}})}:{ok:!1,reason:"off"}}o(Lt,"rt");function Pt(e=typeof navigator<"u"?navigator.userAgent:""){return/SamsungBrowser\//.test(e)?"samsung":/Firefox\/|FxiOS\//.test(e)?"firefox":/Chrome\/|CriOS\/|Chromium\//.test(e)&&!/Edg\/|OPR\//.test(e)?"chrome":/Safari\//.test(e)&&/Version\/|Mobile\//.test(e)&&!/Chrome\/|CriOS\//.test(e)?"safari":"other"}o(Pt,"Tt");var O=o(e=>e===void 0||!Number.isFinite(e)?void 0:Math.min(6e5,Math.max(0,Math.round(e))),"W"),ce=o((e,t,r)=>e===void 0||!Number.isFinite(e)?void 0:Math.min(r,Math.max(t,Math.round(e))),"pe");function Rt(e){let t=e.assist??null,r=e.load!==null&&e.load!==void 0&&typeof e.load=="object"?e.load:null,i=typeof e.load=="string"?e.load:null,l=t!==null?t.outcome:i==="unsupported"||i==="download"||i==="integrity"?i:i==="error"||i==="timeout"?"error":"off",u={kind:"live_mrz",platform:"web",engine:e.engine??ee,arm:e.arm,capture:e.capture,outcome:l,reads:ce(t?.reads??0,0,1e4)??0,browser:e.browser??Pt()},s=o((d,p)=>{p!==void 0&&(u[d]=p)},"s");return s("format",t?.format),s("framesToValid",ce(t?.framesToValid,1,1e4)),s("msToValid",O(t?.msToValid)),s("framesToLock",ce(t?.framesToLock,1,1e4)),s("msToLock",O(t?.msToLock)),s("msToCapture",O(e.msToCapture)),s("readP50Ms",O(t?.readP50Ms)),s("readP90Ms",O(t?.readP90Ms)),s("deviceClass",t?.deviceClass),r!==null&&(s("warmupMs",O(r.warmupMs)),s("downloadMs",O(r.downloadMs)),s("cached",r.cached),s("tier",r.tier),s("benchMs",O(r.benchMs))),s("stillConfirmed",e.stillConfirmed),s("typeMismatch",e.typeMismatch),u}o(Rt,"ot");function Ue(e,t){return e===void 0?!1:t==="passport"?e!=="TD3":e==="TD3"}o(Ue,"fe");var zt=2,Dt=1500;async function Et(e){let t=await import("./capture-session-doc-J4MIDQOS-DYA3TI2D.js");return new t.CaptureSessionDoc(e)}o(Et,"Ot");function qt(e){return{topLeft:{x:e.x,y:e.y},topRight:{x:e.x+e.width,y:e.y},bottomRight:{x:e.x+e.width,y:e.y+e.height},bottomLeft:{x:e.x,y:e.y+e.height}}}o(qt,"Et");function Wt(e,t,r){let i=[e.topLeft,e.topRight,e.bottomRight,e.bottomLeft],l=0;for(let u=0;u<i.length;u+=1){let s=i[u],d=i[(u+1)%i.length];l+=s.x*d.y-d.x*s.y}return t>0&&r>0?Math.abs(l)/2/(t*r):0}o(Wt,"At");function Vt(){import("./capture-session-doc-J4MIDQOS-DYA3TI2D.js").then(e=>e.warmDocDetector()).catch(()=>{})}o(Vt,"kn");function Ht(e){return Ft(e,{}).handle}o(Ht,"Cn");function Ft(e,t){let r=Te(),i=Ce({enabled:e.keepScreenAwake!==!1}),l=t.decode??(a=>createImageBitmap(a)),u=t.blurRefuseSharpnessMax??.16,s=t.now??(()=>performance.now()),d=tt(e.documentType,t.catalogCapture===!0?t.captureSeries??rt(e.issuer,e.documentType):[]),p=d.sides.length===1||e.side==="single",c=je(p?"singlePage":"twoSided",s());if(!p&&(e.side==="recto"||e.side==="verso")){let a=e.side==="recto"?"verso":"recto";c={...c,captured:{[a]:"server"},readSides:[a],current:e.side,phase:"flipCue",restPhase:"flipCue"}}let M="idle",f=null,P=null,x=!0,y=0,h=0,g=null,w=!1,E=!1,U="",F=null,_,B=null,pe=[],he=d.mrz==="none",_e=d.barcodeSide==="recto"||d.barcodeSide==="verso"?d.barcodeSide:null,N=he&&!p?t.barcode?.side??_e:null,fe=e.barcodeAssetBaseUrl??t.barcode?.assetBaseUrl,te=null,ge=o(()=>N===null||fe===void 0||t.barcode?.seen!==void 0?Promise.resolve(null):(te??(te=import("./barcode-detect-C5IOXMKI-ZOZ2WOWU.js").then(a=>a.loadBarcodeDetect(fe)).catch(()=>null)),te),"Se"),Ge=o((a,n)=>{if(N===null)return Promise.resolve(null);let m,v=new Promise(k=>{m=setTimeout(()=>k(null),t.barcode?.budgetMs??Dt)});return Promise.race([Ye(a,n,N),v]).finally(()=>clearTimeout(m))},"it"),Ye=o(async(a,n,m)=>{let v=m==="recto"?"verso":"recto";try{let k=t.barcode?.seen;if(k!==void 0)return await k(a)?m:v;let[z,C]=await Promise.all([ge(),n()]);if(z===null||C===null)return null;let b=Math.min(1600,C.width),S=document.createElement("canvas");S.width=b,S.height=Math.max(1,Math.round(C.height/C.width*b));try{let q=S.getContext("2d");return q===null?null:(q.drawImage(C,0,0,S.width,S.height),await at(z,q.getImageData(0,0,S.width,S.height),m))}finally{S.width=0,S.height=0}}catch{return null}},"st"),T=t.webOcr!==void 0&&!he?At(t.webOcr.captureDocument,{mode:e.liveMrz?.mode??"auto"}):null,G=null,I=T===null||!T.enabled?"off":null,J=null,Q=null,ve=new WeakMap,re="";if(T!==null&&T.enabled&&t.webOcr!==void 0){let a=t.webOcr,n=Lt(T,{baseUrl:e.liveMrz?.assetBaseUrl??a.baseUrl,salt:a.salt,...e.liveMrz?.workerUrl!==void 0?{workerUrl:e.liveMrz.workerUrl}:{},...a.createWorker!==void 0?{createWorker:a.createWorker}:{}});if(n.ok){G=n.engine;let m=new De({textLock:T.textLock,liveMrz:T.liveMrz});J=m;let v=n.engine;v.ready.then(k=>{I=k,typeof k!="string"&&x&&m.setEngine(v,k.tier)})}else I=n.reason}let V=o(a=>{let n=JSON.stringify(a);n!==re&&(re=n,r.emit("mrz",a))},"H"),ye=o((a,n)=>{let m=t.webOcr?.reports;if(m===void 0||T===null||a===void 0)return;let v=a.format==="ID-3"||a.side==="single"?"single":a.side==="verso"?"verso":"recto",k=v!=="recto"?T.liveMrzArm??T.frontLockArm:T.frontLockArm;if(k===null||Math.random()>=T.reportSampleRate)return;let z=a.via==="live_mrz"?Q:null,C=o(()=>{let b=z?.value??null;m([Rt({arm:k,capture:v,assist:a.ocr??null,load:k==="control"?"off":I,...a.msToCapture!==void 0?{msToCapture:a.msToCapture}:{},...b!==null&&b.stillConfirmed!==void 0?{stillConfirmed:b.stillConfirmed}:{},...n!==void 0?{typeMismatch:Ue(n.format,d.format==="ID-3"?"passport":"card")}:{}})])},"x");z!==null&&z.value===null?Promise.race([z.promise,new Promise(b=>setTimeout(b,3e3))]).then(C):C()},"Me"),j=o(a=>{!x||a===M||(M=a,i.setActive(a==="starting"||a==="scanning"),r.emit("state",a))},"U"),Je=o((a,n)=>n===void 0?null:p?"single":a.captured.recto===n?"recto":a.captured.verso===n?"verso":null,"ut"),Qe=o(a=>({phase:a.phase,captured:p?a.captured.recto!==void 0?["single"]:[]:["recto","verso"].filter(n=>a.captured[n]!==void 0),expected:p?null:a.current??null,notice:a.notice??null,lastShot:Je(a,a.lastShot),manualShutter:a.manualShutter,torchAvailable:f?.torchAvailable()??!1,torch:E}),"lt"),we=o(()=>{let a=f;a!==null&&a.captureNow().catch(()=>A({type:"captureFailed",at:s()}))},"De");function A(a){if(!x)return;let n=c;c=yt(c,a),c.phase==="capturing"&&n.phase!=="capturing"&&Promise.resolve().then(we),c.phase==="result"&&n.phase!=="result"&&(j("done"),Me());let m=Qe(c),v=JSON.stringify(m);v!==U&&(U=v,r.emit("scan",m))}o(A,"R");function Me(){B!==null&&clearInterval(B),B=null;for(let a of pe.splice(0))a();f?.destroy(),f=null,i.setActive(!1)}o(Me,"we");let be=o(()=>f?.captureReport?.(),"ke"),ae=!1,ke=o((a,n)=>{if(!(a===void 0||t.onFaceReport===void 0))try{t.onFaceReport(a,n)}catch{}},"Ce"),X=o(a=>{re="",!(f===null||c.phase==="reading"||c.phase==="result")&&(ae=!1,g=p?"single":c.current??a,f.rearm(g))},"j"),Xe=o(async(a,n,m,v)=>{Q=null;let k=I!==null&&typeof I=="object"&&I.tier==="low";if(v!==void 0&&G!==null&&T?.liveMrz?.hint===!0&&!k){let q={promise:bt(G,a,v,{engine:ee,detectorLimit:T.liveMrz.detectorLimit}).catch(()=>null),value:null};q.promise.then(L=>{q.value=L}),Q=q}v!==void 0&&Ue(v.format,d.format==="ID-3"?"passport":"card")&&V({state:"mismatch",format:v.format});let z=be();ke(z,"captured"),ae=!0,ye(z,v);let C=m===void 0?F:m===null?null:{quad:qt(m),frameWidth:0,frameHeight:0,inStill:!0},b={decoded:null},S=o(()=>(b.decoded??(b.decoded=Promise.resolve().then(()=>l(a)).catch(()=>null)),b.decoded),"w");try{await Ke(a,n,C,S,Q,v)}finally{b.decoded!==null&&(await b.decoded)?.close()}},"ct"),Ke=o(async(a,n,m,v,k,z)=>{let C=`shot-${y+=1}`,b=c.current;if(A({type:"captured",id:C,at:s()}),e.haptics!==!1)try{globalThis.navigator?.vibrate?.(30)}catch{}if(!w&&u>0){let L=await(t.measureSharpness!==void 0?t.measureSharpness(a,m):v().then(R=>R===null?-1:Pe(R,ne(m?.quad??null,m?.inStill===!0?R:{width:m?.frameWidth??0,height:m?.frameHeight??0},R)))).catch(()=>-1);if(!x)return;if(Number.isFinite(L)&&L>=0&&L<u){w=!0;let R=p?"recto":c.current??(c.captured.recto===void 0?"recto":"verso");A({type:"readFailed",side:R,id:C,issue:"blurry"}),X(R);return}}w=!1;let S;if(p)S="single";else{let L=z!==void 0&&z.format!=="TD3"&&(d.mrzSide==="recto"||d.mrzSide==="verso")?d.mrzSide:null,R=L===null&&t.classify===void 0?await Ge(a,v):null,Se=R===null||N===null?R:it(R,N,c.captured),Y=L??Se??(Se===null&&N!==null&&b!==void 0?b:null)??await(t.classify!==void 0?t.classify(a):v().then(K=>K===null?b??"recto":m?.inStill===!0?Fe(K,480,null,!0):Fe(K,480,ne(m?.quad??null,{width:m?.frameWidth??0,height:m?.frameHeight??0},K)))).catch(()=>b??"recto");if(!x)return;if(c.captured[Y]!==void 0&&h<zt){h+=1,A({type:"duplicate",id:C,side:Y}),X(Y==="recto"?"verso":"recto");return}let xe=c.captured.recto===void 0?"recto":c.captured.verso===void 0?"verso":void 0;S=c.captured[Y]!==void 0&&xe!==void 0?xe:Y,h=0,A({type:"classified",id:C,side:S})}let q=S==="verso"?"verso":"recto";try{let L=t.encode!==void 0?await t.encode(a):await v().then(R=>{if(R===null)throw new Error("the still could not be decoded");return mt(R)});if(!x)return;k!==null&&ve.set(L.blob,k),r.emit("captured",{image:L.blob,side:S,documentType:e.documentType,...e.issuer!==void 0?{issuer:e.issuer}:{},width:L.width,height:L.height,previewDataUrl:n}),t.deferRead!==!0&&A({type:"readOk",side:q})}catch(L){A({type:"readFailed",side:q,id:C,issue:"technical"}),r.emit("error",Z("generic",!0,{phase:"keyframes",name:oe(L)}))}X(q==="recto"?"verso":"recto")},"dt"),Ze=o(a=>{pe.push(a.on("statechange",({state:n})=>{n==="preflight"||n==="acquiring"?j("starting"):n==="positioning"?j("scanning"):n==="captured"?j("captured"):n==="error"&&j("error")}),a.on("feedback",({key:n,reticle:m})=>r.emit("feedback",{key:n,reticle:m})),a.on("checks",n=>{r.emit("gate",{progress:n.p,quad:n.quad,frameWidth:n.frameWidth,frameHeight:n.frameHeight,...n.guide!==void 0?{guide:{detected:n.guide.detected,fill:n.guide.fill,offsetX:n.guide.offsetX??0,offsetY:n.guide.offsetY??0}}:{}});let m=n.ocr?.mrz;m!==void 0&&(m.state==="fallback"?V({state:"fallback",reason:m.reason}):m.state==="valid"?V({state:"valid",format:m.format}):m.state==="reading"?V({state:"reading",...m.format?{format:m.format}:{},...m.coach?{coach:m.coach}:{}}):V({state:"searching"}));let v=n.quad===null?0:Wt(n.quad,n.frameWidth,n.frameHeight);F=n.quad===null?null:{quad:n.quad,frameWidth:n.frameWidth,frameHeight:n.frameHeight},A({type:"report",report:{present:n.quad!==null&&n.plausible||n.guide?.detected===!0,ready:n.ready===!0,locking:n.p>=.5,areaFrac:v},at:s()})}),a.on("error",({kind:n,retryable:m,detail:v})=>r.emit("error",Z(n,m,v))),a.on("artifacts",n=>{Xe(n.keyframe,n.previewDataUrl,n.docRegion,n.liveMrz)}))},"mt"),ie=o(()=>(P??(P=(async()=>{if(x){if(ge(),f===null){let a;try{a=await(t.createEngine??Et)({...t.engineOptions??{},..._!==void 0?{guide:_}:{},video:e.video,format:d.format,side:p?"single":e.side??"recto",autoCapture:!1,...J!==null?{ocr:J}:{}})}catch(m){j("error"),r.emit("error",Z("models",!0,{phase:"models",name:oe(m)}));return}if(!x){a.destroy();return}f=a,g=p?"single":e.side??"recto",Ze(a);let n=t.tickMs??500;n>0&&(B=setInterval(()=>A({type:"tick",at:s()}),n))}A({type:"clockRestart"}),T!==null&&T.liveMrzArm==="live"&&(I==="unsupported"||I==="off")&&V({state:"fallback",reason:I}),await f.start()}})().finally(()=>{P=null})),P),"ne");return{handle:{get state(){return M},on:o((a,n)=>r.on(a,n),"on"),start:ie,retry:o(()=>{if(f===null&&c.phase==="result"){A({type:"retake"}),h=0,w=!1,ie();return}if(f!==null&&M!=="error"){A({type:"retake"}),h=0,w=!1,g=p?"single":null,f.rearm(p?"single":void 0);return}ie()},"retry"),setSide:o(a=>{p||a==="single"||f!==null&&c.current===a&&g===a&&c.phase!=="reading"&&c.phase!=="result"||(c.current!==a&&(c={...c,current:a}),A({type:"clockRestart"}),c.phase!=="reading"&&c.phase!=="result"&&f!==null&&(g=a,f.rearm(a)))},"setSide"),shutter:we,focusAt:o((a,n)=>{f?.focusAt?.(a,n)},"focusAt"),setGuide:o(a=>{_=a,f?.setGuide?.(a)},"setGuide"),setTorch:o(a=>{E=a,f?.setTorch(a),A({type:"tick",at:s()})},"setTorch"),destroy:o(()=>{if(x&&f!==null&&M!=="done"){let a=be();!ae&&a!==void 0&&a.ticks>0&&ke(a,"abandoned"),ye(a,void 0)}x=!1,Me(),J?.setEngine(null),G?.dispose(),G=null,r.clear()},"destroy")},plan:d,setFlowState:o(a=>{(c.phase==="reading"||c.phase==="result")&&j(a==="done"&&c.phase!=="result"?"scanning":a)},"setFlowState"),settle:o((a,n)=>{let m=a==="verso"?"verso":"recto";A(n.ok?{type:"readOk",side:m}:{type:"readFailed",side:m,issue:n.issue}),n.ok||X(m)},"settle"),takeDeviceRead:o(a=>ve.get(a.image)?.value??null,"takeDeviceRead")}}o(Ft,"Bt");export{zt as a,Dt as b,Vt as c,Ht as d,Ft as e};
@@ -0,0 +1,3 @@
1
+ import{A as Xe,F as me,G as ee,H as et,I as tt,J as nt,a as D,b as je,c as Be,f as Ke,g as Ve,h as $e,i as He,j as pe,k as ze,m as U,o as R,p as q,q as H,r as X,s as L,t as fe,v as We,w as Ze,x as Ye,y as Je,z as Qe}from"./chunk-Y6VKSYVY.js";import{g as it}from"./chunk-WZFFQZE2.js";import{b as Ge}from"./chunk-TODKCK6A.js";import{b as qe,c as de,e as rt}from"./chunk-6MYG4HWP.js";import{a as t}from"./chunk-4FHWXBOB.js";function Et(n){let i=n.now??(()=>Date.now()),p=n.setTimer??((w,c)=>setTimeout(w,c)),f=n.clearTimer??(w=>clearTimeout(w)),g=null,_=!1,d=!1,C=!1,j=0,N=null,A=t(()=>{N!==null&&f(N),N=null},"_"),M=t(()=>{let w=n.armRamp;w===void 0||_||d||C||i()<j||(_=!0,w().catch(()=>{}).then(c=>{if(_=!1,!C){if(c===void 0){j=i()+2e3;return}if(c.challenge===void 0){d=!0;return}g={challenge:c.challenge,expiresAt:c.expiresAt},A(),N=p(()=>{N=null,!C&&g!==null&&n.waiting()&&M()},Math.max(1e3,c.expiresAt-i()-2e4))}}))},"A");return{arm(){g!==null&&g.expiresAt-i()>2e4||M()},take(){let w=g;return g=null,A(),w!==null&&w.expiresAt-i()>=12e3?w.challenge:void 0},stop(){C=!0,g=null,A()}}}t(Et,"gt");function Rt(n){return n.idNumberBound??n.nniBound}t(Rt,"ue");function at(n){return n===void 0?void 0:n.idNumberFromDocument??n.nniFromDocument}t(at,"ee");var lt="https://api.sekyro.ai",Nt=5e3,Pt=24e4,Ot=9e4,Dt=25*6e4,Lt=20*6e4,Ft=3,Ut=3e3,qt=1500,Gt=10;function ot(n){return n instanceof Error&&n.name==="ChallengeError"&&n.code||"challenge_failed"}t(ot,"_t");var st=new Set(["aborted","embedder_opaque","site_key_rejected"]);function jt(n){return new Promise(i=>setTimeout(i,n))}t(jt,"cn");function Bt(){let n=globalThis.crypto;if(n!==void 0&&typeof n.randomUUID=="function")return n.randomUUID();let i=new Uint8Array(16);if(n!==void 0&&typeof n.getRandomValues=="function")n.getRandomValues(i);else for(let f=0;f<16;f+=1)i[f]=Math.floor(Math.random()*256);i[6]=(i[6]??0)&15|64,i[8]=(i[8]??0)&63|128;let p=[...i].map(f=>f.toString(16).padStart(2,"0")).join("");return`${p.slice(0,8)}-${p.slice(8,12)}-${p.slice(12,16)}-${p.slice(16,20)}-${p.slice(20)}`}t(Bt,"dn");function Kt(n){return Vt(n,{})}t(Kt,"Po");function Vt(n,i){let p=n.apiOrigin??lt,f=n.autoRetry??!0,g=n.rearm??"auto",_=i.client??new Be({apiOrigin:p,sessionToken:n.clientToken,fetch:n.fetch,locale:n.locale}),d=new Proxy(_,{get(e,r){if(r==="submitCheck")return gt;let a=Reflect.get(e,r,e);return typeof a=="function"?a.bind(e):a}}),C=i.sleep??jt,j=i.uuid??Bt,N=i.getChallengeToken??((e,r)=>import("./challenge-frame-YBTLAQ5G-NN763UU5.js").then(a=>a.executeChallenge({frameUrl:e.url,siteKey:e.siteKey,action:"liveness",subject:r.subject,signal:r.signal}))),A=rt(),M=null,w=null,c=!1,ve=new AbortController,h=null,z=null,W=null,Z=t(()=>W??et(h),"ne"),Y=t(()=>tt(ee(h),Z()),"oe"),S=t(e=>{h=e,!R(e)&&(Ee(Lt)||yt(e))&&ue(e),A.emit("view",e),M?.onView(e)},"E"),b=t(()=>h!==null?Promise.resolve(h):(z??(z=d.getSession().then(e=>(S(e),e)).finally(()=>{z=null})),z),"x"),T=t(async()=>{let e=await d.getSession();return S(e),e},"I"),te=t(async(e,r)=>{e.plan!==void 0?S(e):await T()},"le"),J=null,ge=t(async e=>{let r=await b();if(e||!r.consentRecorded){let a=await d.recordConsent(n.locale);a.plan!==void 0?S(a):h!==null&&S({...h,consentRecorded:!0})}Q()&&ue(r)},"Me"),I=t(e=>e?.force===!0?ge(!0):(J??(J=ge(!1).finally(()=>{J=null})),J),"F"),ne={client:d,ensureConsent:t(e=>I(e),"ensureConsent"),sleep:C,uuid:j,...i.random!==void 0?{random:i.random}:{},onBusy:t(e=>{c||A.emit("busy",e)},"onBusy")},_e=!1,be=null,re=t(e=>{if(e.status==="verified"||e.status==="not_verified"||e.status==="review"){if(_e)return;_e=!0}be=JSON.stringify(e),A.emit("result",e)},"me"),ft=t(e=>{be!==JSON.stringify(e)&&re(e)},"Nt"),ke=t(async e=>{let r=h;e&&(r=await T().catch(()=>h));let a=r===null?null:U(r);return a!==null&&!c&&A.emit("method",a),a!==null},"Ie"),ie=null,we=!1,Ae=!1,Ce=t(()=>Je(ne,(e,r)=>e.submitCheck("population_registry",{},{idempotencyKey:r})),"Fe"),Me=t(e=>Rt(e)===!0||at(H(e,"population_registry"))===!0,"Ne"),mt=t(async()=>{try{let e=await b();if(R(e)||U(e)!==null||q(e)?.checkType!=="population_registry")return;if(!Me(e)&&at(H(e,"population_registry"))===void 0&&(e=await T()),!Me(e)){Ae=!0;return}await I(),await te(await Ce(),"population_registry");let r=h===null?void 0:H(h,"population_registry");if(r?.state==="input_required"&&r.reason==="registry_unavailable"&&ze(r)>0){if(await C(Nt),c)return;await te(await Ce(),"population_registry")}}catch(e){if(e instanceof D&&(e.code==="check_not_active"||e.code==="step_not_on_path")){await T().catch(()=>{});return}we=!0;return}h!==null&&R(h)&&re(fe(h,{autoRetry:f}))},"Ht"),Se=t(()=>(ie??(ie=mt()),ie),"He"),x=i.now??Date.now,F=null,B,ae,ht=0,oe=t((e,r)=>`${e.url}
2
+ ${e.siteKey}
3
+ ${r}`,"ye"),Te=0,se,le=t((e,r)=>{Te+=1;let a=x(),l=N(e,{signal:ve.signal,subject:r}),s={key:oe(e,r),at:a,token:l};return l.then(()=>{s.issuedAt=x(),ae=void 0},m=>{let u=ot(m);if(s.failed=u,c||u==="aborted")return;ae=u;let{detail:y,readyMs:o}=m;K({check:"attestation",kind:"unavailable",engineKind:u,attempt:ht++,challengeMs:x()-a,readyMs:o,detail:y,inApp:Ge()})}),l.catch(()=>{}),s},"Se"),xe=t((e,r)=>e!==null&&e.key===r&&(e.issuedAt===void 0||x()-e.issuedAt<Pt),"De"),ue=t((e,r={})=>{let a=e?.challenge??null;if(e===null||a===null||c)return;let l=X(e.sessionId),s=F;(r.replaceFailed===!0&&s?.failed!==void 0&&!st.has(s.failed)||!xe(s,oe(a,l)))&&(F=le(a,l))},"_e"),Ie=t(async(e,r)=>{let a=oe(e,r),l=F;F=null;let s=xe(l,a)?l:le(e,r),m=s===l?0:1,u,y=new Promise(o=>{u=setTimeout(()=>o("late"),Ot)});try{for(;;){let o=await Promise.race([s.token.then(k=>({token:k}),k=>({error:ot(k)})),y]);if(o==="late")return!c&&F===null&&(F=s),{error:ae??"timeout"};if("token"in o)return se=Math.max(0,Math.round((s.issuedAt??x())-s.at)),o;if(c||st.has(o.error)||m>=Ft||m>0&&await Promise.race([C(Ut*m),y])==="late")return o;if(c)return{error:"aborted"};m+=1,s=le(e,r)}}finally{clearTimeout(u)}},"Ue"),P=null,yt=t(e=>pe(e).some(r=>(r.checkType==="phone_otp"||r.checkType==="email_otp")&&r.state!=="passed"&&r.state!=="skipped"),"Dt"),Ee=t(e=>P===null||x()-P>=e,"Be"),Q=t(()=>Ee(Dt),"re"),vt=t(e=>{let r=e.attestation;return typeof r?.turnstileToken=="string"&&r.turnstileToken.length>0},"Ut"),Re=new Map,Ne=t(async()=>{let e=await b(),r=e.challenge;if(r==null||e.simulation!==void 0)return;let a=await Ie(r,X(e.sessionId));if(!("token"in a))throw new D({status:400,code:"attestation_invalid",message:`browser check: ${a.error}`});return a.token},"Ge"),gt=t(async(e,r,a={})=>{let l=r;if("attestation"in l)try{let o=await _.submitCheck(e,r,a);return vt(l)&&(P=x()),o}catch(o){throw o instanceof D&&o.code==="attestation_invalid"&&(P=null),o}let s=(e==="phone_otp"||e==="email_otp")&&l.action!=="verify",m=a.idempotencyKey,u=m!==void 0?Re.get(m):void 0;u===void 0&&(s||Q())&&(u=await Ne(),m!==void 0&&u!==void 0&&Re.set(m,u));let y=t((o,k)=>o!==void 0?{...k,browserCheckToken:o}:k,"b");try{let o=await _.submitCheck(e,r,y(u,a));return u!==void 0&&(P=x()),o}catch(o){if(!(o instanceof D)||o.code!=="attestation_invalid"||(P=null,u!==void 0))throw o;let k=await Ne(),O=m!==void 0?{...a,idempotencyKey:j()}:a,E=await _.submitCheck(e,r,y(k,O));return k!==void 0&&(P=x()),E}},"Bt"),Pe=t(async(e={})=>{if(B=void 0,e.always!==!0&&!Q())return{};let r=await b(),a=r.challenge;if(a==null)return{};let l=await Ie(a,X(r.sessionId));if("token"in l)return{channel:"hosted_web",turnstileToken:l.token};if(B=l.error,r.simulation!==void 0)return{channel:"hosted_web"};throw new Ye(l.error)},"Ke"),_t=t(()=>B,"qt"),bt=t(()=>({checks:Math.min(50,Te),...se!==void 0?{challengeMs:Math.min(6e5,se)}:{}}),"Gt"),K=t(e=>{if(c)return;let r=d.reportCaptureIssue;if(r===void 0)return;let a=e.formFactor;try{a??(a=qe())}catch{}try{Promise.resolve(r.call(d,{...e,...a!==void 0?{formFactor:a}:{}})).catch(()=>{})}catch{}},"W"),v=null,V=null,Oe=new WeakMap,De=Promise.resolve(),$=0,kt=t(async()=>{let e=await b();for(let r=0;r<Gt&&!c&&!R(e)&&q(e)===void 0&&pe(e).some(a=>a.state==="processing")&&(await C(qt),!c);r+=1)e=await T();return e},"Kt"),wt=t(async(e,r,a)=>{let{capture:l}=e,s=t(()=>c,"m"),m=t(()=>e.alive&&e.attempt===a,"C"),u=t(o=>{m()&&l.setFlowState(o)},"g"),y=t(o=>{if(!s()&&(o.status==="unavailable"&&o.reasonCode!==void 0&&!Ke(o.reasonCode)&&K({check:"liveness",kind:"unavailable",phase:"upload",engineKind:o.reasonCode,attempt:Math.max(0,e.issues.value)}),re(o),!!m())){if(o.status==="retry"&&g==="auto"){l.handle.retry();return}l.setFlowState("done")}},"b");if(r.degraded==="NO_RECORDER"){let o=h?.sessionId??(await b().catch(()=>null))?.sessionId??"";y(L(o,"no_recorder"));return}u("uploading");try{if(await Se(),s())return;let o=await b(),k;if(!R(o)&&U(o)!==null){await ke(!1),y(L(o.sessionId,"method_required"));return}if(!R(o)){if(q(o)?.checkType==="population_registry"){y(L(o.sessionId,Ae?"nni_unbound":we?"network":"registry_unavailable"));return}if(await I(),s())return;k=h??o;let O=await Qe({...ne,artifacts:r,getAttestation:Pe,attestationError:_t,attestationFacts:bt,clipKeys:{get:t(()=>Oe.get(r)??null,"get"),set:t(E=>{Oe.set(r,E)},"set")},getView:t(()=>h??o,"getView"),refreshView:T,applySubmit:te,onPhase:u,isCancelled:s,onKeyframePromoted:t(E=>{w=E},"onKeyframePromoted")});if(s())return;if(O.kind==="unavailable"){O.reason==="attestation"&&(V={bound:e,artifacts:r});let E=L(o.sessionId,O.reason),Ue=O.reason==="attestation"?B:void 0;y(Ue!==void 0?{...E,attestationError:Ue}:E);return}if(O.kind==="resync"&&await T(),h!==null&&U(h)!==null){await ke(!1),y(L(o.sessionId,"method_required"));return}o=await kt()}y(fe(o,{autoRetry:f,previous:k}))}catch{if(s())return;y(L(h?.sessionId??"","network"))}},"jt"),Le=t((e,r)=>{let a=e.attempt;$>0&&e.alive&&e.capture.setFlowState("uploading"),$+=1,De=De.then(()=>wt(e,r,a)).finally(()=>{$-=1,$===0&&M?.onChainIdle()}).catch(()=>{})},"We"),Fe=t(e=>{v?.capture.handle.destroy(),v!==null&&(v.alive=!1,v.ramp.stop());let r=Et({armRamp:typeof d.armRamp=="function"?()=>d.armRamp():void 0,waiting:t(()=>s.alive&&Y()==="self"&&(l.handle.state==="starting"||l.handle.state==="gating"),"waiting")}),a=Promise.resolve(),l=it(e,M?.captureInternals?.(e)??i.capture,()=>h?.capture?.liveness?.keyframe?.rank===!0,Y,()=>r.take()??h?.capture?.liveness?.screenRamp,{session:t(()=>ee(h),"session"),onModeChange:t(u=>{W=u},"onModeChange")}),s={capture:l,alive:!0,ramp:r,attempt:0,issues:$e()};v=s,l.handle.on("error",u=>{K(Ve("liveness",u,s.issues.value))}),l.handle.on("state",u=>{if(s.issues.note(u),u==="starting"){s.attempt+=1,V?.bound===s&&(V=null),Q()&&ue(h,{replaceFailed:!0});let y=h===null?void 0:q(h)?.checkType;a=y==="liveness"||y==="face_match"?I().catch(()=>{}):Promise.resolve()}(u==="starting"||u==="gating")&&Y()==="self"&&a.then(()=>{s.alive&&r.arm()})}),l.handle.on("captured",u=>{Promise.resolve().then(()=>Le(s,u))});let m=l.handle;return{get state(){return m.state},get captureMode(){return m.captureMode},get facingMode(){return m.facingMode},on:t((u,y)=>m.on(u,y),"on"),start:t(async u=>{if(h===null&&await b().catch(()=>{}),!!s.alive)return m.start(u)},"start"),retry:t(()=>{let u=V;if(u!==null&&u.bound===s&&s.alive){V=null,Le(s,u.artifacts);return}m.retry()},"retry"),switchCamera:t(()=>m.switchCamera(),"switchCamera"),canSwitchCaptureMode:t(()=>m.canSwitchCaptureMode(),"canSwitchCaptureMode"),setCaptureMode:t(u=>m.setCaptureMode(u),"setCaptureMode"),destroy:t(()=>{s.alive=!1,r.stop(),v===s&&(v=null),m.destroy()},"destroy")}},"$e"),At=t(async()=>{if(c)return null;try{let e=await b();return c?null:U(e)}catch{return null}},"Yt"),Ct=t(async()=>{if(c)return"self";try{let e=await b();if(c)return"self";let r=ee(e);return r==="choice"?Z()??r:r}catch{return"self"}},"Wt"),Mt=t(async()=>{if(c)return!1;try{let e=await b();return c||R(e)||de()?!1:me(e,q(e))==="phone"||me(e,H(e,"liveness"))==="phone"}catch{return!1}},"$t"),St=t(async()=>{if(c)return!1;try{let e=await b();return!c&&e.returning===!0}catch{return!1}},"Qt"),Tt=t(async e=>{let r=(await b()).plan?.choice,a=r?.options.find(s=>He[s.service]===e);if(!a)throw new RangeError(`method ${String(e)} is not offered`);let l=await d.choose(r.nodeId,a.id);c||S(l)},"Zt"),ce=null,xt=t(()=>(ce??(ce=import("./plan-runner-ZVYJ3UI3-PDRZPFOE.js").then(e=>{let r=e.createPlanRunner({runtime:ne,currentView:t(()=>h,"currentView"),cameraMode:Y,captureModeSwitch:{pick:Z,choose:t(a=>{W=a},"choose")},ensureView:b,refreshView:T,ensureConsent:t(()=>I(),"ensureConsent"),liveness:Fe,stopLiveness:t(()=>{v!==null&&(v.alive=!1,v.ramp.stop(),v.capture.handle.destroy(),v=null)},"stopLiveness"),chainBusy:t(()=>$>0,"chainBusy"),destroyed:t(()=>c,"destroyed"),sleep:C,isMobile:de,now:i.now??Date.now,keptFaceKey:t(()=>w,"keptFaceKey"),setView:S,baseCapture:i.capture,emitStep:t(a=>{c||A.emit("step",a)},"emitStep"),emitResult:ft,reportCaptureIssue:K,documentInternals:i.document,documentFacts:i.documentFacts,portraitInternals:i.portrait,livePhotoInternals:i.livePhoto,uploadInternals:i.upload,pageCameraInternals:i.pageCamera});return M=r,r})),ce),"Jt");return{consent:t(()=>I(),"consent"),startRegistry:Se,methodChoice:At,selectMethod:Tt,reportCameraUnavailable:t(async e=>{await I();let r=d.reportCameraUnavailable;if(r===void 0)throw new TypeError("this client cannot report a missing camera");let a=await r.call(d,e).catch(l=>{if(l instanceof D&&l.code==="check_out_of_order")return d.getSession();throw l});c||S(a)},"reportCameraUnavailable"),reportCaptureIssue:K,testerGate:t(async e=>{let r=d.testerGate;if(r===void 0)throw new TypeError("this client cannot run the tester gate");let a=e.clip,l=je(e.clipMime??"");if(a===void 0||!Ze.includes(l))throw new TypeError("the capture has no clip");await I();let s=await We(d,"clip",l,a.size,{engine:e.engine,durationMs:e.clipMs});await d.uploadToSpaces(s.uploadUrl,a,l);let{key:m}=await d.completeMedia(s.key),u=await Pe({always:!0}),y=await r.call(d,{clipKey:m,attestation:u,captureChannel:e.captureChannel,capture:{...Xe(e),attestationError:B}}),{bound:o,...k}=y;return c||(k.plan!==void 0?S(k):await T()),{bound:o===!0}},"testerGate"),mobileRequired:Mt,captureMode:Ct,chooseCaptureMode:t(e=>{W=e},"chooseCaptureMode"),get captureChoice(){return Z()},returning:St,liveness:Fe,run:t(async()=>{if(c)throw new Error("verification destroyed");return(await xt()).run()},"run"),currentStep:t(()=>M?.current()??null,"currentStep"),voiceClips:t(async()=>{if(c)return null;try{let e=await b();return c?null:e.voice??null}catch{return null}},"voiceClips"),on:t((e,r)=>A.on(e,r),"on"),destroy:t(()=>{c=!0,ve.abort(),M?.destroy(),v!==null&&(v.alive=!1,v.capture.handle.destroy(),v=null),A.clear()},"destroy")}}t(Vt,"ln");var ut=["AD","AE","AF","AG","AI","AL","AM","AO","AQ","AR","AS","AT","AU","AW","AX","AZ","BA","BB","BD","BE","BF","BG","BH","BI","BJ","BL","BM","BN","BO","BQ","BR","BS","BT","BV","BW","BY","BZ","CA","CC","CD","CF","CG","CH","CI","CK","CL","CM","CN","CO","CR","CU","CV","CW","CX","CY","CZ","DE","DJ","DK","DM","DO","DZ","EC","EE","EG","EH","ER","ES","ET","FI","FJ","FK","FM","FO","FR","GA","GB","GD","GE","GF","GG","GH","GI","GL","GM","GN","GP","GQ","GR","GS","GT","GU","GW","GY","HK","HM","HN","HR","HT","HU","ID","IE","IL","IM","IN","IO","IQ","IR","IS","IT","JE","JM","JO","JP","KE","KG","KH","KI","KM","KN","KP","KR","KW","KY","KZ","LA","LB","LC","LI","LK","LR","LS","LT","LU","LV","LY","MA","MC","MD","ME","MF","MG","MH","MK","ML","MM","MN","MO","MP","MQ","MR","MS","MT","MU","MV","MW","MX","MY","MZ","NA","NC","NE","NF","NG","NI","NL","NO","NP","NR","NU","NZ","OM","PA","PE","PF","PG","PH","PK","PL","PM","PN","PR","PS","PT","PW","PY","QA","RE","RO","RS","RU","RW","SA","SB","SC","SD","SE","SG","SH","SI","SJ","SK","SL","SM","SN","SO","SR","SS","ST","SV","SX","SY","SZ","TC","TD","TF","TG","TH","TJ","TK","TL","TM","TN","TO","TR","TT","TV","TW","TZ","UA","UG","UM","US","UY","UZ","VA","VC","VE","VG","VI","VN","VU","WF","WS","XK","YE","YT","ZA","ZM","ZW"],ct=["carte_identite","passport","residence_permit","drivers_license"],$t=["carte_identite","passport","residence_permit"];function he(n,i){let p=n.byIssuer?.[i]??n.default;return ct.filter(f=>p==="*"?$t.includes(f):p.includes(f))}t(he,"mn");function dt(n,i=ut){return[...new Set([...i,...Object.keys(n.byIssuer??{})])].filter(p=>he(n,p).length>0).sort()}t(dt,"Io");var G={fullNameMin:2,fullName:200,email:254,occupation:120,shortText:120,longText:1e3,addressLine:120,addressLines:4,city:80,postcode:16,number:1e12,dateMin:"1900-01-01",dateMax:"2100-12-31"};var bn={full_name:G.fullName,occupation:G.occupation,email:G.email,short_text:G.shortText,long_text:G.longText},pt=Object.freeze({nni_invalid:"id_number_invalid",nni_not_found:"registry_record_not_found",nni_recheck:"id_number_recheck",document_nni_mismatch:"document_id_number_mismatch",nni_locked:"id_number_locked",nni_unbound:"id_number_unbound",missing_nni:"missing_id_number",registry_needs_nni_source:"registry_needs_id_number_source"}),kn=new Map(Object.entries(pt)),wn=new Map(Object.entries(pt).map(([n,i])=>[i,n]));function Ht(n,i){let p=n.options.filter(d=>d.id!==n.current);if(i===void 0)return{switchTo:p,methods:[]};let f=t(d=>d.countries!==void 0&&d.countries.length>0,"i");if(i===null)return{switchTo:p.filter(d=>!f(d)),methods:[]};let g=i.toUpperCase(),_=t(d=>!f(d)||d.countries.includes(g),"u");return{switchTo:p.filter(_),methods:p.filter(d=>f(d)&&_(d))}}t(Ht,"Wo");function zt(n,i,p){let f=n.names?.[i.toUpperCase()],g=f?.[p]??f?.en;if(g!==void 0&&g!=="")return g;let _=n.nationalEid?.providerName;return _!==void 0&&_!==""?_:void 0}t(zt,"$o");function Wt(n){return n===void 0?[]:[...new Set(n.options.filter(i=>i.id!==n.current).flatMap(i=>i.countries??[]).map(i=>i.toUpperCase()))]}t(Wt,"Qo");var An=10*1024*1024;function lr(n){if(n==="permission")return"denied";if(n==="notfound"||n==="insecure"||n==="unsupported")return"no_camera"}t(lr,"Ce");var Zt=/^[A-Z0-9][A-Z0-9 -]{0,39}$/,Yt=Object.freeze({normalize:t(n=>n.trim().toUpperCase().replace(/\s+/g," "),"normalize"),check:t(n=>Zt.test(n),"check"),registrySources:Object.freeze([]),describe:"number must be 1 to 40 letters, digits, spaces or hyphens"}),Jt=/^[A-Z0-9]{4,20}$/,ye=t(n=>n.trim().toUpperCase().replace(/[\s-]+/g,""),"m"),Qt=Object.freeze({normalize:ye,check:t(n=>Jt.test(ye(n)),"check"),registrySources:Object.freeze([]),describe:"number must be 4 to 20 letters or digits"});function Xt(n){return typeof n=="string"&&/^\d{10}$/.test(n)&&Number(n)%97===1}t(Xt,"he");var en={trim:t(n=>n.trim(),"trim"),upper_single_space:t(n=>n.trim().toUpperCase().replace(/\s+/g," "),"upper_single_space"),upper_no_space_or_hyphen:ye},tn={mr_nni_mod97:t(n=>Xt(n),"mr_nni_mod97")};function nn(n){let i=new RegExp(n.pattern,"u"),p=n.check===null?void 0:tn[n.check];return Object.freeze({normalize:en[n.normalize],check:t(f=>i.test(f.trim())&&(p===void 0||p(f)),"check"),registrySources:Object.freeze([...n.registrySources]),describe:n.describe})}t(nn,"ge");var rn=Object.freeze(Object.fromEntries(Object.entries(nt).map(([n,i])=>[n,nn(i)])));function an(n,i){return rn[`${n.toUpperCase()}:${i}`]??(i==="drivers_license"?Qt:Yt)}t(an,"C");var ur=Object.freeze({JPN:"JP",MRT:"MR"});function cr(n){return an("MR","national_id").check(n)}t(cr,"Ae");function on(n){let i="";for(let p of n){let f=p.codePointAt(0)??0;f>=1632&&f<=1641?i+=String(f-1632):f>=1776&&f<=1785?i+=String(f-1776):p!==" "&&p!=="-"&&p!==" "&&(i+=p)}return i}t(on,"H");function dr(n){return on(n)}t(dr,"De");var pr=he,fr=dt;var sn=t(()=>import("./create-document-capture-SMEKDBGF-DISVYLXM.js"),"E");function ln(){sn().then(n=>n.warmDocumentCapture()).catch(()=>{})}t(ln,"D");function mr(){ln()}t(mr,"rt");var un=t(()=>import("./create-portrait-capture-5VGYZUOK-KTCFCHTN.js"),"O");function cn(){un().then(n=>n.warmPortraitCapture()).catch(()=>{})}t(cn,"I");function hr(){cn()}t(hr,"dt");export{Kt as a,Ht as b,zt as c,Wt as d,lr as e,cr as f,dr as g,pr as h,fr as i,mr as j,hr as k};