@sekyro/web 0.1.0-rc.13 → 0.1.0-rc.14

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 (48) hide show
  1. package/CHANGELOG.md +7 -0
  2. package/dist/capture-session-doc-J2CJELJ7.js +1 -0
  3. package/dist/{capture-session-v3-C5DRPBhM.d.ts → capture-session-v3-BrWuhh8k.d.ts} +1 -1
  4. package/dist/{capture-session-v3-Db4n6d-k.d.cts → capture-session-v3-CH6iDIql.d.cts} +1 -1
  5. package/dist/chunk-2BFYVMUU.js +1 -0
  6. package/dist/chunk-EIETPWIG.js +1 -0
  7. package/dist/chunk-G6MU3B5V.js +1 -0
  8. package/dist/{chunk-57VOMVKM.js → chunk-JPAGYRNX.js} +1 -1
  9. package/dist/{chunk-UBDG5IAP.js → chunk-KEIGHTGM.js} +1 -1
  10. package/dist/chunk-LPQQOB6M.js +1 -0
  11. package/dist/{chunk-5OIC5TZS.js → chunk-Q6CPJVOG.js} +1 -1
  12. package/dist/{chunk-XBVSYVKA.js → chunk-VDNW4TR5.js} +1 -1
  13. package/dist/{chunk-WTQE6IGL.js → chunk-VRD3HG2L.js} +1 -1
  14. package/dist/{chunk-H6H2RT6M.js → chunk-XEOM3MX3.js} +1 -1
  15. package/dist/{chunk-JRSIMNB5.js → chunk-YKXG7GME.js} +1 -1
  16. package/dist/client/index.cjs +1 -1
  17. package/dist/client/index.d.cts +4 -4
  18. package/dist/client/index.d.ts +4 -4
  19. package/dist/client/index.js +1 -1
  20. package/dist/core/index.cjs +1 -1
  21. package/dist/core/index.d.cts +3 -3
  22. package/dist/core/index.d.ts +3 -3
  23. package/dist/core/index.js +1 -1
  24. package/dist/create-document-capture-ENXEVHWQ.js +1 -0
  25. package/dist/{create-portrait-capture-C462EIB6.js → create-portrait-capture-53XBURNT.js} +1 -1
  26. package/dist/{create-verification-BV_T0-CR.d.cts → create-verification-B4f0BrHs.d.cts} +46 -4
  27. package/dist/{create-verification-P6i3tyce.d.ts → create-verification-CXATqO0d.d.ts} +46 -4
  28. package/dist/{icao-gate-B0GDH_JS.d.cts → icao-gate-D576CJ_s.d.cts} +1 -1
  29. package/dist/{icao-gate-BP11XO-h.d.ts → icao-gate-DSbntJnM.d.ts} +1 -1
  30. package/dist/index.cjs +1 -1
  31. package/dist/index.d.cts +6 -6
  32. package/dist/index.d.ts +6 -6
  33. package/dist/index.js +1 -1
  34. package/dist/internal/index.cjs +1 -1
  35. package/dist/internal/index.d.cts +6 -6
  36. package/dist/internal/index.d.ts +6 -6
  37. package/dist/internal/index.js +1 -1
  38. package/dist/{plan-runner-RVVF5DJV.js → plan-runner-YXN3I6CA.js} +1 -1
  39. package/dist/{types-DPWT_KMn.d.cts → types-BtEm3Lxe.d.cts} +1 -1
  40. package/dist/{types-DPWT_KMn.d.ts → types-BtEm3Lxe.d.ts} +1 -1
  41. package/package.json +1 -1
  42. package/sbom.cdx.json +7 -7
  43. package/dist/capture-session-doc-7LQAOCHJ.js +0 -1
  44. package/dist/chunk-73M7LS4H.js +0 -1
  45. package/dist/chunk-FHJ7HO3M.js +0 -1
  46. package/dist/chunk-IBA5CPDV.js +0 -1
  47. package/dist/chunk-VJM76LUI.js +0 -1
  48. package/dist/create-document-capture-RTFDQSBC.js +0 -1
@@ -1 +1 @@
1
- import{a as X,b as ke,d as V,e as L,f as U,g as be,h as E,i as B,j as b,k as F,l as P,m as w,n as D,v as Pe,w as xe}from"./chunk-UBDG5IAP.js";import{m as Ce}from"./chunk-JRSIMNB5.js";import{a as ge}from"./chunk-GT2ZLGF7.js";import{d as $}from"./chunk-FUHDOEBP.js";import{c as j,f as _e,g as G}from"./chunk-57VOMVKM.js";function K(e){return e.idNumberBound??e.nniBound}function H(e){return e===void 0?void 0:e.idNumberFromDocument??e.nniFromDocument}function ve(e){let t=e.idNumberMasked??e.nniMasked;return typeof t=="string"&&t!==""?t:void 0}var Ze="https://api.sekyro.ai",We=5e3,Je=1500,Qe=10;function $e(e){return new Promise(t=>setTimeout(t,e))}function je(){let e=globalThis.crypto;if(e!==void 0&&typeof e.randomUUID=="function")return e.randomUUID();let t=new Uint8Array(16);if(e!==void 0&&typeof e.getRandomValues=="function")e.getRandomValues(t);else for(let o=0;o<16;o+=1)t[o]=Math.floor(Math.random()*256);t[6]=(t[6]??0)&15|64,t[8]=(t[8]??0)&63|128;let i=[...t].map(o=>o.toString(16).padStart(2,"0")).join("");return`${i.slice(0,8)}-${i.slice(8,12)}-${i.slice(12,16)}-${i.slice(16,20)}-${i.slice(20)}`}function Tt(e){return Xe(e,{})}function Xe(e,t){let i=e.apiOrigin??Ze,o=e.autoRetry??!0,r=e.rearm??"auto",a=t.client??new _e({apiOrigin:i,sessionToken:e.clientToken,fetch:e.fetch}),u=t.sleep??$e,s=t.uuid??je,h=t.getTurnstileToken??((n,c)=>import("./turnstile-FATNZ4AG.js").then(l=>l.executeTurnstile(n,c))),S=ge(),m=null,p=null,d=!1,R=new AbortController,f=null,q=null,x=n=>{f=n,S.emit("view",n),m?.onView(n)},_=()=>f!==null?Promise.resolve(f):(q??(q=a.getSession().then(n=>(x(n),n)).finally(()=>{q=null})),q),v=async()=>{let n=await a.getSession();return x(n),n},Y=async(n,c)=>{n.plan!==void 0?x(n):await v()},Z=null,ie=async n=>{let c=await _();if(!n&&c.consentRecorded)return;let l=await a.recordConsent(e.locale);l.plan!==void 0?x(l):f!==null&&x({...f,consentRecorded:!0})},O=n=>n?.force===!0?ie(!0):(Z??(Z=ie(!1).finally(()=>{Z=null})),Z),W={client:a,ensureConsent:n=>O(n),sleep:u,uuid:s,onBusy:n=>{d||S.emit("busy",n)}},oe=!1,re=null,J=n=>{if(n.status==="approved"||n.status==="rejected"||n.status==="review"){if(oe)return;oe=!0}re=JSON.stringify(n),S.emit("result",n)},Te=n=>{re!==JSON.stringify(n)&&J(n)},se=async n=>{let c=f;n&&(c=await v().catch(()=>f));let l=c===null?null:E(c);return l!==null&&!d&&S.emit("method",l),l!==null},ae=null,ce=!1,ue=!1,de=()=>Pe(W,(n,c)=>n.submitCheck("population_registry",{},{idempotencyKey:c})),le=n=>K(n)===!0||H(P(n,"population_registry"))===!0,Ve=async()=>{try{let n=await _();if(b(n)||E(n)!==null||F(n)?.checkType!=="population_registry")return;if(!le(n)&&H(P(n,"population_registry"))===void 0&&(n=await v()),!le(n)){ue=!0;return}await O(),await Y(await de(),"population_registry");let c=f===null?void 0:P(f,"population_registry");if(c?.state==="input_required"&&c.reason==="registry_unavailable"&&U(c)>0){if(await u(We),d)return;await Y(await de(),"population_registry")}}catch(n){if(n instanceof j&&(n.code==="check_not_active"||n.code==="step_not_on_path")){await v().catch(()=>{});return}ce=!0;return}f!==null&&b(f)&&J(D(f,{autoRetry:o}))},pe=()=>(ae??(ae=Ve()),ae),De=async()=>{let c=(await _()).turnstileSiteKey;return c===null?{sandbox:!0}:{channel:"hosted_web",siteKey:c,turnstileToken:await h(c,{signal:R.signal})}},k=null,fe=Promise.resolve(),T=0,He=async()=>{let n=await _();for(let c=0;c<Qe&&!d&&!b(n)&&F(n)===void 0&&L(n).some(l=>l.state==="processing")&&(await u(Je),!d);c+=1)n=await v();return n},Ne=async(n,c,l)=>{let{capture:g}=n,C=()=>d,N=()=>n.alive&&n.attempt===l,he=y=>{N()&&g.setFlowState(y)},A=y=>{if(!C()&&(J(y),!!N())){if(y.status==="retry"&&r==="auto"){g.handle.retry();return}g.setFlowState("done")}};if(c.degraded==="NO_RECORDER"){let y=f?.sessionId??(await _().catch(()=>null))?.sessionId??"";A(w(y,"no_recorder"));return}he("uploading");try{if(await pe(),C())return;let y=await _(),ye;if(!b(y)&&E(y)!==null){await se(!1),A(w(y.sessionId,"method_required"));return}if(!b(y)){if(F(y)?.checkType==="population_registry"){A(w(y.sessionId,ue?"nni_unbound":ce?"network":"registry_unavailable"));return}if(await O(),C())return;ye=f??y;let Q=await xe({...W,artifacts:c,getAttestation:De,getView:()=>f??y,refreshView:v,applySubmit:Y,onPhase:he,isCancelled:C,onKeyframePromoted:Ye=>{p=Ye}});if(C())return;if(Q.kind==="unavailable"){A(w(y.sessionId,Q.reason));return}if(Q.kind==="resync"&&await v(),f!==null&&E(f)!==null){await se(!1),A(w(y.sessionId,"method_required"));return}y=await He()}A(D(y,{autoRetry:o,previous:ye}))}catch{if(C())return;A(w(f?.sessionId??"","network"))}},Le=(n,c)=>{let l=n.attempt;T>0&&n.alive&&n.capture.setFlowState("uploading"),T+=1,fe=fe.then(()=>Ne(n,c,l)).finally(()=>{T-=1,T===0&&m?.onChainIdle()}).catch(()=>{})},me=n=>{k?.capture.handle.destroy(),k!==null&&(k.alive=!1);let c=Ce(n,m?.captureInternals?.(n)??t.capture,()=>f?.capture?.liveness?.keyframe?.rank===!0,()=>X(f),()=>f?.capture?.liveness?.screenRamp),l={capture:c,alive:!0,attempt:0};k=l,c.handle.on("state",C=>{C==="starting"&&(l.attempt+=1)}),c.handle.on("captured",C=>{Promise.resolve().then(()=>Le(l,C))});let g=c.handle;return{get state(){return g.state},get captureMode(){return g.captureMode},get facingMode(){return g.facingMode},on:(C,N)=>g.on(C,N),start:async C=>{if(f===null&&await _().catch(()=>{}),!!l.alive)return g.start(C)},retry:()=>g.retry(),switchCamera:()=>g.switchCamera(),destroy:()=>{l.alive=!1,k===l&&(k=null),g.destroy()}}},Ue=async()=>{if(d)return null;try{let n=await _();return d?null:E(n)}catch{return null}},Be=async()=>{if(d)return"self";try{let n=await _();return d?"self":X(n)}catch{return"self"}},Fe=async()=>{if(d)return!1;try{let n=await _();if(d||b(n))return!1;let c=P(n,"liveness");return B(c)&&c?.requiresMobile===!0&&!$()}catch{return!1}},Ge=async()=>{if(d)return!1;try{let n=await _();return!d&&n.returning===!0}catch{return!1}},Ke=async n=>{let c=(await _()).plan?.choice,l=c?.options.find(C=>V[C.service]===n);if(!l)throw new RangeError(`method ${String(n)} is not offered`);let g=await a.choose(c.nodeId,l.id);d||x(g)},Se=null,qe=()=>(Se??(Se=import("./plan-runner-RVVF5DJV.js").then(n=>{let c=n.createPlanRunner({runtime:W,currentView:()=>f,ensureView:_,refreshView:v,ensureConsent:()=>O(),liveness:me,chainBusy:()=>T>0,destroyed:()=>d,sleep:u,isMobile:$,now:t.now??Date.now,keptFaceKey:()=>p,setView:x,baseCapture:t.capture,emitStep:l=>{d||S.emit("step",l)},emitResult:Te,documentInternals:t.document,portraitInternals:t.portrait,livePhotoInternals:t.livePhoto});return m=c,c})),Se);return{consent:()=>O(),startRegistry:pe,methodChoice:Ue,selectMethod:Ke,reportCameraUnavailable:async n=>{await O();let c=a.reportCameraUnavailable;if(c===void 0)throw new TypeError("this client cannot report a missing camera");let l=await c.call(a,n).catch(g=>{if(g instanceof j&&g.code==="check_out_of_order")return a.getSession();throw g});d||x(l)},mobileRequired:Fe,captureMode:Be,returning:Ge,liveness:me,run:async()=>{if(d)throw new Error("verification destroyed");return(await qe()).run()},currentStep:()=>m?.current()??null,voiceClips:async()=>{if(d)return null;try{let n=await _();return d?null:n.voice??null}catch{return null}},on:(n,c)=>S.on(n,c),destroy:()=>{d=!0,R.abort(),m?.destroy(),k!==null&&(k.alive=!1,k.capture.handle.destroy(),k=null),S.clear()}}}var Ie=["AD","AE","AF","AG","AI","AL","AM","AO","AQ","AR","AS","AT","AU","AW","AX","AZ","BA","BB","BD","BE","BF","BG","BH","BI","BJ","BL","BM","BN","BO","BQ","BR","BS","BT","BV","BW","BY","BZ","CA","CC","CD","CF","CG","CH","CI","CK","CL","CM","CN","CO","CR","CU","CV","CW","CX","CY","CZ","DE","DJ","DK","DM","DO","DZ","EC","EE","EG","EH","ER","ES","ET","FI","FJ","FK","FM","FO","FR","GA","GB","GD","GE","GF","GG","GH","GI","GL","GM","GN","GP","GQ","GR","GS","GT","GU","GW","GY","HK","HM","HN","HR","HT","HU","ID","IE","IL","IM","IN","IO","IQ","IR","IS","IT","JE","JM","JO","JP","KE","KG","KH","KI","KM","KN","KP","KR","KW","KY","KZ","LA","LB","LC","LI","LK","LR","LS","LT","LU","LV","LY","MA","MC","MD","ME","MF","MG","MH","MK","ML","MM","MN","MO","MP","MQ","MR","MS","MT","MU","MV","MW","MX","MY","MZ","NA","NC","NE","NF","NG","NI","NL","NO","NP","NR","NU","NZ","OM","PA","PE","PF","PG","PH","PK","PL","PM","PN","PR","PS","PT","PW","PY","QA","RE","RO","RS","RU","RW","SA","SB","SC","SD","SE","SG","SH","SI","SJ","SK","SL","SM","SN","SO","SR","SS","ST","SV","SX","SY","SZ","TC","TD","TF","TG","TH","TJ","TK","TL","TM","TN","TO","TR","TT","TV","TW","TZ","UA","UG","UM","US","UY","UZ","VA","VC","VE","VG","VI","VN","VU","WF","WS","XK","YE","YT","ZA","ZM","ZW"];var ze=["carte_identite","passport","residence_permit"];function et(e,t){let i=e.byIssuer?.[t]??e.default;return ze.filter(o=>i==="*"||i.includes(o))}function Nt(e,t=Ie){return[...new Set([...t,...Object.keys(e.byIssuer??{})])].filter(o=>et(e,o).length>0).sort()}function Re(e){if(e.acceptedDocuments)return e.acceptedDocuments;let t=e.acceptedDocumentTypes?.length?[...e.acceptedDocumentTypes]:["carte_identite","passport"];return{default:[],byIssuer:{MR:t}}}function Lt(e){return/^[A-Z]{2}$/.test(e)?String.fromCodePoint(...[...e].map(t=>127462+t.charCodeAt(0)-65)):""}var Yt=["national_number","document_photo","national_eid"],tt=new Set(["phone_otp","email_otp","national_eid","document","nfc","population_registry","supplied_identity","summary_confirm","liveness","face_match","aml_screening","face_dedup","age_estimation"]),nt=new Set(["supplied_identity","aml_screening","face_dedup","age_estimation"]),ee=["document","population_registry","national_eid"],te=["phone_otp","email_otp"],we={identity_method:ee,contact:te},it=["population_registry","document"],Oe="platform_unsupported",ot=new Set(["prefilled","user_entered","prefilled_or_entered"]),rt={phone_otp:"contact",email_otp:"contact",eid_auth:"identity",doc_ocr:"identity",nfc_chip:"identity",population_registry:"identity",liveness:"live_photo",portrait_icao:"live_photo",face_match:"live_photo"};function I(e){return e.section??rt[e.checkType]??null}function st(e,t){let i=e.plan?.choice;if(i===void 0||i.locked)return;let o=i.options.find(r=>r.id!==i.selected&&r.available!==!1&&t.includes(r.service));return o===void 0?void 0:{nodeId:i.nodeId,option:o}}function ne(e){let t=e.plan,i=t?.choice;if(t===void 0||i===void 0||i.locked||t.current===null||t.current===i.nodeId||b(e))return null;let o=we[i.kind]??[...ee,...te],r=i.options.flatMap(s=>s.available===!1||!o.includes(s.service)?[]:[s.nationalEid!=null?{id:s.id,service:s.service,nationalEid:s.nationalEid}:{id:s.id,service:s.service}]),a=t.steps.find(s=>s.id===t.current)?.service,u=i.selected??r.find(s=>s.service===a)?.id??null;return r.some(s=>s.id!==u)?{nodeId:i.nodeId,kind:i.kind,current:u,options:r}:null}function Ee(e){return e==null?[]:e.options.filter(t=>t.id!==e.current)}function at(e){let t=(e.plan?.sections??[]).map(r=>({id:r.id,state:r.state})),i={sessionId:e.sessionId,orgName:e.orgName,returning:e.returning===!0,consentRecorded:e.consentRecorded,expiresAt:e.expiresAt,sections:t.map(r=>r.id),progress:t,purpose:e.purpose??"identity"};e.branding!==void 0&&(i.branding=e.branding),e.cameraUnavailableHandled===!0&&(i.cameraUnavailableHandled=!0);let o=ne(e);return o!==null&&(i.switchable=o),i}function ct(e){let t={attemptsRemaining:U(e),attemptsExhausted:e.attemptsExhausted===!0};return e.reason!==void 0&&(t.reason=e.reason),e.retakeHint!==void 0&&(t.retakeHint=e.retakeHint),t}var Me={phone_otp:"phone",email_otp:"email"};function ut(e,t){let i=st(e,[t==="phone_otp"?"email_otp":"phone_otp"]);return i===void 0?void 0:Me[i.option.service]}function dt(e,t,i,o){let r=t.checkType==="email_otp",a=(r?t.emailOtp:t.otp)??{},u=r?t.emailOtp?.emailSource:t.otp?.numberSource,s=u!==void 0&&ot.has(u)?u:r?"prefilled_or_entered":"user_entered",h=typeof a.sentToMasked=="string"&&a.sentToMasked.length>0,S=ut(e,r?"email_otp":"phone_otp"),m={key:t.checkType,context:i,section:I(t),phase:h?"verify":"send",canSwitch:S!==void 0,...o},p=r?{kind:"email_otp",...m,emailSource:s,needsEmail:s!=="prefilled"}:{kind:"phone_otp",...m,numberSource:s,needsPhone:s!=="prefilled",channels:(t.otp?.channels??[]).filter(d=>d==="whatsapp"||d==="sms")};return S!==void 0&&(p.switchChannel=S),h&&(p.sentToMasked=a.sentToMasked),!r&&t.otp?.channel!==void 0&&(p.channel=t.otp.channel),!r&&Array.isArray(t.phoneCountries)&&(p.phoneCountries=t.phoneCountries.filter(d=>typeof d=="string"&&/^[A-Z]{2}$/.test(d))),a.expiresAt!==void 0&&(p.codeExpiresAt=a.expiresAt),a.resendAvailableAt!==void 0&&(p.resendAvailableAt=a.resendAvailableAt),p}function lt(e,t,i,o){let r=K(e)===!0?"bound":H(t)===!0?"document":"typed",a=r==="typed"&&t.state==="input_required"&&t.reason!==void 0&&ke(t.reason)==="id_number_recheck",u=Ee(ne(e)),s=!o.attemptsExhausted&&u.length===1&&u[0]?.service==="document";return{kind:"registry",key:"registry",context:i,section:I(t),state:t.state==="input_required"?"input_required":"pending",source:r,recheck:a,canUseDocument:s,...o}}function pt(e,t,i,o){let r=[...t.acceptedSides??[]];return{kind:"document",key:"document",context:i,section:I(t),side:r.includes("recto")?"verso":"recto",acceptedSides:r,documents:Re(e),...o}}function ft(e){let t=P(e,"liveness");return t?.state==="passed"||t?.state==="review"}function Ae(e,t,i,o,r){let a=t.icao?.report;return{kind:"portrait",key:`portrait:${r}`,context:i,section:I(t),phase:r,report:Array.isArray(a)?a:null,review:t.state==="review",tuning:e.capture?.icao??null,tuningVersion:e.capture?.tuningVersion??null,icao:G(e),retakeOnly:r==="capture"&&t.state==="input_required"&&e.capture?.livePhoto?.oneCapture===!0&&ft(e),...o}}var z={minLongSidePx:1280,jpegQuality:.95};function mt(e,t){let i=e.capture?.livePhoto;if(i?.oneCapture!==!0)return null;let o=P(e,"portrait_icao"),r=i.still??z;return{icao:t==="liveness"&&G(e)!==null&&o!==void 0&&o.state==="pending"&&o.reason===void 0,still:{minLongSidePx:r.minLongSidePx??z.minLongSidePx,jpegQuality:r.jpegQuality??z.jpegQuality}}}function St(e,t,i,o){let r=t.eid,a=I(t);if(r===void 0||r.challenge!=="app_code")return{kind:"unsupported",key:"unsupported:eid_auth",context:i,section:a,checkType:"eid_auth",reason:"update_required"};let u=Ee(ne(e)),s=u.length===1&&it.includes(u[0]?.service??"")?u[0]:void 0,h=s===void 0?void 0:V[s.service],S=h!==void 0,m={kind:"eid",key:"eid",context:i,section:a,provider:r.provider,providerName:r.providerName,country:r.country,challenge:"app_code",phase:r.awaiting==="code"?"code":"identifier",identifierBound:r.identifierBound===!0,canUseCamera:S,afterPass:r.afterPass==="continue"?"continue":"end",...o};return S&&(m.cameraMethod=h),r.expiresAt!==void 0&&(m.codeExpiresAt=r.expiresAt),r.resendAvailableAt!==void 0&&(m.resendAvailableAt=r.resendAvailableAt),r.resendsRemaining!==void 0&&(m.resendsRemaining=r.resendsRemaining),r.codeAttemptsRemaining!==void 0&&(m.codeAttemptsRemaining=r.codeAttemptsRemaining),m}function ht(e,t){if(t.checkType!=="face_match"||t.reason!==void 0)return null;let i=P(e,"portrait_icao");return i!==void 0&&(i.state==="passed"||i.state==="review")?i:null}function yt(e){return L(e).filter(t=>t.state==="failed").pop()?.attemptsExhausted===!0}function gt(e,t){let i=e.failureReason,o;i===Oe?o="platform_unsupported":e.status==="expired"?o="expired":e.status==="review_pending"?o="review":e.status==="completed"&&e.outcome==="approved"?o="approved":e.status==="completed"&&e.outcome==="review"?o="review":i==="device_cooldown"?o="cooldown":i!==void 0?o="policy_stop":yt(e)?o="attempts_exhausted":o="rejected";let r=o==="platform_unsupported"?{sessionId:e.sessionId,status:"unavailable"}:D(e,{autoRetry:!1}),a={kind:"result",key:"result",context:t,section:null,display:o,result:r};return i!==void 0&&(a.failureReason=i),e.retryAfter!==void 0&&(a.retryAfter=e.retryAfter),a}function Ct(e,t,i){let o=e.identitySummary;if(o==null)return null;let r={kind:"identity_summary",key:"identity_summary",context:t,section:i??"identity",summaryKind:o.kind==="partial"?"partial":o.kind??"full",source:o.source,portraitAvailable:o.portrait?.available===!0,retakeAvailable:o.retakeAvailable===!0};for(let u of _t){let s=o[u];typeof s=="string"&&s!==""&&(r[u]=s)}let a=ve(o);return a!==void 0&&(r.idNumberMasked=a,r.nniMasked=a),r}var _t=["fullName","birthDate","birthYear","nationality","documentType","documentNumberMasked","expiryDate","retakeTarget"];function M(e,t,i,o){return{kind:"unsupported",key:`unsupported:${i}`,context:e,section:t,checkType:i,reason:o}}function kt(e){return e.kind==="contact"?"contact":(e.kind==="identity_method","identity")}function bt(e,t){let i=we[e.kind]??[...ee,...te],o=kt(e),r=e.options.flatMap(u=>{if(u.available===!1||!i.includes(u.service))return[];let s={id:u.id,service:u.service};return u.nationalEid!=null&&(s.nationalEid=u.nationalEid),[s]});if(r.length===0){let u=e.options.length>0&&e.options.every(s=>s.service==="nfc");return M(t,o,"choice",u?"platform_unsupported":"update_required")}let a={nodeId:e.nodeId,kind:e.kind,selected:e.selected,options:r};if(e.kind==="identity_method"){let u={kind:"method",key:"method",context:t,section:o,options:r.map(h=>V[h.service]),choice:a},s=r.find(h=>h.nationalEid!==void 0)?.nationalEid;return s!==void 0&&(u.nationalEid=s),u}return e.kind==="contact"?{kind:"contact_choice",key:"contact_choice",context:t,section:o,options:r.map(u=>Me[u.service]),selected:null,locked:!1,choice:a}:{kind:"choice",key:`choice:${e.nodeId}`,context:t,section:o,choice:a}}function Zt(e,t={}){let i=at(e);if(b(e)||e.failureReason===Oe)return gt(e,i);let o=e.plan;if(o===void 0||!Array.isArray(o.sections))return M(i,null,"plan","update_required");let r=be(e);if(r!==null)return bt(r,i);let a=o.current===null?void 0:o.steps.find(p=>p.id===o.current),u=p=>{let d={kind:"processing",key:"processing",context:i,section:p!==void 0?I(p):o.sections.find(R=>R.state==="current")?.id??null,stalled:!1};return typeof p?.service=="string"&&p.service!==""&&(d.service=p.service),d};if(o.current===null)return u(o.steps.find(p=>p.state==="processing"));if(a===void 0)return M(i,null,"step","update_required");if(!tt.has(a.service))return a.interaction==="server"?u(a):M(i,I(a),a.service,"update_required");if(nt.has(a.service)||!B(a))return u(a);let s=a,h=ct(s),S=s.checkType,m=I(s);switch(S){case"phone_otp":case"email_otp":return dt(e,s,i,h);case"population_registry":return lt(e,s,i,h);case"eid_auth":return St(e,s,i,h);case"doc_ocr":return pt(e,s,i,h);case"identity_confirm":return Ct(e,i,m)??u(s);case"portrait_icao":return Ae(e,s,i,h,"capture");case"liveness":case"face_match":{let p=ht(e,s);if(p!==null)return Ae(e,p,i,h,"match");let d=s.requiresMobile===!0,R=G(e);return d&&t.isMobile===!1?{kind:"mobile_required",key:"mobile_required",context:i,section:m,checkType:S}:{kind:"liveness",key:"biometric",context:i,section:m,mode:S==="face_match"?"selfie":"liveness",requiresMobile:d,instructions:R===null?"standard":"icao",icao:R,livePhoto:mt(e,S),...h}}case"nfc_chip":return M(i,m,S,"platform_unsupported");default:return M(i,m,S,"update_required")}}export{Ze as a,We as b,Je as c,Qe as d,je as e,Tt as f,Xe as g,Ie as h,ze as i,et as j,Nt as k,Re as l,Lt as m,Yt as n,Oe as o,I as p,ne as q,Ee as r,ht as s,Zt as t};
1
+ import{a as X,b as ke,d as V,e as L,f as U,g as be,h as E,i as B,j as b,k as F,l as P,m as w,n as D,v as Pe,w as xe}from"./chunk-KEIGHTGM.js";import{m as Ce}from"./chunk-YKXG7GME.js";import{a as ge}from"./chunk-GT2ZLGF7.js";import{d as $}from"./chunk-FUHDOEBP.js";import{c as j,f as _e,g as G}from"./chunk-JPAGYRNX.js";function K(e){return e.idNumberBound??e.nniBound}function H(e){return e===void 0?void 0:e.idNumberFromDocument??e.nniFromDocument}function ve(e){let t=e.idNumberMasked??e.nniMasked;return typeof t=="string"&&t!==""?t:void 0}var Ze="https://api.sekyro.ai",We=5e3,Je=1500,Qe=10;function $e(e){return new Promise(t=>setTimeout(t,e))}function je(){let e=globalThis.crypto;if(e!==void 0&&typeof e.randomUUID=="function")return e.randomUUID();let t=new Uint8Array(16);if(e!==void 0&&typeof e.getRandomValues=="function")e.getRandomValues(t);else for(let o=0;o<16;o+=1)t[o]=Math.floor(Math.random()*256);t[6]=(t[6]??0)&15|64,t[8]=(t[8]??0)&63|128;let i=[...t].map(o=>o.toString(16).padStart(2,"0")).join("");return`${i.slice(0,8)}-${i.slice(8,12)}-${i.slice(12,16)}-${i.slice(16,20)}-${i.slice(20)}`}function Tt(e){return Xe(e,{})}function Xe(e,t){let i=e.apiOrigin??Ze,o=e.autoRetry??!0,r=e.rearm??"auto",a=t.client??new _e({apiOrigin:i,sessionToken:e.clientToken,fetch:e.fetch}),u=t.sleep??$e,s=t.uuid??je,h=t.getTurnstileToken??((n,c)=>import("./turnstile-FATNZ4AG.js").then(l=>l.executeTurnstile(n,c))),S=ge(),m=null,p=null,d=!1,R=new AbortController,f=null,q=null,x=n=>{f=n,S.emit("view",n),m?.onView(n)},_=()=>f!==null?Promise.resolve(f):(q??(q=a.getSession().then(n=>(x(n),n)).finally(()=>{q=null})),q),v=async()=>{let n=await a.getSession();return x(n),n},Y=async(n,c)=>{n.plan!==void 0?x(n):await v()},Z=null,ie=async n=>{let c=await _();if(!n&&c.consentRecorded)return;let l=await a.recordConsent(e.locale);l.plan!==void 0?x(l):f!==null&&x({...f,consentRecorded:!0})},O=n=>n?.force===!0?ie(!0):(Z??(Z=ie(!1).finally(()=>{Z=null})),Z),W={client:a,ensureConsent:n=>O(n),sleep:u,uuid:s,onBusy:n=>{d||S.emit("busy",n)}},oe=!1,re=null,J=n=>{if(n.status==="approved"||n.status==="rejected"||n.status==="review"){if(oe)return;oe=!0}re=JSON.stringify(n),S.emit("result",n)},Te=n=>{re!==JSON.stringify(n)&&J(n)},se=async n=>{let c=f;n&&(c=await v().catch(()=>f));let l=c===null?null:E(c);return l!==null&&!d&&S.emit("method",l),l!==null},ae=null,ce=!1,ue=!1,de=()=>Pe(W,(n,c)=>n.submitCheck("population_registry",{},{idempotencyKey:c})),le=n=>K(n)===!0||H(P(n,"population_registry"))===!0,Ve=async()=>{try{let n=await _();if(b(n)||E(n)!==null||F(n)?.checkType!=="population_registry")return;if(!le(n)&&H(P(n,"population_registry"))===void 0&&(n=await v()),!le(n)){ue=!0;return}await O(),await Y(await de(),"population_registry");let c=f===null?void 0:P(f,"population_registry");if(c?.state==="input_required"&&c.reason==="registry_unavailable"&&U(c)>0){if(await u(We),d)return;await Y(await de(),"population_registry")}}catch(n){if(n instanceof j&&(n.code==="check_not_active"||n.code==="step_not_on_path")){await v().catch(()=>{});return}ce=!0;return}f!==null&&b(f)&&J(D(f,{autoRetry:o}))},pe=()=>(ae??(ae=Ve()),ae),De=async()=>{let c=(await _()).turnstileSiteKey;return c===null?{sandbox:!0}:{channel:"hosted_web",siteKey:c,turnstileToken:await h(c,{signal:R.signal})}},k=null,fe=Promise.resolve(),T=0,He=async()=>{let n=await _();for(let c=0;c<Qe&&!d&&!b(n)&&F(n)===void 0&&L(n).some(l=>l.state==="processing")&&(await u(Je),!d);c+=1)n=await v();return n},Ne=async(n,c,l)=>{let{capture:g}=n,C=()=>d,N=()=>n.alive&&n.attempt===l,he=y=>{N()&&g.setFlowState(y)},A=y=>{if(!C()&&(J(y),!!N())){if(y.status==="retry"&&r==="auto"){g.handle.retry();return}g.setFlowState("done")}};if(c.degraded==="NO_RECORDER"){let y=f?.sessionId??(await _().catch(()=>null))?.sessionId??"";A(w(y,"no_recorder"));return}he("uploading");try{if(await pe(),C())return;let y=await _(),ye;if(!b(y)&&E(y)!==null){await se(!1),A(w(y.sessionId,"method_required"));return}if(!b(y)){if(F(y)?.checkType==="population_registry"){A(w(y.sessionId,ue?"nni_unbound":ce?"network":"registry_unavailable"));return}if(await O(),C())return;ye=f??y;let Q=await xe({...W,artifacts:c,getAttestation:De,getView:()=>f??y,refreshView:v,applySubmit:Y,onPhase:he,isCancelled:C,onKeyframePromoted:Ye=>{p=Ye}});if(C())return;if(Q.kind==="unavailable"){A(w(y.sessionId,Q.reason));return}if(Q.kind==="resync"&&await v(),f!==null&&E(f)!==null){await se(!1),A(w(y.sessionId,"method_required"));return}y=await He()}A(D(y,{autoRetry:o,previous:ye}))}catch{if(C())return;A(w(f?.sessionId??"","network"))}},Le=(n,c)=>{let l=n.attempt;T>0&&n.alive&&n.capture.setFlowState("uploading"),T+=1,fe=fe.then(()=>Ne(n,c,l)).finally(()=>{T-=1,T===0&&m?.onChainIdle()}).catch(()=>{})},me=n=>{k?.capture.handle.destroy(),k!==null&&(k.alive=!1);let c=Ce(n,m?.captureInternals?.(n)??t.capture,()=>f?.capture?.liveness?.keyframe?.rank===!0,()=>X(f),()=>f?.capture?.liveness?.screenRamp),l={capture:c,alive:!0,attempt:0};k=l,c.handle.on("state",C=>{C==="starting"&&(l.attempt+=1)}),c.handle.on("captured",C=>{Promise.resolve().then(()=>Le(l,C))});let g=c.handle;return{get state(){return g.state},get captureMode(){return g.captureMode},get facingMode(){return g.facingMode},on:(C,N)=>g.on(C,N),start:async C=>{if(f===null&&await _().catch(()=>{}),!!l.alive)return g.start(C)},retry:()=>g.retry(),switchCamera:()=>g.switchCamera(),destroy:()=>{l.alive=!1,k===l&&(k=null),g.destroy()}}},Ue=async()=>{if(d)return null;try{let n=await _();return d?null:E(n)}catch{return null}},Be=async()=>{if(d)return"self";try{let n=await _();return d?"self":X(n)}catch{return"self"}},Fe=async()=>{if(d)return!1;try{let n=await _();if(d||b(n))return!1;let c=P(n,"liveness");return B(c)&&c?.requiresMobile===!0&&!$()}catch{return!1}},Ge=async()=>{if(d)return!1;try{let n=await _();return!d&&n.returning===!0}catch{return!1}},Ke=async n=>{let c=(await _()).plan?.choice,l=c?.options.find(C=>V[C.service]===n);if(!l)throw new RangeError(`method ${String(n)} is not offered`);let g=await a.choose(c.nodeId,l.id);d||x(g)},Se=null,qe=()=>(Se??(Se=import("./plan-runner-YXN3I6CA.js").then(n=>{let c=n.createPlanRunner({runtime:W,currentView:()=>f,ensureView:_,refreshView:v,ensureConsent:()=>O(),liveness:me,chainBusy:()=>T>0,destroyed:()=>d,sleep:u,isMobile:$,now:t.now??Date.now,keptFaceKey:()=>p,setView:x,baseCapture:t.capture,emitStep:l=>{d||S.emit("step",l)},emitResult:Te,documentInternals:t.document,portraitInternals:t.portrait,livePhotoInternals:t.livePhoto});return m=c,c})),Se);return{consent:()=>O(),startRegistry:pe,methodChoice:Ue,selectMethod:Ke,reportCameraUnavailable:async n=>{await O();let c=a.reportCameraUnavailable;if(c===void 0)throw new TypeError("this client cannot report a missing camera");let l=await c.call(a,n).catch(g=>{if(g instanceof j&&g.code==="check_out_of_order")return a.getSession();throw g});d||x(l)},mobileRequired:Fe,captureMode:Be,returning:Ge,liveness:me,run:async()=>{if(d)throw new Error("verification destroyed");return(await qe()).run()},currentStep:()=>m?.current()??null,voiceClips:async()=>{if(d)return null;try{let n=await _();return d?null:n.voice??null}catch{return null}},on:(n,c)=>S.on(n,c),destroy:()=>{d=!0,R.abort(),m?.destroy(),k!==null&&(k.alive=!1,k.capture.handle.destroy(),k=null),S.clear()}}}var Ie=["AD","AE","AF","AG","AI","AL","AM","AO","AQ","AR","AS","AT","AU","AW","AX","AZ","BA","BB","BD","BE","BF","BG","BH","BI","BJ","BL","BM","BN","BO","BQ","BR","BS","BT","BV","BW","BY","BZ","CA","CC","CD","CF","CG","CH","CI","CK","CL","CM","CN","CO","CR","CU","CV","CW","CX","CY","CZ","DE","DJ","DK","DM","DO","DZ","EC","EE","EG","EH","ER","ES","ET","FI","FJ","FK","FM","FO","FR","GA","GB","GD","GE","GF","GG","GH","GI","GL","GM","GN","GP","GQ","GR","GS","GT","GU","GW","GY","HK","HM","HN","HR","HT","HU","ID","IE","IL","IM","IN","IO","IQ","IR","IS","IT","JE","JM","JO","JP","KE","KG","KH","KI","KM","KN","KP","KR","KW","KY","KZ","LA","LB","LC","LI","LK","LR","LS","LT","LU","LV","LY","MA","MC","MD","ME","MF","MG","MH","MK","ML","MM","MN","MO","MP","MQ","MR","MS","MT","MU","MV","MW","MX","MY","MZ","NA","NC","NE","NF","NG","NI","NL","NO","NP","NR","NU","NZ","OM","PA","PE","PF","PG","PH","PK","PL","PM","PN","PR","PS","PT","PW","PY","QA","RE","RO","RS","RU","RW","SA","SB","SC","SD","SE","SG","SH","SI","SJ","SK","SL","SM","SN","SO","SR","SS","ST","SV","SX","SY","SZ","TC","TD","TF","TG","TH","TJ","TK","TL","TM","TN","TO","TR","TT","TV","TW","TZ","UA","UG","UM","US","UY","UZ","VA","VC","VE","VG","VI","VN","VU","WF","WS","XK","YE","YT","ZA","ZM","ZW"];var ze=["carte_identite","passport","residence_permit"];function et(e,t){let i=e.byIssuer?.[t]??e.default;return ze.filter(o=>i==="*"||i.includes(o))}function Nt(e,t=Ie){return[...new Set([...t,...Object.keys(e.byIssuer??{})])].filter(o=>et(e,o).length>0).sort()}function Re(e){if(e.acceptedDocuments)return e.acceptedDocuments;let t=e.acceptedDocumentTypes?.length?[...e.acceptedDocumentTypes]:["carte_identite","passport"];return{default:[],byIssuer:{MR:t}}}function Lt(e){return/^[A-Z]{2}$/.test(e)?String.fromCodePoint(...[...e].map(t=>127462+t.charCodeAt(0)-65)):""}var Yt=["national_number","document_photo","national_eid"],tt=new Set(["phone_otp","email_otp","national_eid","document","nfc","population_registry","supplied_identity","summary_confirm","liveness","face_match","aml_screening","face_dedup","age_estimation"]),nt=new Set(["supplied_identity","aml_screening","face_dedup","age_estimation"]),ee=["document","population_registry","national_eid"],te=["phone_otp","email_otp"],we={identity_method:ee,contact:te},it=["population_registry","document"],Oe="platform_unsupported",ot=new Set(["prefilled","user_entered","prefilled_or_entered"]),rt={phone_otp:"contact",email_otp:"contact",eid_auth:"identity",doc_ocr:"identity",nfc_chip:"identity",population_registry:"identity",liveness:"live_photo",portrait_icao:"live_photo",face_match:"live_photo"};function I(e){return e.section??rt[e.checkType]??null}function st(e,t){let i=e.plan?.choice;if(i===void 0||i.locked)return;let o=i.options.find(r=>r.id!==i.selected&&r.available!==!1&&t.includes(r.service));return o===void 0?void 0:{nodeId:i.nodeId,option:o}}function ne(e){let t=e.plan,i=t?.choice;if(t===void 0||i===void 0||i.locked||t.current===null||t.current===i.nodeId||b(e))return null;let o=we[i.kind]??[...ee,...te],r=i.options.flatMap(s=>s.available===!1||!o.includes(s.service)?[]:[s.nationalEid!=null?{id:s.id,service:s.service,nationalEid:s.nationalEid}:{id:s.id,service:s.service}]),a=t.steps.find(s=>s.id===t.current)?.service,u=i.selected??r.find(s=>s.service===a)?.id??null;return r.some(s=>s.id!==u)?{nodeId:i.nodeId,kind:i.kind,current:u,options:r}:null}function Ee(e){return e==null?[]:e.options.filter(t=>t.id!==e.current)}function at(e){let t=(e.plan?.sections??[]).map(r=>({id:r.id,state:r.state})),i={sessionId:e.sessionId,orgName:e.orgName,returning:e.returning===!0,consentRecorded:e.consentRecorded,expiresAt:e.expiresAt,sections:t.map(r=>r.id),progress:t,purpose:e.purpose??"identity"};e.branding!==void 0&&(i.branding=e.branding),e.cameraUnavailableHandled===!0&&(i.cameraUnavailableHandled=!0);let o=ne(e);return o!==null&&(i.switchable=o),i}function ct(e){let t={attemptsRemaining:U(e),attemptsExhausted:e.attemptsExhausted===!0};return e.reason!==void 0&&(t.reason=e.reason),e.retakeHint!==void 0&&(t.retakeHint=e.retakeHint),t}var Me={phone_otp:"phone",email_otp:"email"};function ut(e,t){let i=st(e,[t==="phone_otp"?"email_otp":"phone_otp"]);return i===void 0?void 0:Me[i.option.service]}function dt(e,t,i,o){let r=t.checkType==="email_otp",a=(r?t.emailOtp:t.otp)??{},u=r?t.emailOtp?.emailSource:t.otp?.numberSource,s=u!==void 0&&ot.has(u)?u:r?"prefilled_or_entered":"user_entered",h=typeof a.sentToMasked=="string"&&a.sentToMasked.length>0,S=ut(e,r?"email_otp":"phone_otp"),m={key:t.checkType,context:i,section:I(t),phase:h?"verify":"send",canSwitch:S!==void 0,...o},p=r?{kind:"email_otp",...m,emailSource:s,needsEmail:s!=="prefilled"}:{kind:"phone_otp",...m,numberSource:s,needsPhone:s!=="prefilled",channels:(t.otp?.channels??[]).filter(d=>d==="whatsapp"||d==="sms")};return S!==void 0&&(p.switchChannel=S),h&&(p.sentToMasked=a.sentToMasked),!r&&t.otp?.channel!==void 0&&(p.channel=t.otp.channel),!r&&Array.isArray(t.phoneCountries)&&(p.phoneCountries=t.phoneCountries.filter(d=>typeof d=="string"&&/^[A-Z]{2}$/.test(d))),a.expiresAt!==void 0&&(p.codeExpiresAt=a.expiresAt),a.resendAvailableAt!==void 0&&(p.resendAvailableAt=a.resendAvailableAt),p}function lt(e,t,i,o){let r=K(e)===!0?"bound":H(t)===!0?"document":"typed",a=r==="typed"&&t.state==="input_required"&&t.reason!==void 0&&ke(t.reason)==="id_number_recheck",u=Ee(ne(e)),s=!o.attemptsExhausted&&u.length===1&&u[0]?.service==="document";return{kind:"registry",key:"registry",context:i,section:I(t),state:t.state==="input_required"?"input_required":"pending",source:r,recheck:a,canUseDocument:s,...o}}function pt(e,t,i,o){let r=[...t.acceptedSides??[]];return{kind:"document",key:"document",context:i,section:I(t),side:r.includes("recto")?"verso":"recto",acceptedSides:r,documents:Re(e),...o}}function ft(e){let t=P(e,"liveness");return t?.state==="passed"||t?.state==="review"}function Ae(e,t,i,o,r){let a=t.icao?.report;return{kind:"portrait",key:`portrait:${r}`,context:i,section:I(t),phase:r,report:Array.isArray(a)?a:null,review:t.state==="review",tuning:e.capture?.icao??null,tuningVersion:e.capture?.tuningVersion??null,icao:G(e),retakeOnly:r==="capture"&&t.state==="input_required"&&e.capture?.livePhoto?.oneCapture===!0&&ft(e),...o}}var z={minLongSidePx:1280,jpegQuality:.95};function mt(e,t){let i=e.capture?.livePhoto;if(i?.oneCapture!==!0)return null;let o=P(e,"portrait_icao"),r=i.still??z;return{icao:t==="liveness"&&G(e)!==null&&o!==void 0&&o.state==="pending"&&o.reason===void 0,still:{minLongSidePx:r.minLongSidePx??z.minLongSidePx,jpegQuality:r.jpegQuality??z.jpegQuality}}}function St(e,t,i,o){let r=t.eid,a=I(t);if(r===void 0||r.challenge!=="app_code")return{kind:"unsupported",key:"unsupported:eid_auth",context:i,section:a,checkType:"eid_auth",reason:"update_required"};let u=Ee(ne(e)),s=u.length===1&&it.includes(u[0]?.service??"")?u[0]:void 0,h=s===void 0?void 0:V[s.service],S=h!==void 0,m={kind:"eid",key:"eid",context:i,section:a,provider:r.provider,providerName:r.providerName,country:r.country,challenge:"app_code",phase:r.awaiting==="code"?"code":"identifier",identifierBound:r.identifierBound===!0,canUseCamera:S,afterPass:r.afterPass==="continue"?"continue":"end",...o};return S&&(m.cameraMethod=h),r.expiresAt!==void 0&&(m.codeExpiresAt=r.expiresAt),r.resendAvailableAt!==void 0&&(m.resendAvailableAt=r.resendAvailableAt),r.resendsRemaining!==void 0&&(m.resendsRemaining=r.resendsRemaining),r.codeAttemptsRemaining!==void 0&&(m.codeAttemptsRemaining=r.codeAttemptsRemaining),m}function ht(e,t){if(t.checkType!=="face_match"||t.reason!==void 0)return null;let i=P(e,"portrait_icao");return i!==void 0&&(i.state==="passed"||i.state==="review")?i:null}function yt(e){return L(e).filter(t=>t.state==="failed").pop()?.attemptsExhausted===!0}function gt(e,t){let i=e.failureReason,o;i===Oe?o="platform_unsupported":e.status==="expired"?o="expired":e.status==="review_pending"?o="review":e.status==="completed"&&e.outcome==="approved"?o="approved":e.status==="completed"&&e.outcome==="review"?o="review":i==="device_cooldown"?o="cooldown":i!==void 0?o="policy_stop":yt(e)?o="attempts_exhausted":o="rejected";let r=o==="platform_unsupported"?{sessionId:e.sessionId,status:"unavailable"}:D(e,{autoRetry:!1}),a={kind:"result",key:"result",context:t,section:null,display:o,result:r};return i!==void 0&&(a.failureReason=i),e.retryAfter!==void 0&&(a.retryAfter=e.retryAfter),a}function Ct(e,t,i){let o=e.identitySummary;if(o==null)return null;let r={kind:"identity_summary",key:"identity_summary",context:t,section:i??"identity",summaryKind:o.kind==="partial"?"partial":o.kind??"full",source:o.source,portraitAvailable:o.portrait?.available===!0,retakeAvailable:o.retakeAvailable===!0};for(let u of _t){let s=o[u];typeof s=="string"&&s!==""&&(r[u]=s)}let a=ve(o);return a!==void 0&&(r.idNumberMasked=a,r.nniMasked=a),r}var _t=["fullName","birthDate","birthYear","nationality","documentType","documentNumberMasked","expiryDate","retakeTarget"];function M(e,t,i,o){return{kind:"unsupported",key:`unsupported:${i}`,context:e,section:t,checkType:i,reason:o}}function kt(e){return e.kind==="contact"?"contact":(e.kind==="identity_method","identity")}function bt(e,t){let i=we[e.kind]??[...ee,...te],o=kt(e),r=e.options.flatMap(u=>{if(u.available===!1||!i.includes(u.service))return[];let s={id:u.id,service:u.service};return u.nationalEid!=null&&(s.nationalEid=u.nationalEid),[s]});if(r.length===0){let u=e.options.length>0&&e.options.every(s=>s.service==="nfc");return M(t,o,"choice",u?"platform_unsupported":"update_required")}let a={nodeId:e.nodeId,kind:e.kind,selected:e.selected,options:r};if(e.kind==="identity_method"){let u={kind:"method",key:"method",context:t,section:o,options:r.map(h=>V[h.service]),choice:a},s=r.find(h=>h.nationalEid!==void 0)?.nationalEid;return s!==void 0&&(u.nationalEid=s),u}return e.kind==="contact"?{kind:"contact_choice",key:"contact_choice",context:t,section:o,options:r.map(u=>Me[u.service]),selected:null,locked:!1,choice:a}:{kind:"choice",key:`choice:${e.nodeId}`,context:t,section:o,choice:a}}function Zt(e,t={}){let i=at(e);if(b(e)||e.failureReason===Oe)return gt(e,i);let o=e.plan;if(o===void 0||!Array.isArray(o.sections))return M(i,null,"plan","update_required");let r=be(e);if(r!==null)return bt(r,i);let a=o.current===null?void 0:o.steps.find(p=>p.id===o.current),u=p=>{let d={kind:"processing",key:"processing",context:i,section:p!==void 0?I(p):o.sections.find(R=>R.state==="current")?.id??null,stalled:!1};return typeof p?.service=="string"&&p.service!==""&&(d.service=p.service),d};if(o.current===null)return u(o.steps.find(p=>p.state==="processing"));if(a===void 0)return M(i,null,"step","update_required");if(!tt.has(a.service))return a.interaction==="server"?u(a):M(i,I(a),a.service,"update_required");if(nt.has(a.service)||!B(a))return u(a);let s=a,h=ct(s),S=s.checkType,m=I(s);switch(S){case"phone_otp":case"email_otp":return dt(e,s,i,h);case"population_registry":return lt(e,s,i,h);case"eid_auth":return St(e,s,i,h);case"doc_ocr":return pt(e,s,i,h);case"identity_confirm":return Ct(e,i,m)??u(s);case"portrait_icao":return Ae(e,s,i,h,"capture");case"liveness":case"face_match":{let p=ht(e,s);if(p!==null)return Ae(e,p,i,h,"match");let d=s.requiresMobile===!0,R=G(e);return d&&t.isMobile===!1?{kind:"mobile_required",key:"mobile_required",context:i,section:m,checkType:S}:{kind:"liveness",key:"biometric",context:i,section:m,mode:S==="face_match"?"selfie":"liveness",requiresMobile:d,instructions:R===null?"standard":"icao",icao:R,livePhoto:mt(e,S),...h}}case"nfc_chip":return M(i,m,S,"platform_unsupported");default:return M(i,m,S,"update_required")}}export{Ze as a,We as b,Je as c,Qe as d,je as e,Tt as f,Xe as g,Ie as h,ze as i,et as j,Nt as k,Re as l,Lt as m,Yt as n,Oe as o,I as p,ne as q,Ee as r,ht as s,Zt as t};
@@ -1 +1 @@
1
- import{d as j,h as be,i as he,j as ye,l as Se}from"./chunk-G6LKLN4U.js";import{f as ge}from"./chunk-TDLIXFDT.js";import{l as fe}from"./chunk-JRSIMNB5.js";import{a as me,e as pe}from"./chunk-GT2ZLGF7.js";var Ge={low:{maxLongEdge:1920,payloadTargetBytes:7e5,qMin:.7,qMax:.92},mid:{maxLongEdge:2240,payloadTargetBytes:12e5,qMin:.7,qMax:.92},good:{maxLongEdge:2560,payloadTargetBytes:16e5,qMin:.7,qMax:.92}};function qe(e){let{deviceMemory:t,effectiveType:n,saveData:r,downlinkMbps:i,sourceLongEdge:l}=e,s=r===!0||n==="slow-2g"||n==="2g"||i!=null&&i>0&&i<1,u=t!=null&&t<=2,c=n==="4g"||i!=null&&i>=5,f=t!=null&&t>=6,p;s||u?p="low":c&&f?p="good":p="mid";let b=Ge[p],S=l&&l>0?Math.min(b.maxLongEdge,l):b.maxLongEdge;return{tier:p,...b,maxLongEdge:S}}function Me(e){let t={};try{let n=navigator;typeof n.deviceMemory=="number"&&(t.deviceMemory=n.deviceMemory);let r=n.connection;r&&(t.effectiveType=r.effectiveType,t.saveData=r.saveData,t.downlinkMbps=r.downlink)}catch{}return typeof e=="number"&&e>0&&(t.sourceLongEdge=e),qe(t)}function He(e,t,n){let r=Math.min(1,Math.max(0,(e-.28)/.21999999999999997)),i=(t+n)/2;return Math.max(t,n-r*(n-i))}function Xe(e,t,n){let r=Math.max(e,t),i=r>0?Math.min(1,n/r):1;return{width:Math.max(1,Math.round(e*i)),height:Math.max(1,Math.round(t*i))}}async function Ve(e,t){let n=t.startQ,r=await e(n);for(let i=0;i<4&&!(r.size<=t.budgetBytes||n<=t.qMin);i++)n=Math.max(t.qMin,n-.08),r=await e(n);return{blob:r,quality:n}}async function ke(e,t,n,r,i){if(t<=0||n<=0)return null;let{width:l,height:s}=Xe(t,n,r.maxLongEdge),u=document.createElement("canvas");u.width=l,u.height=s;let c=u.getContext("2d");if(!c)return null;c.drawImage(e,0,0,l,s);let f=I=>new Promise((h,w)=>{u.toBlob(d=>d?h(d):w(new Error("canvas toBlob returned null")),"image/jpeg",I)}),p=He(i,r.qMin,r.qMax),{blob:b,quality:S}=await Ve(f,{startQ:p,qMin:r.qMin,budgetBytes:r.payloadTargetBytes}).finally(()=>{u.width=0,u.height=0});if(b.size>5242880)throw new Error("encoded document exceeds the 5242880-byte media cap");return{blob:b,quality:S,width:l,height:s}}async function $(e){let t=Me(Math.max(e.width,e.height)),n=await ke(e,e.width,e.height,t,.5);if(n===null)throw new Error("canvas encode unavailable");return{blob:n.blob,width:n.width,height:n.height}}async function dt(e){let t=await createImageBitmap(e);try{return await $(t)}finally{t.close()}}var pt=250,ft=.6,gt=1800,bt=6e3,ht=2e3,De=.16;function Z(e,t){return{layout:e,phase:"framing",captured:{},pending:[],lastCaptureAt:t,lastReportAt:t,manualShutter:!1,restPhase:"framing",readSides:[],needFlip:!1,flipped:!1,flipTimeoutSpent:!1,timeoutCapture:!1,lastShotByTimeout:!1}}var we=e=>e==="recto"?"verso":"recto",Ce=e=>e.phase==="framing"||e.phase==="locking"||e.phase==="flipCue"||e.phase==="reaskRecto",ee=e=>(e.captured.recto!==void 0?1:0)+(e.captured.verso!==void 0?1:0)+e.pending.length;function J(e,t){return e.lastCaptureAt>=0&&e.lastReportAt>=0?e:{...e,lastCaptureAt:e.lastCaptureAt<0?t:e.lastCaptureAt,lastReportAt:e.lastReportAt<0?t:e.lastReportAt}}function Ye(e,t,n){if(e.phase==="result")return{...e,lastReportAt:n};let r=!t.present||e.captureArea!==void 0&&t.areaFrac<.6*e.captureArea,{flipped:i,awaySince:l}=e;r&&(l=l??n),l!==void 0&&n-l>=250&&(i=!0),r||(l=void 0);let s=e.flipTimeoutSpent&&!(i&&!e.flipped),u={...e,lastReportAt:n,flipped:i,awaySince:l,flipTimeoutSpent:s,lastArea:t.areaFrac};if(!Ce(e))return u;if(e.needFlip&&!i){if(!t.ready)return{...u,phase:e.restPhase,goodSince:void 0};let c=e.lastShot!==void 0&&e.pending.includes(e.lastShot);if(s||c)return{...u,goodSince:void 0,phase:e.restPhase};let f=e.goodSince??n;return n-f>=1800?{...u,goodSince:f,phase:"capturing",flipTimeoutSpent:!0,timeoutCapture:!0}:{...u,goodSince:f,phase:e.restPhase}}return t.ready?{...u,phase:"capturing",goodSince:e.goodSince??n}:{...u,goodSince:void 0,phase:t.locking?"locking":e.restPhase}}function Qe(e,t){if(!Ce(e)||e.manualShutter)return e;let n=t-e.lastReportAt>=2e3,r=t-e.lastCaptureAt>=6e3;return n||r?{...e,manualShutter:!0}:e}function Ke(e,t,n){let r=e.layout==="singlePage",i=r?{recto:t}:e.captured,l=r?[]:[...e.pending,t],s={...e,captured:i,pending:l,lastShot:t,lastCaptureAt:n,lastReportAt:-1,manualShutter:!1,goodSince:void 0,notice:void 0,awaySince:void 0,flipped:!1,lastShotByTimeout:e.timeoutCapture,timeoutCapture:!1,captureArea:e.lastArea};return r||ee({captured:i,pending:l})>=2?{...s,phase:"reading",restPhase:"framing",current:void 0,needFlip:!1}:{...s,phase:"flipCue",restPhase:"flipCue",current:void 0,needFlip:!0}}function Re(e,t,n){return e.pending.includes(t)?{...e,pending:e.pending.filter(r=>r!==t),lastShot:e.lastShot===t?void 0:e.lastShot,phase:e.phase==="capturing"?e.phase:"flipCue",restPhase:"flipCue",current:we(n),needFlip:!0,flipTimeoutSpent:!0,goodSince:void 0,manualShutter:!0,notice:"same_face",lastCaptureAt:-1,lastReportAt:-1}:e}function je(e,t,n){if(!e.pending.includes(t))return e;if(e.captured[n]!==void 0)return Re(e,t,n);let r=e.pending.filter(c=>c!==t),i={...e,pending:r,captured:{...e.captured,[n]:t}};if(ee(i)!==1||e.layout==="singlePage")return i;let l=we(n),s=l==="recto"&&e.restPhase==="reaskRecto"?"reaskRecto":"flipCue",u=e.phase==="flipCue"||e.phase==="reaskRecto"||e.phase==="framing";return{...i,restPhase:s,current:l,phase:u?s:e.phase}}function $e(e,t){let n=t.id??e.captured[t.side],r={...e.captured};(t.id===void 0||r[t.side]===t.id)&&delete r[t.side];let i=e.pending.filter(f=>f!==n),l=e.layout==="twoSided"&&ee({captured:r,pending:i})>0,s=e.lastShotByTimeout||n===e.lastShot!==e.flipped,u=l&&!s,c=u?t.side==="recto"?"reaskRecto":"flipCue":"framing";return{...e,captured:r,pending:i,readSides:e.readSides.filter(f=>f!==t.side),lastShot:e.lastShot===n?void 0:e.lastShot,notice:t.issue,goodSince:void 0,manualShutter:!1,phase:c,restPhase:c,current:t.side,needFlip:u,flipped:!1,flipTimeoutSpent:!1,awaySince:void 0,lastCaptureAt:-1,lastReportAt:-1}}function xe(e,t){switch(t.type){case"report":return Ye(J(e,t.at),t.report,t.at);case"tick":return Qe(J(e,t.at),t.at);case"captured":return Ke(J(e,t.at),t.id,t.at);case"captureFailed":return{...e,phase:e.restPhase,goodSince:void 0,lastCaptureAt:t.at,manualShutter:!0,timeoutCapture:!1};case"classified":return je(e,t.id,t.side);case"duplicate":return Re(e,t.id,t.side);case"readOk":{let n=e.readSides.includes(t.side)?e.readSides:[...e.readSides,t.side],r=["recto","verso"].filter(l=>e.captured[l]!==void 0),i=e.phase==="reading"&&e.pending.length===0&&r.every(l=>n.includes(l));return{...e,readSides:n,flipTimeoutSpent:!1,phase:i?"result":e.phase}}case"readFailed":return $e(e,t);case"clockRestart":return e.lastCaptureAt<0&&e.lastReportAt<0&&e.awaySince===void 0?e:{...e,awaySince:void 0,lastCaptureAt:-1,lastReportAt:-1};case"retake":return{...Z(e.layout,-1),lastCaptureAt:-1,lastReportAt:-1};default:return e}}function Je(e,t,n=!1){let r=e(t);return r===null?"recto":!n||r.y+r.height/2>=t.height/2?"verso":"recto"}async function Ze(e,t=!1){let{detectMrzBand:n}=await import("./mrz-band-VYHOTDHY.js");return Je(n,e,t)}async function te(e,t=480,n,r=n!=null){let i=n??{x:0,y:0,width:e.width,height:e.height},l=Math.max(1,Math.round(i.height/i.width*t)),s=document.createElement("canvas");s.width=t,s.height=l;try{let u=s.getContext("2d");return u===null?"recto":(u.drawImage(e,i.x,i.y,i.width,i.height,0,0,t,l),await Ze(u.getImageData(0,0,t,l),r))}finally{s.width=0,s.height=0}}async function St(e,t=480){try{let n=await createImageBitmap(e),r=Math.max(1,Math.round(n.height/n.width*t)),i=document.createElement("canvas");i.width=t,i.height=r;let l=i.getContext("2d");return l===null?(n.close(),null):(l.drawImage(n,0,0,t,r),n.close(),l.getImageData(0,0,t,r))}catch{return null}}var ne=(e,t,n)=>Math.min(n,Math.max(t,Math.round(e))),V=e=>Math.round(Math.min(1,Math.max(0,e))*1e4)/1e4;async function ve(e,t,n,r){let i=r.decode??(c=>createImageBitmap(c)),l=async()=>e.stillRead(await i(t),r.region??[0,0,1,1],r.detectorLimit),s;try{s=await l()}catch{try{await new Promise(c=>setTimeout(c,r.retryMs??300)),s=await l()}catch{return null}}let u=s.mrzBox;return u===void 0?null:{engine:r.engine,source:"live_mrz",format:n.format,lineCount:ne(n.lineCount,2,3),checkDigitsValid:!0,stillConfirmed:s.valid&&s.digest===n.digest,band:[V(u[0]),V(u[1]),V(Math.min(u[2],1-u[0])),V(Math.min(u[3],1-u[1]))],digest:n.digest,framesToValid:ne(n.framesToValid,1,1e3),msToValid:ne(n.msToValid,0,12e4)}}function kt(e){let t=null;return e?.then(n=>{t=n}),()=>t}var et=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]),tt=new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,2,1,0,10,7,1,5,0,6,64,11,11]);function Le(e,t=globalThis){let n=t.WebAssembly?.validate;if(typeof n!="function")return{ok:!1,reason:"simd"};try{if(!n.call(t.WebAssembly,et)||!n.call(t.WebAssembly,tt))return{ok:!1,reason:"simd"}}catch{return{ok:!1,reason:"simd"}}if(typeof t.Worker!="function")return{ok:!1,reason:"worker"};if(typeof t.createImageBitmap!="function")return{ok:!1,reason:"bitmap"};let r=t.navigator?.deviceMemory;return typeof r=="number"&&r<e.minDeviceMemoryGb?{ok:!1,reason:"memory"}:{ok:!0}}function _e(e=globalThis){let t=e.navigator?.connection;return t?.saveData===!0||["slow-2g","2g","3g"].includes(t?.effectiveType??"")}var T=class extends Error{constructor(t){super(t),this.name="OcrEngineError",this.code=t}};function Te(){let e=t=>(t.close(),Promise.reject(new T("unsupported")));return{ready:Promise.resolve("unsupported"),busy:!1,bandRead:e,stillRead:e,layoutRead:e,dispose:()=>{}}}function Ee(e){let t;try{if(e.createWorker)t=e.createWorker();else if(e.workerUrl!==void 0)t=new Worker(e.workerUrl,{type:"module",name:"sekyro-ocr"});else return Te()}catch{return Te()}let n=new Map,r=0,i=!1,l=!1,s=!1;t.addEventListener("message",d=>{let g=d.data,C=n.get(g.id);C&&(n.delete(g.id),C.resolve(g))});let u=()=>{for(let d of n.values())d.reject(new T("error"));n.clear(),f()};t.addEventListener("error",u),t.addEventListener("messageerror",u);function c(d,g=[]){if(i)return Promise.reject(new T("disposed"));let C=++r;return new Promise((B,O)=>{n.set(C,{resolve:B,reject:O});try{t.postMessage({...d,id:C},g)}catch{n.delete(C),O(new T("error"))}})}function f(){if(!i){i=!0;try{t.postMessage({id:++r,kind:"dispose"})}catch{}t.terminate();for(let d of n.values())d.reject(new T("disposed"));n.clear()}}let p=(async()=>{let d=await c({kind:"init",baseUrl:e.baseUrl,salt:e.salt,detectorLimit:e.tuning.detectorLimit,maxDownloadMs:e.tuning.maxDownloadMs});if(d.kind==="failed")return d.reason;if(d.kind!=="ready")return"error";let g=await c({kind:"warmup"});return g.kind!=="ready"?"error":{warmupMs:g.warmupMs,downloadMs:d.downloadMs,cached:d.cached}})().catch(()=>"error"),b,S=new Promise(d=>{b=setTimeout(()=>d("timeout"),e.tuning.loadTimeoutMs)}),I=Promise.race([p,S]).then(d=>(clearTimeout(b),typeof d=="string"?f():s=!0,i&&typeof d!="string"?"error":d));(e.page===void 0?globalThis.addEventListener?globalThis:null:e.page)?.addEventListener("pagehide",f,{once:!0});async function w(d,g,C){if(i)throw g.close(),new T("disposed");if(!s)throw g.close(),new T("not_ready");if(l)throw g.close(),new T("busy");l=!0;let B;try{let O=new Promise((M,A)=>{B=setTimeout(()=>{A(new T("timeout")),f()},e.tuning.readTimeoutMs??1e4)}),P=await Promise.race([c(d,[g]),O]);if(P.kind===C){let{id:M,...A}=P;return A}throw new T(P.kind==="error"?P.code:P.kind==="failed"?P.reason:"error")}finally{clearTimeout(B),l=!1}}return{ready:I,get busy(){return l},bandRead:(d,g=e.tuning.detectorLimit)=>w({kind:"band",bitmap:d,detectorLimit:g},d,"band"),stillRead:(d,g,C=e.tuning.detectorLimit)=>w({kind:"still",bitmap:d,region:g,detectorLimit:C},d,"band"),layoutRead:(d,g)=>w({kind:"layout",bitmap:d,detectorLimit:g},d,"layout"),dispose:f}}var U="sekyro-ocr-1",re=e=>e!==null&&typeof e=="object"?e:{},v=(e,t,n,r)=>typeof e=="number"&&Number.isFinite(e)&&e>=t&&e<=n?e:r,Oe=(e,t)=>typeof e=="boolean"?e:t,Pe=e=>{let t=typeof e=="string"?/^sekyro-ocr-(\d{1,4})$/.exec(e):null;return t?Number(t[1]):Number.POSITIVE_INFINITY};function Ae(e,t={}){let n=re(e),r=re(n.liveMrz),i=re(n.frontLock),l=Pe(t.engine??U),s=t.mode==="off",u=d=>d.enabled===!0?d.arm==="live"?"live":"control":null,c=u(r),f=u(i),p=(d,g)=>!s&&g==="live"&&Pe(d.minEngine??U)<=l,b=ye,S=p(r,c)?{detectorLimit:v(r.detectorLimit,320,1600,b.detectorLimit),bandMaxWidthPx:v(r.bandMaxWidthPx,320,4096,b.bandMaxWidthPx),minBandWidthPx:v(r.minBandWidthPx,0,4096,b.minBandWidthPx),bandTop:v(r.bandTop,0,.95,b.bandTop),minIntervalMs:v(r.minIntervalMs,0,5e3,b.minIntervalMs),stableReads:Math.round(v(r.stableReads,1,10,b.stableReads)),profileReads:Math.round(v(r.profileReads,1,100,b.profileReads)),maxReadMs:v(r.maxReadMs,50,6e4,b.maxReadMs),searchTimeoutMs:v(r.searchTimeoutMs,1e3,12e4,b.searchTimeoutMs),hint:Oe(r.hint,!0),stillConfirm:Oe(r.stillConfirm,!0)}:null,I=he,h=(d,g,C)=>v(i[d],g,C,I[d]),w=p(i,f)?{minLines:Math.round(h("minLines",1,50)),fillMin:h("fillMin",0,1),fillMax:h("fillMax",0,2),offsetMax:h("offsetMax",0,1),steadyFillDelta:h("steadyFillDelta",0,1),steadyOffsetDelta:h("steadyOffsetDelta",0,1),layoutShiftMax:h("layoutShiftMax",0,1),lineCountDelta:Math.round(h("lineCountDelta",0,50)),lockMs:h("lockMs",0,3e4),steadyMs:h("steadyMs",0,3e4),minFrames:Math.round(h("minFrames",1,100)),minIntervalMs:h("minIntervalMs",0,5e3),maxWidthPx:h("maxWidthPx",160,2048),detectorLimit:h("detectorLimit",320,1600),searchTimeoutMs:h("searchTimeoutMs",1e3,12e4)}:null;return{enabled:S!==null||w!==null,liveMrz:S,textLock:w,liveMrzArm:c,frontLockArm:f,load:{detectorLimit:S?.detectorLimit??w?.detectorLimit??b.detectorLimit,loadTimeoutMs:v(r.loadTimeoutMs,1e3,12e4,2e4),maxDownloadMs:v(r.maxDownloadMs,1e3,12e4,2e4),minDeviceMemoryGb:v(r.minDeviceMemoryGb,0,64,2)},reportSampleRate:v(r.reportSampleRate,0,1,1)}}function Be(e,t){return e.enabled?!(t.probe??Le)({minDeviceMemoryGb:e.load.minDeviceMemoryGb}).ok||(t.slow??_e)()?{ok:!1,reason:"unsupported"}:{ok:!0,engine:Ee({baseUrl:t.baseUrl,salt:t.salt,tuning:{detectorLimit:e.load.detectorLimit,maxDownloadMs:e.load.maxDownloadMs,loadTimeoutMs:e.load.loadTimeoutMs},...t.workerUrl!==void 0?{workerUrl:t.workerUrl}:{},...t.createWorker!==void 0?{createWorker:t.createWorker}:{},...t.page!==void 0?{page:t.page}:{}})}:{ok:!1,reason:"off"}}function nt(e=typeof navigator<"u"?navigator.userAgent:""){return/SamsungBrowser\//.test(e)?"samsung":/Firefox\/|FxiOS\//.test(e)?"firefox":/Chrome\/|CriOS\/|Chromium\//.test(e)&&!/Edg\/|OPR\//.test(e)?"chrome":/Safari\//.test(e)&&/Version\/|Mobile\//.test(e)&&!/Chrome\/|CriOS\//.test(e)?"safari":"other"}var W=e=>e===void 0||!Number.isFinite(e)?void 0:Math.min(6e5,Math.max(0,Math.round(e))),oe=(e,t,n)=>e===void 0||!Number.isFinite(e)?void 0:Math.min(n,Math.max(t,Math.round(e)));function Ie(e){let t=e.assist??null,n=e.load!==null&&e.load!==void 0&&typeof e.load=="object"?e.load:null,r=typeof e.load=="string"?e.load:null,i=t!==null?t.outcome:r==="unsupported"||r==="download"||r==="integrity"?r:r==="error"||r==="timeout"?"error":"off",l={kind:"live_mrz",platform:"web",engine:e.engine??U,arm:e.arm,capture:e.capture,outcome:i,reads:oe(t?.reads??0,0,1e4)??0,browser:e.browser??nt()},s=(u,c)=>{c!==void 0&&(l[u]=c)};return s("format",t?.format),s("framesToValid",oe(t?.framesToValid,1,1e4)),s("msToValid",W(t?.msToValid)),s("framesToLock",oe(t?.framesToLock,1,1e4)),s("msToLock",W(t?.msToLock)),s("msToCapture",W(e.msToCapture)),s("readP50Ms",W(t?.readP50Ms)),s("readP90Ms",W(t?.readP90Ms)),s("deviceClass",t?.deviceClass),n!==null&&(s("warmupMs",W(n.warmupMs)),s("downloadMs",W(n.downloadMs)),s("cached",n.cached)),s("stillConfirmed",e.stillConfirmed),s("typeMismatch",e.typeMismatch),l}function ae(e,t){return e===void 0?!1:t==="passport"?e!=="TD3":e==="TD3"}var rt=2;async function ot(e){let t=await import("./capture-session-doc-7LQAOCHJ.js");return new t.CaptureSessionDoc(e)}function at(e){return{topLeft:{x:e.x,y:e.y},topRight:{x:e.x+e.width,y:e.y},bottomRight:{x:e.x+e.width,y:e.y+e.height},bottomLeft:{x:e.x,y:e.y+e.height}}}function it(e,t,n){let r=[e.topLeft,e.topRight,e.bottomRight,e.bottomLeft],i=0;for(let l=0;l<r.length;l+=1){let s=r[l],u=r[(l+1)%r.length];i+=s.x*u.y-u.x*s.y}return t>0&&n>0?Math.abs(i)/2/(t*n):0}function Nt(){import("./capture-session-doc-7LQAOCHJ.js").then(e=>e.warmDocDetector()).catch(()=>{})}function Ut(e){return st(e,{}).handle}function st(e,t){let n=me(),r=pe({enabled:e.keepScreenAwake!==!1}),i=t.decode??(o=>createImageBitmap(o)),l=t.blurRefuseSharpnessMax??.16,s=t.now??(()=>performance.now()),u=e.documentType==="passport"||e.side==="single",c=Z(u?"singlePage":"twoSided",s());if(!u&&(e.side==="recto"||e.side==="verso")){let o=e.side==="recto"?"verso":"recto";c={...c,captured:{[o]:"server"},readSides:[o],current:e.side,phase:"flipCue",restPhase:"flipCue"}}let f="idle",p=null,b=null,S=!0,I=0,h=0,w=!1,d=!1,g="",C=null,B,O=null,P=[],M=t.webOcr!==void 0?Ae(t.webOcr.captureDocument,{mode:e.liveMrz?.mode??"auto"}):null,A=null,F=M===null||!M.enabled?"off":null,G=null,q=null,ie=new WeakMap,Y="";if(M!==null&&M.enabled&&t.webOcr!==void 0){let o=t.webOcr,a=Be(M,{baseUrl:e.liveMrz?.assetBaseUrl??o.baseUrl,salt:o.salt,...e.liveMrz?.workerUrl!==void 0?{workerUrl:e.liveMrz.workerUrl}:{},...o.createWorker!==void 0?{createWorker:o.createWorker}:{}});if(a.ok){A=a.engine;let m=new Se({textLock:M.textLock,liveMrz:M.liveMrz});G=m;let y=a.engine;y.ready.then(L=>{F=L,typeof L!="string"&&S&&m.setEngine(y)})}else F=a.reason}let z=o=>{let a=JSON.stringify(o);a!==Y&&(Y=a,n.emit("mrz",o))},se=(o,a)=>{let m=t.webOcr?.reports;if(m===void 0||M===null||o===void 0)return;let y=o.format==="ID-3"||o.side==="single"?"single":o.side==="verso"?"verso":"recto",L=y!=="recto"?M.liveMrzArm??M.frontLockArm:M.frontLockArm;if(L===null||Math.random()>=M.reportSampleRate)return;let _=o.via==="live_mrz"?q:null,x=()=>{let E=_?.value??null;m([Ie({arm:L,capture:y,assist:o.ocr??null,load:L==="control"?"off":F,...o.msToCapture!==void 0?{msToCapture:o.msToCapture}:{},...E!==null&&E.stillConfirmed!==void 0?{stillConfirmed:E.stillConfirmed}:{},...a!==void 0?{typeMismatch:ae(a.format,e.documentType==="passport"?"passport":"card")}:{}})])};_!==null&&_.value===null?Promise.race([_.promise,new Promise(E=>setTimeout(E,3e3))]).then(x):x()},N=o=>{!S||o===f||(f=o,r.setActive(o==="starting"||o==="scanning"),n.emit("state",o))},We=(o,a)=>a===void 0?null:u?"single":o.captured.recto===a?"recto":o.captured.verso===a?"verso":null,Fe=o=>({phase:o.phase,captured:u?o.captured.recto!==void 0?["single"]:[]:["recto","verso"].filter(a=>o.captured[a]!==void 0),expected:u?null:o.current??null,notice:o.notice??null,lastShot:We(o,o.lastShot),manualShutter:o.manualShutter,torchAvailable:p?.torchAvailable()??!1,torch:d}),ue=()=>{let o=p;o!==null&&o.captureNow().catch(()=>R({type:"captureFailed",at:s()}))};function R(o){if(!S)return;let a=c;c=xe(c,o),c.phase==="capturing"&&a.phase!=="capturing"&&Promise.resolve().then(ue),c.phase==="result"&&a.phase!=="result"&&(N("done"),le());let m=Fe(c),y=JSON.stringify(m);y!==g&&(g=y,n.emit("scan",m))}function le(){O!==null&&clearInterval(O),O=null;for(let o of P.splice(0))o();p?.destroy(),p=null,r.setActive(!1)}let ce=()=>p?.captureReport?.(),Q=!1,de=(o,a)=>{if(!(o===void 0||t.onFaceReport===void 0))try{t.onFaceReport(o,a)}catch{}},H=o=>{Y="",!(p===null||c.phase==="reading"||c.phase==="result")&&(Q=!1,p.rearm(u?"single":c.current??o))},ze=async(o,a,m,y)=>{if(q=null,y!==void 0&&A!==null&&M?.liveMrz?.hint===!0){let D={promise:ve(A,o,y,{engine:U,detectorLimit:M.liveMrz.detectorLimit}).catch(()=>null),value:null};D.promise.then(k=>{D.value=k}),q=D}y!==void 0&&ae(y.format,e.documentType==="passport"?"passport":"card")&&z({state:"mismatch",format:y.format});let L=ce();de(L,"captured"),Q=!0,se(L,y);let _=m===void 0?C:m===null?null:{quad:at(m),frameWidth:0,frameHeight:0,inStill:!0},x={decoded:null},E=()=>(x.decoded??(x.decoded=Promise.resolve().then(()=>i(o)).catch(()=>null)),x.decoded);try{await Ne(o,a,_,E,q)}finally{x.decoded!==null&&(await x.decoded)?.close()}},Ne=async(o,a,m,y,L)=>{let _=`shot-${I+=1}`;if(R({type:"captured",id:_,at:s()}),e.haptics!==!1)try{globalThis.navigator?.vibrate?.(30)}catch{}if(!w&&l>0){let D=await(t.measureSharpness!==void 0?t.measureSharpness(o,m):y().then(k=>k===null?-1:be(k,j(m?.quad??null,m?.inStill===!0?k:{width:m?.frameWidth??0,height:m?.frameHeight??0},k)))).catch(()=>-1);if(!S)return;if(Number.isFinite(D)&&D>=0&&D<l){w=!0;let k=u?"recto":c.current??(c.captured.recto===void 0?"recto":"verso");R({type:"readFailed",side:k,id:_,issue:"blurry"}),H(k);return}}w=!1;let x;if(u)x="single";else{let D=c.current,k=await(t.classify!==void 0?t.classify(o):y().then(X=>X===null?D??"recto":m?.inStill===!0?te(X,480,null,!0):te(X,480,j(m?.quad??null,{width:m?.frameWidth??0,height:m?.frameHeight??0},X)))).catch(()=>D??"recto");if(!S)return;if(c.captured[k]!==void 0&&h<rt){h+=1,R({type:"duplicate",id:_,side:k}),H(k==="recto"?"verso":"recto");return}x=c.captured[k]!==void 0&&D!==void 0?D:k,h=0,R({type:"classified",id:_,side:x})}let E=x==="verso"?"verso":"recto";try{let D=t.encode!==void 0?await t.encode(o):await y().then(k=>{if(k===null)throw new Error("the still could not be decoded");return $(k)});if(!S)return;L!==null&&ie.set(D.blob,L),n.emit("captured",{image:D.blob,side:x,documentType:e.documentType,...e.issuer!==void 0?{issuer:e.issuer}:{},width:D.width,height:D.height,previewDataUrl:a}),t.deferRead!==!0&&R({type:"readOk",side:E})}catch{R({type:"readFailed",side:E,id:_,issue:"technical"}),n.emit("error",{kind:"generic",retryable:!0})}H(E==="recto"?"verso":"recto")},Ue=o=>{P.push(o.on("statechange",({state:a})=>{a==="preflight"||a==="acquiring"?N("starting"):a==="positioning"?N("scanning"):a==="captured"?N("captured"):a==="error"&&N("error")}),o.on("feedback",({key:a,reticle:m})=>n.emit("feedback",{key:a,reticle:m})),o.on("checks",a=>{n.emit("gate",{progress:a.p,quad:a.quad,frameWidth:a.frameWidth,frameHeight:a.frameHeight,...a.guide!==void 0?{guide:{detected:a.guide.detected,fill:a.guide.fill,offsetX:a.guide.offsetX??0,offsetY:a.guide.offsetY??0}}:{}});let m=a.ocr?.mrz;m!==void 0&&(m.state==="fallback"?z({state:"fallback",reason:m.reason}):m.state==="valid"?z({state:"valid",format:m.format}):m.state==="reading"?z({state:"reading",...m.format?{format:m.format}:{},...m.coach?{coach:m.coach}:{}}):z({state:"searching"}));let y=a.quad===null?0:it(a.quad,a.frameWidth,a.frameHeight);C=a.quad===null?null:{quad:a.quad,frameWidth:a.frameWidth,frameHeight:a.frameHeight},R({type:"report",report:{present:a.quad!==null&&a.plausible||a.guide?.detected===!0,ready:a.ready===!0,locking:a.p>=.5,areaFrac:y},at:s()})}),o.on("error",({kind:a,retryable:m})=>n.emit("error",{kind:fe(a),retryable:m})),o.on("artifacts",a=>{ze(a.keyframe,a.previewDataUrl,a.docRegion,a.liveMrz)}))},K=()=>(b??(b=(async()=>{if(S){if(p===null){let o=await(t.createEngine??ot)({...t.engineOptions??{},...B!==void 0?{guide:B}:{},video:e.video,format:ge(e.documentType),side:u?"single":e.side??"recto",autoCapture:!1,...G!==null?{ocr:G}:{}});if(!S){o.destroy();return}p=o,Ue(o);let a=t.tickMs??500;a>0&&(O=setInterval(()=>R({type:"tick",at:s()}),a))}R({type:"clockRestart"}),M!==null&&M.liveMrzArm==="live"&&(F==="unsupported"||F==="off")&&z({state:"fallback",reason:F}),await p.start()}})().finally(()=>{b=null})),b);return{handle:{get state(){return f},on:(o,a)=>n.on(o,a),start:K,retry:()=>{if(p===null&&c.phase==="result"){R({type:"retake"}),h=0,w=!1,K();return}if(p!==null&&f!=="error"){R({type:"retake"}),h=0,w=!1,p.rearm(u?"single":void 0);return}K()},setSide:o=>{u||o==="single"||(c.current!==o&&(c={...c,current:o}),R({type:"clockRestart"}),c.phase!=="reading"&&c.phase!=="result"&&p?.rearm(o))},shutter:ue,focusAt:(o,a)=>{p?.focusAt?.(o,a)},setGuide:o=>{B=o,p?.setGuide?.(o)},setTorch:o=>{d=o,p?.setTorch(o),R({type:"tick",at:s()})},destroy:()=>{if(S&&p!==null&&f!=="done"){let o=ce();!Q&&o!==void 0&&o.ticks>0&&de(o,"abandoned"),se(o,void 0)}S=!1,le(),G?.setEngine(null),A?.dispose(),A=null,n.clear()}},setFlowState:o=>{(c.phase==="reading"||c.phase==="result")&&N(o==="done"&&c.phase!=="result"?"scanning":o)},settle:(o,a)=>{let m=o==="verso"?"verso":"recto";R(a.ok?{type:"readOk",side:m}:{type:"readFailed",side:m,issue:a.issue}),a.ok||H(m)},takeDeviceRead:o=>ie.get(o.image)?.value??null}}export{dt as a,pt as b,ft as c,gt as d,bt as e,ht as f,De as g,Z as h,xe as i,Je as j,Ze as k,St as l,ve as m,kt as n,U as o,Ae as p,Be as q,nt as r,Ie as s,ae as t,rt as u,Nt as v,Ut as w,st as x};
1
+ import{d as j,h as be,i as he,j as ye,l as Se}from"./chunk-G6LKLN4U.js";import{f as ge}from"./chunk-TDLIXFDT.js";import{l as fe}from"./chunk-YKXG7GME.js";import{a as me,e as pe}from"./chunk-GT2ZLGF7.js";var Ge={low:{maxLongEdge:1920,payloadTargetBytes:7e5,qMin:.7,qMax:.92},mid:{maxLongEdge:2240,payloadTargetBytes:12e5,qMin:.7,qMax:.92},good:{maxLongEdge:2560,payloadTargetBytes:16e5,qMin:.7,qMax:.92}};function qe(e){let{deviceMemory:t,effectiveType:n,saveData:r,downlinkMbps:i,sourceLongEdge:l}=e,s=r===!0||n==="slow-2g"||n==="2g"||i!=null&&i>0&&i<1,u=t!=null&&t<=2,c=n==="4g"||i!=null&&i>=5,f=t!=null&&t>=6,p;s||u?p="low":c&&f?p="good":p="mid";let b=Ge[p],S=l&&l>0?Math.min(b.maxLongEdge,l):b.maxLongEdge;return{tier:p,...b,maxLongEdge:S}}function Me(e){let t={};try{let n=navigator;typeof n.deviceMemory=="number"&&(t.deviceMemory=n.deviceMemory);let r=n.connection;r&&(t.effectiveType=r.effectiveType,t.saveData=r.saveData,t.downlinkMbps=r.downlink)}catch{}return typeof e=="number"&&e>0&&(t.sourceLongEdge=e),qe(t)}function He(e,t,n){let r=Math.min(1,Math.max(0,(e-.28)/.21999999999999997)),i=(t+n)/2;return Math.max(t,n-r*(n-i))}function Xe(e,t,n){let r=Math.max(e,t),i=r>0?Math.min(1,n/r):1;return{width:Math.max(1,Math.round(e*i)),height:Math.max(1,Math.round(t*i))}}async function Ve(e,t){let n=t.startQ,r=await e(n);for(let i=0;i<4&&!(r.size<=t.budgetBytes||n<=t.qMin);i++)n=Math.max(t.qMin,n-.08),r=await e(n);return{blob:r,quality:n}}async function ke(e,t,n,r,i){if(t<=0||n<=0)return null;let{width:l,height:s}=Xe(t,n,r.maxLongEdge),u=document.createElement("canvas");u.width=l,u.height=s;let c=u.getContext("2d");if(!c)return null;c.drawImage(e,0,0,l,s);let f=I=>new Promise((h,w)=>{u.toBlob(d=>d?h(d):w(new Error("canvas toBlob returned null")),"image/jpeg",I)}),p=He(i,r.qMin,r.qMax),{blob:b,quality:S}=await Ve(f,{startQ:p,qMin:r.qMin,budgetBytes:r.payloadTargetBytes}).finally(()=>{u.width=0,u.height=0});if(b.size>5242880)throw new Error("encoded document exceeds the 5242880-byte media cap");return{blob:b,quality:S,width:l,height:s}}async function $(e){let t=Me(Math.max(e.width,e.height)),n=await ke(e,e.width,e.height,t,.5);if(n===null)throw new Error("canvas encode unavailable");return{blob:n.blob,width:n.width,height:n.height}}async function dt(e){let t=await createImageBitmap(e);try{return await $(t)}finally{t.close()}}var pt=250,ft=.6,gt=1800,bt=6e3,ht=2e3,De=.16;function Z(e,t){return{layout:e,phase:"framing",captured:{},pending:[],lastCaptureAt:t,lastReportAt:t,manualShutter:!1,restPhase:"framing",readSides:[],needFlip:!1,flipped:!1,flipTimeoutSpent:!1,timeoutCapture:!1,lastShotByTimeout:!1}}var we=e=>e==="recto"?"verso":"recto",Ce=e=>e.phase==="framing"||e.phase==="locking"||e.phase==="flipCue"||e.phase==="reaskRecto",ee=e=>(e.captured.recto!==void 0?1:0)+(e.captured.verso!==void 0?1:0)+e.pending.length;function J(e,t){return e.lastCaptureAt>=0&&e.lastReportAt>=0?e:{...e,lastCaptureAt:e.lastCaptureAt<0?t:e.lastCaptureAt,lastReportAt:e.lastReportAt<0?t:e.lastReportAt}}function Ye(e,t,n){if(e.phase==="result")return{...e,lastReportAt:n};let r=!t.present||e.captureArea!==void 0&&t.areaFrac<.6*e.captureArea,{flipped:i,awaySince:l}=e;r&&(l=l??n),l!==void 0&&n-l>=250&&(i=!0),r||(l=void 0);let s=e.flipTimeoutSpent&&!(i&&!e.flipped),u={...e,lastReportAt:n,flipped:i,awaySince:l,flipTimeoutSpent:s,lastArea:t.areaFrac};if(!Ce(e))return u;if(e.needFlip&&!i){if(!t.ready)return{...u,phase:e.restPhase,goodSince:void 0};let c=e.lastShot!==void 0&&e.pending.includes(e.lastShot);if(s||c)return{...u,goodSince:void 0,phase:e.restPhase};let f=e.goodSince??n;return n-f>=1800?{...u,goodSince:f,phase:"capturing",flipTimeoutSpent:!0,timeoutCapture:!0}:{...u,goodSince:f,phase:e.restPhase}}return t.ready?{...u,phase:"capturing",goodSince:e.goodSince??n}:{...u,goodSince:void 0,phase:t.locking?"locking":e.restPhase}}function Qe(e,t){if(!Ce(e)||e.manualShutter)return e;let n=t-e.lastReportAt>=2e3,r=t-e.lastCaptureAt>=6e3;return n||r?{...e,manualShutter:!0}:e}function Ke(e,t,n){let r=e.layout==="singlePage",i=r?{recto:t}:e.captured,l=r?[]:[...e.pending,t],s={...e,captured:i,pending:l,lastShot:t,lastCaptureAt:n,lastReportAt:-1,manualShutter:!1,goodSince:void 0,notice:void 0,awaySince:void 0,flipped:!1,lastShotByTimeout:e.timeoutCapture,timeoutCapture:!1,captureArea:e.lastArea};return r||ee({captured:i,pending:l})>=2?{...s,phase:"reading",restPhase:"framing",current:void 0,needFlip:!1}:{...s,phase:"flipCue",restPhase:"flipCue",current:void 0,needFlip:!0}}function Re(e,t,n){return e.pending.includes(t)?{...e,pending:e.pending.filter(r=>r!==t),lastShot:e.lastShot===t?void 0:e.lastShot,phase:e.phase==="capturing"?e.phase:"flipCue",restPhase:"flipCue",current:we(n),needFlip:!0,flipTimeoutSpent:!0,goodSince:void 0,manualShutter:!0,notice:"same_face",lastCaptureAt:-1,lastReportAt:-1}:e}function je(e,t,n){if(!e.pending.includes(t))return e;if(e.captured[n]!==void 0)return Re(e,t,n);let r=e.pending.filter(c=>c!==t),i={...e,pending:r,captured:{...e.captured,[n]:t}};if(ee(i)!==1||e.layout==="singlePage")return i;let l=we(n),s=l==="recto"&&e.restPhase==="reaskRecto"?"reaskRecto":"flipCue",u=e.phase==="flipCue"||e.phase==="reaskRecto"||e.phase==="framing";return{...i,restPhase:s,current:l,phase:u?s:e.phase}}function $e(e,t){let n=t.id??e.captured[t.side],r={...e.captured};(t.id===void 0||r[t.side]===t.id)&&delete r[t.side];let i=e.pending.filter(f=>f!==n),l=e.layout==="twoSided"&&ee({captured:r,pending:i})>0,s=e.lastShotByTimeout||n===e.lastShot!==e.flipped,u=l&&!s,c=u?t.side==="recto"?"reaskRecto":"flipCue":"framing";return{...e,captured:r,pending:i,readSides:e.readSides.filter(f=>f!==t.side),lastShot:e.lastShot===n?void 0:e.lastShot,notice:t.issue,goodSince:void 0,manualShutter:!1,phase:c,restPhase:c,current:t.side,needFlip:u,flipped:!1,flipTimeoutSpent:!1,awaySince:void 0,lastCaptureAt:-1,lastReportAt:-1}}function xe(e,t){switch(t.type){case"report":return Ye(J(e,t.at),t.report,t.at);case"tick":return Qe(J(e,t.at),t.at);case"captured":return Ke(J(e,t.at),t.id,t.at);case"captureFailed":return{...e,phase:e.restPhase,goodSince:void 0,lastCaptureAt:t.at,manualShutter:!0,timeoutCapture:!1};case"classified":return je(e,t.id,t.side);case"duplicate":return Re(e,t.id,t.side);case"readOk":{let n=e.readSides.includes(t.side)?e.readSides:[...e.readSides,t.side],r=["recto","verso"].filter(l=>e.captured[l]!==void 0),i=e.phase==="reading"&&e.pending.length===0&&r.every(l=>n.includes(l));return{...e,readSides:n,flipTimeoutSpent:!1,phase:i?"result":e.phase}}case"readFailed":return $e(e,t);case"clockRestart":return e.lastCaptureAt<0&&e.lastReportAt<0&&e.awaySince===void 0?e:{...e,awaySince:void 0,lastCaptureAt:-1,lastReportAt:-1};case"retake":return{...Z(e.layout,-1),lastCaptureAt:-1,lastReportAt:-1};default:return e}}function Je(e,t,n=!1){let r=e(t);return r===null?"recto":!n||r.y+r.height/2>=t.height/2?"verso":"recto"}async function Ze(e,t=!1){let{detectMrzBand:n}=await import("./mrz-band-VYHOTDHY.js");return Je(n,e,t)}async function te(e,t=480,n,r=n!=null){let i=n??{x:0,y:0,width:e.width,height:e.height},l=Math.max(1,Math.round(i.height/i.width*t)),s=document.createElement("canvas");s.width=t,s.height=l;try{let u=s.getContext("2d");return u===null?"recto":(u.drawImage(e,i.x,i.y,i.width,i.height,0,0,t,l),await Ze(u.getImageData(0,0,t,l),r))}finally{s.width=0,s.height=0}}async function St(e,t=480){try{let n=await createImageBitmap(e),r=Math.max(1,Math.round(n.height/n.width*t)),i=document.createElement("canvas");i.width=t,i.height=r;let l=i.getContext("2d");return l===null?(n.close(),null):(l.drawImage(n,0,0,t,r),n.close(),l.getImageData(0,0,t,r))}catch{return null}}var ne=(e,t,n)=>Math.min(n,Math.max(t,Math.round(e))),V=e=>Math.round(Math.min(1,Math.max(0,e))*1e4)/1e4;async function ve(e,t,n,r){let i=r.decode??(c=>createImageBitmap(c)),l=async()=>e.stillRead(await i(t),r.region??[0,0,1,1],r.detectorLimit),s;try{s=await l()}catch{try{await new Promise(c=>setTimeout(c,r.retryMs??300)),s=await l()}catch{return null}}let u=s.mrzBox;return u===void 0?null:{engine:r.engine,source:"live_mrz",format:n.format,lineCount:ne(n.lineCount,2,3),checkDigitsValid:!0,stillConfirmed:s.valid&&s.digest===n.digest,band:[V(u[0]),V(u[1]),V(Math.min(u[2],1-u[0])),V(Math.min(u[3],1-u[1]))],digest:n.digest,framesToValid:ne(n.framesToValid,1,1e3),msToValid:ne(n.msToValid,0,12e4)}}function kt(e){let t=null;return e?.then(n=>{t=n}),()=>t}var et=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]),tt=new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,2,1,0,10,7,1,5,0,6,64,11,11]);function Le(e,t=globalThis){let n=t.WebAssembly?.validate;if(typeof n!="function")return{ok:!1,reason:"simd"};try{if(!n.call(t.WebAssembly,et)||!n.call(t.WebAssembly,tt))return{ok:!1,reason:"simd"}}catch{return{ok:!1,reason:"simd"}}if(typeof t.Worker!="function")return{ok:!1,reason:"worker"};if(typeof t.createImageBitmap!="function")return{ok:!1,reason:"bitmap"};let r=t.navigator?.deviceMemory;return typeof r=="number"&&r<e.minDeviceMemoryGb?{ok:!1,reason:"memory"}:{ok:!0}}function _e(e=globalThis){let t=e.navigator?.connection;return t?.saveData===!0||["slow-2g","2g","3g"].includes(t?.effectiveType??"")}var T=class extends Error{constructor(t){super(t),this.name="OcrEngineError",this.code=t}};function Te(){let e=t=>(t.close(),Promise.reject(new T("unsupported")));return{ready:Promise.resolve("unsupported"),busy:!1,bandRead:e,stillRead:e,layoutRead:e,dispose:()=>{}}}function Ee(e){let t;try{if(e.createWorker)t=e.createWorker();else if(e.workerUrl!==void 0)t=new Worker(e.workerUrl,{type:"module",name:"sekyro-ocr"});else return Te()}catch{return Te()}let n=new Map,r=0,i=!1,l=!1,s=!1;t.addEventListener("message",d=>{let g=d.data,C=n.get(g.id);C&&(n.delete(g.id),C.resolve(g))});let u=()=>{for(let d of n.values())d.reject(new T("error"));n.clear(),f()};t.addEventListener("error",u),t.addEventListener("messageerror",u);function c(d,g=[]){if(i)return Promise.reject(new T("disposed"));let C=++r;return new Promise((B,O)=>{n.set(C,{resolve:B,reject:O});try{t.postMessage({...d,id:C},g)}catch{n.delete(C),O(new T("error"))}})}function f(){if(!i){i=!0;try{t.postMessage({id:++r,kind:"dispose"})}catch{}t.terminate();for(let d of n.values())d.reject(new T("disposed"));n.clear()}}let p=(async()=>{let d=await c({kind:"init",baseUrl:e.baseUrl,salt:e.salt,detectorLimit:e.tuning.detectorLimit,maxDownloadMs:e.tuning.maxDownloadMs});if(d.kind==="failed")return d.reason;if(d.kind!=="ready")return"error";let g=await c({kind:"warmup"});return g.kind!=="ready"?"error":{warmupMs:g.warmupMs,downloadMs:d.downloadMs,cached:d.cached}})().catch(()=>"error"),b,S=new Promise(d=>{b=setTimeout(()=>d("timeout"),e.tuning.loadTimeoutMs)}),I=Promise.race([p,S]).then(d=>(clearTimeout(b),typeof d=="string"?f():s=!0,i&&typeof d!="string"?"error":d));(e.page===void 0?globalThis.addEventListener?globalThis:null:e.page)?.addEventListener("pagehide",f,{once:!0});async function w(d,g,C){if(i)throw g.close(),new T("disposed");if(!s)throw g.close(),new T("not_ready");if(l)throw g.close(),new T("busy");l=!0;let B;try{let O=new Promise((M,A)=>{B=setTimeout(()=>{A(new T("timeout")),f()},e.tuning.readTimeoutMs??1e4)}),P=await Promise.race([c(d,[g]),O]);if(P.kind===C){let{id:M,...A}=P;return A}throw new T(P.kind==="error"?P.code:P.kind==="failed"?P.reason:"error")}finally{clearTimeout(B),l=!1}}return{ready:I,get busy(){return l},bandRead:(d,g=e.tuning.detectorLimit)=>w({kind:"band",bitmap:d,detectorLimit:g},d,"band"),stillRead:(d,g,C=e.tuning.detectorLimit)=>w({kind:"still",bitmap:d,region:g,detectorLimit:C},d,"band"),layoutRead:(d,g)=>w({kind:"layout",bitmap:d,detectorLimit:g},d,"layout"),dispose:f}}var U="sekyro-ocr-1",re=e=>e!==null&&typeof e=="object"?e:{},v=(e,t,n,r)=>typeof e=="number"&&Number.isFinite(e)&&e>=t&&e<=n?e:r,Oe=(e,t)=>typeof e=="boolean"?e:t,Pe=e=>{let t=typeof e=="string"?/^sekyro-ocr-(\d{1,4})$/.exec(e):null;return t?Number(t[1]):Number.POSITIVE_INFINITY};function Ae(e,t={}){let n=re(e),r=re(n.liveMrz),i=re(n.frontLock),l=Pe(t.engine??U),s=t.mode==="off",u=d=>d.enabled===!0?d.arm==="live"?"live":"control":null,c=u(r),f=u(i),p=(d,g)=>!s&&g==="live"&&Pe(d.minEngine??U)<=l,b=ye,S=p(r,c)?{detectorLimit:v(r.detectorLimit,320,1600,b.detectorLimit),bandMaxWidthPx:v(r.bandMaxWidthPx,320,4096,b.bandMaxWidthPx),minBandWidthPx:v(r.minBandWidthPx,0,4096,b.minBandWidthPx),bandTop:v(r.bandTop,0,.95,b.bandTop),minIntervalMs:v(r.minIntervalMs,0,5e3,b.minIntervalMs),stableReads:Math.round(v(r.stableReads,1,10,b.stableReads)),profileReads:Math.round(v(r.profileReads,1,100,b.profileReads)),maxReadMs:v(r.maxReadMs,50,6e4,b.maxReadMs),searchTimeoutMs:v(r.searchTimeoutMs,1e3,12e4,b.searchTimeoutMs),hint:Oe(r.hint,!0),stillConfirm:Oe(r.stillConfirm,!0)}:null,I=he,h=(d,g,C)=>v(i[d],g,C,I[d]),w=p(i,f)?{minLines:Math.round(h("minLines",1,50)),fillMin:h("fillMin",0,1),fillMax:h("fillMax",0,2),offsetMax:h("offsetMax",0,1),steadyFillDelta:h("steadyFillDelta",0,1),steadyOffsetDelta:h("steadyOffsetDelta",0,1),layoutShiftMax:h("layoutShiftMax",0,1),lineCountDelta:Math.round(h("lineCountDelta",0,50)),lockMs:h("lockMs",0,3e4),steadyMs:h("steadyMs",0,3e4),minFrames:Math.round(h("minFrames",1,100)),minIntervalMs:h("minIntervalMs",0,5e3),maxWidthPx:h("maxWidthPx",160,2048),detectorLimit:h("detectorLimit",320,1600),searchTimeoutMs:h("searchTimeoutMs",1e3,12e4)}:null;return{enabled:S!==null||w!==null,liveMrz:S,textLock:w,liveMrzArm:c,frontLockArm:f,load:{detectorLimit:S?.detectorLimit??w?.detectorLimit??b.detectorLimit,loadTimeoutMs:v(r.loadTimeoutMs,1e3,12e4,2e4),maxDownloadMs:v(r.maxDownloadMs,1e3,12e4,2e4),minDeviceMemoryGb:v(r.minDeviceMemoryGb,0,64,2)},reportSampleRate:v(r.reportSampleRate,0,1,1)}}function Be(e,t){return e.enabled?!(t.probe??Le)({minDeviceMemoryGb:e.load.minDeviceMemoryGb}).ok||(t.slow??_e)()?{ok:!1,reason:"unsupported"}:{ok:!0,engine:Ee({baseUrl:t.baseUrl,salt:t.salt,tuning:{detectorLimit:e.load.detectorLimit,maxDownloadMs:e.load.maxDownloadMs,loadTimeoutMs:e.load.loadTimeoutMs},...t.workerUrl!==void 0?{workerUrl:t.workerUrl}:{},...t.createWorker!==void 0?{createWorker:t.createWorker}:{},...t.page!==void 0?{page:t.page}:{}})}:{ok:!1,reason:"off"}}function nt(e=typeof navigator<"u"?navigator.userAgent:""){return/SamsungBrowser\//.test(e)?"samsung":/Firefox\/|FxiOS\//.test(e)?"firefox":/Chrome\/|CriOS\/|Chromium\//.test(e)&&!/Edg\/|OPR\//.test(e)?"chrome":/Safari\//.test(e)&&/Version\/|Mobile\//.test(e)&&!/Chrome\/|CriOS\//.test(e)?"safari":"other"}var F=e=>e===void 0||!Number.isFinite(e)?void 0:Math.min(6e5,Math.max(0,Math.round(e))),oe=(e,t,n)=>e===void 0||!Number.isFinite(e)?void 0:Math.min(n,Math.max(t,Math.round(e)));function Ie(e){let t=e.assist??null,n=e.load!==null&&e.load!==void 0&&typeof e.load=="object"?e.load:null,r=typeof e.load=="string"?e.load:null,i=t!==null?t.outcome:r==="unsupported"||r==="download"||r==="integrity"?r:r==="error"||r==="timeout"?"error":"off",l={kind:"live_mrz",platform:"web",engine:e.engine??U,arm:e.arm,capture:e.capture,outcome:i,reads:oe(t?.reads??0,0,1e4)??0,browser:e.browser??nt()},s=(u,c)=>{c!==void 0&&(l[u]=c)};return s("format",t?.format),s("framesToValid",oe(t?.framesToValid,1,1e4)),s("msToValid",F(t?.msToValid)),s("framesToLock",oe(t?.framesToLock,1,1e4)),s("msToLock",F(t?.msToLock)),s("msToCapture",F(e.msToCapture)),s("readP50Ms",F(t?.readP50Ms)),s("readP90Ms",F(t?.readP90Ms)),s("deviceClass",t?.deviceClass),n!==null&&(s("warmupMs",F(n.warmupMs)),s("downloadMs",F(n.downloadMs)),s("cached",n.cached)),s("stillConfirmed",e.stillConfirmed),s("typeMismatch",e.typeMismatch),l}function ae(e,t){return e===void 0?!1:t==="passport"?e!=="TD3":e==="TD3"}var rt=2;async function ot(e){let t=await import("./capture-session-doc-J2CJELJ7.js");return new t.CaptureSessionDoc(e)}function at(e){return{topLeft:{x:e.x,y:e.y},topRight:{x:e.x+e.width,y:e.y},bottomRight:{x:e.x+e.width,y:e.y+e.height},bottomLeft:{x:e.x,y:e.y+e.height}}}function it(e,t,n){let r=[e.topLeft,e.topRight,e.bottomRight,e.bottomLeft],i=0;for(let l=0;l<r.length;l+=1){let s=r[l],u=r[(l+1)%r.length];i+=s.x*u.y-u.x*s.y}return t>0&&n>0?Math.abs(i)/2/(t*n):0}function Nt(){import("./capture-session-doc-J2CJELJ7.js").then(e=>e.warmDocDetector()).catch(()=>{})}function Ut(e){return st(e,{}).handle}function st(e,t){let n=me(),r=pe({enabled:e.keepScreenAwake!==!1}),i=t.decode??(o=>createImageBitmap(o)),l=t.blurRefuseSharpnessMax??.16,s=t.now??(()=>performance.now()),u=e.documentType==="passport"||e.side==="single",c=Z(u?"singlePage":"twoSided",s());if(!u&&(e.side==="recto"||e.side==="verso")){let o=e.side==="recto"?"verso":"recto";c={...c,captured:{[o]:"server"},readSides:[o],current:e.side,phase:"flipCue",restPhase:"flipCue"}}let f="idle",p=null,b=null,S=!0,I=0,h=0,w=!1,d=!1,g="",C=null,B,O=null,P=[],M=t.webOcr!==void 0?Ae(t.webOcr.captureDocument,{mode:e.liveMrz?.mode??"auto"}):null,A=null,z=M===null||!M.enabled?"off":null,G=null,q=null,ie=new WeakMap,Y="";if(M!==null&&M.enabled&&t.webOcr!==void 0){let o=t.webOcr,a=Be(M,{baseUrl:e.liveMrz?.assetBaseUrl??o.baseUrl,salt:o.salt,...e.liveMrz?.workerUrl!==void 0?{workerUrl:e.liveMrz.workerUrl}:{},...o.createWorker!==void 0?{createWorker:o.createWorker}:{}});if(a.ok){A=a.engine;let m=new Se({textLock:M.textLock,liveMrz:M.liveMrz});G=m;let y=a.engine;y.ready.then(L=>{z=L,typeof L!="string"&&S&&m.setEngine(y)})}else z=a.reason}let N=o=>{let a=JSON.stringify(o);a!==Y&&(Y=a,n.emit("mrz",o))},se=(o,a)=>{let m=t.webOcr?.reports;if(m===void 0||M===null||o===void 0)return;let y=o.format==="ID-3"||o.side==="single"?"single":o.side==="verso"?"verso":"recto",L=y!=="recto"?M.liveMrzArm??M.frontLockArm:M.frontLockArm;if(L===null||Math.random()>=M.reportSampleRate)return;let _=o.via==="live_mrz"?q:null,x=()=>{let E=_?.value??null;m([Ie({arm:L,capture:y,assist:o.ocr??null,load:L==="control"?"off":z,...o.msToCapture!==void 0?{msToCapture:o.msToCapture}:{},...E!==null&&E.stillConfirmed!==void 0?{stillConfirmed:E.stillConfirmed}:{},...a!==void 0?{typeMismatch:ae(a.format,e.documentType==="passport"?"passport":"card")}:{}})])};_!==null&&_.value===null?Promise.race([_.promise,new Promise(E=>setTimeout(E,3e3))]).then(x):x()},W=o=>{!S||o===f||(f=o,r.setActive(o==="starting"||o==="scanning"),n.emit("state",o))},We=(o,a)=>a===void 0?null:u?"single":o.captured.recto===a?"recto":o.captured.verso===a?"verso":null,Fe=o=>({phase:o.phase,captured:u?o.captured.recto!==void 0?["single"]:[]:["recto","verso"].filter(a=>o.captured[a]!==void 0),expected:u?null:o.current??null,notice:o.notice??null,lastShot:We(o,o.lastShot),manualShutter:o.manualShutter,torchAvailable:p?.torchAvailable()??!1,torch:d}),ue=()=>{let o=p;o!==null&&o.captureNow().catch(()=>R({type:"captureFailed",at:s()}))};function R(o){if(!S)return;let a=c;c=xe(c,o),c.phase==="capturing"&&a.phase!=="capturing"&&Promise.resolve().then(ue),c.phase==="result"&&a.phase!=="result"&&(W("done"),le());let m=Fe(c),y=JSON.stringify(m);y!==g&&(g=y,n.emit("scan",m))}function le(){O!==null&&clearInterval(O),O=null;for(let o of P.splice(0))o();p?.destroy(),p=null,r.setActive(!1)}let ce=()=>p?.captureReport?.(),Q=!1,de=(o,a)=>{if(!(o===void 0||t.onFaceReport===void 0))try{t.onFaceReport(o,a)}catch{}},H=o=>{Y="",!(p===null||c.phase==="reading"||c.phase==="result")&&(Q=!1,p.rearm(u?"single":c.current??o))},ze=async(o,a,m,y)=>{if(q=null,y!==void 0&&A!==null&&M?.liveMrz?.hint===!0){let D={promise:ve(A,o,y,{engine:U,detectorLimit:M.liveMrz.detectorLimit}).catch(()=>null),value:null};D.promise.then(k=>{D.value=k}),q=D}y!==void 0&&ae(y.format,e.documentType==="passport"?"passport":"card")&&N({state:"mismatch",format:y.format});let L=ce();de(L,"captured"),Q=!0,se(L,y);let _=m===void 0?C:m===null?null:{quad:at(m),frameWidth:0,frameHeight:0,inStill:!0},x={decoded:null},E=()=>(x.decoded??(x.decoded=Promise.resolve().then(()=>i(o)).catch(()=>null)),x.decoded);try{await Ne(o,a,_,E,q)}finally{x.decoded!==null&&(await x.decoded)?.close()}},Ne=async(o,a,m,y,L)=>{let _=`shot-${I+=1}`;if(R({type:"captured",id:_,at:s()}),e.haptics!==!1)try{globalThis.navigator?.vibrate?.(30)}catch{}if(!w&&l>0){let D=await(t.measureSharpness!==void 0?t.measureSharpness(o,m):y().then(k=>k===null?-1:be(k,j(m?.quad??null,m?.inStill===!0?k:{width:m?.frameWidth??0,height:m?.frameHeight??0},k)))).catch(()=>-1);if(!S)return;if(Number.isFinite(D)&&D>=0&&D<l){w=!0;let k=u?"recto":c.current??(c.captured.recto===void 0?"recto":"verso");R({type:"readFailed",side:k,id:_,issue:"blurry"}),H(k);return}}w=!1;let x;if(u)x="single";else{let D=c.current,k=await(t.classify!==void 0?t.classify(o):y().then(X=>X===null?D??"recto":m?.inStill===!0?te(X,480,null,!0):te(X,480,j(m?.quad??null,{width:m?.frameWidth??0,height:m?.frameHeight??0},X)))).catch(()=>D??"recto");if(!S)return;if(c.captured[k]!==void 0&&h<rt){h+=1,R({type:"duplicate",id:_,side:k}),H(k==="recto"?"verso":"recto");return}x=c.captured[k]!==void 0&&D!==void 0?D:k,h=0,R({type:"classified",id:_,side:x})}let E=x==="verso"?"verso":"recto";try{let D=t.encode!==void 0?await t.encode(o):await y().then(k=>{if(k===null)throw new Error("the still could not be decoded");return $(k)});if(!S)return;L!==null&&ie.set(D.blob,L),n.emit("captured",{image:D.blob,side:x,documentType:e.documentType,...e.issuer!==void 0?{issuer:e.issuer}:{},width:D.width,height:D.height,previewDataUrl:a}),t.deferRead!==!0&&R({type:"readOk",side:E})}catch{R({type:"readFailed",side:E,id:_,issue:"technical"}),n.emit("error",{kind:"generic",retryable:!0})}H(E==="recto"?"verso":"recto")},Ue=o=>{P.push(o.on("statechange",({state:a})=>{a==="preflight"||a==="acquiring"?W("starting"):a==="positioning"?W("scanning"):a==="captured"?W("captured"):a==="error"&&W("error")}),o.on("feedback",({key:a,reticle:m})=>n.emit("feedback",{key:a,reticle:m})),o.on("checks",a=>{n.emit("gate",{progress:a.p,quad:a.quad,frameWidth:a.frameWidth,frameHeight:a.frameHeight,...a.guide!==void 0?{guide:{detected:a.guide.detected,fill:a.guide.fill,offsetX:a.guide.offsetX??0,offsetY:a.guide.offsetY??0}}:{}});let m=a.ocr?.mrz;m!==void 0&&(m.state==="fallback"?N({state:"fallback",reason:m.reason}):m.state==="valid"?N({state:"valid",format:m.format}):m.state==="reading"?N({state:"reading",...m.format?{format:m.format}:{},...m.coach?{coach:m.coach}:{}}):N({state:"searching"}));let y=a.quad===null?0:it(a.quad,a.frameWidth,a.frameHeight);C=a.quad===null?null:{quad:a.quad,frameWidth:a.frameWidth,frameHeight:a.frameHeight},R({type:"report",report:{present:a.quad!==null&&a.plausible||a.guide?.detected===!0,ready:a.ready===!0,locking:a.p>=.5,areaFrac:y},at:s()})}),o.on("error",({kind:a,retryable:m})=>n.emit("error",{kind:fe(a),retryable:m})),o.on("artifacts",a=>{ze(a.keyframe,a.previewDataUrl,a.docRegion,a.liveMrz)}))},K=()=>(b??(b=(async()=>{if(S){if(p===null){let o;try{o=await(t.createEngine??ot)({...t.engineOptions??{},...B!==void 0?{guide:B}:{},video:e.video,format:ge(e.documentType),side:u?"single":e.side??"recto",autoCapture:!1,...G!==null?{ocr:G}:{}})}catch{W("error"),n.emit("error",{kind:"generic",retryable:!0});return}if(!S){o.destroy();return}p=o,Ue(o);let a=t.tickMs??500;a>0&&(O=setInterval(()=>R({type:"tick",at:s()}),a))}R({type:"clockRestart"}),M!==null&&M.liveMrzArm==="live"&&(z==="unsupported"||z==="off")&&N({state:"fallback",reason:z}),await p.start()}})().finally(()=>{b=null})),b);return{handle:{get state(){return f},on:(o,a)=>n.on(o,a),start:K,retry:()=>{if(p===null&&c.phase==="result"){R({type:"retake"}),h=0,w=!1,K();return}if(p!==null&&f!=="error"){R({type:"retake"}),h=0,w=!1,p.rearm(u?"single":void 0);return}K()},setSide:o=>{u||o==="single"||(c.current!==o&&(c={...c,current:o}),R({type:"clockRestart"}),c.phase!=="reading"&&c.phase!=="result"&&p?.rearm(o))},shutter:ue,focusAt:(o,a)=>{p?.focusAt?.(o,a)},setGuide:o=>{B=o,p?.setGuide?.(o)},setTorch:o=>{d=o,p?.setTorch(o),R({type:"tick",at:s()})},destroy:()=>{if(S&&p!==null&&f!=="done"){let o=ce();!Q&&o!==void 0&&o.ticks>0&&de(o,"abandoned"),se(o,void 0)}S=!1,le(),G?.setEngine(null),A?.dispose(),A=null,n.clear()}},setFlowState:o=>{(c.phase==="reading"||c.phase==="result")&&W(o==="done"&&c.phase!=="result"?"scanning":o)},settle:(o,a)=>{let m=o==="verso"?"verso":"recto";R(a.ok?{type:"readOk",side:m}:{type:"readFailed",side:m,issue:a.issue}),a.ok||H(m)},takeDeviceRead:o=>ie.get(o.image)?.value??null}}export{dt as a,pt as b,ft as c,gt as d,bt as e,ht as f,De as g,Z as h,xe as i,Je as j,Ze as k,St as l,ve as m,kt as n,U as o,Ae as p,Be as q,nt as r,Ie as s,ae as t,rt as u,Nt as v,Ut as w,st as x};
@@ -1 +1 @@
1
- import{a as Q,d as Z,e as j}from"./chunk-GT2ZLGF7.js";import{w as $}from"./chunk-IBA5CPDV.js";import{c as q}from"./chunk-FUHDOEBP.js";import{f as G}from"./chunk-FHJ7HO3M.js";import{a as N,f as v}from"./chunk-OKWG3PVH.js";var ne=12e4,J=13e4,re=3e3,se=1200,P=Symbol.for("@sekyro/web.preload.v1");function f(){let e=globalThis;return e[P]??(e[P]=new Map),e[P]}function g(e){let n=(e??N).replace(/\/+$/,"");return n===""?"/":n}function X(e){let n=f(),r=n.get(e);return r===void 0&&(r={status:"idle",promise:null,scheduled:null,detectorPromise:null,detector:null,listeners:new Set},n.set(e,r)),r}function A(e,n){if(e.status!==n){e.status=n;for(let r of[...e.listeners])r(n)}}var x=e=>v({preferred:["blaze"],v3AssetBaseUrl:e,blazeInitTimeoutMs:ne}),I=x;function ge(e){I=e??x}function he(){for(let e of f().values())e.detector?.destroy();f().clear(),I=x}function oe(){return typeof window<"u"&&typeof navigator<"u"&&typeof navigator.mediaDevices?.getUserMedia=="function"}function ie(){return navigator.connection?.saveData===!0}function ae(e){let n=window;if(typeof n.requestIdleCallback=="function"){let s=n.requestIdleCallback(e,{timeout:re});return()=>n.cancelIdleCallback?.(s)}let r=setTimeout(e,se);return()=>clearTimeout(r)}function ce(e,n){let r,s=new Promise(o=>{r=o}),u=!1,l=()=>{},d={promise:s,settle:o=>{u||(u=!0,l(),e.scheduled===d&&(e.scheduled=null),r(o))}};return e.scheduled=d,l=ae(()=>{u||d.settle(R(e,n))}),s}function R(e,n){if((e.status==="loading"||e.status==="ready")&&e.promise!==null)return e.promise;A(e,"loading");let r=new Promise(o=>o(I(n)));e.detectorPromise=r;let s,u=new Promise((o,h)=>{s=setTimeout(()=>{r.then(S=>S.destroy(),()=>{}),h(new Error(`detector preload exceeded ${J} ms`))},J)}),d=Promise.race([r,u]).then(o=>e.detectorPromise!==r?(o.destroy(),e.status):(e.detector=o,A(e,"ready"),"ready"),o=>(e.detectorPromise===r&&(e.detectorPromise=null,e.detector=null,A(e,"failed"),console.warn("[@sekyro/web] face-detector preload failed:",o)),e.status)).finally(()=>clearTimeout(s));return e.promise=d,e.scheduled?.settle(d),d}function Se(e={}){if(!oe())return Promise.resolve("idle");let n=g(e.assetBaseUrl),r=X(n);return e.respectSaveData===!0&&ie()?Promise.resolve(r.status):(r.status==="loading"||r.status==="ready")&&r.promise!==null?r.promise:e.idle===!0?r.scheduled?.promise??ce(r,n):R(r,n)}function Ce(e){return f().get(g(e))?.status??"idle"}function Le(e,n){let r=X(g(n));return r.listeners.add(e),()=>{r.listeners.delete(e)}}function ye(e){let n=f().get(g(e));n!==void 0&&(n.scheduled?.settle("idle"),n.detector?.destroy(),n.detector=null,n.detectorPromise=null,n.promise=null,A(n,"idle"))}function de(e){return{get tier(){return e.tier},get fallbackReason(){return e.fallbackReason},detect:(...n)=>e.detect(...n),destroy:()=>{}}}function Y(e){let n=g(e),r=f().get(n);if(!(r===void 0||r.detector===null&&r.detectorPromise===null&&r.scheduled===null))return async()=>{r.scheduled!==null&&R(r,n);let s=r.promise;for(;r.detector===null&&s!==null&&(await s,r.promise!==s);)s=r.promise;return r.detector!==null?de(r.detector):v({v3AssetBaseUrl:n})}}function ue(e){switch(e){case"fcv3.no_face":case"fcv3.center_face":case"fcv3.straighten":return"center";case"fcv3.come_closer":return"closer";case"fcv3.move_back":return"farther";case"fcv3.more_light":case"fcv3.too_bright":return"light";case"fcv3.hold_still":case"fcv3.steady_camera":return"still";case"fcv3.hold_upright":return"upright";default:return null}}function le(e){switch(e){case"preflight":case"acquiring":return"starting";case"positioning":return"gating";default:return e}}function fe(e){switch(e){case"permission":case"notfound":case"inuse":case"insecure":case"unsupported":return e;default:{let n=e;return"generic"}}}function pe(e,n={},r,s=()=>"self",u=()=>{}){let l=n.now??(()=>performance.now()),d=n.canChooseFacing??Z,o="user",h=!1,S=t=>(t==="environment"&&!h&&(h=!0,console.warn('[@sekyro/web] facing "environment" ignored: this capture is a self capture (the person films themselves), which uses the front camera only. The back camera is for assisted capture, set in the flow.')),"user"),k=!1,p=s(),c=Q(),H=!G(),U=n.engineOptions,ee=U?.createDetector===void 0&&U?.createWorker===void 0?{createDetector:()=>{let t=Y(e.assetBaseUrl);return t!==void 0?t():v({v3AssetBaseUrl:e.assetBaseUrl})}}:{},B={video:e.video,mode:H?"photo":"clip",rankKeyframes:r,facingMode:void 0,v3AssetBaseUrl:e.assetBaseUrl,screenRamp:()=>p==="self"&&c.count("ramp")>0?u():void 0,...n.engineOptions??{},...ee},i=n.createEngine?.(B)??new $(B),C="idle",L=null,y=0,D=!1,M="full",E=null,b=null,_=0,F=0,K=()=>{e.video.videoWidth>0&&e.video.videoHeight>0&&(_=e.video.videoWidth,F=e.video.videoHeight)},V=j({enabled:e.keepScreenAwake!==!1}),W=t=>{C=t,V.setActive(t==="starting"||t==="gating"||t==="recording"),c.emit("state",t)},O=()=>c.emit("gate",{progress:y,hint:L,faceDetected:D}),z=()=>{let t=i.animations??"full";t!==M&&(M=t,c.emit("profile",{animations:M}))},te=[i.on("statechange",({state:t})=>{let a=le(t);a==="starting"&&C!=="starting"&&(L=null,y=0,D=!1,E=null,b=null,_=0,F=0),W(a),z(),a==="recording"&&(K(),E=l(),L="hold",y=1,O())}),i.on("checks",t=>{K(),y=t.progress,D=t.factors.presence>0,O(),z()}),i.on("guidance",({key:t})=>{L=ue(t),O()}),i.on("frozen",({previewDataUrl:t})=>{b=l(),c.emit("frozen",{previewDataUrl:t})}),i.on("ramp",t=>c.emit("ramp",t)),i.on("artifacts",t=>{let a=q(),m=E!==null&&b!==null?Math.max(0,Math.round(b-E)):void 0;c.emit("captured",{keyframe:t.keyframe,...t.clip!==void 0?{clip:t.clip}:{},...t.clipMimeType!==void 0?{clipMime:t.clipMimeType}:{},width:e.video.videoWidth||_,height:e.video.videoHeight||F,...m!==void 0?{clipMs:m}:{},captureChannel:a==="desktop"?"desktop":"mobile",formFactor:a,...H?{degraded:"NO_RECORDER"}:{},engine:"v3",facingMode:i.facingMode,mode:p,...t.timing,...t.screenRamp!==void 0?{screenRamp:t.screenRamp}:{},...t.provenance!==void 0?{provenance:t.provenance}:{}})}),i.on("error",({kind:t,retryable:a})=>{c.emit("error",{kind:fe(t),retryable:a})})];return{handle:{get state(){return C},get captureMode(){return s()},get facingMode(){return i.facingMode??o},on:(t,a)=>c.on(t,a),start:t=>{if(p=s(),p==="self")return S(e.facing),S(t?.facing),k=!0,o="user",i.start({facingMode:"user"});let a=!k;k=!0;let m=t?.facing??(a?e.facing:void 0),T=w=>(o=w,i.start({facingMode:w}));return m!==void 0?T(m):a?d().then(w=>T(w?"environment":"user"),()=>T("user")):i.start({})},retry:()=>i.retry(),switchCamera:()=>s()!=="assisted"?!1:(p="assisted",o=o==="user"?"environment":"user",i.switchCamera(),!0),destroy:()=>{for(let t of te)t();V.setActive(!1),i.destroy(),c.clear()}},setFlowState:t=>{C!==t&&W(t)}}}function Fe(e){return pe(e).handle}export{ne as a,J as b,ge as c,he as d,Se as e,Ce as f,Le as g,ye as h,Y as i,ue as j,le as k,fe as l,pe as m,Fe as n};
1
+ import{a as Q,d as Z,e as j}from"./chunk-GT2ZLGF7.js";import{w as $}from"./chunk-EIETPWIG.js";import{c as q}from"./chunk-FUHDOEBP.js";import{f as G}from"./chunk-2BFYVMUU.js";import{a as N,f as v}from"./chunk-OKWG3PVH.js";var ne=12e4,J=13e4,re=3e3,se=1200,P=Symbol.for("@sekyro/web.preload.v1");function f(){let e=globalThis;return e[P]??(e[P]=new Map),e[P]}function g(e){let n=(e??N).replace(/\/+$/,"");return n===""?"/":n}function X(e){let n=f(),r=n.get(e);return r===void 0&&(r={status:"idle",promise:null,scheduled:null,detectorPromise:null,detector:null,listeners:new Set},n.set(e,r)),r}function A(e,n){if(e.status!==n){e.status=n;for(let r of[...e.listeners])r(n)}}var x=e=>v({preferred:["blaze"],v3AssetBaseUrl:e,blazeInitTimeoutMs:ne}),I=x;function ge(e){I=e??x}function he(){for(let e of f().values())e.detector?.destroy();f().clear(),I=x}function oe(){return typeof window<"u"&&typeof navigator<"u"&&typeof navigator.mediaDevices?.getUserMedia=="function"}function ie(){return navigator.connection?.saveData===!0}function ae(e){let n=window;if(typeof n.requestIdleCallback=="function"){let s=n.requestIdleCallback(e,{timeout:re});return()=>n.cancelIdleCallback?.(s)}let r=setTimeout(e,se);return()=>clearTimeout(r)}function ce(e,n){let r,s=new Promise(o=>{r=o}),u=!1,l=()=>{},d={promise:s,settle:o=>{u||(u=!0,l(),e.scheduled===d&&(e.scheduled=null),r(o))}};return e.scheduled=d,l=ae(()=>{u||d.settle(R(e,n))}),s}function R(e,n){if((e.status==="loading"||e.status==="ready")&&e.promise!==null)return e.promise;A(e,"loading");let r=new Promise(o=>o(I(n)));e.detectorPromise=r;let s,u=new Promise((o,h)=>{s=setTimeout(()=>{r.then(S=>S.destroy(),()=>{}),h(new Error(`detector preload exceeded ${J} ms`))},J)}),d=Promise.race([r,u]).then(o=>e.detectorPromise!==r?(o.destroy(),e.status):(e.detector=o,A(e,"ready"),"ready"),o=>(e.detectorPromise===r&&(e.detectorPromise=null,e.detector=null,A(e,"failed"),console.warn("[@sekyro/web] face-detector preload failed:",o)),e.status)).finally(()=>clearTimeout(s));return e.promise=d,e.scheduled?.settle(d),d}function Se(e={}){if(!oe())return Promise.resolve("idle");let n=g(e.assetBaseUrl),r=X(n);return e.respectSaveData===!0&&ie()?Promise.resolve(r.status):(r.status==="loading"||r.status==="ready")&&r.promise!==null?r.promise:e.idle===!0?r.scheduled?.promise??ce(r,n):R(r,n)}function Ce(e){return f().get(g(e))?.status??"idle"}function Le(e,n){let r=X(g(n));return r.listeners.add(e),()=>{r.listeners.delete(e)}}function ye(e){let n=f().get(g(e));n!==void 0&&(n.scheduled?.settle("idle"),n.detector?.destroy(),n.detector=null,n.detectorPromise=null,n.promise=null,A(n,"idle"))}function de(e){return{get tier(){return e.tier},get fallbackReason(){return e.fallbackReason},detect:(...n)=>e.detect(...n),destroy:()=>{}}}function Y(e){let n=g(e),r=f().get(n);if(!(r===void 0||r.detector===null&&r.detectorPromise===null&&r.scheduled===null))return async()=>{r.scheduled!==null&&R(r,n);let s=r.promise;for(;r.detector===null&&s!==null&&(await s,r.promise!==s);)s=r.promise;return r.detector!==null?de(r.detector):v({v3AssetBaseUrl:n})}}function ue(e){switch(e){case"fcv3.no_face":case"fcv3.center_face":case"fcv3.straighten":return"center";case"fcv3.come_closer":return"closer";case"fcv3.move_back":return"farther";case"fcv3.more_light":case"fcv3.too_bright":return"light";case"fcv3.hold_still":case"fcv3.steady_camera":return"still";case"fcv3.hold_upright":return"upright";default:return null}}function le(e){switch(e){case"preflight":case"acquiring":return"starting";case"positioning":return"gating";default:return e}}function fe(e){switch(e){case"permission":case"notfound":case"inuse":case"insecure":case"unsupported":return e;default:{let n=e;return"generic"}}}function pe(e,n={},r,s=()=>"self",u=()=>{}){let l=n.now??(()=>performance.now()),d=n.canChooseFacing??Z,o="user",h=!1,S=t=>(t==="environment"&&!h&&(h=!0,console.warn('[@sekyro/web] facing "environment" ignored: this capture is a self capture (the person films themselves), which uses the front camera only. The back camera is for assisted capture, set in the flow.')),"user"),k=!1,p=s(),c=Q(),H=!G(),U=n.engineOptions,ee=U?.createDetector===void 0&&U?.createWorker===void 0?{createDetector:()=>{let t=Y(e.assetBaseUrl);return t!==void 0?t():v({v3AssetBaseUrl:e.assetBaseUrl})}}:{},B={video:e.video,mode:H?"photo":"clip",rankKeyframes:r,facingMode:void 0,v3AssetBaseUrl:e.assetBaseUrl,screenRamp:()=>p==="self"&&c.count("ramp")>0?u():void 0,...n.engineOptions??{},...ee},i=n.createEngine?.(B)??new $(B),C="idle",L=null,y=0,D=!1,M="full",E=null,b=null,_=0,F=0,K=()=>{e.video.videoWidth>0&&e.video.videoHeight>0&&(_=e.video.videoWidth,F=e.video.videoHeight)},V=j({enabled:e.keepScreenAwake!==!1}),W=t=>{C=t,V.setActive(t==="starting"||t==="gating"||t==="recording"),c.emit("state",t)},O=()=>c.emit("gate",{progress:y,hint:L,faceDetected:D}),z=()=>{let t=i.animations??"full";t!==M&&(M=t,c.emit("profile",{animations:M}))},te=[i.on("statechange",({state:t})=>{let a=le(t);a==="starting"&&C!=="starting"&&(L=null,y=0,D=!1,E=null,b=null,_=0,F=0),W(a),z(),a==="recording"&&(K(),E=l(),L="hold",y=1,O())}),i.on("checks",t=>{K(),y=t.progress,D=t.factors.presence>0,O(),z()}),i.on("guidance",({key:t})=>{L=ue(t),O()}),i.on("frozen",({previewDataUrl:t})=>{b=l(),c.emit("frozen",{previewDataUrl:t})}),i.on("ramp",t=>c.emit("ramp",t)),i.on("artifacts",t=>{let a=q(),m=E!==null&&b!==null?Math.max(0,Math.round(b-E)):void 0;c.emit("captured",{keyframe:t.keyframe,...t.clip!==void 0?{clip:t.clip}:{},...t.clipMimeType!==void 0?{clipMime:t.clipMimeType}:{},width:e.video.videoWidth||_,height:e.video.videoHeight||F,...m!==void 0?{clipMs:m}:{},captureChannel:a==="desktop"?"desktop":"mobile",formFactor:a,...H?{degraded:"NO_RECORDER"}:{},engine:"v3",facingMode:i.facingMode,mode:p,...t.timing,...t.screenRamp!==void 0?{screenRamp:t.screenRamp}:{},...t.provenance!==void 0?{provenance:t.provenance}:{}})}),i.on("error",({kind:t,retryable:a})=>{c.emit("error",{kind:fe(t),retryable:a})})];return{handle:{get state(){return C},get captureMode(){return s()},get facingMode(){return i.facingMode??o},on:(t,a)=>c.on(t,a),start:t=>{if(p=s(),p==="self")return S(e.facing),S(t?.facing),k=!0,o="user",i.start({facingMode:"user"});let a=!k;k=!0;let m=t?.facing??(a?e.facing:void 0),T=w=>(o=w,i.start({facingMode:w}));return m!==void 0?T(m):a?d().then(w=>T(w?"environment":"user"),()=>T("user")):i.start({})},retry:()=>i.retry(),switchCamera:()=>s()!=="assisted"?!1:(p="assisted",o=o==="user"?"environment":"user",i.switchCamera(),!0),destroy:()=>{for(let t of te)t();V.setActive(!1),i.destroy(),c.clear()}},setFlowState:t=>{C!==t&&W(t)}}}function Fe(e){return pe(e).handle}export{ne as a,J as b,ge as c,he as d,Se as e,Ce as f,Le as g,ye as h,Y as i,ue as j,le as k,fe as l,pe as m,Fe as n};
@@ -1 +1 @@
1
- "use strict";var m=Object.defineProperty;var v=Object.getOwnPropertyDescriptor;var O=Object.getOwnPropertyNames;var H=Object.prototype.hasOwnProperty;var M=(t,e)=>{for(var o in e)m(t,o,{get:e[o],enumerable:!0})},A=(t,e,o,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of O(e))!H.call(t,i)&&i!==o&&m(t,i,{get:()=>e[i],enumerable:!(n=v(e,i))||n.enumerable});return t};var N=t=>A(m({},"__esModule",{value:!0}),t);var J={};M(J,{HostedApiError:()=>d,HostedClient:()=>y,KNOWN_CODES:()=>g,SEKYRO_SDK_HEADER:()=>S,icaoPolicyOf:()=>I,isKnownCode:()=>P,portraitIcaoGate:()=>E,stripMimeParams:()=>u});module.exports=N(J);var p="0.1.0-rc.13";var w="sekyro.did",C;function T(){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,o=>o.toString(16).padStart(2,"0")).join("")}}catch{}}function D(){try{let t=localStorage.getItem(w);if(t)return t;let e=T();return e!==void 0&&localStorage.setItem(w,e),e}catch{return C??(C=T()),C}}async function x(){let t=globalThis.crypto?.subtle;if(!t)return"";let e=navigator,o=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]),n=await t.digest("SHA-256",new TextEncoder().encode(o));return Array.from(new Uint8Array(n),i=>i.toString(16).padStart(2,"0")).join("").slice(0,32)}function V(t){let e=new TextEncoder().encode(t),o="";for(let n of e)o+=String.fromCharCode(n);return btoa(o).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}function K(t){let e,o;return{timezone(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone?.slice(0,64)||void 0}catch{return}},noteCameraLabel(n){n&&(e=n.slice(0,128))},async deviceHeader(){try{o??(o=x().catch(()=>""));let n=[];navigator.webdriver&&n.push("webdriver"),/HeadlessChrome/.test(navigator.userAgent)&&n.push("headless");let i=await o,s=D(),r={v:1,platform:"web",sdk:t.sdk.slice(0,64),ids:[...s?[{kind:"web_local",value:s.slice(0,128)}]:[],...i?[{kind:"web_fp",value:i}]:[]],screen:{w:screen.width,h:screen.height,dpr:globalThis.devicePixelRatio??1},...e?{cameraLabel:e}:{},...n.length?{signals:n}:{}};return V(JSON.stringify(r))}catch{return}}}}var f=Symbol.for("sekyro.web.clientContext"),h=globalThis,_=h[f]??(h[f]=K({sdk:`@sekyro/web@${p}`}));var g=["session_token_invalid","session_token_required","session_token_session_mismatch","session_not_found","rate_limit_exceeded","consent_required","session_not_active","check_not_found","check_already_finalized","check_out_of_order","check_type_unsupported","force_outcome_forbidden","attestation_invalid","platform_unregistered","app_attest_invalid","too_many_challenges","inference_unavailable","mobile_required","nni_locked","document_nni_mismatch","media_content_type_not_allowed","media_too_large","media_key_invalid","media_key_forbidden","media_not_found","media_unreadable","media_session_invalid","idempotency_key_collision","idempotency_in_progress","idempotency_key_required","validation_error","internal_error","unknown_error","upload_failed","network_error","timeout","nfc_outcome_not_accepted","identity_confirm_required","identity_confirm_locked","choice_not_found","choice_locked","choice_option_unavailable","step_not_on_path","check_not_active","sekyro_app_not_allowed","sekyro_app_unverified","id_number_locked","document_id_number_mismatch"];function P(t){return g.includes(t)}var d=class extends Error{constructor(e){super(e.message),this.name="HostedApiError",this.status=e.status,this.code=e.code,e.retryAfterSeconds!==void 0&&(this.retryAfterSeconds=e.retryAfterSeconds),e.details&&(this.details=e.details)}};var U=6e4,k=4,L=3e4,$=9e5,q=200,F=5,B=400;function u(t){return(t.split(";")[0]??"").trim()}var j={liveness:"clipKey",face_match:"imageKey",doc_ocr:"imageKey"},S=`@sekyro/web/${p}`,G=S,y=class{constructor(e){this.sessionId=null;this.bootstrap=null;this.captureNonces=[];this.captureFetch=null;this.apiOrigin=e.apiOrigin.replace(/\/+$/,""),this.sessionToken=e.sessionToken;let o=e.fetch;this.fetchImpl=(n,i)=>(o??globalThis.fetch).call(globalThis,n,i),this.requestTimeoutMs=e.requestTimeoutMs??L,this.retryAttempts=e.inProgressRetry?.attempts??F,this.retryDelayMs=e.inProgressRetry?.delayMs??B}async getSession(){let e=await this.api("GET","/hosted/session");return this.sessionId=e.sessionId,e}async recordConsent(e){return this.api("POST","/hosted/consent",{body:{locale:e}})}async reportCameraUnavailable(e){return this.api("POST","/hosted/camera-unavailable",{body:{cause:e}})}async choose(e,o){let n=await this.api("POST","/hosted/choice",{body:{nodeId:e,option:o}});return this.sessionId=n.sessionId,n}async confirmIdentity(e){return this.api("POST","/hosted/identity/confirm",{body:{decision:e}})}async identityPortrait(){return this.api("GET","/hosted/identity/portrait",{blob:!0})}async presign(e,o,n){let i=await this.ensureSessionId(),s={kind:e,contentType:u(o),contentLength:n};return this.api("POST",`/sessions/${i}/media`,{body:s})}armCapture(e=2){this.fillCaptureNonces(e)}async presignCapture(e,o,n,i={}){let s=await this.ensureSessionId(),r=await this.takeCaptureNonce(),c=r===void 0?void 0:{nonce:r,...i.engine!==void 0?{engine:i.engine.slice(0,32)}:{},...i.durationMs!==void 0&&Number.isFinite(i.durationMs)?{captureMs:Math.min(36e5,Math.max(0,Math.round(i.durationMs)))}:{}},a={kind:e,contentType:u(o),contentLength:n,capture:c};return this.api("POST",`/sessions/${s}/media`,{body:a})}async takeCaptureNonce(){let e=()=>{let o=Date.now();return this.captureNonces=this.captureNonces.filter(n=>n.expiresAt-U>o),this.captureNonces.shift()?.nonce};for(let o=0;o<2;o++){let n=e();if(n!==void 0)return n;await this.fillCaptureNonces(1)}return e()}fillCaptureNonces(e){return this.captureFetch??(this.captureFetch=(async()=>{try{let o=await this.ensureSessionId(),n=await this.api("POST",`/sessions/${o}/media/capture-nonces`,{body:{count:Math.min(k,Math.max(1,e))}}),i=Date.now()+Math.max(0,n.expiresIn)*1e3;for(let s of Array.isArray(n.nonces)?n.nonces:[])typeof s=="string"&&s.length>0&&this.captureNonces.push({nonce:s,expiresAt:i});this.captureNonces=this.captureNonces.slice(-k)}catch{}})().finally(()=>{this.captureFetch=null})),this.captureFetch}async uploadToSpaces(e,o,n){let i;try{i=await this.fetchImpl(e,{method:"PUT",headers:{"content-type":u(n)},body:o,signal:AbortSignal.timeout($)})}catch(s){throw b(s)}if(!i.ok){let s=(await i.text().catch(()=>"")).slice(0,q);throw new d({status:i.status,code:"upload_failed",message:`media upload failed (HTTP ${i.status})${s?`: ${s}`:""}`})}}async completeMedia(e){let o=await this.ensureSessionId();return this.api("POST",`/sessions/${o}/media/complete`,{body:{key:e}})}async submitCheck(e,o,n={}){let i=await this.ensureSessionId(),s={input:o,forceOutcome:n.forceOutcome};return this.api("POST",`/sessions/${i}/checks/${e}`,{body:s,idempotencyKey:n.idempotencyKey})}async uploadAndSubmit(e,o,n,i={}){let s=u(o.contentType),r=await this.presign(o.kind,s,o.blob.size);await this.uploadToSpaces(r.uploadUrl,o.blob,s);let c=await this.completeMedia(r.key),a={...n,[j[e]]:c.key};return this.submitCheck(e,a,i)}async ensureSessionId(){return this.sessionId!==null?this.sessionId:(this.bootstrap??(this.bootstrap=this.getSession().finally(()=>{this.bootstrap=null})),(await this.bootstrap).sessionId)}async api(e,o,n={}){let i=`${this.apiOrigin}/api/v2${o}`,s={"x-session-token":this.sessionToken,"x-sekyro-sdk":G};n.body!==void 0&&(s["content-type"]="application/json"),n.idempotencyKey!==void 0&&(s["x-idempotency-key"]=n.idempotencyKey);try{let r=_.timezone();r!==void 0&&(s["sekyro-client-timezone"]=r)}catch{}try{let r=await _.deviceHeader();r!==void 0&&(s["sekyro-client-device"]=r)}catch{}for(let r=0;;r++){let c;try{c=await this.fetchImpl(i,{method:e,headers:s,...n.body!==void 0?{body:JSON.stringify(n.body)}:{},cache:"no-store",signal:AbortSignal.timeout(this.requestTimeoutMs)})}catch(l){throw b(l)}if(c.ok){if(n.blob===!0)try{return await c.blob()}catch(R){throw b(R)}let l;try{l=await c.json()}catch{throw new d({status:c.status,code:"unknown_error",message:`response body was not valid JSON (HTTP ${c.status})`})}return Y(l)}let a=await z(c);if(a.code==="idempotency_in_progress"&&r<this.retryAttempts){this.retryDelayMs>0&&await W(this.retryDelayMs);continue}throw a}}};function b(t){if((typeof t=="object"&&t!==null?t.name:void 0)==="TimeoutError")return new d({status:0,code:"timeout",message:"request timed out"});let o=t instanceof Error?t.message:String(t);return new d({status:0,code:"network_error",message:`network request failed: ${o}`})}function Y(t){return t!==null&&typeof t=="object"&&"success"in t&&"data"in t?t.data:t}async function z(t){let e="unknown_error",o=`request failed (HTTP ${t.status})`,n=Number.NaN,i;try{let c=await t.json();if(c!==null&&typeof c=="object"){let a=c;typeof a.code=="string"&&a.code.length>0&&(e=a.code),typeof a.message=="string"&&a.message.length>0&&(o=a.message),typeof a.retryAfterSeconds=="number"&&(n=a.retryAfterSeconds),Array.isArray(a.details?.issues)&&(i=a.details)}}catch{}let s=t.headers.get("retry-after"),r=s===null?Math.floor(n):Number.parseInt(s,10);return new d({status:t.status,code:e,message:o,...Number.isFinite(r)&&r>=0?{retryAfterSeconds:r}:{},details:i})}function W(t){return new Promise(e=>setTimeout(e,t))}function I(t){let e=t?.portrait,o=e?.icao,n=e?.purpose==="id_document";return o==null?n?{policy:"reject",profile:"id_document"}:null:{policy:o.policy==="alert"&&!n?"alert":"reject",profile:n||o.profile==="id_document"?"id_document":"selfie"}}function E(t){return{...t.baselineEyeOpenness!==void 0?{baselineEyeOpenness:t.baselineEyeOpenness}:{},criteria:t.verdict??{},...t.backgroundCheck!==void 0?{backgroundCheck:t.backgroundCheck}:{}}}0&&(module.exports={HostedApiError,HostedClient,KNOWN_CODES,SEKYRO_SDK_HEADER,icaoPolicyOf,isKnownCode,portraitIcaoGate,stripMimeParams});
1
+ "use strict";var m=Object.defineProperty;var v=Object.getOwnPropertyDescriptor;var O=Object.getOwnPropertyNames;var H=Object.prototype.hasOwnProperty;var M=(t,e)=>{for(var o in e)m(t,o,{get:e[o],enumerable:!0})},A=(t,e,o,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of O(e))!H.call(t,i)&&i!==o&&m(t,i,{get:()=>e[i],enumerable:!(n=v(e,i))||n.enumerable});return t};var N=t=>A(m({},"__esModule",{value:!0}),t);var J={};M(J,{HostedApiError:()=>d,HostedClient:()=>y,KNOWN_CODES:()=>g,SEKYRO_SDK_HEADER:()=>S,icaoPolicyOf:()=>I,isKnownCode:()=>P,portraitIcaoGate:()=>E,stripMimeParams:()=>u});module.exports=N(J);var p="0.1.0-rc.14";var w="sekyro.did",C;function T(){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,o=>o.toString(16).padStart(2,"0")).join("")}}catch{}}function D(){try{let t=localStorage.getItem(w);if(t)return t;let e=T();return e!==void 0&&localStorage.setItem(w,e),e}catch{return C??(C=T()),C}}async function x(){let t=globalThis.crypto?.subtle;if(!t)return"";let e=navigator,o=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]),n=await t.digest("SHA-256",new TextEncoder().encode(o));return Array.from(new Uint8Array(n),i=>i.toString(16).padStart(2,"0")).join("").slice(0,32)}function V(t){let e=new TextEncoder().encode(t),o="";for(let n of e)o+=String.fromCharCode(n);return btoa(o).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}function K(t){let e,o;return{timezone(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone?.slice(0,64)||void 0}catch{return}},noteCameraLabel(n){n&&(e=n.slice(0,128))},async deviceHeader(){try{o??(o=x().catch(()=>""));let n=[];navigator.webdriver&&n.push("webdriver"),/HeadlessChrome/.test(navigator.userAgent)&&n.push("headless");let i=await o,s=D(),r={v:1,platform:"web",sdk:t.sdk.slice(0,64),ids:[...s?[{kind:"web_local",value:s.slice(0,128)}]:[],...i?[{kind:"web_fp",value:i}]:[]],screen:{w:screen.width,h:screen.height,dpr:globalThis.devicePixelRatio??1},...e?{cameraLabel:e}:{},...n.length?{signals:n}:{}};return V(JSON.stringify(r))}catch{return}}}}var f=Symbol.for("sekyro.web.clientContext"),h=globalThis,_=h[f]??(h[f]=K({sdk:`@sekyro/web@${p}`}));var g=["session_token_invalid","session_token_required","session_token_session_mismatch","session_not_found","rate_limit_exceeded","consent_required","session_not_active","check_not_found","check_already_finalized","check_out_of_order","check_type_unsupported","force_outcome_forbidden","attestation_invalid","platform_unregistered","app_attest_invalid","too_many_challenges","inference_unavailable","mobile_required","nni_locked","document_nni_mismatch","media_content_type_not_allowed","media_too_large","media_key_invalid","media_key_forbidden","media_not_found","media_unreadable","media_session_invalid","idempotency_key_collision","idempotency_in_progress","idempotency_key_required","validation_error","internal_error","unknown_error","upload_failed","network_error","timeout","nfc_outcome_not_accepted","identity_confirm_required","identity_confirm_locked","choice_not_found","choice_locked","choice_option_unavailable","step_not_on_path","check_not_active","sekyro_app_not_allowed","sekyro_app_unverified","id_number_locked","document_id_number_mismatch"];function P(t){return g.includes(t)}var d=class extends Error{constructor(e){super(e.message),this.name="HostedApiError",this.status=e.status,this.code=e.code,e.retryAfterSeconds!==void 0&&(this.retryAfterSeconds=e.retryAfterSeconds),e.details&&(this.details=e.details)}};var U=6e4,k=4,L=3e4,$=9e5,q=200,F=5,B=400;function u(t){return(t.split(";")[0]??"").trim()}var j={liveness:"clipKey",face_match:"imageKey",doc_ocr:"imageKey"},S=`@sekyro/web/${p}`,G=S,y=class{constructor(e){this.sessionId=null;this.bootstrap=null;this.captureNonces=[];this.captureFetch=null;this.apiOrigin=e.apiOrigin.replace(/\/+$/,""),this.sessionToken=e.sessionToken;let o=e.fetch;this.fetchImpl=(n,i)=>(o??globalThis.fetch).call(globalThis,n,i),this.requestTimeoutMs=e.requestTimeoutMs??L,this.retryAttempts=e.inProgressRetry?.attempts??F,this.retryDelayMs=e.inProgressRetry?.delayMs??B}async getSession(){let e=await this.api("GET","/hosted/session");return this.sessionId=e.sessionId,e}async recordConsent(e){return this.api("POST","/hosted/consent",{body:{locale:e}})}async reportCameraUnavailable(e){return this.api("POST","/hosted/camera-unavailable",{body:{cause:e}})}async choose(e,o){let n=await this.api("POST","/hosted/choice",{body:{nodeId:e,option:o}});return this.sessionId=n.sessionId,n}async confirmIdentity(e){return this.api("POST","/hosted/identity/confirm",{body:{decision:e}})}async identityPortrait(){return this.api("GET","/hosted/identity/portrait",{blob:!0})}async presign(e,o,n){let i=await this.ensureSessionId(),s={kind:e,contentType:u(o),contentLength:n};return this.api("POST",`/sessions/${i}/media`,{body:s})}armCapture(e=2){this.fillCaptureNonces(e)}async presignCapture(e,o,n,i={}){let s=await this.ensureSessionId(),r=await this.takeCaptureNonce(),c=r===void 0?void 0:{nonce:r,...i.engine!==void 0?{engine:i.engine.slice(0,32)}:{},...i.durationMs!==void 0&&Number.isFinite(i.durationMs)?{captureMs:Math.min(36e5,Math.max(0,Math.round(i.durationMs)))}:{}},a={kind:e,contentType:u(o),contentLength:n,capture:c};return this.api("POST",`/sessions/${s}/media`,{body:a})}async takeCaptureNonce(){let e=()=>{let o=Date.now();return this.captureNonces=this.captureNonces.filter(n=>n.expiresAt-U>o),this.captureNonces.shift()?.nonce};for(let o=0;o<2;o++){let n=e();if(n!==void 0)return n;await this.fillCaptureNonces(1)}return e()}fillCaptureNonces(e){return this.captureFetch??(this.captureFetch=(async()=>{try{let o=await this.ensureSessionId(),n=await this.api("POST",`/sessions/${o}/media/capture-nonces`,{body:{count:Math.min(k,Math.max(1,e))}}),i=Date.now()+Math.max(0,n.expiresIn)*1e3;for(let s of Array.isArray(n.nonces)?n.nonces:[])typeof s=="string"&&s.length>0&&this.captureNonces.push({nonce:s,expiresAt:i});this.captureNonces=this.captureNonces.slice(-k)}catch{}})().finally(()=>{this.captureFetch=null})),this.captureFetch}async uploadToSpaces(e,o,n){let i;try{i=await this.fetchImpl(e,{method:"PUT",headers:{"content-type":u(n)},body:o,signal:AbortSignal.timeout($)})}catch(s){throw b(s)}if(!i.ok){let s=(await i.text().catch(()=>"")).slice(0,q);throw new d({status:i.status,code:"upload_failed",message:`media upload failed (HTTP ${i.status})${s?`: ${s}`:""}`})}}async completeMedia(e){let o=await this.ensureSessionId();return this.api("POST",`/sessions/${o}/media/complete`,{body:{key:e}})}async submitCheck(e,o,n={}){let i=await this.ensureSessionId(),s={input:o,forceOutcome:n.forceOutcome};return this.api("POST",`/sessions/${i}/checks/${e}`,{body:s,idempotencyKey:n.idempotencyKey})}async uploadAndSubmit(e,o,n,i={}){let s=u(o.contentType),r=await this.presign(o.kind,s,o.blob.size);await this.uploadToSpaces(r.uploadUrl,o.blob,s);let c=await this.completeMedia(r.key),a={...n,[j[e]]:c.key};return this.submitCheck(e,a,i)}async ensureSessionId(){return this.sessionId!==null?this.sessionId:(this.bootstrap??(this.bootstrap=this.getSession().finally(()=>{this.bootstrap=null})),(await this.bootstrap).sessionId)}async api(e,o,n={}){let i=`${this.apiOrigin}/api/v2${o}`,s={"x-session-token":this.sessionToken,"x-sekyro-sdk":G};n.body!==void 0&&(s["content-type"]="application/json"),n.idempotencyKey!==void 0&&(s["x-idempotency-key"]=n.idempotencyKey);try{let r=_.timezone();r!==void 0&&(s["sekyro-client-timezone"]=r)}catch{}try{let r=await _.deviceHeader();r!==void 0&&(s["sekyro-client-device"]=r)}catch{}for(let r=0;;r++){let c;try{c=await this.fetchImpl(i,{method:e,headers:s,...n.body!==void 0?{body:JSON.stringify(n.body)}:{},cache:"no-store",signal:AbortSignal.timeout(this.requestTimeoutMs)})}catch(l){throw b(l)}if(c.ok){if(n.blob===!0)try{return await c.blob()}catch(R){throw b(R)}let l;try{l=await c.json()}catch{throw new d({status:c.status,code:"unknown_error",message:`response body was not valid JSON (HTTP ${c.status})`})}return Y(l)}let a=await z(c);if(a.code==="idempotency_in_progress"&&r<this.retryAttempts){this.retryDelayMs>0&&await W(this.retryDelayMs);continue}throw a}}};function b(t){if((typeof t=="object"&&t!==null?t.name:void 0)==="TimeoutError")return new d({status:0,code:"timeout",message:"request timed out"});let o=t instanceof Error?t.message:String(t);return new d({status:0,code:"network_error",message:`network request failed: ${o}`})}function Y(t){return t!==null&&typeof t=="object"&&"success"in t&&"data"in t?t.data:t}async function z(t){let e="unknown_error",o=`request failed (HTTP ${t.status})`,n=Number.NaN,i;try{let c=await t.json();if(c!==null&&typeof c=="object"){let a=c;typeof a.code=="string"&&a.code.length>0&&(e=a.code),typeof a.message=="string"&&a.message.length>0&&(o=a.message),typeof a.retryAfterSeconds=="number"&&(n=a.retryAfterSeconds),Array.isArray(a.details?.issues)&&(i=a.details)}}catch{}let s=t.headers.get("retry-after"),r=s===null?Math.floor(n):Number.parseInt(s,10);return new d({status:t.status,code:e,message:o,...Number.isFinite(r)&&r>=0?{retryAfterSeconds:r}:{},details:i})}function W(t){return new Promise(e=>setTimeout(e,t))}function I(t){let e=t?.portrait,o=e?.icao,n=e?.purpose==="id_document";return o==null?n?{policy:"reject",profile:"id_document"}:null:{policy:o.policy==="alert"&&!n?"alert":"reject",profile:n||o.profile==="id_document"?"id_document":"selfie"}}function E(t){return{...t.baselineEyeOpenness!==void 0?{baselineEyeOpenness:t.baselineEyeOpenness}:{},criteria:t.verdict??{},...t.backgroundCheck!==void 0?{backgroundCheck:t.backgroundCheck}:{}}}0&&(module.exports={HostedApiError,HostedClient,KNOWN_CODES,SEKYRO_SDK_HEADER,icaoPolicyOf,isKnownCode,portraitIcaoGate,stripMimeParams});
@@ -1,7 +1,7 @@
1
- import { c as IcaoGateSummary } from '../icao-gate-B0GDH_JS.cjs';
2
- export { N as HostedClient, O as HostedClientOptions, Q as MediaCheckType, S as SEKYRO_SDK_HEADER, T as SubmitOptions, U as UploadMedia, V as stripMimeParams } from '../icao-gate-B0GDH_JS.cjs';
3
- import { H as HostedSessionView, G as HostedIcaoPolicy, ah as PortraitIcaoInput } from '../types-DPWT_KMn.cjs';
4
- export { A as AcceptedDocumentType, ax as AttestationInput, c as CaptureContext, i as CaptureMode, ay as CaptureNoncesResult, az as CaptureProof, f as CheckInputByType, k as CheckReason, l as CheckState, e as CheckType, d as CompleteMediaResult, C as ConsentLocale, m as ContactChannel, D as DecisionReason, aA as DocDeviceRead, aB as DocOcrInput, n as DocReason, aC as DocSide, E as EidAfterPass, o as EidAuthInput, p as EidReason, aD as EmailOtpInput, q as EmailOtpReason, aE as FaceMatchInput, F as FaceMatchReason, r as HostedAcceptedDocuments, u as HostedCaptureTuning, a as HostedConsentView, v as HostedDocumentCaptureTuning, w as HostedDocumentScanTuning, x as HostedEidView, y as HostedEmailOtpView, z as HostedFlowRef, J as HostedIntegrity, K as HostedLivePhotoTuning, N as HostedNativeCaptureTuning, O as HostedOcrTuning, Q as HostedOtpView, T as HostedPlanView, U as HostedPortraitView, V as HostedStepView, W as HostedVoiceLocale, X as HostedVoiceView, g as IcaoCriterion, Z as IcaoReportEntry, I as IdentityConfirmDecision, _ as IdentityMethod, $ as IdentitySummarySource, a0 as IdentitySummaryView, aF as LivenessCaptureInput, aG as LivenessInput, a1 as LivenessReason, a2 as MatchReason, M as MediaKind, a3 as MethodChoiceView, a4 as NationalEidOption, a5 as NfcChipReason, a6 as NfcStepView, a7 as OtpChoiceView, aH as PhoneOtpInput, a8 as PhoneOtpReason, a9 as PlanAttempts, aa as PlanChoiceKind, ab as PlanChoiceOption, ac as PlanChoiceView, ad as PlanSectionView, ae as PlanStepView, af as PolicyFailureReason, aI as PopulationInput, ag as PopulationReason, ai as PortraitIcaoReason, aJ as PresignRequest, P as PresignUploadResult, aK as RecordConsentResult, an as SessionFailureReason, ao as SessionOutcome, ap as SessionStatus, aL as SessionStepView, aM as SessionView, aq as StepSection, aN as SubmitCheckBody, ar as VerificationAssurance, as as VerificationLevel } from '../types-DPWT_KMn.cjs';
1
+ import { c as IcaoGateSummary } from '../icao-gate-D576CJ_s.cjs';
2
+ export { N as HostedClient, O as HostedClientOptions, Q as MediaCheckType, S as SEKYRO_SDK_HEADER, T as SubmitOptions, U as UploadMedia, V as stripMimeParams } from '../icao-gate-D576CJ_s.cjs';
3
+ import { H as HostedSessionView, G as HostedIcaoPolicy, ah as PortraitIcaoInput } from '../types-BtEm3Lxe.cjs';
4
+ export { A as AcceptedDocumentType, ax as AttestationInput, c as CaptureContext, i as CaptureMode, ay as CaptureNoncesResult, az as CaptureProof, f as CheckInputByType, k as CheckReason, l as CheckState, e as CheckType, d as CompleteMediaResult, C as ConsentLocale, m as ContactChannel, D as DecisionReason, aA as DocDeviceRead, aB as DocOcrInput, n as DocReason, aC as DocSide, E as EidAfterPass, o as EidAuthInput, p as EidReason, aD as EmailOtpInput, q as EmailOtpReason, aE as FaceMatchInput, F as FaceMatchReason, r as HostedAcceptedDocuments, u as HostedCaptureTuning, a as HostedConsentView, v as HostedDocumentCaptureTuning, w as HostedDocumentScanTuning, x as HostedEidView, y as HostedEmailOtpView, z as HostedFlowRef, J as HostedIntegrity, K as HostedLivePhotoTuning, N as HostedNativeCaptureTuning, O as HostedOcrTuning, Q as HostedOtpView, T as HostedPlanView, U as HostedPortraitView, V as HostedStepView, W as HostedVoiceLocale, X as HostedVoiceView, g as IcaoCriterion, Z as IcaoReportEntry, I as IdentityConfirmDecision, _ as IdentityMethod, $ as IdentitySummarySource, a0 as IdentitySummaryView, aF as LivenessCaptureInput, aG as LivenessInput, a1 as LivenessReason, a2 as MatchReason, M as MediaKind, a3 as MethodChoiceView, a4 as NationalEidOption, a5 as NfcChipReason, a6 as NfcStepView, a7 as OtpChoiceView, aH as PhoneOtpInput, a8 as PhoneOtpReason, a9 as PlanAttempts, aa as PlanChoiceKind, ab as PlanChoiceOption, ac as PlanChoiceView, ad as PlanSectionView, ae as PlanStepView, af as PolicyFailureReason, aI as PopulationInput, ag as PopulationReason, ai as PortraitIcaoReason, aJ as PresignRequest, P as PresignUploadResult, aK as RecordConsentResult, an as SessionFailureReason, ao as SessionOutcome, ap as SessionStatus, aL as SessionStepView, aM as SessionView, aq as StepSection, aN as SubmitCheckBody, ar as VerificationAssurance, as as VerificationLevel } from '../types-BtEm3Lxe.cjs';
5
5
 
6
6
  /**
7
7
  * Every error code the hosted page can receive from the session-token surface.
@@ -1,7 +1,7 @@
1
- import { c as IcaoGateSummary } from '../icao-gate-BP11XO-h.js';
2
- export { N as HostedClient, O as HostedClientOptions, Q as MediaCheckType, S as SEKYRO_SDK_HEADER, T as SubmitOptions, U as UploadMedia, V as stripMimeParams } from '../icao-gate-BP11XO-h.js';
3
- import { H as HostedSessionView, G as HostedIcaoPolicy, ah as PortraitIcaoInput } from '../types-DPWT_KMn.js';
4
- export { A as AcceptedDocumentType, ax as AttestationInput, c as CaptureContext, i as CaptureMode, ay as CaptureNoncesResult, az as CaptureProof, f as CheckInputByType, k as CheckReason, l as CheckState, e as CheckType, d as CompleteMediaResult, C as ConsentLocale, m as ContactChannel, D as DecisionReason, aA as DocDeviceRead, aB as DocOcrInput, n as DocReason, aC as DocSide, E as EidAfterPass, o as EidAuthInput, p as EidReason, aD as EmailOtpInput, q as EmailOtpReason, aE as FaceMatchInput, F as FaceMatchReason, r as HostedAcceptedDocuments, u as HostedCaptureTuning, a as HostedConsentView, v as HostedDocumentCaptureTuning, w as HostedDocumentScanTuning, x as HostedEidView, y as HostedEmailOtpView, z as HostedFlowRef, J as HostedIntegrity, K as HostedLivePhotoTuning, N as HostedNativeCaptureTuning, O as HostedOcrTuning, Q as HostedOtpView, T as HostedPlanView, U as HostedPortraitView, V as HostedStepView, W as HostedVoiceLocale, X as HostedVoiceView, g as IcaoCriterion, Z as IcaoReportEntry, I as IdentityConfirmDecision, _ as IdentityMethod, $ as IdentitySummarySource, a0 as IdentitySummaryView, aF as LivenessCaptureInput, aG as LivenessInput, a1 as LivenessReason, a2 as MatchReason, M as MediaKind, a3 as MethodChoiceView, a4 as NationalEidOption, a5 as NfcChipReason, a6 as NfcStepView, a7 as OtpChoiceView, aH as PhoneOtpInput, a8 as PhoneOtpReason, a9 as PlanAttempts, aa as PlanChoiceKind, ab as PlanChoiceOption, ac as PlanChoiceView, ad as PlanSectionView, ae as PlanStepView, af as PolicyFailureReason, aI as PopulationInput, ag as PopulationReason, ai as PortraitIcaoReason, aJ as PresignRequest, P as PresignUploadResult, aK as RecordConsentResult, an as SessionFailureReason, ao as SessionOutcome, ap as SessionStatus, aL as SessionStepView, aM as SessionView, aq as StepSection, aN as SubmitCheckBody, ar as VerificationAssurance, as as VerificationLevel } from '../types-DPWT_KMn.js';
1
+ import { c as IcaoGateSummary } from '../icao-gate-DSbntJnM.js';
2
+ export { N as HostedClient, O as HostedClientOptions, Q as MediaCheckType, S as SEKYRO_SDK_HEADER, T as SubmitOptions, U as UploadMedia, V as stripMimeParams } from '../icao-gate-DSbntJnM.js';
3
+ import { H as HostedSessionView, G as HostedIcaoPolicy, ah as PortraitIcaoInput } from '../types-BtEm3Lxe.js';
4
+ export { A as AcceptedDocumentType, ax as AttestationInput, c as CaptureContext, i as CaptureMode, ay as CaptureNoncesResult, az as CaptureProof, f as CheckInputByType, k as CheckReason, l as CheckState, e as CheckType, d as CompleteMediaResult, C as ConsentLocale, m as ContactChannel, D as DecisionReason, aA as DocDeviceRead, aB as DocOcrInput, n as DocReason, aC as DocSide, E as EidAfterPass, o as EidAuthInput, p as EidReason, aD as EmailOtpInput, q as EmailOtpReason, aE as FaceMatchInput, F as FaceMatchReason, r as HostedAcceptedDocuments, u as HostedCaptureTuning, a as HostedConsentView, v as HostedDocumentCaptureTuning, w as HostedDocumentScanTuning, x as HostedEidView, y as HostedEmailOtpView, z as HostedFlowRef, J as HostedIntegrity, K as HostedLivePhotoTuning, N as HostedNativeCaptureTuning, O as HostedOcrTuning, Q as HostedOtpView, T as HostedPlanView, U as HostedPortraitView, V as HostedStepView, W as HostedVoiceLocale, X as HostedVoiceView, g as IcaoCriterion, Z as IcaoReportEntry, I as IdentityConfirmDecision, _ as IdentityMethod, $ as IdentitySummarySource, a0 as IdentitySummaryView, aF as LivenessCaptureInput, aG as LivenessInput, a1 as LivenessReason, a2 as MatchReason, M as MediaKind, a3 as MethodChoiceView, a4 as NationalEidOption, a5 as NfcChipReason, a6 as NfcStepView, a7 as OtpChoiceView, aH as PhoneOtpInput, a8 as PhoneOtpReason, a9 as PlanAttempts, aa as PlanChoiceKind, ab as PlanChoiceOption, ac as PlanChoiceView, ad as PlanSectionView, ae as PlanStepView, af as PolicyFailureReason, aI as PopulationInput, ag as PopulationReason, ai as PortraitIcaoReason, aJ as PresignRequest, P as PresignUploadResult, aK as RecordConsentResult, an as SessionFailureReason, ao as SessionOutcome, ap as SessionStatus, aL as SessionStepView, aM as SessionView, aq as StepSection, aN as SubmitCheckBody, ar as VerificationAssurance, as as VerificationLevel } from '../types-BtEm3Lxe.js';
5
5
 
6
6
  /**
7
7
  * Every error code the hosted page can receive from the session-token surface.
@@ -1 +1 @@
1
- import{a as e,b as t,c as o,d as i,e as n,f as s,g as a,h as p}from"../chunk-57VOMVKM.js";import"../chunk-5OIC5TZS.js";export{o as HostedApiError,s as HostedClient,e as KNOWN_CODES,n as SEKYRO_SDK_HEADER,a as icaoPolicyOf,t as isKnownCode,p as portraitIcaoGate,i as stripMimeParams};
1
+ import{a as e,b as t,c as o,d as i,e as n,f as s,g as a,h as p}from"../chunk-JPAGYRNX.js";import"../chunk-Q6CPJVOG.js";export{o as HostedApiError,s as HostedClient,e as KNOWN_CODES,n as SEKYRO_SDK_HEADER,a as icaoPolicyOf,t as isKnownCode,p as portraitIcaoGate,i as stripMimeParams};