@sekyro/elements 0.1.0-rc.3 → 0.1.0-rc.31

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (142) hide show
  1. package/CHANGELOG.md +274 -0
  2. package/README.md +9 -10
  3. package/custom-elements.json +2 -2
  4. package/dist/cdn/chunks/barcode-detect-C5IOXMKI-ZOZ2WOWU.js +1 -0
  5. package/dist/cdn/chunks/{camera-trait-V4UAOPIQ-TFCPOCSU.js → camera-trait-DELAK3YN-4I2GHAFU.js} +1 -1
  6. package/dist/cdn/chunks/capture-session-doc-2JNGYSH6-GFUM3RZY.js +1 -0
  7. package/dist/cdn/chunks/challenge-frame-HTZ2ZBIE-5JRAFZOU.js +1 -0
  8. package/dist/cdn/chunks/chunk-37BKUH3E.js +1 -0
  9. package/dist/cdn/chunks/chunk-44UA2IDQ.js +1 -0
  10. package/dist/cdn/chunks/chunk-4MHDMYKP.js +1 -0
  11. package/dist/cdn/chunks/chunk-5AGMJYMI.js +1 -0
  12. package/dist/cdn/chunks/chunk-5OPKZZON.js +1 -0
  13. package/dist/cdn/chunks/{chunk-WPRIGJHG.js → chunk-5Y7NCFTK.js} +1 -1
  14. package/dist/cdn/chunks/chunk-6MYG4HWP.js +1 -0
  15. package/dist/cdn/chunks/chunk-6T7VBPLY.js +3 -0
  16. package/dist/cdn/chunks/chunk-7UCVVWRT.js +1 -0
  17. package/dist/cdn/chunks/{chunk-RKH7O2P5.js → chunk-7V3YMJPI.js} +1 -1
  18. package/dist/cdn/chunks/chunk-AKU6DWJM.js +1 -0
  19. package/dist/cdn/chunks/{chunk-5K4YQOZN.js → chunk-DO66BOHU.js} +1 -1
  20. package/dist/cdn/chunks/chunk-EB2QC3GA.js +25 -0
  21. package/dist/cdn/chunks/chunk-EGCT7K5E.js +1 -0
  22. package/dist/cdn/chunks/{chunk-H22YHQ6V.js → chunk-HTIKUYTU.js} +1 -1
  23. package/dist/cdn/chunks/chunk-JICBF2XL.js +1 -0
  24. package/dist/cdn/chunks/{chunk-FV4TIWHC.js → chunk-LBEHJATK.js} +1 -1
  25. package/dist/cdn/chunks/chunk-PND4F7JQ.js +1 -0
  26. package/dist/cdn/chunks/chunk-PRZX4CTP.js +33 -0
  27. package/dist/cdn/chunks/{chunk-QOZB3DLY.js → chunk-PWGUNXYH.js} +1 -1
  28. package/dist/cdn/chunks/chunk-SIBJ56BG.js +1 -0
  29. package/dist/cdn/chunks/chunk-SLLJX5QK.js +1 -0
  30. package/dist/cdn/chunks/{chunk-POHYEXNR.js → chunk-SOCYEC7N.js} +1 -1
  31. package/dist/cdn/chunks/{chunk-UNQ3QO4U.js → chunk-SYUAQ7BF.js} +1 -1
  32. package/dist/cdn/chunks/{chunk-UQKRYXN5.js → chunk-T5IBMUSY.js} +1 -1
  33. package/dist/cdn/chunks/chunk-V6PELUV7.js +1 -0
  34. package/dist/cdn/chunks/chunk-W5WWCOOW.js +1 -0
  35. package/dist/cdn/chunks/chunk-XKZZC74I.js +1 -0
  36. package/dist/cdn/chunks/{chunk-CXQO6QMQ.js → chunk-XVHJIXFH.js} +1 -1
  37. package/dist/cdn/chunks/{chunk-LA2MA2UQ.js → chunk-Y6MS7VVL.js} +1 -1
  38. package/dist/cdn/chunks/chunk-YZWLMKXA.js +1 -0
  39. package/dist/cdn/chunks/chunk-ZWGMVZWP.js +1 -0
  40. package/dist/cdn/chunks/create-document-capture-DNJSSCWA-M73L4ODE.js +1 -0
  41. package/dist/cdn/chunks/{create-portrait-capture-5VGYZUOK-N3333DJC.js → create-portrait-capture-3MHP4DGA-4XIQSUJ3.js} +1 -1
  42. package/dist/cdn/chunks/{detector-scanic-23DAYT3H-AJXQA7H4.js → detector-scanic-3VQFGZAA-NF7AFUUP.js} +1 -1
  43. package/dist/cdn/chunks/document-capture-view-RFBBBM3S-MO6WL377.js +1 -0
  44. package/dist/cdn/chunks/eid-view-XM5VHPPM-6KKXEHDA.js +1 -0
  45. package/dist/cdn/chunks/email-otp-view-RQV5WU3T-TP222TAL.js +1 -0
  46. package/dist/cdn/chunks/flow-views-GYVML5BT-MTJUSGHX.js +1 -0
  47. package/dist/cdn/chunks/form-view-Z7ODA3GO-2R5H32O2.js +1 -0
  48. package/dist/cdn/chunks/icons-form-R366YPMB-6C7SJPCB.js +1 -0
  49. package/dist/cdn/chunks/mrz-band-IH54XO42-AE4D3F2E.js +1 -0
  50. package/dist/cdn/chunks/overlay-de-ZQRK2WPD-YEE555KF.js +1 -0
  51. package/dist/cdn/chunks/overlay-es-XSQAIH32-DCYWAHRS.js +1 -0
  52. package/dist/cdn/chunks/overlay-pt-2LMQDJ4F-EWEOFJ27.js +1 -0
  53. package/dist/cdn/chunks/plan-runner-JXCJC5MM-BF6RMCBJ.js +1 -0
  54. package/dist/cdn/chunks/portrait-capture-view-ZBOXEM6H-LSOMBP5R.js +1 -0
  55. package/dist/cdn/chunks/{portrait-review-view-TBSABVSX-5SVU25AE.js → portrait-review-view-BWCMLEID-JA7RWO6C.js} +1 -1
  56. package/dist/cdn/chunks/print-DCYX3CZD-DLQCPZZE.js +11 -0
  57. package/dist/cdn/chunks/proof-of-address-view-LW5RYD5I-Q3UXH6YT.js +1 -0
  58. package/dist/cdn/chunks/reader-652D2CK6.js +2 -0
  59. package/dist/cdn/chunks/session-events-W5DRVA6F-BNHYAEHE.js +8 -0
  60. package/dist/cdn/chunks/session-watch-7HMFAHQI-WNCXXNDK.js +1 -0
  61. package/dist/cdn/define.js +1 -1
  62. package/dist/cdn/index.js +1 -1
  63. package/dist/{chunk-PNTIMH72.js → chunk-35LCXJCF.js} +1 -1
  64. package/dist/chunk-3DAPWPSR.js +1 -0
  65. package/dist/{chunk-2FHYNKUL.js → chunk-A5EHF3BR.js} +1 -1
  66. package/dist/chunk-BA2AJKJM.js +25 -0
  67. package/dist/{chunk-JUB6FRPB.js → chunk-CMJWPBX6.js} +1 -1
  68. package/dist/chunk-H7LR746C.js +33 -0
  69. package/dist/chunk-HBK2ROSI.js +1 -0
  70. package/dist/chunk-JGYTOIH7.js +1 -0
  71. package/dist/{chunk-YPBTBTOU.js → chunk-JREXIOVU.js} +1 -1
  72. package/dist/chunk-P223YKM3.js +1 -0
  73. package/dist/{chunk-JCCTKW23.js → chunk-QEDULGVW.js} +1 -1
  74. package/dist/{chunk-UXPM24JI.js → chunk-SVNDR2JE.js} +1 -1
  75. package/dist/{chunk-UZJG5SPC.js → chunk-W4G27O4B.js} +1 -1
  76. package/dist/chunk-WQIU4I3K.js +1 -0
  77. package/dist/chunk-XXCBLQ53.js +1 -0
  78. package/dist/{chunk-CFERAKA2.js → chunk-YHNEYMR2.js} +1 -1
  79. package/dist/{chunk-PMIO3U3J.js → chunk-YLWJXCPT.js} +1 -1
  80. package/dist/define.cjs +6 -6
  81. package/dist/define.js +1 -1
  82. package/dist/document-capture-view-RFBBBM3S-ZNPUP6QX.js +1 -0
  83. package/dist/{eid-view-FKFEF42L-ZXQWPIIA.js → eid-view-XM5VHPPM-XKR4NZTZ.js} +1 -1
  84. package/dist/{email-otp-view-NRZCAJJ4-RANTR7SO.js → email-otp-view-RQV5WU3T-JY72E4XM.js} +1 -1
  85. package/dist/flow-views-GYVML5BT-WVKFYYSN.js +1 -0
  86. package/dist/form-view-Z7ODA3GO-2ONECUO5.js +1 -0
  87. package/dist/icons-form-R366YPMB-KUTXHC7X.js +1 -0
  88. package/dist/index.cjs +6 -6
  89. package/dist/index.d.cts +182 -17
  90. package/dist/index.d.ts +182 -17
  91. package/dist/index.js +1 -1
  92. package/dist/overlay-de-ZQRK2WPD-FMRJWQQX.js +1 -0
  93. package/dist/overlay-es-XSQAIH32-VTIW3L6E.js +1 -0
  94. package/dist/overlay-pt-2LMQDJ4F-BB366XXI.js +1 -0
  95. package/dist/{portrait-capture-view-6KZGPAJU-LAGNB7A4.js → portrait-capture-view-ZBOXEM6H-PNCYH3WV.js} +1 -1
  96. package/dist/{portrait-review-view-TBSABVSX-MLNZZBL5.js → portrait-review-view-BWCMLEID-MAO4RY74.js} +1 -1
  97. package/dist/proof-of-address-view-LW5RYD5I-RDTH7FUR.js +1 -0
  98. package/dist/styles.css +174 -21
  99. package/package.json +3 -3
  100. package/sbom.cdx.json +4 -4
  101. package/dist/cdn/chunks/capture-session-doc-WZMI5XPE-AZDHR6MQ.js +0 -1
  102. package/dist/cdn/chunks/challenge-frame-NUGPTWFP-V3GGQN65.js +0 -1
  103. package/dist/cdn/chunks/chunk-2FETDQV5.js +0 -1
  104. package/dist/cdn/chunks/chunk-2T6RLTDQ.js +0 -1
  105. package/dist/cdn/chunks/chunk-434MMEWK.js +0 -1
  106. package/dist/cdn/chunks/chunk-6BRQUKUP.js +0 -1
  107. package/dist/cdn/chunks/chunk-7MV4CI4L.js +0 -1
  108. package/dist/cdn/chunks/chunk-CW56KMMH.js +0 -1
  109. package/dist/cdn/chunks/chunk-EWTKC2C2.js +0 -1
  110. package/dist/cdn/chunks/chunk-KVTY4E6J.js +0 -1
  111. package/dist/cdn/chunks/chunk-L22GFJQV.js +0 -1
  112. package/dist/cdn/chunks/chunk-MJEQ5ANO.js +0 -1
  113. package/dist/cdn/chunks/chunk-SGUCIULX.js +0 -3
  114. package/dist/cdn/chunks/chunk-SIPFHN7E.js +0 -25
  115. package/dist/cdn/chunks/chunk-TKJVGZWP.js +0 -33
  116. package/dist/cdn/chunks/chunk-YRTHQZAW.js +0 -1
  117. package/dist/cdn/chunks/chunk-ZMHEKDRM.js +0 -1
  118. package/dist/cdn/chunks/chunk-ZYZPLDA2.js +0 -1
  119. package/dist/cdn/chunks/create-document-capture-OXPLKHOF-GVCM77EK.js +0 -1
  120. package/dist/cdn/chunks/document-capture-view-UL3ISHNS-WZLR5RSQ.js +0 -1
  121. package/dist/cdn/chunks/eid-view-FKFEF42L-2OQYMKAB.js +0 -1
  122. package/dist/cdn/chunks/email-otp-view-NRZCAJJ4-BJNXOVUF.js +0 -1
  123. package/dist/cdn/chunks/flow-views-N7LBFI55-27RU7EZG.js +0 -1
  124. package/dist/cdn/chunks/mrz-band-VYHOTDHY-VEZ2J5IL.js +0 -1
  125. package/dist/cdn/chunks/overlay-de-KYSF3MDD-XORYFTYU.js +0 -1
  126. package/dist/cdn/chunks/overlay-es-36H5G6S5-22UFLFPZ.js +0 -1
  127. package/dist/cdn/chunks/overlay-pt-EB4UDBFE-CWJXQDCQ.js +0 -1
  128. package/dist/cdn/chunks/plan-runner-EP26JU6A-LU7KJ6JU.js +0 -1
  129. package/dist/cdn/chunks/portrait-capture-view-6KZGPAJU-2O54W4SR.js +0 -1
  130. package/dist/cdn/chunks/print-SEWS3VHQ-HWJTHADG.js +0 -11
  131. package/dist/cdn/chunks/proof-of-address-view-3GG3XEQK-CPQ2AQEQ.js +0 -1
  132. package/dist/chunk-A75VY7L7.js +0 -1
  133. package/dist/chunk-APM7FCA2.js +0 -25
  134. package/dist/chunk-LYFBZCIH.js +0 -33
  135. package/dist/chunk-WBXQX6DQ.js +0 -1
  136. package/dist/chunk-YZ6YGLNN.js +0 -1
  137. package/dist/document-capture-view-UL3ISHNS-K636D7VR.js +0 -1
  138. package/dist/flow-views-N7LBFI55-DZ3PH2EP.js +0 -1
  139. package/dist/overlay-de-KYSF3MDD-2ZNXM2N7.js +0 -1
  140. package/dist/overlay-es-36H5G6S5-VQWD57TO.js +0 -1
  141. package/dist/overlay-pt-EB4UDBFE-6VWPTFO2.js +0 -1
  142. package/dist/proof-of-address-view-3GG3XEQK-FWM7OQ4K.js +0 -1
@@ -0,0 +1 @@
1
+ import{g as X}from"./chunk-6T7VBPLY.js";import{a as z,b as ee}from"./chunk-EB2QC3GA.js";import{a as n}from"./chunk-5QL6W6FW.js";import{a,c as Z}from"./chunk-4FHWXBOB.js";var u=Z(z(),1),J=Z(z(),1),s=Z(ee(),1);var h=Z(ee(),1);var he="AC247 AD376 AE971/0 AF93/0 AG1/1 AI1/1 AL355/0 AM374/0 AO244 AR54/0 AS1/1 AT43/0 AU61/0 AW297 AX358/0 AZ994/0 BA387/0 BB1/1 BD880/0 BE32/0 BF226 BG359/0 BH973 BI257 BJ229 BL590/0 BM1/1 BN673 BO591/0 BQ599 BR55/0 BS1/1 BT975 BW267 BY375/8 BZ501 CA1/1 CC61/0 CD243/0 CF236 CG242 CH41/0 CI225 CK682 CL56 CM237 CN86/0 CO57/0 CR506 CU53/0 CV238 CW599 CX61/0 CY357 CZ420 DE49/0 DJ253 DK45 DM1/1 DO1/1 DZ213/0 EC593/0 EE372 EG20/0 EH212/0 ER291/0 ES34 ET251/0 FI358/0 FJ679 FK500 FM691 FO298 FR33/0 GA241 GB44/0 GD1/1 GE995/0 GF594/0 GG44/0 GH233/0 GI350 GL299 GM220 GN224 GP590/0 GQ240 GR30 GT502 GU1/1 GW245 GY592 HK852 HN504 HR385/0 HT509 HU36/06 ID62/0 IE353/0 IL972/0 IM44/0 IN91/0 IO246 IQ964/0 IR98/0 IS354 IT39 JE44/0 JM1/1 JO962/0 JP81/0 KE254/0 KG996/0 KH855/0 KI686/0 KM269 KN1/1 KP850/0 KR82/0 KW965 KY1/1 KZ7/8 LA856/0 LB961/0 LC1/1 LI423/0 LK94/0 LR231/0 LS266 LT370/0 LU352 LV371 LY218/0 MA212/0 MC377/0 MD373/0 ME382/0 MF590/0 MG261/0 MH692/1 MK389/0 ML223 MM95/0 MN976/0 MO853 MP1/1 MQ596/0 MR222 MS1/1 MT356 MU230 MV960 MW265/0 MX52 MY60/0 MZ258 NA264/0 NC687 NE227 NF672 NG234/0 NI505 NL31/0 NO47 NP977/0 NR674 NU683 NZ64/0 OM968 PA507 PE51/0 PF689 PG675 PH63/0 PK92/0 PL48 PM508/0 PR1/1 PS970/0 PT351 PW680 PY595/0 QA974 RE262/0 RO40/0 RS381/0 RU7/8 RW250/0 SA966/0 SB677 SC248 SD249/0 SE46/0 SG65 SH290 SI386/0 SJ47 SK421/0 SL232/0 SM378 SN221 SO252/0 SR597 SS211/0 ST239 SV503 SX1/1 SY963/0 SZ268 TA290 TC1/1 TD235 TG228 TH66/0 TJ992 TK690 TL670 TM993/8 TN216 TO676 TR90/0 TT1/1 TV688 TW886/0 TZ255/0 UA380/0 UG256/0 US1/1 UY598/0 UZ998 VA39 VC1/1 VE58/0 VG1/1 VI1/1 VN84/0 VU678 WF681 WS685 XK383/0 YE967/0 YT262/0 ZA27/0 ZM260/0 ZW263/0",j;function Q(e){return j??(j=new Map(he.split(" ").map(l=>{let[r,t]=l.slice(2).split("/");return[l.slice(0,2),[r,t]]}))),j.get(e.toUpperCase())}a(Q,"z");n(Q,"entryOf");function pe(e){return Q(e)?.[0]}a(pe,"Ne");n(pe,"dialCodeOf");function ne(e){return Q(e)?.[1]}a(ne,"ee");n(ne,"nationalPrefixOf");var le=n(e=>e.normalize("NFD").replace(/\p{Diacritic}/gu,"").toLocaleLowerCase(),"fold");function ae(e,l){let r=le(l.trim());return r===""?e:e.filter(t=>le(t.name).includes(r)||t.code.toLowerCase()===r)}a(ae,"ce");n(ae,"matchCountries");function oe({countries:e,label:l,searchPlaceholder:r,noMatch:t,onPick:v,selected:P,searchRef:f,scroll:E=!1,searchable:w=!0,detail:D,extra:y}){let[M,b]=(0,J.useState)(""),c=(0,J.useId)(),T=ae(e,M),N=(0,s.jsxs)("ul",{className:`sekyro-rows${E?" sekyro-rows--scroll":""}`,children:[T.map(d=>{let S=D?.(d.code);return(0,s.jsx)("li",{children:(0,s.jsxs)("button",{type:"button",className:"sekyro-row-btn","aria-current":P===d.code||void 0,onClick:a(()=>v(d.code),"onClick"),children:[(0,s.jsx)("span",{className:"sekyro-row-btn__flag","aria-hidden":"true",children:ce(d.code)}),(0,s.jsx)("span",{className:"sekyro-row-btn__name",children:d.name}),S!==void 0?(0,s.jsx)("bdi",{className:"sekyro-row-btn__detail",dir:"ltr",children:S}):null]})},d.code)}),y!==void 0?(0,s.jsx)("li",{children:(0,s.jsxs)("button",{type:"button",className:"sekyro-row-btn","aria-current":y.current||void 0,onClick:y.onPick,children:[(0,s.jsx)("span",{className:"sekyro-row-btn__flag","aria-hidden":"true",children:"🌐"}),(0,s.jsx)("span",{className:"sekyro-row-btn__name",children:y.label})]})}):null]});return w?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)("div",{className:"sekyro-field",children:[(0,s.jsx)("label",{className:"sekyro-label",htmlFor:c,children:l}),(0,s.jsx)("input",{ref:f,id:c,type:"search",className:"sekyro-input",placeholder:r,value:M,onChange:a(d=>b(d.target.value),"onChange")})]}),T.length===0&&y===void 0?(0,s.jsx)("p",{className:"sekyro-text-muted",children:t}):N]}):N}a(oe,"te");n(oe,"CountryList");function U(e){let l=X(e).replace(/\D/g,"");return/^\D*\+/.test(e)?`+${l}`:l.startsWith("00")?`+${l.slice(2)}`:l}a(U,"H");n(U,"digitsOf");var te=n((e,l)=>(l.trunk!==void 0&&e.startsWith(l.trunk)?e.slice(l.trunk.length):e).slice(0,Math.max(...l.lengths)),"fitDigits");function Y(e,l){let r="",t=0;for(let v of l?.formats?.find(P=>new RegExp(`^(?:${P.leading})`).test(e))?.groups??[])t<e.length&&(r+=(t>0?" ":"")+e.slice(t,t+v)),t+=v;return r+e.slice(t)}a(Y,"Z");n(Y,"groupDigits");function ie(e,l){let r=0;for(let t=l;t>0&&r<e.length;r+=1)e[r]!==" "&&(t-=1);return r}a(ie,"oe");n(ie,"caretAfter");var se=n((e,l)=>l.find(r=>e.startsWith(r.dial)),"countryOfNumber"),me=n((e,l)=>e.lengths.join(", ").replace(/, (\d+)$/,` ${l} $1`),"lengthsLabel");function q(e){let l=U(e).replace("+","");return/^\d{8,15}$/.test(l)?`+${l}`:null}a(q,"le");n(q,"normalizedPhone");var ce=n(e=>String.fromCodePoint(...Array.from(e.toUpperCase(),l=>127397+l.charCodeAt(0))),"flagOf");function de(e,l){if(l===null||!e.startsWith(l.dial))return q(e);let r=e.slice(l.dial.length).replace(/\D/g,""),t=ne(l.code);return t!==void 0&&r.startsWith(t)&&(r=r.slice(t.length)),q(l.dial+r)}a(de,"ye");n(de,"e164Of");var re=n((e,l)=>(se(e,l)??l[0])?.code??null,"countryFor");function ue(e){let l=null;try{l=new Intl.DisplayNames([e],{type:"region"})}catch{}return r=>`${l?.of(r.code)??r.code} (${r.dial})`}a(ue,"me");n(ue,"countryLabels");var fe="other",ye=8;function ge({countries:e,international:l,closed:r,defaultPhone:t}){let[v,P]=(0,u.useState)(()=>re(t,e)),[f,E]=(0,u.useState)(t),[w,D]=(0,u.useState)(!1),[y,M]=(0,u.useState)(!1),b=e.map(o=>o.code).join(","),c=e.find(o=>o.code===v)??null,T=(0,u.useRef)(c);c!==null&&(T.current=c),(0,u.useEffect)(()=>{if(v===null||!e.some(o=>o.code===v)){let o=re(t,e);P(o);let i=T.current,k=e.find(C=>C.code===o)?.dial;k!==void 0&&E(C=>i!==null&&C.startsWith(i.dial)?k+C.slice(i.dial.length):C.startsWith("+")?C:k)}},[b,t]);let N=w||c===null,d=N||f.startsWith("+")&&!f.startsWith(c.dial),S=d?void 0:c.rule,x=d?f:f.replace(c.dial,"").replace(/\D/g,""),p=S?te(x,S):x,W=d&&!N&&!l&&r&&!e.some(o=>o.dial.startsWith(f)),I=W?null:S?S.lengths.includes(p.length)?c.dial+p:null:N&&!f.startsWith("+")?null:de(f,w?null:c),H=d||c===null?I??f:`${c.dial} ${Y(p,S)}`,B=d?U(f).replace("+","")==="":p==="";return{countries:e,international:l,phone:f,selected:c,other:w,whole:d,free:N,rule:S,national:p,refused:W,typed:I,shown:H,empty:B,lengthShown:y,setLengthShown:M,onNumber:n(o=>{let i=o.target,k=o.nativeEvent.inputType,C=Math.max(0,i.value.lastIndexOf("+")),G=U(i.value.slice(C)),A=se(G,e),_=U(i.value.slice(C,i.selectionStart)).length,F=G,V=G;if(M(!1),!A&&(N||G.startsWith("+")))l&&D(!0);else{let R=A??c,g=A?G.slice(A.dial.length):G;if(P(R.code),D(!1),g===p&&k?.startsWith("delete")&&(k.endsWith("Forward")||(_-=1),g=g.slice(0,_)+g.slice(_+1)),R.rule){let $=te(g,R.rule),O=g.length-$.length;_-=O,g=O>0&&!A&&p.length===$.length?p:$}V=R.dial+g,F=Y(g,R.rule)}E(V),i.value=F;let K=ie(F,_);i.setSelectionRange(K,K)},"onNumber"),onCountry:n(o=>{M(!1);let i=e.find(k=>k.code===o);D(i===void 0),i!==void 0&&P(i.code),E(i===void 0?"":i.dial+(d?"":p))},"onCountry")}}a(ge,"_e");n(ge,"usePhoneField");function Ne({field:e,id:l,locale:r,t,inputRef:v,invalid:P=!1,describedby:f,required:E,compact:w=!1,ready:D}){let{selected:y,whole:M,other:b,free:c,national:T,rule:N,phone:d,refused:S,typed:x,countries:p,international:W}=e,[I,H]=(0,u.useState)(!1),B=(0,u.useRef)(null),o=(0,u.useRef)(null),i=(0,u.useRef)(null),k=(0,u.useRef)(null),C=v??k,G=(0,u.useId)(),A=S?t("otp.reason_otp_destination_not_allowed"):e.lengthShown&&N?t("otp.phoneLengthError",{digits:me(N,t("otp.or"))}):"",_=p.length>1||W,F=ue(r),V=(0,u.useMemo)(()=>{let m=null;try{m=new Intl.DisplayNames([r],{type:"region"})}catch{}return p.map(L=>({code:L.code,name:m?.of(L.code)??L.code}))},[p,r]),K=p.length>ye,R=[M?"":`${l}-dial ${l}-hint`,A?`${l}-error`:"",f??""].join(" ").trim()||void 0,g=n(m=>{H(!1),requestAnimationFrame(()=>(m==="lead"?B.current:C.current)?.focus())},"close"),$=n(()=>{if(I)return g("lead");H(!0),requestAnimationFrame(()=>(i.current??o.current?.querySelector('[aria-current="true"]')??o.current?.querySelector("button"))?.focus())},"toggle"),O=n(()=>(0,h.jsxs)("span",{className:"sekyro-phone__dial",id:`${l}-dial`,"aria-hidden":_||void 0,children:[(0,h.jsx)("span",{className:"sekyro-phone__flag","aria-hidden":"true",children:b?"🌐":ce(y.code)}),b?null:y.dial]}),"dial");return(0,h.jsxs)(h.Fragment,{children:[(0,h.jsxs)("div",{className:`sekyro-phone${w?" sekyro-phone--compact":""}`,dir:"ltr",children:[y===null||M&&!b?null:_?(0,h.jsx)("button",{ref:B,type:"button",className:"sekyro-phone__lead sekyro-phone__pick","aria-label":`${t("otp.countryLabel")}: ${b?t("otp.otherCountry"):F(y)}`,"aria-expanded":I,"aria-controls":I?G:void 0,onClick:$,children:O()}):(0,h.jsx)("div",{className:"sekyro-phone__lead",children:O()}),(0,h.jsx)("input",{ref:C,id:l,className:"sekyro-phone__input",type:"tel",dir:"ltr",inputMode:"tel",autoComplete:"tel",required:E,"aria-describedby":R,"aria-invalid":!!A||P||void 0,placeholder:c?"+":void 0,value:M?d:Y(T,N),onChange:e.onNumber,onKeyDown:a(m=>{m.key==="Enter"&&D===!1&&e.setLengthShown(!0)},"onKeyDown"),onBlur:a(m=>{let L=m.relatedTarget;L!==null&&(B.current?.contains(L)||o.current?.contains(L))||e.setLengthShown(T!==""&&x===null)},"onBlur")})]}),I?(0,h.jsx)("div",{ref:o,id:G,className:"sekyro-phone__list",onKeyDown:a(m=>{m.key==="Escape"&&(m.preventDefault(),g("lead"))},"onKeyDown"),children:(0,h.jsx)(oe,{countries:V,label:(0,h.jsx)("span",{className:"sekyro-visually-hidden",children:t("otp.countrySearch")}),searchPlaceholder:t("otp.countrySearch"),noMatch:t("doc.noCountryMatch"),searchable:K,scroll:!0,...K?{searchRef:i}:{},...!b&&y!==null?{selected:y.code}:{},detail:a(m=>p.find(L=>L.code===m)?.dial,"detail"),onPick:a(m=>{e.onCountry(m),g("number")},"onPick"),...W?{extra:{label:t("otp.otherCountry"),current:b,onPick:n(()=>{e.onCountry(fe),g("number")},"onPick")}}:{}})}):null,M?null:(0,h.jsx)("span",{className:"sekyro-help",id:`${l}-hint`,children:t("otp.phonePlaceholderGeneric")}),A?(0,h.jsx)("span",{className:"sekyro-help is-danger",id:`${l}-error`,role:"alert",children:A}):null]})}a(Ne,"xe");n(Ne,"PhoneField");export{pe as a,oe as b,ce as c,ge as d,Ne as e};
@@ -0,0 +1 @@
1
+ import{b as Mr,d as Ar}from"./chunk-SYUAQ7BF.js";import{a as Ir}from"./chunk-AKU6DWJM.js";import{b as Lr,c as Nt}from"./chunk-DO66BOHU.js";import{d as _t}from"./chunk-6T7VBPLY.js";import{c as at}from"./chunk-ZWGMVZWP.js";import{a as xr,b as Rr,c as Nr,d as Ee}from"./chunk-PWGUNXYH.js";import{F as Er,K as xt,L as Rt,a as W,b as de,c as Y,m as Cr,n as Fe,p as _r,q as nt,r as wr,s as Sr,t as wt,u as le,v as me,w as $e,y as St}from"./chunk-EB2QC3GA.js";import{a}from"./chunk-5QL6W6FW.js";import{c as gr,d as vr,e as kr,h as br}from"./chunk-5OPKZZON.js";import{b as Ct}from"./chunk-EGCT7K5E.js";import{g as yr}from"./chunk-6MYG4HWP.js";import{a as l,c as T}from"./chunk-4FHWXBOB.js";var jr=T(W(),1),g=T(de(),1),ne=T(de(),1),ve=T(W(),1),K=T(de(),1),_=T(W(),1),y=T(W(),1),ot=T(W(),1),ye=T(de(),1),nn=T(W(),1),ee=T(W(),1),ct=T(W(),1),Se=T(de(),1),xe=T(de(),1),P=T(de(),1);var ut=T(W(),1),pe=T(W(),1);var J=T(W(),1);var L=T(W(),1),ge=T(W(),1),He=T(W(),1),Ut=T(de(),1),k=T(de(),1);function ce({className:e,children:t}){return(0,g.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(ce,"ne");a(ce,"Svg");var jt="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 Tr(e){return(0,g.jsxs)(ce,{...e,children:[(0,g.jsx)("circle",{cx:"12",cy:"12",r:"4"}),(0,g.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(Tr,"pn");a(Tr,"SunIcon");function Hr(e){return(0,g.jsxs)(ce,{...e,children:[(0,g.jsx)("circle",{cx:"12",cy:"12",r:"9"}),(0,g.jsx)("path",{d:"M9 10h.01M15 10h.01M8.8 14.6a4.2 4.2 0 0 0 6.4 0"})]})}l(Hr,"fn");a(Hr,"FaceUncoveredIcon");function Or(e){return(0,g.jsxs)(ce,{...e,children:[(0,g.jsx)("rect",{x:"7",y:"2.5",width:"10",height:"19",rx:"2"}),(0,g.jsx)("path",{d:"M10.5 18.5h3M2.5 9.5h2.5M19 9.5h2.5"}),(0,g.jsx)("circle",{cx:"12",cy:"9.5",r:"1.6"})]})}l(Or,"mn");a(Or,"PhoneEyeLevelIcon");function Pr(e){return(0,g.jsxs)(ce,{...e,children:[(0,g.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,g.jsx)("circle",{cx:"12",cy:"12",r:"2.8"})]})}l(Pr,"yn");a(Pr,"LookStraightIcon");function Br(e){return(0,g.jsxs)(ce,{...e,children:[(0,g.jsx)("path",{d:jt}),(0,g.jsx)("path",{d:"M9 13l2 2 4-4"})]})}l(Br,"gn");a(Br,"CameraCheckIcon");function qr(e){return(0,g.jsxs)(ce,{...e,children:[(0,g.jsx)("path",{d:jt}),(0,g.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(qr,"hn");a(qr,"CameraAskIcon");function Vr(e){return(0,g.jsxs)(ce,{...e,children:[(0,g.jsx)("path",{d:jt}),(0,g.jsx)("path",{d:"M3 3l18 18"})]})}l(Vr,"vn");a(Vr,"CameraBlockedIcon");function it({off:e,className:t}){return(0,g.jsxs)(ce,{className:t,children:[(0,g.jsx)("path",{d:"M4.5 9.5v5H8l4 3.5v-12L8 9.5H4.5Z"}),e?(0,g.jsx)("path",{d:"M4 4l16 16"}):(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)("path",{d:"M15.5 9.7a3.6 3.6 0 0 1 0 4.6"}),(0,g.jsx)("path",{d:"M18 7.6a6.6 6.6 0 0 1 0 8.8"})]})]})}l(it,"Ve");a(it,"SpeakerIcon");function Dr(e){return(0,g.jsx)(ce,{...e,children:(0,g.jsx)("path",{d:"M5 12.5l4.5 4.5L19 7.5"})})}l(Dr,"Cn");a(Dr,"CheckIcon");function Fr(e){return(0,g.jsxs)(ce,{className:e.className??"sekyro-spinner",children:[(0,g.jsx)("circle",{cx:"12",cy:"12",r:"9",opacity:"0.25"}),(0,g.jsx)("path",{d:"M21 12a9 9 0 0 0-9-9"})]})}l(Fr,"kn");a(Fr,"SpinnerIcon");var Mt=["light","uncover","eyeLevel","straight"],qn={light:{key:"capture.tips.light",icon:a(()=>(0,ne.jsx)(Tr,{}),"icon")},uncover:{key:"capture.tips.uncover",icon:a(()=>(0,ne.jsx)(Hr,{}),"icon")},eyeLevel:{key:"capture.tips.eyeLevel",icon:a(()=>(0,ne.jsx)(Or,{}),"icon")},straight:{key:"capture.tips.straight",icon:a(()=>(0,ne.jsx)(Pr,{}),"icon")}};function $r({tips:e}){let t=Ee(),n=(0,jr.useId)();return e.length===0?null:(0,ne.jsxs)("section",{className:"sekyro-tips","aria-labelledby":n,"data-testid":"sekyro-tips",children:[(0,ne.jsx)("p",{className:"sekyro-tips__title",id:n,children:t("capture.tips.title")}),(0,ne.jsx)("ul",{className:"sekyro-tips__list",children:e.map(r=>{let s=typeof r=="string"?qn[r]:void 0,i=typeof r=="string"?r:r.id,c=s!==void 0?s.icon():typeof r=="string"?void 0:r.icon,p=s!==void 0?t(s.key):typeof r=="string"?r:r.text;return(0,ne.jsxs)("li",{className:"sekyro-tips__item",children:[c!=null?(0,ne.jsx)("span",{className:"sekyro-tips__icon","aria-hidden":"true",children:c}):null,(0,ne.jsx)("span",{children:p})]},i)})})]})}l($r,"Sn");a($r,"TipList");var Vn=220;function Kr({title:e,description:t,options:n,busy:r,error:s,focus:i,testId:c,look:p="cards",marked:w,onChoose:h}){let m=(0,ve.useId)(),R=wt(),[x,U]=(0,ve.useState)(null),M=(0,ve.useRef)(null);(0,ve.useEffect)(()=>{s!==null&&U(null)},[s]),(0,ve.useEffect)(()=>()=>{M.current!==null&&clearTimeout(M.current)},[]);let B=a(A=>{r||x!==null||(U(A),M.current=setTimeout(()=>{M.current=null,U(null),h(A)},Vn))},"choose");return(0,K.jsxs)("section",{className:"sekyro-stack sekyro-stack--4 sekyro-choice","aria-labelledby":m,"data-testid":c,children:[(0,K.jsxs)("div",{className:p==="cards"?"sekyro-heading":"sekyro-stack sekyro-stack--1",children:[(0,K.jsx)("h2",{id:m,ref:i?R:void 0,tabIndex:-1,className:"sekyro-text-body",children:e}),t!==void 0&&t!==""?(0,K.jsx)("p",{className:"sekyro-text-muted",children:t}):null]}),s!==null?(0,K.jsx)(le,{tone:"danger",children:(0,K.jsx)("span",{children:s})}):null,p==="buttons"?(0,K.jsx)("div",{className:"sekyro-stack sekyro-stack--3",children:n.map((A,te)=>(0,K.jsx)(Y,{kind:te===0?"primary":"ghost",full:!0,disabled:r,"aria-busy":r||void 0,onClick:l(()=>h(A.id),"onClick"),children:A.label},A.id))}):(0,K.jsx)("div",{className:"sekyro-choices",children:n.map(A=>(0,K.jsxs)("button",{type:"button",className:"sekyro-card","aria-pressed":(x??w)===A.id,"aria-busy":r||void 0,disabled:r||x!==null&&x!==A.id,onClick:l(()=>B(A.id),"onClick"),children:[A.glyph!==void 0?(0,K.jsx)("span",{className:"sekyro-card__tile",children:A.glyph}):null,(0,K.jsxs)("span",{className:"sekyro-card__body",children:[(0,K.jsx)("span",{className:"sekyro-card__title",children:A.label}),A.sub!==void 0?(0,K.jsx)("span",{className:"sekyro-card__sub",children:A.sub}):null]}),(0,K.jsx)("span",{className:"sekyro-radio","aria-hidden":"true"})]},A.id))})]})}l(Kr,"Vn");a(Kr,"ChoiceScreen");var Gr=["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 lt(e){return e!==null&&Gr.includes(e)}l(lt,"he");a(lt,"isVoiceKey");var Dn=a((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 s=e[n];r=s!=null&&Dn(s,t)?s[t]:null}}catch{return null}return typeof r=="string"&&r!==""?r:null}l(je,"we");a(je,"resolveClip");var Fn="UklGRiQAAABXQVZFZm10IBAAAAABAAEAESsAACJWAAACABAAZGF0YQAAAAA=",$n={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");a(oe,"synth");function zr(){return oe()!==null&&typeof SpeechSynthesisUtterance=="function"}l(zr,"Ir");a(zr,"speechAvailable");function At(e){return(e.split(/[-_]/)[0]??e).toLowerCase()}l(At,"wn");a(At,"baseLang");function Tt(e,t){let n=a(s=>s.replace(/_/g,"-").toLowerCase(),"norm"),r=At(t);return e.find(s=>n(s.lang)===n(t))??e.find(s=>At(s.lang)===r)}l(Tt,"_n");a(Tt,"pickVoice");function Wr(e){if(!zr())return!1;let t=[];try{t=oe()?.getVoices()??[]}catch{return!0}return t.length===0||Tt(t,e)!==void 0}l(Wr,"In");a(Wr,"speechUsable");function Zr(e){let t=oe();return t===null||typeof t.addEventListener!="function"?()=>{}:(t.addEventListener("voiceschanged",e),()=>t.removeEventListener?.("voiceschanged",e))}l(Zr,"xn");a(Zr,"subscribeVoices");function Ge(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(Ge,"He");a(Ge,"clipIdentity");function Et(e){e.pause(),e.removeAttribute("src"),e.load()}l(Et,"Mn");a(Et,"release");function Qr(){let e=null,t=null,n=0,r=null,s=null,i=null,c=!1,p=null,w=[],h=new Map,m=a(()=>{w=oe()?.getVoices()??[]},"loadVoices"),R=!1,x=a(()=>{let f=oe();R||f===null||(R=!0,m(),f.addEventListener?.("voiceschanged",m))},"bindVoices"),U=a(()=>(e??(e=new Audio),e),"element"),M=a((f,N,S,b)=>{let u=oe();if(u!==null&&f!==""&&typeof SpeechSynthesisUtterance=="function"){x();let E=Tt(w,N);if(w.length===0||E!==void 0){u.cancel();let j=new SpeechSynthesisUtterance(f);j.lang=N,E!==void 0&&(j.voice=E),j.rate=.95,S!==void 0&&(j.onend=S),(S!==void 0||b!==void 0)&&(j.onerror=D=>{b!==void 0&&D.error==="not-allowed"?b():S?.()}),u.speak(j);return}}S?.()},"speak"),B=a(()=>{n+=1,r=null,s=i=null,e!==null&&(e.pause(),e.currentTime=0),oe()?.cancel()},"stop"),A=a(f=>{for(let N of f){let S=Ge(N);if(h.has(S))continue;let b=new Audio;b.preload="auto",b.src=N,h.set(S,b)}},"warmClips"),te=a((f,N,S)=>{let b={utterance:f,generation:N,end:S};p=b;let u=a(()=>N===n&&p===b,"live"),E=a(()=>{u()&&(s=b)},"block");if(oe()?.cancel(),f.url!==null){let j=U();j.pause(),j.muted=!1,j.src=f.url,j.currentTime=0,j.onended=S??null;let D=a(()=>{i===b&&(i=null)},"settled"),o=j.play();if(o===void 0)return;i=b,o.then(D,H=>{if(D(),!u())return;let O=H?.name;if(O!=="AbortError"){if(O==="NotAllowedError")return E();f.speech?M(f.text,f.lang,S,E):S?.()}});return}f.speech?M(f.text,f.lang,S,E):S?.()},"start");return{say(f){let N=f.url!==null?Ge(f.url):`tts:${f.lang}:${f.text}`;if(N===r)return;r=N,s=i=null,n+=1;let S=n,b=f.onEnd;te(f,S,b!==void 0?()=>{S===n&&b()}:void 0)},unlock({lang:f,speech:N,prefetch:S}){let b=s??(c?null:i);c=!0;let u=b!==null&&b.generation===n?b:null;s=i=null,u!==null&&te(u.utterance,u.generation,u.end);let E=U();if(t===null&&typeof Blob=="function"&&typeof URL.createObjectURL=="function"){let H=Uint8Array.from(atob(Fn),O=>O.charCodeAt(0));t=URL.createObjectURL(new Blob([H],{type:"audio/wav"}))}let j=E.paused===!1&&t!==null&&E.src!==t;t!==null&&!j&&(u===null||u.utterance.url===null)&&(E.muted=!0,E.onended=null,E.src=t,E.play()?.catch(()=>{}));let D=oe(),o=u!==null&&u.utterance.url===null;if(N&&!o&&D!==null&&typeof SpeechSynthesisUtterance=="function"){x();let H=new SpeechSynthesisUtterance(" ");H.volume=0,H.lang=f,D.speak(H)}A(S??[])},prefetch:A,stop:B,dispose(){B(),R&&oe()?.removeEventListener?.("voiceschanged",m),R=!1,t!==null&&URL.revokeObjectURL(t),t=null,e!==null&&Et(e),e=null;for(let f of h.values())Et(f);h.clear()}}}l(Qr,"En");a(Qr,"createVoicePlayer");var Kn="sekyro.voiceGuidance";function Xr(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(Xr,"Nn");a(Xr,"readVoicePreference");function Yr(e,t){try{if(typeof window>"u")return;window.localStorage.setItem(e,t?"1":"0")}catch{}}l(Yr,"Pn");a(Yr,"writeVoicePreference");var Ke="capture.tips.summary",Gn=typeof window<"u"?_.useLayoutEffect:_.useEffect,zn=Object.freeze({});function st(e,t){let n=new Set,r=[];for(let s of Gr){let i=s===Ke?null:je(e,s,t);i===null||n.has(Ge(i))||(n.add(Ge(i)),r.push(i))}return r}l(st,"vt");a(st,"resolvedClipUrls");function Jr({locale:e,defaultClips:t,options:n}){let r=n===!1,s=r?{}:n??{},i=s.storageKey===void 0?Kn:s.storageKey,[c,p]=(0,_.useState)(s.defaultEnabled??!0),w=(0,_.useRef)(c),[h,m]=(0,_.useState)(!1),[R,x]=(0,_.useState)("none"),[U,M]=(0,_.useState)(!1),B=(0,_.useRef)(!1),[A,te]=(0,_.useState)(0),f=(0,_.useRef)(null),N=(0,_.useCallback)(()=>(f.current??(f.current=Qr()),f.current),[]),S=$n[e],b=s.speechFallback,u=b===void 0||b===!0?!0:b===!1?!1:b.includes(e),E=s.clips??t??zn,j=(0,_.useRef)(!1),D=(0,_.useRef)(E);Gn(()=>{D.current=E,w.current=c}),(0,_.useEffect)(()=>{if(r||i===null)return;let I=Xr(i);I!==null&&(w.current=I,p(I))},[r,i]),(0,_.useEffect)(()=>{if(!(r||!u))return Zr(()=>te(I=>I+1))},[r,u]);let o=s.clips;(0,_.useEffect)(()=>{if(r)return;let I=u&&Wr(S);m(st(E,e).length>0||I),x(o!==void 0&&je(o,Ke,e)!==null?"partner":je(E,Ke,e)!==null||I?"default":"none")},[r,E,o,e,u,S,A]),(0,_.useEffect)(()=>{if(r||!c||!j.current)return;let I=st(E,e);I.length>0&&N().prefetch(I)},[r,c,E,e,N]),(0,_.useEffect)(()=>()=>{f.current?.dispose(),f.current=null,j.current=!1},[]);let H=(0,_.useCallback)(I=>{r||(j.current=!0,N().unlock({lang:S,speech:u,...I?{prefetch:st(D.current,e)}:{}}))},[r,N,S,u,e]),O=(0,_.useCallback)(()=>H(w.current),[H]),Z=(0,_.useCallback)(()=>{B.current=!1,M(!1)},[]),F=(0,_.useCallback)(()=>{Z(),f.current?.stop()},[Z]),ke=(0,_.useCallback)(()=>{B.current&&F()},[F]),he=(0,_.useCallback)((I,Re)=>{if(r)return;if(B.current){F();return}let be=N();be.stop(),B.current=!0,M(!0);let q=Re?.clip===!1?null:je(D.current,Ke,e);be.say({url:q,text:I,lang:S,speech:u,onEnd:Z})},[r,F,N,e,S,u,Z]),Q=(0,_.useCallback)(I=>{r||(I?H(!0):F(),i!==null&&Yr(i,I),w.current=I,p(I))},[r,H,F,i]),X=(0,_.useCallback)(()=>Q(!w.current),[Q]),ae=(0,_.useCallback)((I,Re)=>{if(r||!c)return;B.current&&Z();let be=je(D.current,I,e);N().say({url:be,text:Re,lang:S,speech:u})},[r,c,e,N,S,u,Z]);return(0,_.useMemo)(()=>({supported:!r&&h,enabled:!r&&c,setEnabled:Q,toggle:X,unlock:O,speakKey:ae,stop:F,summary:r?"none":R,summaryPlaying:U,toggleSummary:he,stopSummary:ke}),[r,h,c,Q,X,O,ae,F,R,U,he,ke])}l(Jr,"Ct");a(Jr,"useVoiceGuidance");function en(e,t,n,r){let{speakKey:s,stop:i,enabled:c}=e,p=(0,_.useRef)(!1);(0,_.useEffect)(()=>{if(!r||!c){p.current&&i(),p.current=!1;return}p.current=!0,lt(t)&&t!==Ke&&n!==""&&s(t,n)},[r,c,t,n,s,i])}l(en,"kt");a(en,"useSpeakGuidance");function ze(e,t){let n=tn(e);return n==="face"&&(t==="lighting"||e==="liveness_inconclusive")?"again":n}l(ze,"On");a(ze,"retryCoachingOf");function tn(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(tn,"Kr");a(tn,"coachingOfReason");var Te={face:{title:"capture.retryCoaching.title",tips:["capture.retryCoaching.light","capture.retryCoaching.eyeLevel","capture.retryCoaching.head"]},again:{title:"capture.retryTips.title",tips:["capture.retryCoaching.eyeLevel","capture.retryCoaching.head"]},one_face:{title:"capture.retryTips.title",tips:["capture.retryOneFace.alone","capture.retryOneFace.screens"]},front_camera:{title:"capture.retryTips.title",tips:["capture.retryFrontCamera.screenSide"]},back_camera:{title:"capture.retryTips.title",tips:["capture.retryBackCamera.backSide","capture.retryBackCamera.circle"]},upright:{title:"capture.retryTips.title",tips:["capture.retryUpright.vertical","capture.retryUpright.untilEnd"]},recording:{title:"capture.retryTips.title",tips:["capture.retryRecording.cameraOn","capture.retryRecording.stay","capture.retryRecording.network"]},device:{title:"capture.retryTips.title",tips:["capture.retryDevice.screenRecording","capture.retryDevice.phone"]}};function rn({showCoaching:e,coaching:t="face",attemptsText:n,showRetake:r,onRetake:s}){let i=Ee(),c=(0,ot.useRef)(null);return(0,ot.useEffect)(()=>{r&&c.current?.focus()},[r]),!e&&!r?null:(0,ye.jsxs)("div",{className:"sekyro-stack sekyro-stack--3","data-testid":"sekyro-captured-panel",children:[e?(0,ye.jsxs)("div",{className:"sekyro-stack sekyro-stack--1",children:[(0,ye.jsx)("p",{className:"sekyro-text-body",children:i(Te[t].title)}),(0,ye.jsx)("ul",{className:"sekyro-coaching",children:Te[t].tips.map(p=>(0,ye.jsx)("li",{children:i(p)},p))}),n!==null?(0,ye.jsx)("p",{className:"sekyro-text-muted","data-testid":"sekyro-attempts-remaining",children:n}):null]}):null,r?(0,ye.jsx)(Y,{ref:c,className:"sekyro-btn--start",onClick:s,children:i("capture.recordAgain")}):null]})}l(rn,"Hn");a(rn,"CapturedPanel");function Ht(){try{return!1}catch{return!1}}l(Ht,"rt");a(Ht,"isDevBuild");var Wn=(0,nn.createContext)(null);function an({state:e}){let t=Ee(),[n,r]=(0,ct.useState)(!1);(0,ct.useEffect)(()=>{e!=="unknown"&&r(!0)},[e]);let s=e==="granted"?(0,Se.jsx)(Br,{}):e==="denied"?(0,Se.jsx)(Vr,{}):(0,Se.jsx)(qr,{});return(0,Se.jsxs)("div",{role:n?"status":void 0,className:`sekyro-permission sekyro-permission--${e}`,"data-testid":"sekyro-permission","data-state":e,children:[(0,Se.jsx)("span",{className:"sekyro-permission__icon","aria-hidden":"true",children:s}),(0,Se.jsx)("span",{children:t(`capture.permission.${e}`)})]})}l(an,"Gn");a(an,"PermissionRow");function sn({voice:e}){let t=Ee();if(!e.supported)return null;let n=e.enabled;return(0,xe.jsxs)("button",{type:"button",role:"switch","aria-checked":n,className:"sekyro-switch","data-testid":"sekyro-voice-switch",onClick:l(()=>e.toggle(),"onClick"),children:[(0,xe.jsxs)("span",{className:"sekyro-switch__label",children:[(0,xe.jsx)(it,{off:!n}),t("capture.voiceGuidance")]}),(0,xe.jsx)("span",{className:"sekyro-switch__track","aria-hidden":"true",children:(0,xe.jsx)("span",{className:"sekyro-switch__thumb",children:n?(0,xe.jsx)(Dr,{className:"sekyro-switch__check"}):null})})]})}l(sn,"Fn");a(sn,"VoiceSwitch");function ln({assets:e,onRetryAssets:t,permission:n,captureMode:r="self",voice:s,tips:i,summary:c,startLabel:p,startDisabled:w,onStart:h}){let m=Ee(),R=(0,ee.useRef)(c?.stop);R.current=c?.stop,(0,ee.useEffect)(()=>()=>R.current?.(),[]);let x=(0,ee.useRef)(null),U=(0,ee.useRef)(null),M=(0,ee.useRef)(null),B=(0,ee.useRef)(e),A=(0,ee.useRef)(!1);(0,ee.useEffect)(()=>{let u=B.current;if(B.current=e,u===e)return;let E=A.current;e!=="loading"&&(A.current=!1),on(x.current)&&(e==="failed"?M.current?.focus():E&&U.current?.focus())},[e]);let te=(0,ee.useCallback)(()=>{A.current=!0,t()},[t]),f=e==="loading",N=f||w,S=(0,ee.useCallback)(()=>{N||(R.current?.(),h())},[N,h]),b;return e==="failed"?b=(0,P.jsxs)(le,{tone:"danger",testId:"sekyro-assets-error",children:[(0,P.jsx)("p",{className:"sekyro-text-body",children:m("fcv2.err.models")}),(0,P.jsx)(Y,{kind:"ghost",ref:M,className:"sekyro-btn--start",onClick:te,"data-testid":"sekyro-assets-retry",children:m("common.retry")})]}):b=(0,P.jsxs)("div",{className:"sekyro-stack sekyro-stack--1",children:[(0,P.jsx)(Y,{ref:U,full:!0,"data-testid":"sekyro-start","aria-disabled":N?"true":void 0,"aria-busy":f?"true":void 0,onClick:S,children:f?(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(Fr,{}),m("capture.preparing.title")]}):p??m("capture.start")}),f?(0,P.jsx)("p",{className:"sekyro-text-muted",children:m("capture.preparing.hint")}):null]}),(0,P.jsxs)("div",{ref:x,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:m("capture.assisted.title")}),(0,P.jsx)("p",{className:"sekyro-text-muted",children:m("capture.assisted.lead")})]}):null,i!==!1?(0,P.jsx)($r,{tips:i}):null,c!==void 0?(0,P.jsxs)(Y,{kind:"ghost",className:"sekyro-btn--start",onClick:c.toggle,"data-testid":"sekyro-tips-listen",children:[(0,P.jsx)(it,{off:!1}),m(c.playing?"capture.tips.stop":"capture.tips.listen")]}):null,(0,P.jsx)(an,{state:n}),(0,P.jsx)(sn,{voice:s}),(0,P.jsx)("p",{className:"sekyro-text-muted",children:m("capture.securityNote")}),b,(0,P.jsx)("p",{role:"status",className:"sekyro-visually-hidden","data-testid":"sekyro-intro-status",children:e==="loading"?m("capture.preparing.title"):e==="ready"?m("capture.ready"):""})]})}l(ln,"jn");a(ln,"PreCaptureScreen");function on(e){if(typeof document>"u")return!1;let t=document.activeElement;return t===null||t===document.body||e!==null&&e.contains(t)}l(on,"Br");a(on,"focusIsOurs");function cn(){let[e,t]=(0,ut.useState)({state:"unknown",settled:!1});return(0,ut.useEffect)(()=>yr(n=>t({state:n,settled:!0})),[]),{permission:e.state,permissionSettled:e.settled}}l(cn,"Yn");a(cn,"useCameraStatus");function un(e){return Ot(e,"mobileRequired")}l(un,"$n");a(un,"useMobileRequired");function dn(e){return Ot(e,"returning").required}l(dn,"zn");a(dn,"useReturning");function Ot(e,t){let[n,r]=(0,pe.useState)({required:!1,settled:e===void 0});return(0,pe.useEffect)(()=>{let s=e?.[t];if(e===void 0||typeof s!="function"){r({required:!1,settled:!0});return}let i=!0;return r({required:!1,settled:!1}),Promise.resolve().then(()=>s.call(e)).then(c=>{i&&r({required:c===!0,settled:!0})},()=>{i&&r({required:!1,settled:!0})}),()=>{i=!1}},[e,t]),n}l(Ot,"Zn");a(Ot,"useFlag");function pn(e){let t=a(()=>e?.captureChoice??null,"initialChoice"),[n,r]=(0,pe.useState)(()=>({session:"self",choice:t(),settled:e===void 0}));(0,pe.useEffect)(()=>{let i=e?.captureMode,c=e?.captureChoice??null;if(e===void 0||typeof i!="function"){r({session:"self",choice:c,settled:!0});return}let p=!0;return r({session:"self",choice:c,settled:!1}),Promise.resolve().then(()=>i.call(e)).then(w=>{let h=e.captureChoice??null;p&&r({session:h!==null&&w===h?"choice":w==="assisted"||w==="choice"?w:"self",choice:h,settled:!0})},()=>{p&&r({session:"self",choice:null,settled:!0})}),()=>{p=!1}},[e]);let s=(0,pe.useCallback)(i=>{e?.chooseCaptureMode?.(i),r(c=>({...c,choice:i}))},[e]);return{mode:n.session==="choice"?n.choice??"self":n.session==="assisted"?"assisted":"self",session:n.session,choice:n.choice,settled:n.settled,choose:s}}l(pn,"Wn");a(pn,"useCaptureMode");function hn(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)),s=e.on("result",()=>n(!1));return()=>{r(),s()}},[e]),t}l(hn,"Qn");a(hn,"useBusy");var Zn=a(()=>"idle","serverSnapshot");function Lt(e){return gr(e!==void 0?{assetBaseUrl:e}:{})}l(Lt,"er");a(Lt,"preload");function fn(e,t=!0){let n=(0,J.useSyncExternalStore)((0,J.useCallback)(h=>kr(h,e),[e]),()=>vr(e),Zn),[r,s]=(0,J.useState)(null),i=(0,J.useRef)(!1),c=(0,J.useCallback)(()=>{Lt(e).then(h=>{i.current&&h==="idle"&&s({base:e})})},[e]);(0,J.useEffect)(()=>(i.current=!0,c(),()=>{i.current=!1}),[c]);let p=(0,J.useRef)(null);(0,J.useEffect)(()=>{if(n!=="idle"){p.current={base:e};return}!t||p.current===null||p.current.base!==e||(p.current=null,c())},[n,e,c,t]);let w=(0,J.useCallback)(()=>{Lt(e)},[e]);return{gate:r!==null&&r.base===e&&n==="idle"||n==="ready"?"ready":n==="failed"?"failed":"loading",retry:w}}l(fn,"tr");a(fn,"useLivenessAssets");var Ur={progress:0,hint:null,faceDetected:!1};function mn(e){let{videoRef:t,assetBaseUrl:n}=e,r=(0,L.useRef)(e.verification).current,s=(0,L.useRef)(!1);e.verification!==r&&!s.current&&Ht()&&(s.current=!0,console.warn("[@sekyro/react] <LivenessCapture>: the `verification` prop changed identity after mount. The first instance stays bound (the camera is not rebuilt); create the verification once (useMemo / useState / outside render) instead of on every render."));let i=(0,L.useRef)(null),[c,p]=(0,L.useState)("idle"),[w,h]=(0,L.useState)(Ur),[m,R]=(0,L.useState)(!1),[x,U]=(0,L.useState)(!1),[M,B]=(0,L.useState)(null),[A,te]=(0,L.useState)(!1),[f,N]=(0,L.useState)(null),[S,b]=(0,L.useState)(null),[u,E]=(0,L.useState)(null),[j,D]=(0,L.useState)(null),[o,H]=(0,L.useState)(null),[O,Z]=(0,L.useState)(!1),F=(0,L.useRef)(null),ke=(0,L.useRef)("idle"),he=(0,L.useRef)(-1),[Q,X]=(0,L.useState)(0),ae=(0,L.useRef)(e);ae.current=e,(0,L.useEffect)(()=>{let re=t.current;if(re===null)return;let ue={video:re,...n!==void 0?{assetBaseUrl:n}:{}},G=r!==void 0?r.liveness(ue):br(ue);i.current=G;let Ne=a(()=>H(G.facingMode??null),"readFacing");Ne();let We=[G.on("state",C=>{C==="mode_switch"?Z(!0):C!=="starting"&&C!=="gating"&&Z(!1),C==="starting"?(ke.current!=="starting"&&(he.current+=1,X(Math.max(0,he.current))),b(null),E(null),h(Ur),U(!1),R(!1),B(null),N(null),F.current=null):C==="gating"&&ke.current==="recording"&&(U(!1),R(!1),B(null),F.current=null),ke.current=C,Ne(),p(C),ae.current.onStateChange?.(C)}),G.on("gate",C=>{let Ce=F.current;F.current=C.progress,R(Ce!==null&&C.progress<Ce-.001&&C.progress>0&&C.progress<1),C.progress>=1&&U(!0),h(C)}),G.on("frozen",({previewDataUrl:C})=>B(C)),G.on("profile",({animations:C})=>te(C==="reduced")),G.on("ramp",({colour:C})=>N(C)),G.on("captured",C=>{b(C),D(null),ae.current.onCaptured?.(C)}),G.on("error",C=>{E(C);let Ce=r?.reportCaptureIssue;Ce!==void 0&&Nt(Le=>Ce.call(r,Le),Lr("liveness",C,Math.max(0,he.current))),ae.current.onError?.(C)}),r?.on("result",C=>{D(C),ae.current.onResult?.(C)})];return()=>{for(let C of We)C?.();i.current=null,G.destroy()}},[r,t,n]);let I=(0,L.useCallback)(()=>{i.current?.start()},[]),Re=(0,L.useCallback)(()=>{i.current?.retry()},[]),be=(0,L.useCallback)(async()=>{let re=i.current;return re===null||typeof re.canSwitchCaptureMode!="function"?!1:await re.canSwitchCaptureMode().catch(()=>!1)===!0},[]),q=(0,L.useCallback)(async re=>{let ue=i.current;if(ue===null||typeof ue.setCaptureMode!="function")return!1;let G=await ue.setCaptureMode(re).catch(()=>!1)===!0;return G&&H(ue.facingMode??null),G},[]);return{state:c,gate:w,draining:m,gateLocked:x,frozenPreview:M,reduceMotion:A,rampColour:f,artifacts:S,error:u,result:j,facingMode:o,start:I,retry:Re,canSwitchCaptureMode:be,setCaptureMode:q,modeRestarted:O,attempt:Q}}l(mn,"rr");a(mn,"useLivenessHandle");var Qn=new Set(["national_number"]);function It(e){if(e==null||!e.available||e.selected!==null)return null;let t=e.options.filter(n=>Qn.has(n));return t.length>0?{...e,options:t}:null}l(It,"or");a(It,"pending");function yn(e){let[t,n]=(0,ge.useState)(null),[r,s]=(0,ge.useState)(e===void 0),[i,c]=(0,ge.useState)(!1),[p,w]=(0,ge.useState)(!1);(0,ge.useEffect)(()=>{if(n(null),e===void 0){s(!0);return}let R=!0,x=e.methodChoice;typeof x=="function"?(s(!1),Promise.resolve().then(()=>x.call(e)).then(M=>{R&&n(It(M))},()=>{}).finally(()=>{R&&s(!0)})):s(!0);let U=e.on("method",M=>n(It(M)));return()=>{R=!1,U()}},[e]);let h=(0,ge.useCallback)(async R=>{if(e===void 0)return!1;c(!0),w(!1);try{return await e.selectMethod(R),n(null),!0}catch{return w(!0),!1}finally{c(!1)}},[e]),m=t!==null&&t.options.length===1?t.options[0]:null;return{choice:t,auto:m==="national_number"&&!p?m:null,settled:r,busy:i,failed:p,select:h}}l(yn,"sr");a(yn,"useMethodChoice");var Xn=["ar","fr","en"];function gn(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(gn,"co");a(gn,"isClipUrl");function vn(e){let t=e.clips;if(typeof t!="object"||t===null)return null;let n={};for(let r of Xn){let s=t[r];if(!(typeof s!="object"||s===null))for(let[i,c]of Object.entries(s))!lt(i)||!gn(c)||((n[r]??(n[r]={}))[i]=c)}return Object.keys(n).length>0?n:null}l(vn,"lo");a(vn,"toVoiceClipMap");function kn(e){let[t,n]=(0,He.useState)(null);(0,He.useEffect)(()=>{if(n(null),e===void 0)return;let s=!0,i=a(p=>{if(!s)return;let w=typeof p=="object"&&p!==null&&typeof p.setId=="string"?p:null;n(h=>h?.setId===w?.setId?h:w)},"take");try{typeof e.voiceClips=="function"&&Promise.resolve(e.voiceClips()).then(i,()=>i(null))}catch{i(null)}let c=e.on("view",p=>i(p.voice));return()=>{s=!1,c()}},[e]);let r=(0,He.useMemo)(()=>t!==null?vn(t):null,[t]);return e===void 0?null:r}l(kn,"ir");a(kn,"useServerVoiceClips");function bn({voice:e}){let t=Ee();return(0,Ut.jsx)(Y,{kind:"chip","aria-pressed":e.enabled,"aria-label":t("capture.voiceGuidance"),"data-testid":"sekyro-voice-toggle",onClick:l(()=>e.toggle(),"onClick"),children:(0,Ut.jsx)(it,{off:!e.enabled,className:"sekyro-icon"})})}l(bn,"cr");a(bn,"VoiceChip");var Yn=new Set(["abandoned","not_opened","cancelled","superseded"]),Jn=800,ea="capture.lookAtColours";function Cn(e){return e===void 0||e!==!1&&e.length===Mt.length&&Mt.every(t=>e.includes(t))}l(Cn,"go");a(Cn,"isDefaultTips");function _n(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(_n,"ho");a(_n,"carriesActivation");function wn(e){return typeof e=="object"&&e!==null&&!(0,y.isValidElement)(e)&&"tone"in e&&"text"in e}l(wn,"vo");a(wn,"isNoticeObject");var ta=new Set(["nni_unbound","id_number_unbound","method_required","mobile_required","portrait_required"]);function Sn(e){return e==="starting"||e==="gating"||e==="recording"||e==="mode_switch"}l(Sn,"ko");a(Sn,"isCapturing");function xn(e){return e==="captured"||e==="uploading"||e==="checking"}l(xn,"bo");a(xn,"isPostCapture");function ra({verification:e,locale:t,dir:n,strings:r,slots:s,autoStart:i=!1,notice:c,startDisabled:p=!1,startLabel:w,tips:h,tipsSummary:m,coach:R,voice:x,onGuidance:U,onCaptured:M,onResult:B,onError:A,onStateChange:te,assetBaseUrl:f,className:N}){let S=Rr(t),b=(0,y.useMemo)(()=>xr(t,r),[t,r,S]),u=(0,y.useMemo)(()=>v=>b[v]??"",[b]),E=n??(t==="ar"?"rtl":"ltr"),j=(0,y.useRef)(null),D=(0,y.useContext)(Wn),o=mn({verification:e,videoRef:j,assetBaseUrl:f,onCaptured:M,onResult:B,onError:A,onStateChange:te}),H=fn(f,o.state==="idle"&&o.error===null),O=yn(e),Z=O.choice!==null,F=un(e),ke=dn(e),he=hn(e),Q=cn(),X=pn(e),ae=X.session==="choice",I=X.mode==="assisted",Re=x!==!1&&x?.clips===void 0,be=kn(Re?e:void 0),q=Jr({locale:t,defaultClips:be,options:x}),re=I?"environment":"user",ue=X.settled,G=(0,y.useRef)(null),Ne=(0,y.useRef)(!1),We=(0,y.useRef)(q.unlock);We.current=q.unlock,(0,y.useEffect)(()=>{let v=G.current;if(v===null)return;let ie=["pointerup","touchend","click","keydown"],we=a(()=>{for(let De of ie)v.removeEventListener(De,Ae,!0)},"disarm");function Ae(De){if(Ne.current){we();return}_n(De)&&(Ne.current=!0,we(),We.current())}l(Ae,"Re"),a(Ae,"onGesture");for(let De of ie)v.addEventListener(De,Ae,{capture:!0,passive:!0});return we},[]);let C=(0,y.useCallback)(()=>{Ne.current||(Ne.current=!0,q.unlock()),o.start()},[q.unlock,o.start]),Ce=(0,y.useCallback)(()=>o.start(),[o.start]),Le=(0,y.useRef)(!1),Oe=o.state==="idle"&&o.error===null,Vt=!Z&&!F.required&&(i===!0||i==="when-permitted"&&Q.permission==="granted"),Dt=Vt&&O.settled&&F.settled&&ue,Ln=i==="when-permitted"&&!Q.permissionSettled&&!Le.current,Ft=Vt&&Oe&&!Le.current,pt=(Ln||Ft||!ue)&&H.gate==="ready"?"loading":H.gate;(0,y.useEffect)(()=>{!Dt||!Oe||H.gate!=="ready"||Le.current||(Le.current=!0,Ce())},[Dt,Oe,H.gate,Ce]);let In=Oe&&!Z&&!F.required&&!(Ft&&H.gate==="ready"),[$t,Kt]=(0,y.useState)(!1),{canSwitchCaptureMode:Gt,setCaptureMode:zt}=o;(0,y.useEffect)(()=>{if(!X.settled||!ae){Kt(!1);return}let v=!0;return Gt().then(ie=>{v&&Kt(ie)}),()=>{v=!1}},[X.settled,ae,Gt]);let{choose:Wt}=X,Ie=I?"self":"assisted",Un=(0,y.useCallback)(async()=>{await zt(Ie)&&Wt(Ie)},[zt,Wt,Ie]),Zt=o.state!=="idle"&&o.facingMode!==null?o.facingMode:re;(0,y.useEffect)(()=>{let v=j.current?.style;Zt==="user"?v?.removeProperty("transform"):v&&(v.transform="none")},[Zt]);let Ze=(0,y.useMemo)(()=>o.artifacts!==null&&typeof URL.createObjectURL=="function"?URL.createObjectURL(o.artifacts.keyframe):null,[o.artifacts]);(0,y.useEffect)(()=>{if(Ze!==null)return()=>URL.revokeObjectURL(Ze)},[Ze]);let Qt=o.frozenPreview??Ze,Ue=e!==void 0,$=Sn(o.state),fe=xn(o.state),Pe=$||fe,se=o.result,Xt=o.state==="done"&&se!==null,Qe=$&&o.rampColour!==null,ht=o.state==="recording"&&o.frozenPreview!==null&&!Qe,Be=D!==null,Yt=$t&&$&&!ht?{to:Ie,label:u(Ie==="assisted"?"capture.modeSwitch.toAssisted":"capture.modeSwitch.toSelf"),description:u(Ie==="assisted"?"capture.modeSwitch.toAssistedLabel":"capture.modeSwitch.toSelfLabel"),onSwitch:a(()=>{Un()},"onSwitch")}:null,Xe=o.modeRestarted&&$?u("capture.modeSwitch.restarted"):null,qe=fe||ht,Jt=fe?"checking":ht?"frozen":o.state==="recording"||Qe?"recording":o.gateLocked||o.gate.progress>=1?"locked":o.gate.faceDetected?"aligning":"seeking",Ye=$?o.gate.hint:null,Je=o.state==="starting"?"capture.preparing.title":Ye===null?null:Ye==="center"&&!o.gate.faceDetected?"fcv3.no_face":Cr(Ye),[jn,er]=(0,y.useState)(null);(0,y.useEffect)(()=>{if(Je!=="fcv3.no_face"){er(Je);return}if(!$)return;let v=setTimeout(()=>er(Je),Jn);return()=>clearTimeout(v)},[Je,$]);let ft=$&&!Qe&&typeof R=="string"&&R!=="",tr=I&&$?u("capture.assisted.stage"):null,Me=$&&!ft?Qe?ea:jn:null,mt=ft?R:Me===null?"":u(Me);en(q,Me,mt,$);let rr=(0,y.useRef)(U);rr.current=U,(0,y.useEffect)(()=>{if(lt(Me))try{rr.current?.(Me)}catch(v){console.error("[@sekyro/react] onGuidance threw:",v)}},[Me]);let Ve=(0,y.useMemo)(()=>({supported:q.supported,enabled:q.enabled,setEnabled:q.setEnabled,toggle:q.toggle}),[q.supported,q.enabled,q.setEnabled,q.toggle]),yt=s?.voicePrompt,nr=yt!==void 0,ar=x===void 0,sr=(0,y.useRef)(!1);(0,y.useEffect)(()=>{!nr||!ar||sr.current||!Ht()||(sr.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."))},[nr,ar]);let Tn=yt!==void 0?(v,ie,we)=>yt(v,ie,we,Ve):q.supported?()=>(0,k.jsx)(bn,{voice:Ve}):void 0,{summary:gt,summaryPlaying:ir,toggleSummary:lr,stopSummary:or}=q,et=m!==void 0&&m!=="",cr=et?m:u("capture.tips.summary"),ur=et?gt!=="none":gt==="partner"||gt==="default"&&Cn(h),Hn=(0,y.useMemo)(()=>ur?{playing:ir,toggle:a(()=>lr(cr,{clip:!et}),"toggle"),stop:or}:void 0,[ur,ir,lr,cr,or,et]),dr=(0,y.useMemo)(()=>({assets:pt,retryAssets:H.retry,permission:Q.permission,permissionSettled:Q.permissionSettled,captureMode:X.mode,facing:re,voice:Ve}),[pt,H.retry,Q.permission,Q.permissionSettled,X.mode,re,Ve]),On=wn(c)?(0,k.jsx)(le,{tone:c.tone,testId:"sekyro-host-notice",children:(0,k.jsx)("span",{children:c.text})}):c??null,V=se!==null&&se.status==="retry"?se:null,tt=V!==null&&s?.intro!==void 0&&!$&&!fe&&o.error===null,pr=V===null?void 0:{reason:String(V.reasonCode??""),...V.retakeHint!==void 0?{retakeHint:V.retakeHint}:{},...V.attemptsRemaining!==void 0?{attemptsRemaining:V.attemptsRemaining}:{}},z=Xt&&se.status==="unavailable"&&!Z&&se.reasonCode!=="portrait_required"?se:null,_e=Xt&&(se.status==="verified"||se.status==="not_verified"||se.status==="review")?se:null,vt=a((v,ie)=>{if(v===void 0)return null;if(v==="device_cooldown"){let Ae=wr(t,ie);if(Ae!==null)return u(Ae.key).replace("{time}",Ae.time)}let we=nt(v);return we===null?null:u(we)},"reasonText"),kt=a(v=>{let ie=v.retakeHint===void 0?null:Fe(v.retakeHint);return ie===null?vt(v.reasonCode):u(ie)},"retryText"),hr=_e===null?null:vt(_e.reasonCode,_e.retryAfter)??(_e.status==="not_verified"&&_e.reason!==void 0&&Yn.has(_e.reason)?u("errors.session_expired"):null),Pn=z!==null&&z.reasonCode!==void 0&&z.reasonCode!=="nni_unbound"&&z.reasonCode!=="id_number_unbound"&&z.reasonCode!=="method_required"&&z.reasonCode!=="mobile_required"&&!(z.reasonCode==="no_recorder"&&o.artifacts?.degraded==="NO_RECORDER"),rt=z?.reasonCode,fr=o.attempt;(0,y.useEffect)(()=>{z===null||rt===void 0||e?.reportCaptureIssue===void 0||ta.has(rt)||Nt(v=>e.reportCaptureIssue?.(v),{check:"liveness",kind:"unavailable",phase:"upload",engineKind:rt,attempt:Math.min(1e3,fr)})},[z,rt,fr,e]);let mr=wt(),Bn=Z&&O.auto===null&&!$&&!fe&&o.error===null,bt=(0,y.useCallback)(async v=>{await O.select(v)&&o.state==="done"&&o.retry()},[O.select,o.state,o.retry]);return(0,y.useEffect)(()=>{O.auto!==null&&!O.busy&&!$&&!fe&&bt(O.auto)},[O.auto,O.busy,$,fe,bt]),(0,k.jsx)(Nr,{value:u,children:(0,k.jsxs)("div",{ref:G,className:N===void 0?"sekyro-capture":`sekyro-capture ${N}`,dir:E,lang:t,"data-testid":"sekyro-liveness-capture","data-state":o.state,children:[s?.header,V!==null&&kt(V)!==null&&!(Be&&Pe)&&!tt?(0,k.jsx)(le,{tone:"warning",role:"status",testId:"sekyro-retry-notice",children:(0,k.jsx)("span",{children:kt(V)})}):null,Xe!==null&&!Be?(0,k.jsx)(le,{tone:"info",role:"status",testId:"sekyro-mode-switch-status",children:(0,k.jsx)("span",{children:Xe})}):null,he&&fe&&!Be?(0,k.jsx)(le,{tone:"info",role:"status",testId:"sekyro-busy-notice",children:(0,k.jsx)("span",{children:u("capture.busy")})}):null,F.required&&Oe?(0,k.jsx)(le,{tone:"info",role:"status",testId:"sekyro-mobile-required",children:(0,k.jsx)("span",{children:u("reasons.mobile_required")})}):null,o.error!==null?s?.errorPanel!==void 0?s.errorPanel(o.error,o.retry):(0,k.jsxs)(le,{tone:"danger",testId:"sekyro-error-notice",children:[(0,k.jsx)("span",{children:u(_r(o.error))}),o.error.retryable?(0,k.jsx)(Y,{ref:mr,kind:"ghost",className:"sekyro-btn--start",onClick:o.retry,children:u("common.retry")}):null]}):null,z!==null?(0,k.jsxs)(le,{tone:"danger",testId:"sekyro-unavailable-notice",children:[(0,k.jsx)("span",{children:(z.reasonCode==="attestation"&&z.attestationError==="clock_wrong"?u("errors.device_clock"):vt(z.reasonCode))??u(z.reasonCode===void 0?"errors.session_expired":"errors.network_error")}),Pn?(0,k.jsx)(Y,{ref:mr,kind:"ghost",className:"sekyro-btn--start",onClick:o.retry,children:u(z.reasonCode==="attestation"?"common.retry":"capture.recordAgain")}):null]}):null,hr!==null&&_e!==null?(0,k.jsx)(le,{tone:_e.status==="not_verified"?"danger":"info",testId:"sekyro-result-notice",children:(0,k.jsx)("span",{children:hr})}):null,(0,k.jsx)("div",{className:Pe?void 0:"sekyro-hidden","data-capture-live":Pe?"":void 0,children:Be?D({videoRef:j,guidance:qe&&Ue?u("capture.checking"):mt,coached:ft&&!(qe&&Ue),note:qe?Ue?u(he?"capture.busy":"capture.checkingHint"):null:Xe??tr,settled:qe&&Ue,progress:o.gate.progress,phase:Jt,still:qe?Qt:null,live:Pe,modeSwitch:Yt,...$t||V!==null?{status:Xe??(V!==null&&$?kt(V):null)}:{},ramp:o.rampColour===null?null:{colour:o.rampColour}}):(0,k.jsx)(Mr,{videoRef:j,guidanceText:mt,guidanceHint:Ye,guidanceKey:Me,progress:o.gate.progress,phase:Jt,draining:o.draining,stillUrl:Qt,showChecking:Ue,operatorText:tr,voicePrompt:Tn,overlay:l(v=>(0,k.jsxs)(k.Fragment,{children:[s?.stageOverlay?.(v),(0,k.jsx)(Ar,{colour:o.rampColour})]}),"overlay"),reduceMotion:o.reduceMotion,modeSwitch:Yt})}),Bn&&O.choice!==null?(0,k.jsx)(Kr,{title:u("method.title"),description:u("method.description"),options:O.choice.options.map(v=>({id:v,label:u(`method.${v}`)})),busy:O.busy,error:O.failed?u("errors.network_error"):null,focus:o.state==="done",testId:"sekyro-method",look:"buttons",onChoose:l(v=>{bt(v)},"onChoose")}):null,tt&&s?.intro!==void 0&&pr!==void 0?s.intro(o.retry,{...dr,retry:pr}):null,In?(0,k.jsxs)(k.Fragment,{children:[ke&&s?.header===void 0&&s?.intro===void 0?(0,k.jsxs)("div",{className:"sekyro-stack sekyro-stack--1",children:[(0,k.jsx)("h2",{className:"sekyro-text-body",children:u("returning.title")}),(0,k.jsx)("p",{className:"sekyro-text-muted",children:u("returning.description")})]}):null,On,s?.intro!==void 0?s.intro(C,dr):(0,k.jsx)(ln,{assets:pt,onRetryAssets:H.retry,permission:Q.permission,captureMode:X.mode,voice:Ve,tips:h??Mt,summary:Hn,startLabel:w,startDisabled:p,onStart:C})]}):null,(0,k.jsx)(rn,{showCoaching:V!==null&&!(Be&&Pe)&&!tt,coaching:ze(V?.reasonCode,V?.retakeHint),attemptsText:V?.attemptsRemaining!==void 0?Sr(b,t,V.attemptsRemaining):null,showRetake:V!==null&&!$&&!fe&&!tt||!Ue&&o.state==="captured",onRetake:o.retry}),s?.footer]})})}l(ra,"Ni");a(ra,"LivenessCapture");var Pt=T(W(),1),dt=T(W(),1),d=T(de(),1);var La={document:"card",population_registry:"id",national_eid:"smartphone",phone_otp:"phone",email_otp:"email"};function na(e,t){switch(e.service){case"document":return t.t("method.document_photo");case"population_registry":return _t(e,t.locale)??t.t("method.nationalNumber");case"national_eid":return _t(e,t.locale)??t.t("method.nationalEid");default:return null}}l(na,"J");a(na,"identityLabel");function aa(e,t){let[n,r]=(0,Pt.useState)(!1),[s,i]=(0,Pt.useState)(null);return{busy:n,error:s,run:a(c=>{r(!0),i(null),c().then(()=>r(!1),p=>{r(!1),i(e.t(Ir(p,e.strings))),t?.(p)})},"run")}}l(aa,"Q");a(aa,"useChoiceAction");function Bt(){let e=`sekyro-face-light-${(0,dt.useId)().replace(/[^A-Za-z0-9_-]/g,"")}`;return(0,d.jsxs)("svg",{className:"sekyro-mark sekyro-mark--face",viewBox:"0 0 168 206","aria-hidden":"true",focusable:"false",children:[(0,d.jsx)("defs",{children:(0,d.jsx)("mask",{id:e,children:(0,d.jsx)("ellipse",{className:"sekyro-mark__arc",cx:"84",cy:"103",rx:"76",ry:"95",pathLength:"1",fill:"none",stroke:"#fff",strokeWidth:"16"})})}),(0,d.jsx)("ellipse",{cx:"84",cy:"103",rx:"64",ry:"83",fill:"none",className:"sekyro-mark__line"}),(0,d.jsx)("path",{className:"sekyro-mark__face",d:"M68 64v10M100 64v10M84 66v25q0 2-6 1M60 108q24 18 48 0"}),(0,d.jsx)("ellipse",{className:"sekyro-mark__ticks",cx:"84",cy:"103",rx:"76",ry:"95",pathLength:"56"}),(0,d.jsx)("ellipse",{className:"sekyro-mark__ticks sekyro-mark__ticks--light",cx:"84",cy:"103",rx:"76",ry:"95",pathLength:"56",mask:`url(#${e})`})]})}l(Bt,"O");a(Bt,"FaceMark");var sa={glasses:"jGlasses",lighting:"light",faceCamera:"camera"};function ia(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(ia,"le");a(ia,"faceIntroRetryOf");var Nn={"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 la({start:e,context:t,tips:n,tipsTitle:r,human:s=!1,returning:i=!1,notice:c,retry:p}){let w=at(),{t:h}=w,m=p??An(t),R=(0,dt.useContext)(Er)?.busy===!0;if(m!==void 0&&c===void 0&&t.captureMode!=="assisted")return(0,d.jsx)(En,{retry:m,start:e,context:t,disabled:R});let x=m===void 0?"face":ze(m.reason,m.retakeHint),U=x==="face"?null:Te[x].tips;return(0,d.jsxs)("section",{className:"sekyro-step",children:[(0,d.jsx)(Bt,{}),t.captureMode==="assisted"?(0,d.jsx)($e,{title:h("capture.assisted.heading"),lead:h("capture.assisted.lead")}):i?(0,d.jsx)($e,{title:h("returning.heading"),lead:h("returning.description")}):(0,d.jsx)($e,{title:h(s?"native.face.humanIntroTitle":"native.face.introTitle"),lead:h(s?"native.face.humanIntroLead":"native.face.introLead")}),m!==void 0?(0,d.jsx)(Mn,{retry:m,title:Te[x].title}):null,r!==void 0&&U===null?(0,d.jsx)("p",{className:"sekyro-section-label",children:r}):null,(0,d.jsx)("ul",{className:"sekyro-tiprows",children:U!==null?U.map(M=>(0,d.jsxs)("li",{children:[(0,d.jsx)(me,{name:Nn[M]??"face"}),h(M)]},M)):n!==void 0?n.map(M=>(0,d.jsxs)("li",{children:[(0,d.jsx)(me,{name:sa[M.id]??"face"}),M.text]},M.id)):(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)("li",{children:[(0,d.jsx)(me,{name:"light"}),h("capture.tips.light")]}),(0,d.jsxs)("li",{children:[(0,d.jsx)(me,{name:"jGlasses"}),h("capture.tips.uncover")]}),(0,d.jsxs)("li",{children:[(0,d.jsx)(me,{name:"smartphone"}),h("capture.tips.eyeLevel")]})]})}),c??null,c!==void 0?null:t.assets==="failed"?(0,d.jsx)(Y,{kind:"secondary",full:!0,onClick:t.retryAssets,children:h("common.retry")}):null,c!==void 0?null:(0,d.jsx)(St,{children:(0,d.jsxs)(Y,{full:!0,disabled:t.assets!=="ready"||R,"aria-busy":t.assets==="loading"||void 0,onClick:e,children:[(0,d.jsx)(me,{name:"camera"}),h("capture.start")]})})]})}l(la,"ue");a(la,"FaceIntro");var oa=new Set(["match_inconclusive","no_face_source","below_threshold"]);function qt(e){return e==="probe_not_from_liveness"?"capture.retrySamePerson.message":e==="faces_differ"?"reasons.faces_differ":oa.has(e)?"capture.retryMatch.message":nt(e)}l(qt,"F");a(qt,"retryReasonKey");function Mn({retry:e,title:t}){let n=at(),r=e.retakeHint===void 0?null:Fe(e.retakeHint),s=qt(e.reason);return(0,d.jsxs)(xt,{tone:"warning",children:[r!==null?(0,d.jsx)("span",{children:n.t(r)}):s!==null?(0,d.jsx)("span",{children:n.t(s)}):null,r===null?(0,d.jsx)("span",{children:n.t(t)}):null,(0,d.jsx)("span",{children:Rt(n,e.attemptsRemaining,e.attemptsExhausted)})]})}l(Mn,"U");a(Mn,"RetryNotice");function An(e){let t=e.retry;if(t!==void 0)return{reason:t.reason,...t.retakeHint!==void 0?{retakeHint:t.retakeHint}:{},attemptsRemaining:t.attemptsRemaining??0,attemptsExhausted:t.attemptsRemaining===0}}l(An,"G");a(An,"faceIntroRetryOfContext");var Rn=[{key:"capture.retryCoaching.light",icon:"light"},{key:"capture.retryCoaching.eyeLevel",icon:"smartphone"},{key:"capture.retryCoaching.head",icon:"face"}],ca={appearance:"hintTitles.appearance",motion:"hintTitles.motion",lighting:"hintTitles.lighting",framing:"hintTitles.framing"};function En({retry:e,start:t,context:n,disabled:r}){let s=at(),{t:i}=s,c=ze(e.reason,e.retakeHint),p=c==="face"?Rn:Te[c].tips.map(x=>({key:x,icon:Rn.find(U=>U.key===x)?.icon??Nn[x]??"face"})),w=e.retakeHint===void 0?null:Fe(e.retakeHint),h=qt(e.reason),m=w!==null?i(w):h!==null?i(h):void 0,R=i((e.retakeHint!==void 0?ca[e.retakeHint]:void 0)??"hintTitles.default");return(0,d.jsxs)("section",{className:"sekyro-step","data-testid":"sekyro-face-retry",children:[(0,d.jsx)(Bt,{}),(0,d.jsx)($e,{title:R}),m!==void 0?(0,d.jsx)(xt,{tone:"warning",children:(0,d.jsx)("span",{children:m})}):null,(0,d.jsx)("ul",{className:"sekyro-tiprows",children:p.slice(0,3).map(x=>(0,d.jsxs)("li",{children:[(0,d.jsx)(me,{name:x.icon}),i(x.key)]},x.key))}),n.assets==="failed"?(0,d.jsx)(Y,{kind:"secondary",full:!0,onClick:n.retryAssets,children:i("common.retry")}):null,(0,d.jsxs)(St,{children:[(0,d.jsx)("p",{className:"sekyro-text-muted","data-testid":"sekyro-attempts-remaining",children:Rt(s,e.attemptsRemaining,e.attemptsExhausted)}),(0,d.jsxs)(Y,{full:!0,disabled:n.assets!=="ready"||r||e.attemptsExhausted,"aria-busy":n.assets==="loading"||void 0,onClick:t,children:[(0,d.jsx)(me,{name:"camera"}),i("capture.recordAgain")]})]})]})}l(En,"q");a(En,"FaceRetry");function ua(e){return Ct(e)}l(ua,"ye");a(ua,"isInAppBrowser");function da(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 s=r.protocol.slice(0,-1);return`intent://${r.host}${r.pathname}${r.search}#Intent;scheme=${s};action=android.intent.action.VIEW;S.browser_fallback_url=${encodeURIComponent(e)};end`}l(da,"ge");a(da,"androidBrowserIntent");export{Kr as a,Ht as b,Wn as c,pn as d,ra as e,La as f,na as g,aa as h,ia as i,la as j,ua as k,da as l};
@@ -0,0 +1 @@
1
+ import{d as Re,e as Xe,f as Ze,g as Ve}from"./chunk-EGCT7K5E.js";import{a as le,b as je,c as ce,d as $e}from"./chunk-P7K7ELYZ.js";import{a as Se,b as Q,c as Ae,d as Ie,e as Ce,h as Oe,i as ne,j as Pe,k as Ge,l as He,m as Ke}from"./chunk-6MYG4HWP.js";import{a as Ue,b as Fe,c as Ne,d as Le,e as Be,f as oe,g as j,h as qe,i as We,j as ze}from"./chunk-JS2IXPNL.js";import{b as xe,c as De}from"./chunk-SLLJX5QK.js";import{a as o}from"./chunk-4FHWXBOB.js";var Tt=["magenta","yellow","green","blue"],_t={magenta:"rgb(255, 72, 150)",yellow:"rgb(255, 190, 0)",green:"rgb(0, 238, 175)",blue:"rgb(25, 150, 255)",dark:"rgb(0, 0, 0)"};function zi(i){return _t[i]}o(zi,"P");var Et=4,St=4,J=o(i=>typeof i=="number"&&Number.isFinite(i),"R");function ee(i){if(typeof i!="object"||i===null)return!1;let e=i;if(typeof e.nonce!="string"||e.nonce.length===0||!Array.isArray(e.colours)||e.colours.length<1||e.colours.length>8||!e.colours.every(r=>Tt.includes(r))||!Array.isArray(e.onsetsMs)||e.onsetsMs.length!==e.colours.length)return!1;let t=-1;for(let r of e.onsetsMs){if(!J(r)||r<0||r<=t)return!1;t=r}return!(!J(e.holdMs)||e.holdMs<=0||!J(e.endMs)||e.endMs<=t||!J(e.clipMs)||e.clipMs<e.endMs||e.clipMs>8e3)}o(ee,"_");function Ye(i,e){return ee(i)?Math.max(e,Math.ceil(i.clipMs)):e}o(Ye,"O");function Qe(i,e){let t=e.now??(()=>performance.now()),r=ee(i)?i:void 0,s=[],a=null,n=null,l=null,c=!1,h=null,d=o(p=>{h=p;try{e.paint(p)}catch{}},"s"),u=o(p=>{let v=e.frames?.()??null;return v!==null&&l!==null?v.mediaTimeMs+(p-v.presentationTimeMs)-l:p-(n??p)},"p"),m=o((p,v,y=0)=>{if(c)return;let g=Math.max(0,p-u(t()));a=setTimeout(()=>{if(a=null,!c){if(y<Et&&u(t())<p-St){m(p,v,y+1);return}v()}},g)},"f"),w=o(p=>{if(r===void 0)return;let v=r.endMs;if(p>=r.colours.length){m(v,()=>d(null));return}let y=r.onsetsMs[p],g=p+1<r.onsetsMs.length?r.onsetsMs[p+1]:v;m(y,()=>{let M=u(t());if(M>v){h!==null&&d(null);return}let E=r.colours[p];d(E);let A=s.length===0?0:s[s.length-1].tMs;s.push({tMs:Math.max(A,Math.round(M)),colour:E});let I=y+r.holdMs;if(I<g){m(I,()=>{if(u(t())>v){h!==null&&d(null);return}d("dark"),w(p+1)});return}w(p+1)})},"S");return{started(p){if(r===void 0||c||n!==null)return;n=p;let v=e.frames?.()??null;l=v===null?null:v.mediaTimeMs+(p-v.presentationTimeMs),w(0)},stop(){c||(c=!0,a!==null&&clearTimeout(a),a=null,h!==null&&d(null))},report(){return r===void 0?void 0:{nonce:r.nonce,rendered:[...s]}}}}o(Qe,"w");var At=1e4,O,It=(O=class{constructor(e,t){this.tier="blaze",this.inner=e,t!==void 0&&(this.fallbackReason=t)}static async create(e,t){let r=await import("./vision_bundle-WBHR7TEE.js"),s=await r.FilesetResolver.forVisionTasks(e),a=await r.FaceDetector.createFromOptions(s,{baseOptions:{modelAssetPath:`${e}/blaze_face_short_range.tflite`,delegate:"CPU"},runningMode:"IMAGE"});return new O(a,t)}async detect(e,t,r){let s;try{s=this.inner.detect(e).detections}catch{return null}let a=xt(s);if(a?.boundingBox===void 0)return null;let n=te(e),l=Dt(a.keypoints,n),c=a.keypoints?.[2],h={box:{x:a.boundingBox.originX,y:a.boundingBox.originY,width:a.boundingBox.width,height:a.boundingBox.height},...l!==void 0?{eyes:l}:{},...c!==void 0?{nose:{x:c.x*n.width,y:c.y*n.height}}:{},score:a.categories[0]?.score??0,extraFaces:Je(s.map(d=>d.boundingBox??{width:0,height:0}),s.indexOf(a))};return et(h,e,t,r)}destroy(){try{this.inner.close()}catch{}}},o(O,"t"),O);function xt(i){let e,t=-1;for(let r of i){let s=r.categories[0]?.score??0;s>t&&(e=r,t=s)}return e}o(xt,"R");function Dt(i,e){let t=i?.[0],r=i?.[1];if(t===void 0||r===void 0)return;let s=o(l=>({x:l.x*e.width,y:l.y*e.height}),"n"),[a,n]=[s(t),s(r)];return a.x<=n.x?{left:a,right:n}:{left:n,right:a}}o(Dt,"T");function Rt(){if(typeof OffscreenCanvas=="function")return new OffscreenCanvas(2,2);let i=document.createElement("canvas");return i.width=2,i.height=2,i}o(Rt,"E");var Ct=4;async function Ot(){let i=globalThis.FaceDetector;if(typeof i!="function")return{ok:!1,reason:"unsupported"};try{let e=new i({fastMode:!0,maxDetectedFaces:Ct});return await e.detect(Rt()),{ok:!0,instance:e}}catch(e){return{ok:!1,reason:`smoke_failed:${e instanceof Error?e.message:String(e)}`}}}o(Ot,"w");var U,Pt=(U=class{constructor(e,t){this.tier="native",this.inner=e,t!==void 0&&(this.fallbackReason=t)}async detect(e,t,r){let s;try{s=await this.inner.detect(e)}catch{return null}let a=s.map(d=>d.boundingBox),n=-1;a.forEach((d,u)=>{let m=a[n];(m===void 0||d.width*d.height>m.width*m.height)&&(n=u)});let l=s[n];if(l===void 0)return null;let c=Gt(l.landmarks),h={box:{x:l.boundingBox.x,y:l.boundingBox.y,width:l.boundingBox.width,height:l.boundingBox.height},...c!==void 0?{eyes:c}:{},score:1,extraFaces:Je(a,n)};return et(h,e,t,r)}destroy(){}},o(U,"b"),U);function Gt(i){if(i===void 0)return;let e=i.filter(s=>s.type==="eye").map(s=>s.locations[0]).filter(s=>s!==void 0),[t,r]=e;if(!(t===void 0||r===void 0))return t.x<=r.x?{left:t,right:r}:{left:r,right:t}}o(Gt,"S");var Ut=.25;function Je(i,e){let t=i[e],r=t===void 0?0:t.width*t.height;if(!(r>0))return 0;let s=0;return i.forEach((a,n)=>{n!==e&&a.width*a.height>=Ut*r&&(s+=1)}),s}o(Je,"f");var ue="/models-v3",Ft=["native","blaze"],F,de=(F=class extends Error{constructor(e){super(`no detector tier available (${e})`),this.name="DetectorLadderError",this.fallbackReason=e}},o(F,"x"),F);function te(i){let e=i;if(typeof e.videoWidth=="number"&&e.videoWidth>0)return{width:e.videoWidth,height:e.videoHeight??0};if(typeof e.naturalWidth=="number"&&e.naturalWidth>0)return{width:e.naturalWidth,height:e.naturalHeight??0};let t=typeof e.width=="number"?e.width:0,r=typeof e.height=="number"?e.height:0;return{width:t,height:r}}o(te,"y");function et(i,e,t,r){let s=te(e),a=s.width>0?t/s.width:1,n=s.height>0?r/s.height:1,l=o(c=>({x:c.x*a,y:c.y*n}),"s");return{box:{x:i.box.x*a,y:i.box.y*n,width:i.box.width*a,height:i.box.height*n},...i.eyes!==void 0?{eyes:{left:l(i.eyes.left),right:l(i.eyes.right)}}:{},...i.nose!==void 0?{nose:l(i.nose)}:{},score:i.score,...i.extraFaces!==void 0?{extraFaces:i.extraFaces}:{}}}o(et,"h");function Nt(i){return i instanceof Error?i.message:String(i)}o(Nt,"C");async function x(i){let e=i.preferred??Ft,t=[];for(let r of e){if(r==="native"){let s=await Ot();if(s.ok)return new Pt(s.instance,he(t));t.push(`native:${s.reason}`);continue}try{return await Lt(It.create(i.v3AssetBaseUrl??ue,he(t)),i.blazeInitTimeoutMs??At)}catch(s){t.push(s instanceof tt?"blaze:blaze_init_timeout":`blaze:${Nt(s)}`)}}throw new de(he(t)??"no_tier_available")}o(x,"O");function he(i){return i.length>0?i.join("; "):void 0}o(he,"v");var N,tt=(N=class extends Error{},o(N,"g"),N);function Lt(i,e){return new Promise((t,r)=>{let s=setTimeout(()=>{r(new tt(`init exceeded ${e}ms`)),i.then(a=>a.destroy(),()=>{})},e);i.then(a=>{clearTimeout(s),t(a)},a=>{clearTimeout(s),r(a)})})}o(Lt,"W");var C=1;function it(){return typeof OffscreenCanvas=="function"&&typeof createImageBitmap=="function"&&typeof Worker=="function"}o(it,"K");function Bt(i,e={}){let t=e.createDetector??x,r=null;i.onmessage=s=>{let a=s.data;if(a.v!==C){a.bitmap?.close?.();return}if(a.type==="init"){t(a.options).then(n=>{r=n;let l={v:C,type:"ready",tier:n.tier,...n.fallbackReason!==void 0?{fallbackReason:n.fallbackReason}:{}};i.postMessage(l)});return}if(a.type==="detect"){let n=o(l=>{let c={v:C,type:"result",id:a.id,observation:l};i.postMessage(c),a.bitmap.close?.()},"a");if(r===null){n(null);return}r.detect(a.bitmap,a.streamWidth,a.streamHeight).then(n,()=>n(null))}}}o(Bt,"B");typeof self<"u"&&typeof self.importScripts=="function"&&Bt(self);var P,rt=(P=class{constructor(e,t){this.pending=new Map,this.nextId=1,this.worker=e,this.tier=t.tier,t.fallbackReason!==void 0&&(this.fallbackReason=t.fallbackReason),e.addEventListener("message",r=>{let s=r.data;if(s.v!==C||s.type!=="result")return;let a=this.pending.get(s.id);this.pending.delete(s.id),a?.(s.observation)})}static create(e,t,r=1e4){return new Promise((s,a)=>{let n=setTimeout(()=>{e.removeEventListener("message",l),e.terminate(),a(new Error(`worker detector not ready within ${r}ms`))},r),l=o(h=>{let d=h.data;d.v!==C||d.type!=="ready"||(clearTimeout(n),e.removeEventListener("message",l),s(new P(e,d)))},"s");e.addEventListener("message",l);let c={v:C,type:"init",options:t};e.postMessage(c)})}async detect(e,t,r){let s;try{typeof ImageBitmap<"u"&&e instanceof ImageBitmap?s=e:typeof createImageBitmap=="function"?s=await createImageBitmap(e):s=e}catch{return null}let a=this.nextId;return this.nextId+=1,new Promise(n=>{this.pending.set(a,n);let l={v:C,type:"detect",id:a,bitmap:s,streamWidth:t,streamHeight:r};this.worker.postMessage(l,[s])})}destroy(){for(let e of this.pending.values())e(null);this.pending.clear(),this.worker.terminate()}},o(P,"t"),P);var qt=[...Ue.filter(i=>i.startsWith("video/mp4")),"video/webm;codecs=h264","video/webm;codecs=avc1","video/webm;codecs=vp8","video/webm;codecs=vp9","video/webm"],dt=new Set;function Wt(i){let e=/(?:Chrome|Chromium)\/(\d+)\./.exec(i??"");return e?Number(e[1]):null}o(Wt,"Pe");function zt(i=Kt(),e=globalThis.navigator?.userAgent){if(i===void 0)return"";let t=Wt(e)===126;for(let r of qt)if(!(dt.has(r)||t&&r.startsWith("video/mp4")))try{if(i(r))return r}catch{}return""}o(zt,"be");function st(i){i!==""&&dt.add(i)}o(st,"L");function Ht(i){return i.replace(/^video\/x-matroska/i,"video/webm")}o(Ht,"ye");function ft(i){let e=/codecs=["']?([^,;"']+)/i.exec(i);return e?e[1].trim():i.split(";")[0].trim()}o(ft,"lt");function Kt(){let i=globalThis.MediaRecorder;return i&&typeof i.isTypeSupported=="function"?e=>i.isTypeSupported(e):void 0}o(Kt,"xe");var pt=2500,Xt=1e3,Zt=1500,at=25e5,Vt=100,jt=700,$t=20,Yt=1500,ie=null;function Qt(){return ie??(ie=import("./clip-inspect-DLJXVKV6-TNHTD4LV.js").catch(i=>{throw ie=null,i})),ie.catch(()=>null)}o(Qt,"He");var B,D=(B=class extends Error{constructor(e,t){super(t??e),this.kind=e}},o(B,"T"),B),Jt=100;function nt(i,e){return i.stats===void 0?!1:i.stats===null?!0:i.stats.durationMs<e-Jt}o(nt,"N");function ei(i,e){return i.stats?e.stats?i.stats.durationMs>e.stats.durationMs:!0:!1}o(ei,"Ee");var q,ti=(q=class{constructor(e={}){this.recorder=null,this.stream=null,this.chunks=[],this.bytes=0,this.hardStopTimer=null,this.graceTimer=null,this.pollTimer=null,this.settled=!1,this.now=e.now??(()=>globalThis.performance?.now?.()??Date.now())}clearTimers(){this.hardStopTimer&&clearTimeout(this.hardStopTimer),this.graceTimer&&clearTimeout(this.graceTimer),this.pollTimer&&clearInterval(this.pollTimer),this.hardStopTimer=null,this.graceTimer=null,this.pollTimer=null}record(e,t,r,s=pt,a){let n=zt(),l=Qt();return this.recordRaw(e,t,r,s,a,n).then(c=>ii(c,l),c=>{throw c instanceof D&&(c.requestedMimeType=n),c})}recordRaw(e,t,r,s,a,n){return this.recorder&&!this.settled?Promise.reject(new D("generic","record() called while a recording is in flight — ClipRecorder handles one recording at a time")):(this.recorder=null,this.clearTimers(),this.chunks=[],this.bytes=0,this.settled=!1,this.stream=e,new Promise((l,c)=>{let h;try{h=new MediaRecorder(e,n?{mimeType:n,videoBitsPerSecond:at}:{videoBitsPerSecond:at})}catch{try{h=new MediaRecorder(e)}catch{c(new D("unsupported"));return}}this.recorder=h;let d=o(g=>{this.settled||(this.settled=!0,this.clearTimers(),g())},"d"),u=o(()=>d(()=>{let g=Ht(h.mimeType||n||Fe),M=new Blob(this.chunks,{type:g});if(M.size===0){c(new D("generic","empty clip"));return}if(oe(M)){c(new D("cliptoolarge"));return}l({blob:M,mimeType:g,requestedMimeType:n})}),"u");h.ondataavailable=g=>{g.data&&g.data.size&&(this.chunks.push(g.data),this.bytes+=g.data.size,this.bytes>Be&&d(()=>{try{h.state!=="inactive"&&h.stop()}catch{}c(new D("cliptoolarge"))}))},h.onstop=u,h.onerror=()=>d(()=>c(new D("generic")));let m=this.now();if(r!==void 0||a!==void 0){let g=!1;h.onstart=()=>{if(!(g||this.settled)&&(g=!0,m=this.now(),r!==void 0))try{r()}catch{}}}try{h.start(Xt)}catch{d(()=>c(new D("generic")));return}let w=o(()=>{if(this.pollTimer&&clearInterval(this.pollTimer),this.pollTimer=null,this.hardStopTimer&&clearTimeout(this.hardStopTimer),this.hardStopTimer=null,this.settled||t?.(),h.state!=="inactive"){try{h.stop()}catch{u()}this.graceTimer=setTimeout(u,Zt)}else u()},"m"),p=this.now();if(a===void 0){this.hardStopTimer=setTimeout(w,s);return}let v=null,y=!1;this.hardStopTimer=setTimeout(w,s+jt),this.pollTimer=setInterval(()=>{if(this.settled||y)return;let g=null;try{g=a.latest()}catch{g=null}let M=g?.presentationTimeMs;M!==void 0&&Number.isFinite(M)&&M>=m&&v===null&&(v=M);let E=v!==null&&M!==void 0&&M-v>=s,A=v===null&&this.now()-p>=s;if(!(!E&&!A)){if(y=!0,this.pollTimer&&clearInterval(this.pollTimer),this.pollTimer=null,A){w();return}this.hardStopTimer&&clearTimeout(this.hardStopTimer),this.hardStopTimer=setTimeout(w,Vt)}},$t)}))}stop(e){this.clearTimers();let t=this.recorder;if(t&&t.state!=="inactive")try{t.stop()}catch{}this.recorder=null,(e??this.stream)?.getTracks().forEach(r=>r.stop()),this.stream=null}},o(q,"A"),q);async function ii(i,e){let t,r=new Promise(h=>{t=setTimeout(()=>h(null),Yt)}),s=await Promise.race([e,r]);if(clearTimeout(t),s===null)return i;let a;try{a=await s.blobBytes(i.blob)}catch{return{...i,stats:null}}let n=s.inspectClipBytes(a);if(n?.container!=="webm")return{...i,stats:n};let l=s.withWebmDuration(a,n.durationMs);if(l===null)return{...i,stats:n};let c=s.inspectClipBytes(l);return c===null||c.frames!==n.frames||c.durationMs!==n.durationMs?{...i,stats:n}:{...i,blob:new Blob([l],{type:i.blob.type}),stats:n}}o(ii,"Be");function ri(i,e,t=.92){return new Promise((r,s)=>{let a=i.videoWidth,n=i.videoHeight;if(!a||!n){s(new Error("video-not-ready"));return}let l=e.getContext("2d");if(!l){s(new Error("no-2d-context"));return}e.width=a,e.height=n,l.scale(-1,1),l.drawImage(i,-a,0),e.toBlob(c=>c?r(c):s(new Error("empty-keyframe")),"image/jpeg",t)})}o(ri,"Me");var W,si=(W=class{constructor(e){this.timer=null,this.frameCallbackId=null,this.running=!1,this.busy=!1,this.lastRunAt=Number.NEGATIVE_INFINITY,this.degradeCount=0,this.durations=[],this.options=e,this.periodMs=1e3/e.cadenceHz}start(){if(this.running)return;this.running=!0;let e=this.options.video;if(typeof e?.requestVideoFrameCallback=="function"){let t=o(()=>{this.running&&(this.frameCallbackId=e.requestVideoFrameCallback?.(()=>{this.frameCallbackId=null,this.now()-this.lastRunAt>=this.periodMs&&this.tick(),t()}))},"t");t();return}this.timer=setInterval(()=>this.tick(),this.periodMs)}stop(){this.running=!1,this.timer!==null&&(clearInterval(this.timer),this.timer=null),this.frameCallbackId!==null&&(this.options.video?.cancelVideoFrameCallback?.(this.frameCallbackId),this.frameCallbackId=null)}stats(){let e=this.durations.length===0?0:this.durations.reduce((t,r)=>t+r,0)/this.durations.length;return{degradeCount:this.degradeCount,meanDetectMs:e}}now(){return this.options.now?.()??performance.now()}tick(){if(!this.running)return;if(this.busy){this.degradeCount+=1;return}this.busy=!0,this.lastRunAt=this.now();let e=this.now();this.options.run().catch(()=>{}).finally(()=>{this.busy=!1,this.durations.push(this.now()-e),this.durations.length>20&&this.durations.shift()})}},o(W,"D"),W),ai=Object.freeze({Q_GOOD:.6,RISE_PER_S:.9,FALL_PER_S:.25,CENTER_FALLOFF_IOD_MULTIPLE:1.35,BOX_EYE_OFFSET_FACTOR:.12,IOD_BOX_PROXY_FACTOR:.42,SIZE_IDEAL_MIN:.12,SIZE_IDEAL_MAX:.3,SIZE_HARD_MIN:.08,SIZE_HARD_MAX:.45,ROLL_MAX_DEG:25,MOTION_VELOCITY_IOD_PER_S:.5,MOTION_TAU_S:.4,MOTION_DEADBAND_IOD_PER_S:.1,READY_WINDOW_MS:500,GUIDE_SIZE:.6,GUIDE_CENTERING:.6,GUIDE_POSE:.6,GUIDE_EXPOSURE:.6,GUIDE_SHARPNESS:.35,GUIDE_MOTION:.5}),L=o(i=>Math.min(1,Math.max(0,i)),"C"),z,ot=(z=class{constructor(e={}){this.p=0,this.lastTickAt=null,this.lastCenter=null,this.velocityEma=0,this.qWindow=[],this.lastSizeDirection="ideal",this.t={...ai,...e}}reset(){this.p=0,this.lastTickAt=null,this.lastCenter=null,this.velocityEma=0,this.qWindow=[],this.lastSizeDirection="ideal"}tick(e){let{observation:t,quality:r,timestampMs:s}=e,a=this.lastTickAt===null?0:Math.max(0,(s-this.lastTickAt)/1e3);this.lastTickAt=s;let n={presence:0,single:1,centering:0,size:0,pose:0,sharpness:L(r.sharpness),exposure:L(r.exposure),motion:1};if(t!==null){n.presence=1,n.single=(t.extraFaces??0)>0?0:1;let d=this.geometryOf(t,e);n.centering=d.centering,n.size=d.size,n.pose=d.pose,n.motion=this.motionOf(d.center,d.iod,s)}else this.lastCenter=null,this.velocityEma=0;let l=Math.min(n.presence,n.single,n.centering,n.size,n.pose,n.sharpness,n.exposure,n.motion);this.p=L(this.p+(l>=this.t.Q_GOOD?this.t.RISE_PER_S*l:-this.t.FALL_PER_S*(1-l))*a),this.qWindow.push({at:s,q:l}),this.qWindow=this.qWindow.filter(d=>d.at>=s-this.t.READY_WINDOW_MS);let c=this.qWindow.map(d=>d.q);if(c.length>=3){let d=Math.min(...c),u=c.indexOf(d);c=c.filter((m,w)=>w!==u)}let h=this.p>=1&&c.every(d=>d>=this.t.Q_GOOD);return{at:s,q:l,p:this.p,factors:n,guidanceKey:this.guidanceOf(n,r,l),ready:h,accepted:l>=this.t.Q_GOOD}}geometryOf(e,t){let{box:r,eyes:s}=e,a={x:t.frameWidth/2,y:t.frameHeight/2},n=Math.min(t.frameWidth,t.frameHeight),l=s!==void 0?{x:(s.left.x+s.right.x)/2,y:(s.left.y+s.right.y)/2}:{x:r.x+r.width/2,y:r.y+r.height/2-this.t.BOX_EYE_OFFSET_FACTOR*r.height},c=s!==void 0?Math.hypot(s.right.x-s.left.x,s.right.y-s.left.y):this.t.IOD_BOX_PROXY_FACTOR*r.width,h=Math.hypot(l.x-a.x,l.y-a.y),d=c<=0?0:1-L(h/(this.t.CENTER_FALLOFF_IOD_MULTIPLE*c)),u=n>0?c/n:0;this.lastSizeDirection=u<this.t.SIZE_IDEAL_MIN?"far":u>this.t.SIZE_IDEAL_MAX?"close":"ideal";let m;u<this.t.SIZE_HARD_MIN||u>this.t.SIZE_HARD_MAX?m=0:u<this.t.SIZE_IDEAL_MIN?m=(u-this.t.SIZE_HARD_MIN)/(this.t.SIZE_IDEAL_MIN-this.t.SIZE_HARD_MIN):u>this.t.SIZE_IDEAL_MAX?m=(this.t.SIZE_HARD_MAX-u)/(this.t.SIZE_HARD_MAX-this.t.SIZE_IDEAL_MAX):m=1;let w=1;if(s!==void 0){let p=Math.abs(Math.atan2(s.right.y-s.left.y,s.right.x-s.left.x))*180/Math.PI;w=1-L(p/this.t.ROLL_MAX_DEG)}return{center:l,iod:c,centering:d,size:m,pose:w}}motionOf(e,t,r){let s=this.lastCenter;if(this.lastCenter={...e,at:r},s===null||t<=0)return 1;let a=(r-s.at)/1e3;if(a<=0)return 1;let n=Math.hypot(e.x-s.x,e.y-s.y)/t/a;n<=this.t.MOTION_DEADBAND_IOD_PER_S&&(n=0);let l=1-Math.exp(-a/this.t.MOTION_TAU_S);return this.velocityEma=l*n+(1-l)*this.velocityEma,1-L(this.velocityEma/this.t.MOTION_VELOCITY_IOD_PER_S)}guidanceOf(e,t,r){if(e.presence<=0)return"fcv3.no_face";if(e.single<=0)return"fcv3.one_face";if(e.size<this.t.GUIDE_SIZE)return this.sizeGuidance();if(e.centering<this.t.GUIDE_CENTERING)return"fcv3.center_face";if(e.pose<this.t.GUIDE_POSE)return"fcv3.straighten";if(e.exposure<this.t.GUIDE_EXPOSURE)return this.exposureGuidance(t);if(e.sharpness<this.t.GUIDE_SHARPNESS)return"fcv3.steady_camera";if(e.motion<this.t.GUIDE_MOTION)return"fcv3.hold_still";if(r<this.t.Q_GOOD){let s=[["size",this.sizeGuidance()],["centering","fcv3.center_face"],["pose","fcv3.straighten"],["exposure",this.exposureGuidance(t)],["sharpness","fcv3.steady_camera"],["motion","fcv3.hold_still"]],a=s[0];for(let n of s)e[n[0]]<e[a[0]]&&(a=n);return a[1]}return"fcv3.hold_still"}sizeGuidance(){return this.lastSizeDirection==="far"?"fcv3.come_closer":"fcv3.move_back"}exposureGuidance(e){let t=(le[0]+le[1])/2;return e.meanLuma<t?"fcv3.more_light":"fcv3.too_bright"}},o(z,"_"),z),ni=["single","size","centering","pose","exposure","sharpness","motion"];function oi(i){if(i.accepted)return null;if(i.factors.presence<=0)return"no_face";let e="single";for(let t of ni)i.factors[t]<i.factors[e]&&(e=t);return e}o(oi,"ze");var H,lt=(H=class{constructor(){this.blocked={},this.acceptedMs=0,this.ticks=0,this.lastAt=null}record(e){let t=this.lastAt===null?0:Math.max(0,e.at-this.lastAt);this.lastAt=e.at,this.ticks+=1;let r=oi(e);if(r===null){this.acceptedMs+=t;return}let s=this.blocked[r]??{count:0,ms:0};s.count+=1,s.ms+=t,this.blocked[r]=s}summary(){let e={};for(let[t,r]of Object.entries(this.blocked))e[t]={count:r.count,ms:Math.round(r.ms)};return{blocked:e,acceptedMs:Math.round(this.acceptedMs),ticks:this.ticks}}},o(H,"w"),H),li=["obs","manycam","virtual","snap camera","xsplit","droidcam","iriun","camo","fake_device","fake-capture-device"],ci=[/^(front|back|rear)( [a-z ]+)? camera$/i,/^caméra (avant|arrière)\b/i,/^cámara (frontal|trasera|delantera)\b/i,/^câmera (frontal|traseira)\b/i,/^(front|rück)kamera\b/i,/^الكاميرا (الأمامية|الخلفية)/,/^camera2? ?\d+, facing (front|back|external)/i,/facetime/i,/\b(integrated|built-in|builtin) (web)?cam(era)?\b/i,/\b(hd )?web ?cam\b/i,/\([0-9a-f]{4}:[0-9a-f]{4}\)\s*$/i];function hi(i){let e=(i??"").trim().toLowerCase();return e.length===0?"unknown":li.some(t=>e.includes(t))?"known_virtual":ci.some(t=>t.test(e))?"platform":"unknown"}o(hi,"Qe");function ct(i){if(typeof i!="function")return!1;try{return/\{\s*\[native code\]\s*\}\s*$/.test(Function.prototype.toString.call(i))}catch{return!1}}o(ct,"Ce");function ui(i=globalThis){return ct(i.navigator?.mediaDevices?.getUserMedia)&&ct(i.MediaStreamTrack?.prototype?.getSettings)}o(ui,"Ye");async function di(i,e=globalThis){let t=e.crypto?.subtle?.digest;if(typeof t=="function")try{let r=new Uint8Array(await t.call(e.crypto?.subtle,"SHA-256",new TextEncoder().encode(i)));return Array.from(r.subarray(0,8),s=>s.toString(16).padStart(2,"0")).join("")}catch{return}}o(di,"je");async function fi(i,e=globalThis){let t={};try{t=typeof i.getSettings=="function"?i.getSettings()??{}:{}}catch{t={}}let r={};if((t.facingMode==="user"||t.facingMode==="environment"||t.facingMode==="left"||t.facingMode==="right")&&(r.facingMode=t.facingMode),typeof t.frameRate=="number"&&Number.isFinite(t.frameRate)&&(r.frameRate=t.frameRate),typeof t.width=="number"&&Number.isFinite(t.width)&&(r.width=t.width),typeof t.height=="number"&&Number.isFinite(t.height)&&(r.height=t.height),typeof t.deviceId=="string"&&t.deviceId.length>0){let a=await di(t.deviceId,e);a!==void 0&&(r.deviceIdHash=a)}let s;try{s=i.label}catch{s=void 0}return{trackSettings:r,capabilitiesPresent:typeof i.getCapabilities=="function",labelClass:hi(s),prototypesIntact:ui(e)}}o(fi,"Se");var fe=o(i=>Math.round(i*100)/100,"U");function pi(i){let e=i,t=typeof e?.requestVideoFrameCallback=="function",r=null,s=null,a=0,n=0,l=0,c=0,h=0,d=0,u=o(()=>{!t||e?.requestVideoFrameCallback===void 0||(r=e.requestVideoFrameCallback((m,w)=>{if(r=null,!t)return;let p=w.presentationTime;if(s!==null){let v=p-s.presentationTimeMs;n+=1;let y=v-l;l+=y/n,c+=y*(v-l)}typeof w.captureTime=="number"&&Number.isFinite(w.captureTime)&&(h+=p-w.captureTime,d+=1),a+=1,s={mediaTimeMs:w.mediaTime*1e3,presentationTimeMs:p},u()}))},"u");return u(),{latest:o(()=>s,"latest"),stats:o(()=>({n:a,meanGapMs:n===0?0:fe(l),stdGapMs:n<2?0:fe(Math.sqrt(c/(n-1))),captureLatencyMs:d===0?null:fe(h/d)}),"stats"),stop:o(()=>{t&&(t=!1,r!==null&&e?.cancelVideoFrameCallback?.(r),r=null)},"stop")}}o(pi,"ke");function mi(i,e,t){return{...i,rvfc:e,rampPainter:t}}o(mi,"_e");var gi=1e3,pe="fcv3.hold_upright",vi=200,me=4,yi=600,wi=1e3,ht={sharpness:1,exposure:1,meanLuma:128};function bi(i,e){return e.width=i.videoWidth,e.height=i.videoHeight,e.getContext("2d").drawImage(i,0,0),new Promise((t,r)=>e.toBlob(s=>s?t(s):r(new Error("empty-keyframe")),"image/jpeg",.92))}o(bi,"rt");function Mi(){return Q()==="phone"}o(Mi,"it");var K,mt=(K=class{constructor(e){this.handlers=new Map,this.stateValue="idle",this.attempt=0,this.stream=null,this.detector=null,this.scheduler=null,this.gate=null,this.profiler=null,this.lastGuidanceKey=null,this.positioningStartedAt=0,this.cameraRequestedAt=null,this.cameraReadyAt=null,this.faceAcquiredAt=null,this.captureCompleteAt=null,this.fired=!1,this.carriedDegrade=0,this.carriedMeans=[],this.blockStats=null,this.lastGateSnapshotAt=Number.NEGATIVE_INFINITY,this.uprightGuard=!1,this.trackProvenance=null,this.openEnvironment=null,this.ramp=null,this.snapshotCanvas=null,this.options=e,this.facing=e.facingMode??"user"}get state(){return this.stateValue}on(e,t){let r=this.handlers.get(e);return r||(r=new Set,this.handlers.set(e,r)),r.add(t),()=>r?.delete(t)}emit(e,t){for(let r of[...this.handlers.get(e)??[]])r(t)}async start(e={}){e.facingMode!==void 0&&(this.facing=e.facingMode),this.attempt+=1,await this.run(this.attempt)}get facingMode(){return this.facing}retry(){this.teardownAttempt(),this.start()}switchCamera(){this.facing=this.facing==="user"?"environment":"user",this.teardownAttempt(),this.start()}restart(e){this.facing=e,this.teardownAttempt(),this.start()}destroy(){this.attempt+=1,this.teardownAttempt(),this.detector?.destroy(),this.detector=null,this.options.video.srcObject=null}async run(e){let{options:t}=this;this.fired=!1,this.lastGuidanceKey=null,this.carriedDegrade=0,this.carriedMeans=[],this.cameraRequestedAt=null,this.cameraReadyAt=null,this.faceAcquiredAt=null,this.captureCompleteAt=null,this.uprightGuard=(t.isPhone??Mi)(),this.setState("preflight");let r=Ne();if(r!=="OK"){this.fail(r==="INSECURE_CONTEXT"?"insecure":"unsupported",{phase:"preflight"});return}this.setState("acquiring");let s=t.getUserMedia??(h=>navigator.mediaDevices.getUserMedia(h)),a;this.cameraRequestedAt=this.now();try{let{facingMode:h,...d}=Se(Ae(),this.facing).video;a=await Ke(this.facing,d,{getUserMedia:s,enumerateDevices:_i(t)})}catch(h){if(e!==this.attempt)return;if(h instanceof He){this.fail("backcamera",{phase:"acquiring",name:j(h)});return}this.fail(We(h),{phase:"acquiring",name:j(h)});return}if(Re(a),ze(a),e!==this.attempt){for(let h of a.getTracks())h.stop();return}this.stream=a;let n=a.getVideoTracks?.()[0];if(this.trackProvenance=n===void 0?null:fi(n).catch(()=>null),this.openEnvironment=n===void 0?null:xe(n).catch(()=>({})),this.facing=Ie(a)??this.facing,t.video.srcObject=a,await t.video.play().catch(()=>{}),e!==this.attempt)return;if(this.cameraReadyAt=this.now(),this.detector===null){let h={v3AssetBaseUrl:t.v3AssetBaseUrl},d=t.createDetector??(t.createWorker!==void 0&&it()?async()=>{try{return await rt.create(t.createWorker(),h)}catch{return x(h)}}:()=>x(h)),u;try{u=await d()}catch(m){e===this.attempt&&this.fail("models",{phase:"models",name:j(m)},m instanceof de?m.fallbackReason:Ti(m));return}if(e!==this.attempt){u.destroy();return}this.detector=u,this.options.telemetry?.({type:"detector",tier:u.tier,fallbackReason:u.fallbackReason})}let l=Xe(),c=t.deviceClass??Ze(l);this.profiler=new Ve(c),this.options.telemetry?.({type:"profile",staticClass:c,activeClass:this.profiler.deviceClass,simd:l.simd}),this.gate=new ot(t.thresholds??{}),this.blockStats=new lt,this.lastGateSnapshotAt=this.now(),t.rankKeyframes?.()&&import("./keyframe-rank-YAJLYJYF-WCA6RPMD.js").then(h=>ge=h,()=>{}),this.setState("positioning"),this.positioningStartedAt=this.now(),this.startScheduler(e)}get animations(){return this.profiler?.profile.animations??"full"}startScheduler(e){let t=this.profiler;if(t===null)return;if(this.scheduler!==null){let s=this.scheduler.stats();this.carriedDegrade+=s.degradeCount,s.meanDetectMs>0&&this.carriedMeans.push(s.meanDetectMs),this.scheduler.stop()}let r=new si({cadenceHz:t.profile.cadenceHz,video:this.options.video,now:this.options.now,run:o(()=>this.detectTick(e),"run")});this.scheduler=r,r.start()}async detectTick(e){let{detector:t,gate:r,profiler:s}=this,a=this.options.video;if(e!==this.attempt||t===null||r===null||s===null||this.fired||a.videoWidth===0)return;if(this.isLandscape()){this.holdUpright(e);return}let n=s.deviceClass,l=this.now(),c=this.options.makeSnapshot?.(a,s.profile.inputWidth)??this.defaultSnapshot(a,s.profile.inputWidth),h=null;try{h=await t.detect(c,a.videoWidth,a.videoHeight)}catch{h=null}if(e!==this.attempt||this.fired)return;s.record(this.now()-l),s.deviceClass!==n&&this.startScheduler(e);let d=h===null?ht:this.options.measureQuality?.(a,h.box)??this.defaultQuality(a,h.box),u=r.tick({timestampMs:this.now(),observation:h,quality:d,frameWidth:a.videoWidth,frameHeight:a.videoHeight});u.accepted&&this.faceAcquiredAt===null&&(this.faceAcquiredAt=u.at),this.blockStats?.record(u),!u.ready&&u.at-this.lastGateSnapshotAt>=gi&&(this.lastGateSnapshotAt=u.at,this.reportGate(!1)),this.emit("checks",{engine:"v3",progress:u.p,q:u.q,factors:u.factors,attempt:e}),u.guidanceKey!==this.lastGuidanceKey&&(this.lastGuidanceKey=u.guidanceKey,this.emit("guidance",{key:u.guidanceKey})),u.ready&&this.stateValue==="positioning"&&(this.fired=!0,this.captureCompleteAt=u.at,this.fire(e))}async fire(e){let{options:t}=this,r=this.scheduler;r?.stop(),this.reportGate(!0);let s=r?.stats()??{degradeCount:0,meanDetectMs:0},a=[...this.carriedMeans,...s.meanDetectMs>0?[s.meanDetectMs]:[]];t.telemetry?.({type:"fired",timeToGateMs:this.now()-this.positioningStartedAt,degradeCount:this.carriedDegrade+s.degradeCount,meanDetectMs:a.length===0?0:a.reduce((_,b)=>_+b,0)/a.length});let n=t.mode??"clip",l=t.rankKeyframes?.()&&ge?ge.default(this,e).catch(()=>this.collectKeyframes(e)):this.collectKeyframes(e);if(n==="photo"){let _=this.watchRotation(e,null),b=await l;if(_(),e!==this.attempt)return;if(b===null){this.fail("generic",{phase:"keyframes"});return}let R=await this.provenance({n:0,meanGapMs:0,stdGapMs:0,captureLatencyMs:null},!1);if(e!==this.attempt)return;this.finishCapture({keyframe:b.blob,previewDataUrl:b.previewDataUrl,...R});return}this.setState("recording");let c=this.stream;if(c===null){this.fail("generic",{phase:"recording"});return}let h=t.screenRamp?.(),d=ee(h),u=null;l.then(_=>{u=_},()=>{});let m=o(()=>{e===this.attempt&&u!==null&&this.emit("frozen",{previewDataUrl:u.previewDataUrl})},"p"),w=Ye(h,pt),p=null,v,y=0;try{let _=this.recordTake(e,c,h,w,void 0).then(S=>S,S=>({failed:S})),[b,R]=await Promise.all([_,l]);if(v=R,e!==this.attempt)return;if("failed"in b){if(b.failed.kind==="cliptoolarge")throw b.failed;st(b.failed.requestedMimeType??"")}else p=b,nt(b.clip,w)?b.clip.stats===null&&st(b.clip.requestedMimeType??""):m();if(p===null||nt(p.clip,w)){y=1,t.telemetry?.({type:"clip_retake",reason:p===null?"error":p.clip.stats===null?"unreadable":"short"});let S=null;try{S=await this.recordTake(e,c,h,w,m)}catch($){if(p===null)throw $}if(e!==this.attempt)return;S!==null&&(p===null||ei(S.clip,p.clip))&&(p=S),S===null&&m()}}catch(_){if(e!==this.attempt)return;let b=_.kind;this.fail(b==="cliptoolarge"?"cliptoolarge":"recorder",{phase:"recording",name:j(_)});return}if(p===null){this.fail("recorder",{phase:"recording"});return}let{clip:g,rvfc:M,report:E,watched:A}=p;if(oe(g.blob)){this.fail("cliptoolarge",{phase:"recording"});return}if(v===null){this.fail("generic",{phase:"keyframes"});return}let I=await this.provenance(M,d,A);e===this.attempt&&this.finishCapture({clip:g.blob,clipMimeType:g.mimeType,...g.stats?{clipStats:g.stats}:{},clipRetakes:y,keyframe:v.blob,previewDataUrl:v.previewDataUrl,...E!==void 0&&E.rendered.length>0?{screenRamp:E}:{},...I})}async recordTake(e,t,r,s,a){let n=this.options.createRecorder?.()??new ti({now:o(()=>this.now(),"now")}),l=pi(this.options.video),c=Qe(r,{paint:o(m=>{(m===null||e===this.attempt)&&this.emit("ramp",{colour:m})},"paint"),now:o(()=>this.now(),"now"),frames:l.latest});this.ramp=c;let h=o(()=>{l.stop(),c.stop(),this.ramp===c&&(this.ramp=null)},"l"),d=this.watchRotation(e,n),u=De();try{return{clip:await n.record(t,a,()=>c.started(this.now()),s,l),rvfc:l.stats(),report:c.report(),watched:u.stop()}}finally{u.stop(),d(),h()}}async provenance(e,t,r={}){let s=this.trackProvenance;if(s===null)return{};let a,n=new Promise(d=>{a=setTimeout(()=>d(null),wi)}),l=await Promise.race([s,n]),c=l===null?null:await Promise.race([this.openEnvironment,n]);if(clearTimeout(a),l===null)return{};let h={...c,...r};return{provenance:{...mi(l,e,t),...Object.keys(h).length>0?{env:h}:{}}}}isLandscape(){let e=this.options.video;return this.uprightGuard&&e.videoWidth>e.videoHeight}holdUpright(e){this.gate?.reset(),this.emit("checks",{engine:"v3",progress:0,q:0,factors:{presence:0,single:1,centering:0,size:0,pose:0,sharpness:0,exposure:0,motion:0},attempt:e}),this.lastGuidanceKey!==pe&&(this.lastGuidanceKey=pe,this.emit("guidance",{key:pe}))}watchRotation(e,t){if(!this.uprightGuard)return()=>{};let r=this.options.video,s=o(()=>{if(e!==this.attempt||t!==null&&this.stateValue!=="recording"){l();return}r.videoWidth>0&&this.isLandscape()&&(l(),this.abortRecording(e,t))},"i"),a=setInterval(s,vi);r.addEventListener?.("resize",s);let n=!1;function l(){n||(n=!0,clearInterval(a),r.removeEventListener?.("resize",s))}return o(l,"o"),l}abortRecording(e,t){if(e!==this.attempt)return;this.attempt+=1;let r=this.attempt;try{t?.stop()}catch{}this.ramp?.stop(),this.ramp=null,this.fired=!1,this.captureCompleteAt=null,this.gate=new ot(this.options.thresholds??{}),this.blockStats=new lt,this.lastGateSnapshotAt=this.now(),this.lastGuidanceKey=null,this.setState("positioning"),this.positioningStartedAt=this.now(),this.holdUpright(r),this.startScheduler(r)}async collectKeyframes(e){let t=this.options.captureKeyframe??(a=>this.defaultKeyframe(a)),r=yi/(me-1),s=null;for(let a=0;a<me;a+=1){if(e!==this.attempt)return s;try{let n=await t(this.options.video);(s===null||n.sharpness>s.sharpness)&&(s=n)}catch{}a<me-1&&await ki(r)}return s}finishCapture(e){this.stopTracks(),this.setState("captured");let t=this.captureTiming();this.emit("artifacts",t===void 0?e:{...e,timing:t})}captureTiming(){let e={},t=o((r,s,a)=>{s!==null&&a!==null&&(e[r]=Math.max(0,Math.round(a-s)))},"t");return t("cameraReadyMs",this.cameraRequestedAt,this.cameraReadyAt),t("faceAcquireMs",this.cameraReadyAt,this.faceAcquiredAt),t("captureMs",this.faceAcquiredAt,this.captureCompleteAt),Object.keys(e).length>0?e:void 0}async defaultKeyframe(e){let t=document.createElement("canvas"),r=await(this.facing==="user"?ri:bi)(e,t),s=t.toDataURL("image/jpeg",.92);return{blob:r,previewDataUrl:s,sharpness:this.centerSharpness(e)}}defaultSnapshot(e,t){try{let r=this.snapshotCanvas??document.createElement("canvas"),s=t/Math.max(1,e.videoWidth),a=Math.max(1,Math.round(e.videoWidth*s)),n=Math.max(1,Math.round(e.videoHeight*s)),l=r.getContext("2d");return l===null?e:(r.width!==a&&(r.width=a),r.height!==n&&(r.height=n),l.drawImage(e,0,0,a,n),this.snapshotCanvas=r,r)}catch{return e}}defaultQuality(e,t){let r=ut(e,t,96);return r===null?ht:{sharpness:ce(r),exposure:$e(r),meanLuma:je(r)}}centerSharpness(e){let t=te(e),r=ut(e,{x:t.width*.25,y:t.height*.25,width:t.width*.5,height:t.height*.5},96);return r===null?0:ce(r)}teardownAttempt(){this.scheduler?.stop(),this.scheduler=null,this.reportGate(!0),this.gate=null,this.ramp?.stop(),this.ramp=null,this.stopTracks()}reportGate(e){let t=this.blockStats,r=this.profiler;if(t===null||r===null)return;let s=t.summary();e&&(this.blockStats=null),s.ticks!==0&&this.options.telemetry?.({type:"gate",final:e,activeClass:r.deviceClass,cadenceHz:r.profile.cadenceHz,...s})}stopTracks(){if(this.stream!==null){for(let e of this.stream.getTracks())e.stop();this.stream=null}}fail(e,t,r){this.scheduler?.stop(),this.reportGate(!0),this.stopTracks(),this.setState("error"),this.options.telemetry?.({type:"error",kind:e,fallbackReason:r});let{phase:s,name:a}=t;this.emit("error",{kind:e,retryable:e!=="insecure"&&e!=="unsupported",detail:a===void 0?{phase:s}:{phase:s,name:a}})}setState(e){this.stateValue=e,this.emit("statechange",{state:e})}now(){return this.options.now?.()??performance.now()}},o(K,"Ie"),K),ge;function ki(i){return new Promise(e=>setTimeout(e,i))}o(ki,"nt");function Ti(i){return i instanceof Error?i.message:String(i)}o(Ti,"at");function ut(i,e,t){try{let r=document.createElement("canvas"),s=t/Math.max(1,e.width);r.width=Math.max(1,Math.round(e.width*s)),r.height=Math.max(1,Math.round(e.height*s));let a=r.getContext("2d");return a===null?null:(a.drawImage(i,e.x,e.y,e.width,e.height,0,0,r.width,r.height),a.getImageData(0,0,r.width,r.height))}catch{return null}}o(ut,"Re");function _i(i){if(i.enumerateDevices!==void 0)return i.enumerateDevices;if(i.getUserMedia===void 0&&!(typeof navigator>"u"||typeof navigator.mediaDevices?.enumerateDevices!="function"))return()=>navigator.mediaDevices.enumerateDevices()}o(_i,"st");var Ei=12e4,gt=13e4,Si=3e3,Ai=1200,ve=Symbol.for("@sekyro/web.preload.v1");function we(){let i=globalThis;return i[ve]??(i[ve]=new Map),i[ve]}o(we,"h");function re(i){let e=(i??ue).replace(/\/+$/,"");return e===""?"/":e}o(re,"b");function yt(i){let e=we(),t=e.get(i);return t===void 0&&(t={status:"idle",promise:null,scheduled:null,detectorPromise:null,detector:null,listeners:new Set},e.set(i,t)),t}o(yt,"ae");function ye(i,e){if(i.status!==e){i.status=e;for(let t of[...i.listeners])t(e)}}o(ye,"k");var Ii=o(i=>x({preferred:["blaze"],v3AssetBaseUrl:i,blazeInitTimeoutMs:Ei}),"K"),xi=Ii;function Di(){return typeof window<"u"&&typeof navigator<"u"&&typeof navigator.mediaDevices?.getUserMedia=="function"}o(Di,"Ce");function Ri(){return navigator.connection?.saveData===!0}o(Ri,"Se");function Ci(i){let e=window;if(typeof e.requestIdleCallback=="function"){let r=e.requestIdleCallback(i,{timeout:Si});return()=>e.cancelIdleCallback?.(r)}let t=setTimeout(i,Ai);return()=>clearTimeout(t)}o(Ci,"Ee");function Oi(i,e){let t,r=new Promise(l=>{t=l}),s=!1,a=o(()=>{},"u"),n={promise:r,settle:o(l=>{s||(s=!0,a(),i.scheduled===n&&(i.scheduled=null),t(l))},"settle")};return i.scheduled=n,a=Ci(()=>{s||n.settle(be(i,e))}),r}o(Oi,"ye");function be(i,e){if((i.status==="loading"||i.status==="ready")&&i.promise!==null)return i.promise;ye(i,"loading");let t=new Promise(n=>n(xi(e)));i.detectorPromise=t;let r,s=new Promise((n,l)=>{r=setTimeout(()=>{t.then(c=>c.destroy(),()=>{}),l(new Error(`detector preload exceeded ${gt} ms`))},gt)}),a=Promise.race([t,s]).then(n=>i.detectorPromise!==t?(n.destroy(),i.status):(i.detector=n,ye(i,"ready"),"ready"),n=>(i.detectorPromise===t&&(i.detectorPromise=null,i.detector=null,ye(i,"failed"),console.warn("[@sekyro/web] face-detector preload failed:",n)),i.status)).finally(()=>clearTimeout(r));return i.promise=a,i.scheduled?.settle(a),a}o(be,"U");function hr(i={}){if(!Di())return Promise.resolve("idle");let e=re(i.assetBaseUrl),t=yt(e);return i.respectSaveData===!0&&Ri()?Promise.resolve(t.status):(t.status==="loading"||t.status==="ready")&&t.promise!==null?t.promise:i.idle===!0?t.scheduled?.promise??Oi(t,e):be(t,e)}o(hr,"xe");function ur(i){return we().get(re(i))?.status??"idle"}o(ur,"Fe");function dr(i,e){let t=yt(re(e));return t.listeners.add(i),()=>{t.listeners.delete(i)}}o(dr,"Ie");function Pi(i){return{get tier(){return i.tier},get fallbackReason(){return i.fallbackReason},detect:o((...e)=>i.detect(...e),"detect"),destroy:o(()=>{},"destroy")}}o(Pi,"Le");function Gi(i){let e=re(i),t=we().get(e);if(!(t===void 0||t.detector===null&&t.detectorPromise===null&&t.scheduled===null))return async()=>{t.scheduled!==null&&be(t,e);let r=t.promise;for(;t.detector===null&&r!==null&&(await r,t.promise!==r);)r=t.promise;return t.detector!==null?Pi(t.detector):x({v3AssetBaseUrl:e})}}o(Gi,"de");var Ui=new Set(["inuse","overconstrained","notfound"]),Fi=[500,1500];function Ni(i){switch(i){case"fcv3.no_face":case"fcv3.center_face":case"fcv3.straighten":return"center";case"fcv3.come_closer":return"closer";case"fcv3.move_back":return"farther";case"fcv3.more_light":case"fcv3.too_bright":return"light";case"fcv3.hold_still":case"fcv3.steady_camera":return"still";case"fcv3.hold_upright":return"upright";case"fcv3.one_face":return"one_face";default:return null}}o(Ni,"Ae");function Li(i){switch(i){case"preflight":case"acquiring":return"starting";case"positioning":return"gating";default:return i}}o(Li,"Pe");function vt(i){switch(i){case"permission":case"notfound":case"inuse":case"insecure":case"unsupported":return i;case"backcamera":return"notfound";default:{let e=i;return"generic"}}}o(vt,"ue");function Bi(i,e,t){if(t===void 0)return{kind:vt(i),retryable:e};let r=qe(t.name);return{kind:vt(i),retryable:e,detail:{...r!==void 0?{name:r}:{},phase:t.phase,engineKind:i}}}o(Bi,"we");var qi=new Set(["captured","uploading","checking"]);function Wi(i,e={},t,r=()=>"self",s=()=>{},a){let n=e.now??(()=>performance.now()),l=e.canChooseFacing??Oe,c="user",h=Pe(),d=r(),u=Ce(),m=!Le(),w=e.engineOptions,p=w?.createDetector===void 0&&w?.createWorker===void 0?{createDetector:o(()=>{let f=Gi(i.assetBaseUrl);return f!==void 0?f():x({v3AssetBaseUrl:i.assetBaseUrl})},"createDetector")}:{},v={video:i.video,mode:m?"photo":"clip",rankKeyframes:t,facingMode:void 0,v3AssetBaseUrl:i.assetBaseUrl,screenRamp:o(()=>d==="self"&&u.count("ramp")>0?s():void 0,"screenRamp"),...e.engineOptions??{},...p},y=e.createEngine?.(v)??new mt(v),g="idle",M=null,E=0,A=!1,I="full",_=null,b=null,R=0,S=0,$=o(()=>{i.video.videoWidth>0&&i.video.videoHeight>0&&(R=i.video.videoWidth,S=i.video.videoHeight)},"W"),Me=Ge({enabled:i.keepScreenAwake!==!1}),X=o(f=>{g=f,Me.setActive(f==="starting"||f==="gating"||f==="recording"),u.emit("state",f)},"S"),se=o(()=>u.emit("gate",{progress:E,hint:M,faceDetected:A}),"F"),ae=o(()=>{let f=y.animations??"full";f!==I&&(I=f,u.emit("profile",{animations:I}))},"I"),G=0,Y=null,wt=e.schedule??((f,k)=>{let T=setTimeout(f,k);return()=>clearTimeout(T)}),Z=o(()=>{Y?.(),Y=null},"E"),bt=o((f,k)=>{if(V||!Ui.has(f)||k?.phase!=="acquiring")return!1;let T=Fi[G];return T===void 0?!1:(G+=1,Z(),Y=wt(()=>{Y=null,V||y.retry()},T),!0)},"fe"),Mt=[y.on("statechange",({state:f})=>{if(f==="error")return;let k=Li(f);k==="gating"&&(G=0),k==="starting"&&g!=="starting"&&(M=null,E=0,A=!1,_=null,b=null,R=0,S=0),X(k),ae(),k==="recording"&&($(),_=n(),M="hold",E=1,se())}),y.on("checks",f=>{$(),E=f.progress,A=f.factors.presence>0,se(),ae()}),y.on("guidance",({key:f})=>{M=Ni(f),se()}),y.on("frozen",({previewDataUrl:f})=>{b=n(),u.emit("frozen",{previewDataUrl:f})}),y.on("ramp",f=>u.emit("ramp",f)),y.on("artifacts",f=>{if(g!=="captured")return;let k=Q(),T=f.clipStats,_e=T!==void 0?Math.round(T.durationMs):_!==null&&b!==null?Math.max(0,Math.round(b-_)):void 0,Ee=T!==void 0&&T.frames>1&&T.durationMs>0?Math.round(T.frames*1e4/T.durationMs)/10:void 0;u.emit("captured",{keyframe:f.keyframe,...f.clip!==void 0?{clip:f.clip}:{},...f.clipMimeType!==void 0?{clipMime:f.clipMimeType}:{},width:i.video.videoWidth||R,height:i.video.videoHeight||S,..._e!==void 0?{clipMs:_e}:{},...T!==void 0?{clipFrames:T.frames}:{},...Ee!==void 0?{fps:Ee}:{},...f.clipRetakes!==void 0?{clipRetakes:f.clipRetakes}:{},...f.clipMimeType!==void 0?{codec:ft(f.clipMimeType)}:{},captureChannel:k==="desktop"?"desktop":"mobile",formFactor:k,...m?{degraded:"NO_RECORDER"}:{},engine:"v3",facingMode:y.facingMode,mode:d,...f.timing,...f.screenRamp!==void 0?{screenRamp:f.screenRamp}:{},...f.provenance!==void 0?{provenance:f.provenance}:{}})}),y.on("error",({kind:f,retryable:k,detail:T})=>{f==="backcamera"&&kt()||bt(f,T)||(X("error"),ae(),u.emit("error",Bi(f,k,T)))})],ke=!1;function kt(){return V||ke||d!=="assisted"||a===void 0||a.session()!=="choice"?!1:(ke=!0,a.onModeChange("self"),d="self",c=ne("self"),X("mode_switch"),y.restart(c),!0)}o(kt,"me");let Te=o(async()=>a!==void 0&&a.session()==="choice"&&await l().catch(()=>!1),"$"),V=!1;return{handle:{get state(){return g},get captureMode(){return r()},get facingMode(){return y.facingMode??c},on:o((f,k)=>u.on(f,k),"on"),start:o(f=>(d=r(),h.facing(d,i.facing),c=h.facing(d,f?.facing),Z(),G=0,y.start({facingMode:c})),"start"),retry:o(()=>{Z(),G=0,y.retry()},"retry"),switchCamera:o(()=>h.refuseSwitch(r()),"switchCamera"),canSwitchCaptureMode:Te,setCaptureMode:o(async f=>{if(f===r()||!await Te()||V||qi.has(g)||a===void 0)return!1;a.onModeChange(f),d=f;let k=ne(f);return c=k,g==="idle"||(X("mode_switch"),Z(),G=0,y.restart(k)),!0},"setCaptureMode"),destroy:o(()=>{V=!0,Z();for(let f of Mt)f();Me.setActive(!1),y.destroy(),u.clear()},"destroy")},setFlowState:o(f=>{g!==f&&X(f)},"setFlowState")}}o(Wi,"De");function fr(i){return Wi(i).handle}o(fr,"Ze");export{zi as a,ee as b,hr as c,ur as d,dr as e,Bi as f,Wi as g,fr as h};
@@ -1 +1 @@
1
- import{b as M}from"./chunk-EWTKC2C2.js";import{a as u}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),c=(t.x2-t.x1)*(t.y2-t.y1),d=(s.x2-s.x1)*(s.y2-s.y1),p=c+d-_;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,c=x(s.sharpness)>=this.t.GUIDE_SHARPNESS,d=_&&c;if(l&&d&&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&&d;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(_)c?f="dcv1.hold_still":f="dcv1.steady";else{let m=(u[0]+u[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{d as M}from"./chunk-37BKUH3E.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};
@@ -0,0 +1 @@
1
+ import{l as p}from"./chunk-JS2IXPNL.js";import{a as n}from"./chunk-4FHWXBOB.js";function U(e,r){return{video:{width:{ideal:1280,max:1280},height:{ideal:720,max:720},facingMode:r,frameRate:{ideal:24,max:30}},audio:!1}}n(U,"c");var P=600;function A(){if(typeof window>"u"||typeof navigator>"u")return"desktop";let e=navigator.userAgentData,r=e?.mobile||/Android|i(Pad)?OS/.test(String(e?.platform)),t=String(navigator.userAgent??"");if(/iPhone|iPod/i.test(t))return"phone";if(/iPad/i.test(t))return"tablet";if(/Android/i.test(t))return/Mobile/i.test(t)?"phone":"tablet";if(/BlackBerry|IEMobile|Opera Mini/i.test(t))return"phone";if(!r){if(Number(navigator.maxTouchPoints??0)<=1)return"desktop";if(/Macintosh/.test(t))return"tablet";if(/Windows NT|CrOS/.test(t)||!T())return"desktop"}let i=L();return i>0&&i<P?"phone":"tablet"}n(A,"i");function q(){return A()!=="desktop"}n(q,"u");function L(){try{let e=window.screen,r=Number(e?.width??0),t=Number(e?.height??0);return r>0&&t>0?Math.min(r,t):0}catch{return 0}}n(L,"a");function w(e){try{let r=e?.getVideoTracks?.()[0]?.getSettings?.().facingMode;return r==="user"||r==="environment"?r:null}catch{return null}}n(w,"d");function T(){try{return typeof window.matchMedia=="function"&&window.matchMedia("(pointer: coarse)").matches}catch{return!1}}n(T,"s");function B(){let e=new Map;return{on(r,t){let i=e.get(r);i===void 0&&(i=new Set,e.set(r,i));let a=t;return i.add(a),()=>{i?.delete(a)}},emit(r,t){let i=e.get(r);if(i!==void 0)for(let a of[...i])a(t)},count(r){return e.get(r)?.size??0},clear(){e.clear()}}}n(B,"y");async function M(){try{return typeof navigator>"u"||typeof navigator.permissions?.query!="function"?null:await navigator.permissions.query({name:"camera"})}catch{return null}}n(M,"f");function m(e){return e==="granted"||e==="prompt"||e==="denied"?e:"unknown"}n(m,"c");async function O(){let e=await M();return e===null?"unknown":m(e.state)}n(O,"k");function I(e){let r=!1,t=null,i=n(()=>{!r&&t!==null&&e(m(t.state))},"t");return M().then(a=>{r||(t=a,e(a===null?"unknown":m(a.state)),a?.addEventListener?.("change",i))}),()=>{r=!0,t?.removeEventListener?.("change",i)}}n(I,"w");async function z(){if(typeof navigator>"u")return!1;let e=String(navigator.userAgent??"");if(/Android|iPhone|iPad|iPod/i.test(e)||/Macintosh/.test(e)&&(navigator.maxTouchPoints??0)>1)return!0;try{return(await navigator.mediaDevices?.enumerateDevices?.()??[]).filter(r=>r.kind==="videoinput").length>=2}catch{return!1}}n(z,"b");var D=n(e=>e==="self"?"user":"environment","h");function R(){let e=!1,r=n(i=>{e||(e=!0,console.warn(`[@sekyro/web] ${i}`))},"i"),t=n(i=>i==="self"?"this capture is a self capture (the person films themselves), which uses the front camera only. The back camera is for assisted capture, set in the flow.":"this capture is an assisted capture (another person films the face), which uses the back camera only. The front camera is for self capture, set in the flow.","n");return{facing:n((i,a)=>{let s=D(i);return a!==void 0&&a!==s&&r(`facing "${a}" ignored: ${t(i)}`),s},"facing"),refuseSwitch:n(i=>(r(`switchCamera() ignored: ${t(i)}`),!1),"refuseSwitch")}}n(R,"S");function y(){if(typeof navigator>"u"||!("wakeLock"in navigator))return null;let e=navigator.wakeLock;return typeof e?.request=="function"?e:null}n(y,"v");function b(){return typeof document>"u"||document.visibilityState==="visible"}n(b,"m");function k(e){try{e.release().catch(()=>{})}catch{}}n(k,"p");function V(e={}){if(e.enabled===!1)return{setActive:n(()=>{},"setActive")};let r=!1,t=null,i=!1,a=!1,s=n(()=>{if(!r||i||t!==null&&!t.released)return;let u=y();if(u===null||!b())return;let c;try{c=u.request("screen")}catch{return}i=!0,c.then(o=>{if(i=!1,!r){k(o);return}t=o,o.addEventListener?.("release",()=>{t===o&&(t=null)})},()=>{i=!1})},"o"),f=n(()=>{b()&&s()},"l"),d=n(u=>{typeof document>"u"||u===a||(a=u,u?document.addEventListener("visibilitychange",f):document.removeEventListener("visibilitychange",f))},"d");return{setActive:n(u=>{if(r=u,u){if(y()===null)return;d(!0),s();return}if(d(!1),t!==null){let c=t;t=null,k(c)}},"setActive")}}n(V,"P");var l,N=(l=class extends Error{constructor(){super("the back camera could not be opened"),this.name="BackCameraUnavailableError"}},n(l,"u"),l),S=new Set(["NotAllowedError","PermissionDeniedError","SecurityError"]);function x(e){try{return String(e?.name??"")}catch{return""}}n(x,"h");function g(e){if(e!==null)for(let r of e.getTracks())r.stop()}n(g,"c");async function J(e,r,t){let i=n(o=>({video:{...r,...o},audio:!1}),"a");if(e==="user")return t.getUserMedia(i({facingMode:"user"}));let a=n(o=>w(o)!=="user","o");try{let o=await t.getUserMedia(i({facingMode:{exact:"environment"}}));if(a(o))return o;g(o)}catch(o){if(S.has(x(o)))throw o}let s=!1,f=n(async()=>{if(t.enumerateDevices===void 0||s)return null;let o;try{o=p(await t.enumerateDevices()).slice(0,3)}catch{return null}s=o.length>0;for(let E of o){let h;try{h=await t.getUserMedia(i({deviceId:{exact:E}}))}catch(v){if(S.has(x(v)))throw v;continue}if(a(h))return h;g(h)}return null},"l"),d=await f();if(d!==null)return d;let u=await t.getUserMedia(i({facingMode:"environment"}));if(a(u))return u;g(u);let c=await f();if(c!==null)return c;throw new N}n(J,"C");export{U as a,A as b,q as c,w as d,B as e,O as f,I as g,z as h,D as i,R as j,V as k,N as l,J as m};
@@ -0,0 +1,3 @@
1
+ import{B as vt,C as gt,D as _t,I as Ae,J as pe,K as bt,L as wt,M as kt,a as D,b as ce,c as ot,d as st,g as lt,h as ut,i as ct,j as dt,k as we,l as pt,n as V,p as N,q as U,r as Y,s as de,t as P,u as ke,w as ft,x as mt,y as ht,z as yt}from"./chunk-44UA2IDQ.js";import{g as Mt}from"./chunk-5OPKZZON.js";import{b as at}from"./chunk-EGCT7K5E.js";import{b as it,c as be,e as At}from"./chunk-6MYG4HWP.js";import{a as t}from"./chunk-4FHWXBOB.js";var rn={hiddenMs:t(()=>0,"hiddenMs"),hiddenNow:t(()=>!1,"hiddenNow"),stop:t(()=>{},"stop")};function an(n=Date.now){if(typeof document>"u"||typeof document.addEventListener!="function")return rn;let o=t(()=>document.visibilityState==="hidden","t"),f=0,c=o()?n():null,k=t(()=>{o()?c??(c=n()):c!==null&&(f+=Math.max(0,n()-c),c=null)},"r");return document.addEventListener("visibilitychange",k),{hiddenMs:t(()=>Math.round(f+(c!==null?Math.max(0,n()-c):0)),"hiddenMs"),hiddenNow:o,stop:t(()=>document.removeEventListener("visibilitychange",k),"stop")}}t(an,"Ft");function on(n){let o=n.now??(()=>Date.now()),f=n.setTimer??((w,A)=>setTimeout(w,A)),c=n.clearTimer??(w=>clearTimeout(w)),k=null,C=!1,Q=!1,L=!1,h=0,x=null,q=t(()=>{x!==null&&c(x),x=null},"w"),X=t(()=>{let w=n.armRamp;w===void 0||C||Q||L||o()<h||(C=!0,w().catch(()=>{}).then(A=>{if(C=!1,!L){if(A===void 0){h=o()+2e3;return}if(A.challenge===void 0){Q=!0;return}k={challenge:A.challenge,expiresAt:A.expiresAt},q(),x=f(()=>{x=null,!L&&k!==null&&n.waiting()&&X()},Math.max(1e3,A.expiresAt-o()-2e4))}}))},"E");return{arm(){k!==null&&k.expiresAt-o()>2e4||X()},take(){let w=k;return k=null,q(),w!==null&&w.expiresAt-o()>=12e3?w.challenge:void 0},stop(){L=!0,k=null,q()}}}t(on,"Ht");function sn(n){return n.idNumberBound??n.nniBound}t(sn,"ke");function Ct(n){return n===void 0?void 0:n.idNumberFromDocument??n.nniFromDocument}t(Ct,"ae");var xt="https://api.sekyro.ai",ln=5e3,un=24e4,Tt=3e4,cn=15e4,Et=9e4;function St(n,o){return n==="portrait_icao"||n==="poa"||n==="doc_ocr"&&o.source==="upload"?Et:Tt}t(St,"Dt");var dn=25*6e4,pn=30*6e4,Wn=20*6e4,fn=1,mn=3e3,hn=1500,yn=10;function Me(n){return n instanceof Error&&n.name==="ChallengeError"&&n.code||"challenge_failed"}t(Me,"Oe");var Ce=new Set(["aborted","embedder_opaque","site_key_rejected","clock_wrong"]);function vn(n){return new Promise(o=>setTimeout(o,n))}t(vn,"Bn");function gn(){let n=globalThis.crypto;if(n!==void 0&&typeof n.randomUUID=="function")return n.randomUUID();let o=new Uint8Array(16);if(n!==void 0&&typeof n.getRandomValues=="function")n.getRandomValues(o);else for(let c=0;c<16;c+=1)o[c]=Math.floor(Math.random()*256);o[6]=(o[6]??0)&15|64,o[8]=(o[8]??0)&63|128;let f=[...o].map(c=>c.toString(16).padStart(2,"0")).join("");return`${f.slice(0,8)}-${f.slice(8,12)}-${f.slice(12,16)}-${f.slice(16,20)}-${f.slice(20)}`}t(gn,"qn");function _n(n){return bn(n,{})}t(_n,"dr");function bn(n,o){let f=n.apiOrigin??xt,c=n.autoRetry??!0,k=n.rearm??"auto",C=o.client??new st({apiOrigin:f,sessionToken:n.clientToken,fetch:n.fetch,locale:n.locale}),Q=new Set(["getSession","recordConsent"]),L=t((e,r)=>e instanceof Promise?e.catch(i=>{throw ce(i)&&Xe(r!==void 0&&Q.has(r)),i}):e,"d"),h=new Proxy(C,{get(e,r){if(r==="submitCheck")return(...a)=>L(Kt(...a));let i=Reflect.get(e,r,e);return typeof i!="function"?i:r==="armCapture"?(a,s)=>i.call(e,a,p=>{Xe(),s?.(p)}):(...a)=>L(i.apply(e,a),r)}}),x=o.sleep??vn,q=o.uuid??gn,X=o.getChallengeToken??((e,r)=>import("./challenge-frame-HTZ2ZBIE-5JRAFZOU.js").then(i=>i.executeChallenge({frameUrl:e.url,siteKey:e.siteKey,action:"liveness",subject:r.subject,signal:r.signal,...n.locale!==void 0?{locale:n.locale}:{},...r.onInteractive!==void 0?{onInteractive:r.onInteractive}:{},...r.onRuns!==void 0?{onRuns:r.onRuns}:{}}))),w=At(),A=null,Ee=null,d=!1,Ie=new AbortController,m=null,ee=null,te=null,ne=t(()=>te??bt(m),"de"),re=t(()=>wt(pe(m),ne()),"le"),T=t(e=>{m=e,N(e)||Ft(e),w.emit("view",e),A?.onView(e)},"V"),M=t(()=>m!==null?Promise.resolve(m):(ee??(ee=h.getSession().then(e=>(T(e),e)).finally(()=>{ee=null})),ee),"O"),E=t(async()=>{let e=await h.getSession();return T(e),e},"N"),fe=t(async(e,r)=>{e.plan!==void 0?T(e):await E()},"Ce"),ie=null,Re=t(async e=>{let r=await M();if(e||!r.consentRecorded){let i=await h.recordConsent(n.locale);i.plan!==void 0?T(i):m!==null&&T({...m,consentRecorded:!0})}Z()&&se(r)},"Ue"),I=t(e=>e?.force===!0?Re(!0):(ie??(ie=Re(!1).finally(()=>{ie=null})),ie),"F"),me={client:h,ensureConsent:t(e=>I(e),"ensureConsent"),sleep:x,uuid:q,...o.random!==void 0?{random:o.random}:{},onBusy:t(e=>{d||w.emit("busy",e)},"onBusy")},Ne=!1,Oe=null,ae=t(e=>{if(e.status==="verified"||e.status==="not_verified"||e.status==="review"){if(Ne)return;Ne=!0}Oe=JSON.stringify(e),w.emit("result",e)},"pe"),Pt=t(e=>{Oe!==JSON.stringify(e)&&ae(e)},"un"),Pe=t(async e=>{let r=m;e&&(r=await E().catch(()=>m));let i=r===null?null:V(r);return i!==null&&!d&&w.emit("method",i),i!==null},"Ge"),he=null,Le=!1,De=!1,Ue=t(()=>vt(me,(e,r)=>e.submitCheck("population_registry",{},{idempotencyKey:r})),"Ye"),je=t(e=>sn(e)===!0||Ct(Y(e,"population_registry"))===!0,"$e"),Lt=t(async()=>{try{let e=await M();if(N(e)||V(e)!==null||U(e)?.checkType!=="population_registry")return;if(!je(e)&&Ct(Y(e,"population_registry"))===void 0&&(e=await E()),!je(e)){De=!0;return}await I(),await fe(await Ue(),"population_registry");let r=m===null?void 0:Y(m,"population_registry");if(r?.state==="input_required"&&r.reason==="registry_unavailable"&&pt(r)>0){if(await x(ln),d)return;await fe(await Ue(),"population_registry")}}catch(e){if(e instanceof D&&(e.code==="check_not_active"||e.code==="step_not_on_path")){await E().catch(()=>{});return}Le=!0;return}m!==null&&N(m)&&ae(ke(m,{autoRetry:c}))},"cn"),qe=t(()=>(he??(he=Lt()),he),"Qe"),S=o.now??Date.now,F=null,$,Dt=0,ye=t((e,r)=>`${e.url}
2
+ ${e.siteKey}
3
+ ${r}`,"Re"),Fe=0,H=0,oe,G=0,z=0,Ut=0,Ge=t(()=>{d||w.emit("browserCheck",{pending:z>0,...G>0?{interactive:!0}:{}})},"Xe"),ve=t((e,r)=>{Fe+=1;let i=S(),a=!1,s=!1,p=t(v=>{if(a===v)return;a=v,v&&(s=!0);let O=G>0;G=Math.max(0,G+(v?1:-1)),O!==G>0&&Ge()},"S");H+=1;let u=0,g=t(v=>{H+=u===0?Math.max(0,v-1):v,u+=v},"A"),l=an(),y=X(e,{signal:Ie.signal,subject:r,onInteractive:p,onRuns:g}),_={key:ye(e,r),at:i,token:y};return y.then(()=>{l.stop(),_.issuedAt=S(),p(!1),s&&!d&&K({check:"attestation",kind:"generic",engineKind:"interactive_passed",attempt:Ut++,challengeMs:S()-i,interactive:!0,checks:Math.min(50,H)})},v=>{l.stop();let O=Me(v);if(_.failed=O,p(!1),d||O==="aborted")return;let{detail:en,readyMs:tn,stage:rt}=v;K({check:"attestation",kind:"unavailable",engineKind:O,attempt:Dt++,challengeMs:S()-i,readyMs:tn,detail:en,inApp:at(),...s?{interactive:!0}:{},checks:Math.min(50,H),hiddenMs:Math.min(6e5,l.hiddenMs()),...l.hiddenNow()?{hidden:!0}:{},...rt!==void 0?{stage:rt}:{}})}),y.catch(()=>{}),_},"Pe"),Ke=t((e,r)=>e!==null&&e.key===r&&(e.issuedAt===void 0||S()-e.issuedAt<un),"Je"),se=t((e,r={})=>{let i=e?.challenge??null;if(e===null||i===null||d)return;let a=de(e.sessionId),s=F;(r.replaceFailed===!0&&s?.failed!==void 0&&!Ce.has(s.failed)||!Ke(s,ye(i,a)))&&(F=ve(i,a))},"me"),Be=t(e=>{let r=z>0;z=Math.max(0,z+e),r!==z>0&&Ge()},"ze"),jt=t(async e=>{Be(1);let r;try{let i=e.token.then(a=>({token:a}),a=>({error:Me(a)}));for(;;){let a=await Promise.race([i,new Promise(s=>{r=setTimeout(()=>s(void 0),cn)})]);if(d)return{error:"aborted"};if(!(a===void 0&&G>0))return a}}finally{clearTimeout(r),Be(-1)}},"pn"),Ve=t(async(e,r,i)=>{let a=ye(e,r),s=F;F=null;let p=Ke(s,a)&&(s.failed===void 0||Ce.has(s.failed))?s:ve(e,r),u=p===s?0:1,g,l=new Promise(y=>{g=setTimeout(()=>y("late"),i)});try{for(;;){let y=await Promise.race([p.token.then(_=>({token:_}),_=>({error:Me(_)})),l]);if(y==="late"){let _=d?void 0:await jt(p);return _===void 0?(!d&&F===null&&(F=p),{error:"timeout"}):("token"in _&&(oe=Math.max(0,Math.round((p.issuedAt??S())-p.at))),_)}if("token"in y)return oe=Math.max(0,Math.round((p.issuedAt??S())-p.at)),y;if(d||Ce.has(y.error)||u>=fn||u>0&&await Promise.race([x(mn*u),l])==="late")return y;if(d)return{error:"aborted"};u+=1,p=ve(e,r)}}finally{clearTimeout(g)}},"et"),R=null,qt=t(e=>R===null||S()-R>=e,"fn"),Z=t(()=>qt(dn),"ee"),$e=!1,He=null,Ft=t(e=>{let r=e.challenge?.provenMs;R===null&&typeof r=="number"&&r>0&&(R=S()-Math.max(0,pn-r)),$e||($e=!0,Z()&&se(e));let i=U(e),a=i!==void 0&&(i.checkType==="phone_otp"||i.checkType==="email_otp")?`${i.checkType}:${we(e).indexOf(i)}`:null;a!==null&&a!==He&&(He=a,se(e))},"mn"),Gt=t(e=>{let r=e.attestation;return typeof r?.turnstileToken=="string"&&r.turnstileToken.length>0},"hn"),ze=new Map,Ze=t(async e=>{let r=await M(),i=r.challenge;if(i==null||r.simulation!==void 0)return;let a=await Ve(i,de(r.sessionId),e);if(!("token"in a))throw yt(a.error);return a.token},"rt"),Kt=t(async(e,r,i={})=>{let a=r;if("attestation"in a)try{let l=await C.submitCheck(e,r,i);return Gt(a)&&(R=S()),l}catch(l){throw l instanceof D&&l.code==="attestation_invalid"&&(R=null),l}let s=(e==="phone_otp"||e==="email_otp")&&a.action!=="verify",p=i.idempotencyKey,u=p!==void 0?ze.get(p):void 0;u===void 0&&(s||Z())&&(u=await Ze(St(e,a)),p!==void 0&&u!==void 0&&ze.set(p,u));let g=t((l,y)=>l!==void 0?{...y,browserCheckToken:l}:y,"A");try{let l=await C.submitCheck(e,r,g(u,i));return u!==void 0&&(R=S()),l}catch(l){if(!(l instanceof D)||l.code!=="attestation_invalid"||(R=null,u!==void 0))throw l;let y=await Ze(St(e,a)),_=p!==void 0?{...i,idempotencyKey:q()}:i,v=await C.submitCheck(e,r,g(y,_));return y!==void 0&&(R=S()),v}},"yn"),We=t(async(e={})=>{if($=void 0,e.always!==!0&&!Z())return{};let r=await M(),i=r.challenge;if(i==null)return{};let a=e.always===!0?Et:Tt,s=await Ve(i,de(r.sessionId),a);if("token"in s)return{channel:"hosted_web",turnstileToken:s.token};if($=s.error,r.simulation!==void 0&&e.always!==!0)return{channel:"hosted_web"};throw new ht(s.error)},"it"),Bt=t(()=>$,"gn"),Vt=t(()=>({checks:Math.min(50,Math.max(Fe,H)),...oe!==void 0?{challengeMs:Math.min(6e5,oe)}:{}}),"Sn"),K=t(e=>{if(d)return;let r=h.reportCaptureIssue;if(r===void 0)return;let i=e.formFactor;try{i??(i=it())}catch{}try{Promise.resolve(r.call(h,{...e,...i!==void 0?{formFactor:i}:{}})).catch(()=>{})}catch{}},"Y"),b=null,W=null,Je=new WeakMap,Ye=Promise.resolve(),J=0,B=!1,Qe=!1,ge=!1;function Xe(e=!1){d||(e&&(ge=!0),B||(B=!0,b!==null&&(b.alive=!1,b.ramp.stop(),b.capture.handle.destroy(),b=null),Qe||(Qe=!0,ae(P(m?.sessionId??"","elsewhere")))),A?.showElsewhere())}t(Xe,"ct");let et=t(async()=>{if(!d){B=!1,ge=!1;try{await E()}catch(e){if(ce(e)||(B=!0,A?.showElsewhere()),!ce(e))throw e}}},"dt"),$t=t(async()=>{let e=await M();for(let r=0;r<yn&&!d&&!N(e)&&U(e)===void 0&&we(e).some(i=>i.state==="processing")&&(await x(hn),!d);r+=1)e=await E();return e},"_n"),Ht=t(async(e,r,i)=>{let{capture:a}=e,s=t(()=>d||B,"f"),p=t(()=>e.alive&&e.attempt===i,"S"),u=t(l=>{p()&&a.setFlowState(l)},"y"),g=t(l=>{if(!s()&&(l.status==="unavailable"&&l.reasonCode!==void 0&&!lt(l.reasonCode)&&K({check:"liveness",kind:"unavailable",phase:"upload",engineKind:l.reasonCode,attempt:Math.max(0,e.issues.value)}),ae(l),!!p())){if(l.status==="retry"&&k==="auto"){a.handle.retry();return}a.setFlowState("done")}},"A");if(!s()){if(r.degraded==="NO_RECORDER"){let l=m?.sessionId??(await M().catch(()=>null))?.sessionId??"";g(P(l,"no_recorder"));return}u("uploading");try{if(await qe(),s())return;let l=await M(),y;if(!N(l)&&V(l)!==null){await Pe(!1),g(P(l.sessionId,"method_required"));return}if(!N(l)){if(U(l)?.checkType==="population_registry"){g(P(l.sessionId,De?"nni_unbound":Le?"network":"registry_unavailable"));return}if(await I(),s())return;y=m??l;let _=await gt({...me,artifacts:r,getAttestation:We,attestationError:Bt,attestationFacts:Vt,clipKeys:{get:t(()=>Je.get(r)??null,"get"),set:t(v=>{Je.set(r,v)},"set")},getView:t(()=>m??l,"getView"),refreshView:E,applySubmit:fe,onPhase:u,isCancelled:s,onKeyframePromoted:t(v=>{Ee=v},"onKeyframePromoted")});if(s())return;if(_.kind==="unavailable"){_.reason==="attestation"&&(W={bound:e,artifacts:r});let v=P(l.sessionId,_.reason),O=_.reason==="attestation"?$:void 0;g(O!==void 0?{...v,attestationError:O}:v);return}if(_.kind==="resync"&&await E(),m!==null&&V(m)!==null){await Pe(!1),g(P(l.sessionId,"method_required"));return}l=await $t()}g(ke(l,{autoRetry:c,previous:y}))}catch{if(s())return;g(P(m?.sessionId??"","network"))}}},"bn"),tt=t((e,r)=>{let i=e.attempt;J>0&&e.alive&&e.capture.setFlowState("uploading"),J+=1,Ye=Ye.then(()=>Ht(e,r,i)).finally(()=>{J-=1,J===0&&A?.onChainIdle()}).catch(()=>{})},"lt"),nt=t(e=>{b?.capture.handle.destroy(),b!==null&&(b.alive=!1,b.ramp.stop());let r=on({armRamp:typeof h.armRamp=="function"?()=>h.armRamp():void 0,waiting:t(()=>s.alive&&re()==="self"&&(a.handle.state==="starting"||a.handle.state==="gating"),"waiting")}),i=Promise.resolve(),a=Mt(e,A?.captureInternals?.(e)??o.capture,()=>m?.capture?.liveness?.keyframe?.rank===!0,re,()=>r.take()??m?.capture?.liveness?.screenRamp,{session:t(()=>pe(m),"session"),onModeChange:t(u=>{te=u},"onModeChange")}),s={capture:a,alive:!0,ramp:r,attempt:0,issues:ct()};b=s,a.handle.on("error",u=>{K(ut("liveness",u,s.issues.value))}),a.handle.on("state",u=>{if(s.issues.note(u),u==="starting"){s.attempt+=1,W?.bound===s&&(W=null),Z()&&se(m,{replaceFailed:!0});let g=m===null?void 0:U(m)?.checkType;i=g==="liveness"||g==="face_match"?I().catch(()=>{}):Promise.resolve()}(u==="starting"||u==="gating")&&re()==="self"?i.then(()=>{s.alive&&r.arm()}):u==="starting"&&i.then(()=>{s.alive&&h.armCapture?.(2)})}),a.handle.on("captured",u=>{Promise.resolve().then(()=>tt(s,u))});let p=a.handle;return{get state(){return p.state},get captureMode(){return p.captureMode},get facingMode(){return p.facingMode},on:t((u,g)=>p.on(u,g),"on"),start:t(async u=>{if(m===null&&await M().catch(()=>{}),!!s.alive)return p.start(u)},"start"),retry:t(()=>{let u=W;if(u!==null&&u.bound===s&&s.alive){W=null,tt(s,u.artifacts);return}p.retry()},"retry"),switchCamera:t(()=>p.switchCamera(),"switchCamera"),canSwitchCaptureMode:t(()=>p.canSwitchCaptureMode(),"canSwitchCaptureMode"),setCaptureMode:t(u=>p.setCaptureMode(u),"setCaptureMode"),destroy:t(()=>{s.alive=!1,r.stop(),b===s&&(b=null),p.destroy()},"destroy")}},"pt"),zt=t(async()=>{if(d)return null;try{let e=await M();return d?null:V(e)}catch{return null}},"kn"),Zt=t(async()=>{if(d)return"self";try{let e=await M();if(d)return"self";let r=pe(e);return r==="choice"?ne()??r:r}catch{return"self"}},"wn"),Wt=t(async()=>{if(d)return!1;try{let e=await M();return d||N(e)||be()?!1:Ae(e,U(e))==="phone"||Ae(e,Y(e,"liveness"))==="phone"}catch{return!1}},"Cn"),Jt=t(async()=>{if(d)return!1;try{let e=await M();return!d&&e.returning===!0}catch{return!1}},"xn"),Yt=t(async e=>{let r=(await M()).plan?.choice,i=r?.options.find(s=>dt[s.service]===e);if(!i)throw new RangeError(`method ${String(e)} is not offered`);let a=await h.choose(r.nodeId,i.id);d||T(a)},"An"),le=null,ue=null,Qt=t(()=>{let e=h.sessionEvents;return ue!==null||d||e===void 0?ue??Promise.resolve():(ue=import("./session-watch-7HMFAHQI-WNCXXNDK.js").then(({createSessionWatch:r,documentVisibility:i})=>{d||(le=r({events:t(a=>e(a),"events"),read:t(()=>h.getSession(),"read"),apply:t(a=>{d||T(a)},"apply"),isTerminal:N,sleep:wn,hidden:i.hidden,onVisibility:i.onVisibility,now:o.now??Date.now}),le.start())}),ue)},"Rn"),_e=null,Xt=t(()=>(_e??(_e=import("./plan-runner-JXCJC5MM-BF6RMCBJ.js").then(e=>{let r=e.createPlanRunner({runtime:me,currentView:t(()=>m,"currentView"),cameraMode:re,captureModeSwitch:{pick:ne,choose:t(i=>{te=i},"choose")},ensureView:M,refreshView:E,ensureConsent:t(()=>I(),"ensureConsent"),liveness:nt,stopLiveness:t(()=>{b!==null&&(b.alive=!1,b.ramp.stop(),b.capture.handle.destroy(),b=null)},"stopLiveness"),chainBusy:t(()=>J>0,"chainBusy"),destroyed:t(()=>d,"destroyed"),following:t(()=>{let i=le?.mode();return i==="stream"||i==="polling"},"following"),sleep:x,isMobile:be,now:o.now??Date.now,keptFaceKey:t(()=>Ee,"keptFaceKey"),elsewhere:t(()=>B,"elsewhere"),elsewhereEnded:t(()=>ge,"elsewhereEnded"),retryElsewhere:et,setView:T,baseCapture:o.capture,emitStep:t(i=>{d||w.emit("step",i)},"emitStep"),emitResult:Pt,reportCaptureIssue:K,documentInternals:o.document,documentFacts:o.documentFacts,portraitInternals:o.portrait,livePhotoInternals:o.livePhoto,uploadInternals:o.upload,pageCameraInternals:o.pageCamera});return A=r,r})),_e),"Pn");return{consent:t(()=>I(),"consent"),startRegistry:qe,methodChoice:zt,selectMethod:Yt,reportCameraUnavailable:t(async e=>{await I();let r=h.reportCameraUnavailable;if(r===void 0)throw new TypeError("this client cannot report a missing camera");let i=await r.call(h,e).catch(a=>{if(a instanceof D&&a.code==="check_out_of_order")return h.getSession();throw a});d||T(i)},"reportCameraUnavailable"),reportCaptureIssue:K,testerGate:t(async(e,r={})=>{let i=h.testerGate;if(i===void 0)throw new TypeError("this client cannot run the tester gate");let a=e.clip,s=ot(e.clipMime??"");if(a===void 0||!mt.includes(s))throw new TypeError("the capture has no clip");await I();let p=await We({always:!0}),u=await ft(h,"clip",s,a.size,{engine:e.engine,durationMs:e.clipMs});await h.uploadToSpaces(u.uploadUrl,a,s);let{key:g}=await h.completeMedia(u.key),l=await i.call(h,{clipKey:g,attestation:p,captureChannel:e.captureChannel,capture:{..._t(e),attestationError:$},...r.evidenceNotice===!0?{evidenceNotice:1}:{}}),{bound:y,missReason:_,...v}=l;return d||(v.plan!==void 0?T(v):await E()),y===!0||_===void 0?{bound:y===!0}:{bound:!1,missReason:_}},"testerGate"),chooseSandboxMode:t(async e=>{let r=h.chooseSandboxMode;if(r===void 0)throw new TypeError("this client cannot choose the Sandbox mode");await I();let i=await r.call(h,e).catch(a=>{if(a instanceof D&&a.code==="sandbox_mode_set")return h.getSession();throw a});d||(i.plan!==void 0?T(i):await E())},"chooseSandboxMode"),mobileRequired:Wt,captureMode:Zt,chooseCaptureMode:t(e=>{te=e},"chooseCaptureMode"),get captureChoice(){return ne()},returning:Jt,liveness:nt,run:t(async()=>{if(d)throw new Error("verification destroyed");let e=await Xt();return Qt(),e.run()},"run"),currentStep:t(()=>A?.current()??null,"currentStep"),retryElsewhere:et,voiceClips:t(async()=>{if(d)return null;try{let e=await M();return d?null:e.voice??null}catch{return null}},"voiceClips"),on:t((e,r)=>w.on(e,r),"on"),destroy:t(()=>{d=!0,Ie.abort(),le?.stop(),A?.destroy(),b!==null&&(b.alive=!1,b.capture.handle.destroy(),b=null),w.clear()},"destroy")}}t(bn,"Gn");function wn(n,o){return new Promise((f,c)=>{if(o.aborted)return c(new Error("aborted"));let k=t(()=>{clearTimeout(C),c(new Error("aborted"))},"r"),C=setTimeout(()=>{o.removeEventListener("abort",k),f()},n);o.addEventListener("abort",k,{once:!0})})}t(wn,"Kn");var It=["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"],Rt=["carte_identite","passport","residence_permit","drivers_license"],kn=["carte_identite","passport","residence_permit"];function xe(n,o){let f=n.byIssuer?.[o]??n.default;return Rt.filter(c=>f==="*"?kn.includes(c):f.includes(c))}t(xe,"Yn");function Nt(n,o=It){return[...new Set([...o,...Object.keys(n.byIssuer??{})])].filter(f=>xe(n,f).length>0).sort()}t(Nt,"mr");var j={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",remoteOptions:30,remoteFilterAbove:12,remoteOther:120,remoteValue:128};function An(n,o){let f=Se(o);return f===""?[...n]:n.filter(c=>Se([c.title,c.label,c.description].filter(Boolean).join(" ")).includes(f))}t(An,"gr");function Se(n){return n.normalize("NFKD").replace(/[\u0300-\u036f\u064b-\u065f\u0670\u0640]/g,"").toLowerCase().replace(/\s+/g," ").trim()}t(Se,"Kt");var Jn={remote_choice:j.remoteOther,full_name:j.fullName,occupation:j.occupation,email:j.email,short_text:j.shortText,long_text:j.longText},Ot=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"}),Yn=new Map(Object.entries(Ot)),Qn=new Map(Object.entries(Ot).map(([n,o])=>[o,n]));function Mn(n,o){let f=Object.keys(n.names??{});if(f.length===1){let k=n.names?.[f[0]],C=k?.[o]??k?.en;if(C!==void 0&&C!=="")return C}if(f.length>1)return;let c=n.nationalEid?.providerName;return c!==void 0&&c!==""?c:void 0}t(Mn,"vr");var Xn=10*1024*1024;function qr(n){if(n==="permission")return"denied";if(n==="notfound"||n==="insecure"||n==="unsupported")return"no_camera"}t(qr,"Ce");var Cn=/^[A-Z0-9][A-Z0-9 -]{0,39}$/,Sn=Object.freeze({normalize:t(n=>n.trim().toUpperCase().replace(/\s+/g," "),"normalize"),check:t(n=>Cn.test(n),"check"),registrySources:Object.freeze([]),describe:"number must be 1 to 40 letters, digits, spaces or hyphens"}),xn=/^[A-Z0-9]{4,20}$/,Te=t(n=>n.trim().toUpperCase().replace(/[\s-]+/g,""),"m"),Tn=Object.freeze({normalize:Te,check:t(n=>xn.test(Te(n)),"check"),registrySources:Object.freeze([]),describe:"number must be 4 to 20 letters or digits"});function En(n){return typeof n=="string"&&/^\d{10}$/.test(n)&&Number(n)%97===1}t(En,"Re");var In={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:Te},Rn={mr_nni_mod97:t(n=>En(n),"mr_nni_mod97")};function Nn(n){let o=new RegExp(n.pattern,"u"),f=n.check===null?void 0:Rn[n.check];return Object.freeze({normalize:In[n.normalize],check:t(c=>o.test(c.trim())&&(f===void 0||f(c)),"check"),registrySources:Object.freeze([...n.registrySources]),describe:n.describe})}t(Nn,"Me");var On=Object.freeze(Object.fromEntries(Object.entries(kt).map(([n,o])=>[n,Nn(o)])));function Pn(n,o){return On[`${n.toUpperCase()}:${o}`]??(o==="drivers_license"?Tn:Sn)}t(Pn,"S");var Fr=Object.freeze({JPN:"JP",MRT:"MR"});function Gr(n){return Pn("MR","national_id").check(n)}t(Gr,"be");function Ln(n){let o="";for(let f of n){let c=f.codePointAt(0)??0;c>=1632&&c<=1641?o+=String(c-1632):c>=1776&&c<=1785?o+=String(c-1776):f!==" "&&f!=="-"&&f!==" "&&(o+=f)}return o}t(Ln,"H");function Kr(n){return Ln(n)}t(Kr,"De");var Br=xe,Vr=Nt;var Dn=t(()=>import("./create-document-capture-DNJSSCWA-M73L4ODE.js"),"E");function Un(){Dn().then(n=>n.warmDocumentCapture()).catch(()=>{})}t(Un,"b");function $r(){Un()}t($r,"nt");var jn=t(()=>import("./create-portrait-capture-3MHP4DGA-4XIQSUJ3.js"),"D");function qn(){jn().then(n=>n.warmPortraitCapture()).catch(()=>{})}t(qn,"x");function Hr(){qn()}t(Hr,"ut");export{_n as a,j as b,An as c,Mn as d,qr as e,Gr as f,Kr as g,Br as h,Vr as i,$r as j,Hr as k};
@@ -0,0 +1 @@
1
+ import{a as e}from"./chunk-SIBJ56BG.js";import{a}from"./chunk-5QL6W6FW.js";import{a as o}from"./chunk-4FHWXBOB.js";var c=5;function i(t,n){try{return new Intl.ListFormat([n],{style:"long",type:"conjunction"}).format(t)}catch{return t.join(", ")}}o(i,"a");a(i,"joined");function u(t,n){if(t===void 0||t.length===0||t.length>c)return null;let r=i(t.map(l=>e(l,n.locale)),n.locale);return n.t(t.length===1?"doc.nationalityOne":"doc.nationalityMany",{countries:r})}o(u,"c");a(u,"nationalityLine");export{u as a};
@@ -1 +1 @@
1
- import{d as v}from"./chunk-SGUCIULX.js";import{a as y,b as C}from"./chunk-SIPFHN7E.js";import{a as d}from"./chunk-5QL6W6FW.js";import{a,c as p}from"./chunk-4FHWXBOB.js";var r=p(y(),1),o=p(C(),1),m=p(y(),1);function w(t,e,i){let[n,c]=(0,r.useState)(!1),s=(0,r.useRef)(i);return s.current=i,(0,r.useEffect)(()=>{t&&(c(!0),s.current())},[t,e]),[n,()=>c(!1)]}a(w,"I");d(w,"useWrongCode");function x({id:t,value:e,onChange:i,length:n=6,describedBy:c,invalid:s}){let[k,f]=(0,r.useState)(!1),[h,N]=(0,r.useState)(0);(0,r.useEffect)(()=>{s&&N(l=>l+1)},[s]);let g=(0,r.useRef)(null);(0,r.useEffect)(()=>{let l=setTimeout(()=>g.current?.focus({preventScroll:!0}),350);return()=>clearTimeout(l)},[]);let b=e.length<n?e.length:-1;return(0,o.jsxs)("div",{className:"sekyro-otp-boxes",dir:"ltr",children:[(0,o.jsx)("div",{className:`sekyro-otp-row${h>0?" is-shaking":""}`,"aria-hidden":"true",children:Array.from({length:n},(l,u)=>(0,o.jsx)("span",{className:`sekyro-otp-box${u<e.length?" is-filled":""}${k&&u===b?" is-current":""}${s?" is-invalid":""}`,children:e[u]!==void 0?(0,o.jsx)("span",{className:"sekyro-otp-digit",children:e[u]},e[u]):null},u))},h),(0,o.jsx)("input",{ref:g,id:t,className:"sekyro-input sekyro-input--code",dir:"ltr",inputMode:"numeric",autoComplete:"one-time-code",value:e,"aria-describedby":c,"aria-invalid":s||void 0,onFocus:a(()=>f(!0),"onFocus"),onBlur:a(()=>f(!1),"onBlur"),onChange:a(l=>i(v(l.target.value).replace(/\D/g,"").slice(0,n)),"onChange")})]})}a(x,"S");d(x,"CodeInput");function I(t){let[e,i]=(0,m.useState)(()=>Date.now());return(0,m.useEffect)(()=>{if(!t)return;let n=setInterval(()=>i(Date.now()),1e3);return()=>clearInterval(n)},[t]),e}a(I,"B");d(I,"useNow");export{w as a,x as b,I as c};
1
+ import{g as v}from"./chunk-6T7VBPLY.js";import{a as y,b as C}from"./chunk-EB2QC3GA.js";import{a as d}from"./chunk-5QL6W6FW.js";import{a,c as p}from"./chunk-4FHWXBOB.js";var r=p(y(),1),o=p(C(),1),m=p(y(),1);function w(t,e,i){let[n,c]=(0,r.useState)(!1),s=(0,r.useRef)(i);return s.current=i,(0,r.useEffect)(()=>{t&&(c(!0),s.current())},[t,e]),[n,()=>c(!1)]}a(w,"I");d(w,"useWrongCode");function x({id:t,value:e,onChange:i,length:n=6,describedBy:c,invalid:s}){let[k,f]=(0,r.useState)(!1),[h,N]=(0,r.useState)(0);(0,r.useEffect)(()=>{s&&N(l=>l+1)},[s]);let g=(0,r.useRef)(null);(0,r.useEffect)(()=>{let l=setTimeout(()=>g.current?.focus({preventScroll:!0}),350);return()=>clearTimeout(l)},[]);let b=e.length<n?e.length:-1;return(0,o.jsxs)("div",{className:"sekyro-otp-boxes",dir:"ltr",children:[(0,o.jsx)("div",{className:`sekyro-otp-row${h>0?" is-shaking":""}`,"aria-hidden":"true",children:Array.from({length:n},(l,u)=>(0,o.jsx)("span",{className:`sekyro-otp-box${u<e.length?" is-filled":""}${k&&u===b?" is-current":""}${s?" is-invalid":""}`,children:e[u]!==void 0?(0,o.jsx)("span",{className:"sekyro-otp-digit",children:e[u]},e[u]):null},u))},h),(0,o.jsx)("input",{ref:g,id:t,className:"sekyro-input sekyro-input--code",dir:"ltr",inputMode:"numeric",autoComplete:"one-time-code",value:e,"aria-describedby":c,"aria-invalid":s||void 0,onFocus:a(()=>f(!0),"onFocus"),onBlur:a(()=>f(!1),"onBlur"),onChange:a(l=>i(v(l.target.value).replace(/\D/g,"").slice(0,n)),"onChange")})]})}a(x,"S");d(x,"CodeInput");function I(t){let[e,i]=(0,m.useState)(()=>Date.now());return(0,m.useEffect)(()=>{if(!t)return;let n=setInterval(()=>i(Date.now()),1e3);return()=>clearInterval(n)},[t]),e}a(I,"B");d(I,"useNow");export{w as a,x as b,I as c};
@@ -0,0 +1 @@
1
+ import{a as n}from"./chunk-5QL6W6FW.js";import{G as t,H as a,a as i}from"./chunk-44UA2IDQ.js";import{a as o}from"./chunk-4FHWXBOB.js";function d(r,c){if(r instanceof t)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){if(r.code==="attestation_invalid"&&r.details?.browserCheck==="clock_wrong")return"errors.device_clock";let e=`errors.${r.code}`;if(Object.hasOwn(c,e))return e}return"errors.network_error"}o(d,"d");n(d,"errorKey");export{d as a};
@@ -1 +1 @@
1
- import{a as d}from"./chunk-SIPFHN7E.js";import{a as t}from"./chunk-5QL6W6FW.js";import{a as i,c as r}from"./chunk-4FHWXBOB.js";var s=r(d(),1);var u=(0,s.createContext)(null);function c(a,n,o){let e=n.detail;return{check:a,kind:n.kind,...e?.name!==void 0?{name:e.name}:{},...e?.phase!==void 0?{phase:e.phase}:{},...e?.engineKind!==void 0?{engineKind:e.engineKind}:{},attempt:Math.max(0,Math.min(1e3,o))}}i(c,"a");t(c,"captureIssueOf");function m(a,n){if(a!==void 0)try{a(n)}catch{}}i(m,"o");t(m,"sendCaptureIssue");export{u as a,c as b,m as c};
1
+ import{a as d}from"./chunk-EB2QC3GA.js";import{a as t}from"./chunk-5QL6W6FW.js";import{a as i,c as r}from"./chunk-4FHWXBOB.js";var s=r(d(),1);var u=(0,s.createContext)(null);function c(a,n,o){let e=n.detail;return{check:a,kind:n.kind,...e?.name!==void 0?{name:e.name}:{},...e?.phase!==void 0?{phase:e.phase}:{},...e?.engineKind!==void 0?{engineKind:e.engineKind}:{},attempt:Math.max(0,Math.min(1e3,o))}}i(c,"a");t(c,"captureIssueOf");function m(a,n){if(a!==void 0)try{a(n)}catch{}}i(m,"o");t(m,"sendCaptureIssue");export{u as a,c as b,m as c};