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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (90) hide show
  1. package/CHANGELOG.md +17 -0
  2. package/dist/cdn/chunks/{capture-session-doc-MGDYUASI-LYQ23KS6.js → capture-session-doc-DFLSX6BB-3ULMTYJH.js} +1 -1
  3. package/dist/cdn/chunks/chunk-3PBU4237.js +33 -0
  4. package/dist/cdn/chunks/chunk-4VHWJD57.js +1 -0
  5. package/dist/cdn/chunks/{chunk-SI6GIBVC.js → chunk-6H2SLOEK.js} +1 -1
  6. package/dist/cdn/chunks/{chunk-NPTVQXUW.js → chunk-AC45ZP53.js} +1 -1
  7. package/dist/cdn/chunks/{chunk-2MJOW3FG.js → chunk-CGOCWIXM.js} +1 -1
  8. package/dist/cdn/chunks/chunk-D7YINY2U.js +3 -0
  9. package/dist/cdn/chunks/{chunk-E5JQU363.js → chunk-EPMGZQHF.js} +1 -1
  10. package/dist/cdn/chunks/{chunk-BR5RW4XZ.js → chunk-EXMVZUHU.js} +1 -1
  11. package/dist/cdn/chunks/{chunk-3S7YMUPU.js → chunk-F4Q2Q4OC.js} +1 -1
  12. package/dist/cdn/chunks/{chunk-RPMVDYDV.js → chunk-HXD7VO3F.js} +1 -1
  13. package/dist/cdn/chunks/{chunk-IGZCP7OY.js → chunk-IWZRAEUN.js} +1 -1
  14. package/dist/cdn/chunks/{chunk-6TIQ2463.js → chunk-IXRKOBFA.js} +1 -1
  15. package/dist/cdn/chunks/{chunk-Z5QOJL3W.js → chunk-JR4AQLJ2.js} +1 -1
  16. package/dist/cdn/chunks/{chunk-3DAULGZ2.js → chunk-K2JDLIFO.js} +1 -1
  17. package/dist/cdn/chunks/{chunk-3APQX7OW.js → chunk-L66SWMJ5.js} +1 -1
  18. package/dist/cdn/chunks/{chunk-6L4TYBV7.js → chunk-LUO3AZFS.js} +1 -1
  19. package/dist/cdn/chunks/{chunk-QR7XWTXK.js → chunk-PAU2BFT7.js} +1 -1
  20. package/dist/cdn/chunks/{chunk-Z6KNLRUW.js → chunk-PLWGAXYM.js} +1 -1
  21. package/dist/cdn/chunks/{chunk-DHMC5D6M.js → chunk-RTCZJKYC.js} +1 -1
  22. package/dist/cdn/chunks/{chunk-E5YZMFCZ.js → chunk-WANVL25H.js} +1 -1
  23. package/dist/cdn/chunks/{chunk-DCTDTKG7.js → chunk-WCEIXBIS.js} +1 -1
  24. package/dist/cdn/chunks/{chunk-HM65LKWB.js → chunk-YULJCSQ3.js} +1 -1
  25. package/dist/cdn/chunks/{chunk-PRMQUJTM.js → chunk-ZWP6MDIC.js} +1 -1
  26. package/dist/cdn/chunks/{create-document-capture-KISF6XD3-R6PFAJU6.js → create-document-capture-4ZOSBL3Y-KLZDMWOQ.js} +1 -1
  27. package/dist/cdn/chunks/{detector-scanic-JC25DD3A-YZ3NPKMQ.js → detector-scanic-P2RTEQUV-A5WTP2Q7.js} +1 -1
  28. package/dist/cdn/chunks/document-capture-view-25EASYV7-EUEYS55L.js +1 -0
  29. package/dist/cdn/chunks/{eid-view-ZM7QAEME-DIL3UVBB.js → eid-view-6DXZ5ELB-ZX35JGDS.js} +1 -1
  30. package/dist/cdn/chunks/{email-otp-view-EYS26ZZM-UNGUBHFI.js → email-otp-view-3UJPJOQ6-MIOPWSME.js} +1 -1
  31. package/dist/cdn/chunks/flow-views-ZVDXJZWH-C5ZVKCB6.js +1 -0
  32. package/dist/cdn/chunks/{form-view-Y5KA6R5T-KUDCNJNS.js → form-view-4NKEHYNF-I25LMP47.js} +1 -1
  33. package/dist/cdn/chunks/overlay-de-64ABPD3N-KIBBQI36.js +1 -0
  34. package/dist/cdn/chunks/overlay-es-VIMXYK2Q-KTLONTNF.js +1 -0
  35. package/dist/cdn/chunks/overlay-pt-3IBDZBAW-DQTJHDLG.js +1 -0
  36. package/dist/cdn/chunks/plan-runner-3BLEJWHF-3K3RBXJU.js +1 -0
  37. package/dist/cdn/chunks/{portrait-capture-view-E5LKQQ5Y-3HNPCMBJ.js → portrait-capture-view-QDUJ36UH-GRTZTYTJ.js} +1 -1
  38. package/dist/cdn/chunks/{portrait-review-view-NJHH2E4W-B3RFT2PG.js → portrait-review-view-LW5DBF3L-K7WAOPAG.js} +1 -1
  39. package/dist/cdn/chunks/{proof-of-address-view-LS3JZUTD-MDTXER25.js → proof-of-address-view-E6WJTTIV-7ISFWEEZ.js} +1 -1
  40. package/dist/cdn/define.js +1 -1
  41. package/dist/cdn/index.js +1 -1
  42. package/dist/{chunk-AJHRPKD4.js → chunk-57MVUXQ6.js} +1 -1
  43. package/dist/{chunk-MWTOWGEI.js → chunk-5QJOJLKJ.js} +1 -1
  44. package/dist/{chunk-2WYXQYNY.js → chunk-6FAODASF.js} +1 -1
  45. package/dist/{chunk-D3TZZ4SI.js → chunk-7XJHQ3NM.js} +1 -1
  46. package/dist/{chunk-WLCS5VAA.js → chunk-BRS7YLGB.js} +1 -1
  47. package/dist/{chunk-5NSMKCTW.js → chunk-CY66YE6F.js} +1 -1
  48. package/dist/{chunk-VJZANYM3.js → chunk-KYDIB6KR.js} +1 -1
  49. package/dist/chunk-M7HNWDQD.js +1 -0
  50. package/dist/{chunk-6NNMOFMF.js → chunk-PKK72TVJ.js} +1 -1
  51. package/dist/{chunk-ICJ544T4.js → chunk-QNK7OBIW.js} +1 -1
  52. package/dist/chunk-RPA5QQVH.js +33 -0
  53. package/dist/{chunk-734Y6RUV.js → chunk-SVGBNMXK.js} +1 -1
  54. package/dist/{chunk-YVGOUZ7T.js → chunk-VBJ4CJHE.js} +1 -1
  55. package/dist/{chunk-ZUFN5VIE.js → chunk-XQPY6G2B.js} +1 -1
  56. package/dist/define.cjs +5 -5
  57. package/dist/define.js +1 -1
  58. package/dist/document-capture-view-25EASYV7-MOFQVGV6.js +1 -0
  59. package/dist/{eid-view-ZM7QAEME-7FRC3TV6.js → eid-view-6DXZ5ELB-XDQVFDXS.js} +1 -1
  60. package/dist/{email-otp-view-EYS26ZZM-EESWRHKM.js → email-otp-view-3UJPJOQ6-5PQM7LNW.js} +1 -1
  61. package/dist/flow-views-ZVDXJZWH-LOGNCRIA.js +1 -0
  62. package/dist/{form-view-Y5KA6R5T-DOZFYGBK.js → form-view-4NKEHYNF-VFMN6QFW.js} +1 -1
  63. package/dist/index.cjs +5 -5
  64. package/dist/index.d.cts +5 -0
  65. package/dist/index.d.ts +5 -0
  66. package/dist/index.js +1 -1
  67. package/dist/overlay-de-64ABPD3N-ARJE63WR.js +1 -0
  68. package/dist/overlay-es-VIMXYK2Q-JRHIX3OT.js +1 -0
  69. package/dist/overlay-pt-3IBDZBAW-JXQE6BVY.js +1 -0
  70. package/dist/{portrait-capture-view-E5LKQQ5Y-E3BRULLL.js → portrait-capture-view-QDUJ36UH-QZR4O3YW.js} +1 -1
  71. package/dist/{portrait-review-view-NJHH2E4W-CKMVD7ME.js → portrait-review-view-LW5DBF3L-QVERJXKH.js} +1 -1
  72. package/dist/{proof-of-address-view-LS3JZUTD-ZQ4BDFNP.js → proof-of-address-view-E6WJTTIV-4SHZIQ3O.js} +1 -1
  73. package/package.json +2 -2
  74. package/sbom.cdx.json +4 -4
  75. package/dist/cdn/chunks/chunk-4RGDPCRE.js +0 -33
  76. package/dist/cdn/chunks/chunk-BDRBGJA3.js +0 -3
  77. package/dist/cdn/chunks/chunk-Q7ACZDU4.js +0 -1
  78. package/dist/cdn/chunks/document-capture-view-7ZSM7YTT-UHYBVOQI.js +0 -1
  79. package/dist/cdn/chunks/flow-views-7SAYQQ62-2TENAJ6C.js +0 -1
  80. package/dist/cdn/chunks/overlay-de-4OISTBDL-WWT74VG7.js +0 -1
  81. package/dist/cdn/chunks/overlay-es-YO5UCAO2-U3OAELIS.js +0 -1
  82. package/dist/cdn/chunks/overlay-pt-E7PSFLLQ-ZPN4CLS4.js +0 -1
  83. package/dist/cdn/chunks/plan-runner-NWK4LZFI-CDXUYVEW.js +0 -1
  84. package/dist/chunk-2EMXU2MG.js +0 -33
  85. package/dist/chunk-XI37ATRU.js +0 -1
  86. package/dist/document-capture-view-7ZSM7YTT-GLHWVI3B.js +0 -1
  87. package/dist/flow-views-7SAYQQ62-3NIWXTDB.js +0 -1
  88. package/dist/overlay-de-4OISTBDL-TH46LT3S.js +0 -1
  89. package/dist/overlay-es-YO5UCAO2-NBICE576.js +0 -1
  90. package/dist/overlay-pt-E7PSFLLQ-NCA5NABT.js +0 -1
@@ -1 +1 @@
1
- import{a as n}from"./chunk-4FHWXBOB.js";var S="0.1.0-rc.38",k=/FBAN|FBAV|FB_IAB|FBIOS|MessengerForiOS|Instagram|WhatsApp|musical_ly|BytedanceWebview|TikTok|Snapchat|\bLine\/|LinkedInApp|Pinterest|MicroMessenger|; wv\)/i;function O(t){let e=t??(typeof navigator>"u"?"":String(navigator.userAgent??""));return k.test(e)}n(O,"p");var f="sekyro.did",C=1e4,w=n(()=>globalThis.process?.versions?.node,"v"),l;function y(){let t=globalThis.crypto;try{if(typeof t?.randomUUID=="function")return t.randomUUID()}catch{}try{if(typeof t?.getRandomValues=="function"){let e=t.getRandomValues(new Uint8Array(16));return Array.from(e,a=>a.toString(16).padStart(2,"0")).join("")}}catch{}}n(y,"b");function H(){try{let t=localStorage.getItem(f);if(t)return t;let e=y();return e!==void 0&&localStorage.setItem(f,e),e}catch{return l??(l=y()),l}}n(H,"I");async function M(){let t=globalThis.crypto?.subtle;if(!t)return"";let e=navigator,a=JSON.stringify([e.userAgent,e.platform,e.hardwareConcurrency??null,e.deviceMemory??null,e.maxTouchPoints??0,screen.width,screen.height,screen.colorDepth,globalThis.devicePixelRatio??1,Intl.DateTimeFormat().resolvedOptions().timeZone,e.languages?.join(",")??e.language]),i=await t.digest("SHA-256",new TextEncoder().encode(a));return Array.from(new Uint8Array(i),s=>s.toString(16).padStart(2,"0")).join("").slice(0,32)}n(M,"w");function x(){try{let t=Number(navigator.maxTouchPoints);return Number.isFinite(t)&&t>=0?{touch:Math.min(64,Math.trunc(t))}:{}}catch{return{}}}n(x,"k");function W(t){let e=new TextEncoder().encode(t),a="";for(let i of e)a+=String.fromCharCode(i);return btoa(a).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}n(W,"x");function j(t){let e,a,i,s,c,d,m=n(()=>d?.readyState==="live","u"),T=n(()=>{c!==void 0||!globalThis.crypto?.subtle||w()||m()||(c=Promise.race([import("./print-DCYX3CZD-DLQCPZZE.js"),new Promise(r=>setTimeout(r,C))]).then(r=>r?.computePrint(m)).then(r=>{r==="busy"?c=void 0:s=r}).catch(()=>{}))},"_");return{timezone(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone?.slice(0,64)||void 0}catch{return}},noteCameraLabel(r){r&&(e=r.slice(0,128))},noteCamera(r){a=r},noteCameraTrack(r){d=r},async deviceHeader(){try{i??(i=M().catch(()=>""));let r=[];navigator.webdriver&&r.push("webdriver"),/HeadlessChrome/.test(navigator.userAgent)&&r.push("headless");let p=await i,g=H(),A={v:1,platform:"web",sdk:t.sdk.slice(0,64),caps:["session_proof"],rampAtArm:!0,ids:[...g?[{kind:"web_local",value:g.slice(0,128)}]:[],...p?[{kind:"web_fp",value:p}]:[]],screen:{w:screen.width,h:screen.height,dpr:globalThis.devicePixelRatio??1},...x(),...e?{cameraLabel:e}:{},...r.length?{signals:r}:{},...s?{print:{v:2,...s,...a?{camera:a}:{}}}:{},...O()?{inApp:!0}:{}},I=W(JSON.stringify(A));return T(),I}catch{return}},printReady(){return c??Promise.resolve()}}}n(j,"A");var v=Symbol.for("sekyro.web.clientContext"),b=globalThis,u=b[v]??(b[v]=j({sdk:`@sekyro/web@${S}`}));function z(t){try{let e=t.getVideoTracks?.()[0];if(e){if(u.noteCameraLabel(e.label),u.noteCameraTrack(e),w())return;import("./camera-trait-DELAK3YN-4I2GHAFU.js").then(a=>a.noteCameraTrait(e,u)).catch(()=>{})}}catch{}}n(z,"M");var P=Object.freeze({LOW:Object.freeze({cadenceHz:5,inputWidth:128,animations:"reduced"}),MID:Object.freeze({cadenceHz:8,inputWidth:160,animations:"full"}),HIGH:Object.freeze({cadenceHz:10,inputWidth:192,animations:"full"})}),L=new Uint8Array([0,97,115,109,1,0,0,0,1,5,1,96,0,1,123,3,2,1,0,10,10,1,8,0,65,0,253,15,253,98,11]);function F(){let t=typeof navigator>"u"?void 0:navigator,e=!1;try{e=typeof WebAssembly<"u"&&WebAssembly.validate(L)}catch{e=!1}return{cores:t?.hardwareConcurrency??2,memGB:t?.deviceMemory??null,simd:e}}n(F,"o");function U(t){let e=t.memGB??4;return t.cores<4||e<3?"LOW":t.cores>=8&&e>=6?"HIGH":"MID"}n(U,"l");var h=["LOW","MID","HIGH"],o,_=(o=class{constructor(e){this.samples=[],this.adjusted=!1,this.current=e}get deviceClass(){return this.current}get profile(){return P[this.current]}record(e){if(this.adjusted||this.samples.length>=10)return this.current;if(this.samples.push(e),this.samples.length<10)return this.current;this.adjusted=!0;let a=this.samples.reduce((i,s)=>i+s,0)/this.samples.length;if(a>70)this.current="LOW";else if(a<25){let i=h.indexOf(this.current);this.current=h[Math.min(h.length-1,i+1)]??this.current}return this.current}},n(o,"i"),o);export{S as a,O as b,u as c,z as d,F as e,U as f,_ as g};
1
+ import{a as n}from"./chunk-4FHWXBOB.js";var S="0.1.0-rc.40",k=/FBAN|FBAV|FB_IAB|FBIOS|MessengerForiOS|Instagram|WhatsApp|musical_ly|BytedanceWebview|TikTok|Snapchat|\bLine\/|LinkedInApp|Pinterest|MicroMessenger|; wv\)/i;function O(t){let e=t??(typeof navigator>"u"?"":String(navigator.userAgent??""));return k.test(e)}n(O,"p");var f="sekyro.did",C=1e4,w=n(()=>globalThis.process?.versions?.node,"v"),l;function y(){let t=globalThis.crypto;try{if(typeof t?.randomUUID=="function")return t.randomUUID()}catch{}try{if(typeof t?.getRandomValues=="function"){let e=t.getRandomValues(new Uint8Array(16));return Array.from(e,a=>a.toString(16).padStart(2,"0")).join("")}}catch{}}n(y,"b");function H(){try{let t=localStorage.getItem(f);if(t)return t;let e=y();return e!==void 0&&localStorage.setItem(f,e),e}catch{return l??(l=y()),l}}n(H,"I");async function M(){let t=globalThis.crypto?.subtle;if(!t)return"";let e=navigator,a=JSON.stringify([e.userAgent,e.platform,e.hardwareConcurrency??null,e.deviceMemory??null,e.maxTouchPoints??0,screen.width,screen.height,screen.colorDepth,globalThis.devicePixelRatio??1,Intl.DateTimeFormat().resolvedOptions().timeZone,e.languages?.join(",")??e.language]),i=await t.digest("SHA-256",new TextEncoder().encode(a));return Array.from(new Uint8Array(i),s=>s.toString(16).padStart(2,"0")).join("").slice(0,32)}n(M,"w");function x(){try{let t=Number(navigator.maxTouchPoints);return Number.isFinite(t)&&t>=0?{touch:Math.min(64,Math.trunc(t))}:{}}catch{return{}}}n(x,"k");function W(t){let e=new TextEncoder().encode(t),a="";for(let i of e)a+=String.fromCharCode(i);return btoa(a).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}n(W,"x");function j(t){let e,a,i,s,c,d,m=n(()=>d?.readyState==="live","u"),T=n(()=>{c!==void 0||!globalThis.crypto?.subtle||w()||m()||(c=Promise.race([import("./print-DCYX3CZD-DLQCPZZE.js"),new Promise(r=>setTimeout(r,C))]).then(r=>r?.computePrint(m)).then(r=>{r==="busy"?c=void 0:s=r}).catch(()=>{}))},"_");return{timezone(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone?.slice(0,64)||void 0}catch{return}},noteCameraLabel(r){r&&(e=r.slice(0,128))},noteCamera(r){a=r},noteCameraTrack(r){d=r},async deviceHeader(){try{i??(i=M().catch(()=>""));let r=[];navigator.webdriver&&r.push("webdriver"),/HeadlessChrome/.test(navigator.userAgent)&&r.push("headless");let p=await i,g=H(),A={v:1,platform:"web",sdk:t.sdk.slice(0,64),caps:["session_proof"],rampAtArm:!0,ids:[...g?[{kind:"web_local",value:g.slice(0,128)}]:[],...p?[{kind:"web_fp",value:p}]:[]],screen:{w:screen.width,h:screen.height,dpr:globalThis.devicePixelRatio??1},...x(),...e?{cameraLabel:e}:{},...r.length?{signals:r}:{},...s?{print:{v:2,...s,...a?{camera:a}:{}}}:{},...O()?{inApp:!0}:{}},I=W(JSON.stringify(A));return T(),I}catch{return}},printReady(){return c??Promise.resolve()}}}n(j,"A");var v=Symbol.for("sekyro.web.clientContext"),b=globalThis,u=b[v]??(b[v]=j({sdk:`@sekyro/web@${S}`}));function z(t){try{let e=t.getVideoTracks?.()[0];if(e){if(u.noteCameraLabel(e.label),u.noteCameraTrack(e),w())return;import("./camera-trait-DELAK3YN-4I2GHAFU.js").then(a=>a.noteCameraTrait(e,u)).catch(()=>{})}}catch{}}n(z,"M");var P=Object.freeze({LOW:Object.freeze({cadenceHz:5,inputWidth:128,animations:"reduced"}),MID:Object.freeze({cadenceHz:8,inputWidth:160,animations:"full"}),HIGH:Object.freeze({cadenceHz:10,inputWidth:192,animations:"full"})}),L=new Uint8Array([0,97,115,109,1,0,0,0,1,5,1,96,0,1,123,3,2,1,0,10,10,1,8,0,65,0,253,15,253,98,11]);function F(){let t=typeof navigator>"u"?void 0:navigator,e=!1;try{e=typeof WebAssembly<"u"&&WebAssembly.validate(L)}catch{e=!1}return{cores:t?.hardwareConcurrency??2,memGB:t?.deviceMemory??null,simd:e}}n(F,"o");function U(t){let e=t.memGB??4;return t.cores<4||e<3?"LOW":t.cores>=8&&e>=6?"HIGH":"MID"}n(U,"l");var h=["LOW","MID","HIGH"],o,_=(o=class{constructor(e){this.samples=[],this.adjusted=!1,this.current=e}get deviceClass(){return this.current}get profile(){return P[this.current]}record(e){if(this.adjusted||this.samples.length>=10)return this.current;if(this.samples.push(e),this.samples.length<10)return this.current;this.adjusted=!0;let a=this.samples.reduce((i,s)=>i+s,0)/this.samples.length;if(a>70)this.current="LOW";else if(a<25){let i=h.indexOf(this.current);this.current=h[Math.min(h.length-1,i+1)]??this.current}return this.current}},n(o,"i"),o);export{S as a,O as b,u as c,z as d,F as e,U as f,_ as g};
@@ -1 +1 @@
1
- import{c as M}from"./chunk-3S7YMUPU.js";import{a as c}from"./chunk-P7K7ELYZ.js";import{a as r}from"./chunk-4FHWXBOB.js";var T=480,I=Object.freeze({MIN_AREA_FRAC:.15,EDGE_CLIP_MARGIN_PX:4,STABLE_TICKS:3,IOU_STABLE_MIN:.85,RISE_PER_S:.9,FALL_PER_S:.25,GUIDE_EXPOSURE:.6,GUIDE_SHARPNESS:.35,ID3_BAND_MIN_WIDTH_FRAC:.55,ID3_BAND_ASPECT_MIN:4,ID3_BAND_ASPECT_MAX:40}),x=r(i=>Math.min(1,Math.max(0,i)),"p");function E(i,h,t){let s=[i.topLeft,i.topRight,i.bottomRight,i.bottomLeft],e=0;for(let a=0;a<4;a++){let l=s[a],_=s[(a+1)%4];e+=l.x*_.y-_.x*l.y}let o=h*t;return o>0?Math.abs(e/2)/o:0}r(E,"E");function g(i,h){let t=A(i),s=A(h),e=Math.max(t.x1,s.x1),o=Math.max(t.y1,s.y1),a=Math.min(t.x2,s.x2),l=Math.min(t.y2,s.y2),_=Math.max(0,a-e)*Math.max(0,l-o),d=(t.x2-t.x1)*(t.y2-t.y1),u=(s.x2-s.x1)*(s.y2-s.y1),p=d+u-_;return p>0?_/p:0}r(g,"I");function L(i){let h=A(i);return{width:h.x2-h.x1,height:h.y2-h.y1}}r(L,"R");function A(i){let h=[i.topLeft,i.topRight,i.bottomRight,i.bottomLeft];return{x1:Math.min(...h.map(t=>t.x)),y1:Math.min(...h.map(t=>t.y)),x2:Math.max(...h.map(t=>t.x)),y2:Math.max(...h.map(t=>t.y))}}r(A,"D");function S(i){let h=Math.hypot(i.topRight.x-i.topLeft.x,i.topRight.y-i.topLeft.y),t=Math.hypot(i.bottomRight.x-i.bottomLeft.x,i.bottomRight.y-i.bottomLeft.y),s=Math.hypot(i.bottomLeft.x-i.topLeft.x,i.bottomLeft.y-i.topLeft.y),e=Math.hypot(i.bottomRight.x-i.topRight.x,i.bottomRight.y-i.topRight.y),o=(h+t)/2,a=(s+e)/2;return o<=0||a<=0?0:Math.max(o,a)/Math.min(o,a)}r(S,"M");var n,N=(n=class{constructor(h,t={}){this.p=0,this.lastTickAt=null,this.lastQuad=null,this.streak=0,this.format=h,this.t={...I,...t}}reset(){this.p=0,this.lastTickAt=null,this.lastQuad=null,this.streak=0}tick(h){let{quad:t,quality:s,timestampMs:e}=h,o=this.lastTickAt===null?0:Math.max(0,(e-this.lastTickAt)/1e3);this.lastTickAt=e;let a=null;if(t===null)a="dcv1.no_doc";else if(this.format==="ID-3"){let m=L(t),y=m.height>0?m.width/m.height:0;m.width<this.t.ID3_BAND_MIN_WIDTH_FRAC*h.frameWidth?a="dcv1.come_closer":this.edgeClipped(t,h.frameWidth,h.frameHeight)?a="dcv1.fit_document":(y<this.t.ID3_BAND_ASPECT_MIN||y>this.t.ID3_BAND_ASPECT_MAX)&&(a="dcv1.wrong_shape")}else E(t,h.frameWidth,h.frameHeight)<this.t.MIN_AREA_FRAC?a="dcv1.come_closer":this.edgeClipped(t,h.frameWidth,h.frameHeight)?a="dcv1.fit_document":M(this.format,S(t))||(a="dcv1.wrong_shape");let l=a===null,_=x(s.exposure)>=this.t.GUIDE_EXPOSURE,d=x(s.sharpness)>=this.t.GUIDE_SHARPNESS,u=_&&d;if(l&&u&&t!==null){let m=this.lastQuad===null||g(t,this.lastQuad)>=this.t.IOU_STABLE_MIN;this.streak=m?this.streak+1:1}else this.streak=0;this.lastQuad=t;let p=l&&u;this.p=x(this.p+(p?this.t.RISE_PER_S:-this.t.FALL_PER_S)*o);let R=p&&this.streak>=this.t.STABLE_TICKS,f;if(a!==null)f=a;else if(_)d?f="dcv1.hold_still":f="dcv1.steady";else{let m=(c[0]+c[1])/2;f=s.meanLuma<m?"dcv1.more_light":"dcv1.too_bright"}return{at:e,quad:t,plausible:l,p:this.p,guidanceKey:f,ready:R,stableTicks:this.streak}}edgeClipped(h,t,s){let e=this.t.EDGE_CLIP_MARGIN_PX;return[h.topLeft,h.topRight,h.bottomRight,h.bottomLeft].some(o=>o.x<=e||o.y<=e||o.x>=t-e||o.y>=s-e)}},r(n,"d"),n);export{T as a,I as b,E as c,L as d,N as e};
1
+ import{c as M}from"./chunk-F4Q2Q4OC.js";import{a as c}from"./chunk-P7K7ELYZ.js";import{a as r}from"./chunk-4FHWXBOB.js";var T=480,I=Object.freeze({MIN_AREA_FRAC:.15,EDGE_CLIP_MARGIN_PX:4,STABLE_TICKS:3,IOU_STABLE_MIN:.85,RISE_PER_S:.9,FALL_PER_S:.25,GUIDE_EXPOSURE:.6,GUIDE_SHARPNESS:.35,ID3_BAND_MIN_WIDTH_FRAC:.55,ID3_BAND_ASPECT_MIN:4,ID3_BAND_ASPECT_MAX:40}),x=r(i=>Math.min(1,Math.max(0,i)),"p");function E(i,h,t){let s=[i.topLeft,i.topRight,i.bottomRight,i.bottomLeft],e=0;for(let a=0;a<4;a++){let l=s[a],_=s[(a+1)%4];e+=l.x*_.y-_.x*l.y}let o=h*t;return o>0?Math.abs(e/2)/o:0}r(E,"E");function g(i,h){let t=A(i),s=A(h),e=Math.max(t.x1,s.x1),o=Math.max(t.y1,s.y1),a=Math.min(t.x2,s.x2),l=Math.min(t.y2,s.y2),_=Math.max(0,a-e)*Math.max(0,l-o),d=(t.x2-t.x1)*(t.y2-t.y1),u=(s.x2-s.x1)*(s.y2-s.y1),p=d+u-_;return p>0?_/p:0}r(g,"I");function L(i){let h=A(i);return{width:h.x2-h.x1,height:h.y2-h.y1}}r(L,"R");function A(i){let h=[i.topLeft,i.topRight,i.bottomRight,i.bottomLeft];return{x1:Math.min(...h.map(t=>t.x)),y1:Math.min(...h.map(t=>t.y)),x2:Math.max(...h.map(t=>t.x)),y2:Math.max(...h.map(t=>t.y))}}r(A,"D");function S(i){let h=Math.hypot(i.topRight.x-i.topLeft.x,i.topRight.y-i.topLeft.y),t=Math.hypot(i.bottomRight.x-i.bottomLeft.x,i.bottomRight.y-i.bottomLeft.y),s=Math.hypot(i.bottomLeft.x-i.topLeft.x,i.bottomLeft.y-i.topLeft.y),e=Math.hypot(i.bottomRight.x-i.topRight.x,i.bottomRight.y-i.topRight.y),o=(h+t)/2,a=(s+e)/2;return o<=0||a<=0?0:Math.max(o,a)/Math.min(o,a)}r(S,"M");var n,N=(n=class{constructor(h,t={}){this.p=0,this.lastTickAt=null,this.lastQuad=null,this.streak=0,this.format=h,this.t={...I,...t}}reset(){this.p=0,this.lastTickAt=null,this.lastQuad=null,this.streak=0}tick(h){let{quad:t,quality:s,timestampMs:e}=h,o=this.lastTickAt===null?0:Math.max(0,(e-this.lastTickAt)/1e3);this.lastTickAt=e;let a=null;if(t===null)a="dcv1.no_doc";else if(this.format==="ID-3"){let m=L(t),y=m.height>0?m.width/m.height:0;m.width<this.t.ID3_BAND_MIN_WIDTH_FRAC*h.frameWidth?a="dcv1.come_closer":this.edgeClipped(t,h.frameWidth,h.frameHeight)?a="dcv1.fit_document":(y<this.t.ID3_BAND_ASPECT_MIN||y>this.t.ID3_BAND_ASPECT_MAX)&&(a="dcv1.wrong_shape")}else E(t,h.frameWidth,h.frameHeight)<this.t.MIN_AREA_FRAC?a="dcv1.come_closer":this.edgeClipped(t,h.frameWidth,h.frameHeight)?a="dcv1.fit_document":M(this.format,S(t))||(a="dcv1.wrong_shape");let l=a===null,_=x(s.exposure)>=this.t.GUIDE_EXPOSURE,d=x(s.sharpness)>=this.t.GUIDE_SHARPNESS,u=_&&d;if(l&&u&&t!==null){let m=this.lastQuad===null||g(t,this.lastQuad)>=this.t.IOU_STABLE_MIN;this.streak=m?this.streak+1:1}else this.streak=0;this.lastQuad=t;let p=l&&u;this.p=x(this.p+(p?this.t.RISE_PER_S:-this.t.FALL_PER_S)*o);let R=p&&this.streak>=this.t.STABLE_TICKS,f;if(a!==null)f=a;else if(_)d?f="dcv1.hold_still":f="dcv1.steady";else{let m=(c[0]+c[1])/2;f=s.meanLuma<m?"dcv1.more_light":"dcv1.too_bright"}return{at:e,quad:t,plausible:l,p:this.p,guidanceKey:f,ready:R,stableTicks:this.streak}}edgeClipped(h,t,s){let e=this.t.EDGE_CLIP_MARGIN_PX;return[h.topLeft,h.topRight,h.bottomRight,h.bottomLeft].some(o=>o.x<=e||o.y<=e||o.x>=t-e||o.y>=s-e)}},r(n,"d"),n);export{T as a,I as b,E as c,L as d,N as e};
@@ -1 +1 @@
1
- import{b as U}from"./chunk-E5YZMFCZ.js";import{a as V,c as R}from"./chunk-RPMVDYDV.js";import{b as L}from"./chunk-6MYG4HWP.js";import{a as r}from"./chunk-4FHWXBOB.js";var g,f=(g=class extends Error{constructor(t){super(t.message),this.name="HostedApiError",this.status=t.status,this.code=t.code,t.retryAfterSeconds!==void 0&&(this.retryAfterSeconds=t.retryAfterSeconds),t.details&&(this.details=t.details)}},r(g,"u"),g);function H(e,t,n=Math.random){let i=(e??t)*1e3,s=Math.min(Math.max(i,500),2e4),a=Math.round(s*(1+(n()*2-1)*.25));return Math.min(Math.max(a,500),2e4)}r(H,"T");var G=6e4,N=4,se=3e4,re=9e5,ae=200,oe=5,ce=400,de=new Set(["server_busy","request_timeout"]),ue=20,le=60,pe=600,he=2;function v(e){return(e.split(";")[0]??"").trim()}r(v,"l");var fe={liveness:"clipKey",face_match:"imageKey",doc_ocr:"imageKey"},me=`@sekyro/web/${V}`,ye=me,k,it=(k=class{constructor(t){this.sessionId=null,this.bootstrap=null,this.captureNonces=[],this.captureFetch=null,this.reportedIssues=new Map,this.issueReports=0,this.issuesPausedUntil=0,this.apiOrigin=t.apiOrigin.replace(/\/+$/,""),this.sessionToken=t.sessionToken;let n=t.fetch;this.fetchImpl=(i,s)=>(n??globalThis.fetch).call(globalThis,i,s),this.requestTimeoutMs=t.requestTimeoutMs??se,this.retryAttempts=t.inProgressRetry?.attempts??oe,this.retryDelayMs=t.inProgressRetry?.delayMs??ce,this.random=t.random??Math.random,this.clientLocale=t.locale}async getSession(){let t=await this.api("GET","/hosted/session");return this.sessionId=t.sessionId,t}async recordConsent(t){let n=await this.api("POST","/hosted/consent",{body:{locale:t},busyRetry:!0}),i=this.captureHold;return this.captureHold=void 0,i&&this.armCapture(i),n}async reportCameraUnavailable(t){return this.api("POST","/hosted/camera-unavailable",{body:{cause:t}})}async testerGate(t){return this.api("POST","/hosted/tester-gate",{body:{input:t}})}async reportCaptureIssue(t){let n=typeof t.name=="string"?t.name.replace(/[^A-Za-z]/g,"").slice(0,40):"",i=typeof t.engineKind=="string"&&/^[a-z_]{1,32}$/.test(t.engineKind)?t.engineKind:void 0,s=typeof t.attempt=="number"&&Number.isInteger(t.attempt)&&t.attempt>=0&&t.attempt<=1e3?t.attempt:void 0,a=t.check==="attestation"?s??"":"",c=[t.check,a,t.kind,n,t.phase??"",i??""].join("|"),d=this.reportedIssues.get(c);if(d!==void 0)return d;if(Date.now()<this.issuesPausedUntil||this.issueReports>=ue)return;let o={check:t.check,kind:t.kind,...n!==""?{name:n}:{},...t.phase!==void 0?{phase:t.phase}:{},...i!==void 0?{engineKind:i}:{},...s!==void 0?{attempt:s}:{},...t.formFactor!==void 0?{formFactor:t.formFactor}:{},...typeof t.detail=="string"&&/^\d{1,10}$/.test(t.detail)?{detail:t.detail}:{},...J(t.challengeMs)?{challengeMs:t.challengeMs}:{},...J(t.readyMs)?{readyMs:t.readyMs}:{},...t.inApp===!0?{inApp:!0}:{}};this.issueReports+=1;let u=this.api("POST","/hosted/capture-issue",{body:o,empty:!0}).catch(l=>{if(l instanceof f&&l.status===429){let p=Math.min(Math.max(l.retryAfterSeconds??le,0),pe);this.issuesPausedUntil=Math.max(this.issuesPausedUntil,Date.now()+p*1e3);return}(!(l instanceof f)||l.status===0||l.status>=500)&&this.reportedIssues.delete(c)});return this.reportedIssues.set(c,u),u}async choose(t,n){let i=await this.api("POST","/hosted/choice",{body:{nodeId:t,option:n},busyRetry:!0});return this.sessionId=i.sessionId,i}async confirmIdentity(t){return this.api("POST","/hosted/identity/confirm",{body:{decision:t}})}async identityPortrait(){return this.api("GET","/hosted/identity/portrait",{blob:!0})}async presign(t,n,i,s={}){let a=await this.ensureSessionId(),c={kind:t,contentType:v(n),contentLength:i,...s.source==="upload"?{source:"upload"}:{}};return this.api("POST",`/sessions/${a}/media`,{body:c})}armCapture(t=2){let n=Date.now();this.captureNonces.filter(i=>i.expiresAt-G>n).length>=t||(this.captureHold===void 0?this.fillCaptureNonces(t,t):this.captureHold=Math.max(this.captureHold,t))}async armRamp(){try{let t=await this.ensureSessionId(),n=await this.api("POST",`/sessions/${t}/media/capture-nonces`,{body:{count:2,ramp:!0}}),i=Date.now(),s=U(n.screenRamp)?n.screenRamp:void 0,a=i+Math.max(0,n.expiresIn)*1e3;for(let d of Array.isArray(n.nonces)?n.nonces:[])typeof d!="string"||d.length===0||this.captureNonces.push({nonce:d,expiresAt:a,...s!==void 0?{arm:s.nonce}:{}});this.captureNonces=this.captureNonces.slice(-N),this.captureHold=void 0;let c=typeof n.rampExpiresIn=="number"&&n.rampExpiresIn>0?n.rampExpiresIn:0;return{...s!==void 0?{challenge:s}:{},expiresAt:i+c*1e3}}catch{return}}async presignCapture(t,n,i,s={}){let a=await this.ensureSessionId(),c=await this.takeCaptureNonce(s.arm),d=c===void 0?void 0:{nonce:c,...s.engine!==void 0?{engine:s.engine.slice(0,32)}:{},...s.durationMs!==void 0&&Number.isFinite(s.durationMs)?{captureMs:Math.min(36e5,Math.max(0,Math.round(s.durationMs)))}:{}},o={kind:t,contentType:v(n),contentLength:i,capture:d};return this.api("POST",`/sessions/${a}/media`,{body:o})}async takeCaptureNonce(t){let n=r(()=>{let i=Date.now();this.captureNonces=this.captureNonces.filter(a=>a.expiresAt-G>i);let s=this.captureNonces.findIndex(a=>a.arm===t);return this.captureNonces.splice(s<0?0:s,1)[0]?.nonce},"n");for(let i=0;i<2;i++){let s=n();if(s!==void 0)return s;await this.fillCaptureNonces(1)}return n()}fillCaptureNonces(t,n=0){return this.captureFetch??(this.captureFetch=(async()=>{try{let i=await this.ensureSessionId(),s=await this.api("POST",`/sessions/${i}/media/capture-nonces`,{body:{count:Math.min(N,Math.max(1,t))}}),a=Date.now()+Math.max(0,s.expiresIn)*1e3;for(let c of Array.isArray(s.nonces)?s.nonces:[])typeof c=="string"&&c.length>0&&this.captureNonces.push({nonce:c,expiresAt:a});this.captureNonces=this.captureNonces.slice(-N),this.captureHold=void 0}catch(i){i instanceof f&&i.code==="consent_required"&&(this.captureHold=Math.max(this.captureHold??0,n))}})().finally(()=>{this.captureFetch=null})),this.captureFetch}async uploadToSpaces(t,n,i){let s;try{s=await this.fetchImpl(t,{method:"PUT",headers:{"content-type":v(i)},body:n,signal:AbortSignal.timeout(re)})}catch(a){throw K(a)}if(!s.ok){let a=(await s.text().catch(()=>"")).slice(0,ae);throw new f({status:s.status,code:"upload_failed",message:`media upload failed (HTTP ${s.status})${a?`: ${a}`:""}`})}}async completeMedia(t){let n=await this.ensureSessionId();return this.api("POST",`/sessions/${n}/media/complete`,{body:{key:t}})}async submitCheck(t,n,i={}){let s=await this.ensureSessionId(),a={input:n,forceOutcome:i.forceOutcome};return this.api("POST",`/sessions/${s}/checks/${t}`,{body:a,idempotencyKey:i.idempotencyKey,...i.browserCheckToken!==void 0?{browserCheckToken:i.browserCheckToken}:{},busyRetry:i.idempotencyKey!==void 0})}async uploadAndSubmit(t,n,i,s={}){let a=v(n.contentType),c=await this.presign(n.kind,a,n.blob.size);await this.uploadToSpaces(c.uploadUrl,n.blob,a);let d=await this.completeMedia(c.key),o={...i,[fe[t]]:d.key};return this.submitCheck(t,o,s)}async ensureSessionId(){return this.sessionId!==null?this.sessionId:(this.bootstrap??(this.bootstrap=this.getSession().finally(()=>{this.bootstrap=null})),(await this.bootstrap).sessionId)}async api(t,n,i={}){let s=t==="GET"||i.busyRetry===!0,a=`${this.apiOrigin}/api/v2${n}`,c={"x-session-token":this.sessionToken,"x-sekyro-sdk":ye};i.body!==void 0&&(c["content-type"]="application/json"),i.idempotencyKey!==void 0&&(c["x-idempotency-key"]=i.idempotencyKey),i.browserCheckToken!==void 0&&(c["sekyro-browser-check"]=i.browserCheckToken),this.clientLocale!==void 0&&(c["sekyro-client-locale"]=this.clientLocale);try{let d=R.timezone();d!==void 0&&(c["sekyro-client-timezone"]=d)}catch{}c["sekyro-client-form-factor"]=L();try{let d=await R.deviceHeader();d!==void 0&&(c["sekyro-client-device"]=d)}catch{}for(let d=0;;d++){let o;try{o=await this.fetchImpl(a,{method:t,headers:c,...i.body!==void 0?{body:JSON.stringify(i.body)}:{},cache:"no-store",signal:AbortSignal.timeout(this.requestTimeoutMs)})}catch(l){throw K(l)}if(o.ok){if(i.empty===!0)return;if(i.blob===!0)try{return await o.blob()}catch(p){throw K(p)}let l;try{l=await o.json()}catch{throw new f({status:o.status,code:"unknown_error",message:`response body was not valid JSON (HTTP ${o.status})`})}return _e(l)}let u=await ve(o);if(u.code==="idempotency_in_progress"&&d<this.retryAttempts){this.retryDelayMs>0&&await B(this.retryDelayMs);continue}if(s&&u.status===503&&de.has(u.code)){s=!1,await B(H(u.retryAfterSeconds,he,this.random));continue}throw u}}},r(k,"S"),k);function J(e){return typeof e=="number"&&Number.isInteger(e)&&e>=0&&e<=6e5}r(J,"k");function K(e){if((typeof e=="object"&&e!==null?e.name:void 0)==="TimeoutError")return new f({status:0,code:"timeout",message:"request timed out"});let t=e instanceof Error?e.message:String(e);return new f({status:0,code:"network_error",message:`network request failed: ${t}`})}r(K,"f");function _e(e){return e!==null&&typeof e=="object"&&"success"in e&&"data"in e?e.data:e}r(_e,"L");async function ve(e){let t="unknown_error",n=`request failed (HTTP ${e.status})`,i=Number.NaN,s;try{let d=await e.json();if(d!==null&&typeof d=="object"){let o=d;typeof o.code=="string"&&o.code.length>0&&(t=o.code),typeof o.message=="string"&&o.message.length>0&&(n=o.message),typeof o.retryAfterSeconds=="number"&&(i=o.retryAfterSeconds),Array.isArray(o.details?.issues)?s=o.details:Array.isArray(o.details?.errors)&&(s={...o.details,issues:[]})}}catch{}let a=e.headers.get("retry-after"),c=a===null?Math.floor(i):Number.parseInt(a,10);return new f({status:e.status,code:t,message:n,...Number.isFinite(c)&&c>=0?{retryAfterSeconds:c}:{},details:s})}r(ve,"V");function B(e){return new Promise(t=>setTimeout(t,e))}r(B,"R");function st(e){let t=e?.portrait,n=t?.icao,i=t?.purpose==="id_document";return n==null?i?{policy:"reject",profile:"id_document"}:null:{policy:n.policy==="alert"?"alert":"reject",profile:i||n.profile==="id_document"?"id_document":"selfie"}}r(st,"J");function rt(e){return{...e.baselineEyeOpenness!==void 0?{baselineEyeOpenness:e.baselineEyeOpenness}:{},...e.baselineEyeOpennessLeft!==void 0&&e.baselineEyeOpennessRight!==void 0?{baselineEyeOpennessLeft:e.baselineEyeOpennessLeft,baselineEyeOpennessRight:e.baselineEyeOpennessRight}:{},criteria:e.verdict??{},...e.backgroundCheck!==void 0?{backgroundCheck:e.backgroundCheck}:{}}}r(rt,"Q");var ge=new Set(["nni_unbound","id_number_unbound","method_required","mobile_required","portrait_required"]);function dt(e){return ge.has(e)}r(dt,"be");function ut(e,t,n){let i=t.detail;return{check:e,kind:t.kind,...i?.name!==void 0?{name:i.name}:{},...i?.phase!==void 0?{phase:i.phase}:{},...i?.engineKind!==void 0?{engineKind:i.engineKind}:{},attempt:Math.max(0,Math.min(1e3,n))}}r(ut,"ve");function lt(){let e=-1,t="";return{note(n){n==="starting"&&t!=="starting"&&(e+=1),t=n},newHandle(){t=""},noteError(){e<0&&(e=0)},get value(){return e}}}r(lt,"Pe");var ke={document:"document_photo",nfc:"document_chip",population_registry:"national_number",national_eid:"national_eid"};function y(e){return e.plan?.steps??[]}r(y,"f");function F(e){return Math.max(0,e.attempts.max-e.attempts.used)}r(F,"x");function be(e){let t=e.plan?.choice;return t!==void 0&&e.plan?.current===t.nodeId?t:null}r(be,"W");function pt(e){let t=be(e);if(t?.kind!=="identity_method")return null;let n=t.options.map(s=>ke[s.service]).filter(s=>s!==void 0),i=t.options.find(s=>s.nationalEid)?.nationalEid;return i?{available:!0,selected:null,options:n,nationalEid:i}:{available:!0,selected:null,options:n}}r(pt,"Me");var we=new Set(["liveness","face_match"]);function z(e){return e!==void 0&&(e.state==="pending"||e.state==="input_required")}r(z,"y");function Me(e){return e.status!=="created"&&e.status!=="in_progress"}r(Me,"T");function W(e){let t=e.plan?.current,n=t==null?void 0:y(e).find(i=>i.id===t);return z(n)?n:void 0}r(W,"M");function q(e,t){return y(e).find(n=>n.checkType===t)}r(q,"_");function O(e){let t=y(e),n=t.findIndex(i=>i.checkType==="liveness");return t.find((i,s)=>s>n&&i.checkType==="face_match")}r(O,"S");function Se(e,t){let n=q(t,"liveness")?.state,i=O(t)?.state;return(O(e)?.state??"pending")==="pending"&&(n==="passed"||n==="review")&&i!==void 0&&i!=="pending"&&i!=="skipped"}r(Se,"F");function Q(e,t){let n=new Map(y(e).map(i=>[i.id,i.state]));return y(t).filter(i=>i.checkType==="face_match"&&(n.get(i.id)??"pending")==="pending"&&i.state!=="pending"&&i.state!=="skipped").map(i=>i.id)}r(Q,"V");var Ie=/^[0-9a-f]{24}$/i;function x(e){return Ie.test(e)?`ses_${e}`:e}r(x,"R");function E(e,t){let n=x(e);return t===void 0?{sessionId:n,status:"unavailable"}:{sessionId:n,status:"unavailable",reasonCode:t}}r(E,"w");function X(e,t,n){let i=x(e);return n===void 0?{sessionId:i,status:t}:{sessionId:i,status:t,reasonCode:n}}r(X,"O");function ht(e,t){let n=Ae(e,t),i=Ce(e);return i!==void 0&&(n.sandbox={simulated:!0,reason:i}),n}r(ht,"Ve");var Te=new Set(["no_testers","tester_gate_not_used","tester_gate_missed"]);function Ce(e){if(e.sandbox!==!0)return;let t=e.simulation?.reason;return Te.has(t)?t:void 0}r(Ce,"Q");function Ae(e,t){let n=x(e.sessionId);switch(e.status){case"created":case"in_progress":return qe(e,t);case"verified":return P(e,{sessionId:n,status:"verified"});case"review_pending":return P(e,X(n,"review",Y(e,"review")));case"not_verified":return P(e,Ee(e));default:return P(e,{sessionId:n,status:"not_verified"})}}r(Ae,"Z");var xe=new Set([0,1,2,3]);function P(e,t){return xe.has(e.level)&&(t.level=e.level),typeof e.assurance=="string"&&e.assurance.length>0&&(t.assurance=e.assurance),t}r(P,"b");function Ee(e){let t={sessionId:x(e.sessionId),status:"not_verified"};return e.reason!==void 0&&(t.reason=e.reason),e.reasonCode!==void 0&&(t.reasonCode=e.reasonCode),e.reasonCode==="device_cooldown"&&e.retryAfter!==void 0&&(t.retryAfter=e.retryAfter),t}r(Ee,"ne");function Pe(e){return e==="rejected"?"rejected":e==="unavailable"?"unavailable":"inconclusive"}r(Pe,"te");function Oe(e,t){if(t===void 0)return!1;let n=y(t).find(i=>i.id===e.id);return n!==void 0&&n.attempts.used===e.attempts.used}r(Oe,"ie");function qe(e,t){let n=x(e.sessionId),i=y(e).find(a=>we.has(a.checkType)&&a.state==="input_required"&&a.reason!==void 0);if(i?.reason==="mobile_required")return E(n,"mobile_required");if(i?.reason!==void 0){if(i.result==="unavailable")return E(n,i.reason);let a=t.autoRetry&&(F(i)>0||Oe(i,t.previous))?{sessionId:n,status:"retry",reasonCode:i.reason,attemptsRemaining:F(i)}:{sessionId:n,status:"not_verified",reason:Pe(i.result),reasonCode:i.reason,attemptsRemaining:F(i)};return i.retakeHint!==void 0&&(a.retakeHint=i.retakeHint),a}let s=W(e);return s===void 0&&y(e).some(a=>a.state==="review")?X(n,"review",Y(e,"review")):s?.checkType==="portrait_icao"?E(n,"portrait_required"):E(n)}r(qe,"re");function Y(e,t){return y(e).find(n=>n.state===t&&n.reason!==void 0)?.reason}r(Y,"L");function ee(e,t,n,i,s){return e.presignCapture!==void 0?e.presignCapture(t,n,i,s):e.presign(t,n,i)}r(ee,"K");function te(e){return{engine:e?.engine,durationMs:e?.clipMs,arm:e?.screenRamp?.nonce}}r(te,"q");var $e=["video/webm","video/mp4"],Z="image/jpeg",Re=2,Ne=1e3,Ke=1e4,He=3,Fe=10,je=3,ze=new Set(["network_error","timeout","upload_failed","unknown_error","rate_limit_exceeded"]),De=new Set(["session_not_active","check_not_found","check_already_finalized","check_out_of_order","identity_confirm_required","check_not_active","step_not_on_path","native_app_required"]),b,D=(b=class extends Error{constructor(){super("verification destroyed"),this.name="FlowCancelledError"}},r(b,"k"),b);function Ue(e){let t=O(e);return q(e,"portrait_icao")?.state!=="pending"&&(t!==void 0?z(t):e.capture?.livePhoto?.oneCapture===!0)}r(Ue,"me");var w,A=(w=class extends Error{constructor(t){super(t),this.name="AttestationError"}},r(w,"h"),w),M,Le=(M=class extends A{constructor(t){super(`no attestation token: ${t}`),this.name="AttestationUnavailableError",this.code=t}},r(M,"E"),M);async function ne(e,t,n={}){let i=e.uuid(),s=!1,a=!1,c=0,d=0;for(;;)try{return await t(e.client,i)}catch(o){if(o instanceof A){if(a||o instanceof Le)throw o;a=!0,n.onAttestationInvalid?.(),i=e.uuid();continue}if(!(o instanceof f))throw o;if(o.code==="consent_required"&&!s){s=!0,await e.ensureConsent({force:!0}),i=e.uuid();continue}if(o.code==="attestation_invalid"&&!a){a=!0,n.onAttestationInvalid?.(),i=e.uuid();continue}if(o.code==="inference_unavailable"&&d<He){d+=1;let u=H(o.retryAfterSeconds,Fe,e.random??Math.random);e.onBusy?.({attempt:d,retryAfterSeconds:u/1e3}),await e.sleep(u),n.onAttestationInvalid?.(),i=e.uuid();continue}if(ze.has(o.code)&&c<Re){c+=1;let u=o.retryAfterSeconds!==void 0?o.retryAfterSeconds*1e3:void 0;await e.sleep(u!==void 0?Math.min(u,Ke):Ne);continue}throw o}}r(ne,"D");var Ve=new Set(["passed","review","processing","skipped"]);async function ft(e){let{artifacts:t}=e,n=t.clip,i=v(t.clipMime??"");if(t.degraded==="NO_RECORDER"||n===void 0||!$e.includes(i))return{kind:"unavailable",reason:"no_recorder"};e.client.armCapture?.(2);let s=Ge(e,t.keyframe),a=Je(e,n,i,s),c=Be(e,s),d=!1,o=new Set,u=!0,l=0;for(;;){if(e.isCancelled())return{kind:"cancelled"};let p=e.getView();if(Me(p))return{kind:"settled"};let h=W(p),C=h?.checkType,$=C==="liveness"&&!d?"liveness":C==="face_match"&&!o.has(h?.id)&&o.size<2&&u?"face_match":null;if($===null)return{kind:"settled"};if($==="liveness"&&t.captureChannel==="desktop")return{kind:"unavailable",reason:"mobile_required"};try{if($==="liveness"){d=!0;let m=await a();if(e.isCancelled())return{kind:"cancelled"};Se(p,m)&&o.add(O(m)?.id);for(let ie of Q(p,m))o.add(ie);await e.applySubmit(m,"liveness");let _=q(e.getView(),"liveness")?.state;u=_===void 0||Ve.has(_)}else{o.add(h?.id);let m=await c();if(e.isCancelled())return{kind:"cancelled"};for(let _ of Q(p,m))o.add(_);await e.applySubmit(m,"face_match")}}catch(m){if(e.isCancelled()||m instanceof D)return{kind:"cancelled"};let _=Xe(m);if(_.kind!=="resync"||l>=je)return _;l+=1,await e.refreshView()}}}r(ft,"Fe");function Ge(e,t){let n=null,i=null,s=r(()=>n!==null?Promise.resolve(n):(i??(i=(async()=>{let a=await ee(e.client,"image",Z,t.size,te(e.artifacts));return await e.client.uploadToSpaces(a.uploadUrl,t,Z),n=(await e.client.completeMedia(a.key)).key,e.onKeyframePromoted?.(n),n})().finally(()=>{i=null})),i),"r");return{ensure:s,attempt:r(()=>s().catch(()=>null),"attempt"),current:r(()=>n,"current")}}r(Ge,"_e");function Je(e,t,n,i){let s=e.clipKeys?.get()??null,a,c=null,d=0,o;return()=>ne(e,async(u,l)=>{if(s===null||a===void 0){if(e.isCancelled())throw new D;a===void 0&&!Ue(e.getView())&&(a=null),e.onPhase("uploading");let[p,h]=await Promise.all([s!==null?Promise.resolve(s):(async()=>{let C=await ee(u,"clip",n,t.size,te(e.artifacts));return await u.uploadToSpaces(C.uploadUrl,t,n),(await u.completeMedia(C.key)).key})(),a!==void 0?Promise.resolve(a===null?null:a.imageKey):i.attempt()]);s=p,e.clipKeys?.set(p),a===void 0&&(a=h===null?null:{imageKey:h})}if(c===null){let p=performance.now();try{c=await e.getAttestation(),o=e.attestationError?.()}catch(h){throw h instanceof A?h:new A(h instanceof Error?h.message:String(h))}d=Math.round(performance.now()-p)}return e.onPhase("checking"),u.submitCheck("liveness",{clipKey:s,attestation:c,captureChannel:e.artifacts.captureChannel,capture:{...Qe(e.artifacts),attestationMs:d,attestationError:o,...We(e.attestationFacts?.())},...a!==null?{faceMatch:a}:{}},{idempotencyKey:l})},{onAttestationInvalid:r(()=>{c=null},"onAttestationInvalid")})}r(Je,"ge");function Be(e,t){return()=>ne(e,async(n,i)=>{if(t.current()===null){if(e.isCancelled())throw new D;e.onPhase("uploading")}let s=await t.ensure();return e.onPhase("checking"),n.submitCheck("face_match",{imageKey:s},{idempotencyKey:i})})}r(Be,"Se");function Qe(e){let t={width:e.width,height:e.height};for(let n of Ze)e[n]!==void 0&&(t[n]=e[n]);return t}r(Qe,"ye");var Ze=["engine","facingMode","mode","formFactor","clipMs","clipFrames","fps","clipRetakes","codec","cameraReadyMs","faceAcquireMs","captureMs","screenRamp","provenance"];function We(e){return e===void 0?{}:{attestationChecks:e.checks,...e.challengeMs!==void 0?{attestationChallengeMs:e.challengeMs}:{}}}r(We,"ke");function Xe(e){if(e instanceof A)return{kind:"unavailable",reason:"attestation"};if(e instanceof f){if(e.code==="attestation_invalid")return{kind:"unavailable",reason:"attestation"};if(e.code==="inference_unavailable")return{kind:"unavailable",reason:"inference_unavailable"};if(e.code==="mobile_required")return{kind:"unavailable",reason:"mobile_required"};if(De.has(e.code))return{kind:"resync"}}return{kind:"unavailable",reason:"network"}}r(Xe,"Ce");var mt="form_answers_invalid",S,yt=(S=class extends Error{constructor(t,n){super(`form answers refused (${t.map(i=>`${i.id}: ${i.code}`).join(", ")})`),this.name="FormAnswersError",this.issues=t,this.source=n}},r(S,"U"),S),I,_t=(I=class extends Error{constructor(t,n){super(`invalid ${t} (${n})`),this.name="InvalidInputError",this.field=t,this.kind=n}},r(I,"B"),I),T,vt=(T=class extends Error{constructor(t,n){super(`invalid ${t} (${n})`),this.name="OtpInputError",this.field=t,this.kind=n}},r(T,"$"),T);function j(e){return e?.source==="upload"?null:e?.source==="choice"&&e.sourcePick!=="camera"?"upload_or_phone":"phone"}r(j,"I");function gt(e,t){if(t===void 0||!z(t)||t.requiresMobile!==!0)return null;switch(t.checkType){case"liveness":return"phone";case"face_match":{if(t.reason!==void 0)return"phone";let n=q(e,"portrait_icao");return n?.state==="passed"||n?.state==="review"?null:"phone"}case"doc_ocr":return j(e.documents);case"poa":return j(e.proofOfAddress);case"portrait_icao":{let n=e.portrait;return n?.pendingFix!==void 0||n?.reuse?.pending===!0?null:j(n)}default:return null}}r(gt,"De");function Ye(e){let t=e?.capture,n=t?.mode;return n==="assisted"||n==="self"||n==="choice"?n:t?.cameraSwitch===!0?"assisted":"self"}r(Ye,"we");function kt(e){let t=e?.capture?.pick;return Ye(e)==="choice"&&(t==="self"||t==="assisted")?t:null}r(kt,"Be");function bt(e,t,n=null){return e==="choice"?t??n??"self":e}r(bt,"$e");var wt={"MR:drivers_license":{normalize:"upper_no_space_or_hyphen",pattern:"^[0-9]{8}$",check:null,registrySources:[],describe:"number must be the 8-digit Mauritanian driver's license number"},"MR:national_id":{normalize:"trim",pattern:"^[0-9]{10}$",check:"mr_nni_mod97",registrySources:["MR.anrpts"],describe:"number must be the 10-digit Mauritanian national ID number with a valid check digit"}};export{f as a,v as b,it as c,st as d,rt as e,dt as f,ut as g,lt as h,ke as i,y as j,F as k,be as l,pt as m,z as n,Me as o,W as p,q,x as r,E as s,ht as t,Ce as u,ee as v,$e as w,Le as x,ne as y,ft as z,Qe as A,mt as B,yt as C,_t as D,vt as E,gt as F,Ye as G,kt as H,bt as I,wt as J};
1
+ import{b as U}from"./chunk-WANVL25H.js";import{a as J,c as R}from"./chunk-HXD7VO3F.js";import{b as L}from"./chunk-6MYG4HWP.js";import{a as r}from"./chunk-4FHWXBOB.js";var g,m=(g=class extends Error{constructor(t){super(t.message),this.name="HostedApiError",this.status=t.status,this.code=t.code,t.retryAfterSeconds!==void 0&&(this.retryAfterSeconds=t.retryAfterSeconds),t.details&&(this.details=t.details)}},r(g,"u"),g);function H(e,t,n=Math.random){let i=(e??t)*1e3,s=Math.min(Math.max(i,500),2e4),a=Math.round(s*(1+(n()*2-1)*.25));return Math.min(Math.max(a,500),2e4)}r(H,"T");var V=6e4,N=4,se=3e4,re=9e5,ae=200,oe=5,ce=400,de=new Set(["server_busy","request_timeout"]),ue=20,le=60,pe=600,he=2;function v(e){return(e.split(";")[0]??"").trim()}r(v,"l");var me={liveness:"clipKey",face_match:"imageKey",doc_ocr:"imageKey"},fe=`@sekyro/web/${J}`,ye=fe,b,it=(b=class{constructor(t){this.sessionId=null,this.bootstrap=null,this.captureNonces=[],this.captureFetch=null,this.reportedIssues=new Map,this.issueReports=0,this.issuesPausedUntil=0,this.apiOrigin=t.apiOrigin.replace(/\/+$/,""),this.sessionToken=t.sessionToken;let n=t.fetch;this.fetchImpl=(i,s)=>(n??globalThis.fetch).call(globalThis,i,s),this.requestTimeoutMs=t.requestTimeoutMs??se,this.retryAttempts=t.inProgressRetry?.attempts??oe,this.retryDelayMs=t.inProgressRetry?.delayMs??ce,this.random=t.random??Math.random,this.clientLocale=t.locale}async getSession(){let t=await this.api("GET","/hosted/session");return this.sessionId=t.sessionId,t}async recordConsent(t){let n=await this.api("POST","/hosted/consent",{body:{locale:t},busyRetry:!0}),i=this.captureHold;return this.captureHold=void 0,i&&this.armCapture(i),n}async reportCameraUnavailable(t){return this.api("POST","/hosted/camera-unavailable",{body:{cause:t}})}async testerGate(t){return this.api("POST","/hosted/tester-gate",{body:{input:t}})}async reportCaptureIssue(t){let n=typeof t.name=="string"?t.name.replace(/[^A-Za-z]/g,"").slice(0,40):"",i=typeof t.engineKind=="string"&&/^[a-z_]{1,32}$/.test(t.engineKind)?t.engineKind:void 0,s=typeof t.attempt=="number"&&Number.isInteger(t.attempt)&&t.attempt>=0&&t.attempt<=1e3?t.attempt:void 0,a=t.check==="attestation"?s??"":"",c=[t.check,a,t.kind,n,t.phase??"",i??""].join("|"),d=this.reportedIssues.get(c);if(d!==void 0)return d;if(Date.now()<this.issuesPausedUntil||this.issueReports>=ue)return;let o={check:t.check,kind:t.kind,...n!==""?{name:n}:{},...t.phase!==void 0?{phase:t.phase}:{},...i!==void 0?{engineKind:i}:{},...s!==void 0?{attempt:s}:{},...t.formFactor!==void 0?{formFactor:t.formFactor}:{},...typeof t.detail=="string"&&/^\d{1,10}$/.test(t.detail)?{detail:t.detail}:{},...G(t.challengeMs)?{challengeMs:t.challengeMs}:{},...G(t.readyMs)?{readyMs:t.readyMs}:{},...t.inApp===!0?{inApp:!0}:{}};this.issueReports+=1;let u=this.api("POST","/hosted/capture-issue",{body:o,empty:!0}).catch(l=>{if(l instanceof m&&l.status===429){let p=Math.min(Math.max(l.retryAfterSeconds??le,0),pe);this.issuesPausedUntil=Math.max(this.issuesPausedUntil,Date.now()+p*1e3);return}(!(l instanceof m)||l.status===0||l.status>=500)&&this.reportedIssues.delete(c)});return this.reportedIssues.set(c,u),u}async choose(t,n){let i=await this.api("POST","/hosted/choice",{body:{nodeId:t,option:n},busyRetry:!0});return this.sessionId=i.sessionId,i}async confirmIdentity(t){return this.api("POST","/hosted/identity/confirm",{body:{decision:t}})}async identityPortrait(){return this.api("GET","/hosted/identity/portrait",{blob:!0})}async presign(t,n,i,s={}){let a=await this.ensureSessionId(),c={kind:t,contentType:v(n),contentLength:i,...s.source==="upload"?{source:"upload"}:{}};return this.api("POST",`/sessions/${a}/media`,{body:c})}armCapture(t=2){let n=Date.now();this.captureNonces.filter(i=>i.expiresAt-V>n).length>=t||(this.captureHold===void 0?this.fillCaptureNonces(t,t):this.captureHold=Math.max(this.captureHold,t))}async armRamp(){try{let t=await this.ensureSessionId(),n=await this.api("POST",`/sessions/${t}/media/capture-nonces`,{body:{count:2,ramp:!0}}),i=Date.now(),s=U(n.screenRamp)?n.screenRamp:void 0,a=i+Math.max(0,n.expiresIn)*1e3;for(let d of Array.isArray(n.nonces)?n.nonces:[])typeof d!="string"||d.length===0||this.captureNonces.push({nonce:d,expiresAt:a,...s!==void 0?{arm:s.nonce}:{}});this.captureNonces=this.captureNonces.slice(-N),this.captureHold=void 0;let c=typeof n.rampExpiresIn=="number"&&n.rampExpiresIn>0?n.rampExpiresIn:0;return{...s!==void 0?{challenge:s}:{},expiresAt:i+c*1e3}}catch{return}}async presignCapture(t,n,i,s={}){let a=await this.ensureSessionId(),c=await this.takeCaptureNonce(s.arm),d=c===void 0?void 0:{nonce:c,...s.engine!==void 0?{engine:s.engine.slice(0,32)}:{},...s.durationMs!==void 0&&Number.isFinite(s.durationMs)?{captureMs:Math.min(36e5,Math.max(0,Math.round(s.durationMs)))}:{}},o={kind:t,contentType:v(n),contentLength:i,capture:d};return this.api("POST",`/sessions/${a}/media`,{body:o})}async takeCaptureNonce(t){let n=r(()=>{let i=Date.now();this.captureNonces=this.captureNonces.filter(a=>a.expiresAt-V>i);let s=this.captureNonces.findIndex(a=>a.arm===t);return this.captureNonces.splice(s<0?0:s,1)[0]?.nonce},"n");for(let i=0;i<2;i++){let s=n();if(s!==void 0)return s;await this.fillCaptureNonces(1)}return n()}fillCaptureNonces(t,n=0){return this.captureFetch??(this.captureFetch=(async()=>{try{let i=await this.ensureSessionId(),s=await this.api("POST",`/sessions/${i}/media/capture-nonces`,{body:{count:Math.min(N,Math.max(1,t))}}),a=Date.now()+Math.max(0,s.expiresIn)*1e3;for(let c of Array.isArray(s.nonces)?s.nonces:[])typeof c=="string"&&c.length>0&&this.captureNonces.push({nonce:c,expiresAt:a});this.captureNonces=this.captureNonces.slice(-N),this.captureHold=void 0}catch(i){i instanceof m&&i.code==="consent_required"&&(this.captureHold=Math.max(this.captureHold??0,n))}})().finally(()=>{this.captureFetch=null})),this.captureFetch}async uploadToSpaces(t,n,i){let s;try{s=await this.fetchImpl(t,{method:"PUT",headers:{"content-type":v(i)},body:n,signal:AbortSignal.timeout(re)})}catch(a){throw K(a)}if(!s.ok){let a=(await s.text().catch(()=>"")).slice(0,ae);throw new m({status:s.status,code:"upload_failed",message:`media upload failed (HTTP ${s.status})${a?`: ${a}`:""}`})}}async completeMedia(t){let n=await this.ensureSessionId();return this.api("POST",`/sessions/${n}/media/complete`,{body:{key:t}})}async submitCheck(t,n,i={}){let s=await this.ensureSessionId(),a={input:n,forceOutcome:i.forceOutcome};return this.api("POST",`/sessions/${s}/checks/${t}`,{body:a,idempotencyKey:i.idempotencyKey,...i.browserCheckToken!==void 0?{browserCheckToken:i.browserCheckToken}:{},busyRetry:i.idempotencyKey!==void 0})}async uploadAndSubmit(t,n,i,s={}){let a=v(n.contentType),c=await this.presign(n.kind,a,n.blob.size);await this.uploadToSpaces(c.uploadUrl,n.blob,a);let d=await this.completeMedia(c.key),o={...i,[me[t]]:d.key};return this.submitCheck(t,o,s)}async ensureSessionId(){return this.sessionId!==null?this.sessionId:(this.bootstrap??(this.bootstrap=this.getSession().finally(()=>{this.bootstrap=null})),(await this.bootstrap).sessionId)}async api(t,n,i={}){let s=t==="GET"||i.busyRetry===!0,a=`${this.apiOrigin}/api/v2${n}`,c={"x-session-token":this.sessionToken,"x-sekyro-sdk":ye};i.body!==void 0&&(c["content-type"]="application/json"),i.idempotencyKey!==void 0&&(c["x-idempotency-key"]=i.idempotencyKey),i.browserCheckToken!==void 0&&(c["sekyro-browser-check"]=i.browserCheckToken),this.clientLocale!==void 0&&(c["sekyro-client-locale"]=this.clientLocale);try{let d=R.timezone();d!==void 0&&(c["sekyro-client-timezone"]=d)}catch{}c["sekyro-client-form-factor"]=L();try{let d=await R.deviceHeader();d!==void 0&&(c["sekyro-client-device"]=d)}catch{}for(let d=0;;d++){let o;try{o=await this.fetchImpl(a,{method:t,headers:c,...i.body!==void 0?{body:JSON.stringify(i.body)}:{},cache:"no-store",signal:AbortSignal.timeout(this.requestTimeoutMs)})}catch(l){throw K(l)}if(o.ok){if(i.empty===!0)return;if(i.blob===!0)try{return await o.blob()}catch(p){throw K(p)}let l;try{l=await o.json()}catch{throw new m({status:o.status,code:"unknown_error",message:`response body was not valid JSON (HTTP ${o.status})`})}return _e(l)}let u=await ve(o);if(u.code==="idempotency_in_progress"&&d<this.retryAttempts){this.retryDelayMs>0&&await B(this.retryDelayMs);continue}if(s&&u.status===503&&de.has(u.code)){s=!1,await B(H(u.retryAfterSeconds,he,this.random));continue}throw u}}},r(b,"S"),b);function G(e){return typeof e=="number"&&Number.isInteger(e)&&e>=0&&e<=6e5}r(G,"k");function K(e){if((typeof e=="object"&&e!==null?e.name:void 0)==="TimeoutError")return new m({status:0,code:"timeout",message:"request timed out"});let t=e instanceof Error?e.message:String(e);return new m({status:0,code:"network_error",message:`network request failed: ${t}`})}r(K,"f");function _e(e){return e!==null&&typeof e=="object"&&"success"in e&&"data"in e?e.data:e}r(_e,"L");async function ve(e){let t="unknown_error",n=`request failed (HTTP ${e.status})`,i=Number.NaN,s;try{let d=await e.json();if(d!==null&&typeof d=="object"){let o=d;typeof o.code=="string"&&o.code.length>0&&(t=o.code),typeof o.message=="string"&&o.message.length>0&&(n=o.message),typeof o.retryAfterSeconds=="number"&&(i=o.retryAfterSeconds),Array.isArray(o.details?.issues)?s=o.details:Array.isArray(o.details?.errors)&&(s={...o.details,issues:[]})}}catch{}let a=e.headers.get("retry-after"),c=a===null?Math.floor(i):Number.parseInt(a,10);return new m({status:e.status,code:t,message:n,...Number.isFinite(c)&&c>=0?{retryAfterSeconds:c}:{},details:s})}r(ve,"V");function B(e){return new Promise(t=>setTimeout(t,e))}r(B,"R");function st(e){let t=e?.portrait,n=t?.icao,i=t?.purpose==="id_document";return n==null?i?{policy:"reject",profile:"id_document"}:null:{policy:n.policy==="alert"?"alert":"reject",profile:i||n.profile==="id_document"?"id_document":"selfie"}}r(st,"J");function rt(e){return{...e.baselineEyeOpenness!==void 0?{baselineEyeOpenness:e.baselineEyeOpenness}:{},...e.baselineEyeOpennessLeft!==void 0&&e.baselineEyeOpennessRight!==void 0?{baselineEyeOpennessLeft:e.baselineEyeOpennessLeft,baselineEyeOpennessRight:e.baselineEyeOpennessRight}:{},criteria:e.verdict??{},...e.backgroundCheck!==void 0?{backgroundCheck:e.backgroundCheck}:{}}}r(rt,"Q");var ge=new Set(["nni_unbound","id_number_unbound","method_required","mobile_required","portrait_required"]);function dt(e){return ge.has(e)}r(dt,"Ce");function ut(e,t,n){let i=t.detail;return{check:e,kind:t.kind,...i?.name!==void 0?{name:i.name}:{},...i?.phase!==void 0?{phase:i.phase}:{},...i?.engineKind!==void 0?{engineKind:i.engineKind}:{},attempt:Math.max(0,Math.min(1e3,n))}}r(ut,"ve");function lt(){let e=-1,t="";return{note(n){n==="starting"&&t!=="starting"&&(e+=1),t=n},newHandle(){t=""},noteError(){e<0&&(e=0)},get value(){return e}}}r(lt,"Pe");var be={document:"document_photo",nfc:"document_chip",population_registry:"national_number",national_eid:"national_eid"};function y(e){return e.plan?.steps??[]}r(y,"f");function F(e){return Math.max(0,e.attempts.max-e.attempts.used)}r(F,"x");function ke(e){let t=e.plan?.choice;return t!==void 0&&e.plan?.current===t.nodeId?t:null}r(ke,"J");function pt(e){let t=ke(e);if(t?.kind!=="identity_method")return null;let n=t.options.map(s=>be[s.service]).filter(s=>s!==void 0),i=t.options.find(s=>s.nationalEid)?.nationalEid;return i?{available:!0,selected:null,options:n,nationalEid:i}:{available:!0,selected:null,options:n}}r(pt,"Me");var we=new Set(["liveness","face_match"]);function j(e){return e!==void 0&&(e.state==="pending"||e.state==="input_required")}r(j,"S");function Me(e){return e.status!=="created"&&e.status!=="in_progress"}r(Me,"T");function W(e){let t=e.plan?.current,n=t==null?void 0:y(e).find(i=>i.id===t);return j(n)?n:void 0}r(W,"M");function O(e,t){return y(e).find(n=>n.checkType===t)}r(O,"_");function $(e){let t=y(e),n=t.findIndex(i=>i.checkType==="liveness");return t.find((i,s)=>s>n&&i.checkType==="face_match")}r($,"y");function Se(e,t){let n=O(t,"liveness")?.state,i=$(t)?.state;return($(e)?.state??"pending")==="pending"&&(n==="passed"||n==="review")&&i!==void 0&&i!=="pending"&&i!=="skipped"}r(Se,"F");function Z(e,t){let n=new Map(y(e).map(i=>[i.id,i.state]));return y(t).filter(i=>i.checkType==="face_match"&&(n.get(i.id)??"pending")==="pending"&&i.state!=="pending"&&i.state!=="skipped").map(i=>i.id)}r(Z,"V");var Ie=/^[0-9a-f]{24}$/i;function x(e){return Ie.test(e)?`ses_${e}`:e}r(x,"R");function E(e,t){let n=x(e);return t===void 0?{sessionId:n,status:"unavailable"}:{sessionId:n,status:"unavailable",reasonCode:t}}r(E,"w");function X(e,t,n){let i=x(e);return n===void 0?{sessionId:i,status:t}:{sessionId:i,status:t,reasonCode:n}}r(X,"O");function ht(e,t){let n=Ae(e,t),i=Ce(e);return i!==void 0&&(n.sandbox={simulated:!0,reason:i}),n}r(ht,"Ve");var Te=new Set(["no_testers","tester_gate_not_used","tester_gate_missed"]);function Ce(e){if(e.sandbox!==!0)return;let t=e.simulation?.reason;return Te.has(t)?t:void 0}r(Ce,"Z");function Ae(e,t){let n=x(e.sessionId);switch(e.status){case"created":case"in_progress":return Oe(e,t);case"verified":return P(e,{sessionId:n,status:"verified"});case"review_pending":return P(e,X(n,"review",Y(e,"review")));case"not_verified":return P(e,Ee(e));default:return P(e,{sessionId:n,status:"not_verified"})}}r(Ae,"Q");var xe=new Set([0,1,2,3]);function P(e,t){return xe.has(e.level)&&(t.level=e.level),typeof e.assurance=="string"&&e.assurance.length>0&&(t.assurance=e.assurance),t}r(P,"C");function Ee(e){let t={sessionId:x(e.sessionId),status:"not_verified"};return e.reason!==void 0&&(t.reason=e.reason),e.reasonCode!==void 0&&(t.reasonCode=e.reasonCode),e.reasonCode==="device_cooldown"&&e.retryAfter!==void 0&&(t.retryAfter=e.retryAfter),t}r(Ee,"ne");function Pe(e){return e==="rejected"?"rejected":e==="unavailable"?"unavailable":"inconclusive"}r(Pe,"te");function $e(e,t){if(t===void 0)return!1;let n=y(t).find(i=>i.id===e.id);return n!==void 0&&n.attempts.used===e.attempts.used}r($e,"ie");function Oe(e,t){let n=x(e.sessionId),i=y(e).find(a=>we.has(a.checkType)&&a.state==="input_required"&&a.reason!==void 0);if(i?.reason==="mobile_required")return E(n,"mobile_required");if(i?.reason!==void 0){if(i.result==="unavailable")return E(n,i.reason);let a=t.autoRetry&&(F(i)>0||$e(i,t.previous))?{sessionId:n,status:"retry",reasonCode:i.reason,attemptsRemaining:F(i)}:{sessionId:n,status:"not_verified",reason:Pe(i.result),reasonCode:i.reason,attemptsRemaining:F(i)};return i.retakeHint!==void 0&&(a.retakeHint=i.retakeHint),a}let s=W(e);return s===void 0&&y(e).some(a=>a.state==="review")?X(n,"review",Y(e,"review")):s?.checkType==="portrait_icao"?E(n,"portrait_required"):E(n)}r(Oe,"re");function Y(e,t){return y(e).find(n=>n.state===t&&n.reason!==void 0)?.reason}r(Y,"L");function ee(e,t,n,i,s){return e.presignCapture!==void 0?e.presignCapture(t,n,i,s):e.presign(t,n,i)}r(ee,"K");function te(e){return{engine:e?.engine,durationMs:e?.clipMs,arm:e?.screenRamp?.nonce}}r(te,"q");var qe=["video/webm","video/mp4"],Q="image/jpeg",Re=2,Ne=1e3,Ke=1e4,He=3,Fe=10,ze=3,je=new Set(["network_error","timeout","upload_failed","unknown_error","rate_limit_exceeded"]),De=new Set(["session_not_active","check_not_found","check_already_finalized","check_out_of_order","identity_confirm_required","check_not_active","step_not_on_path","native_app_required"]),k,D=(k=class extends Error{constructor(){super("verification destroyed"),this.name="FlowCancelledError"}},r(k,"k"),k);function Ue(e){let t=$(e);return O(e,"portrait_icao")?.state!=="pending"&&(t!==void 0?j(t):e.capture?.livePhoto?.oneCapture===!0)}r(Ue,"me");var w,A=(w=class extends Error{constructor(t){super(t),this.name="AttestationError"}},r(w,"h"),w),M,Le=(M=class extends A{constructor(t){super(`no attestation token: ${t}`),this.name="AttestationUnavailableError",this.code=t}},r(M,"E"),M);async function ne(e,t,n={}){let i=e.uuid(),s=!1,a=!1,c=0,d=0;for(;;)try{return await t(e.client,i)}catch(o){if(o instanceof A){if(a||o instanceof Le)throw o;a=!0,n.onAttestationInvalid?.(),i=e.uuid();continue}if(!(o instanceof m))throw o;if(o.code==="consent_required"&&!s){s=!0,await e.ensureConsent({force:!0}),i=e.uuid();continue}if(o.code==="attestation_invalid"&&!a){a=!0,n.onAttestationInvalid?.(),i=e.uuid();continue}if(o.code==="inference_unavailable"&&d<He){d+=1;let u=H(o.retryAfterSeconds,Fe,e.random??Math.random);e.onBusy?.({attempt:d,retryAfterSeconds:u/1e3}),await e.sleep(u),n.onAttestationInvalid?.(),i=e.uuid();continue}if(je.has(o.code)&&c<Re){c+=1;let u=o.retryAfterSeconds!==void 0?o.retryAfterSeconds*1e3:void 0;await e.sleep(u!==void 0?Math.min(u,Ke):Ne);continue}throw o}}r(ne,"D");var Je=new Set(["passed","review","processing","skipped"]);async function mt(e){let{artifacts:t}=e,n=t.clip,i=v(t.clipMime??"");if(t.degraded==="NO_RECORDER"||n===void 0||!qe.includes(i))return{kind:"unavailable",reason:"no_recorder"};e.client.armCapture?.(2);let s=Ve(e,t.keyframe),a=Ge(e,n,i,s),c=Be(e,s),d=!1,o=new Set,u=!0,l=0;for(;;){if(e.isCancelled())return{kind:"cancelled"};let p=e.getView();if(Me(p))return{kind:"settled"};let h=W(p),C=h?.checkType,q=C==="liveness"&&!d?"liveness":C==="face_match"&&!o.has(h?.id)&&o.size<2&&u?"face_match":null;if(q===null)return{kind:"settled"};if(q==="liveness"&&t.captureChannel==="desktop")return{kind:"unavailable",reason:"mobile_required"};try{if(q==="liveness"){d=!0;let f=await a();if(e.isCancelled())return{kind:"cancelled"};Se(p,f)&&o.add($(f)?.id);for(let ie of Z(p,f))o.add(ie);await e.applySubmit(f,"liveness");let _=O(e.getView(),"liveness")?.state;u=_===void 0||Je.has(_)}else{o.add(h?.id);let f=await c();if(e.isCancelled())return{kind:"cancelled"};for(let _ of Z(p,f))o.add(_);await e.applySubmit(f,"face_match")}}catch(f){if(e.isCancelled()||f instanceof D)return{kind:"cancelled"};let _=Xe(f);if(_.kind!=="resync"||l>=ze)return _;l+=1,await e.refreshView()}}}r(mt,"Fe");function Ve(e,t){let n=null,i=null,s=r(()=>n!==null?Promise.resolve(n):(i??(i=(async()=>{let a=await ee(e.client,"image",Q,t.size,te(e.artifacts));return await e.client.uploadToSpaces(a.uploadUrl,t,Q),n=(await e.client.completeMedia(a.key)).key,e.onKeyframePromoted?.(n),n})().finally(()=>{i=null})),i),"r");return{ensure:s,attempt:r(()=>s().catch(()=>null),"attempt"),current:r(()=>n,"current")}}r(Ve,"_e");function Ge(e,t,n,i){let s=e.clipKeys?.get()??null,a,c=null,d=0,o;return()=>ne(e,async(u,l)=>{if(s===null||a===void 0){if(e.isCancelled())throw new D;a===void 0&&!Ue(e.getView())&&(a=null),e.onPhase("uploading");let[p,h]=await Promise.all([s!==null?Promise.resolve(s):(async()=>{let C=await ee(u,"clip",n,t.size,te(e.artifacts));return await u.uploadToSpaces(C.uploadUrl,t,n),(await u.completeMedia(C.key)).key})(),a!==void 0?Promise.resolve(a===null?null:a.imageKey):i.attempt()]);s=p,e.clipKeys?.set(p),a===void 0&&(a=h===null?null:{imageKey:h})}if(c===null){let p=performance.now();try{c=await e.getAttestation(),o=e.attestationError?.()}catch(h){throw h instanceof A?h:new A(h instanceof Error?h.message:String(h))}d=Math.round(performance.now()-p)}return e.onPhase("checking"),u.submitCheck("liveness",{clipKey:s,attestation:c,captureChannel:e.artifacts.captureChannel,capture:{...Ze(e.artifacts),attestationMs:d,attestationError:o,...We(e.attestationFacts?.())},...a!==null?{faceMatch:a}:{}},{idempotencyKey:l})},{onAttestationInvalid:r(()=>{c=null},"onAttestationInvalid")})}r(Ge,"ge");function Be(e,t){return()=>ne(e,async(n,i)=>{if(t.current()===null){if(e.isCancelled())throw new D;e.onPhase("uploading")}let s=await t.ensure();return e.onPhase("checking"),n.submitCheck("face_match",{imageKey:s},{idempotencyKey:i})})}r(Be,"ye");function Ze(e){let t={width:e.width,height:e.height};for(let n of Qe)e[n]!==void 0&&(t[n]=e[n]);return t}r(Ze,"Se");var Qe=["engine","facingMode","mode","formFactor","clipMs","clipFrames","fps","clipRetakes","codec","cameraReadyMs","faceAcquireMs","captureMs","screenRamp","provenance"];function We(e){return e===void 0?{}:{attestationChecks:e.checks,...e.challengeMs!==void 0?{attestationChallengeMs:e.challengeMs}:{}}}r(We,"ke");function Xe(e){if(e instanceof A)return{kind:"unavailable",reason:"attestation"};if(e instanceof m){if(e.code==="attestation_invalid")return{kind:"unavailable",reason:"attestation"};if(e.code==="inference_unavailable")return{kind:"unavailable",reason:"inference_unavailable"};if(e.code==="mobile_required")return{kind:"unavailable",reason:"mobile_required"};if(De.has(e.code))return{kind:"resync"}}return{kind:"unavailable",reason:"network"}}r(Xe,"be");var ft="form_answers_invalid",S,yt=(S=class extends Error{constructor(t,n){super(`form answers refused (${t.map(i=>`${i.id}: ${i.code}`).join(", ")})`),this.name="FormAnswersError",this.issues=t,this.source=n}},r(S,"U"),S),I,_t=(I=class extends Error{constructor(t,n){super(`invalid ${t} (${n})`),this.name="InvalidInputError",this.field=t,this.kind=n}},r(I,"B"),I),T,vt=(T=class extends Error{constructor(t,n){super(`invalid ${t} (${n})`),this.name="OtpInputError",this.field=t,this.kind=n}},r(T,"$"),T);function z(e){return e?.source==="upload"?null:e?.source==="choice"&&e.sourcePick!=="camera"?"upload_or_phone":"phone"}r(z,"I");function gt(e,t){if(t===void 0||!j(t)||t.requiresMobile!==!0)return null;switch(t.checkType){case"liveness":return"phone";case"face_match":{if(t.reason!==void 0)return"phone";let n=O(e,"portrait_icao");return n?.state==="passed"||n?.state==="review"?null:"phone"}case"doc_ocr":return z(e.documents);case"poa":return z(e.proofOfAddress);case"portrait_icao":{let n=e.portrait;return n?.pendingFix!==void 0||n?.reuse?.pending===!0?null:z(n)}default:return null}}r(gt,"De");function Ye(e){let t=e?.capture,n=t?.mode;return n==="assisted"||n==="self"||n==="choice"?n:t?.cameraSwitch===!0?"assisted":"self"}r(Ye,"we");function bt(e){let t=e?.capture?.pick;return Ye(e)==="choice"&&(t==="self"||t==="assisted")?t:null}r(bt,"Be");function kt(e,t,n=null){return e==="choice"?t??n??"self":e}r(kt,"$e");var wt={"JP:drivers_license":{normalize:"upper_no_space_or_hyphen",pattern:"^[0-9]{12}$",check:null,registrySources:[],describe:"number must be the 12-digit Japanese driving licence number"},"JP:residence_permit":{normalize:"upper_no_space_or_hyphen",pattern:"^[A-Z]{2}[0-9]{8}[A-Z]{2}$",check:null,registrySources:[],describe:"number must be the 12-character residence card number: two letters, eight digits, two letters"},"MR:drivers_license":{normalize:"upper_no_space_or_hyphen",pattern:"^[0-9]{8}$",check:null,registrySources:[],describe:"number must be the 8-digit Mauritanian driver's license number"},"MR:national_id":{normalize:"trim",pattern:"^[0-9]{10}$",check:"mr_nni_mod97",registrySources:["MR.anrpts"],describe:"number must be the 10-digit Mauritanian national ID number with a valid check digit"}};export{m as a,v as b,it as c,st as d,rt as e,dt as f,ut as g,lt as h,be as i,y as j,F as k,ke as l,pt as m,j as n,Me as o,W as p,O as q,x as r,E as s,ht as t,Ce as u,ee as v,qe as w,Le as x,ne as y,mt as z,Ze as A,ft as B,yt as C,_t as D,vt as E,gt as F,Ye as G,bt as H,kt as I,wt as J};
@@ -1 +1 @@
1
- import{a as Nr}from"./chunk-HM65LKWB.js";import{c as _t}from"./chunk-Q7ACZDU4.js";import{b as kr,d as br}from"./chunk-E5JQU363.js";import{b as xr,c as Ct}from"./chunk-BR5RW4XZ.js";import{a as yr,b as gr,c as vr,d as Me}from"./chunk-DHMC5D6M.js";import{F as _r,K as wr,L as Sr,a as K,b as de,c as te,m as pr,n as Xe,p as hr,q as et,r as fr,s as mr,t as bt,u as oe,v as Ee,w as tt,y as Cr}from"./chunk-Z6KNLRUW.js";import{c as ir,d as cr,e as ur,h as dr}from"./chunk-E5YZMFCZ.js";import{b as kt}from"./chunk-RPMVDYDV.js";import{a as s}from"./chunk-5QL6W6FW.js";import{g as lr}from"./chunk-6MYG4HWP.js";import{a as o,c as U}from"./chunk-4FHWXBOB.js";var Ar=U(K(),1),y=U(de(),1),re=U(de(),1),ye=U(K(),1),F=U(de(),1),C=U(K(),1),m=U(K(),1),at=U(K(),1),fe=U(de(),1),Wr=U(K(),1),Q=U(K(),1),lt=U(K(),1),we=U(de(),1),Se=U(de(),1),P=U(de(),1);var it=U(K(),1),pe=U(K(),1);var J=U(K(),1);var E=U(K(),1),me=U(K(),1),Te=U(K(),1),At=U(de(),1),v=U(de(),1);function ie({className:e,children:t}){return(0,y.jsx)("svg",{"aria-hidden":"true",focusable:"false",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",className:e??"sekyro-icon sekyro-icon--sm",children:t})}o(ie,"ne");s(ie,"Svg");var Mt="M4 7.5h2.2l1.4-1.9h8.8l1.4 1.9H20a1.6 1.6 0 0 1 1.6 1.6v8.3A1.6 1.6 0 0 1 20 19H4a1.6 1.6 0 0 1-1.6-1.6V9.1A1.6 1.6 0 0 1 4 7.5Z";function Mr(e){return(0,y.jsxs)(ie,{...e,children:[(0,y.jsx)("circle",{cx:"12",cy:"12",r:"4"}),(0,y.jsx)("path",{d:"M12 2.5v2M12 19.5v2M2.5 12h2M19.5 12h2M5.3 5.3l1.4 1.4M17.3 17.3l1.4 1.4M5.3 18.7l1.4-1.4M17.3 6.7l1.4-1.4"})]})}o(Mr,"ln");s(Mr,"SunIcon");function Er(e){return(0,y.jsxs)(ie,{...e,children:[(0,y.jsx)("circle",{cx:"12",cy:"12",r:"9"}),(0,y.jsx)("path",{d:"M9 10h.01M15 10h.01M8.8 14.6a4.2 4.2 0 0 0 6.4 0"})]})}o(Er,"un");s(Er,"FaceUncoveredIcon");function Lr(e){return(0,y.jsxs)(ie,{...e,children:[(0,y.jsx)("rect",{x:"7",y:"2.5",width:"10",height:"19",rx:"2"}),(0,y.jsx)("path",{d:"M10.5 18.5h3M2.5 9.5h2.5M19 9.5h2.5"}),(0,y.jsx)("circle",{cx:"12",cy:"9.5",r:"1.6"})]})}o(Lr,"dn");s(Lr,"PhoneEyeLevelIcon");function Ir(e){return(0,y.jsxs)(ie,{...e,children:[(0,y.jsx)("path",{d:"M2.5 12S6 5.5 12 5.5 21.5 12 21.5 12 18 18.5 12 18.5 2.5 12 2.5 12Z"}),(0,y.jsx)("circle",{cx:"12",cy:"12",r:"2.8"})]})}o(Ir,"pn");s(Ir,"LookStraightIcon");function Ur(e){return(0,y.jsxs)(ie,{...e,children:[(0,y.jsx)("path",{d:Mt}),(0,y.jsx)("path",{d:"M9 13l2 2 4-4"})]})}o(Ur,"fn");s(Ur,"CameraCheckIcon");function jr(e){return(0,y.jsxs)(ie,{...e,children:[(0,y.jsx)("path",{d:Mt}),(0,y.jsx)("path",{d:"M10.2 11.2a1.9 1.9 0 1 1 2.6 1.8c-.5.2-.8.6-.8 1.1v.3M12 16.4h.01"})]})}o(jr,"mn");s(jr,"CameraAskIcon");function Tr(e){return(0,y.jsxs)(ie,{...e,children:[(0,y.jsx)("path",{d:Mt}),(0,y.jsx)("path",{d:"M3 3l18 18"})]})}o(Tr,"yn");s(Tr,"CameraBlockedIcon");function nt({off:e,className:t}){return(0,y.jsxs)(ie,{className:t,children:[(0,y.jsx)("path",{d:"M4.5 9.5v5H8l4 3.5v-12L8 9.5H4.5Z"}),e?(0,y.jsx)("path",{d:"M4 4l16 16"}):(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)("path",{d:"M15.5 9.7a3.6 3.6 0 0 1 0 4.6"}),(0,y.jsx)("path",{d:"M18 7.6a6.6 6.6 0 0 1 0 8.8"})]})]})}o(nt,"Ve");s(nt,"SpeakerIcon");function Or(e){return(0,y.jsx)(ie,{...e,children:(0,y.jsx)("path",{d:"M5 12.5l4.5 4.5L19 7.5"})})}o(Or,"gn");s(Or,"CheckIcon");function Pr(e){return(0,y.jsxs)(ie,{className:e.className??"sekyro-spinner",children:[(0,y.jsx)("circle",{cx:"12",cy:"12",r:"9",opacity:"0.25"}),(0,y.jsx)("path",{d:"M21 12a9 9 0 0 0-9-9"})]})}o(Pr,"hn");s(Pr,"SpinnerIcon");var wt=["light","uncover","eyeLevel","straight"],Ln={light:{key:"capture.tips.light",icon:s(()=>(0,re.jsx)(Mr,{}),"icon")},uncover:{key:"capture.tips.uncover",icon:s(()=>(0,re.jsx)(Er,{}),"icon")},eyeLevel:{key:"capture.tips.eyeLevel",icon:s(()=>(0,re.jsx)(Lr,{}),"icon")},straight:{key:"capture.tips.straight",icon:s(()=>(0,re.jsx)(Ir,{}),"icon")}};function Br({tips:e}){let t=Me(),n=(0,Ar.useId)();return e.length===0?null:(0,re.jsxs)("section",{className:"sekyro-tips","aria-labelledby":n,"data-testid":"sekyro-tips",children:[(0,re.jsx)("p",{className:"sekyro-tips__title",id:n,children:t("capture.tips.title")}),(0,re.jsx)("ul",{className:"sekyro-tips__list",children:e.map(r=>{let a=typeof r=="string"?Ln[r]:void 0,l=typeof r=="string"?r:r.id,c=a!==void 0?a.icon():typeof r=="string"?void 0:r.icon,d=a!==void 0?t(a.key):typeof r=="string"?r:r.text;return(0,re.jsxs)("li",{className:"sekyro-tips__item",children:[c!=null?(0,re.jsx)("span",{className:"sekyro-tips__icon","aria-hidden":"true",children:c}):null,(0,re.jsx)("span",{children:d})]},l)})})]})}o(Br,"Cn");s(Br,"TipList");var In=220;function qr({title:e,description:t,options:n,busy:r,error:a,focus:l,testId:c,look:d="cards",marked:S,onChoose:p}){let w=(0,ye.useId)(),N=bt(),[j,R]=(0,ye.useState)(null),B=(0,ye.useRef)(null);(0,ye.useEffect)(()=>{a!==null&&R(null)},[a]),(0,ye.useEffect)(()=>()=>{B.current!==null&&clearTimeout(B.current)},[]);let q=s(A=>{r||j!==null||(R(A),B.current=setTimeout(()=>{B.current=null,R(null),p(A)},In))},"choose");return(0,F.jsxs)("section",{className:"sekyro-stack sekyro-stack--4 sekyro-choice","aria-labelledby":w,"data-testid":c,children:[(0,F.jsxs)("div",{className:d==="cards"?"sekyro-heading":"sekyro-stack sekyro-stack--1",children:[(0,F.jsx)("h2",{id:w,ref:l?N:void 0,tabIndex:-1,className:"sekyro-text-body",children:e}),t!==void 0&&t!==""?(0,F.jsx)("p",{className:"sekyro-text-muted",children:t}):null]}),a!==null?(0,F.jsx)(oe,{tone:"danger",children:(0,F.jsx)("span",{children:a})}):null,d==="buttons"?(0,F.jsx)("div",{className:"sekyro-stack sekyro-stack--3",children:n.map((A,X)=>(0,F.jsx)(te,{kind:X===0?"primary":"ghost",full:!0,disabled:r,"aria-busy":r||void 0,onClick:o(()=>p(A.id),"onClick"),children:A.label},A.id))}):(0,F.jsx)("div",{className:"sekyro-choices",children:n.map(A=>(0,F.jsxs)("button",{type:"button",className:"sekyro-card","aria-pressed":(j??S)===A.id,"aria-busy":r||void 0,disabled:r||j!==null&&j!==A.id,onClick:o(()=>q(A.id),"onClick"),children:[A.glyph!==void 0?(0,F.jsx)("span",{className:"sekyro-card__tile",children:A.glyph}):null,(0,F.jsxs)("span",{className:"sekyro-card__body",children:[(0,F.jsx)("span",{className:"sekyro-card__title",children:A.label}),A.sub!==void 0?(0,F.jsx)("span",{className:"sekyro-card__sub",children:A.sub}):null]}),(0,F.jsx)("span",{className:"sekyro-radio","aria-hidden":"true"})]},A.id))})]})}o(qr,"bn");s(qr,"ChoiceScreen");var Vr=["fcv3.no_face","fcv3.come_closer","fcv3.move_back","fcv3.center_face","fcv3.straighten","fcv3.more_light","fcv3.too_bright","fcv3.hold_still","fcv3.steady_camera","fcv3.hold_upright","fcv3.one_face","capture.tips.summary","capture.lookAtColours"];function st(e){return e!==null&&Vr.includes(e)}o(st,"he");s(st,"isVoiceKey");var Un=s((e,t)=>Object.prototype.hasOwnProperty.call(e,t),"own");function je(e,t,n){let r;try{if(typeof e=="function")r=e(t,n);else{let a=e[n];r=a!=null&&Un(a,t)?a[t]:null}}catch{return null}return typeof r=="string"&&r!==""?r:null}o(je,"Me");s(je,"resolveClip");var jn="UklGRiQAAABXQVZFZm10IBAAAAABAAEAESsAACJWAAACABAAZGF0YQAAAAA=",Tn={ar:"ar-SA",fr:"fr-FR",en:"en-US",es:"es-ES",pt:"pt-BR",de:"de-DE"};function le(){return typeof window<"u"&&"speechSynthesis"in window?window.speechSynthesis:null}o(le,"re");s(le,"synth");function Dr(){return le()!==null&&typeof SpeechSynthesisUtterance=="function"}o(Dr,"Lr");s(Dr,"speechAvailable");function St(e){return(e.split(/[-_]/)[0]??e).toLowerCase()}o(St,"Sn");s(St,"baseLang");function Et(e,t){let n=s(a=>a.replace(/_/g,"-").toLowerCase(),"norm"),r=St(t);return e.find(a=>n(a.lang)===n(t))??e.find(a=>St(a.lang)===r)}o(Et,"Mn");s(Et,"pickVoice");function $r(e){if(!Dr())return!1;let t=[];try{t=le()?.getVoices()??[]}catch{return!0}return t.length===0||Et(t,e)!==void 0}o($r,"wn");s($r,"speechUsable");function Fr(e){let t=le();return t===null||typeof t.addEventListener!="function"?()=>{}:(t.addEventListener("voiceschanged",e),()=>t.removeEventListener?.("voiceschanged",e))}o(Fr,"Ln");s(Fr,"subscribeVoices");function De(e){try{let t=typeof location<"u"?location.href:"http://localhost/",n=new URL(e,t);return`clip:${n.origin}${n.pathname}`}catch{return`clip:${e}`}}o(De,"Ke");s(De,"clipIdentity");function xt(e){e.pause(),e.removeAttribute("src"),e.load()}o(xt,"Rn");s(xt,"release");function Hr(){let e=null,t=null,n=0,r=null,a=null,l=null,c=!1,d=null,S=[],p=new Map,w=s(()=>{S=le()?.getVoices()??[]},"loadVoices"),N=!1,j=s(()=>{let h=le();N||h===null||(N=!0,w(),h.addEventListener?.("voiceschanged",w))},"bindVoices"),R=s(()=>(e??(e=new Audio),e),"element"),B=s((h,x,_,k)=>{let u=le();if(u!==null&&h!==""&&typeof SpeechSynthesisUtterance=="function"){j();let M=Et(S,x);if(S.length===0||M!==void 0){u.cancel();let I=new SpeechSynthesisUtterance(h);I.lang=x,M!==void 0&&(I.voice=M),I.rate=.95,_!==void 0&&(I.onend=_),(_!==void 0||k!==void 0)&&(I.onerror=D=>{k!==void 0&&D.error==="not-allowed"?k():_?.()}),u.speak(I);return}}_?.()},"speak"),q=s(()=>{n+=1,r=null,a=l=null,e!==null&&(e.pause(),e.currentTime=0),le()?.cancel()},"stop"),A=s(h=>{for(let x of h){let _=De(x);if(p.has(_))continue;let k=new Audio;k.preload="auto",k.src=x,p.set(_,k)}},"warmClips"),X=s((h,x,_)=>{let k={utterance:h,generation:x,end:_};d=k;let u=s(()=>x===n&&d===k,"live"),M=s(()=>{u()&&(a=k)},"block");if(le()?.cancel(),h.url!==null){let I=R();I.pause(),I.muted=!1,I.src=h.url,I.currentTime=0,I.onended=_??null;let D=s(()=>{l===k&&(l=null)},"settled"),i=I.play();if(i===void 0)return;l=k,i.then(D,T=>{if(D(),!u())return;let O=T?.name;if(O!=="AbortError"){if(O==="NotAllowedError")return M();h.speech?B(h.text,h.lang,_,M):_?.()}});return}h.speech?B(h.text,h.lang,_,M):_?.()},"start");return{say(h){let x=h.url!==null?De(h.url):`tts:${h.lang}:${h.text}`;if(x===r)return;r=x,a=l=null,n+=1;let _=n,k=h.onEnd;X(h,_,k!==void 0?()=>{_===n&&k()}:void 0)},unlock({lang:h,speech:x,prefetch:_}){let k=a??(c?null:l);c=!0;let u=k!==null&&k.generation===n?k:null;a=l=null,u!==null&&X(u.utterance,u.generation,u.end);let M=R();if(t===null&&typeof Blob=="function"&&typeof URL.createObjectURL=="function"){let T=Uint8Array.from(atob(jn),O=>O.charCodeAt(0));t=URL.createObjectURL(new Blob([T],{type:"audio/wav"}))}let I=M.paused===!1&&t!==null&&M.src!==t;t!==null&&!I&&(u===null||u.utterance.url===null)&&(M.muted=!0,M.onended=null,M.src=t,M.play()?.catch(()=>{}));let D=le(),i=u!==null&&u.utterance.url===null;if(x&&!i&&D!==null&&typeof SpeechSynthesisUtterance=="function"){j();let T=new SpeechSynthesisUtterance(" ");T.volume=0,T.lang=h,D.speak(T)}A(_??[])},prefetch:A,stop:q,dispose(){q(),N&&le()?.removeEventListener?.("voiceschanged",w),N=!1,t!==null&&URL.revokeObjectURL(t),t=null,e!==null&&xt(e),e=null;for(let h of p.values())xt(h);p.clear()}}}o(Hr,"_n");s(Hr,"createVoicePlayer");var On="sekyro.voiceGuidance";function Gr(e){try{if(typeof window>"u")return null;let t=window.localStorage.getItem(e);return t==="1"?!0:t==="0"?!1:null}catch{return null}}o(Gr,"xn");s(Gr,"readVoicePreference");function Kr(e,t){try{if(typeof window>"u")return;window.localStorage.setItem(e,t?"1":"0")}catch{}}o(Kr,"En");s(Kr,"writeVoicePreference");var Ve="capture.tips.summary",Pn=typeof window<"u"?C.useLayoutEffect:C.useEffect,Bn=Object.freeze({});function rt(e,t){let n=new Set,r=[];for(let a of Vr){let l=a===Ve?null:je(e,a,t);l===null||n.has(De(l))||(n.add(De(l)),r.push(l))}return r}o(rt,"ht");s(rt,"resolvedClipUrls");function Zr({locale:e,defaultClips:t,options:n}){let r=n===!1,a=r?{}:n??{},l=a.storageKey===void 0?On:a.storageKey,[c,d]=(0,C.useState)(a.defaultEnabled??!0),S=(0,C.useRef)(c),[p,w]=(0,C.useState)(!1),[N,j]=(0,C.useState)("none"),[R,B]=(0,C.useState)(!1),q=(0,C.useRef)(!1),[A,X]=(0,C.useState)(0),h=(0,C.useRef)(null),x=(0,C.useCallback)(()=>(h.current??(h.current=Hr()),h.current),[]),_=Tn[e],k=a.speechFallback,u=k===void 0||k===!0?!0:k===!1?!1:k.includes(e),M=a.clips??t??Bn,I=(0,C.useRef)(!1),D=(0,C.useRef)(M);Pn(()=>{D.current=M,S.current=c}),(0,C.useEffect)(()=>{if(r||l===null)return;let L=Gr(l);L!==null&&(S.current=L,d(L))},[r,l]),(0,C.useEffect)(()=>{if(!(r||!u))return Fr(()=>X(L=>L+1))},[r,u]);let i=a.clips;(0,C.useEffect)(()=>{if(r)return;let L=u&&$r(_);w(rt(M,e).length>0||L),j(i!==void 0&&je(i,Ve,e)!==null?"partner":je(M,Ve,e)!==null||L?"default":"none")},[r,M,i,e,u,_,A]),(0,C.useEffect)(()=>{if(r||!c||!I.current)return;let L=rt(M,e);L.length>0&&x().prefetch(L)},[r,c,M,e,x]),(0,C.useEffect)(()=>()=>{h.current?.dispose(),h.current=null,I.current=!1},[]);let T=(0,C.useCallback)(L=>{r||(I.current=!0,x().unlock({lang:_,speech:u,...L?{prefetch:rt(D.current,e)}:{}}))},[r,x,_,u,e]),O=(0,C.useCallback)(()=>T(S.current),[T]),z=(0,C.useCallback)(()=>{q.current=!1,B(!1)},[]),$=(0,C.useCallback)(()=>{z(),h.current?.stop()},[z]),ge=(0,C.useCallback)(()=>{q.current&&$()},[$]),he=(0,C.useCallback)((L,xe)=>{if(r)return;if(q.current){$();return}let ve=x();ve.stop(),q.current=!0,B(!0);let V=xe?.clip===!1?null:je(D.current,Ve,e);ve.say({url:V,text:L,lang:_,speech:u,onEnd:z})},[r,$,x,e,_,u,z]),Y=(0,C.useCallback)(L=>{r||(L?T(!0):$(),l!==null&&Kr(l,L),S.current=L,d(L))},[r,T,$,l]),W=(0,C.useCallback)(()=>Y(!S.current),[Y]),ne=(0,C.useCallback)((L,xe)=>{if(r||!c)return;q.current&&z();let ve=je(D.current,L,e);x().say({url:ve,text:xe,lang:_,speech:u})},[r,c,e,x,_,u,z]);return(0,C.useMemo)(()=>({supported:!r&&p,enabled:!r&&c,setEnabled:Y,toggle:W,unlock:O,speakKey:ne,stop:$,summary:r?"none":N,summaryPlaying:R,toggleSummary:he,stopSummary:ge}),[r,p,c,Y,W,O,ne,$,N,R,he,ge])}o(Zr,"vt");s(Zr,"useVoiceGuidance");function zr(e,t,n,r){let{speakKey:a,stop:l,enabled:c}=e,d=(0,C.useRef)(!1);(0,C.useEffect)(()=>{if(!r||!c){d.current&&l(),d.current=!1;return}d.current=!0,st(t)&&t!==Ve&&n!==""&&a(t,n)},[r,c,t,n,a,l])}o(zr,"Ct");s(zr,"useSpeakGuidance");function ot(e){switch(e){case"multiple_faces":return"one_face";case"capture_back_camera":return"front_camera";case"capture_front_camera":return"back_camera";case"capture_not_upright":return"upright";case"media_unreadable":case"clip_too_short":return"recording";case"device_integrity_failed":return"device";default:return"face"}}o(ot,"Pn");s(ot,"retryCoachingOf");var $e={face:{title:"capture.retryCoaching.title",tips:["capture.retryCoaching.light","capture.retryCoaching.eyeLevel","capture.retryCoaching.head"]},one_face:{title:"capture.retryTips.title",tips:["capture.retryOneFace.alone","capture.retryOneFace.screens"]},front_camera:{title:"capture.retryTips.title",tips:["capture.retryFrontCamera.screenSide"]},back_camera:{title:"capture.retryTips.title",tips:["capture.retryBackCamera.backSide","capture.retryBackCamera.circle"]},upright:{title:"capture.retryTips.title",tips:["capture.retryUpright.vertical","capture.retryUpright.untilEnd"]},recording:{title:"capture.retryTips.title",tips:["capture.retryRecording.cameraOn","capture.retryRecording.stay","capture.retryRecording.network"]},device:{title:"capture.retryTips.title",tips:["capture.retryDevice.screenRecording","capture.retryDevice.phone"]}};function Yr({showCoaching:e,coaching:t="face",attemptsText:n,showRetake:r,onRetake:a}){let l=Me(),c=(0,at.useRef)(null);return(0,at.useEffect)(()=>{r&&c.current?.focus()},[r]),!e&&!r?null:(0,fe.jsxs)("div",{className:"sekyro-stack sekyro-stack--3","data-testid":"sekyro-captured-panel",children:[e?(0,fe.jsxs)("div",{className:"sekyro-stack sekyro-stack--1",children:[(0,fe.jsx)("p",{className:"sekyro-text-body",children:l($e[t].title)}),(0,fe.jsx)("ul",{className:"sekyro-coaching",children:$e[t].tips.map(d=>(0,fe.jsx)("li",{children:l(d)},d))}),n!==null?(0,fe.jsx)("p",{className:"sekyro-text-muted","data-testid":"sekyro-attempts-remaining",children:n}):null]}):null,r?(0,fe.jsx)(te,{ref:c,className:"sekyro-btn--start",onClick:a,children:l("capture.recordAgain")}):null]})}o(Yr,"Tn");s(Yr,"CapturedPanel");function Lt(){try{return!1}catch{return!1}}o(Lt,"nt");s(Lt,"isDevBuild");var qn=(0,Wr.createContext)(null);function Jr({state:e}){let t=Me(),[n,r]=(0,lt.useState)(!1);(0,lt.useEffect)(()=>{e!=="unknown"&&r(!0)},[e]);let a=e==="granted"?(0,we.jsx)(Ur,{}):e==="denied"?(0,we.jsx)(Tr,{}):(0,we.jsx)(jr,{});return(0,we.jsxs)("div",{role:n?"status":void 0,className:`sekyro-permission sekyro-permission--${e}`,"data-testid":"sekyro-permission","data-state":e,children:[(0,we.jsx)("span",{className:"sekyro-permission__icon","aria-hidden":"true",children:a}),(0,we.jsx)("span",{children:t(`capture.permission.${e}`)})]})}o(Jr,"On");s(Jr,"PermissionRow");function Qr({voice:e}){let t=Me();if(!e.supported)return null;let n=e.enabled;return(0,Se.jsxs)("button",{type:"button",role:"switch","aria-checked":n,className:"sekyro-switch","data-testid":"sekyro-voice-switch",onClick:o(()=>e.toggle(),"onClick"),children:[(0,Se.jsxs)("span",{className:"sekyro-switch__label",children:[(0,Se.jsx)(nt,{off:!n}),t("capture.voiceGuidance")]}),(0,Se.jsx)("span",{className:"sekyro-switch__track","aria-hidden":"true",children:(0,Se.jsx)("span",{className:"sekyro-switch__thumb",children:n?(0,Se.jsx)(Or,{className:"sekyro-switch__check"}):null})})]})}o(Qr,"Hn");s(Qr,"VoiceSwitch");function Xr({assets:e,onRetryAssets:t,permission:n,captureMode:r="self",voice:a,tips:l,summary:c,startLabel:d,startDisabled:S,onStart:p}){let w=Me(),N=(0,Q.useRef)(c?.stop);N.current=c?.stop,(0,Q.useEffect)(()=>()=>N.current?.(),[]);let j=(0,Q.useRef)(null),R=(0,Q.useRef)(null),B=(0,Q.useRef)(null),q=(0,Q.useRef)(e),A=(0,Q.useRef)(!1);(0,Q.useEffect)(()=>{let u=q.current;if(q.current=e,u===e)return;let M=A.current;e!=="loading"&&(A.current=!1),en(j.current)&&(e==="failed"?B.current?.focus():M&&R.current?.focus())},[e]);let X=(0,Q.useCallback)(()=>{A.current=!0,t()},[t]),h=e==="loading",x=h||S,_=(0,Q.useCallback)(()=>{x||(N.current?.(),p())},[x,p]),k;return e==="failed"?k=(0,P.jsxs)(oe,{tone:"danger",testId:"sekyro-assets-error",children:[(0,P.jsx)("p",{className:"sekyro-text-body",children:w("fcv2.err.models")}),(0,P.jsx)(te,{kind:"ghost",ref:B,className:"sekyro-btn--start",onClick:X,"data-testid":"sekyro-assets-retry",children:w("common.retry")})]}):k=(0,P.jsxs)("div",{className:"sekyro-stack sekyro-stack--1",children:[(0,P.jsx)(te,{ref:R,full:!0,"data-testid":"sekyro-start","aria-disabled":x?"true":void 0,"aria-busy":h?"true":void 0,onClick:_,children:h?(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(Pr,{}),w("capture.preparing.title")]}):d??w("capture.start")}),h?(0,P.jsx)("p",{className:"sekyro-text-muted",children:w("capture.preparing.hint")}):null]}),(0,P.jsxs)("div",{ref:j,className:"sekyro-stack sekyro-stack--4","data-testid":"sekyro-intro","data-assets":e,children:[r==="assisted"?(0,P.jsxs)("div",{className:"sekyro-stack sekyro-stack--1","data-testid":"sekyro-assisted-intro",children:[(0,P.jsx)("h2",{className:"sekyro-text-body",children:w("capture.assisted.title")}),(0,P.jsx)("p",{className:"sekyro-text-muted",children:w("capture.assisted.lead")})]}):null,l!==!1?(0,P.jsx)(Br,{tips:l}):null,c!==void 0?(0,P.jsxs)(te,{kind:"ghost",className:"sekyro-btn--start",onClick:c.toggle,"data-testid":"sekyro-tips-listen",children:[(0,P.jsx)(nt,{off:!1}),w(c.playing?"capture.tips.stop":"capture.tips.listen")]}):null,(0,P.jsx)(Jr,{state:n}),(0,P.jsx)(Qr,{voice:a}),(0,P.jsx)("p",{className:"sekyro-text-muted",children:w("capture.securityNote")}),k,(0,P.jsx)("p",{role:"status",className:"sekyro-visually-hidden","data-testid":"sekyro-intro-status",children:e==="loading"?w("capture.preparing.title"):e==="ready"?w("capture.ready"):""})]})}o(Xr,"Fn");s(Xr,"PreCaptureScreen");function en(e){if(typeof document>"u")return!1;let t=document.activeElement;return t===null||t===document.body||e!==null&&e.contains(t)}o(en,"Ur");s(en,"focusIsOurs");function tn(){let[e,t]=(0,it.useState)({state:"unknown",settled:!1});return(0,it.useEffect)(()=>lr(n=>t({state:n,settled:!0})),[]),{permission:e.state,permissionSettled:e.settled}}o(tn,"Dn");s(tn,"useCameraStatus");function rn(e){return It(e,"mobileRequired")}o(rn,"qn");s(rn,"useMobileRequired");function nn(e){return It(e,"returning").required}o(nn,"jn");s(nn,"useReturning");function It(e,t){let[n,r]=(0,pe.useState)({required:!1,settled:e===void 0});return(0,pe.useEffect)(()=>{let a=e?.[t];if(e===void 0||typeof a!="function"){r({required:!1,settled:!0});return}let l=!0;return r({required:!1,settled:!1}),Promise.resolve().then(()=>a.call(e)).then(c=>{l&&r({required:c===!0,settled:!0})},()=>{l&&r({required:!1,settled:!0})}),()=>{l=!1}},[e,t]),n}o(It,"Yn");s(It,"useFlag");function sn(e){let t=s(()=>e?.captureChoice??null,"initialChoice"),[n,r]=(0,pe.useState)(()=>({session:"self",choice:t(),settled:e===void 0}));(0,pe.useEffect)(()=>{let l=e?.captureMode,c=e?.captureChoice??null;if(e===void 0||typeof l!="function"){r({session:"self",choice:c,settled:!0});return}let d=!0;return r({session:"self",choice:c,settled:!1}),Promise.resolve().then(()=>l.call(e)).then(S=>{let p=e.captureChoice??null;d&&r({session:p!==null&&S===p?"choice":S==="assisted"||S==="choice"?S:"self",choice:p,settled:!0})},()=>{d&&r({session:"self",choice:null,settled:!0})}),()=>{d=!1}},[e]);let a=(0,pe.useCallback)(l=>{e?.chooseCaptureMode?.(l),r(c=>({...c,choice:l}))},[e]);return{mode:n.session==="choice"?n.choice??"self":n.session==="assisted"?"assisted":"self",session:n.session,choice:n.choice,settled:n.settled,choose:a}}o(sn,"$n");s(sn,"useCaptureMode");function an(e){let[t,n]=(0,pe.useState)(!1);return(0,pe.useEffect)(()=>{if(n(!1),e===void 0)return;let r=e.on("busy",()=>n(!0)),a=e.on("result",()=>n(!1));return()=>{r(),a()}},[e]),t}o(an,"zn");s(an,"useBusy");var Vn=s(()=>"idle","serverSnapshot");function Nt(e){return ir(e!==void 0?{assetBaseUrl:e}:{})}o(Nt,"Qn");s(Nt,"preload");function on(e,t=!0){let n=(0,J.useSyncExternalStore)((0,J.useCallback)(p=>ur(p,e),[e]),()=>cr(e),Vn),[r,a]=(0,J.useState)(null),l=(0,J.useRef)(!1),c=(0,J.useCallback)(()=>{Nt(e).then(p=>{l.current&&p==="idle"&&a({base:e})})},[e]);(0,J.useEffect)(()=>(l.current=!0,c(),()=>{l.current=!1}),[c]);let d=(0,J.useRef)(null);(0,J.useEffect)(()=>{if(n!=="idle"){d.current={base:e};return}!t||d.current===null||d.current.base!==e||(d.current=null,c())},[n,e,c,t]);let S=(0,J.useCallback)(()=>{Nt(e)},[e]);return{gate:r!==null&&r.base===e&&n==="idle"||n==="ready"?"ready":n==="failed"?"failed":"loading",retry:S}}o(on,"Jn");s(on,"useLivenessAssets");var Rr={progress:0,hint:null,faceDetected:!1};function ln(e){let{videoRef:t,assetBaseUrl:n}=e,r=(0,E.useRef)(e.verification).current,a=(0,E.useRef)(!1);e.verification!==r&&!a.current&&Lt()&&(a.current=!0,console.warn("[@sekyro/react] <LivenessCapture>: the `verification` prop changed identity after mount. The first instance stays bound (the camera is not rebuilt); create the verification once (useMemo / useState / outside render) instead of on every render."));let l=(0,E.useRef)(null),[c,d]=(0,E.useState)("idle"),[S,p]=(0,E.useState)(Rr),[w,N]=(0,E.useState)(!1),[j,R]=(0,E.useState)(!1),[B,q]=(0,E.useState)(null),[A,X]=(0,E.useState)(!1),[h,x]=(0,E.useState)(null),[_,k]=(0,E.useState)(null),[u,M]=(0,E.useState)(null),[I,D]=(0,E.useState)(null),[i,T]=(0,E.useState)(null),[O,z]=(0,E.useState)(!1),$=(0,E.useRef)(null),ge=(0,E.useRef)("idle"),he=(0,E.useRef)(-1),[Y,W]=(0,E.useState)(0),ne=(0,E.useRef)(e);ne.current=e,(0,E.useEffect)(()=>{let ee=t.current;if(ee===null)return;let ce={video:ee,...n!==void 0?{assetBaseUrl:n}:{}},H=r!==void 0?r.liveness(ce):dr(ce);l.current=H;let Ne=s(()=>T(H.facingMode??null),"readFacing");Ne();let Fe=[H.on("state",b=>{b==="mode_switch"?z(!0):b!=="starting"&&b!=="gating"&&z(!1),b==="starting"?(ge.current!=="starting"&&(he.current+=1,W(Math.max(0,he.current))),k(null),M(null),p(Rr),R(!1),N(!1),q(null),x(null),$.current=null):b==="gating"&&ge.current==="recording"&&(R(!1),N(!1),q(null),$.current=null),ge.current=b,Ne(),d(b),ne.current.onStateChange?.(b)}),H.on("gate",b=>{let ke=$.current;$.current=b.progress,N(ke!==null&&b.progress<ke-.001&&b.progress>0&&b.progress<1),b.progress>=1&&R(!0),p(b)}),H.on("frozen",({previewDataUrl:b})=>q(b)),H.on("profile",({animations:b})=>X(b==="reduced")),H.on("ramp",({colour:b})=>x(b)),H.on("captured",b=>{k(b),D(null),ne.current.onCaptured?.(b)}),H.on("error",b=>{M(b);let ke=r?.reportCaptureIssue;ke!==void 0&&Ct(Le=>ke.call(r,Le),xr("liveness",b,Math.max(0,he.current))),ne.current.onError?.(b)}),r?.on("result",b=>{D(b),ne.current.onResult?.(b)})];return()=>{for(let b of Fe)b?.();l.current=null,H.destroy()}},[r,t,n]);let L=(0,E.useCallback)(()=>{l.current?.start()},[]),xe=(0,E.useCallback)(()=>{l.current?.retry()},[]),ve=(0,E.useCallback)(async()=>{let ee=l.current;return ee===null||typeof ee.canSwitchCaptureMode!="function"?!1:await ee.canSwitchCaptureMode().catch(()=>!1)===!0},[]),V=(0,E.useCallback)(async ee=>{let ce=l.current;if(ce===null||typeof ce.setCaptureMode!="function")return!1;let H=await ce.setCaptureMode(ee).catch(()=>!1)===!0;return H&&T(ce.facingMode??null),H},[]);return{state:c,gate:S,draining:w,gateLocked:j,frozenPreview:B,reduceMotion:A,rampColour:h,artifacts:_,error:u,result:I,facingMode:i,start:L,retry:xe,canSwitchCaptureMode:ve,setCaptureMode:V,modeRestarted:O,attempt:Y}}o(ln,"er");s(ln,"useLivenessHandle");var Dn=new Set(["national_number"]);function Rt(e){if(e==null||!e.available||e.selected!==null)return null;let t=e.options.filter(n=>Dn.has(n));return t.length>0?{...e,options:t}:null}o(Rt,"tr");s(Rt,"pending");function cn(e){let[t,n]=(0,me.useState)(null),[r,a]=(0,me.useState)(e===void 0),[l,c]=(0,me.useState)(!1),[d,S]=(0,me.useState)(!1);(0,me.useEffect)(()=>{if(n(null),e===void 0){a(!0);return}let N=!0,j=e.methodChoice;typeof j=="function"?(a(!1),Promise.resolve().then(()=>j.call(e)).then(B=>{N&&n(Rt(B))},()=>{}).finally(()=>{N&&a(!0)})):a(!0);let R=e.on("method",B=>n(Rt(B)));return()=>{N=!1,R()}},[e]);let p=(0,me.useCallback)(async N=>{if(e===void 0)return!1;c(!0),S(!1);try{return await e.selectMethod(N),n(null),!0}catch{return S(!0),!1}finally{c(!1)}},[e]),w=t!==null&&t.options.length===1?t.options[0]:null;return{choice:t,auto:w==="national_number"&&!d?w:null,settled:r,busy:l,failed:d,select:p}}o(cn,"nr");s(cn,"useMethodChoice");var $n=["ar","fr","en"];function un(e){if(typeof e!="string")return!1;try{let t=new URL(e);return t.protocol==="https:"||t.protocol==="http:"&&/^(localhost|127\.0\.0\.1)$/.test(t.hostname)}catch{return!1}}o(un,"so");s(un,"isClipUrl");function dn(e){let t=e.clips;if(typeof t!="object"||t===null)return null;let n={};for(let r of $n){let a=t[r];if(!(typeof a!="object"||a===null))for(let[l,c]of Object.entries(a))!st(l)||!un(c)||((n[r]??(n[r]={}))[l]=c)}return Object.keys(n).length>0?n:null}o(dn,"io");s(dn,"toVoiceClipMap");function pn(e){let[t,n]=(0,Te.useState)(null);(0,Te.useEffect)(()=>{if(n(null),e===void 0)return;let a=!0,l=s(d=>{if(!a)return;let S=typeof d=="object"&&d!==null&&typeof d.setId=="string"?d:null;n(p=>p?.setId===S?.setId?p:S)},"take");try{typeof e.voiceClips=="function"&&Promise.resolve(e.voiceClips()).then(l,()=>l(null))}catch{l(null)}let c=e.on("view",d=>l(d.voice));return()=>{a=!1,c()}},[e]);let r=(0,Te.useMemo)(()=>t!==null?dn(t):null,[t]);return e===void 0?null:r}o(pn,"rr");s(pn,"useServerVoiceClips");function hn({voice:e}){let t=Me();return(0,At.jsx)(te,{kind:"chip","aria-pressed":e.enabled,"aria-label":t("capture.voiceGuidance"),"data-testid":"sekyro-voice-toggle",onClick:o(()=>e.toggle(),"onClick"),children:(0,At.jsx)(nt,{off:!e.enabled,className:"sekyro-icon"})})}o(hn,"sr");s(hn,"VoiceChip");var Fn=new Set(["abandoned","not_opened","cancelled","superseded"]),Hn=800,Gn="capture.lookAtColours";function fn(e){return e===void 0||e!==!1&&e.length===wt.length&&wt.every(t=>e.includes(t))}o(fn,"fo");s(fn,"isDefaultTips");function mn(e){if(e.type==="keydown"&&e.key==="Escape")return!1;let t=globalThis.navigator?.userActivation;return t===void 0?!(e.type==="pointerup"&&e.pointerType==="touch"):t.isActive}o(mn,"mo");s(mn,"carriesActivation");function yn(e){return typeof e=="object"&&e!==null&&!(0,m.isValidElement)(e)&&"tone"in e&&"text"in e}o(yn,"yo");s(yn,"isNoticeObject");var Kn=new Set(["nni_unbound","id_number_unbound","method_required","mobile_required","portrait_required"]);function gn(e){return e==="starting"||e==="gating"||e==="recording"||e==="mode_switch"}o(gn,"ho");s(gn,"isCapturing");function vn(e){return e==="captured"||e==="uploading"||e==="checking"}o(vn,"vo");s(vn,"isPostCapture");function Zn({verification:e,locale:t,dir:n,strings:r,slots:a,autoStart:l=!1,notice:c,startDisabled:d=!1,startLabel:S,tips:p,tipsSummary:w,coach:N,voice:j,onGuidance:R,onCaptured:B,onResult:q,onError:A,onStateChange:X,assetBaseUrl:h,className:x}){let _=gr(t),k=(0,m.useMemo)(()=>yr(t,r),[t,r,_]),u=(0,m.useMemo)(()=>g=>k[g]??"",[k]),M=n??(t==="ar"?"rtl":"ltr"),I=(0,m.useRef)(null),D=(0,m.useContext)(qn),i=ln({verification:e,videoRef:I,assetBaseUrl:h,onCaptured:B,onResult:q,onError:A,onStateChange:X}),T=on(h,i.state==="idle"&&i.error===null),O=cn(e),z=O.choice!==null,$=rn(e),ge=nn(e),he=an(e),Y=tn(),W=sn(e),ne=W.session==="choice",L=W.mode==="assisted",xe=j!==!1&&j?.clips===void 0,ve=pn(xe?e:void 0),V=Zr({locale:t,defaultClips:ve,options:j}),ee=L?"environment":"user",ce=W.settled,H=(0,m.useRef)(null),Ne=(0,m.useRef)(!1),Fe=(0,m.useRef)(V.unlock);Fe.current=V.unlock,(0,m.useEffect)(()=>{let g=H.current;if(g===null)return;let ae=["pointerup","touchend","click","keydown"],_e=s(()=>{for(let qe of ae)g.removeEventListener(qe,Ae,!0)},"disarm");function Ae(qe){if(Ne.current){_e();return}mn(qe)&&(Ne.current=!0,_e(),Fe.current())}o(Ae,"Re"),s(Ae,"onGesture");for(let qe of ae)g.addEventListener(qe,Ae,{capture:!0,passive:!0});return _e},[]);let b=(0,m.useCallback)(()=>{Ne.current||(Ne.current=!0,V.unlock()),i.start()},[V.unlock,i.start]),ke=(0,m.useCallback)(()=>i.start(),[i.start]),Le=(0,m.useRef)(!1),Oe=i.state==="idle"&&i.error===null,jt=!z&&!$.required&&(l===!0||l==="when-permitted"&&Y.permission==="granted"),Tt=jt&&O.settled&&$.settled&&ce,Cn=l==="when-permitted"&&!Y.permissionSettled&&!Le.current,Ot=jt&&Oe&&!Le.current,ut=(Cn||Ot||!ce)&&T.gate==="ready"?"loading":T.gate;(0,m.useEffect)(()=>{!Tt||!Oe||T.gate!=="ready"||Le.current||(Le.current=!0,ke())},[Tt,Oe,T.gate,ke]);let _n=Oe&&!z&&!$.required&&!(Ot&&T.gate==="ready"),[Pt,Bt]=(0,m.useState)(!1),{canSwitchCaptureMode:qt,setCaptureMode:Vt}=i;(0,m.useEffect)(()=>{if(!W.settled||!ne){Bt(!1);return}let g=!0;return qt().then(ae=>{g&&Bt(ae)}),()=>{g=!1}},[W.settled,ne,qt]);let{choose:Dt}=W,Ie=L?"self":"assisted",wn=(0,m.useCallback)(async()=>{await Vt(Ie)&&Dt(Ie)},[Vt,Dt,Ie]),$t=i.state!=="idle"&&i.facingMode!==null?i.facingMode:ee;(0,m.useEffect)(()=>{let g=I.current?.style;$t==="user"?g?.removeProperty("transform"):g&&(g.transform="none")},[$t]);let He=(0,m.useMemo)(()=>i.artifacts!==null&&typeof URL.createObjectURL=="function"?URL.createObjectURL(i.artifacts.keyframe):null,[i.artifacts]);(0,m.useEffect)(()=>{if(He!==null)return()=>URL.revokeObjectURL(He)},[He]);let Ft=i.frozenPreview??He,Ue=e!==void 0,Z=gn(i.state),be=vn(i.state),Ge=Z||be,se=i.result,Ht=i.state==="done"&&se!==null,Ke=Z&&i.rampColour!==null,dt=i.state==="recording"&&i.frozenPreview!==null&&!Ke,Ze=D!==null,Gt=Pt&&Z&&!dt?{to:Ie,label:u(Ie==="assisted"?"capture.modeSwitch.toAssisted":"capture.modeSwitch.toSelf"),description:u(Ie==="assisted"?"capture.modeSwitch.toAssistedLabel":"capture.modeSwitch.toSelfLabel"),onSwitch:s(()=>{wn()},"onSwitch")}:null,ze=i.modeRestarted&&Z?u("capture.modeSwitch.restarted"):null,Pe=be||dt,Kt=be?"checking":dt?"frozen":i.state==="recording"||Ke?"recording":i.gateLocked||i.gate.progress>=1?"locked":i.gate.faceDetected?"aligning":"seeking",Ye=Z?i.gate.hint:null,We=i.state==="starting"?"capture.preparing.title":Ye===null?null:Ye==="center"&&!i.gate.faceDetected?"fcv3.no_face":pr(Ye),[Sn,Zt]=(0,m.useState)(null);(0,m.useEffect)(()=>{if(We!=="fcv3.no_face"){Zt(We);return}if(!Z)return;let g=setTimeout(()=>Zt(We),Hn);return()=>clearTimeout(g)},[We,Z]);let pt=Z&&!Ke&&typeof N=="string"&&N!=="",zt=L&&Z?u("capture.assisted.stage"):null,Re=Z&&!pt?Ke?Gn:Sn:null,ht=pt?N:Re===null?"":u(Re);zr(V,Re,ht,Z);let Yt=(0,m.useRef)(R);Yt.current=R,(0,m.useEffect)(()=>{if(st(Re))try{Yt.current?.(Re)}catch(g){console.error("[@sekyro/react] onGuidance threw:",g)}},[Re]);let Be=(0,m.useMemo)(()=>({supported:V.supported,enabled:V.enabled,setEnabled:V.setEnabled,toggle:V.toggle}),[V.supported,V.enabled,V.setEnabled,V.toggle]),ft=a?.voicePrompt,Wt=ft!==void 0,Jt=j===void 0,Qt=(0,m.useRef)(!1);(0,m.useEffect)(()=>{!Wt||!Jt||Qt.current||!Lt()||(Qt.current=!0,console.warn("[@sekyro/react] <LivenessCapture>: `slots.voicePrompt` is set and `voice` is undefined, so the component speaks the guidance itself. If your slot plays audio, pass voice={false} or the person hears every hint twice; pass voice={{}} to keep the built-in voice and silence this warning."))},[Wt,Jt]);let xn=ft!==void 0?(g,ae,_e)=>ft(g,ae,_e,Be):V.supported?()=>(0,v.jsx)(hn,{voice:Be}):void 0,{summary:mt,summaryPlaying:Xt,toggleSummary:er,stopSummary:tr}=V,Je=w!==void 0&&w!=="",rr=Je?w:u("capture.tips.summary"),nr=Je?mt!=="none":mt==="partner"||mt==="default"&&fn(p),Nn=(0,m.useMemo)(()=>nr?{playing:Xt,toggle:s(()=>er(rr,{clip:!Je}),"toggle"),stop:tr}:void 0,[nr,Xt,er,rr,tr,Je]),Rn=(0,m.useMemo)(()=>({assets:ut,retryAssets:T.retry,permission:Y.permission,permissionSettled:Y.permissionSettled,captureMode:W.mode,facing:ee,voice:Be}),[ut,T.retry,Y.permission,Y.permissionSettled,W.mode,ee,Be]),An=yn(c)?(0,v.jsx)(oe,{tone:c.tone,testId:"sekyro-host-notice",children:(0,v.jsx)("span",{children:c.text})}):c??null,ue=se!==null&&se.status==="retry"?se:null,G=Ht&&se.status==="unavailable"&&!z&&se.reasonCode!=="portrait_required"?se:null,Ce=Ht&&(se.status==="verified"||se.status==="not_verified"||se.status==="review")?se:null,yt=s((g,ae)=>{if(g===void 0)return null;if(g==="device_cooldown"){let Ae=fr(t,ae);if(Ae!==null)return u(Ae.key).replace("{time}",Ae.time)}let _e=et(g);return _e===null?null:u(_e)},"reasonText"),gt=s(g=>{let ae=g.retakeHint===void 0?null:Xe(g.retakeHint);return ae===null?yt(g.reasonCode):u(ae)},"retryText"),sr=Ce===null?null:yt(Ce.reasonCode,Ce.retryAfter)??(Ce.status==="not_verified"&&Ce.reason!==void 0&&Fn.has(Ce.reason)?u("errors.session_expired"):null),Mn=G!==null&&G.reasonCode!==void 0&&G.reasonCode!=="nni_unbound"&&G.reasonCode!=="id_number_unbound"&&G.reasonCode!=="method_required"&&G.reasonCode!=="mobile_required"&&!(G.reasonCode==="no_recorder"&&i.artifacts?.degraded==="NO_RECORDER"),Qe=G?.reasonCode,ar=i.attempt;(0,m.useEffect)(()=>{G===null||Qe===void 0||e?.reportCaptureIssue===void 0||Kn.has(Qe)||Ct(g=>e.reportCaptureIssue?.(g),{check:"liveness",kind:"unavailable",phase:"upload",engineKind:Qe,attempt:Math.min(1e3,ar)})},[G,Qe,ar,e]);let or=bt(),En=z&&O.auto===null&&!Z&&!be&&i.error===null,vt=(0,m.useCallback)(async g=>{await O.select(g)&&i.state==="done"&&i.retry()},[O.select,i.state,i.retry]);return(0,m.useEffect)(()=>{O.auto!==null&&!O.busy&&!Z&&!be&&vt(O.auto)},[O.auto,O.busy,Z,be,vt]),(0,v.jsx)(vr,{value:u,children:(0,v.jsxs)("div",{ref:H,className:x===void 0?"sekyro-capture":`sekyro-capture ${x}`,dir:M,lang:t,"data-testid":"sekyro-liveness-capture","data-state":i.state,children:[a?.header,ue!==null&&gt(ue)!==null&&!(Ze&&Ge)?(0,v.jsx)(oe,{tone:"warning",role:"status",testId:"sekyro-retry-notice",children:(0,v.jsx)("span",{children:gt(ue)})}):null,ze!==null&&!Ze?(0,v.jsx)(oe,{tone:"info",role:"status",testId:"sekyro-mode-switch-status",children:(0,v.jsx)("span",{children:ze})}):null,he&&be&&!Ze?(0,v.jsx)(oe,{tone:"info",role:"status",testId:"sekyro-busy-notice",children:(0,v.jsx)("span",{children:u("capture.busy")})}):null,$.required&&Oe?(0,v.jsx)(oe,{tone:"info",role:"status",testId:"sekyro-mobile-required",children:(0,v.jsx)("span",{children:u("reasons.mobile_required")})}):null,i.error!==null?a?.errorPanel!==void 0?a.errorPanel(i.error,i.retry):(0,v.jsxs)(oe,{tone:"danger",testId:"sekyro-error-notice",children:[(0,v.jsx)("span",{children:u(hr(i.error))}),i.error.retryable?(0,v.jsx)(te,{ref:or,kind:"ghost",className:"sekyro-btn--start",onClick:i.retry,children:u("common.retry")}):null]}):null,G!==null?(0,v.jsxs)(oe,{tone:"danger",testId:"sekyro-unavailable-notice",children:[(0,v.jsx)("span",{children:(G.reasonCode==="attestation"&&G.attestationError==="clock_wrong"?u("errors.device_clock"):yt(G.reasonCode))??u(G.reasonCode===void 0?"errors.session_expired":"errors.network_error")}),Mn?(0,v.jsx)(te,{ref:or,kind:"ghost",className:"sekyro-btn--start",onClick:i.retry,children:u(G.reasonCode==="attestation"?"common.retry":"capture.recordAgain")}):null]}):null,sr!==null&&Ce!==null?(0,v.jsx)(oe,{tone:Ce.status==="not_verified"?"danger":"info",testId:"sekyro-result-notice",children:(0,v.jsx)("span",{children:sr})}):null,(0,v.jsx)("div",{className:Ge?void 0:"sekyro-hidden","data-capture-live":Ge?"":void 0,children:Ze?D({videoRef:I,guidance:Pe&&Ue?u("capture.checking"):ht,coached:pt&&!(Pe&&Ue),note:Pe?Ue?u(he?"capture.busy":"capture.checkingHint"):null:ze??(ue!==null?gt(ue):zt),settled:Pe&&Ue,progress:i.gate.progress,phase:Kt,still:Pe?Ft:null,live:Ge,modeSwitch:Gt,...Pt?{status:ze}:{},ramp:i.rampColour===null?null:{colour:i.rampColour}}):(0,v.jsx)(kr,{videoRef:I,guidanceText:ht,guidanceHint:Ye,guidanceKey:Re,progress:i.gate.progress,phase:Kt,draining:i.draining,stillUrl:Ft,showChecking:Ue,operatorText:zt,voicePrompt:xn,overlay:o(g=>(0,v.jsxs)(v.Fragment,{children:[a?.stageOverlay?.(g),(0,v.jsx)(br,{colour:i.rampColour})]}),"overlay"),reduceMotion:i.reduceMotion,modeSwitch:Gt})}),En&&O.choice!==null?(0,v.jsx)(qr,{title:u("method.title"),description:u("method.description"),options:O.choice.options.map(g=>({id:g,label:u(`method.${g}`)})),busy:O.busy,error:O.failed?u("errors.network_error"):null,focus:i.state==="done",testId:"sekyro-method",look:"buttons",onChoose:o(g=>{vt(g)},"onChoose")}):null,_n?(0,v.jsxs)(v.Fragment,{children:[ge&&a?.header===void 0&&a?.intro===void 0?(0,v.jsxs)("div",{className:"sekyro-stack sekyro-stack--1",children:[(0,v.jsx)("h2",{className:"sekyro-text-body",children:u("returning.title")}),(0,v.jsx)("p",{className:"sekyro-text-muted",children:u("returning.description")})]}):null,An,a?.intro!==void 0?a.intro(b,Rn):(0,v.jsx)(Xr,{assets:ut,onRetryAssets:T.retry,permission:Y.permission,captureMode:W.mode,voice:Be,tips:p??wt,summary:Nn,startLabel:S,startDisabled:d,onStart:b})]}):null,(0,v.jsx)(Yr,{showCoaching:ue!==null,coaching:ot(ue?.reasonCode),attemptsText:ue?.attemptsRemaining!==void 0?mr(k,t,ue.attemptsRemaining):null,showRetake:ue!==null&&!Z&&!be||!Ue&&i.state==="captured",onRetake:i.retry}),a?.footer]})})}o(Zn,"xi");s(Zn,"LivenessCapture");var Ut=U(K(),1),ct=U(K(),1),f=U(de(),1);var Cs={document:"card",population_registry:"id",national_eid:"smartphone",phone_otp:"phone",email_otp:"email"};function zn(e,t){switch(e.service){case"document":return t.t("method.document_photo");case"population_registry":return t.t("method.national_number");case"national_eid":{let n=e.nationalEid?.providerName;return n?t.t("method.national_eid",{provider:n}):t.t("method.national_eidGeneric")}default:return null}}o(zn,"Y");s(zn,"identityLabel");function Yn(e,t){let[n,r]=(0,Ut.useState)(!1),[a,l]=(0,Ut.useState)(null);return{busy:n,error:a,run:s(c=>{r(!0),l(null),c().then(()=>r(!1),d=>{r(!1),l(e.t(Nr(d,e.strings))),t?.(d)})},"run")}}o(Yn,"q");s(Yn,"useChoiceAction");function kn(){let e=`sekyro-face-light-${(0,ct.useId)().replace(/[^A-Za-z0-9_-]/g,"")}`;return(0,f.jsxs)("svg",{className:"sekyro-mark sekyro-mark--face",viewBox:"0 0 168 206","aria-hidden":"true",focusable:"false",children:[(0,f.jsx)("defs",{children:(0,f.jsx)("mask",{id:e,children:(0,f.jsx)("ellipse",{className:"sekyro-mark__arc",cx:"84",cy:"103",rx:"76",ry:"95",pathLength:"1",fill:"none",stroke:"#fff",strokeWidth:"16"})})}),(0,f.jsx)("ellipse",{cx:"84",cy:"103",rx:"64",ry:"83",fill:"none",className:"sekyro-mark__line"}),(0,f.jsx)("path",{className:"sekyro-mark__face",d:"M68 64v10M100 64v10M84 66v25q0 2-6 1M60 108q24 18 48 0"}),(0,f.jsx)("ellipse",{className:"sekyro-mark__ticks",cx:"84",cy:"103",rx:"76",ry:"95",pathLength:"56"}),(0,f.jsx)("ellipse",{className:"sekyro-mark__ticks sekyro-mark__ticks--light",cx:"84",cy:"103",rx:"76",ry:"95",pathLength:"56",mask:`url(#${e})`})]})}o(kn,"O");s(kn,"FaceMark");var Wn={glasses:"jGlasses",lighting:"light",faceCamera:"camera"};function Jn(e){if(!(e?.kind!=="liveness"||e.reason===void 0))return{reason:e.reason,...e.retakeHint!==void 0?{retakeHint:e.retakeHint}:{},attemptsRemaining:e.attemptsRemaining??0,attemptsExhausted:e.attemptsExhausted===!0}}o(Jn,"te");s(Jn,"faceIntroRetryOf");var Qn={"capture.retryFrontCamera.screenSide":"camera","capture.retryBackCamera.backSide":"camera","capture.retryUpright.vertical":"smartphone","capture.retryUpright.untilEnd":"smartphone","capture.retryRecording.cameraOn":"camera","capture.retryRecording.stay":"smartphone","capture.retryRecording.network":"smartphone","capture.retryDevice.screenRecording":"smartphone","capture.retryDevice.phone":"smartphone"};function Xn({start:e,context:t,tips:n,tipsTitle:r,human:a=!1,returning:l=!1,notice:c,retry:d}){let S=_t(),{t:p}=S,w=d===void 0?"face":ot(d.reason),N=w==="face"?null:$e[w].tips,j=(0,ct.useContext)(_r)?.busy===!0;return(0,f.jsxs)("section",{className:"sekyro-step",children:[(0,f.jsx)(kn,{}),t.captureMode==="assisted"?(0,f.jsx)(tt,{title:p("capture.assisted.heading"),lead:p("capture.assisted.lead")}):l?(0,f.jsx)(tt,{title:p("returning.heading"),lead:p("returning.description")}):(0,f.jsx)(tt,{title:p(a?"native.face.humanIntroTitle":"native.face.introTitle"),lead:p(a?"native.face.humanIntroLead":"native.face.introLead")}),d!==void 0?(0,f.jsx)(bn,{retry:d,title:$e[w].title}):null,r!==void 0&&N===null?(0,f.jsx)("p",{className:"sekyro-section-label",children:r}):null,(0,f.jsx)("ul",{className:"sekyro-tiprows",children:N!==null?N.map(R=>(0,f.jsxs)("li",{children:[(0,f.jsx)(Ee,{name:Qn[R]??"face"}),p(R)]},R)):n!==void 0?n.map(R=>(0,f.jsxs)("li",{children:[(0,f.jsx)(Ee,{name:Wn[R.id]??"face"}),R.text]},R.id)):(0,f.jsxs)(f.Fragment,{children:[(0,f.jsxs)("li",{children:[(0,f.jsx)(Ee,{name:"light"}),p("capture.tips.light")]}),(0,f.jsxs)("li",{children:[(0,f.jsx)(Ee,{name:"jGlasses"}),p("capture.tips.uncover")]}),(0,f.jsxs)("li",{children:[(0,f.jsx)(Ee,{name:"smartphone"}),p("capture.tips.eyeLevel")]})]})}),c??null,c!==void 0?null:t.assets==="failed"?(0,f.jsx)(te,{kind:"secondary",full:!0,onClick:t.retryAssets,children:p("common.retry")}):null,c!==void 0?null:(0,f.jsx)(Cr,{children:(0,f.jsxs)(te,{full:!0,disabled:t.assets!=="ready"||j,"aria-busy":t.assets==="loading"||void 0,onClick:e,children:[(0,f.jsx)(Ee,{name:"camera"}),p("capture.start")]})})]})}o(Xn,"ne");s(Xn,"FaceIntro");var es=new Set(["match_inconclusive","no_face_source","below_threshold"]);function bn({retry:e,title:t}){let n=_t(),r=e.retakeHint===void 0?null:Xe(e.retakeHint),a=e.reason==="probe_not_from_liveness"?"capture.retrySamePerson.message":es.has(e.reason)?"capture.retryMatch.message":et(e.reason);return(0,f.jsxs)(wr,{tone:"warning",children:[r!==null?(0,f.jsx)("span",{children:n.t(r)}):a!==null?(0,f.jsx)("span",{children:n.t(a)}):null,r===null?(0,f.jsx)("span",{children:n.t(t)}):null,(0,f.jsx)("span",{children:Sr(n,e.attemptsRemaining,e.attemptsExhausted)})]})}o(bn,"T");s(bn,"RetryNotice");function ts(e){return kt(e)}o(ts,"se");s(ts,"isInAppBrowser");function rs(e,t){let n=t??(typeof navigator>"u"?"":String(navigator.userAgent??""));if(!/Android/i.test(n))return null;let r;try{r=new URL(e)}catch{return null}if(r.protocol!=="https:"&&r.protocol!=="http:")return null;let a=r.protocol.slice(0,-1);return`intent://${r.host}${r.pathname}${r.search}#Intent;scheme=${a};action=android.intent.action.VIEW;S.browser_fallback_url=${encodeURIComponent(e)};end`}o(rs,"ce");s(rs,"androidBrowserIntent");export{qr as a,Lt as b,qn as c,sn as d,Zn as e,Cs as f,zn as g,Yn as h,Jn as i,Xn as j,ts as k,rs as l};
1
+ import{a as Nr}from"./chunk-YULJCSQ3.js";import{c as Ct}from"./chunk-4VHWJD57.js";import{b as kr,d as br}from"./chunk-EPMGZQHF.js";import{b as xr,c as _t}from"./chunk-EXMVZUHU.js";import{a as yr,b as gr,c as vr,d as Me}from"./chunk-RTCZJKYC.js";import{G as Cr,L as wr,M as Sr,a as K,b as de,c as te,m as pr,n as Xe,p as hr,q as et,r as fr,s as mr,t as bt,u as le,v as Ee,w as tt,y as _r}from"./chunk-PLWGAXYM.js";import{c as ir,d as cr,e as ur,h as dr}from"./chunk-WANVL25H.js";import{b as kt}from"./chunk-HXD7VO3F.js";import{a as s}from"./chunk-5QL6W6FW.js";import{g as or}from"./chunk-6MYG4HWP.js";import{a as l,c as U}from"./chunk-4FHWXBOB.js";var Ar=U(K(),1),y=U(de(),1),re=U(de(),1),ye=U(K(),1),F=U(de(),1),_=U(K(),1),m=U(K(),1),at=U(K(),1),fe=U(de(),1),Wr=U(K(),1),Q=U(K(),1),ot=U(K(),1),we=U(de(),1),Se=U(de(),1),P=U(de(),1);var it=U(K(),1),pe=U(K(),1);var J=U(K(),1);var E=U(K(),1),me=U(K(),1),Te=U(K(),1),At=U(de(),1),v=U(de(),1);function ie({className:e,children:t}){return(0,y.jsx)("svg",{"aria-hidden":"true",focusable:"false",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",className:e??"sekyro-icon sekyro-icon--sm",children:t})}l(ie,"ne");s(ie,"Svg");var Mt="M4 7.5h2.2l1.4-1.9h8.8l1.4 1.9H20a1.6 1.6 0 0 1 1.6 1.6v8.3A1.6 1.6 0 0 1 20 19H4a1.6 1.6 0 0 1-1.6-1.6V9.1A1.6 1.6 0 0 1 4 7.5Z";function Mr(e){return(0,y.jsxs)(ie,{...e,children:[(0,y.jsx)("circle",{cx:"12",cy:"12",r:"4"}),(0,y.jsx)("path",{d:"M12 2.5v2M12 19.5v2M2.5 12h2M19.5 12h2M5.3 5.3l1.4 1.4M17.3 17.3l1.4 1.4M5.3 18.7l1.4-1.4M17.3 6.7l1.4-1.4"})]})}l(Mr,"ln");s(Mr,"SunIcon");function Er(e){return(0,y.jsxs)(ie,{...e,children:[(0,y.jsx)("circle",{cx:"12",cy:"12",r:"9"}),(0,y.jsx)("path",{d:"M9 10h.01M15 10h.01M8.8 14.6a4.2 4.2 0 0 0 6.4 0"})]})}l(Er,"un");s(Er,"FaceUncoveredIcon");function Lr(e){return(0,y.jsxs)(ie,{...e,children:[(0,y.jsx)("rect",{x:"7",y:"2.5",width:"10",height:"19",rx:"2"}),(0,y.jsx)("path",{d:"M10.5 18.5h3M2.5 9.5h2.5M19 9.5h2.5"}),(0,y.jsx)("circle",{cx:"12",cy:"9.5",r:"1.6"})]})}l(Lr,"dn");s(Lr,"PhoneEyeLevelIcon");function Ir(e){return(0,y.jsxs)(ie,{...e,children:[(0,y.jsx)("path",{d:"M2.5 12S6 5.5 12 5.5 21.5 12 21.5 12 18 18.5 12 18.5 2.5 12 2.5 12Z"}),(0,y.jsx)("circle",{cx:"12",cy:"12",r:"2.8"})]})}l(Ir,"pn");s(Ir,"LookStraightIcon");function Ur(e){return(0,y.jsxs)(ie,{...e,children:[(0,y.jsx)("path",{d:Mt}),(0,y.jsx)("path",{d:"M9 13l2 2 4-4"})]})}l(Ur,"fn");s(Ur,"CameraCheckIcon");function jr(e){return(0,y.jsxs)(ie,{...e,children:[(0,y.jsx)("path",{d:Mt}),(0,y.jsx)("path",{d:"M10.2 11.2a1.9 1.9 0 1 1 2.6 1.8c-.5.2-.8.6-.8 1.1v.3M12 16.4h.01"})]})}l(jr,"mn");s(jr,"CameraAskIcon");function Tr(e){return(0,y.jsxs)(ie,{...e,children:[(0,y.jsx)("path",{d:Mt}),(0,y.jsx)("path",{d:"M3 3l18 18"})]})}l(Tr,"yn");s(Tr,"CameraBlockedIcon");function nt({off:e,className:t}){return(0,y.jsxs)(ie,{className:t,children:[(0,y.jsx)("path",{d:"M4.5 9.5v5H8l4 3.5v-12L8 9.5H4.5Z"}),e?(0,y.jsx)("path",{d:"M4 4l16 16"}):(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)("path",{d:"M15.5 9.7a3.6 3.6 0 0 1 0 4.6"}),(0,y.jsx)("path",{d:"M18 7.6a6.6 6.6 0 0 1 0 8.8"})]})]})}l(nt,"Ve");s(nt,"SpeakerIcon");function Or(e){return(0,y.jsx)(ie,{...e,children:(0,y.jsx)("path",{d:"M5 12.5l4.5 4.5L19 7.5"})})}l(Or,"gn");s(Or,"CheckIcon");function Pr(e){return(0,y.jsxs)(ie,{className:e.className??"sekyro-spinner",children:[(0,y.jsx)("circle",{cx:"12",cy:"12",r:"9",opacity:"0.25"}),(0,y.jsx)("path",{d:"M21 12a9 9 0 0 0-9-9"})]})}l(Pr,"hn");s(Pr,"SpinnerIcon");var wt=["light","uncover","eyeLevel","straight"],Ln={light:{key:"capture.tips.light",icon:s(()=>(0,re.jsx)(Mr,{}),"icon")},uncover:{key:"capture.tips.uncover",icon:s(()=>(0,re.jsx)(Er,{}),"icon")},eyeLevel:{key:"capture.tips.eyeLevel",icon:s(()=>(0,re.jsx)(Lr,{}),"icon")},straight:{key:"capture.tips.straight",icon:s(()=>(0,re.jsx)(Ir,{}),"icon")}};function Br({tips:e}){let t=Me(),n=(0,Ar.useId)();return e.length===0?null:(0,re.jsxs)("section",{className:"sekyro-tips","aria-labelledby":n,"data-testid":"sekyro-tips",children:[(0,re.jsx)("p",{className:"sekyro-tips__title",id:n,children:t("capture.tips.title")}),(0,re.jsx)("ul",{className:"sekyro-tips__list",children:e.map(r=>{let a=typeof r=="string"?Ln[r]:void 0,o=typeof r=="string"?r:r.id,c=a!==void 0?a.icon():typeof r=="string"?void 0:r.icon,d=a!==void 0?t(a.key):typeof r=="string"?r:r.text;return(0,re.jsxs)("li",{className:"sekyro-tips__item",children:[c!=null?(0,re.jsx)("span",{className:"sekyro-tips__icon","aria-hidden":"true",children:c}):null,(0,re.jsx)("span",{children:d})]},o)})})]})}l(Br,"Cn");s(Br,"TipList");var In=220;function qr({title:e,description:t,options:n,busy:r,error:a,focus:o,testId:c,look:d="cards",marked:S,onChoose:p}){let w=(0,ye.useId)(),N=bt(),[j,R]=(0,ye.useState)(null),B=(0,ye.useRef)(null);(0,ye.useEffect)(()=>{a!==null&&R(null)},[a]),(0,ye.useEffect)(()=>()=>{B.current!==null&&clearTimeout(B.current)},[]);let q=s(A=>{r||j!==null||(R(A),B.current=setTimeout(()=>{B.current=null,R(null),p(A)},In))},"choose");return(0,F.jsxs)("section",{className:"sekyro-stack sekyro-stack--4 sekyro-choice","aria-labelledby":w,"data-testid":c,children:[(0,F.jsxs)("div",{className:d==="cards"?"sekyro-heading":"sekyro-stack sekyro-stack--1",children:[(0,F.jsx)("h2",{id:w,ref:o?N:void 0,tabIndex:-1,className:"sekyro-text-body",children:e}),t!==void 0&&t!==""?(0,F.jsx)("p",{className:"sekyro-text-muted",children:t}):null]}),a!==null?(0,F.jsx)(le,{tone:"danger",children:(0,F.jsx)("span",{children:a})}):null,d==="buttons"?(0,F.jsx)("div",{className:"sekyro-stack sekyro-stack--3",children:n.map((A,X)=>(0,F.jsx)(te,{kind:X===0?"primary":"ghost",full:!0,disabled:r,"aria-busy":r||void 0,onClick:l(()=>p(A.id),"onClick"),children:A.label},A.id))}):(0,F.jsx)("div",{className:"sekyro-choices",children:n.map(A=>(0,F.jsxs)("button",{type:"button",className:"sekyro-card","aria-pressed":(j??S)===A.id,"aria-busy":r||void 0,disabled:r||j!==null&&j!==A.id,onClick:l(()=>q(A.id),"onClick"),children:[A.glyph!==void 0?(0,F.jsx)("span",{className:"sekyro-card__tile",children:A.glyph}):null,(0,F.jsxs)("span",{className:"sekyro-card__body",children:[(0,F.jsx)("span",{className:"sekyro-card__title",children:A.label}),A.sub!==void 0?(0,F.jsx)("span",{className:"sekyro-card__sub",children:A.sub}):null]}),(0,F.jsx)("span",{className:"sekyro-radio","aria-hidden":"true"})]},A.id))})]})}l(qr,"bn");s(qr,"ChoiceScreen");var Vr=["fcv3.no_face","fcv3.come_closer","fcv3.move_back","fcv3.center_face","fcv3.straighten","fcv3.more_light","fcv3.too_bright","fcv3.hold_still","fcv3.steady_camera","fcv3.hold_upright","fcv3.one_face","capture.tips.summary","capture.lookAtColours"];function st(e){return e!==null&&Vr.includes(e)}l(st,"he");s(st,"isVoiceKey");var Un=s((e,t)=>Object.prototype.hasOwnProperty.call(e,t),"own");function je(e,t,n){let r;try{if(typeof e=="function")r=e(t,n);else{let a=e[n];r=a!=null&&Un(a,t)?a[t]:null}}catch{return null}return typeof r=="string"&&r!==""?r:null}l(je,"Me");s(je,"resolveClip");var jn="UklGRiQAAABXQVZFZm10IBAAAAABAAEAESsAACJWAAACABAAZGF0YQAAAAA=",Tn={ar:"ar-SA",fr:"fr-FR",en:"en-US",es:"es-ES",pt:"pt-BR",de:"de-DE"};function oe(){return typeof window<"u"&&"speechSynthesis"in window?window.speechSynthesis:null}l(oe,"re");s(oe,"synth");function Dr(){return oe()!==null&&typeof SpeechSynthesisUtterance=="function"}l(Dr,"Lr");s(Dr,"speechAvailable");function St(e){return(e.split(/[-_]/)[0]??e).toLowerCase()}l(St,"Sn");s(St,"baseLang");function Et(e,t){let n=s(a=>a.replace(/_/g,"-").toLowerCase(),"norm"),r=St(t);return e.find(a=>n(a.lang)===n(t))??e.find(a=>St(a.lang)===r)}l(Et,"Mn");s(Et,"pickVoice");function $r(e){if(!Dr())return!1;let t=[];try{t=oe()?.getVoices()??[]}catch{return!0}return t.length===0||Et(t,e)!==void 0}l($r,"wn");s($r,"speechUsable");function Fr(e){let t=oe();return t===null||typeof t.addEventListener!="function"?()=>{}:(t.addEventListener("voiceschanged",e),()=>t.removeEventListener?.("voiceschanged",e))}l(Fr,"Ln");s(Fr,"subscribeVoices");function De(e){try{let t=typeof location<"u"?location.href:"http://localhost/",n=new URL(e,t);return`clip:${n.origin}${n.pathname}`}catch{return`clip:${e}`}}l(De,"Ke");s(De,"clipIdentity");function xt(e){e.pause(),e.removeAttribute("src"),e.load()}l(xt,"Rn");s(xt,"release");function Hr(){let e=null,t=null,n=0,r=null,a=null,o=null,c=!1,d=null,S=[],p=new Map,w=s(()=>{S=oe()?.getVoices()??[]},"loadVoices"),N=!1,j=s(()=>{let h=oe();N||h===null||(N=!0,w(),h.addEventListener?.("voiceschanged",w))},"bindVoices"),R=s(()=>(e??(e=new Audio),e),"element"),B=s((h,x,C,k)=>{let u=oe();if(u!==null&&h!==""&&typeof SpeechSynthesisUtterance=="function"){j();let M=Et(S,x);if(S.length===0||M!==void 0){u.cancel();let I=new SpeechSynthesisUtterance(h);I.lang=x,M!==void 0&&(I.voice=M),I.rate=.95,C!==void 0&&(I.onend=C),(C!==void 0||k!==void 0)&&(I.onerror=D=>{k!==void 0&&D.error==="not-allowed"?k():C?.()}),u.speak(I);return}}C?.()},"speak"),q=s(()=>{n+=1,r=null,a=o=null,e!==null&&(e.pause(),e.currentTime=0),oe()?.cancel()},"stop"),A=s(h=>{for(let x of h){let C=De(x);if(p.has(C))continue;let k=new Audio;k.preload="auto",k.src=x,p.set(C,k)}},"warmClips"),X=s((h,x,C)=>{let k={utterance:h,generation:x,end:C};d=k;let u=s(()=>x===n&&d===k,"live"),M=s(()=>{u()&&(a=k)},"block");if(oe()?.cancel(),h.url!==null){let I=R();I.pause(),I.muted=!1,I.src=h.url,I.currentTime=0,I.onended=C??null;let D=s(()=>{o===k&&(o=null)},"settled"),i=I.play();if(i===void 0)return;o=k,i.then(D,T=>{if(D(),!u())return;let O=T?.name;if(O!=="AbortError"){if(O==="NotAllowedError")return M();h.speech?B(h.text,h.lang,C,M):C?.()}});return}h.speech?B(h.text,h.lang,C,M):C?.()},"start");return{say(h){let x=h.url!==null?De(h.url):`tts:${h.lang}:${h.text}`;if(x===r)return;r=x,a=o=null,n+=1;let C=n,k=h.onEnd;X(h,C,k!==void 0?()=>{C===n&&k()}:void 0)},unlock({lang:h,speech:x,prefetch:C}){let k=a??(c?null:o);c=!0;let u=k!==null&&k.generation===n?k:null;a=o=null,u!==null&&X(u.utterance,u.generation,u.end);let M=R();if(t===null&&typeof Blob=="function"&&typeof URL.createObjectURL=="function"){let T=Uint8Array.from(atob(jn),O=>O.charCodeAt(0));t=URL.createObjectURL(new Blob([T],{type:"audio/wav"}))}let I=M.paused===!1&&t!==null&&M.src!==t;t!==null&&!I&&(u===null||u.utterance.url===null)&&(M.muted=!0,M.onended=null,M.src=t,M.play()?.catch(()=>{}));let D=oe(),i=u!==null&&u.utterance.url===null;if(x&&!i&&D!==null&&typeof SpeechSynthesisUtterance=="function"){j();let T=new SpeechSynthesisUtterance(" ");T.volume=0,T.lang=h,D.speak(T)}A(C??[])},prefetch:A,stop:q,dispose(){q(),N&&oe()?.removeEventListener?.("voiceschanged",w),N=!1,t!==null&&URL.revokeObjectURL(t),t=null,e!==null&&xt(e),e=null;for(let h of p.values())xt(h);p.clear()}}}l(Hr,"_n");s(Hr,"createVoicePlayer");var On="sekyro.voiceGuidance";function Gr(e){try{if(typeof window>"u")return null;let t=window.localStorage.getItem(e);return t==="1"?!0:t==="0"?!1:null}catch{return null}}l(Gr,"xn");s(Gr,"readVoicePreference");function Kr(e,t){try{if(typeof window>"u")return;window.localStorage.setItem(e,t?"1":"0")}catch{}}l(Kr,"En");s(Kr,"writeVoicePreference");var Ve="capture.tips.summary",Pn=typeof window<"u"?_.useLayoutEffect:_.useEffect,Bn=Object.freeze({});function rt(e,t){let n=new Set,r=[];for(let a of Vr){let o=a===Ve?null:je(e,a,t);o===null||n.has(De(o))||(n.add(De(o)),r.push(o))}return r}l(rt,"ht");s(rt,"resolvedClipUrls");function Zr({locale:e,defaultClips:t,options:n}){let r=n===!1,a=r?{}:n??{},o=a.storageKey===void 0?On:a.storageKey,[c,d]=(0,_.useState)(a.defaultEnabled??!0),S=(0,_.useRef)(c),[p,w]=(0,_.useState)(!1),[N,j]=(0,_.useState)("none"),[R,B]=(0,_.useState)(!1),q=(0,_.useRef)(!1),[A,X]=(0,_.useState)(0),h=(0,_.useRef)(null),x=(0,_.useCallback)(()=>(h.current??(h.current=Hr()),h.current),[]),C=Tn[e],k=a.speechFallback,u=k===void 0||k===!0?!0:k===!1?!1:k.includes(e),M=a.clips??t??Bn,I=(0,_.useRef)(!1),D=(0,_.useRef)(M);Pn(()=>{D.current=M,S.current=c}),(0,_.useEffect)(()=>{if(r||o===null)return;let L=Gr(o);L!==null&&(S.current=L,d(L))},[r,o]),(0,_.useEffect)(()=>{if(!(r||!u))return Fr(()=>X(L=>L+1))},[r,u]);let i=a.clips;(0,_.useEffect)(()=>{if(r)return;let L=u&&$r(C);w(rt(M,e).length>0||L),j(i!==void 0&&je(i,Ve,e)!==null?"partner":je(M,Ve,e)!==null||L?"default":"none")},[r,M,i,e,u,C,A]),(0,_.useEffect)(()=>{if(r||!c||!I.current)return;let L=rt(M,e);L.length>0&&x().prefetch(L)},[r,c,M,e,x]),(0,_.useEffect)(()=>()=>{h.current?.dispose(),h.current=null,I.current=!1},[]);let T=(0,_.useCallback)(L=>{r||(I.current=!0,x().unlock({lang:C,speech:u,...L?{prefetch:rt(D.current,e)}:{}}))},[r,x,C,u,e]),O=(0,_.useCallback)(()=>T(S.current),[T]),z=(0,_.useCallback)(()=>{q.current=!1,B(!1)},[]),$=(0,_.useCallback)(()=>{z(),h.current?.stop()},[z]),ge=(0,_.useCallback)(()=>{q.current&&$()},[$]),he=(0,_.useCallback)((L,xe)=>{if(r)return;if(q.current){$();return}let ve=x();ve.stop(),q.current=!0,B(!0);let V=xe?.clip===!1?null:je(D.current,Ve,e);ve.say({url:V,text:L,lang:C,speech:u,onEnd:z})},[r,$,x,e,C,u,z]),Y=(0,_.useCallback)(L=>{r||(L?T(!0):$(),o!==null&&Kr(o,L),S.current=L,d(L))},[r,T,$,o]),W=(0,_.useCallback)(()=>Y(!S.current),[Y]),ne=(0,_.useCallback)((L,xe)=>{if(r||!c)return;q.current&&z();let ve=je(D.current,L,e);x().say({url:ve,text:xe,lang:C,speech:u})},[r,c,e,x,C,u,z]);return(0,_.useMemo)(()=>({supported:!r&&p,enabled:!r&&c,setEnabled:Y,toggle:W,unlock:O,speakKey:ne,stop:$,summary:r?"none":N,summaryPlaying:R,toggleSummary:he,stopSummary:ge}),[r,p,c,Y,W,O,ne,$,N,R,he,ge])}l(Zr,"vt");s(Zr,"useVoiceGuidance");function zr(e,t,n,r){let{speakKey:a,stop:o,enabled:c}=e,d=(0,_.useRef)(!1);(0,_.useEffect)(()=>{if(!r||!c){d.current&&o(),d.current=!1;return}d.current=!0,st(t)&&t!==Ve&&n!==""&&a(t,n)},[r,c,t,n,a,o])}l(zr,"Ct");s(zr,"useSpeakGuidance");function lt(e){switch(e){case"multiple_faces":return"one_face";case"capture_back_camera":return"front_camera";case"capture_front_camera":return"back_camera";case"capture_not_upright":return"upright";case"media_unreadable":case"clip_too_short":return"recording";case"device_integrity_failed":return"device";default:return"face"}}l(lt,"Pn");s(lt,"retryCoachingOf");var $e={face:{title:"capture.retryCoaching.title",tips:["capture.retryCoaching.light","capture.retryCoaching.eyeLevel","capture.retryCoaching.head"]},one_face:{title:"capture.retryTips.title",tips:["capture.retryOneFace.alone","capture.retryOneFace.screens"]},front_camera:{title:"capture.retryTips.title",tips:["capture.retryFrontCamera.screenSide"]},back_camera:{title:"capture.retryTips.title",tips:["capture.retryBackCamera.backSide","capture.retryBackCamera.circle"]},upright:{title:"capture.retryTips.title",tips:["capture.retryUpright.vertical","capture.retryUpright.untilEnd"]},recording:{title:"capture.retryTips.title",tips:["capture.retryRecording.cameraOn","capture.retryRecording.stay","capture.retryRecording.network"]},device:{title:"capture.retryTips.title",tips:["capture.retryDevice.screenRecording","capture.retryDevice.phone"]}};function Yr({showCoaching:e,coaching:t="face",attemptsText:n,showRetake:r,onRetake:a}){let o=Me(),c=(0,at.useRef)(null);return(0,at.useEffect)(()=>{r&&c.current?.focus()},[r]),!e&&!r?null:(0,fe.jsxs)("div",{className:"sekyro-stack sekyro-stack--3","data-testid":"sekyro-captured-panel",children:[e?(0,fe.jsxs)("div",{className:"sekyro-stack sekyro-stack--1",children:[(0,fe.jsx)("p",{className:"sekyro-text-body",children:o($e[t].title)}),(0,fe.jsx)("ul",{className:"sekyro-coaching",children:$e[t].tips.map(d=>(0,fe.jsx)("li",{children:o(d)},d))}),n!==null?(0,fe.jsx)("p",{className:"sekyro-text-muted","data-testid":"sekyro-attempts-remaining",children:n}):null]}):null,r?(0,fe.jsx)(te,{ref:c,className:"sekyro-btn--start",onClick:a,children:o("capture.recordAgain")}):null]})}l(Yr,"Tn");s(Yr,"CapturedPanel");function Lt(){try{return!1}catch{return!1}}l(Lt,"nt");s(Lt,"isDevBuild");var qn=(0,Wr.createContext)(null);function Jr({state:e}){let t=Me(),[n,r]=(0,ot.useState)(!1);(0,ot.useEffect)(()=>{e!=="unknown"&&r(!0)},[e]);let a=e==="granted"?(0,we.jsx)(Ur,{}):e==="denied"?(0,we.jsx)(Tr,{}):(0,we.jsx)(jr,{});return(0,we.jsxs)("div",{role:n?"status":void 0,className:`sekyro-permission sekyro-permission--${e}`,"data-testid":"sekyro-permission","data-state":e,children:[(0,we.jsx)("span",{className:"sekyro-permission__icon","aria-hidden":"true",children:a}),(0,we.jsx)("span",{children:t(`capture.permission.${e}`)})]})}l(Jr,"On");s(Jr,"PermissionRow");function Qr({voice:e}){let t=Me();if(!e.supported)return null;let n=e.enabled;return(0,Se.jsxs)("button",{type:"button",role:"switch","aria-checked":n,className:"sekyro-switch","data-testid":"sekyro-voice-switch",onClick:l(()=>e.toggle(),"onClick"),children:[(0,Se.jsxs)("span",{className:"sekyro-switch__label",children:[(0,Se.jsx)(nt,{off:!n}),t("capture.voiceGuidance")]}),(0,Se.jsx)("span",{className:"sekyro-switch__track","aria-hidden":"true",children:(0,Se.jsx)("span",{className:"sekyro-switch__thumb",children:n?(0,Se.jsx)(Or,{className:"sekyro-switch__check"}):null})})]})}l(Qr,"Hn");s(Qr,"VoiceSwitch");function Xr({assets:e,onRetryAssets:t,permission:n,captureMode:r="self",voice:a,tips:o,summary:c,startLabel:d,startDisabled:S,onStart:p}){let w=Me(),N=(0,Q.useRef)(c?.stop);N.current=c?.stop,(0,Q.useEffect)(()=>()=>N.current?.(),[]);let j=(0,Q.useRef)(null),R=(0,Q.useRef)(null),B=(0,Q.useRef)(null),q=(0,Q.useRef)(e),A=(0,Q.useRef)(!1);(0,Q.useEffect)(()=>{let u=q.current;if(q.current=e,u===e)return;let M=A.current;e!=="loading"&&(A.current=!1),en(j.current)&&(e==="failed"?B.current?.focus():M&&R.current?.focus())},[e]);let X=(0,Q.useCallback)(()=>{A.current=!0,t()},[t]),h=e==="loading",x=h||S,C=(0,Q.useCallback)(()=>{x||(N.current?.(),p())},[x,p]),k;return e==="failed"?k=(0,P.jsxs)(le,{tone:"danger",testId:"sekyro-assets-error",children:[(0,P.jsx)("p",{className:"sekyro-text-body",children:w("fcv2.err.models")}),(0,P.jsx)(te,{kind:"ghost",ref:B,className:"sekyro-btn--start",onClick:X,"data-testid":"sekyro-assets-retry",children:w("common.retry")})]}):k=(0,P.jsxs)("div",{className:"sekyro-stack sekyro-stack--1",children:[(0,P.jsx)(te,{ref:R,full:!0,"data-testid":"sekyro-start","aria-disabled":x?"true":void 0,"aria-busy":h?"true":void 0,onClick:C,children:h?(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(Pr,{}),w("capture.preparing.title")]}):d??w("capture.start")}),h?(0,P.jsx)("p",{className:"sekyro-text-muted",children:w("capture.preparing.hint")}):null]}),(0,P.jsxs)("div",{ref:j,className:"sekyro-stack sekyro-stack--4","data-testid":"sekyro-intro","data-assets":e,children:[r==="assisted"?(0,P.jsxs)("div",{className:"sekyro-stack sekyro-stack--1","data-testid":"sekyro-assisted-intro",children:[(0,P.jsx)("h2",{className:"sekyro-text-body",children:w("capture.assisted.title")}),(0,P.jsx)("p",{className:"sekyro-text-muted",children:w("capture.assisted.lead")})]}):null,o!==!1?(0,P.jsx)(Br,{tips:o}):null,c!==void 0?(0,P.jsxs)(te,{kind:"ghost",className:"sekyro-btn--start",onClick:c.toggle,"data-testid":"sekyro-tips-listen",children:[(0,P.jsx)(nt,{off:!1}),w(c.playing?"capture.tips.stop":"capture.tips.listen")]}):null,(0,P.jsx)(Jr,{state:n}),(0,P.jsx)(Qr,{voice:a}),(0,P.jsx)("p",{className:"sekyro-text-muted",children:w("capture.securityNote")}),k,(0,P.jsx)("p",{role:"status",className:"sekyro-visually-hidden","data-testid":"sekyro-intro-status",children:e==="loading"?w("capture.preparing.title"):e==="ready"?w("capture.ready"):""})]})}l(Xr,"Fn");s(Xr,"PreCaptureScreen");function en(e){if(typeof document>"u")return!1;let t=document.activeElement;return t===null||t===document.body||e!==null&&e.contains(t)}l(en,"Ur");s(en,"focusIsOurs");function tn(){let[e,t]=(0,it.useState)({state:"unknown",settled:!1});return(0,it.useEffect)(()=>or(n=>t({state:n,settled:!0})),[]),{permission:e.state,permissionSettled:e.settled}}l(tn,"Dn");s(tn,"useCameraStatus");function rn(e){return It(e,"mobileRequired")}l(rn,"qn");s(rn,"useMobileRequired");function nn(e){return It(e,"returning").required}l(nn,"jn");s(nn,"useReturning");function It(e,t){let[n,r]=(0,pe.useState)({required:!1,settled:e===void 0});return(0,pe.useEffect)(()=>{let a=e?.[t];if(e===void 0||typeof a!="function"){r({required:!1,settled:!0});return}let o=!0;return r({required:!1,settled:!1}),Promise.resolve().then(()=>a.call(e)).then(c=>{o&&r({required:c===!0,settled:!0})},()=>{o&&r({required:!1,settled:!0})}),()=>{o=!1}},[e,t]),n}l(It,"Yn");s(It,"useFlag");function sn(e){let t=s(()=>e?.captureChoice??null,"initialChoice"),[n,r]=(0,pe.useState)(()=>({session:"self",choice:t(),settled:e===void 0}));(0,pe.useEffect)(()=>{let o=e?.captureMode,c=e?.captureChoice??null;if(e===void 0||typeof o!="function"){r({session:"self",choice:c,settled:!0});return}let d=!0;return r({session:"self",choice:c,settled:!1}),Promise.resolve().then(()=>o.call(e)).then(S=>{let p=e.captureChoice??null;d&&r({session:p!==null&&S===p?"choice":S==="assisted"||S==="choice"?S:"self",choice:p,settled:!0})},()=>{d&&r({session:"self",choice:null,settled:!0})}),()=>{d=!1}},[e]);let a=(0,pe.useCallback)(o=>{e?.chooseCaptureMode?.(o),r(c=>({...c,choice:o}))},[e]);return{mode:n.session==="choice"?n.choice??"self":n.session==="assisted"?"assisted":"self",session:n.session,choice:n.choice,settled:n.settled,choose:a}}l(sn,"$n");s(sn,"useCaptureMode");function an(e){let[t,n]=(0,pe.useState)(!1);return(0,pe.useEffect)(()=>{if(n(!1),e===void 0)return;let r=e.on("busy",()=>n(!0)),a=e.on("result",()=>n(!1));return()=>{r(),a()}},[e]),t}l(an,"zn");s(an,"useBusy");var Vn=s(()=>"idle","serverSnapshot");function Nt(e){return ir(e!==void 0?{assetBaseUrl:e}:{})}l(Nt,"Qn");s(Nt,"preload");function ln(e,t=!0){let n=(0,J.useSyncExternalStore)((0,J.useCallback)(p=>ur(p,e),[e]),()=>cr(e),Vn),[r,a]=(0,J.useState)(null),o=(0,J.useRef)(!1),c=(0,J.useCallback)(()=>{Nt(e).then(p=>{o.current&&p==="idle"&&a({base:e})})},[e]);(0,J.useEffect)(()=>(o.current=!0,c(),()=>{o.current=!1}),[c]);let d=(0,J.useRef)(null);(0,J.useEffect)(()=>{if(n!=="idle"){d.current={base:e};return}!t||d.current===null||d.current.base!==e||(d.current=null,c())},[n,e,c,t]);let S=(0,J.useCallback)(()=>{Nt(e)},[e]);return{gate:r!==null&&r.base===e&&n==="idle"||n==="ready"?"ready":n==="failed"?"failed":"loading",retry:S}}l(ln,"Jn");s(ln,"useLivenessAssets");var Rr={progress:0,hint:null,faceDetected:!1};function on(e){let{videoRef:t,assetBaseUrl:n}=e,r=(0,E.useRef)(e.verification).current,a=(0,E.useRef)(!1);e.verification!==r&&!a.current&&Lt()&&(a.current=!0,console.warn("[@sekyro/react] <LivenessCapture>: the `verification` prop changed identity after mount. The first instance stays bound (the camera is not rebuilt); create the verification once (useMemo / useState / outside render) instead of on every render."));let o=(0,E.useRef)(null),[c,d]=(0,E.useState)("idle"),[S,p]=(0,E.useState)(Rr),[w,N]=(0,E.useState)(!1),[j,R]=(0,E.useState)(!1),[B,q]=(0,E.useState)(null),[A,X]=(0,E.useState)(!1),[h,x]=(0,E.useState)(null),[C,k]=(0,E.useState)(null),[u,M]=(0,E.useState)(null),[I,D]=(0,E.useState)(null),[i,T]=(0,E.useState)(null),[O,z]=(0,E.useState)(!1),$=(0,E.useRef)(null),ge=(0,E.useRef)("idle"),he=(0,E.useRef)(-1),[Y,W]=(0,E.useState)(0),ne=(0,E.useRef)(e);ne.current=e,(0,E.useEffect)(()=>{let ee=t.current;if(ee===null)return;let ce={video:ee,...n!==void 0?{assetBaseUrl:n}:{}},H=r!==void 0?r.liveness(ce):dr(ce);o.current=H;let Ne=s(()=>T(H.facingMode??null),"readFacing");Ne();let Fe=[H.on("state",b=>{b==="mode_switch"?z(!0):b!=="starting"&&b!=="gating"&&z(!1),b==="starting"?(ge.current!=="starting"&&(he.current+=1,W(Math.max(0,he.current))),k(null),M(null),p(Rr),R(!1),N(!1),q(null),x(null),$.current=null):b==="gating"&&ge.current==="recording"&&(R(!1),N(!1),q(null),$.current=null),ge.current=b,Ne(),d(b),ne.current.onStateChange?.(b)}),H.on("gate",b=>{let ke=$.current;$.current=b.progress,N(ke!==null&&b.progress<ke-.001&&b.progress>0&&b.progress<1),b.progress>=1&&R(!0),p(b)}),H.on("frozen",({previewDataUrl:b})=>q(b)),H.on("profile",({animations:b})=>X(b==="reduced")),H.on("ramp",({colour:b})=>x(b)),H.on("captured",b=>{k(b),D(null),ne.current.onCaptured?.(b)}),H.on("error",b=>{M(b);let ke=r?.reportCaptureIssue;ke!==void 0&&_t(Le=>ke.call(r,Le),xr("liveness",b,Math.max(0,he.current))),ne.current.onError?.(b)}),r?.on("result",b=>{D(b),ne.current.onResult?.(b)})];return()=>{for(let b of Fe)b?.();o.current=null,H.destroy()}},[r,t,n]);let L=(0,E.useCallback)(()=>{o.current?.start()},[]),xe=(0,E.useCallback)(()=>{o.current?.retry()},[]),ve=(0,E.useCallback)(async()=>{let ee=o.current;return ee===null||typeof ee.canSwitchCaptureMode!="function"?!1:await ee.canSwitchCaptureMode().catch(()=>!1)===!0},[]),V=(0,E.useCallback)(async ee=>{let ce=o.current;if(ce===null||typeof ce.setCaptureMode!="function")return!1;let H=await ce.setCaptureMode(ee).catch(()=>!1)===!0;return H&&T(ce.facingMode??null),H},[]);return{state:c,gate:S,draining:w,gateLocked:j,frozenPreview:B,reduceMotion:A,rampColour:h,artifacts:C,error:u,result:I,facingMode:i,start:L,retry:xe,canSwitchCaptureMode:ve,setCaptureMode:V,modeRestarted:O,attempt:Y}}l(on,"er");s(on,"useLivenessHandle");var Dn=new Set(["national_number"]);function Rt(e){if(e==null||!e.available||e.selected!==null)return null;let t=e.options.filter(n=>Dn.has(n));return t.length>0?{...e,options:t}:null}l(Rt,"tr");s(Rt,"pending");function cn(e){let[t,n]=(0,me.useState)(null),[r,a]=(0,me.useState)(e===void 0),[o,c]=(0,me.useState)(!1),[d,S]=(0,me.useState)(!1);(0,me.useEffect)(()=>{if(n(null),e===void 0){a(!0);return}let N=!0,j=e.methodChoice;typeof j=="function"?(a(!1),Promise.resolve().then(()=>j.call(e)).then(B=>{N&&n(Rt(B))},()=>{}).finally(()=>{N&&a(!0)})):a(!0);let R=e.on("method",B=>n(Rt(B)));return()=>{N=!1,R()}},[e]);let p=(0,me.useCallback)(async N=>{if(e===void 0)return!1;c(!0),S(!1);try{return await e.selectMethod(N),n(null),!0}catch{return S(!0),!1}finally{c(!1)}},[e]),w=t!==null&&t.options.length===1?t.options[0]:null;return{choice:t,auto:w==="national_number"&&!d?w:null,settled:r,busy:o,failed:d,select:p}}l(cn,"nr");s(cn,"useMethodChoice");var $n=["ar","fr","en"];function un(e){if(typeof e!="string")return!1;try{let t=new URL(e);return t.protocol==="https:"||t.protocol==="http:"&&/^(localhost|127\.0\.0\.1)$/.test(t.hostname)}catch{return!1}}l(un,"so");s(un,"isClipUrl");function dn(e){let t=e.clips;if(typeof t!="object"||t===null)return null;let n={};for(let r of $n){let a=t[r];if(!(typeof a!="object"||a===null))for(let[o,c]of Object.entries(a))!st(o)||!un(c)||((n[r]??(n[r]={}))[o]=c)}return Object.keys(n).length>0?n:null}l(dn,"io");s(dn,"toVoiceClipMap");function pn(e){let[t,n]=(0,Te.useState)(null);(0,Te.useEffect)(()=>{if(n(null),e===void 0)return;let a=!0,o=s(d=>{if(!a)return;let S=typeof d=="object"&&d!==null&&typeof d.setId=="string"?d:null;n(p=>p?.setId===S?.setId?p:S)},"take");try{typeof e.voiceClips=="function"&&Promise.resolve(e.voiceClips()).then(o,()=>o(null))}catch{o(null)}let c=e.on("view",d=>o(d.voice));return()=>{a=!1,c()}},[e]);let r=(0,Te.useMemo)(()=>t!==null?dn(t):null,[t]);return e===void 0?null:r}l(pn,"rr");s(pn,"useServerVoiceClips");function hn({voice:e}){let t=Me();return(0,At.jsx)(te,{kind:"chip","aria-pressed":e.enabled,"aria-label":t("capture.voiceGuidance"),"data-testid":"sekyro-voice-toggle",onClick:l(()=>e.toggle(),"onClick"),children:(0,At.jsx)(nt,{off:!e.enabled,className:"sekyro-icon"})})}l(hn,"sr");s(hn,"VoiceChip");var Fn=new Set(["abandoned","not_opened","cancelled","superseded"]),Hn=800,Gn="capture.lookAtColours";function fn(e){return e===void 0||e!==!1&&e.length===wt.length&&wt.every(t=>e.includes(t))}l(fn,"fo");s(fn,"isDefaultTips");function mn(e){if(e.type==="keydown"&&e.key==="Escape")return!1;let t=globalThis.navigator?.userActivation;return t===void 0?!(e.type==="pointerup"&&e.pointerType==="touch"):t.isActive}l(mn,"mo");s(mn,"carriesActivation");function yn(e){return typeof e=="object"&&e!==null&&!(0,m.isValidElement)(e)&&"tone"in e&&"text"in e}l(yn,"yo");s(yn,"isNoticeObject");var Kn=new Set(["nni_unbound","id_number_unbound","method_required","mobile_required","portrait_required"]);function gn(e){return e==="starting"||e==="gating"||e==="recording"||e==="mode_switch"}l(gn,"ho");s(gn,"isCapturing");function vn(e){return e==="captured"||e==="uploading"||e==="checking"}l(vn,"vo");s(vn,"isPostCapture");function Zn({verification:e,locale:t,dir:n,strings:r,slots:a,autoStart:o=!1,notice:c,startDisabled:d=!1,startLabel:S,tips:p,tipsSummary:w,coach:N,voice:j,onGuidance:R,onCaptured:B,onResult:q,onError:A,onStateChange:X,assetBaseUrl:h,className:x}){let C=gr(t),k=(0,m.useMemo)(()=>yr(t,r),[t,r,C]),u=(0,m.useMemo)(()=>g=>k[g]??"",[k]),M=n??(t==="ar"?"rtl":"ltr"),I=(0,m.useRef)(null),D=(0,m.useContext)(qn),i=on({verification:e,videoRef:I,assetBaseUrl:h,onCaptured:B,onResult:q,onError:A,onStateChange:X}),T=ln(h,i.state==="idle"&&i.error===null),O=cn(e),z=O.choice!==null,$=rn(e),ge=nn(e),he=an(e),Y=tn(),W=sn(e),ne=W.session==="choice",L=W.mode==="assisted",xe=j!==!1&&j?.clips===void 0,ve=pn(xe?e:void 0),V=Zr({locale:t,defaultClips:ve,options:j}),ee=L?"environment":"user",ce=W.settled,H=(0,m.useRef)(null),Ne=(0,m.useRef)(!1),Fe=(0,m.useRef)(V.unlock);Fe.current=V.unlock,(0,m.useEffect)(()=>{let g=H.current;if(g===null)return;let ae=["pointerup","touchend","click","keydown"],Ce=s(()=>{for(let qe of ae)g.removeEventListener(qe,Ae,!0)},"disarm");function Ae(qe){if(Ne.current){Ce();return}mn(qe)&&(Ne.current=!0,Ce(),Fe.current())}l(Ae,"Re"),s(Ae,"onGesture");for(let qe of ae)g.addEventListener(qe,Ae,{capture:!0,passive:!0});return Ce},[]);let b=(0,m.useCallback)(()=>{Ne.current||(Ne.current=!0,V.unlock()),i.start()},[V.unlock,i.start]),ke=(0,m.useCallback)(()=>i.start(),[i.start]),Le=(0,m.useRef)(!1),Oe=i.state==="idle"&&i.error===null,jt=!z&&!$.required&&(o===!0||o==="when-permitted"&&Y.permission==="granted"),Tt=jt&&O.settled&&$.settled&&ce,_n=o==="when-permitted"&&!Y.permissionSettled&&!Le.current,Ot=jt&&Oe&&!Le.current,ut=(_n||Ot||!ce)&&T.gate==="ready"?"loading":T.gate;(0,m.useEffect)(()=>{!Tt||!Oe||T.gate!=="ready"||Le.current||(Le.current=!0,ke())},[Tt,Oe,T.gate,ke]);let Cn=Oe&&!z&&!$.required&&!(Ot&&T.gate==="ready"),[Pt,Bt]=(0,m.useState)(!1),{canSwitchCaptureMode:qt,setCaptureMode:Vt}=i;(0,m.useEffect)(()=>{if(!W.settled||!ne){Bt(!1);return}let g=!0;return qt().then(ae=>{g&&Bt(ae)}),()=>{g=!1}},[W.settled,ne,qt]);let{choose:Dt}=W,Ie=L?"self":"assisted",wn=(0,m.useCallback)(async()=>{await Vt(Ie)&&Dt(Ie)},[Vt,Dt,Ie]),$t=i.state!=="idle"&&i.facingMode!==null?i.facingMode:ee;(0,m.useEffect)(()=>{let g=I.current?.style;$t==="user"?g?.removeProperty("transform"):g&&(g.transform="none")},[$t]);let He=(0,m.useMemo)(()=>i.artifacts!==null&&typeof URL.createObjectURL=="function"?URL.createObjectURL(i.artifacts.keyframe):null,[i.artifacts]);(0,m.useEffect)(()=>{if(He!==null)return()=>URL.revokeObjectURL(He)},[He]);let Ft=i.frozenPreview??He,Ue=e!==void 0,Z=gn(i.state),be=vn(i.state),Ge=Z||be,se=i.result,Ht=i.state==="done"&&se!==null,Ke=Z&&i.rampColour!==null,dt=i.state==="recording"&&i.frozenPreview!==null&&!Ke,Ze=D!==null,Gt=Pt&&Z&&!dt?{to:Ie,label:u(Ie==="assisted"?"capture.modeSwitch.toAssisted":"capture.modeSwitch.toSelf"),description:u(Ie==="assisted"?"capture.modeSwitch.toAssistedLabel":"capture.modeSwitch.toSelfLabel"),onSwitch:s(()=>{wn()},"onSwitch")}:null,ze=i.modeRestarted&&Z?u("capture.modeSwitch.restarted"):null,Pe=be||dt,Kt=be?"checking":dt?"frozen":i.state==="recording"||Ke?"recording":i.gateLocked||i.gate.progress>=1?"locked":i.gate.faceDetected?"aligning":"seeking",Ye=Z?i.gate.hint:null,We=i.state==="starting"?"capture.preparing.title":Ye===null?null:Ye==="center"&&!i.gate.faceDetected?"fcv3.no_face":pr(Ye),[Sn,Zt]=(0,m.useState)(null);(0,m.useEffect)(()=>{if(We!=="fcv3.no_face"){Zt(We);return}if(!Z)return;let g=setTimeout(()=>Zt(We),Hn);return()=>clearTimeout(g)},[We,Z]);let pt=Z&&!Ke&&typeof N=="string"&&N!=="",zt=L&&Z?u("capture.assisted.stage"):null,Re=Z&&!pt?Ke?Gn:Sn:null,ht=pt?N:Re===null?"":u(Re);zr(V,Re,ht,Z);let Yt=(0,m.useRef)(R);Yt.current=R,(0,m.useEffect)(()=>{if(st(Re))try{Yt.current?.(Re)}catch(g){console.error("[@sekyro/react] onGuidance threw:",g)}},[Re]);let Be=(0,m.useMemo)(()=>({supported:V.supported,enabled:V.enabled,setEnabled:V.setEnabled,toggle:V.toggle}),[V.supported,V.enabled,V.setEnabled,V.toggle]),ft=a?.voicePrompt,Wt=ft!==void 0,Jt=j===void 0,Qt=(0,m.useRef)(!1);(0,m.useEffect)(()=>{!Wt||!Jt||Qt.current||!Lt()||(Qt.current=!0,console.warn("[@sekyro/react] <LivenessCapture>: `slots.voicePrompt` is set and `voice` is undefined, so the component speaks the guidance itself. If your slot plays audio, pass voice={false} or the person hears every hint twice; pass voice={{}} to keep the built-in voice and silence this warning."))},[Wt,Jt]);let xn=ft!==void 0?(g,ae,Ce)=>ft(g,ae,Ce,Be):V.supported?()=>(0,v.jsx)(hn,{voice:Be}):void 0,{summary:mt,summaryPlaying:Xt,toggleSummary:er,stopSummary:tr}=V,Je=w!==void 0&&w!=="",rr=Je?w:u("capture.tips.summary"),nr=Je?mt!=="none":mt==="partner"||mt==="default"&&fn(p),Nn=(0,m.useMemo)(()=>nr?{playing:Xt,toggle:s(()=>er(rr,{clip:!Je}),"toggle"),stop:tr}:void 0,[nr,Xt,er,rr,tr,Je]),Rn=(0,m.useMemo)(()=>({assets:ut,retryAssets:T.retry,permission:Y.permission,permissionSettled:Y.permissionSettled,captureMode:W.mode,facing:ee,voice:Be}),[ut,T.retry,Y.permission,Y.permissionSettled,W.mode,ee,Be]),An=yn(c)?(0,v.jsx)(le,{tone:c.tone,testId:"sekyro-host-notice",children:(0,v.jsx)("span",{children:c.text})}):c??null,ue=se!==null&&se.status==="retry"?se:null,G=Ht&&se.status==="unavailable"&&!z&&se.reasonCode!=="portrait_required"?se:null,_e=Ht&&(se.status==="verified"||se.status==="not_verified"||se.status==="review")?se:null,yt=s((g,ae)=>{if(g===void 0)return null;if(g==="device_cooldown"){let Ae=fr(t,ae);if(Ae!==null)return u(Ae.key).replace("{time}",Ae.time)}let Ce=et(g);return Ce===null?null:u(Ce)},"reasonText"),gt=s(g=>{let ae=g.retakeHint===void 0?null:Xe(g.retakeHint);return ae===null?yt(g.reasonCode):u(ae)},"retryText"),sr=_e===null?null:yt(_e.reasonCode,_e.retryAfter)??(_e.status==="not_verified"&&_e.reason!==void 0&&Fn.has(_e.reason)?u("errors.session_expired"):null),Mn=G!==null&&G.reasonCode!==void 0&&G.reasonCode!=="nni_unbound"&&G.reasonCode!=="id_number_unbound"&&G.reasonCode!=="method_required"&&G.reasonCode!=="mobile_required"&&!(G.reasonCode==="no_recorder"&&i.artifacts?.degraded==="NO_RECORDER"),Qe=G?.reasonCode,ar=i.attempt;(0,m.useEffect)(()=>{G===null||Qe===void 0||e?.reportCaptureIssue===void 0||Kn.has(Qe)||_t(g=>e.reportCaptureIssue?.(g),{check:"liveness",kind:"unavailable",phase:"upload",engineKind:Qe,attempt:Math.min(1e3,ar)})},[G,Qe,ar,e]);let lr=bt(),En=z&&O.auto===null&&!Z&&!be&&i.error===null,vt=(0,m.useCallback)(async g=>{await O.select(g)&&i.state==="done"&&i.retry()},[O.select,i.state,i.retry]);return(0,m.useEffect)(()=>{O.auto!==null&&!O.busy&&!Z&&!be&&vt(O.auto)},[O.auto,O.busy,Z,be,vt]),(0,v.jsx)(vr,{value:u,children:(0,v.jsxs)("div",{ref:H,className:x===void 0?"sekyro-capture":`sekyro-capture ${x}`,dir:M,lang:t,"data-testid":"sekyro-liveness-capture","data-state":i.state,children:[a?.header,ue!==null&&gt(ue)!==null&&!(Ze&&Ge)?(0,v.jsx)(le,{tone:"warning",role:"status",testId:"sekyro-retry-notice",children:(0,v.jsx)("span",{children:gt(ue)})}):null,ze!==null&&!Ze?(0,v.jsx)(le,{tone:"info",role:"status",testId:"sekyro-mode-switch-status",children:(0,v.jsx)("span",{children:ze})}):null,he&&be&&!Ze?(0,v.jsx)(le,{tone:"info",role:"status",testId:"sekyro-busy-notice",children:(0,v.jsx)("span",{children:u("capture.busy")})}):null,$.required&&Oe?(0,v.jsx)(le,{tone:"info",role:"status",testId:"sekyro-mobile-required",children:(0,v.jsx)("span",{children:u("reasons.mobile_required")})}):null,i.error!==null?a?.errorPanel!==void 0?a.errorPanel(i.error,i.retry):(0,v.jsxs)(le,{tone:"danger",testId:"sekyro-error-notice",children:[(0,v.jsx)("span",{children:u(hr(i.error))}),i.error.retryable?(0,v.jsx)(te,{ref:lr,kind:"ghost",className:"sekyro-btn--start",onClick:i.retry,children:u("common.retry")}):null]}):null,G!==null?(0,v.jsxs)(le,{tone:"danger",testId:"sekyro-unavailable-notice",children:[(0,v.jsx)("span",{children:(G.reasonCode==="attestation"&&G.attestationError==="clock_wrong"?u("errors.device_clock"):yt(G.reasonCode))??u(G.reasonCode===void 0?"errors.session_expired":"errors.network_error")}),Mn?(0,v.jsx)(te,{ref:lr,kind:"ghost",className:"sekyro-btn--start",onClick:i.retry,children:u(G.reasonCode==="attestation"?"common.retry":"capture.recordAgain")}):null]}):null,sr!==null&&_e!==null?(0,v.jsx)(le,{tone:_e.status==="not_verified"?"danger":"info",testId:"sekyro-result-notice",children:(0,v.jsx)("span",{children:sr})}):null,(0,v.jsx)("div",{className:Ge?void 0:"sekyro-hidden","data-capture-live":Ge?"":void 0,children:Ze?D({videoRef:I,guidance:Pe&&Ue?u("capture.checking"):ht,coached:pt&&!(Pe&&Ue),note:Pe?Ue?u(he?"capture.busy":"capture.checkingHint"):null:ze??(ue!==null?gt(ue):zt),settled:Pe&&Ue,progress:i.gate.progress,phase:Kt,still:Pe?Ft:null,live:Ge,modeSwitch:Gt,...Pt?{status:ze}:{},ramp:i.rampColour===null?null:{colour:i.rampColour}}):(0,v.jsx)(kr,{videoRef:I,guidanceText:ht,guidanceHint:Ye,guidanceKey:Re,progress:i.gate.progress,phase:Kt,draining:i.draining,stillUrl:Ft,showChecking:Ue,operatorText:zt,voicePrompt:xn,overlay:l(g=>(0,v.jsxs)(v.Fragment,{children:[a?.stageOverlay?.(g),(0,v.jsx)(br,{colour:i.rampColour})]}),"overlay"),reduceMotion:i.reduceMotion,modeSwitch:Gt})}),En&&O.choice!==null?(0,v.jsx)(qr,{title:u("method.title"),description:u("method.description"),options:O.choice.options.map(g=>({id:g,label:u(`method.${g}`)})),busy:O.busy,error:O.failed?u("errors.network_error"):null,focus:i.state==="done",testId:"sekyro-method",look:"buttons",onChoose:l(g=>{vt(g)},"onChoose")}):null,Cn?(0,v.jsxs)(v.Fragment,{children:[ge&&a?.header===void 0&&a?.intro===void 0?(0,v.jsxs)("div",{className:"sekyro-stack sekyro-stack--1",children:[(0,v.jsx)("h2",{className:"sekyro-text-body",children:u("returning.title")}),(0,v.jsx)("p",{className:"sekyro-text-muted",children:u("returning.description")})]}):null,An,a?.intro!==void 0?a.intro(b,Rn):(0,v.jsx)(Xr,{assets:ut,onRetryAssets:T.retry,permission:Y.permission,captureMode:W.mode,voice:Be,tips:p??wt,summary:Nn,startLabel:S,startDisabled:d,onStart:b})]}):null,(0,v.jsx)(Yr,{showCoaching:ue!==null,coaching:lt(ue?.reasonCode),attemptsText:ue?.attemptsRemaining!==void 0?mr(k,t,ue.attemptsRemaining):null,showRetake:ue!==null&&!Z&&!be||!Ue&&i.state==="captured",onRetake:i.retry}),a?.footer]})})}l(Zn,"xi");s(Zn,"LivenessCapture");var Ut=U(K(),1),ct=U(K(),1),f=U(de(),1);var _s={document:"card",population_registry:"id",national_eid:"smartphone",phone_otp:"phone",email_otp:"email"},Cs={population_registry:"hashtag",national_eid:"key"};function zn(e,t){switch(e.service){case"document":return t.t("method.document_photo");case"population_registry":return t.t("method.national_number");case"national_eid":{let n=e.nationalEid?.providerName;return n?t.t("method.national_eid",{provider:n}):t.t("method.national_eidGeneric")}default:return null}}l(zn,"D");s(zn,"identityLabel");function Yn(e,t){let[n,r]=(0,Ut.useState)(!1),[a,o]=(0,Ut.useState)(null);return{busy:n,error:a,run:s(c=>{r(!0),o(null),c().then(()=>r(!1),d=>{r(!1),o(e.t(Nr(d,e.strings))),t?.(d)})},"run")}}l(Yn,"q");s(Yn,"useChoiceAction");function kn(){let e=`sekyro-face-light-${(0,ct.useId)().replace(/[^A-Za-z0-9_-]/g,"")}`;return(0,f.jsxs)("svg",{className:"sekyro-mark sekyro-mark--face",viewBox:"0 0 168 206","aria-hidden":"true",focusable:"false",children:[(0,f.jsx)("defs",{children:(0,f.jsx)("mask",{id:e,children:(0,f.jsx)("ellipse",{className:"sekyro-mark__arc",cx:"84",cy:"103",rx:"76",ry:"95",pathLength:"1",fill:"none",stroke:"#fff",strokeWidth:"16"})})}),(0,f.jsx)("ellipse",{cx:"84",cy:"103",rx:"64",ry:"83",fill:"none",className:"sekyro-mark__line"}),(0,f.jsx)("path",{className:"sekyro-mark__face",d:"M68 64v10M100 64v10M84 66v25q0 2-6 1M60 108q24 18 48 0"}),(0,f.jsx)("ellipse",{className:"sekyro-mark__ticks",cx:"84",cy:"103",rx:"76",ry:"95",pathLength:"56"}),(0,f.jsx)("ellipse",{className:"sekyro-mark__ticks sekyro-mark__ticks--light",cx:"84",cy:"103",rx:"76",ry:"95",pathLength:"56",mask:`url(#${e})`})]})}l(kn,"O");s(kn,"FaceMark");var Wn={glasses:"jGlasses",lighting:"light",faceCamera:"camera"};function Jn(e){if(!(e?.kind!=="liveness"||e.reason===void 0))return{reason:e.reason,...e.retakeHint!==void 0?{retakeHint:e.retakeHint}:{},attemptsRemaining:e.attemptsRemaining??0,attemptsExhausted:e.attemptsExhausted===!0}}l(Jn,"ne");s(Jn,"faceIntroRetryOf");var Qn={"capture.retryFrontCamera.screenSide":"camera","capture.retryBackCamera.backSide":"camera","capture.retryUpright.vertical":"smartphone","capture.retryUpright.untilEnd":"smartphone","capture.retryRecording.cameraOn":"camera","capture.retryRecording.stay":"smartphone","capture.retryRecording.network":"smartphone","capture.retryDevice.screenRecording":"smartphone","capture.retryDevice.phone":"smartphone"};function Xn({start:e,context:t,tips:n,tipsTitle:r,human:a=!1,returning:o=!1,notice:c,retry:d}){let S=Ct(),{t:p}=S,w=d===void 0?"face":lt(d.reason),N=w==="face"?null:$e[w].tips,j=(0,ct.useContext)(Cr)?.busy===!0;return(0,f.jsxs)("section",{className:"sekyro-step",children:[(0,f.jsx)(kn,{}),t.captureMode==="assisted"?(0,f.jsx)(tt,{title:p("capture.assisted.heading"),lead:p("capture.assisted.lead")}):o?(0,f.jsx)(tt,{title:p("returning.heading"),lead:p("returning.description")}):(0,f.jsx)(tt,{title:p(a?"native.face.humanIntroTitle":"native.face.introTitle"),lead:p(a?"native.face.humanIntroLead":"native.face.introLead")}),d!==void 0?(0,f.jsx)(bn,{retry:d,title:$e[w].title}):null,r!==void 0&&N===null?(0,f.jsx)("p",{className:"sekyro-section-label",children:r}):null,(0,f.jsx)("ul",{className:"sekyro-tiprows",children:N!==null?N.map(R=>(0,f.jsxs)("li",{children:[(0,f.jsx)(Ee,{name:Qn[R]??"face"}),p(R)]},R)):n!==void 0?n.map(R=>(0,f.jsxs)("li",{children:[(0,f.jsx)(Ee,{name:Wn[R.id]??"face"}),R.text]},R.id)):(0,f.jsxs)(f.Fragment,{children:[(0,f.jsxs)("li",{children:[(0,f.jsx)(Ee,{name:"light"}),p("capture.tips.light")]}),(0,f.jsxs)("li",{children:[(0,f.jsx)(Ee,{name:"jGlasses"}),p("capture.tips.uncover")]}),(0,f.jsxs)("li",{children:[(0,f.jsx)(Ee,{name:"smartphone"}),p("capture.tips.eyeLevel")]})]})}),c??null,c!==void 0?null:t.assets==="failed"?(0,f.jsx)(te,{kind:"secondary",full:!0,onClick:t.retryAssets,children:p("common.retry")}):null,c!==void 0?null:(0,f.jsx)(_r,{children:(0,f.jsxs)(te,{full:!0,disabled:t.assets!=="ready"||j,"aria-busy":t.assets==="loading"||void 0,onClick:e,children:[(0,f.jsx)(Ee,{name:"camera"}),p("capture.start")]})})]})}l(Xn,"re");s(Xn,"FaceIntro");var es=new Set(["match_inconclusive","no_face_source","below_threshold"]);function bn({retry:e,title:t}){let n=Ct(),r=e.retakeHint===void 0?null:Xe(e.retakeHint),a=e.reason==="probe_not_from_liveness"?"capture.retrySamePerson.message":es.has(e.reason)?"capture.retryMatch.message":et(e.reason);return(0,f.jsxs)(wr,{tone:"warning",children:[r!==null?(0,f.jsx)("span",{children:n.t(r)}):a!==null?(0,f.jsx)("span",{children:n.t(a)}):null,r===null?(0,f.jsx)("span",{children:n.t(t)}):null,(0,f.jsx)("span",{children:Sr(n,e.attemptsRemaining,e.attemptsExhausted)})]})}l(bn,"K");s(bn,"RetryNotice");function ts(e){return kt(e)}l(ts,"ce");s(ts,"isInAppBrowser");function rs(e,t){let n=t??(typeof navigator>"u"?"":String(navigator.userAgent??""));if(!/Android/i.test(n))return null;let r;try{r=new URL(e)}catch{return null}if(r.protocol!=="https:"&&r.protocol!=="http:")return null;let a=r.protocol.slice(0,-1);return`intent://${r.host}${r.pathname}${r.search}#Intent;scheme=${a};action=android.intent.action.VIEW;S.browser_fallback_url=${encodeURIComponent(e)};end`}l(rs,"le");s(rs,"androidBrowserIntent");export{qr as a,Lt as b,qn as c,sn as d,Zn as e,_s as f,Cs as g,zn as h,Yn as i,Jn as j,Xn as k,ts as l,rs as m};
@@ -1 +1 @@
1
- import{b,t as r,v as l,y as o}from"./chunk-Z6KNLRUW.js";import{a as i}from"./chunk-5QL6W6FW.js";import{a,c as p}from"./chunk-4FHWXBOB.js";var s=p(b(),1);function f({tone:d,icon:n,busy:c,title:m,titleId:e,children:u,actions:t,live:y,testId:h}){let k=r();return(0,s.jsxs)("section",{className:"sekyro-step sekyro-status",...e!==void 0?{"aria-labelledby":e}:{},...y?{role:"status","aria-live":"polite"}:{},"data-testid":h,children:[(0,s.jsxs)("div",{className:"sekyro-status__body",children:[(0,s.jsx)("span",{className:`sekyro-tile sekyro-tile--${d}${c?" is-busy":""}`,"aria-hidden":"true",children:(0,s.jsx)(l,{name:n})}),(0,s.jsxs)("div",{className:"sekyro-heading sekyro-status__text",children:[(0,s.jsx)("h2",{id:e,ref:k,tabIndex:-1,className:"sekyro-text-body",children:m}),u]})]}),t!=null&&t!==!1?(0,s.jsx)(o,{children:t}):null]})}a(f,"g");i(f,"StatusPage");export{f as a};
1
+ import{b,t as r,v as l,y as o}from"./chunk-PLWGAXYM.js";import{a as i}from"./chunk-5QL6W6FW.js";import{a,c as p}from"./chunk-4FHWXBOB.js";var s=p(b(),1);function f({tone:d,icon:n,busy:c,title:m,titleId:e,children:u,actions:t,live:y,testId:h}){let k=r();return(0,s.jsxs)("section",{className:"sekyro-step sekyro-status",...e!==void 0?{"aria-labelledby":e}:{},...y?{role:"status","aria-live":"polite"}:{},"data-testid":h,children:[(0,s.jsxs)("div",{className:"sekyro-status__body",children:[(0,s.jsx)("span",{className:`sekyro-tile sekyro-tile--${d}${c?" is-busy":""}`,"aria-hidden":"true",children:(0,s.jsx)(l,{name:n})}),(0,s.jsxs)("div",{className:"sekyro-heading sekyro-status__text",children:[(0,s.jsx)("h2",{id:e,ref:k,tabIndex:-1,className:"sekyro-text-body",children:m}),u]})]}),t!=null&&t!==!1?(0,s.jsx)(o,{children:t}):null]})}a(f,"g");i(f,"StatusPage");export{f as a};
@@ -1 +1 @@
1
- import{a as j}from"./chunk-QR7XWTXK.js";import{d as U}from"./chunk-SI6GIBVC.js";import{K as k,L as I,a as A,b as V,c as h,v as T,w as _,y as C}from"./chunk-Z6KNLRUW.js";import{a as n}from"./chunk-5QL6W6FW.js";import{a as s,c as N}from"./chunk-4FHWXBOB.js";var f=N(A(),1),e=N(V(),1);var D={"portrait.source.title":"كيف تريد إضافة صورتك الشخصية؟","portrait.source.description":"التقط صورة جديدة بالكاميرا، أو ارفع صورة حديثة من هذا الجهاز.","portrait.source.camera":"التقاط صورة","portrait.source.upload":"رفع صورة","portrait.source.uploadInstead":"رفع صورة بدلًا من ذلك","portrait.upload.title":"ارفع صورتك الشخصية","portrait.upload.hint":"صورة حديثة لوجهك، تنظر فيها مباشرة إلى الكاميرا، أمام جدار فاتح وبلون واحد.","portrait.upload.choose":"اختيار صورة","portrait.upload.unsupported":"اختر صورة بصيغة JPEG أو PNG أو HEIC.","portrait.upload.failed":"تعذّر إرسال هذه الصورة. حاول مرة أخرى.","portrait.review.title":"تحقّق من صورتك المعدّلة","portrait.review.description":"عدّلنا صورتك لتطابق قواعد صور الهوية. لم نغيّر وجهك.","portrait.review.original":"صورتك","portrait.review.fixed":"الصورة المعدّلة","portrait.review.fixesTitle":"ما الذي غيّرناه","portrait.review.accept":"استخدام هذه الصورة","portrait.review.retake":"إعادة الالتقاط","portrait.review.uploadAnother":"رفع صورة أخرى","portrait.fixes.crop":"قُصّت","portrait.fixes.scale":"غُيّر حجمها","portrait.fixes.straighten":"عُدّل ميلها","portrait.fixes.background":"استُبدلت الخلفية","portrait.fixes.exposure":"عُدّل السطوع","portrait.fixes.white_balance":"وُزنت الألوان","reasons.portrait_morph_suspected":"لا يمكن استخدام هذه الصورة. التقط صورة جديدة للشخص.","reasons.portrait_reference_mismatch":"لا تطابق الصورة المرجع. التقط صورة جديدة للشخص.","reasons.portrait_declined_fix":"التقط صورة أخرى أو ارفعها."},y={"portrait.source.title":"How do you want to add your ID photo?","portrait.source.description":"Take a new photo with the camera, or upload a recent photo from this device.","portrait.source.camera":"Take a photo","portrait.source.upload":"Upload a photo","portrait.source.uploadInstead":"Upload a photo instead","portrait.upload.title":"Upload your ID photo","portrait.upload.hint":"A recent photo of your face, looking straight at the camera, in front of a plain, light wall.","portrait.upload.choose":"Choose a photo","portrait.upload.unsupported":"Choose a JPEG, PNG or HEIC photo.","portrait.upload.failed":"We could not send this photo. Try again.","portrait.review.title":"Check your adjusted photo","portrait.review.description":"We adjusted your photo to meet the ID photo rules. Your face was not changed.","portrait.review.original":"Your photo","portrait.review.fixed":"Adjusted photo","portrait.review.fixesTitle":"What we changed","portrait.review.accept":"Use this photo","portrait.review.retake":"Take another","portrait.review.uploadAnother":"Upload another","portrait.fixes.crop":"Cropped","portrait.fixes.scale":"Resized","portrait.fixes.straighten":"Straightened","portrait.fixes.background":"Background replaced","portrait.fixes.exposure":"Brightness adjusted","portrait.fixes.white_balance":"Colours balanced","reasons.portrait_morph_suspected":"This photo cannot be used. Take a new photo of the person.","reasons.portrait_reference_mismatch":"The photo does not match the reference. Take a new photo of the person.","reasons.portrait_declined_fix":"Take or upload another photo."},G={"portrait.source.title":"Comment voulez-vous ajouter votre photo d'identité ?","portrait.source.description":"Prenez une nouvelle photo avec la caméra, ou importez une photo récente depuis cet appareil.","portrait.source.camera":"Prendre une photo","portrait.source.upload":"Importer une photo","portrait.source.uploadInstead":"Importer une photo à la place","portrait.upload.title":"Importez votre photo d'identité","portrait.upload.hint":"Une photo récente de votre visage, de face, devant un mur clair et uni.","portrait.upload.choose":"Choisir une photo","portrait.upload.unsupported":"Choisissez une photo JPEG, PNG ou HEIC.","portrait.upload.failed":"Nous n'avons pas pu envoyer cette photo. Réessayez.","portrait.review.title":"Vérifiez votre photo ajustée","portrait.review.description":"Nous avons ajusté votre photo pour qu'elle respecte les règles des photos d'identité. Votre visage n'a pas été modifié.","portrait.review.original":"Votre photo","portrait.review.fixed":"Photo ajustée","portrait.review.fixesTitle":"Ce que nous avons modifié","portrait.review.accept":"Utiliser cette photo","portrait.review.retake":"Reprendre","portrait.review.uploadAnother":"Importer une autre","portrait.fixes.crop":"Recadrée","portrait.fixes.scale":"Redimensionnée","portrait.fixes.straighten":"Redressée","portrait.fixes.background":"Fond remplacé","portrait.fixes.exposure":"Luminosité ajustée","portrait.fixes.white_balance":"Couleurs équilibrées","reasons.portrait_morph_suspected":"Cette photo ne peut pas être utilisée. Prenez une nouvelle photo de la personne.","reasons.portrait_reference_mismatch":"La photo ne correspond pas à la référence. Prenez une nouvelle photo de la personne.","reasons.portrait_declined_fix":"Prenez ou importez une autre photo."},H={en:y,fr:G,ar:D,es:y,pt:y,de:y},S="image/jpeg,image/png,image/heic,image/heif";function m(r){let o=r.strings,a=H[r.locale];return t=>o[t]??a[t]??""}s(m,"v");n(m,"portraitCopy");function b({step:r,i18n:o}){if(r.reason===void 0||r.reason==="portrait_fix_review")return null;let a=m(o)(`reasons.${r.reason}`)||o.t("portrait.retryTitle");return(0,e.jsxs)(k,{tone:"warning",children:[(0,e.jsx)("span",{children:a}),(0,e.jsx)("span",{children:I(o,r.attemptsRemaining,r.attemptsExhausted)})]})}s(b,"R");n(b,"ReasonNotice");function z({step:r,i18n:o,onCamera:a,onUpload:t}){let i=m(o),p=r.photo?.cameraOnPhone===!0;return(0,e.jsx)(j,{testId:"sekyro-portrait-source",title:i("portrait.source.title"),lead:i("portrait.source.description"),cameraLabel:p?o.t("capture.source.phone"):i("portrait.source.camera"),onPhone:p,uploadLabel:i("portrait.source.upload"),notice:(0,e.jsx)(b,{step:r,i18n:o}),onCamera:a,onUpload:t})}s(z,"z");n(z,"PortraitSourceView");function R({step:r,i18n:o,onCamera:a}){let t=m(o),i=(0,f.useRef)(null),[p,v]=(0,f.useState)("idle"),u=p==="sending",d=r.photo?.uploadOffered===!0,g=n(async c=>{let x=c.currentTarget.files?.[0];if(c.currentTarget.value="",x!==void 0){v("sending");try{await r.uploadPortrait(x),v("idle")}catch(w){v(w instanceof TypeError&&w.message==="unsupported_file"?"unsupported":"failed")}}},"onFile");return(0,e.jsxs)("section",{className:"sekyro-step","data-testid":"sekyro-portrait-upload-screen",children:[(0,e.jsx)(_,{title:t("portrait.upload.title"),lead:t("portrait.upload.hint")}),p==="idle"||p==="sending"?(0,e.jsx)(b,{step:r,i18n:o}):null,p==="unsupported"||p==="failed"?(0,e.jsx)(k,{tone:"warning",children:(0,e.jsx)("span",{children:t(p==="unsupported"?"portrait.upload.unsupported":"portrait.upload.failed")})}):null,u?(0,e.jsx)("p",{className:"sekyro-text-muted",role:"status","aria-busy":"true",children:o.t("portrait.uploading")}):null,(0,e.jsx)("input",{ref:i,type:"file",accept:S,hidden:!0,"data-testid":"sekyro-portrait-upload","aria-label":t("portrait.upload.title"),onChange:s(c=>{g(c)},"onChange")}),(0,e.jsxs)(C,{children:[(0,e.jsx)(h,{full:!0,onClick:s(()=>i.current?.click(),"onClick"),disabled:u||!d||r.attemptsExhausted,children:t("portrait.upload.choose")}),a!==void 0?(0,e.jsxs)(h,{full:!0,kind:"ghost",onClick:a,disabled:u,children:[(0,e.jsx)(T,{name:"camera"}),t("portrait.source.camera")]}):null]})]})}s(R,"A");n(R,"PortraitUploadView");function E({step:r,i18n:o,onDeclined:a}){let t=m(o),[i,p]=(0,f.useState)(!1),[v,u]=(0,f.useState)(!1),d=r.pendingFix;if(d==null)return null;let g=n(async l=>{p(!0),u(!1);try{await r.confirmFix(l),l||a?.()}catch{u(!0)}finally{p(!1)}},"answer"),c=r.photo?.source==="upload"?t("portrait.review.uploadAnother"):t("portrait.review.retake"),x=n(l=>t(`portrait.fixes.${l}`)||l,"fixName"),w=t("portrait.review.original"),P=t("portrait.review.fixed");return(0,e.jsxs)("section",{className:"sekyro-step","data-testid":"sekyro-portrait-review",children:[(0,e.jsx)(_,{title:t("portrait.review.title"),lead:t("portrait.review.description")}),(0,e.jsxs)("div",{className:"sekyro-portrait-pair",children:[(0,e.jsxs)("figure",{className:"sekyro-portrait-pair__item",children:[(0,e.jsx)("img",{src:d.originalUrl,alt:w}),(0,e.jsx)("figcaption",{className:"sekyro-text-muted",children:w})]}),(0,e.jsxs)("figure",{className:"sekyro-portrait-pair__item",children:[(0,e.jsx)("img",{src:d.fixedUrl,alt:P}),(0,e.jsx)("figcaption",{className:"sekyro-text-muted",children:P})]})]}),d.fixes.length>0?(0,e.jsxs)("div",{className:"sekyro-stack sekyro-stack--1",children:[(0,e.jsx)("p",{className:"sekyro-text-body",children:t("portrait.review.fixesTitle")}),(0,e.jsx)("ul",{className:"sekyro-portrait-fixes","data-testid":"sekyro-portrait-fixes",children:d.fixes.map(l=>(0,e.jsx)("li",{children:x(l)},l))})]}):null,v?(0,e.jsx)(k,{tone:"danger",children:(0,e.jsx)("span",{children:o.t("errors.network_error")})}):null,(0,e.jsxs)(C,{children:[(0,e.jsx)(h,{full:!0,onClick:s(()=>{g(!0)},"onClick"),disabled:i,"data-testid":"sekyro-portrait-accept",children:t("portrait.review.accept")}),(0,e.jsx)(h,{full:!0,kind:"ghost",onClick:s(()=>{g(!1)},"onClick"),disabled:i,"data-testid":"sekyro-portrait-decline",children:c})]})]})}s(E,"j");n(E,"PortraitReviewView");function q({screen:r,step:o,i18n:a,onCamera:t,onUpload:i,onDeclined:p}){return r==="phone"?(0,e.jsx)(U,{i18n:a,lead:a.t("handoff.lead.portrait"),refresh:o.refresh,actions:(0,e.jsx)(h,{kind:"ghost",full:!0,onClick:i,children:m(a)("portrait.source.upload")})}):r==="review"?(0,e.jsx)(E,{step:o,i18n:a,onDeclined:p}):r==="upload"?(0,e.jsx)(R,{step:o,i18n:a,...t!==void 0?{onCamera:t}:{}}):(0,e.jsx)(z,{step:o,i18n:a,onCamera:t??i,onUpload:i})}s(q,"Q");n(q,"PortraitScreens");export{m as a,z as b,R as c,E as d,q as e};
1
+ import{a as j}from"./chunk-PAU2BFT7.js";import{d as U}from"./chunk-6H2SLOEK.js";import{L as k,M as I,a as A,b as V,c as h,v as T,w as _,y as C}from"./chunk-PLWGAXYM.js";import{a as n}from"./chunk-5QL6W6FW.js";import{a as s,c as N}from"./chunk-4FHWXBOB.js";var f=N(A(),1),e=N(V(),1);var D={"portrait.source.title":"كيف تريد إضافة صورتك الشخصية؟","portrait.source.description":"التقط صورة جديدة بالكاميرا، أو ارفع صورة حديثة من هذا الجهاز.","portrait.source.camera":"التقاط صورة","portrait.source.upload":"رفع صورة","portrait.source.uploadInstead":"رفع صورة بدلًا من ذلك","portrait.upload.title":"ارفع صورتك الشخصية","portrait.upload.hint":"صورة حديثة لوجهك، تنظر فيها مباشرة إلى الكاميرا، أمام جدار فاتح وبلون واحد.","portrait.upload.choose":"اختيار صورة","portrait.upload.unsupported":"اختر صورة بصيغة JPEG أو PNG أو HEIC.","portrait.upload.failed":"تعذّر إرسال هذه الصورة. حاول مرة أخرى.","portrait.review.title":"تحقّق من صورتك المعدّلة","portrait.review.description":"عدّلنا صورتك لتطابق قواعد صور الهوية. لم نغيّر وجهك.","portrait.review.original":"صورتك","portrait.review.fixed":"الصورة المعدّلة","portrait.review.fixesTitle":"ما الذي غيّرناه","portrait.review.accept":"استخدام هذه الصورة","portrait.review.retake":"إعادة الالتقاط","portrait.review.uploadAnother":"رفع صورة أخرى","portrait.fixes.crop":"قُصّت","portrait.fixes.scale":"غُيّر حجمها","portrait.fixes.straighten":"عُدّل ميلها","portrait.fixes.background":"استُبدلت الخلفية","portrait.fixes.exposure":"عُدّل السطوع","portrait.fixes.white_balance":"وُزنت الألوان","reasons.portrait_morph_suspected":"لا يمكن استخدام هذه الصورة. التقط صورة جديدة للشخص.","reasons.portrait_reference_mismatch":"لا تطابق الصورة المرجع. التقط صورة جديدة للشخص.","reasons.portrait_declined_fix":"التقط صورة أخرى أو ارفعها."},y={"portrait.source.title":"How do you want to add your ID photo?","portrait.source.description":"Take a new photo with the camera, or upload a recent photo from this device.","portrait.source.camera":"Take a photo","portrait.source.upload":"Upload a photo","portrait.source.uploadInstead":"Upload a photo instead","portrait.upload.title":"Upload your ID photo","portrait.upload.hint":"A recent photo of your face, looking straight at the camera, in front of a plain, light wall.","portrait.upload.choose":"Choose a photo","portrait.upload.unsupported":"Choose a JPEG, PNG or HEIC photo.","portrait.upload.failed":"We could not send this photo. Try again.","portrait.review.title":"Check your adjusted photo","portrait.review.description":"We adjusted your photo to meet the ID photo rules. Your face was not changed.","portrait.review.original":"Your photo","portrait.review.fixed":"Adjusted photo","portrait.review.fixesTitle":"What we changed","portrait.review.accept":"Use this photo","portrait.review.retake":"Take another","portrait.review.uploadAnother":"Upload another","portrait.fixes.crop":"Cropped","portrait.fixes.scale":"Resized","portrait.fixes.straighten":"Straightened","portrait.fixes.background":"Background replaced","portrait.fixes.exposure":"Brightness adjusted","portrait.fixes.white_balance":"Colours balanced","reasons.portrait_morph_suspected":"This photo cannot be used. Take a new photo of the person.","reasons.portrait_reference_mismatch":"The photo does not match the reference. Take a new photo of the person.","reasons.portrait_declined_fix":"Take or upload another photo."},G={"portrait.source.title":"Comment voulez-vous ajouter votre photo d'identité ?","portrait.source.description":"Prenez une nouvelle photo avec la caméra, ou importez une photo récente depuis cet appareil.","portrait.source.camera":"Prendre une photo","portrait.source.upload":"Importer une photo","portrait.source.uploadInstead":"Importer une photo à la place","portrait.upload.title":"Importez votre photo d'identité","portrait.upload.hint":"Une photo récente de votre visage, de face, devant un mur clair et uni.","portrait.upload.choose":"Choisir une photo","portrait.upload.unsupported":"Choisissez une photo JPEG, PNG ou HEIC.","portrait.upload.failed":"Nous n'avons pas pu envoyer cette photo. Réessayez.","portrait.review.title":"Vérifiez votre photo ajustée","portrait.review.description":"Nous avons ajusté votre photo pour qu'elle respecte les règles des photos d'identité. Votre visage n'a pas été modifié.","portrait.review.original":"Votre photo","portrait.review.fixed":"Photo ajustée","portrait.review.fixesTitle":"Ce que nous avons modifié","portrait.review.accept":"Utiliser cette photo","portrait.review.retake":"Reprendre","portrait.review.uploadAnother":"Importer une autre","portrait.fixes.crop":"Recadrée","portrait.fixes.scale":"Redimensionnée","portrait.fixes.straighten":"Redressée","portrait.fixes.background":"Fond remplacé","portrait.fixes.exposure":"Luminosité ajustée","portrait.fixes.white_balance":"Couleurs équilibrées","reasons.portrait_morph_suspected":"Cette photo ne peut pas être utilisée. Prenez une nouvelle photo de la personne.","reasons.portrait_reference_mismatch":"La photo ne correspond pas à la référence. Prenez une nouvelle photo de la personne.","reasons.portrait_declined_fix":"Prenez ou importez une autre photo."},H={en:y,fr:G,ar:D,es:y,pt:y,de:y},S="image/jpeg,image/png,image/heic,image/heif";function m(r){let o=r.strings,a=H[r.locale];return t=>o[t]??a[t]??""}s(m,"v");n(m,"portraitCopy");function b({step:r,i18n:o}){if(r.reason===void 0||r.reason==="portrait_fix_review")return null;let a=m(o)(`reasons.${r.reason}`)||o.t("portrait.retryTitle");return(0,e.jsxs)(k,{tone:"warning",children:[(0,e.jsx)("span",{children:a}),(0,e.jsx)("span",{children:I(o,r.attemptsRemaining,r.attemptsExhausted)})]})}s(b,"R");n(b,"ReasonNotice");function z({step:r,i18n:o,onCamera:a,onUpload:t}){let i=m(o),p=r.photo?.cameraOnPhone===!0;return(0,e.jsx)(j,{testId:"sekyro-portrait-source",title:i("portrait.source.title"),lead:i("portrait.source.description"),cameraLabel:p?o.t("capture.source.phone"):i("portrait.source.camera"),onPhone:p,uploadLabel:i("portrait.source.upload"),notice:(0,e.jsx)(b,{step:r,i18n:o}),onCamera:a,onUpload:t})}s(z,"z");n(z,"PortraitSourceView");function R({step:r,i18n:o,onCamera:a}){let t=m(o),i=(0,f.useRef)(null),[p,v]=(0,f.useState)("idle"),u=p==="sending",d=r.photo?.uploadOffered===!0,g=n(async c=>{let x=c.currentTarget.files?.[0];if(c.currentTarget.value="",x!==void 0){v("sending");try{await r.uploadPortrait(x),v("idle")}catch(w){v(w instanceof TypeError&&w.message==="unsupported_file"?"unsupported":"failed")}}},"onFile");return(0,e.jsxs)("section",{className:"sekyro-step","data-testid":"sekyro-portrait-upload-screen",children:[(0,e.jsx)(_,{title:t("portrait.upload.title"),lead:t("portrait.upload.hint")}),p==="idle"||p==="sending"?(0,e.jsx)(b,{step:r,i18n:o}):null,p==="unsupported"||p==="failed"?(0,e.jsx)(k,{tone:"warning",children:(0,e.jsx)("span",{children:t(p==="unsupported"?"portrait.upload.unsupported":"portrait.upload.failed")})}):null,u?(0,e.jsx)("p",{className:"sekyro-text-muted",role:"status","aria-busy":"true",children:o.t("portrait.uploading")}):null,(0,e.jsx)("input",{ref:i,type:"file",accept:S,hidden:!0,"data-testid":"sekyro-portrait-upload","aria-label":t("portrait.upload.title"),onChange:s(c=>{g(c)},"onChange")}),(0,e.jsxs)(C,{children:[(0,e.jsx)(h,{full:!0,onClick:s(()=>i.current?.click(),"onClick"),disabled:u||!d||r.attemptsExhausted,children:t("portrait.upload.choose")}),a!==void 0?(0,e.jsxs)(h,{full:!0,kind:"ghost",onClick:a,disabled:u,children:[(0,e.jsx)(T,{name:"camera"}),t("portrait.source.camera")]}):null]})]})}s(R,"A");n(R,"PortraitUploadView");function E({step:r,i18n:o,onDeclined:a}){let t=m(o),[i,p]=(0,f.useState)(!1),[v,u]=(0,f.useState)(!1),d=r.pendingFix;if(d==null)return null;let g=n(async l=>{p(!0),u(!1);try{await r.confirmFix(l),l||a?.()}catch{u(!0)}finally{p(!1)}},"answer"),c=r.photo?.source==="upload"?t("portrait.review.uploadAnother"):t("portrait.review.retake"),x=n(l=>t(`portrait.fixes.${l}`)||l,"fixName"),w=t("portrait.review.original"),P=t("portrait.review.fixed");return(0,e.jsxs)("section",{className:"sekyro-step","data-testid":"sekyro-portrait-review",children:[(0,e.jsx)(_,{title:t("portrait.review.title"),lead:t("portrait.review.description")}),(0,e.jsxs)("div",{className:"sekyro-portrait-pair",children:[(0,e.jsxs)("figure",{className:"sekyro-portrait-pair__item",children:[(0,e.jsx)("img",{src:d.originalUrl,alt:w}),(0,e.jsx)("figcaption",{className:"sekyro-text-muted",children:w})]}),(0,e.jsxs)("figure",{className:"sekyro-portrait-pair__item",children:[(0,e.jsx)("img",{src:d.fixedUrl,alt:P}),(0,e.jsx)("figcaption",{className:"sekyro-text-muted",children:P})]})]}),d.fixes.length>0?(0,e.jsxs)("div",{className:"sekyro-stack sekyro-stack--1",children:[(0,e.jsx)("p",{className:"sekyro-text-body",children:t("portrait.review.fixesTitle")}),(0,e.jsx)("ul",{className:"sekyro-portrait-fixes","data-testid":"sekyro-portrait-fixes",children:d.fixes.map(l=>(0,e.jsx)("li",{children:x(l)},l))})]}):null,v?(0,e.jsx)(k,{tone:"danger",children:(0,e.jsx)("span",{children:o.t("errors.network_error")})}):null,(0,e.jsxs)(C,{children:[(0,e.jsx)(h,{full:!0,onClick:s(()=>{g(!0)},"onClick"),disabled:i,"data-testid":"sekyro-portrait-accept",children:t("portrait.review.accept")}),(0,e.jsx)(h,{full:!0,kind:"ghost",onClick:s(()=>{g(!1)},"onClick"),disabled:i,"data-testid":"sekyro-portrait-decline",children:c})]})]})}s(E,"j");n(E,"PortraitReviewView");function q({screen:r,step:o,i18n:a,onCamera:t,onUpload:i,onDeclined:p}){return r==="phone"?(0,e.jsx)(U,{i18n:a,lead:a.t("handoff.lead.portrait"),refresh:o.refresh,actions:(0,e.jsx)(h,{kind:"ghost",full:!0,onClick:i,children:m(a)("portrait.source.upload")})}):r==="review"?(0,e.jsx)(E,{step:o,i18n:a,onDeclined:p}):r==="upload"?(0,e.jsx)(R,{step:o,i18n:a,...t!==void 0?{onCamera:t}:{}}):(0,e.jsx)(z,{step:o,i18n:a,onCamera:t??i,onUpload:i})}s(q,"Q");n(q,"PortraitScreens");export{m as a,z as b,R as c,E as d,q as e};