@sekyro/elements 0.1.0-rc.7 → 0.1.0-rc.9

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 (107) hide show
  1. package/CHANGELOG.md +28 -0
  2. package/dist/cdn/chunks/barcode-detect-C5IOXMKI-ZOZ2WOWU.js +1 -0
  3. package/dist/cdn/chunks/{capture-session-doc-LUA4Y7PZ-LOMSB7V7.js → capture-session-doc-ESEZJBQM-BXCU4HNS.js} +1 -1
  4. package/dist/cdn/chunks/challenge-frame-YAQJ5YMB-MHZYRGKY.js +1 -0
  5. package/dist/cdn/chunks/{chunk-OGRBLEPE.js → chunk-3S4VNKLC.js} +1 -1
  6. package/dist/cdn/chunks/chunk-4PBYN632.js +1 -0
  7. package/dist/cdn/chunks/chunk-4ZCLJICC.js +1 -0
  8. package/dist/cdn/chunks/chunk-6NWHU56A.js +33 -0
  9. package/dist/cdn/chunks/{chunk-33KMCERZ.js → chunk-A2ZKVVIE.js} +1 -1
  10. package/dist/cdn/chunks/chunk-CYLXKJUY.js +3 -0
  11. package/dist/cdn/chunks/{chunk-3ELDB5WG.js → chunk-DASQWRD2.js} +1 -1
  12. package/dist/cdn/chunks/{chunk-M4UCDUJB.js → chunk-DYCKQAZH.js} +1 -1
  13. package/dist/cdn/chunks/chunk-E2MOAJT7.js +1 -0
  14. package/dist/cdn/chunks/{chunk-4FTXJ6MZ.js → chunk-ELKN3A2Q.js} +1 -1
  15. package/dist/cdn/chunks/{chunk-L2UAVB62.js → chunk-F2MXING6.js} +1 -1
  16. package/dist/cdn/chunks/chunk-GTYN5CAI.js +25 -0
  17. package/dist/cdn/chunks/{chunk-FGBKOHVK.js → chunk-J6ERQV2N.js} +1 -1
  18. package/dist/cdn/chunks/chunk-KMKUWNV6.js +1 -0
  19. package/dist/cdn/chunks/{chunk-F4IM73DE.js → chunk-MSENKS6X.js} +1 -1
  20. package/dist/cdn/chunks/{chunk-HH33TJJH.js → chunk-O33NXBND.js} +1 -1
  21. package/dist/cdn/chunks/chunk-OVZDKB3N.js +1 -0
  22. package/dist/cdn/chunks/{chunk-W4RXHXFP.js → chunk-PJ2UDPYO.js} +1 -1
  23. package/dist/cdn/chunks/{chunk-D2JAXHZF.js → chunk-RUN75CTZ.js} +1 -1
  24. package/dist/cdn/chunks/chunk-S5NGSYGI.js +1 -0
  25. package/dist/cdn/chunks/chunk-SIBJ56BG.js +1 -0
  26. package/dist/cdn/chunks/{chunk-WPRIGJHG.js → chunk-SMZ7F4L7.js} +1 -1
  27. package/dist/cdn/chunks/{chunk-ETJPN5LO.js → chunk-T5IERZBI.js} +1 -1
  28. package/dist/cdn/chunks/chunk-YZWLMKXA.js +1 -0
  29. package/dist/cdn/chunks/{chunk-QMITFZK4.js → chunk-ZXPJTB7H.js} +1 -1
  30. package/dist/cdn/chunks/{create-document-capture-ZTJKSEJB-NIBVRVLZ.js → create-document-capture-V7XCRRDV-3MGZONM3.js} +1 -1
  31. package/dist/cdn/chunks/{detector-scanic-23DAYT3H-AJXQA7H4.js → detector-scanic-SE3CL55N-JIGLCDPS.js} +1 -1
  32. package/dist/cdn/chunks/document-capture-view-5FWUD45F-TTB7XRVE.js +1 -0
  33. package/dist/cdn/chunks/{eid-view-7CTFIZ5R-PN357YSL.js → eid-view-U2HL2IX7-EKYQNIVA.js} +1 -1
  34. package/dist/cdn/chunks/{email-otp-view-MB334KKV-YKOW7MU6.js → email-otp-view-CMJHROOH-S7HHGHMS.js} +1 -1
  35. package/dist/cdn/chunks/flow-views-O3KBN7YF-37NQVUAE.js +1 -0
  36. package/dist/cdn/chunks/form-view-WVPN7ZUY-WVYV733R.js +1 -0
  37. package/dist/cdn/chunks/overlay-de-PVJMYZGV-JDDHHQJZ.js +1 -0
  38. package/dist/cdn/chunks/overlay-es-PZCE25XM-D7N7YW66.js +1 -0
  39. package/dist/cdn/chunks/overlay-pt-PZ3L6DR7-AD7SQLSO.js +1 -0
  40. package/dist/cdn/chunks/plan-runner-IXCKR4DB-OJHNDXG2.js +1 -0
  41. package/dist/cdn/chunks/{portrait-capture-view-DSUGE7PI-L7U7UVJY.js → portrait-capture-view-UYISOXXV-HR5FCO4J.js} +1 -1
  42. package/dist/cdn/chunks/{portrait-review-view-PPYEEMYM-V4UMKNJE.js → portrait-review-view-67VI2Q6K-KD55P5MN.js} +1 -1
  43. package/dist/cdn/chunks/proof-of-address-view-EIQXYYM3-JYSRHJ7R.js +1 -0
  44. package/dist/cdn/chunks/reader-652D2CK6.js +2 -0
  45. package/dist/cdn/define.js +1 -1
  46. package/dist/cdn/index.js +1 -1
  47. package/dist/{chunk-OSC2SC2X.js → chunk-6MLQBNF4.js} +1 -1
  48. package/dist/{chunk-3BGD4PJ7.js → chunk-DAAZBRNM.js} +1 -1
  49. package/dist/chunk-DUYCGH4R.js +33 -0
  50. package/dist/chunk-FAZTWW5J.js +1 -0
  51. package/dist/{chunk-VEOZABLV.js → chunk-HOOZLWNR.js} +1 -1
  52. package/dist/{chunk-KHBP6WWR.js → chunk-IB3NF7H5.js} +1 -1
  53. package/dist/{chunk-F2IPIZ4J.js → chunk-JIHK7L54.js} +1 -1
  54. package/dist/{chunk-BJ2YKUCC.js → chunk-MYYAFIK6.js} +1 -1
  55. package/dist/chunk-P223YKM3.js +1 -0
  56. package/dist/{chunk-PFH7S4E7.js → chunk-THDSSKYQ.js} +1 -1
  57. package/dist/chunk-TOU3UDCB.js +25 -0
  58. package/dist/{chunk-LNCABBX7.js → chunk-UIOHM6CB.js} +1 -1
  59. package/dist/chunk-V2KMG4IA.js +1 -0
  60. package/dist/{chunk-XLLG6AKG.js → chunk-WCPTICNC.js} +1 -1
  61. package/dist/chunk-ZLREPJUJ.js +1 -0
  62. package/dist/define.cjs +6 -6
  63. package/dist/define.js +1 -1
  64. package/dist/document-capture-view-5FWUD45F-PZAJNUII.js +1 -0
  65. package/dist/{eid-view-7CTFIZ5R-OL2YXQZO.js → eid-view-U2HL2IX7-ONZGT2S5.js} +1 -1
  66. package/dist/{email-otp-view-MB334KKV-Q7237EQV.js → email-otp-view-CMJHROOH-4DBMTA3R.js} +1 -1
  67. package/dist/flow-views-O3KBN7YF-I2I3K4EY.js +1 -0
  68. package/dist/form-view-WVPN7ZUY-Z523S2WJ.js +1 -0
  69. package/dist/index.cjs +6 -6
  70. package/dist/index.d.cts +70 -0
  71. package/dist/index.d.ts +70 -0
  72. package/dist/index.js +1 -1
  73. package/dist/overlay-de-PVJMYZGV-75ZFRADU.js +1 -0
  74. package/dist/overlay-es-PZCE25XM-IEA7Y6EU.js +1 -0
  75. package/dist/overlay-pt-PZ3L6DR7-WMCH3XQV.js +1 -0
  76. package/dist/{portrait-capture-view-DSUGE7PI-HBLXJDXY.js → portrait-capture-view-UYISOXXV-SO3YYR22.js} +1 -1
  77. package/dist/{portrait-review-view-PPYEEMYM-W66WNNUM.js → portrait-review-view-67VI2Q6K-ELE4HPWJ.js} +1 -1
  78. package/dist/proof-of-address-view-EIQXYYM3-HDMZQJCO.js +1 -0
  79. package/dist/styles.css +80 -10
  80. package/package.json +2 -2
  81. package/sbom.cdx.json +4 -4
  82. package/dist/cdn/chunks/challenge-frame-NUGPTWFP-V3GGQN65.js +0 -1
  83. package/dist/cdn/chunks/chunk-AXYGICTN.js +0 -3
  84. package/dist/cdn/chunks/chunk-DBGVBAMW.js +0 -1
  85. package/dist/cdn/chunks/chunk-DQAVYXAF.js +0 -25
  86. package/dist/cdn/chunks/chunk-EWTKC2C2.js +0 -1
  87. package/dist/cdn/chunks/chunk-FWZOENNU.js +0 -1
  88. package/dist/cdn/chunks/chunk-NYF6B3ZA.js +0 -1
  89. package/dist/cdn/chunks/chunk-OPRYWIQM.js +0 -33
  90. package/dist/cdn/chunks/chunk-UGHWANZX.js +0 -1
  91. package/dist/cdn/chunks/document-capture-view-ZKT3W6UE-FQWRXOHT.js +0 -1
  92. package/dist/cdn/chunks/flow-views-SRAXHC6K-J3H3VF3P.js +0 -1
  93. package/dist/cdn/chunks/overlay-de-ILMZBGZH-DIOHROVO.js +0 -1
  94. package/dist/cdn/chunks/overlay-es-YLDY73HJ-LSXKLJQ2.js +0 -1
  95. package/dist/cdn/chunks/overlay-pt-GZXT2S6D-ASML67UA.js +0 -1
  96. package/dist/cdn/chunks/plan-runner-INQLWFGS-24JH5MQZ.js +0 -1
  97. package/dist/cdn/chunks/proof-of-address-view-2M6UDK76-ND76DOHN.js +0 -1
  98. package/dist/chunk-FSGDOTCB.js +0 -1
  99. package/dist/chunk-ULVT7UW6.js +0 -1
  100. package/dist/chunk-UUDX5GK4.js +0 -33
  101. package/dist/chunk-YQ7XHAQJ.js +0 -25
  102. package/dist/document-capture-view-ZKT3W6UE-5JRPJOO5.js +0 -1
  103. package/dist/flow-views-SRAXHC6K-DUSVVMFO.js +0 -1
  104. package/dist/overlay-de-ILMZBGZH-L5N7BMI4.js +0 -1
  105. package/dist/overlay-es-YLDY73HJ-JYBZEXG5.js +0 -1
  106. package/dist/overlay-pt-GZXT2S6D-WCIUJ4DI.js +0 -1
  107. package/dist/proof-of-address-view-2M6UDK76-27QSU4R3.js +0 -1
package/CHANGELOG.md CHANGED
@@ -1,5 +1,33 @@
1
1
  # @sekyro/elements
2
2
 
3
+ ## 0.1.0-rc.9
4
+
5
+ ### Patch Changes
6
+
7
+ - Carries the @sekyro/react release of this version: the changes in its changelog reach the element.
8
+ - Updated dependencies [e70fdcd]
9
+ - @sekyro/web@0.1.0-rc.30
10
+
11
+ ## 0.1.0-rc.8
12
+
13
+ ### Patch Changes
14
+
15
+ - 8a832f3: `<sekyro-verification>` draws the Form step with the bundled `@sekyro/react` (planned: no flow can contain it yet).
16
+ - 9d173d9: `<SekyroVerification>` titles no longer change shape when Geist arrives: until the title face has loaded they are drawn in a metric-matched bold fallback (Arial Bold or Roboto Bold, sized to Geist), where they used to show Inter or the system face at a different width, so the title reflowed when Geist arrived. The result title now uses the flow's hero size (28 px), as on iOS and Android. A partner font still replaces the titles' face.
17
+ - Updated dependencies [1e6001c]
18
+ - Updated dependencies [06d8764]
19
+ - Updated dependencies [1c7c752]
20
+ - Updated dependencies [030c9dc]
21
+ - Updated dependencies [4581cc5]
22
+ - Updated dependencies [1b8395d]
23
+ - Updated dependencies [43ae1ec]
24
+ - Updated dependencies [a63d45e]
25
+ - Updated dependencies [98f6752]
26
+ - Updated dependencies [567f41a]
27
+ - Updated dependencies [a75a33e]
28
+ - Updated dependencies [80fbf3d]
29
+ - @sekyro/web@0.1.0-rc.29
30
+
3
31
  ## 0.1.0-rc.7
4
32
 
5
33
  ### Patch Changes
@@ -0,0 +1 @@
1
+ import{a as i}from"./chunk-YZWLMKXA.js";import{a as t}from"./chunk-4FHWXBOB.js";var c={name:"zxing_reader.wasm",bytes:928265,sha256:"5bb3ce7aeedc314e24afb873bebcf366a01c27a00b21cdf2fa98b819c005c16b",sha12:"5bb3ce7aeedc"},d=["PDF417","QRCode","DataMatrix","Aztec"];function f(e){return`${e.replace(/\/+$/,"")}/${c.sha12}/${c.name}`}t(f,"f");async function m(e,o=fetch){let r=await o(f(e),{cache:"force-cache",credentials:"omit"});if(!r.ok)throw new Error("barcode wasm download");let a=await r.arrayBuffer();if(a.byteLength!==c.bytes||await i(a)!==c.sha256)throw new Error("barcode wasm integrity");return a}t(m,"d");async function w(e,o=fetch){let r=await m(e,o),a=await import("./reader-652D2CK6.js");return await a.prepareZXingModule({overrides:{wasmBinary:r},fireImmediately:!0}),async s=>(await a.readBarcodes(s,{formats:[...d],tryHarder:!0,maxNumberOfSymbols:1})).some(n=>n.isValid)}t(w,"h");export{f as barcodeWasmUrl,m as fetchBarcodeWasm,w as loadBarcodeDetect};
@@ -1 +1 @@
1
- import{c as a,d as s,e as o,f as r,g as _,h as t,i as A,j as C,k as D,l as p,m as i}from"./chunk-L2UAVB62.js";import"./chunk-WPRIGJHG.js";import"./chunk-2FETDQV5.js";import"./chunk-EWTKC2C2.js";import"./chunk-L22GFJQV.js";import"./chunk-W4RXHXFP.js";import"./chunk-P7K7ELYZ.js";import"./chunk-JS2IXPNL.js";import"./chunk-4FHWXBOB.js";export{i as CAPTURE_CANDIDATE_SPACING_MS,p as CAPTURE_EXTRA_CANDIDATES,C as CaptureSessionDoc,o as DOC_BLACK_FRAME_LUMA,r as DOC_BLACK_FRAME_TICKS,_ as DOC_CADENCE_HZ,s as DOC_FIRST_FRAME_MS,t as DOC_SHUTTER_DEFAULTS,D as passportBandOf,A as resolveDocShutterTuning,a as warmDocDetector};
1
+ import{c as a,d as s,e as o,f as r,g as _,h as t,i as A,j as C,k as D,l as p,m as i}from"./chunk-F2MXING6.js";import"./chunk-SMZ7F4L7.js";import"./chunk-2FETDQV5.js";import"./chunk-OVZDKB3N.js";import"./chunk-L22GFJQV.js";import"./chunk-PJ2UDPYO.js";import"./chunk-P7K7ELYZ.js";import"./chunk-JS2IXPNL.js";import"./chunk-4FHWXBOB.js";export{i as CAPTURE_CANDIDATE_SPACING_MS,p as CAPTURE_EXTRA_CANDIDATES,C as CaptureSessionDoc,o as DOC_BLACK_FRAME_LUMA,r as DOC_BLACK_FRAME_TICKS,_ as DOC_CADENCE_HZ,s as DOC_FIRST_FRAME_MS,t as DOC_SHUTTER_DEFAULTS,D as passportBandOf,A as resolveDocShutterTuning,a as warmDocDetector};
@@ -0,0 +1 @@
1
+ import{a as i}from"./chunk-4FHWXBOB.js";var k=new Set(["challenge_frame_blocked","challenge_script_blocked","site_key_rejected","challenge_failed","timeout","embedder_opaque"]),f,o=(f=class extends Error{constructor(t,r){super(`Sekyro challenge failed: ${t}${r!==void 0?` (${r})`:""}`),this.name="ChallengeError",this.code=t,r!==void 0&&(this.detail=r)}},i(f,"i"),f),b=3e4,p=12e4,E="sekyro.challenge.",M="position:fixed;width:1px;height:1px;inset-block-start:0;inset-inline-start:0;opacity:0;pointer-events:none;border:0",d=null,m=Promise.resolve();function T(){y(),m=Promise.resolve(),g=!1}i(T,"F");function u(){return new o("aborted")}i(u,"c");function S(){let e=globalThis.crypto;return e!==void 0&&typeof e.randomUUID=="function"?e.randomUUID():`${Date.now().toString(36)}-${Math.random().toString(36).slice(2)}`}i(S,"C");function v(e){return new URL(e,document.baseURI).origin}i(v,"h");function y(){let e=d;if(e!==null){d=null,window.removeEventListener("message",e.listener),e.iframe.remove();for(let t of e.waiters.values())t.reject(new o("challenge_frame_blocked"));e.waiters.clear()}}i(y,"u");function A(e,t){if(t.source!==e.iframe.contentWindow||t.origin!==e.origin)return;let r=t.data;if(typeof r!="object"||r===null)return;let n=r;if(typeof n.type!="string"||!n.type.startsWith(E)||n.v!==1)return;if(n.type==="sekyro.challenge.ready"){e.readyMs??(e.readyMs=Date.now()-e.insertedAt),e.isReady=!0,e.onReady?.();return}if(typeof n.id!="string")return;let l=e.waiters.get(n.id);if(l!==void 0){if(n.type==="sekyro.challenge.token"&&typeof n.token=="string"&&n.token!=="")e.waiters.delete(n.id),l.resolve(n.token);else if(n.type==="sekyro.challenge.error"){e.waiters.delete(n.id);let a=typeof n.code=="string"&&k.has(n.code)?n.code:"challenge_failed",s=typeof n.detail=="string"||typeof n.detail=="number"?String(n.detail).slice(0,32):void 0;l.reject(new o(a,s))}}}i(A,"M");function L(e){if(d!==null&&d.url===e)return d;y();let t=document.createElement("iframe");t.setAttribute("title","Security check"),t.setAttribute("aria-hidden","true"),t.setAttribute("tabindex","-1"),t.setAttribute("referrerpolicy","no-referrer"),t.setAttribute("style",M);let r={url:e,origin:v(e),iframe:t,isReady:!1,insertedAt:Date.now(),onReady:null,waiters:new Map,listener:i(n=>A(r,n),"listener")};return window.addEventListener("message",r.listener),t.src=e,document.body.appendChild(t),d=r,r}i(L,"k");function R(e,t,r){return e.isReady?Promise.resolve():new Promise((n,l)=>{let a=i(()=>{clearTimeout(c),r?.removeEventListener("abort",s),e.onReady=null},"o"),s=i(()=>{a(),l(u())},"s"),c=setTimeout(()=>{a(),l(new o("challenge_frame_blocked"))},t);r?.addEventListener("abort",s,{once:!0}),e.onReady=()=>{a(),n()}})}i(R,"A");async function w(e){if(e.signal?.aborted)throw u();let t=L(e.frameUrl);try{return await U(t,e)}catch(r){throw r instanceof o&&t.readyMs!==void 0&&(r.readyMs??(r.readyMs=t.readyMs)),r}}i(w,"y");async function U(e,t){let r=t.signal;await R(e,t.readyTimeoutMs??b,r);let n=e.iframe.contentWindow;if(n===null)throw new o("challenge_frame_blocked");let l=t.timeoutMs??p,a=S(),s,c;try{return await new Promise((_,h)=>{e.waiters.set(a,{resolve:_,reject:h}),s=setTimeout(()=>h(new o("timeout")),l),r!==void 0&&(c=i(()=>h(u()),"l"),r.addEventListener("abort",c,{once:!0})),n.postMessage({type:"sekyro.challenge.request",v:1,id:a,siteKey:t.siteKey,action:t.action,subject:t.subject},e.origin)})}finally{clearTimeout(s),r!==void 0&&c!==void 0&&r.removeEventListener("abort",c),e.waiters.delete(a)}}i(U,"x");var g=!1;function x(e,t){if(g)return;let r;if(t==="challenge_frame_blocked"){let n=e;try{n=v(e)}catch{}r=`Sekyro: the security check frame could not load. Allow \`frame-src ${n}\` in your Content-Security-Policy.`}else if(t==="embedder_opaque")r="Sekyro: the security check needs a page with an origin. Do not run the SDK in a sandboxed or data: document.";else return;g=!0,console.warn(r)}i(x,"R");async function C(e){if(globalThis.origin==="null")throw new o("embedder_opaque");if(e.signal?.aborted)throw u();try{return await w(e)}catch(t){if(y(),e.signal?.aborted||t instanceof o&&t.code==="aborted")throw u();if(t instanceof o&&t.code==="timeout")throw t;try{return await w(e)}catch(r){throw y(),e.signal?.aborted?u():r instanceof o?r:new o("challenge_failed")}}}i(C,"S");function D(e){let t=i(()=>C(e).catch(n=>{throw n instanceof o&&x(e.frameUrl,n.code),n}),"n"),r=m.then(t,t);return m=r.catch(()=>{}),r}i(D,"T");export{p as CHALLENGE_EXECUTE_TIMEOUT_MS,b as CHALLENGE_READY_TIMEOUT_MS,o as ChallengeError,D as executeChallenge,T as resetChallengeFrameForTests};
@@ -1 +1 @@
1
- import{A as n,B as a,a as i}from"./chunk-NYF6B3ZA.js";import{a as t}from"./chunk-5QL6W6FW.js";import{a as o}from"./chunk-4FHWXBOB.js";function d(r,p){if(r instanceof n)return r.field==="phone"?"otp.phoneInvalid":r.field==="code"?"otp.codeInvalid":r.kind==="check_digit"?"population.reason_id_number_invalid":"population.invalid";if(r instanceof a&&r.field==="channel")return"otp.reason_otp_channel_unavailable";if(r instanceof i){let e=`errors.${r.code}`;if(Object.hasOwn(p,e))return e}return"errors.network_error"}o(d,"d");t(d,"errorKey");export{d as a};
1
+ import{D as n,E as a,a as i}from"./chunk-4ZCLJICC.js";import{a as t}from"./chunk-5QL6W6FW.js";import{a as o}from"./chunk-4FHWXBOB.js";function d(r,p){if(r instanceof n)return r.field==="phone"?"otp.phoneInvalid":r.field==="code"?"otp.codeInvalid":r.kind==="check_digit"?"population.reason_id_number_invalid":"population.invalid";if(r instanceof a&&r.field==="channel")return"otp.reason_otp_channel_unavailable";if(r instanceof i){let e=`errors.${r.code}`;if(Object.hasOwn(p,e))return e}return"errors.network_error"}o(d,"d");t(d,"errorKey");export{d as a};
@@ -0,0 +1 @@
1
+ import{a as Nr}from"./chunk-3S4VNKLC.js";import{c as _t}from"./chunk-KMKUWNV6.js";import{b as kr,d as br}from"./chunk-RUN75CTZ.js";import{b as xr,c as Ct}from"./chunk-A2ZKVVIE.js";import{a as yr,b as vr,c as gr,d as Le}from"./chunk-T5IERZBI.js";import{F as _r,K as wr,L as Sr,a as D,b as de,c as X,m as pr,n as Xe,p as hr,q as et,r as fr,s as mr,t as bt,u as se,v as Ae,w as tt,y as Cr}from"./chunk-GTYN5CAI.js";import{b as lr,c as cr,d as ur,g as dr}from"./chunk-ELKN3A2Q.js";import{b as kt}from"./chunk-PJ2UDPYO.js";import{a as s}from"./chunk-5QL6W6FW.js";import{f as ir}from"./chunk-CW56KMMH.js";import{a as o,c as E}from"./chunk-4FHWXBOB.js";var Rr=E(D(),1),v=E(de(),1),ee=E(de(),1),ye=E(D(),1),B=E(de(),1),C=E(D(),1),y=E(D(),1),at=E(D(),1),fe=E(de(),1),Wr=E(D(),1),Y=E(D(),1),it=E(D(),1),we=E(de(),1),Se=E(de(),1),U=E(de(),1);var lt=E(D(),1),pe=E(D(),1);var Q=E(D(),1);var M=E(D(),1),me=E(D(),1),Oe=E(D(),1),Rt=E(de(),1),k=E(de(),1);function oe({className:e,children:t}){return(0,v.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(oe,"te");s(oe,"Svg");var Lt="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 Lr(e){return(0,v.jsxs)(oe,{...e,children:[(0,v.jsx)("circle",{cx:"12",cy:"12",r:"4"}),(0,v.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(Lr,"ln");s(Lr,"SunIcon");function Ar(e){return(0,v.jsxs)(oe,{...e,children:[(0,v.jsx)("circle",{cx:"12",cy:"12",r:"9"}),(0,v.jsx)("path",{d:"M9 10h.01M15 10h.01M8.8 14.6a4.2 4.2 0 0 0 6.4 0"})]})}o(Ar,"un");s(Ar,"FaceUncoveredIcon");function Er(e){return(0,v.jsxs)(oe,{...e,children:[(0,v.jsx)("rect",{x:"7",y:"2.5",width:"10",height:"19",rx:"2"}),(0,v.jsx)("path",{d:"M10.5 18.5h3M2.5 9.5h2.5M19 9.5h2.5"}),(0,v.jsx)("circle",{cx:"12",cy:"9.5",r:"1.6"})]})}o(Er,"dn");s(Er,"PhoneEyeLevelIcon");function Ir(e){return(0,v.jsxs)(oe,{...e,children:[(0,v.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,v.jsx)("circle",{cx:"12",cy:"12",r:"2.8"})]})}o(Ir,"pn");s(Ir,"LookStraightIcon");function Ur(e){return(0,v.jsxs)(oe,{...e,children:[(0,v.jsx)("path",{d:Lt}),(0,v.jsx)("path",{d:"M9 13l2 2 4-4"})]})}o(Ur,"fn");s(Ur,"CameraCheckIcon");function jr(e){return(0,v.jsxs)(oe,{...e,children:[(0,v.jsx)("path",{d:Lt}),(0,v.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 Or(e){return(0,v.jsxs)(oe,{...e,children:[(0,v.jsx)("path",{d:Lt}),(0,v.jsx)("path",{d:"M3 3l18 18"})]})}o(Or,"yn");s(Or,"CameraBlockedIcon");function nt({off:e,className:t}){return(0,v.jsxs)(oe,{className:t,children:[(0,v.jsx)("path",{d:"M4.5 9.5v5H8l4 3.5v-12L8 9.5H4.5Z"}),e?(0,v.jsx)("path",{d:"M4 4l16 16"}):(0,v.jsxs)(v.Fragment,{children:[(0,v.jsx)("path",{d:"M15.5 9.7a3.6 3.6 0 0 1 0 4.6"}),(0,v.jsx)("path",{d:"M18 7.6a6.6 6.6 0 0 1 0 8.8"})]})]})}o(nt,"Ve");s(nt,"SpeakerIcon");function Pr(e){return(0,v.jsx)(oe,{...e,children:(0,v.jsx)("path",{d:"M5 12.5l4.5 4.5L19 7.5"})})}o(Pr,"gn");s(Pr,"CheckIcon");function Tr(e){return(0,v.jsxs)(oe,{className:e.className??"sekyro-spinner",children:[(0,v.jsx)("circle",{cx:"12",cy:"12",r:"9",opacity:"0.25"}),(0,v.jsx)("path",{d:"M21 12a9 9 0 0 0-9-9"})]})}o(Tr,"hn");s(Tr,"SpinnerIcon");var wt=["light","uncover","eyeLevel","straight"],En={light:{key:"capture.tips.light",icon:s(()=>(0,ee.jsx)(Lr,{}),"icon")},uncover:{key:"capture.tips.uncover",icon:s(()=>(0,ee.jsx)(Ar,{}),"icon")},eyeLevel:{key:"capture.tips.eyeLevel",icon:s(()=>(0,ee.jsx)(Er,{}),"icon")},straight:{key:"capture.tips.straight",icon:s(()=>(0,ee.jsx)(Ir,{}),"icon")}};function Br({tips:e}){let t=Le(),n=(0,Rr.useId)();return e.length===0?null:(0,ee.jsxs)("section",{className:"sekyro-tips","aria-labelledby":n,"data-testid":"sekyro-tips",children:[(0,ee.jsx)("p",{className:"sekyro-tips__title",id:n,children:t("capture.tips.title")}),(0,ee.jsx)("ul",{className:"sekyro-tips__list",children:e.map(r=>{let a=typeof r=="string"?En[r]:void 0,i=typeof r=="string"?r:r.id,l=a!==void 0?a.icon():typeof r=="string"?void 0:r.icon,u=a!==void 0?t(a.key):typeof r=="string"?r:r.text;return(0,ee.jsxs)("li",{className:"sekyro-tips__item",children:[l!=null?(0,ee.jsx)("span",{className:"sekyro-tips__icon","aria-hidden":"true",children:l}):null,(0,ee.jsx)("span",{children:u})]},i)})})]})}o(Br,"Cn");s(Br,"TipList");var In=220;function qr({title:e,description:t,options:n,busy:r,error:a,focus:i,testId:l,look:u="cards",marked:S,onChoose:h}){let w=(0,ye.useId)(),x=bt(),[I,d]=(0,ye.useState)(null),N=(0,ye.useRef)(null);(0,ye.useEffect)(()=>{a!==null&&d(null)},[a]),(0,ye.useEffect)(()=>()=>{N.current!==null&&clearTimeout(N.current)},[]);let R=s(p=>{r||I!==null||(d(p),N.current=setTimeout(()=>{N.current=null,d(null),h(p)},In))},"choose");return(0,B.jsxs)("section",{className:"sekyro-stack sekyro-stack--4 sekyro-choice","aria-labelledby":w,"data-testid":l,children:[(0,B.jsxs)("div",{className:u==="cards"?"sekyro-heading":"sekyro-stack sekyro-stack--1",children:[(0,B.jsx)("h2",{id:w,ref:i?x:void 0,tabIndex:-1,className:"sekyro-text-body",children:e}),t!==void 0&&t!==""?(0,B.jsx)("p",{className:"sekyro-text-muted",children:t}):null]}),a!==null?(0,B.jsx)(se,{tone:"danger",children:(0,B.jsx)("span",{children:a})}):null,u==="buttons"?(0,B.jsx)("div",{className:"sekyro-stack sekyro-stack--3",children:n.map((p,j)=>(0,B.jsx)(X,{kind:j===0?"primary":"ghost",full:!0,disabled:r,"aria-busy":r||void 0,onClick:o(()=>h(p.id),"onClick"),children:p.label},p.id))}):(0,B.jsx)("div",{className:"sekyro-choices",children:n.map(p=>(0,B.jsxs)("button",{type:"button",className:"sekyro-card","aria-pressed":(I??S)===p.id,"aria-busy":r||void 0,disabled:r||I!==null&&I!==p.id,onClick:o(()=>R(p.id),"onClick"),children:[p.glyph!==void 0?(0,B.jsx)("span",{className:"sekyro-card__tile",children:p.glyph}):null,(0,B.jsxs)("span",{className:"sekyro-card__body",children:[(0,B.jsx)("span",{className:"sekyro-card__title",children:p.label}),p.sub!==void 0?(0,B.jsx)("span",{className:"sekyro-card__sub",children:p.sub}):null]}),(0,B.jsx)("span",{className:"sekyro-radio","aria-hidden":"true"})]},p.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"];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=",On={ar:"ar-SA",fr:"fr-FR",en:"en-US",es:"es-ES",pt:"pt-BR",de:"de-DE"};function ae(){return typeof window<"u"&&"speechSynthesis"in window?window.speechSynthesis:null}o(ae,"ne");s(ae,"synth");function Hr(){return ae()!==null&&typeof SpeechSynthesisUtterance=="function"}o(Hr,"Lr");s(Hr,"speechAvailable");function St(e){return(e.split(/[-_]/)[0]??e).toLowerCase()}o(St,"Sn");s(St,"baseLang");function At(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(At,"Mn");s(At,"pickVoice");function Dr(e){if(!Hr())return!1;let t=[];try{t=ae()?.getVoices()??[]}catch{return!0}return t.length===0||At(t,e)!==void 0}o(Dr,"wn");s(Dr,"speechUsable");function Fr(e){let t=ae();return t===null||typeof t.addEventListener!="function"?()=>{}:(t.addEventListener("voiceschanged",e),()=>t.removeEventListener?.("voiceschanged",e))}o(Fr,"Ln");s(Fr,"subscribeVoices");function He(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(He,"Ke");s(He,"clipIdentity");function xt(e){e.pause(),e.removeAttribute("src"),e.load()}o(xt,"Rn");s(xt,"release");function $r(){let e=null,t=null,n=0,r=null,a=[],i=new Map,l=s(()=>{a=ae()?.getVoices()??[]},"loadVoices"),u=!1,S=s(()=>{let d=ae();u||d===null||(u=!0,l(),d.addEventListener?.("voiceschanged",l))},"bindVoices"),h=s(()=>(e??(e=new Audio),e),"element"),w=s((d,N,R)=>{let p=ae();if(p!==null&&d!==""&&typeof SpeechSynthesisUtterance=="function"){S();let j=At(a,N);if(a.length===0||j!==void 0){p.cancel();let _=new SpeechSynthesisUtterance(d);_.lang=N,j!==void 0&&(_.voice=j),_.rate=.95,R!==void 0&&(_.onend=_.onerror=R),p.speak(_);return}}R?.()},"speak"),x=s(()=>{n+=1,r=null,e!==null&&(e.pause(),e.currentTime=0),ae()?.cancel()},"stop"),I=s(d=>{for(let N of d){let R=He(N);if(i.has(R))continue;let p=new Audio;p.preload="auto",p.src=N,i.set(R,p)}},"warmClips");return{say(d){let N=d.url!==null?He(d.url):`tts:${d.lang}:${d.text}`;if(N===r)return;r=N,n+=1;let R=n,p=d.onEnd,j=p!==void 0?()=>{R===n&&p()}:void 0;if(ae()?.cancel(),d.url!==null){let _=h();_.pause(),_.muted=!1,_.src=d.url,_.currentTime=0,_.onended=j??null,_.play()?.catch(A=>{R===n&&A?.name!=="AbortError"&&(d.speech?w(d.text,d.lang,j):j?.())});return}d.speech?w(d.text,d.lang,j):j?.()},unlock({lang:d,speech:N,prefetch:R}){let p=h();if(t===null&&typeof Blob=="function"&&typeof URL.createObjectURL=="function"){let A=Uint8Array.from(atob(jn),q=>q.charCodeAt(0));t=URL.createObjectURL(new Blob([A],{type:"audio/wav"}))}let j=p.paused===!1&&t!==null&&p.src!==t;t!==null&&!j&&(p.muted=!0,p.onended=null,p.src=t,p.play()?.catch(()=>{}));let _=ae();if(N&&_!==null&&typeof SpeechSynthesisUtterance=="function"){S();let A=new SpeechSynthesisUtterance(" ");A.volume=0,A.lang=d,_.speak(A)}I(R??[])},prefetch:I,stop:x,dispose(){x(),u&&ae()?.removeEventListener?.("voiceschanged",l),u=!1,t!==null&&URL.revokeObjectURL(t),t=null,e!==null&&xt(e),e=null;for(let d of i.values())xt(d);i.clear()}}}o($r,"_n");s($r,"createVoicePlayer");var Pn="sekyro.voiceGuidance";function Gr(e){try{if(typeof window>"u")return null;let t=window.localStorage.getItem(e);return t==="1"?!0:t==="0"?!1:null}catch{return null}}o(Gr,"xn");s(Gr,"readVoicePreference");function Kr(e,t){try{if(typeof window>"u")return;window.localStorage.setItem(e,t?"1":"0")}catch{}}o(Kr,"En");s(Kr,"writeVoicePreference");var Ve="capture.tips.summary",Tn=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 i=a===Ve?null:je(e,a,t);i===null||n.has(He(i))||(n.add(He(i)),r.push(i))}return r}o(rt,"ht");s(rt,"resolvedClipUrls");function zr({locale:e,defaultClips:t,options:n}){let r=n===!1,a=r?{}:n??{},i=a.storageKey===void 0?Pn:a.storageKey,[l,u]=(0,C.useState)(a.defaultEnabled??!0),S=(0,C.useRef)(l),[h,w]=(0,C.useState)(!1),[x,I]=(0,C.useState)("none"),[d,N]=(0,C.useState)(!1),R=(0,C.useRef)(!1),[p,j]=(0,C.useState)(0),_=(0,C.useRef)(null),A=(0,C.useCallback)(()=>(_.current??(_.current=$r()),_.current),[]),q=On[e],F=a.speechFallback,f=F===void 0||F===!0?!0:F===!1?!1:F.includes(e),G=a.clips??t??Bn,ie=(0,C.useRef)(!1),le=(0,C.useRef)(G);Tn(()=>{le.current=G,S.current=l}),(0,C.useEffect)(()=>{if(r||i===null)return;let L=Gr(i);L!==null&&(S.current=L,u(L))},[r,i]),(0,C.useEffect)(()=>{if(!(r||!f))return Fr(()=>j(L=>L+1))},[r,f]);let c=a.clips;(0,C.useEffect)(()=>{if(r)return;let L=f&&Dr(q);w(rt(G,e).length>0||L),I(c!==void 0&&je(c,Ve,e)!==null?"partner":je(G,Ve,e)!==null||L?"default":"none")},[r,G,c,e,f,q,p]),(0,C.useEffect)(()=>{if(r||!l||!ie.current)return;let L=rt(G,e);L.length>0&&A().prefetch(L)},[r,l,G,e,A]),(0,C.useEffect)(()=>()=>{_.current?.dispose(),_.current=null,ie.current=!1},[]);let V=(0,C.useCallback)(L=>{r||(ie.current=!0,A().unlock({lang:q,speech:f,...L?{prefetch:rt(le.current,e)}:{}}))},[r,A,q,f,e]),O=(0,C.useCallback)(()=>V(S.current),[V]),K=(0,C.useCallback)(()=>{R.current=!1,N(!1)},[]),T=(0,C.useCallback)(()=>{K(),_.current?.stop()},[K]),ve=(0,C.useCallback)(()=>{R.current&&T()},[T]),he=(0,C.useCallback)((L,xe)=>{if(r)return;if(R.current){T();return}let ge=A();ge.stop(),R.current=!0,N(!0);let P=xe?.clip===!1?null:je(le.current,Ve,e);ge.say({url:P,text:L,lang:q,speech:f,onEnd:K})},[r,T,A,e,q,f,K]),z=(0,C.useCallback)(L=>{r||(L?V(!0):T(),i!==null&&Kr(i,L),S.current=L,u(L))},[r,V,T,i]),Z=(0,C.useCallback)(()=>z(!S.current),[z]),te=(0,C.useCallback)((L,xe)=>{if(r||!l)return;R.current&&K();let ge=je(le.current,L,e);A().say({url:ge,text:xe,lang:q,speech:f})},[r,l,e,A,q,f,K]);return(0,C.useMemo)(()=>({supported:!r&&h,enabled:!r&&l,setEnabled:z,toggle:Z,unlock:O,speakKey:te,stop:T,summary:r?"none":x,summaryPlaying:d,toggleSummary:he,stopSummary:ve}),[r,h,l,z,Z,O,te,T,x,d,he,ve])}o(zr,"vt");s(zr,"useVoiceGuidance");function Zr(e,t,n,r){let{speakKey:a,stop:i,enabled:l}=e,u=(0,C.useRef)(!1);(0,C.useEffect)(()=>{if(!r||!l){u.current&&i(),u.current=!1;return}u.current=!0,st(t)&&t!==Ve&&n!==""&&a(t,n)},[r,l,t,n,a,i])}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,"An");s(ot,"retryCoachingOf");var De={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 Qr({showCoaching:e,coaching:t="face",attemptsText:n,showRetake:r,onRetake:a}){let i=Le(),l=(0,at.useRef)(null);return(0,at.useEffect)(()=>{r&&l.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:i(De[t].title)}),(0,fe.jsx)("ul",{className:"sekyro-coaching",children:De[t].tips.map(u=>(0,fe.jsx)("li",{children:i(u)},u))}),n!==null?(0,fe.jsx)("p",{className:"sekyro-text-muted","data-testid":"sekyro-attempts-remaining",children:n}):null]}):null,r?(0,fe.jsx)(X,{ref:l,className:"sekyro-btn--start",onClick:a,children:i("capture.recordAgain")}):null]})}o(Qr,"Tn");s(Qr,"CapturedPanel");function Et(){try{return!1}catch{return!1}}o(Et,"nt");s(Et,"isDevBuild");var qn=(0,Wr.createContext)(null);function Yr({state:e}){let t=Le(),[n,r]=(0,it.useState)(!1);(0,it.useEffect)(()=>{e!=="unknown"&&r(!0)},[e]);let a=e==="granted"?(0,we.jsx)(Ur,{}):e==="denied"?(0,we.jsx)(Or,{}):(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(Yr,"On");s(Yr,"PermissionRow");function Jr({voice:e}){let t=Le();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)(Pr,{className:"sekyro-switch__check"}):null})})]})}o(Jr,"Hn");s(Jr,"VoiceSwitch");function Xr({assets:e,onRetryAssets:t,permission:n,captureMode:r="self",voice:a,tips:i,summary:l,startLabel:u,startDisabled:S,onStart:h}){let w=Le(),x=(0,Y.useRef)(l?.stop);x.current=l?.stop,(0,Y.useEffect)(()=>()=>x.current?.(),[]);let I=(0,Y.useRef)(null),d=(0,Y.useRef)(null),N=(0,Y.useRef)(null),R=(0,Y.useRef)(e),p=(0,Y.useRef)(!1);(0,Y.useEffect)(()=>{let f=R.current;if(R.current=e,f===e)return;let G=p.current;e!=="loading"&&(p.current=!1),en(I.current)&&(e==="failed"?N.current?.focus():G&&d.current?.focus())},[e]);let j=(0,Y.useCallback)(()=>{p.current=!0,t()},[t]),_=e==="loading",A=_||S,q=(0,Y.useCallback)(()=>{A||(x.current?.(),h())},[A,h]),F;return e==="failed"?F=(0,U.jsxs)(se,{tone:"danger",testId:"sekyro-assets-error",children:[(0,U.jsx)("p",{className:"sekyro-text-body",children:w("fcv2.err.models")}),(0,U.jsx)(X,{kind:"ghost",ref:N,className:"sekyro-btn--start",onClick:j,"data-testid":"sekyro-assets-retry",children:w("common.retry")})]}):F=(0,U.jsxs)("div",{className:"sekyro-stack sekyro-stack--1",children:[(0,U.jsx)(X,{ref:d,full:!0,"data-testid":"sekyro-start","aria-disabled":A?"true":void 0,"aria-busy":_?"true":void 0,onClick:q,children:_?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(Tr,{}),w("capture.preparing.title")]}):u??w("capture.start")}),_?(0,U.jsx)("p",{className:"sekyro-text-muted",children:w("capture.preparing.hint")}):null]}),(0,U.jsxs)("div",{ref:I,className:"sekyro-stack sekyro-stack--4","data-testid":"sekyro-intro","data-assets":e,children:[r==="assisted"?(0,U.jsxs)("div",{className:"sekyro-stack sekyro-stack--1","data-testid":"sekyro-assisted-intro",children:[(0,U.jsx)("h2",{className:"sekyro-text-body",children:w("capture.assisted.title")}),(0,U.jsx)("p",{className:"sekyro-text-muted",children:w("capture.assisted.lead")})]}):null,i!==!1?(0,U.jsx)(Br,{tips:i}):null,l!==void 0?(0,U.jsxs)(X,{kind:"ghost",className:"sekyro-btn--start",onClick:l.toggle,"data-testid":"sekyro-tips-listen",children:[(0,U.jsx)(nt,{off:!1}),w(l.playing?"capture.tips.stop":"capture.tips.listen")]}):null,(0,U.jsx)(Yr,{state:n}),(0,U.jsx)(Jr,{voice:a}),(0,U.jsx)("p",{className:"sekyro-text-muted",children:w("capture.securityNote")}),F,(0,U.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,lt.useState)({state:"unknown",settled:!1});return(0,lt.useEffect)(()=>ir(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 i=!0;return r({required:!1,settled:!1}),Promise.resolve().then(()=>a.call(e)).then(l=>{i&&r({required:l===!0,settled:!0})},()=>{i&&r({required:!1,settled:!0})}),()=>{i=!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 i=e?.captureMode,l=e?.captureChoice??null;if(e===void 0||typeof i!="function"){r({session:"self",choice:l,settled:!0});return}let u=!0;return r({session:"self",choice:l,settled:!1}),Promise.resolve().then(()=>i.call(e)).then(S=>{let h=e.captureChoice??null;u&&r({session:h!==null&&S===h?"choice":S==="assisted"||S==="choice"?S:"self",choice:h,settled:!0})},()=>{u&&r({session:"self",choice:null,settled:!0})}),()=>{u=!1}},[e]);let a=(0,pe.useCallback)(i=>{e?.chooseCaptureMode?.(i),r(l=>({...l,choice:i}))},[e]);return{mode:n.session==="choice"?n.choice??"self":n.session==="assisted"?"assisted":"self",session:n.session,choice:n.choice,settled:n.settled,choose: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 lr(e!==void 0?{assetBaseUrl:e}:{})}o(Nt,"Qn");s(Nt,"preload");function on(e,t=!0){let n=(0,Q.useSyncExternalStore)((0,Q.useCallback)(h=>ur(h,e),[e]),()=>cr(e),Vn),[r,a]=(0,Q.useState)(null),i=(0,Q.useRef)(!1),l=(0,Q.useCallback)(()=>{Nt(e).then(h=>{i.current&&h==="idle"&&a({base:e})})},[e]);(0,Q.useEffect)(()=>(i.current=!0,l(),()=>{i.current=!1}),[l]);let u=(0,Q.useRef)(null);(0,Q.useEffect)(()=>{if(n!=="idle"){u.current={base:e};return}!t||u.current===null||u.current.base!==e||(u.current=null,l())},[n,e,l,t]);let S=(0,Q.useCallback)(()=>{Nt(e)},[e]);return{gate:r!==null&&r.base===e&&n==="idle"||n==="ready"?"ready":n==="failed"?"failed":"loading",retry:S}}o(on,"Jn");s(on,"useLivenessAssets");var Mr={progress:0,hint:null,faceDetected:!1};function ln(e){let{videoRef:t,assetBaseUrl:n}=e,r=(0,M.useRef)(e.verification).current,a=(0,M.useRef)(!1);e.verification!==r&&!a.current&&Et()&&(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 i=(0,M.useRef)(null),[l,u]=(0,M.useState)("idle"),[S,h]=(0,M.useState)(Mr),[w,x]=(0,M.useState)(!1),[I,d]=(0,M.useState)(!1),[N,R]=(0,M.useState)(null),[p,j]=(0,M.useState)(!1),[_,A]=(0,M.useState)(null),[q,F]=(0,M.useState)(null),[f,G]=(0,M.useState)(null),[ie,le]=(0,M.useState)(null),[c,V]=(0,M.useState)(null),[O,K]=(0,M.useState)(!1),T=(0,M.useRef)(null),ve=(0,M.useRef)("idle"),he=(0,M.useRef)(-1),[z,Z]=(0,M.useState)(0),te=(0,M.useRef)(e);te.current=e,(0,M.useEffect)(()=>{let J=t.current;if(J===null)return;let ce={video:J,...n!==void 0?{assetBaseUrl:n}:{}},H=r!==void 0?r.liveness(ce):dr(ce);i.current=H;let Ne=s(()=>V(H.facingMode??null),"readFacing");Ne();let Fe=[H.on("state",b=>{b==="mode_switch"?K(!0):b!=="starting"&&b!=="gating"&&K(!1),b==="starting"?(ve.current!=="starting"&&(he.current+=1,Z(Math.max(0,he.current))),F(null),G(null),h(Mr),d(!1),x(!1),R(null),A(null),T.current=null):b==="gating"&&ve.current==="recording"&&(d(!1),x(!1),R(null),T.current=null),ve.current=b,Ne(),u(b),te.current.onStateChange?.(b)}),H.on("gate",b=>{let ke=T.current;T.current=b.progress,x(ke!==null&&b.progress<ke-.001&&b.progress>0&&b.progress<1),b.progress>=1&&d(!0),h(b)}),H.on("frozen",({previewDataUrl:b})=>R(b)),H.on("profile",({animations:b})=>j(b==="reduced")),H.on("ramp",({colour:b})=>A(b)),H.on("captured",b=>{F(b),le(null),te.current.onCaptured?.(b)}),H.on("error",b=>{G(b);let ke=r?.reportCaptureIssue;ke!==void 0&&Ct(Ee=>ke.call(r,Ee),xr("liveness",b,Math.max(0,he.current))),te.current.onError?.(b)}),r?.on("result",b=>{le(b),te.current.onResult?.(b)})];return()=>{for(let b of Fe)b?.();i.current=null,H.destroy()}},[r,t,n]);let L=(0,M.useCallback)(()=>{i.current?.start()},[]),xe=(0,M.useCallback)(()=>{i.current?.retry()},[]),ge=(0,M.useCallback)(async()=>{let J=i.current;return J===null||typeof J.canSwitchCaptureMode!="function"?!1:await J.canSwitchCaptureMode().catch(()=>!1)===!0},[]),P=(0,M.useCallback)(async J=>{let ce=i.current;if(ce===null||typeof ce.setCaptureMode!="function")return!1;let H=await ce.setCaptureMode(J).catch(()=>!1)===!0;return H&&V(ce.facingMode??null),H},[]);return{state:l,gate:S,draining:w,gateLocked:I,frozenPreview:N,reduceMotion:p,rampColour:_,artifacts:q,error:f,result:ie,facingMode:c,start:L,retry:xe,canSwitchCaptureMode:ge,setCaptureMode:P,modeRestarted:O,attempt:z}}o(ln,"er");s(ln,"useLivenessHandle");var Hn=new Set(["national_number"]);function Mt(e){if(e==null||!e.available||e.selected!==null)return null;let t=e.options.filter(n=>Hn.has(n));return t.length>0?{...e,options:t}:null}o(Mt,"tr");s(Mt,"pending");function cn(e){let[t,n]=(0,me.useState)(null),[r,a]=(0,me.useState)(e===void 0),[i,l]=(0,me.useState)(!1),[u,S]=(0,me.useState)(!1);(0,me.useEffect)(()=>{if(n(null),e===void 0){a(!0);return}let x=!0,I=e.methodChoice;typeof I=="function"?(a(!1),Promise.resolve().then(()=>I.call(e)).then(N=>{x&&n(Mt(N))},()=>{}).finally(()=>{x&&a(!0)})):a(!0);let d=e.on("method",N=>n(Mt(N)));return()=>{x=!1,d()}},[e]);let h=(0,me.useCallback)(async x=>{if(e===void 0)return!1;l(!0),S(!1);try{return await e.selectMethod(x),n(null),!0}catch{return S(!0),!1}finally{l(!1)}},[e]),w=t!==null&&t.options.length===1?t.options[0]:null;return{choice:t,auto:w==="national_number"&&!u?w:null,settled:r,busy:i,failed:u,select:h}}o(cn,"nr");s(cn,"useMethodChoice");var Dn=["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 Dn){let a=t[r];if(!(typeof a!="object"||a===null))for(let[i,l]of Object.entries(a))!st(i)||!un(l)||((n[r]??(n[r]={}))[i]=l)}return Object.keys(n).length>0?n:null}o(dn,"io");s(dn,"toVoiceClipMap");function pn(e){let[t,n]=(0,Oe.useState)(null);(0,Oe.useEffect)(()=>{if(n(null),e===void 0)return;let a=!0,i=s(u=>{if(!a)return;let S=typeof u=="object"&&u!==null&&typeof u.setId=="string"?u:null;n(h=>h?.setId===S?.setId?h:S)},"take");try{typeof e.voiceClips=="function"&&Promise.resolve(e.voiceClips()).then(i,()=>i(null))}catch{i(null)}let l=e.on("view",u=>i(u.voice));return()=>{a=!1,l()}},[e]);let r=(0,Oe.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=Le();return(0,Rt.jsx)(X,{kind:"chip","aria-pressed":e.enabled,"aria-label":t("capture.voiceGuidance"),"data-testid":"sekyro-voice-toggle",onClick:o(()=>e.toggle(),"onClick"),children:(0,Rt.jsx)(nt,{off:!e.enabled,className:"sekyro-icon"})})}o(hn,"sr");s(hn,"VoiceChip");var Fn=new Set(["abandoned","not_opened","cancelled","superseded"]),$n=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,y.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 vn(e){return e==="starting"||e==="gating"||e==="recording"||e==="mode_switch"}o(vn,"ho");s(vn,"isCapturing");function gn(e){return e==="captured"||e==="uploading"||e==="checking"}o(gn,"vo");s(gn,"isPostCapture");function zn({verification:e,locale:t,dir:n,strings:r,slots:a,autoStart:i=!1,notice:l,startDisabled:u=!1,startLabel:S,tips:h,tipsSummary:w,coach:x,voice:I,onGuidance:d,onCaptured:N,onResult:R,onError:p,onStateChange:j,assetBaseUrl:_,className:A}){let q=vr(t),F=(0,y.useMemo)(()=>yr(t,r),[t,r,q]),f=(0,y.useMemo)(()=>g=>F[g]??"",[F]),G=n??(t==="ar"?"rtl":"ltr"),ie=(0,y.useRef)(null),le=(0,y.useContext)(qn),c=ln({verification:e,videoRef:ie,assetBaseUrl:_,onCaptured:N,onResult:R,onError:p,onStateChange:j}),V=on(_,c.state==="idle"&&c.error===null),O=cn(e),K=O.choice!==null,T=rn(e),ve=nn(e),he=an(e),z=tn(),Z=sn(e),te=Z.session==="choice",L=Z.mode==="assisted",xe=I!==!1&&I?.clips===void 0,ge=pn(xe?e:void 0),P=zr({locale:t,defaultClips:ge,options:I}),J=L?"environment":"user",ce=Z.settled,H=(0,y.useRef)(null),Ne=(0,y.useRef)(!1),Fe=(0,y.useRef)(P.unlock);Fe.current=P.unlock,(0,y.useEffect)(()=>{let g=H.current;if(g===null)return;let ne=["pointerup","touchend","click","keydown"],_e=s(()=>{for(let qe of ne)g.removeEventListener(qe,Re,!0)},"disarm");function Re(qe){if(Ne.current){_e();return}mn(qe)&&(Ne.current=!0,_e(),Fe.current())}o(Re,"Re"),s(Re,"onGesture");for(let qe of ne)g.addEventListener(qe,Re,{capture:!0,passive:!0});return _e},[]);let b=(0,y.useCallback)(()=>{Ne.current||(Ne.current=!0,P.unlock()),c.start()},[P.unlock,c.start]),ke=(0,y.useCallback)(()=>c.start(),[c.start]),Ee=(0,y.useRef)(!1),Pe=c.state==="idle"&&c.error===null,jt=!K&&!T.required&&(i===!0||i==="when-permitted"&&z.permission==="granted"),Ot=jt&&O.settled&&T.settled&&ce,Cn=i==="when-permitted"&&!z.permissionSettled&&!Ee.current,Pt=jt&&Pe&&!Ee.current,ut=(Cn||Pt||!ce)&&V.gate==="ready"?"loading":V.gate;(0,y.useEffect)(()=>{!Ot||!Pe||V.gate!=="ready"||Ee.current||(Ee.current=!0,ke())},[Ot,Pe,V.gate,ke]);let _n=Pe&&!K&&!T.required&&!(Pt&&V.gate==="ready"),[Tt,Bt]=(0,y.useState)(!1),{canSwitchCaptureMode:qt,setCaptureMode:Vt}=c;(0,y.useEffect)(()=>{if(!Z.settled||!te){Bt(!1);return}let g=!0;return qt().then(ne=>{g&&Bt(ne)}),()=>{g=!1}},[Z.settled,te,qt]);let{choose:Ht}=Z,Ie=L?"self":"assisted",wn=(0,y.useCallback)(async()=>{await Vt(Ie)&&Ht(Ie)},[Vt,Ht,Ie]),Dt=c.state!=="idle"&&c.facingMode!==null?c.facingMode:J;(0,y.useEffect)(()=>{let g=ie.current?.style;Dt==="user"?g?.removeProperty("transform"):g&&(g.transform="none")},[Dt]);let $e=(0,y.useMemo)(()=>c.artifacts!==null&&typeof URL.createObjectURL=="function"?URL.createObjectURL(c.artifacts.keyframe):null,[c.artifacts]);(0,y.useEffect)(()=>{if($e!==null)return()=>URL.revokeObjectURL($e)},[$e]);let Ft=c.frozenPreview??$e,Ue=e!==void 0,$=vn(c.state),be=gn(c.state),Ge=$||be,re=c.result,$t=c.state==="done"&&re!==null,Ke=$&&c.rampColour!==null,dt=c.state==="recording"&&c.frozenPreview!==null&&!Ke,ze=le!==null,Gt=Tt&&$&&!dt?{to:Ie,label:f(Ie==="assisted"?"capture.modeSwitch.toAssisted":"capture.modeSwitch.toSelf"),description:f(Ie==="assisted"?"capture.modeSwitch.toAssistedLabel":"capture.modeSwitch.toSelfLabel"),onSwitch:s(()=>{wn()},"onSwitch")}:null,Ze=c.modeRestarted&&$?f("capture.modeSwitch.restarted"):null,Te=be||dt,Kt=be?"checking":dt?"frozen":c.state==="recording"||Ke?"recording":c.gateLocked||c.gate.progress>=1?"locked":c.gate.faceDetected?"aligning":"seeking",Qe=$?c.gate.hint:null,We=c.state==="starting"?"capture.preparing.title":Qe===null?null:Qe==="center"&&!c.gate.faceDetected?"fcv3.no_face":pr(Qe),[Sn,zt]=(0,y.useState)(null);(0,y.useEffect)(()=>{if(We!=="fcv3.no_face"){zt(We);return}if(!$)return;let g=setTimeout(()=>zt(We),$n);return()=>clearTimeout(g)},[We,$]);let pt=$&&!Ke&&typeof x=="string"&&x!=="",Zt=L&&$?f("capture.assisted.stage"):null,Me=$&&!pt?Ke?Gn:Sn:null,ht=pt?x:Me===null?"":f(Me);Zr(P,Me,ht,$);let Qt=(0,y.useRef)(d);Qt.current=d,(0,y.useEffect)(()=>{if(st(Me))try{Qt.current?.(Me)}catch(g){console.error("[@sekyro/react] onGuidance threw:",g)}},[Me]);let Be=(0,y.useMemo)(()=>({supported:P.supported,enabled:P.enabled,setEnabled:P.setEnabled,toggle:P.toggle}),[P.supported,P.enabled,P.setEnabled,P.toggle]),ft=a?.voicePrompt,Wt=ft!==void 0,Yt=I===void 0,Jt=(0,y.useRef)(!1);(0,y.useEffect)(()=>{!Wt||!Yt||Jt.current||!Et()||(Jt.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,Yt]);let xn=ft!==void 0?(g,ne,_e)=>ft(g,ne,_e,Be):P.supported?()=>(0,k.jsx)(hn,{voice:Be}):void 0,{summary:mt,summaryPlaying:Xt,toggleSummary:er,stopSummary:tr}=P,Ye=w!==void 0&&w!=="",rr=Ye?w:f("capture.tips.summary"),nr=Ye?mt!=="none":mt==="partner"||mt==="default"&&fn(h),Nn=(0,y.useMemo)(()=>nr?{playing:Xt,toggle:s(()=>er(rr,{clip:!Ye}),"toggle"),stop:tr}:void 0,[nr,Xt,er,rr,tr,Ye]),Mn=(0,y.useMemo)(()=>({assets:ut,retryAssets:V.retry,permission:z.permission,permissionSettled:z.permissionSettled,captureMode:Z.mode,facing:J,voice:Be}),[ut,V.retry,z.permission,z.permissionSettled,Z.mode,J,Be]),Rn=yn(l)?(0,k.jsx)(se,{tone:l.tone,testId:"sekyro-host-notice",children:(0,k.jsx)("span",{children:l.text})}):l??null,ue=re!==null&&re.status==="retry"?re:null,W=$t&&re.status==="unavailable"&&!K&&re.reasonCode!=="portrait_required"?re:null,Ce=$t&&(re.status==="verified"||re.status==="not_verified"||re.status==="review")?re:null,yt=s((g,ne)=>{if(g===void 0)return null;if(g==="device_cooldown"){let Re=fr(t,ne);if(Re!==null)return f(Re.key).replace("{time}",Re.time)}let _e=et(g);return _e===null?null:f(_e)},"reasonText"),vt=s(g=>{let ne=g.retakeHint===void 0?null:Xe(g.retakeHint);return ne===null?yt(g.reasonCode):f(ne)},"retryText"),sr=Ce===null?null:yt(Ce.reasonCode,Ce.retryAfter)??(Ce.status==="not_verified"&&Ce.reason!==void 0&&Fn.has(Ce.reason)?f("errors.session_expired"):null),Ln=W!==null&&W.reasonCode!==void 0&&W.reasonCode!=="nni_unbound"&&W.reasonCode!=="id_number_unbound"&&W.reasonCode!=="method_required"&&W.reasonCode!=="mobile_required"&&!(W.reasonCode==="no_recorder"&&c.artifacts?.degraded==="NO_RECORDER"),Je=W?.reasonCode,ar=c.attempt;(0,y.useEffect)(()=>{W===null||Je===void 0||e?.reportCaptureIssue===void 0||Kn.has(Je)||Ct(g=>e.reportCaptureIssue?.(g),{check:"liveness",kind:"unavailable",phase:"upload",engineKind:Je,attempt:Math.min(1e3,ar)})},[W,Je,ar,e]);let or=bt(),An=K&&O.auto===null&&!$&&!be&&c.error===null,gt=(0,y.useCallback)(async g=>{await O.select(g)&&c.state==="done"&&c.retry()},[O.select,c.state,c.retry]);return(0,y.useEffect)(()=>{O.auto!==null&&!O.busy&&!$&&!be&&gt(O.auto)},[O.auto,O.busy,$,be,gt]),(0,k.jsx)(gr,{value:f,children:(0,k.jsxs)("div",{ref:H,className:A===void 0?"sekyro-capture":`sekyro-capture ${A}`,dir:G,lang:t,"data-testid":"sekyro-liveness-capture","data-state":c.state,children:[a?.header,ue!==null&&vt(ue)!==null&&!(ze&&Ge)?(0,k.jsx)(se,{tone:"warning",role:"status",testId:"sekyro-retry-notice",children:(0,k.jsx)("span",{children:vt(ue)})}):null,Ze!==null&&!ze?(0,k.jsx)(se,{tone:"info",role:"status",testId:"sekyro-mode-switch-status",children:(0,k.jsx)("span",{children:Ze})}):null,he&&be&&!ze?(0,k.jsx)(se,{tone:"info",role:"status",testId:"sekyro-busy-notice",children:(0,k.jsx)("span",{children:f("capture.busy")})}):null,T.required&&Pe?(0,k.jsx)(se,{tone:"info",role:"status",testId:"sekyro-mobile-required",children:(0,k.jsx)("span",{children:f("reasons.mobile_required")})}):null,c.error!==null?a?.errorPanel!==void 0?a.errorPanel(c.error,c.retry):(0,k.jsxs)(se,{tone:"danger",testId:"sekyro-error-notice",children:[(0,k.jsx)("span",{children:f(hr(c.error))}),c.error.retryable?(0,k.jsx)(X,{ref:or,kind:"ghost",className:"sekyro-btn--start",onClick:c.retry,children:f("common.retry")}):null]}):null,W!==null?(0,k.jsxs)(se,{tone:"danger",testId:"sekyro-unavailable-notice",children:[(0,k.jsx)("span",{children:yt(W.reasonCode)??f(W.reasonCode===void 0?"errors.session_expired":"errors.network_error")}),Ln?(0,k.jsx)(X,{ref:or,kind:"ghost",className:"sekyro-btn--start",onClick:c.retry,children:f("capture.recordAgain")}):null]}):null,sr!==null&&Ce!==null?(0,k.jsx)(se,{tone:Ce.status==="not_verified"?"danger":"info",testId:"sekyro-result-notice",children:(0,k.jsx)("span",{children:sr})}):null,(0,k.jsx)("div",{className:Ge?void 0:"sekyro-hidden","data-capture-live":Ge?"":void 0,children:ze?le({videoRef:ie,guidance:Te&&Ue?f("capture.checking"):ht,coached:pt&&!(Te&&Ue),note:Te?Ue?f(he?"capture.busy":"capture.checkingHint"):null:Ze??(ue!==null?vt(ue):Zt),settled:Te&&Ue,progress:c.gate.progress,phase:Kt,still:Te?Ft:null,live:Ge,modeSwitch:Gt,...Tt?{status:Ze}:{},ramp:c.rampColour===null?null:{colour:c.rampColour}}):(0,k.jsx)(kr,{videoRef:ie,guidanceText:ht,guidanceHint:Qe,guidanceKey:Me,progress:c.gate.progress,phase:Kt,draining:c.draining,stillUrl:Ft,showChecking:Ue,operatorText:Zt,voicePrompt:xn,overlay:o(g=>(0,k.jsxs)(k.Fragment,{children:[a?.stageOverlay?.(g),(0,k.jsx)(br,{colour:c.rampColour})]}),"overlay"),reduceMotion:c.reduceMotion,modeSwitch:Gt})}),An&&O.choice!==null?(0,k.jsx)(qr,{title:f("method.title"),description:f("method.description"),options:O.choice.options.map(g=>({id:g,label:f(`method.${g}`)})),busy:O.busy,error:O.failed?f("errors.network_error"):null,focus:c.state==="done",testId:"sekyro-method",look:"buttons",onChoose:o(g=>{gt(g)},"onChoose")}):null,_n?(0,k.jsxs)(k.Fragment,{children:[ve&&a?.header===void 0&&a?.intro===void 0?(0,k.jsxs)("div",{className:"sekyro-stack sekyro-stack--1",children:[(0,k.jsx)("h2",{className:"sekyro-text-body",children:f("returning.title")}),(0,k.jsx)("p",{className:"sekyro-text-muted",children:f("returning.description")})]}):null,Rn,a?.intro!==void 0?a.intro(b,Mn):(0,k.jsx)(Xr,{assets:ut,onRetryAssets:V.retry,permission:z.permission,captureMode:Z.mode,voice:Be,tips:h??wt,summary:Nn,startLabel:S,startDisabled:u,onStart:b})]}):null,(0,k.jsx)(Qr,{showCoaching:ue!==null,coaching:ot(ue?.reasonCode),attemptsText:ue?.attemptsRemaining!==void 0?mr(F,t,ue.attemptsRemaining):null,showRetake:ue!==null&&!$&&!be||!Ue&&c.state==="captured",onRetake:c.retry}),a?.footer]})})}o(zn,"xi");s(zn,"LivenessCapture");var Ut=E(D(),1),ct=E(D(),1),m=E(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 Qn(e,t){let[n,r]=(0,Ut.useState)(!1),[a,i]=(0,Ut.useState)(null);return{busy:n,error:a,run:s(l=>{r(!0),i(null),l().then(()=>r(!1),u=>{r(!1),i(e.t(Nr(u,e.strings))),t?.(u)})},"run")}}o(Qn,"q");s(Qn,"useChoiceAction");function kn(){let e=`sekyro-face-light-${(0,ct.useId)().replace(/[^A-Za-z0-9_-]/g,"")}`;return(0,m.jsxs)("svg",{className:"sekyro-mark sekyro-mark--face",viewBox:"0 0 168 206","aria-hidden":"true",focusable:"false",children:[(0,m.jsx)("defs",{children:(0,m.jsx)("mask",{id:e,children:(0,m.jsx)("ellipse",{className:"sekyro-mark__arc",cx:"84",cy:"103",rx:"76",ry:"95",pathLength:"1",fill:"none",stroke:"#fff",strokeWidth:"16"})})}),(0,m.jsx)("ellipse",{cx:"84",cy:"103",rx:"64",ry:"83",fill:"none",className:"sekyro-mark__line"}),(0,m.jsx)("path",{className:"sekyro-mark__face",d:"M68 64v10M100 64v10M84 66v25q0 2-6 1M60 108q24 18 48 0"}),(0,m.jsx)("ellipse",{className:"sekyro-mark__ticks",cx:"84",cy:"103",rx:"76",ry:"95",pathLength:"56"}),(0,m.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 Yn(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(Yn,"te");s(Yn,"faceIntroRetryOf");var Jn={"capture.retryFrontCamera.screenSide":"camera","capture.retryBackCamera.backSide":"camera","capture.retryUpright.vertical":"smartphone","capture.retryUpright.untilEnd":"smartphone","capture.retryRecording.cameraOn":"camera","capture.retryRecording.stay":"smartphone","capture.retryRecording.network":"smartphone","capture.retryDevice.screenRecording":"smartphone","capture.retryDevice.phone":"smartphone"};function Xn({start:e,context:t,tips:n,tipsTitle:r,human:a=!1,returning:i=!1,notice:l,retry:u}){let S=_t(),{t:h}=S,w=u===void 0?"face":ot(u.reason),x=w==="face"?null:De[w].tips,I=(0,ct.useContext)(_r)?.busy===!0;return(0,m.jsxs)("section",{className:"sekyro-step",children:[(0,m.jsx)(kn,{}),t.captureMode==="assisted"?(0,m.jsx)(tt,{title:h("capture.assisted.heading"),lead:h("capture.assisted.lead")}):i?(0,m.jsx)(tt,{title:h("returning.heading"),lead:h("returning.description")}):(0,m.jsx)(tt,{title:h(a?"native.face.humanIntroTitle":"native.face.introTitle"),lead:h(a?"native.face.humanIntroLead":"native.face.introLead")}),u!==void 0?(0,m.jsx)(bn,{retry:u,title:De[w].title}):null,r!==void 0&&x===null?(0,m.jsx)("p",{className:"sekyro-section-label",children:r}):null,(0,m.jsx)("ul",{className:"sekyro-tiprows",children:x!==null?x.map(d=>(0,m.jsxs)("li",{children:[(0,m.jsx)(Ae,{name:Jn[d]??"face"}),h(d)]},d)):n!==void 0?n.map(d=>(0,m.jsxs)("li",{children:[(0,m.jsx)(Ae,{name:Wn[d.id]??"face"}),d.text]},d.id)):(0,m.jsxs)(m.Fragment,{children:[(0,m.jsxs)("li",{children:[(0,m.jsx)(Ae,{name:"light"}),h("capture.tips.light")]}),(0,m.jsxs)("li",{children:[(0,m.jsx)(Ae,{name:"jGlasses"}),h("capture.tips.uncover")]}),(0,m.jsxs)("li",{children:[(0,m.jsx)(Ae,{name:"smartphone"}),h("capture.tips.eyeLevel")]})]})}),l??null,l!==void 0?null:t.assets==="failed"?(0,m.jsx)(X,{kind:"secondary",full:!0,onClick:t.retryAssets,children:h("common.retry")}):null,l!==void 0?null:(0,m.jsx)(Cr,{children:(0,m.jsxs)(X,{full:!0,disabled:t.assets!=="ready"||I,"aria-busy":t.assets==="loading"||void 0,onClick:e,children:[(0,m.jsx)(Ae,{name:"camera"}),h("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,m.jsxs)(wr,{tone:"warning",children:[r!==null?(0,m.jsx)("span",{children:n.t(r)}):a!==null?(0,m.jsx)("span",{children:n.t(a)}):null,r===null?(0,m.jsx)("span",{children:n.t(t)}):null,(0,m.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,Et as b,qn as c,sn as d,zn as e,Cs as f,Zn as g,Qn as h,Yn as i,Xn as j,ts as k,rs as l};
@@ -0,0 +1 @@
1
+ import{a as U,c as N}from"./chunk-PJ2UDPYO.js";import{b as D}from"./chunk-CW56KMMH.js";import{a as s}from"./chunk-4FHWXBOB.js";var g,y=(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)}},s(g,"c"),g);function R(e,t,n=Math.random){let i=(e??t)*1e3,r=Math.min(Math.max(i,500),2e4),a=Math.round(r*(1+(n()*2-1)*.25));return Math.min(Math.max(a,500),2e4)}s(R,"_");var ne=6e4,G=4,ie=3e4,se=9e5,re=200,ae=5,oe=400,ce=new Set(["server_busy","request_timeout"]),de=2;function v(e){return(e.split(";")[0]??"").trim()}s(v,"l");var ue={liveness:"clipKey",face_match:"imageKey",doc_ocr:"imageKey"},le=`@sekyro/web/${U}`,pe=le,b,Qe=(b=class{constructor(t){this.sessionId=null,this.bootstrap=null,this.captureNonces=[],this.captureFetch=null,this.reportedIssues=new Map,this.apiOrigin=t.apiOrigin.replace(/\/+$/,""),this.sessionToken=t.sessionToken;let n=t.fetch;this.fetchImpl=(i,r)=>(n??globalThis.fetch).call(globalThis,i,r),this.requestTimeoutMs=t.requestTimeoutMs??ie,this.retryAttempts=t.inProgressRetry?.attempts??ae,this.retryDelayMs=t.inProgressRetry?.delayMs??oe,this.random=t.random??Math.random}async getSession(){let t=await this.api("GET","/hosted/session");return this.sessionId=t.sessionId,t}async recordConsent(t){return this.api("POST","/hosted/consent",{body:{locale:t},busyRetry:!0})}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,r=typeof t.attempt=="number"&&Number.isInteger(t.attempt)&&t.attempt>=0&&t.attempt<=1e3?t.attempt:void 0,a=[t.check,r??"",t.kind,n,t.phase??""].join("|"),c=this.reportedIssues.get(a);if(c!==void 0)return c;let d={check:t.check,kind:t.kind,...n!==""?{name:n}:{},...t.phase!==void 0?{phase:t.phase}:{},...i!==void 0?{engineKind:i}:{},...r!==void 0?{attempt:r}:{},...t.formFactor!==void 0?{formFactor:t.formFactor}:{},...typeof t.detail=="string"&&/^\d{1,10}$/.test(t.detail)?{detail:t.detail}:{},...L(t.challengeMs)?{challengeMs:t.challengeMs}:{},...L(t.readyMs)?{readyMs:t.readyMs}:{},...t.inApp===!0?{inApp:!0}:{}},o=this.api("POST","/hosted/capture-issue",{body:d,empty:!0}).catch(()=>{this.reportedIssues.delete(a)});return this.reportedIssues.set(a,o),o}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,r={}){let a=await this.ensureSessionId(),c={kind:t,contentType:v(n),contentLength:i,...r.source==="upload"?{source:"upload"}:{}};return this.api("POST",`/sessions/${a}/media`,{body:c})}armCapture(t=2){this.fillCaptureNonces(t)}async presignCapture(t,n,i,r={}){let a=await this.ensureSessionId(),c=await this.takeCaptureNonce(),d=c===void 0?void 0:{nonce:c,...r.engine!==void 0?{engine:r.engine.slice(0,32)}:{},...r.durationMs!==void 0&&Number.isFinite(r.durationMs)?{captureMs:Math.min(36e5,Math.max(0,Math.round(r.durationMs)))}:{}},o={kind:t,contentType:v(n),contentLength:i,capture:d};return this.api("POST",`/sessions/${a}/media`,{body:o})}async takeCaptureNonce(){let t=s(()=>{let n=Date.now();return this.captureNonces=this.captureNonces.filter(i=>i.expiresAt-ne>n),this.captureNonces.shift()?.nonce},"e");for(let n=0;n<2;n++){let i=t();if(i!==void 0)return i;await this.fillCaptureNonces(1)}return t()}fillCaptureNonces(t){return this.captureFetch??(this.captureFetch=(async()=>{try{let n=await this.ensureSessionId(),i=await this.api("POST",`/sessions/${n}/media/capture-nonces`,{body:{count:Math.min(G,Math.max(1,t))}}),r=Date.now()+Math.max(0,i.expiresIn)*1e3;for(let a of Array.isArray(i.nonces)?i.nonces:[])typeof a=="string"&&a.length>0&&this.captureNonces.push({nonce:a,expiresAt:r});this.captureNonces=this.captureNonces.slice(-G)}catch{}})().finally(()=>{this.captureFetch=null})),this.captureFetch}async uploadToSpaces(t,n,i){let r;try{r=await this.fetchImpl(t,{method:"PUT",headers:{"content-type":v(i)},body:n,signal:AbortSignal.timeout(se)})}catch(a){throw K(a)}if(!r.ok){let a=(await r.text().catch(()=>"")).slice(0,re);throw new y({status:r.status,code:"upload_failed",message:`media upload failed (HTTP ${r.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 r=await this.ensureSessionId(),a={input:n,forceOutcome:i.forceOutcome};return this.api("POST",`/sessions/${r}/checks/${t}`,{body:a,idempotencyKey:i.idempotencyKey,busyRetry:i.idempotencyKey!==void 0})}async uploadAndSubmit(t,n,i,r={}){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,[ue[t]]:d.key};return this.submitCheck(t,o,r)}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 r=t==="GET"||i.busyRetry===!0,a=`${this.apiOrigin}/api/v2${n}`,c={"x-session-token":this.sessionToken,"x-sekyro-sdk":pe};i.body!==void 0&&(c["content-type"]="application/json"),i.idempotencyKey!==void 0&&(c["x-idempotency-key"]=i.idempotencyKey);try{let d=N.timezone();d!==void 0&&(c["sekyro-client-timezone"]=d)}catch{}c["sekyro-client-form-factor"]=D();try{let d=await N.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(f){throw K(f)}if(o.ok){if(i.empty===!0)return;if(i.blob===!0)try{return await o.blob()}catch(p){throw K(p)}let f;try{f=await o.json()}catch{throw new y({status:o.status,code:"unknown_error",message:`response body was not valid JSON (HTTP ${o.status})`})}return he(f)}let u=await fe(o);if(u.code==="idempotency_in_progress"&&d<this.retryAttempts){this.retryDelayMs>0&&await V(this.retryDelayMs);continue}if(r&&u.status===503&&ce.has(u.code)){r=!1,await V(R(u.retryAfterSeconds,de,this.random));continue}throw u}}},s(b,"g"),b);function L(e){return typeof e=="number"&&Number.isInteger(e)&&e>=0&&e<=6e5}s(L,"T");function K(e){if((typeof e=="object"&&e!==null?e.name:void 0)==="TimeoutError")return new y({status:0,code:"timeout",message:"request timed out"});let t=e instanceof Error?e.message:String(e);return new y({status:0,code:"network_error",message:`network request failed: ${t}`})}s(K,"m");function he(e){return e!==null&&typeof e=="object"&&"success"in e&&"data"in e?e.data:e}s(he,"x");async function fe(e){let t="unknown_error",n=`request failed (HTTP ${e.status})`,i=Number.NaN,r;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)?r=o.details:Array.isArray(o.details?.errors)&&(r={...o.details,issues:[]})}}catch{}let a=e.headers.get("retry-after"),c=a===null?Math.floor(i):Number.parseInt(a,10);return new y({status:e.status,code:t,message:n,...Number.isFinite(c)&&c>=0?{retryAfterSeconds:c}:{},details:r})}s(fe,"D");function V(e){return new Promise(t=>setTimeout(t,e))}s(V,"S");function We(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"}}s(We,"j");function Xe(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}:{}}}s(Xe,"B");var me=new Set(["nni_unbound","id_number_unbound","method_required","mobile_required","portrait_required"]);function it(e){return me.has(e)}s(it,"Ce");function st(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))}}s(st,"be");function rt(){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}}}s(rt,"ve");var ye={document:"document_photo",nfc:"document_chip",population_registry:"national_number",national_eid:"national_eid"};function m(e){return e.plan?.steps??[]}s(m,"f");function F(e){return Math.max(0,e.attempts.max-e.attempts.used)}s(F,"x");function _e(e){let t=e.plan?.choice;return t!==void 0&&e.plan?.current===t.nodeId?t:null}s(_e,"W");function at(e){let t=_e(e);if(t?.kind!=="identity_method")return null;let n=t.options.map(r=>ye[r.service]).filter(r=>r!==void 0),i=t.options.find(r=>r.nationalEid)?.nationalEid;return i?{available:!0,selected:null,options:n,nationalEid:i}:{available:!0,selected:null,options:n}}s(at,"xe");var ve=new Set(["liveness","face_match"]);function z(e){return e!==void 0&&(e.state==="pending"||e.state==="input_required")}s(z,"g");function ge(e){return e.status!=="created"&&e.status!=="in_progress"}s(ge,"T");function Y(e){let t=e.plan?.current,n=t==null?void 0:m(e).find(i=>i.id===t);return z(n)?n:void 0}s(Y,"V");function P(e,t){return m(e).find(n=>n.checkType===t)}s(P,"_");function q(e){let t=m(e),n=t.findIndex(i=>i.checkType==="liveness");return t.find((i,r)=>r>n&&i.checkType==="face_match")}s(q,"y");function be(e,t){let n=P(t,"liveness")?.state,i=q(t)?.state;return(q(e)?.state??"pending")==="pending"&&(n==="passed"||n==="review")&&i!==void 0&&i!=="pending"&&i!=="skipped"}s(be,"O");function B(e,t){let n=new Map(m(e).map(i=>[i.id,i.state]));return m(t).filter(i=>i.checkType==="face_match"&&(n.get(i.id)??"pending")==="pending"&&i.state!=="pending"&&i.state!=="skipped").map(i=>i.id)}s(B,"M");var ke=/^[0-9a-f]{24}$/i;function E(e){return ke.test(e)?`ses_${e}`:e}s(E,"R");function x(e,t){let n=E(e);return t===void 0?{sessionId:n,status:"unavailable"}:{sessionId:n,status:"unavailable",reasonCode:t}}s(x,"C");function Z(e,t,n){let i=E(e);return n===void 0?{sessionId:i,status:t}:{sessionId:i,status:t,reasonCode:n}}s(Z,"F");function ot(e,t){let n=Se(e,t),i=Me(e);return i!==void 0&&(n.sandbox={simulated:!0,reason:i}),n}s(ot,"Ve");var we=new Set(["no_testers","tester_gate_not_used","tester_gate_missed"]);function Me(e){if(e.sandbox!==!0)return;let t=e.simulation?.reason;return we.has(t)?t:void 0}s(Me,"Q");function Se(e,t){let n=E(e.sessionId);switch(e.status){case"created":case"in_progress":return Ee(e,t);case"verified":return O(e,{sessionId:n,status:"verified"});case"review_pending":return O(e,Z(n,"review",Q(e,"review")));case"not_verified":return O(e,Te(e));default:return O(e,{sessionId:n,status:"not_verified"})}}s(Se,"Z");var Ie=new Set([0,1,2,3]);function O(e,t){return Ie.has(e.level)&&(t.level=e.level),typeof e.assurance=="string"&&e.assurance.length>0&&(t.assurance=e.assurance),t}s(O,"b");function Te(e){let t={sessionId:E(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}s(Te,"ne");function Ce(e){return e==="rejected"?"rejected":e==="unavailable"?"unavailable":"inconclusive"}s(Ce,"te");function Ae(e,t){if(t===void 0)return!1;let n=m(t).find(i=>i.id===e.id);return n!==void 0&&n.attempts.used===e.attempts.used}s(Ae,"ie");function Ee(e,t){let n=E(e.sessionId),i=m(e).find(a=>ve.has(a.checkType)&&a.state==="input_required"&&a.reason!==void 0);if(i?.reason==="mobile_required")return x(n,"mobile_required");if(i?.reason!==void 0){if(i.result==="unavailable")return x(n,i.reason);let a=t.autoRetry&&(F(i)>0||Ae(i,t.previous))?{sessionId:n,status:"retry",reasonCode:i.reason,attemptsRemaining:F(i)}:{sessionId:n,status:"not_verified",reason:Ce(i.result),reasonCode:i.reason,attemptsRemaining:F(i)};return i.retakeHint!==void 0&&(a.retakeHint=i.retakeHint),a}let r=Y(e);return r===void 0&&m(e).some(a=>a.state==="review")?Z(n,"review",Q(e,"review")):r?.checkType==="portrait_icao"?x(n,"portrait_required"):x(n)}s(Ee,"re");function Q(e,t){return m(e).find(n=>n.state===t&&n.reason!==void 0)?.reason}s(Q,"L");function W(e,t,n,i,r){return e.presignCapture!==void 0?e.presignCapture(t,n,i,r):e.presign(t,n,i)}s(W,"K");function X(e){return{engine:e?.engine,durationMs:e?.clipMs}}s(X,"q");var xe=["video/webm","video/mp4"],J="image/jpeg",Oe=2,qe=1e3,Pe=1e4,$e=3,Ne=10,Ke=3,Re=new Set(["network_error","timeout","upload_failed","unknown_error","rate_limit_exceeded"]),Fe=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,H=(k=class extends Error{constructor(){super("verification destroyed"),this.name="FlowCancelledError"}},s(k,"w"),k);function je(e){let t=q(e);return P(e,"portrait_icao")?.state!=="pending"&&(t!==void 0?z(t):e.capture?.livePhoto?.oneCapture===!0)}s(je,"me");var w,A=(w=class extends Error{constructor(t){super(t),this.name="AttestationError"}},s(w,"h"),w),M,ze=(M=class extends A{constructor(t){super(`no attestation token: ${t}`),this.name="AttestationUnavailableError",this.code=t}},s(M,"E"),M);async function ee(e,t,n={}){let i=e.uuid(),r=!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 ze)throw o;a=!0,n.onAttestationInvalid?.(),i=e.uuid();continue}if(!(o instanceof y))throw o;if(o.code==="consent_required"&&!r){r=!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<$e){d+=1;let u=R(o.retryAfterSeconds,Ne,e.random??Math.random);e.onBusy?.({attempt:d,retryAfterSeconds:u/1e3}),await e.sleep(u),n.onAttestationInvalid?.(),i=e.uuid();continue}if(Re.has(o.code)&&c<Oe){c+=1;let u=o.retryAfterSeconds!==void 0?o.retryAfterSeconds*1e3:void 0;await e.sleep(u!==void 0?Math.min(u,Pe):qe);continue}throw o}}s(ee,"D");var He=new Set(["passed","review","processing","skipped"]);async function ct(e){let{artifacts:t}=e,n=t.clip,i=v(t.clipMime??"");if(t.degraded==="NO_RECORDER"||n===void 0||!xe.includes(i))return{kind:"unavailable",reason:"no_recorder"};e.client.armCapture?.(2);let r=De(e,t.keyframe),a=Ue(e,n,i,r),c=Ge(e,r),d=!1,o=new Set,u=!0,f=0;for(;;){if(e.isCancelled())return{kind:"cancelled"};let p=e.getView();if(ge(p))return{kind:"settled"};let l=Y(p),C=l?.checkType,$=C==="liveness"&&!d?"liveness":C==="face_match"&&!o.has(l?.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 h=await a();if(e.isCancelled())return{kind:"cancelled"};be(p,h)&&o.add(q(h)?.id);for(let te of B(p,h))o.add(te);await e.applySubmit(h,"liveness");let _=P(e.getView(),"liveness")?.state;u=_===void 0||He.has(_)}else{o.add(l?.id);let h=await c();if(e.isCancelled())return{kind:"cancelled"};for(let _ of B(p,h))o.add(_);await e.applySubmit(h,"face_match")}}catch(h){if(e.isCancelled()||h instanceof H)return{kind:"cancelled"};let _=Be(h);if(_.kind!=="resync"||f>=Ke)return _;f+=1,await e.refreshView()}}}s(ct,"Te");function De(e,t){let n=null,i=null,r=s(()=>n!==null?Promise.resolve(n):(i??(i=(async()=>{let a=await W(e.client,"image",J,t.size,X(e.artifacts));return await e.client.uploadToSpaces(a.uploadUrl,t,J),n=(await e.client.completeMedia(a.key)).key,e.onKeyframePromoted?.(n),n})().finally(()=>{i=null})),i),"r");return{ensure:r,attempt:s(()=>r().catch(()=>null),"attempt"),current:s(()=>n,"current")}}s(De,"_e");function Ue(e,t,n,i){let r=null,a,c=null,d=0,o;return()=>ee(e,async(u,f)=>{if(r===null||a===void 0){if(e.isCancelled())throw new H;a===void 0&&!je(e.getView())&&(a=null),e.onPhase("uploading");let[p,l]=await Promise.all([r!==null?Promise.resolve(r):(async()=>{let C=await W(u,"clip",n,t.size,X(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()]);r=p,a===void 0&&(a=l===null?null:{imageKey:l})}if(c===null){let p=performance.now();try{c=await e.getAttestation(),o=e.attestationError?.()}catch(l){throw l instanceof A?l:new A(l instanceof Error?l.message:String(l))}d=Math.round(performance.now()-p)}return e.onPhase("checking"),u.submitCheck("liveness",{clipKey:r,attestation:c,captureChannel:e.artifacts.captureChannel,capture:{...Le(e.artifacts),attestationMs:d,attestationError:o},...a!==null?{faceMatch:a}:{}},{idempotencyKey:f})},{onAttestationInvalid:s(()=>{c=null},"onAttestationInvalid")})}s(Ue,"Se");function Ge(e,t){return()=>ee(e,async(n,i)=>{if(t.current()===null){if(e.isCancelled())throw new H;e.onPhase("uploading")}let r=await t.ensure();return e.onPhase("checking"),n.submitCheck("face_match",{imageKey:r},{idempotencyKey:i})})}s(Ge,"ye");function Le(e){let t={width:e.width,height:e.height};for(let n of Ve)e[n]!==void 0&&(t[n]=e[n]);return t}s(Le,"ge");var Ve=["engine","facingMode","mode","formFactor","clipMs","clipFrames","fps","clipRetakes","codec","cameraReadyMs","faceAcquireMs","captureMs","screenRamp","provenance"];function Be(e){if(e instanceof A)return{kind:"unavailable",reason:"attestation"};if(e instanceof y){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(Fe.has(e.code))return{kind:"resync"}}return{kind:"unavailable",reason:"network"}}s(Be,"we");var dt="form_answers_invalid",S,ut=(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}},s(S,"U"),S),I,lt=(I=class extends Error{constructor(t,n){super(`invalid ${t} (${n})`),this.name="InvalidInputError",this.field=t,this.kind=n}},s(I,"B"),I),T,pt=(T=class extends Error{constructor(t,n){super(`invalid ${t} (${n})`),this.name="OtpInputError",this.field=t,this.kind=n}},s(T,"$"),T);function j(e){return e?.source==="upload"?null:e?.source==="choice"&&e.sourcePick!=="camera"?"upload_or_phone":"phone"}s(j,"I");function ht(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=P(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}}s(ht,"qe");function Je(e){let t=e?.capture,n=t?.mode;return n==="assisted"||n==="self"||n==="choice"?n:t?.cameraSwitch===!0?"assisted":"self"}s(Je,"ke");function ft(e){let t=e?.capture?.pick;return Je(e)==="choice"&&(t==="self"||t==="assisted")?t:null}s(ft,"Ue");function mt(e,t,n=null){return e==="choice"?t??n??"self":e}s(mt,"Be");var yt={"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{y as a,v as b,Qe as c,We as d,Xe as e,it as f,st as g,rt as h,ye as i,m as j,F as k,_e as l,at as m,z as n,ge as o,Y as p,P as q,E as r,x as s,ot as t,Me as u,W as v,xe as w,ze as x,ee as y,ct as z,Le as A,dt as B,ut as C,lt as D,pt as E,ht as F,Je as G,ft as H,mt as I,yt as J};