@sekyro/web 0.1.0-rc.19 → 0.1.0-rc.20
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.
- package/CHANGELOG.md +27 -0
- package/README.md +8 -0
- package/dist/camera-trait-45MJTW4K.js +1 -0
- package/dist/{capture-session-doc-VXWWQEP4.js → capture-session-doc-QA4DOFRF.js} +1 -1
- package/dist/{capture-session-v3-Cs4yV3HJ.d.cts → capture-session-v3-CNL-GX11.d.cts} +1 -1
- package/dist/{capture-session-v3-CFSVWYzi.d.ts → capture-session-v3-DaBqN8fO.d.ts} +1 -1
- package/dist/chunk-5ZKQHFFW.js +1 -0
- package/dist/{chunk-ZPXL26BF.js → chunk-FGOVIGGL.js} +1 -1
- package/dist/{chunk-RNJA5GDF.js → chunk-IG466TOP.js} +1 -1
- package/dist/{chunk-4GJXUVZK.js → chunk-KHR4U2SZ.js} +1 -1
- package/dist/chunk-KZBBB5B2.js +1 -0
- package/dist/chunk-NJML6FMD.js +1 -0
- package/dist/chunk-TQB3URP2.js +1 -0
- package/dist/{chunk-ZO6IHP2I.js → chunk-U6S7SCBY.js} +1 -1
- package/dist/{chunk-6K4D3U6Q.js → chunk-W2WD7PR2.js} +1 -1
- package/dist/chunk-XCKE2MJL.js +1 -0
- package/dist/chunk-ZLWH4RBO.js +1 -0
- package/dist/client/index.cjs +1 -1
- package/dist/client/index.d.cts +6 -71
- package/dist/client/index.d.ts +6 -71
- package/dist/client/index.js +1 -1
- package/dist/core/index.cjs +1 -1
- package/dist/core/index.d.cts +3 -3
- package/dist/core/index.d.ts +3 -3
- package/dist/core/index.js +1 -1
- package/dist/{create-document-capture-FVSQPUF6.js → create-document-capture-GJXBQMTC.js} +1 -1
- package/dist/{create-portrait-capture-INDCF65X.js → create-portrait-capture-MOS2D7CL.js} +1 -1
- package/dist/{create-verification-1BrMZqPJ.d.cts → create-verification-BBOUYpga.d.cts} +113 -22
- package/dist/{create-verification-CuoYJ3kj.d.ts → create-verification-COpe2hxf.d.ts} +113 -22
- package/dist/{icao-gate-BSbyqLUh.d.ts → icao-gate-CEGvJR3q.d.ts} +19 -9
- package/dist/{icao-gate-D-wePfoV.d.cts → icao-gate-l40OU6x1.d.cts} +19 -9
- package/dist/icao-policy-BgI1Y870.d.ts +71 -0
- package/dist/icao-policy-C7fIdRzo.d.cts +71 -0
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +7 -7
- package/dist/index.d.ts +7 -7
- package/dist/index.js +1 -1
- package/dist/internal/index.cjs +1 -1
- package/dist/internal/index.d.cts +6 -6
- package/dist/internal/index.d.ts +6 -6
- package/dist/internal/index.js +1 -1
- package/dist/plan-runner-35655N4Z.js +1 -0
- package/dist/print-AYSCRSZB.js +1 -0
- package/dist/{types-DPl0hsmI.d.cts → types-Dpfg2cO8.d.cts} +149 -11
- package/dist/{types-DPl0hsmI.d.ts → types-Dpfg2cO8.d.ts} +149 -11
- package/dist/upload-file-UYXOHCRG.js +1 -0
- package/package.json +3 -2
- package/sbom.cdx.json +46 -7
- package/dist/chunk-5Y3UST3W.js +0 -1
- package/dist/chunk-64V55KD7.js +0 -1
- package/dist/chunk-JUEOHNVW.js +0 -1
- package/dist/chunk-L45YTRJJ.js +0 -1
- package/dist/chunk-PLH6ZR6J.js +0 -1
- package/dist/plan-runner-WEUIMCYU.js +0 -1
package/dist/client/index.d.ts
CHANGED
|
@@ -1,73 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
export {
|
|
3
|
-
|
|
4
|
-
export { A as AcceptedDocumentType, aB as AttestationInput, d as CaptureContext, j as CaptureMode, aC as CaptureNoncesResult, aD as CaptureProof, g as CheckInputByType, l as CheckReason, m as CheckState, f as CheckType, e as CompleteMediaResult, C as ConsentLocale, n as ContactChannel, D as DecisionReason, aE as DocDeviceRead, aF as DocOcrInput, o as DocReason, aG as DocSide, E as EidAfterPass, p as EidAuthInput, q as EidReason, aH as EmailOtpInput, r as EmailOtpReason, aI as FaceMatchInput, F as FaceMatchReason, s as HostedAcceptedDocuments, v as HostedCaptureTuning, a as HostedConsentView, w as HostedDocumentCaptureTuning, x as HostedDocumentScanTuning, y as HostedEidView, z as HostedEmailOtpView, G as HostedFlowRef, K as HostedIntegrity, L as HostedLivePhotoTuning, O as HostedNativeCaptureTuning, Q as HostedOcrTuning, T as HostedOtpView, U as HostedPlanView, V as HostedPortraitView, W as HostedStepView, X as HostedVoiceLocale, Y as HostedVoiceView, h as IcaoCriterion, _ as IcaoReportEntry, I as IdentityConfirmDecision, $ as IdentityMethod, a0 as IdentitySummarySource, a1 as IdentitySummaryView, aJ as LivenessCaptureInput, aK as LivenessInput, a2 as LivenessReason, a3 as MatchReason, M as MediaKind, a4 as MethodChoiceView, a5 as NationalEidOption, a6 as NfcChipReason, a7 as NfcStepView, a8 as OtpChoiceView, a9 as PhoneCountryRule, aa as PhoneFormat, aL as PhoneOtpInput, ab as PhoneOtpReason, ac as PlanAttempts, ad as PlanChoiceKind, ae as PlanChoiceOption, af as PlanChoiceView, ag as PlanSectionView, ah as PlanStepView, ai as PolicyFailureReason, aM as PopulationInput, aj as PopulationReason, al as PortraitIcaoReason, aN as PresignRequest, P as PresignUploadResult, aO as RecordConsentResult, am as ResolvedCaptureMode, ar as SessionFailureReason, as as SessionOutcome, at as SessionStatus, aP as SessionStepView, aQ as SessionView, au as StepSection, aR as SubmitCheckBody, av as VerificationAssurance, aw as VerificationLevel } from '../types-DPl0hsmI.js';
|
|
1
|
+
export { H as HostedClient, a as HostedClientOptions, M as MediaCheckType, S as SEKYRO_SDK_HEADER, b as SubmitOptions, U as UploadMedia, s as stripMimeParams } from '../icao-gate-CEGvJR3q.js';
|
|
2
|
+
export { H as HostedApiError, a as HostedErrorDetails, b as HostedErrorIssue, K as KNOWN_CODES, c as KnownCode, i as icaoPolicyOf, d as isKnownCode, p as portraitIcaoGate } from '../icao-policy-BgI1Y870.js';
|
|
3
|
+
export { A as AcceptedDocumentType, a as AttestationInput, C as CaptureContext, b as CaptureMode, c as CaptureNoncesResult, d as CaptureProof, e as CheckInputByType, f as CheckReason, g as CheckState, h as CheckType, i as CompleteMediaResult, j as ConsentLocale, k as ContactChannel, D as DecisionReason, l as DocDeviceRead, m as DocOcrInput, n as DocReason, o as DocSide, E as EidAfterPass, p as EidAuthInput, q as EidReason, r as EmailOtpInput, s as EmailOtpReason, F as FaceMatchInput, t as FaceMatchReason, H as HostedAcceptedDocuments, u as HostedCaptureTuning, v as HostedConsentView, w as HostedDocumentCaptureTuning, x as HostedDocumentScanTuning, y as HostedDocumentsView, z as HostedEidView, B as HostedEmailOtpView, G as HostedFlowRef, I as HostedIcaoPolicy, J as HostedIntegrity, K as HostedLivePhotoTuning, L as HostedNativeCaptureTuning, M as HostedOcrTuning, N as HostedOtpView, O as HostedPlanView, P as HostedPortraitPendingFix, Q as HostedPortraitView, R as HostedSessionView, S as HostedStepView, T as HostedVoiceLocale, U as HostedVoiceView, V as IcaoCriterion, W as IcaoReportEntry, X as IdentityConfirmDecision, Y as IdentityMethod, Z as IdentitySummarySource, _ as IdentitySummaryView, $ as LivenessCaptureInput, a0 as LivenessInput, a1 as LivenessReason, a2 as MatchReason, a3 as MediaKind, a4 as MethodChoiceView, a5 as NationalEidOption, a6 as NfcChipReason, a7 as NfcStepView, a8 as OtpChoiceView, a9 as PhoneCountryRule, aa as PhoneFormat, ab as PhoneOtpInput, ac as PhoneOtpReason, ad as PhotoSource, ae as PhotoSourcePick, af as PlanAttempts, ag as PlanChoiceKind, ah as PlanChoiceOption, ai as PlanChoiceView, aj as PlanSectionView, ak as PlanStepView, al as PolicyFailureReason, am as PopulationInput, an as PopulationReason, ao as PortraitFix, ap as PortraitFixReviewInput, aq as PortraitIcaoInput, ar as PortraitIcaoReason, as as PortraitOutputFormat, at as PresignRequest, au as PresignUploadResult, av as RecordConsentResult, aw as ResolvedCaptureMode, ax as SessionFailureReason, ay as SessionOutcome, az as SessionStatus, aA as SessionStepView, aB as SessionView, aC as StepSection, aD as SubmitCheckBody, aE as VerificationAssurance, aF as VerificationLevel } from '../types-Dpfg2cO8.js';
|
|
5
4
|
|
|
6
|
-
/**
|
|
7
|
-
|
|
8
|
-
* A closed string-literal union — switch over {@link KnownCode} with a `never`
|
|
9
|
-
* default arm for compile-checked exhaustiveness.
|
|
10
|
-
*/
|
|
11
|
-
declare const KNOWN_CODES: readonly ["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"];
|
|
12
|
-
/** Closed union of {@link KNOWN_CODES} — exhaustively switchable. */
|
|
13
|
-
type KnownCode = (typeof KNOWN_CODES)[number];
|
|
14
|
-
/** Narrow an arbitrary wire code to the known union (unknown codes stay `string`). */
|
|
15
|
-
declare function isKnownCode(code: string): code is KnownCode;
|
|
16
|
-
/** One machine-readable problem of an error's `details` (Sekyro flows spec §9.4). */
|
|
17
|
-
interface HostedErrorIssue {
|
|
18
|
-
code: string;
|
|
19
|
-
message: string;
|
|
20
|
-
/** The request field (`option`, `nodeId`, …). */
|
|
21
|
-
path?: string;
|
|
22
|
-
/** A node of the flow. */
|
|
23
|
-
nodeId?: string;
|
|
24
|
-
service?: string;
|
|
25
|
-
field?: string;
|
|
26
|
-
}
|
|
27
|
-
/** `details` of a flow error envelope (`choice_*`, `step_not_on_path`, …): the issues, and more per code. */
|
|
28
|
-
interface HostedErrorDetails {
|
|
29
|
-
issues: HostedErrorIssue[];
|
|
30
|
-
/** `override_widens_flow`: the widened fields. */
|
|
31
|
-
fields?: string[];
|
|
32
|
-
[key: string]: unknown;
|
|
33
|
-
}
|
|
34
|
-
/**
|
|
35
|
-
* Typed transport error: EVERY failure surfaces as one of these — non-2xx
|
|
36
|
-
* responses, rejected fetches, timeouts, and unparseable bodies alike. The
|
|
37
|
-
* hosted page never sees a raw TypeError/DOMException from the client.
|
|
38
|
-
*
|
|
39
|
-
* - `code` — the public envelope's `code`, or a client-synthesized fallback
|
|
40
|
-
* ('unknown_error' / 'upload_failed' / 'network_error' / 'timeout'). Typed
|
|
41
|
-
* `string` because the wire may grow codes; narrow with {@link isKnownCode}
|
|
42
|
-
* before an exhaustive switch.
|
|
43
|
-
* - `status` — the HTTP status, or 0 when no response arrived at all
|
|
44
|
-
* ('network_error' / 'timeout').
|
|
45
|
-
* - `retryAfterSeconds` — parsed from the `Retry-After` header when present
|
|
46
|
-
* (rate-limit 429s always set it).
|
|
47
|
-
* - `details` — the envelope's machine-readable `details` when present (flow
|
|
48
|
-
* errors: `issues[]`).
|
|
49
|
-
*/
|
|
50
|
-
declare class HostedApiError extends Error {
|
|
51
|
-
readonly status: number;
|
|
52
|
-
readonly code: string;
|
|
53
|
-
readonly retryAfterSeconds?: number;
|
|
54
|
-
readonly details?: HostedErrorDetails;
|
|
55
|
-
constructor(args: {
|
|
56
|
-
status: number;
|
|
57
|
-
code: string;
|
|
58
|
-
message: string;
|
|
59
|
-
retryAfterSeconds?: number;
|
|
60
|
-
details?: HostedErrorDetails | undefined;
|
|
61
|
-
});
|
|
62
|
-
}
|
|
5
|
+
/** The page runs inside an app's WebView (WhatsApp, Instagram, Facebook, TikTok, Snapchat, LINE, LinkedIn, WeChat, an Android WebView…). */
|
|
6
|
+
declare function isInAppBrowser(userAgent?: string): boolean;
|
|
63
7
|
|
|
64
|
-
|
|
65
|
-
declare function icaoPolicyOf(view: Pick<HostedSessionView, "portrait"> | null | undefined): HostedIcaoPolicy | null;
|
|
66
|
-
/**
|
|
67
|
-
* The `gate` block of a `portrait_icao` body from the gate's summary: the eye
|
|
68
|
-
* baseline, the device verdict under the server's criterion names, and the
|
|
69
|
-
* background-uniformity numbers (telemetry).
|
|
70
|
-
*/
|
|
71
|
-
declare function portraitIcaoGate(summary: IcaoGateSummary): NonNullable<PortraitIcaoInput["gate"]>;
|
|
72
|
-
|
|
73
|
-
export { HostedApiError, type HostedErrorDetails, type HostedErrorIssue, HostedIcaoPolicy, HostedSessionView, KNOWN_CODES, type KnownCode, PortraitIcaoInput, icaoPolicyOf, isKnownCode, portraitIcaoGate };
|
|
8
|
+
export { isInAppBrowser };
|
package/dist/client/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as
|
|
1
|
+
import{a as t,b as o,c as i,e as n,f as s,g as a,h as r,i as p}from"../chunk-NJML6FMD.js";import{b as e}from"../chunk-ZLWH4RBO.js";export{i as HostedApiError,a as HostedClient,t as KNOWN_CODES,s as SEKYRO_SDK_HEADER,r as icaoPolicyOf,e as isInAppBrowser,o as isKnownCode,p as portraitIcaoGate,n as stripMimeParams};
|
package/dist/core/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var dt=Object.create;var K=Object.defineProperty;var mt=Object.getOwnPropertyDescriptor;var pt=Object.getOwnPropertyNames;var ft=Object.getPrototypeOf,ht=Object.prototype.hasOwnProperty;var gt=(r,e)=>()=>(r&&(e=r(r=0)),e);var Se=(r,e)=>{for(var t in e)K(r,t,{get:e[t],enumerable:!0})},ke=(r,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of pt(e))!ht.call(r,i)&&i!==t&&K(r,i,{get:()=>e[i],enumerable:!(n=mt(e,i))||n.enumerable});return r};var yt=(r,e,t)=>(t=r!=null?dt(ft(r)):{},ke(e||!r||!r.__esModule?K(t,"default",{value:r,enumerable:!0}):t,r)),bt=r=>ke(K({},"__esModule",{value:!0}),r);var rt={};Se(rt,{RANK_CANDIDATES:()=>tr,RANK_TOLERANCE:()=>Q,RANK_WINDOW_MS:()=>rr,ROLL_ZERO_DEG:()=>ir,SHARPNESS_REPORT_MAX:()=>et,YAW_REPORT_MAX:()=>Je,YAW_ZERO_IOD:()=>nr,collectRankedKeyframes:()=>tt,default:()=>sr,featuresOf:()=>je,frontalOf:()=>Qe,rankKeyframes:()=>$e});function Qe(r){let e=r.eyes;if(e===void 0)return{frontal:1,yaw:null,roll:null};let t=e.right.x-e.left.x,n=e.right.y-e.left.y,i=t*t+n*n;if(i===0)return{frontal:1,yaw:null,roll:null};let a=Math.abs(Math.atan2(n,Math.abs(t))*180/Math.PI),s=Ze(1-a/30),o=null,u=r.nose;if(u!==void 0){let d=(e.left.x+e.right.x)/2,c=(e.left.y+e.right.y)/2;o=Math.abs(((u.x-d)*t+(u.y-c)*n)/i),s*=Ze(1-o/.5)}return{frontal:s,yaw:o,roll:a}}function je(r,e){return r===null?{face:!1,frontal:0,yaw:null,roll:null,eyes:null,score:0,sharpness:e}:{face:!0,...Qe(r),eyes:null,score:r.score,sharpness:e}}function $e(r){let e=r.map((i,a)=>a),t=(i,a)=>{let s=Number.NEGATIVE_INFINITY;for(let o of e)s=Math.max(s,i(r[o]));e=e.filter(o=>i(r[o])>=s-a)};t(i=>i.frontal,Q.frontal),t(i=>i.eyes??1,Q.eyes),t(i=>i.score,Q.score);let n=-1;for(let i of e)(n===-1||r[i].sharpness>r[n].sharpness)&&(n=i);return n}function ar(r){return{face:r.face,frontal:O(r.frontal),...r.yaw!==null?{yaw:Math.min(O(r.yaw),Je)}:{},...r.roll!==null?{roll:O(r.roll)}:{},...r.eyes!==null?{eyes:O(r.eyes)}:{},score:O(r.score),sharpness:Math.min(O(r.sharpness),et)}}async function tt(r,e){let{options:t}=r,n=t.video,i=t.now??(()=>performance.now()),a=t.captureKeyframe??(m=>r.defaultKeyframe(m)),s=600/3,o=[],u=[],d=0;for(let m=0;m<4;m+=1){if(e!==r.attempt)return null;let f=r.detector,p=Promise.resolve(null),h,g=0;try{if(f!==null){let _=r.profiler?.profile.inputWidth??160,I=t.makeSnapshot?.(n,_)??r.defaultSnapshot(n,_);h=a(n).then(y=>(g=i(),y));let J=i();p=f.detect(I,n.videoWidth,n.videoHeight).then(y=>(d+=i()-J,y),()=>null)}else h=a(n).then(_=>(g=i(),_));let[v,M]=await Promise.all([h,p]);o.push(v),u.push(je(M,v.sharpness))}catch{h?.catch(()=>{})}let E=g>0?Math.max(0,i()-g):0;m<3&&await new Promise(v=>setTimeout(v,Math.max(0,s-E)))}if(e!==r.attempt)return null;let c=$e(u);if(c===-1)return null;let l=0;u.forEach((m,f)=>{m.sharpness>u[l].sharpness&&(l=f)});try{t.telemetry?.({type:"keyframe",tier:r.detector?.tier??null,chosen:c,sharpest:l,detectMs:Math.round(d),candidates:u.map(ar)})}catch{}return o[c]??null}var tr,rr,nr,ir,Q,Ze,O,Je,et,sr,nt=gt(()=>{"use strict";tr=4,rr=600,nr=.5,ir=30,Q={frontal:.1,eyes:.1,score:.05},Ze=r=>r<0?0:r>1?1:r;O=r=>Number.isFinite(r)?Math.round(r*1e3)/1e3:0,Je=99,et=999999;sr=tt});var dr={};Se(dr,{CENTERED_FACTOR:()=>xt,CIRCLE_RADIUS_FACTOR:()=>Ct,CLIP_MS:()=>_e,CaptureSessionV3:()=>Ee,ClipError:()=>b,ClipRecorder:()=>P,DEFAULT_CLIP_MIME:()=>W,DEFAULT_TIER_ORDER:()=>Oe,DEFAULT_V3_ASSET_BASE_URL:()=>De,DEVICE_PROFILES:()=>Pe,DetectScheduler:()=>G,DetectorLadderError:()=>T,DeviceProfiler:()=>N,EXPOSURE_BAND:()=>L,FaceGateV3:()=>w,GATE_SNAPSHOT_MS:()=>st,GateBlockStats:()=>D,HOLD_UPRIGHT_KEY:()=>j,IN_CIRCLE_FACTOR:()=>Tt,KEYFRAME_CANDIDATES:()=>$,KEYFRAME_WINDOW_MS:()=>ct,MAX_CLIP_BYTES:()=>H,MIME_CANDIDATES:()=>Me,PHONE_MAX_SHORT_SIDE:()=>xe,PROVENANCE_WAIT_MS:()=>ut,SHARP_REF:()=>Tr,STOP_GRACE_MS:()=>Te,TIMESLICE_MS:()=>Ce,UPRIGHT_WATCH_MS:()=>ot,V3_GATE_DEFAULTS:()=>Ae,VIDEO_BPS:()=>ae,blockReasonOf:()=>Ye,buildCaptureConstraints:()=>se,buildLivenessV2FormData:()=>Et,cameraPreflight:()=>ne,captureMirroredKeyframe:()=>ie,classifyDevice:()=>pe,createDetector:()=>x,detectFormFactor:()=>U,detectIsMobile:()=>oe,errorCopy:()=>St,exposure:()=>le,extForMime:()=>ee,intrinsicSize:()=>C,isClipTooLarge:()=>A,isMediaRecorderSupported:()=>vt,mapGetUserMediaError:()=>re,meanLuma:()=>q,pickMimeType:()=>te,probeDevice:()=>me,sharpness:()=>Y,toStreamPixels:()=>F,trackFacingMode:()=>ce,uiCopy:()=>kt});module.exports=bt(dr);var Me=["video/mp4;codecs=avc1.42E01E,mp4a.40.2","video/mp4;codecs=avc1.42E01E","video/mp4","video/webm;codecs=vp9,opus","video/webm;codecs=vp9","video/webm;codecs=vp8,opus","video/webm;codecs=vp8","video/webm"];function te(){let r=globalThis.MediaRecorder;return!r||typeof r.isTypeSupported!="function"?"":Me.find(e=>r.isTypeSupported(e))??""}var W="video/webm";function re(r){if(r instanceof TypeError)return"insecure";switch(r?.name??""){case"NotAllowedError":case"PermissionDeniedError":return"permission";case"NotFoundError":case"DevicesNotFoundError":return"notfound";case"NotReadableError":case"TrackStartError":return"inuse";case"OverconstrainedError":case"ConstraintNotSatisfiedError":return"overconstrained";default:return"generic"}}function ne(){let r=globalThis;if(typeof r.window<"u"&&r.window.isSecureContext===!1)return"INSECURE_CONTEXT";let e=r.navigator?.mediaDevices;return!e||typeof e.getUserMedia!="function"?"UNSUPPORTED":"OK"}function vt(){let r=globalThis.MediaRecorder;return typeof r<"u"&&typeof r.isTypeSupported=="function"}var H=8*1024*1024;function A(r){return r.size>H}function ee(r){let e=(r||"").toLowerCase();return e.startsWith("image/jpeg")?"jpg":e.startsWith("video/mp4")?"mp4":(e.startsWith("video/webm"),"webm")}function Et(r){let{token:e,clip:t,keyframe:n}=r,i=r.ts??Date.now(),a=t.type||W,s=n.type||"image/jpeg",o=new FormData;return o.append("token",e),o.append("clip",new File([t],`liveness-${i}.${ee(a)}`,{type:a})),o.append("keyframe",new File([n],`keyframe-${i}.${ee(s)}`,{type:s})),o}function ie(r,e,t=.92){return new Promise((n,i)=>{let a=r.videoWidth,s=r.videoHeight;if(!a||!s){i(new Error("video-not-ready"));return}let o=e.getContext("2d");if(!o){i(new Error("no-2d-context"));return}e.width=a,e.height=s,o.scale(-1,1),o.drawImage(r,-a,0),e.toBlob(u=>u?n(u):i(new Error("empty-keyframe")),"image/jpeg",t)})}var St={permission:{key:"fcv2.err.permission",fr:"Autorisez la cam\xE9ra dans les r\xE9glages du navigateur (ic\xF4ne cam\xE9ra dans la barre d\u2019adresse), puis r\xE9essayez."},notfound:{key:"fcv2.err.notfound",fr:"Aucune cam\xE9ra d\xE9tect\xE9e. Branchez ou activez une cam\xE9ra, puis r\xE9essayez."},inuse:{key:"fcv2.err.inuse",fr:"La cam\xE9ra est utilis\xE9e par une autre application. Fermez-la puis r\xE9essayez."},overconstrained:{key:"fcv2.err.overconstrained",fr:"La cam\xE9ra ne prend pas en charge les r\xE9glages demand\xE9s. Nouvel essai en cours\u2026"},insecure:{key:"fcv2.err.insecure",fr:"La cam\xE9ra n\xE9cessite une connexion s\xE9curis\xE9e (HTTPS). Ouvrez la page en HTTPS."},unsupported:{key:"fcv2.err.unsupported",fr:"Votre navigateur ne prend pas en charge l\u2019enregistrement vid\xE9o. Utilisez un navigateur r\xE9cent."},generic:{key:"fcv2.err.generic",fr:"Cam\xE9ra indisponible. R\xE9essayez ou contactez le support."}},kt={recording:{key:"fcv2.recording",fr:"Enregistrement en cours\u2026"},uploading:{key:"fcv2.uploading",fr:"Envoi en cours\u2026"},clipTooLarge:{key:"fcv2.err.cliptoolarge",fr:"La vid\xE9o est trop volumineuse. R\xE9essayez dans un endroit mieux \xE9clair\xE9."},retry:{key:"fcv2.retry",fr:"R\xE9essayer"},listen:{key:"fcv2.listen",fr:"\xC9couter"}};var _e=2500,Ce=1e3,Te=1500,ae=25e5,b=class extends Error{constructor(e,t){super(t??e),this.kind=e}},P=class{constructor(){this.recorder=null;this.stream=null;this.chunks=[];this.bytes=0;this.hardStopTimer=null;this.graceTimer=null;this.settled=!1}clearTimers(){this.hardStopTimer&&clearTimeout(this.hardStopTimer),this.graceTimer&&clearTimeout(this.graceTimer),this.hardStopTimer=null,this.graceTimer=null}record(e,t,n){if(this.recorder&&!this.settled)return Promise.reject(new b("generic","record() called while a recording is in flight \u2014 ClipRecorder handles one recording at a time"));this.recorder=null,this.clearTimers(),this.chunks=[],this.bytes=0,this.settled=!1,this.stream=e;let i=te();return new Promise((a,s)=>{let o;try{o=new MediaRecorder(e,i?{mimeType:i,videoBitsPerSecond:ae}:{videoBitsPerSecond:ae})}catch{try{o=new MediaRecorder(e)}catch{s(new b("unsupported"));return}}this.recorder=o;let u=c=>{this.settled||(this.settled=!0,this.clearTimers(),c())},d=()=>u(()=>{let c=o.mimeType||i||W,l=new Blob(this.chunks,{type:c});if(l.size===0){s(new b("generic","empty clip"));return}if(A(l)){s(new b("cliptoolarge"));return}a({blob:l,mimeType:c})});if(o.ondataavailable=c=>{c.data&&c.data.size&&(this.chunks.push(c.data),this.bytes+=c.data.size,this.bytes>H&&u(()=>{try{o.state!=="inactive"&&o.stop()}catch{}s(new b("cliptoolarge"))}))},o.onstop=d,o.onerror=()=>u(()=>s(new b("generic"))),n!==void 0){let c=!1;o.onstart=()=>{if(!(c||this.settled)){c=!0;try{n()}catch{}}}}try{o.start(Ce)}catch{u(()=>s(new b("generic")));return}this.hardStopTimer=setTimeout(()=>{if(this.settled||t?.(),o.state!=="inactive"){try{o.stop()}catch{d()}this.graceTimer=setTimeout(d,Te)}else d()},_e)})}stop(e){this.clearTimers();let t=this.recorder;if(t&&t.state!=="inactive")try{t.stop()}catch{}this.recorder=null,(e??this.stream)?.getTracks().forEach(i=>i.stop()),this.stream=null}};function se(r,e){return{video:{width:{ideal:1280,max:1280},height:{ideal:720,max:720},facingMode:e,frameRate:{ideal:24,max:30}},audio:!1}}var xe=600;function U(){if(typeof window>"u"||typeof navigator>"u")return"desktop";let r=String(navigator.userAgent??"");if(/iPhone|iPod/i.test(r))return"phone";if(/iPad/i.test(r))return"tablet";if(/Android/i.test(r))return/Mobile/i.test(r)?"phone":"tablet";if(/BlackBerry|IEMobile|Opera Mini/i.test(r))return"phone";if(Number(navigator.maxTouchPoints??0)<=1)return"desktop";if(/Macintosh/.test(r))return"tablet";if(!_t())return"desktop";let t=Mt();return t>0&&t<xe?"phone":"tablet"}function oe(){return U()!=="desktop"}function Mt(){try{let r=window.screen,e=Number(r?.width??0),t=Number(r?.height??0);return e>0&&t>0?Math.min(e,t):0}catch{return 0}}function ce(r){try{let t=r?.getVideoTracks?.()[0]?.getSettings?.().facingMode;return t==="user"||t==="environment"?t:null}catch{return null}}function _t(){try{return typeof window.matchMedia=="function"&&window.matchMedia("(pointer: coarse)").matches}catch{return!1}}var Ct=.45,Tt=.9,xt=.4;var Re=1e4,B=class r{constructor(e,t){this.tier="blaze";this.inner=e,t!==void 0&&(this.fallbackReason=t)}static async create(e,t){let n=await import("@mediapipe/tasks-vision"),i=await n.FilesetResolver.forVisionTasks(e),a=await n.FaceDetector.createFromOptions(i,{baseOptions:{modelAssetPath:`${e}/blaze_face_short_range.tflite`,delegate:"CPU"},runningMode:"IMAGE"});return new r(a,t)}async detect(e,t,n){let i;try{i=this.inner.detect(e).detections}catch{return null}let a=Rt(i);if(a?.boundingBox===void 0)return null;let s=C(e),o=wt(a.keypoints,s),u=a.keypoints?.[2],d={box:{x:a.boundingBox.originX,y:a.boundingBox.originY,width:a.boundingBox.width,height:a.boundingBox.height},...o!==void 0?{eyes:o}:{},...u!==void 0?{nose:{x:u.x*s.width,y:u.y*s.height}}:{},score:a.categories[0]?.score??0};return F(d,e,t,n)}destroy(){try{this.inner.close()}catch{}}};function Rt(r){let e,t=-1;for(let n of r){let i=n.categories[0]?.score??0;i>t&&(e=n,t=i)}return e}function wt(r,e){let t=r?.[0],n=r?.[1];if(t===void 0||n===void 0)return;let i=o=>({x:o.x*e.width,y:o.y*e.height}),[a,s]=[i(t),i(n)];return a.x<=s.x?{left:a,right:s}:{left:s,right:a}}function Dt(){if(typeof OffscreenCanvas=="function")return new OffscreenCanvas(2,2);let r=document.createElement("canvas");return r.width=2,r.height=2,r}async function we(){let r=globalThis.FaceDetector;if(typeof r!="function")return{ok:!1,reason:"unsupported"};try{let e=new r({fastMode:!0,maxDetectedFaces:1});return await e.detect(Dt()),{ok:!0,instance:e}}catch(e){return{ok:!1,reason:`smoke_failed:${e instanceof Error?e.message:String(e)}`}}}var z=class{constructor(e,t){this.tier="native";this.inner=e,t!==void 0&&(this.fallbackReason=t)}async detect(e,t,n){let i;try{i=await this.inner.detect(e)}catch{return null}let a=i[0];if(a===void 0)return null;let s=Ot(a.landmarks),o={box:{x:a.boundingBox.x,y:a.boundingBox.y,width:a.boundingBox.width,height:a.boundingBox.height},...s!==void 0?{eyes:s}:{},score:1};return F(o,e,t,n)}destroy(){}};function Ot(r){if(r===void 0)return;let e=r.filter(i=>i.type==="eye").map(i=>i.locations[0]).filter(i=>i!==void 0),[t,n]=e;if(!(t===void 0||n===void 0))return t.x<=n.x?{left:t,right:n}:{left:n,right:t}}var De="/models-v3",Oe=["native","blaze"],T=class extends Error{constructor(e){super(`no detector tier available (${e})`),this.name="DetectorLadderError",this.fallbackReason=e}};function C(r){let e=r;if(typeof e.videoWidth=="number"&&e.videoWidth>0)return{width:e.videoWidth,height:e.videoHeight??0};if(typeof e.naturalWidth=="number"&&e.naturalWidth>0)return{width:e.naturalWidth,height:e.naturalHeight??0};let t=typeof e.width=="number"?e.width:0,n=typeof e.height=="number"?e.height:0;return{width:t,height:n}}function F(r,e,t,n){let i=C(e),a=i.width>0?t/i.width:1,s=i.height>0?n/i.height:1,o=u=>({x:u.x*a,y:u.y*s});return{box:{x:r.box.x*a,y:r.box.y*s,width:r.box.width*a,height:r.box.height*s},...r.eyes!==void 0?{eyes:{left:o(r.eyes.left),right:o(r.eyes.right)}}:{},...r.nose!==void 0?{nose:o(r.nose)}:{},score:r.score}}function It(r){return r instanceof Error?r.message:String(r)}async function x(r){let e=r.preferred??Oe,t=[];for(let n of e){if(n==="native"){let i=await we();if(i.ok)return new z(i.instance,ue(t));t.push(`native:${i.reason}`);continue}try{return await At(B.create(r.v3AssetBaseUrl??De,ue(t)),r.blazeInitTimeoutMs??Re)}catch(i){t.push(i instanceof X?"blaze:blaze_init_timeout":`blaze:${It(i)}`)}}throw new T(ue(t)??"no_tier_available")}function ue(r){return r.length>0?r.join("; "):void 0}var X=class extends Error{};function At(r,e){return new Promise((t,n)=>{let i=setTimeout(()=>{n(new X(`init exceeded ${e}ms`)),r.then(a=>a.destroy(),()=>{})},e);r.then(a=>{clearTimeout(i),t(a)},a=>{clearTimeout(i),n(a)})})}var Tr=180,L=[100,190],Pt=64;function Ie(r,e){return .299*(r[e]??0)+.587*(r[e+1]??0)+.114*(r[e+2]??0)}function q(r){let{data:e,width:t,height:n}=r,i=t*n;if(i===0)return 0;let a=0;for(let s=0;s<i;s+=1)a+=Ie(e,s*4);return a/i}function Y(r){let{data:e,width:t,height:n}=r;if(t<3||n<3)return 0;let i=new Float32Array(t*n);for(let c=0;c<i.length;c+=1)i[c]=Ie(e,c*4);let a=0,s=0,o=0;for(let c=1;c<n-1;c+=1)for(let l=1;l<t-1;l+=1){let m=c*t+l,f=(i[m-t]??0)+(i[m-1]??0)+(i[m+1]??0)+(i[m+t]??0)-4*(i[m]??0);a+=f,s+=f*f,o+=1}if(o===0)return 0;let u=a/o,d=s/o-u*u;return Math.min(1,Math.max(0,d)/180)}function le(r){let e=q(r),[t,n]=L,i=e<t?t-e:e>n?e-n:0;return Math.max(0,1-i/Pt)}var Ae=Object.freeze({Q_GOOD:.6,RISE_PER_S:.9,FALL_PER_S:.25,CENTER_FALLOFF_IOD_MULTIPLE:1.35,BOX_EYE_OFFSET_FACTOR:.12,IOD_BOX_PROXY_FACTOR:.42,SIZE_IDEAL_MIN:.12,SIZE_IDEAL_MAX:.3,SIZE_HARD_MIN:.08,SIZE_HARD_MAX:.45,ROLL_MAX_DEG:25,MOTION_VELOCITY_IOD_PER_S:.5,MOTION_TAU_S:.4,MOTION_DEADBAND_IOD_PER_S:.1,READY_WINDOW_MS:500,GUIDE_SIZE:.6,GUIDE_CENTERING:.6,GUIDE_POSE:.6,GUIDE_EXPOSURE:.6,GUIDE_SHARPNESS:.35,GUIDE_MOTION:.5}),R=r=>Math.min(1,Math.max(0,r)),w=class{constructor(e={}){this.p=0;this.lastTickAt=null;this.lastCenter=null;this.velocityEma=0;this.qWindow=[];this.lastSizeDirection="ideal";this.t={...Ae,...e}}reset(){this.p=0,this.lastTickAt=null,this.lastCenter=null,this.velocityEma=0,this.qWindow=[],this.lastSizeDirection="ideal"}tick(e){let{observation:t,quality:n,timestampMs:i}=e,a=this.lastTickAt===null?0:Math.max(0,(i-this.lastTickAt)/1e3);this.lastTickAt=i;let s={presence:0,centering:0,size:0,pose:0,sharpness:R(n.sharpness),exposure:R(n.exposure),motion:1};if(t!==null){s.presence=1;let c=this.geometryOf(t,e);s.centering=c.centering,s.size=c.size,s.pose=c.pose,s.motion=this.motionOf(c.center,c.iod,i)}else this.lastCenter=null,this.velocityEma=0;let o=Math.min(s.presence,s.centering,s.size,s.pose,s.sharpness,s.exposure,s.motion);this.p=R(this.p+(o>=this.t.Q_GOOD?this.t.RISE_PER_S*o:-this.t.FALL_PER_S*(1-o))*a),this.qWindow.push({at:i,q:o}),this.qWindow=this.qWindow.filter(c=>c.at>=i-this.t.READY_WINDOW_MS);let u=this.qWindow.map(c=>c.q);if(u.length>=3){let c=Math.min(...u),l=u.indexOf(c);u=u.filter((m,f)=>f!==l)}let d=this.p>=1&&u.every(c=>c>=this.t.Q_GOOD);return{at:i,q:o,p:this.p,factors:s,guidanceKey:this.guidanceOf(s,n,o),ready:d,accepted:o>=this.t.Q_GOOD}}geometryOf(e,t){let{box:n,eyes:i}=e,a={x:t.frameWidth/2,y:t.frameHeight/2},s=Math.min(t.frameWidth,t.frameHeight),o=i!==void 0?{x:(i.left.x+i.right.x)/2,y:(i.left.y+i.right.y)/2}:{x:n.x+n.width/2,y:n.y+n.height/2-this.t.BOX_EYE_OFFSET_FACTOR*n.height},u=i!==void 0?Math.hypot(i.right.x-i.left.x,i.right.y-i.left.y):this.t.IOD_BOX_PROXY_FACTOR*n.width,d=Math.hypot(o.x-a.x,o.y-a.y),c=u<=0?0:1-R(d/(this.t.CENTER_FALLOFF_IOD_MULTIPLE*u)),l=s>0?u/s:0;this.lastSizeDirection=l<this.t.SIZE_IDEAL_MIN?"far":l>this.t.SIZE_IDEAL_MAX?"close":"ideal";let m;l<this.t.SIZE_HARD_MIN||l>this.t.SIZE_HARD_MAX?m=0:l<this.t.SIZE_IDEAL_MIN?m=(l-this.t.SIZE_HARD_MIN)/(this.t.SIZE_IDEAL_MIN-this.t.SIZE_HARD_MIN):l>this.t.SIZE_IDEAL_MAX?m=(this.t.SIZE_HARD_MAX-l)/(this.t.SIZE_HARD_MAX-this.t.SIZE_IDEAL_MAX):m=1;let f=1;if(i!==void 0){let p=Math.abs(Math.atan2(i.right.y-i.left.y,i.right.x-i.left.x))*180/Math.PI;f=1-R(p/this.t.ROLL_MAX_DEG)}return{center:o,iod:u,centering:c,size:m,pose:f}}motionOf(e,t,n){let i=this.lastCenter;if(this.lastCenter={...e,at:n},i===null||t<=0)return 1;let a=(n-i.at)/1e3;if(a<=0)return 1;let s=Math.hypot(e.x-i.x,e.y-i.y)/t/a;s<=this.t.MOTION_DEADBAND_IOD_PER_S&&(s=0);let o=1-Math.exp(-a/this.t.MOTION_TAU_S);return this.velocityEma=o*s+(1-o)*this.velocityEma,1-R(this.velocityEma/this.t.MOTION_VELOCITY_IOD_PER_S)}guidanceOf(e,t,n){if(e.presence<=0)return"fcv3.no_face";if(e.size<this.t.GUIDE_SIZE)return this.sizeGuidance();if(e.centering<this.t.GUIDE_CENTERING)return"fcv3.center_face";if(e.pose<this.t.GUIDE_POSE)return"fcv3.straighten";if(e.exposure<this.t.GUIDE_EXPOSURE)return this.exposureGuidance(t);if(e.sharpness<this.t.GUIDE_SHARPNESS)return"fcv3.steady_camera";if(e.motion<this.t.GUIDE_MOTION)return"fcv3.hold_still";if(n<this.t.Q_GOOD){let i=[["size",this.sizeGuidance()],["centering","fcv3.center_face"],["pose","fcv3.straighten"],["exposure",this.exposureGuidance(t)],["sharpness","fcv3.steady_camera"],["motion","fcv3.hold_still"]],a=i[0];for(let s of i)e[s[0]]<e[a[0]]&&(a=s);return a[1]}return"fcv3.hold_still"}sizeGuidance(){return this.lastSizeDirection==="far"?"fcv3.come_closer":"fcv3.move_back"}exposureGuidance(e){let t=(L[0]+L[1])/2;return e.meanLuma<t?"fcv3.more_light":"fcv3.too_bright"}};var Pe=Object.freeze({LOW:Object.freeze({cadenceHz:5,inputWidth:128,animations:"reduced"}),MID:Object.freeze({cadenceHz:8,inputWidth:160,animations:"full"}),HIGH:Object.freeze({cadenceHz:10,inputWidth:192,animations:"full"})}),Ft=new Uint8Array([0,97,115,109,1,0,0,0,1,5,1,96,0,1,123,3,2,1,0,10,10,1,8,0,65,0,253,15,253,98,11]);function me(){let r=typeof navigator>"u"?void 0:navigator,e=!1;try{e=typeof WebAssembly<"u"&&WebAssembly.validate(Ft)}catch{e=!1}return{cores:r?.hardwareConcurrency??2,memGB:r?.deviceMemory??null,simd:e}}function pe(r){let e=r.memGB??4;return r.cores<4||e<3?"LOW":r.cores>=8&&e>=6?"HIGH":"MID"}var de=["LOW","MID","HIGH"],N=class{constructor(e){this.samples=[];this.adjusted=!1;this.current=e}get deviceClass(){return this.current}get profile(){return Pe[this.current]}record(e){if(this.adjusted||this.samples.length>=10)return this.current;if(this.samples.push(e),this.samples.length<10)return this.current;this.adjusted=!0;let t=this.samples.reduce((n,i)=>n+i,0)/this.samples.length;if(t>70)this.current="LOW";else if(t<25){let n=de.indexOf(this.current);this.current=de[Math.min(de.length-1,n+1)]??this.current}return this.current}};var G=class{constructor(e){this.timer=null;this.frameCallbackId=null;this.running=!1;this.busy=!1;this.lastRunAt=Number.NEGATIVE_INFINITY;this.degradeCount=0;this.durations=[];this.options=e,this.periodMs=1e3/e.cadenceHz}start(){if(this.running)return;this.running=!0;let e=this.options.video;if(typeof e?.requestVideoFrameCallback=="function"){let t=()=>{this.running&&(this.frameCallbackId=e.requestVideoFrameCallback?.(()=>{this.frameCallbackId=null,this.now()-this.lastRunAt>=this.periodMs&&this.tick(),t()}))};t();return}this.timer=setInterval(()=>this.tick(),this.periodMs)}stop(){this.running=!1,this.timer!==null&&(clearInterval(this.timer),this.timer=null),this.frameCallbackId!==null&&(this.options.video?.cancelVideoFrameCallback?.(this.frameCallbackId),this.frameCallbackId=null)}stats(){let e=this.durations.length===0?0:this.durations.reduce((t,n)=>t+n,0)/this.durations.length;return{degradeCount:this.degradeCount,meanDetectMs:e}}now(){return this.options.now?.()??performance.now()}tick(){if(!this.running)return;if(this.busy){this.degradeCount+=1;return}this.busy=!0,this.lastRunAt=this.now();let e=this.now();this.options.run().catch(()=>{}).finally(()=>{this.busy=!1,this.durations.push(this.now()-e),this.durations.length>20&&this.durations.shift()})}};var Fe="0.1.0-rc.19";var Le="sekyro.did",Ne;function Ge(){let r=globalThis.crypto;try{if(typeof r?.randomUUID=="function")return r.randomUUID()}catch{}try{if(typeof r?.getRandomValues=="function"){let e=r.getRandomValues(new Uint8Array(16));return Array.from(e,t=>t.toString(16).padStart(2,"0")).join("")}}catch{}}function Lt(){try{let r=localStorage.getItem(Le);if(r)return r;let e=Ge();return e!==void 0&&localStorage.setItem(Le,e),e}catch{return Ne??(Ne=Ge()),Ne}}async function Nt(){let r=globalThis.crypto?.subtle;if(!r)return"";let e=navigator,t=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 r.digest("SHA-256",new TextEncoder().encode(t));return Array.from(new Uint8Array(n),i=>i.toString(16).padStart(2,"0")).join("").slice(0,32)}function Gt(r){let e=new TextEncoder().encode(r),t="";for(let n of e)t+=String.fromCharCode(n);return btoa(t).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}function Vt(r){let e,t;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{t??(t=Nt().catch(()=>""));let n=[];navigator.webdriver&&n.push("webdriver"),/HeadlessChrome/.test(navigator.userAgent)&&n.push("headless");let i=await t,a=Lt(),s={v:1,platform:"web",sdk:r.sdk.slice(0,64),ids:[...a?[{kind:"web_local",value:a.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 Gt(JSON.stringify(s))}catch{return}}}}var fe=Symbol.for("sekyro.web.clientContext"),he=globalThis,Kt=he[fe]??(he[fe]=Vt({sdk:`@sekyro/web@${Fe}`}));function Ve(r){try{let e=r.getVideoTracks?.()[0];e&&Kt.noteCameraLabel(e.label)}catch{}}var ge=Symbol.for("sekyro.web.cameraStreams"),ye=globalThis,Wt=ye[ge]??(ye[ge]=new Set);function Ke(r){try{Wt.add(r)}catch{}}var Ht=["obs","manycam","virtual","snap camera","xsplit","droidcam","iriun","camo"],Ut=[/^(front|back|rear)( [a-z ]+)? camera$/i,/^camera2? ?\d+, facing (front|back|external)/i,/facetime/i,/\b(integrated|built-in|builtin) (web)?cam(era)?\b/i,/\b(hd )?web ?cam\b/i,/\([0-9a-f]{4}:[0-9a-f]{4}\)\s*$/i];function Bt(r){let e=(r??"").trim().toLowerCase();return e.length===0?"unknown":Ht.some(t=>e.includes(t))?"known_virtual":Ut.some(t=>t.test(e))?"platform":"unknown"}function We(r){if(typeof r!="function")return!1;try{return/\{\s*\[native code\]\s*\}\s*$/.test(Function.prototype.toString.call(r))}catch{return!1}}function zt(r=globalThis){return We(r.navigator?.mediaDevices?.getUserMedia)&&We(r.MediaStreamTrack?.prototype?.getSettings)}async function Xt(r,e=globalThis){let t=e.crypto?.subtle?.digest;if(typeof t=="function")try{let n=new Uint8Array(await t.call(e.crypto?.subtle,"SHA-256",new TextEncoder().encode(r)));return Array.from(n.subarray(0,8),i=>i.toString(16).padStart(2,"0")).join("")}catch{return}}async function He(r,e=globalThis){let t={};try{t=typeof r.getSettings=="function"?r.getSettings()??{}:{}}catch{t={}}let n={};if((t.facingMode==="user"||t.facingMode==="environment"||t.facingMode==="left"||t.facingMode==="right")&&(n.facingMode=t.facingMode),typeof t.frameRate=="number"&&Number.isFinite(t.frameRate)&&(n.frameRate=t.frameRate),typeof t.width=="number"&&Number.isFinite(t.width)&&(n.width=t.width),typeof t.height=="number"&&Number.isFinite(t.height)&&(n.height=t.height),typeof t.deviceId=="string"&&t.deviceId.length>0){let a=await Xt(t.deviceId,e);a!==void 0&&(n.deviceIdHash=a)}let i;try{i=r.label}catch{i=void 0}return{trackSettings:n,capabilitiesPresent:typeof r.getCapabilities=="function",labelClass:Bt(i),prototypesIntact:zt(e)}}var be=r=>Math.round(r*100)/100;function Ue(r){let e=r,t=typeof e?.requestVideoFrameCallback=="function",n=null,i=null,a=0,s=0,o=0,u=0,d=0,c=0,l=()=>{!t||e?.requestVideoFrameCallback===void 0||(n=e.requestVideoFrameCallback((m,f)=>{if(n=null,!t)return;let p=f.presentationTime;if(i!==null){let h=p-i.presentationTimeMs;s+=1;let g=h-o;o+=g/s,u+=g*(h-o)}typeof f.captureTime=="number"&&Number.isFinite(f.captureTime)&&(d+=p-f.captureTime,c+=1),a+=1,i={mediaTimeMs:f.mediaTime*1e3,presentationTimeMs:p},l()}))};return l(),{latest:()=>i,stats:()=>({n:a,meanGapMs:s===0?0:be(o),stdGapMs:s<2?0:be(Math.sqrt(u/(s-1))),captureLatencyMs:c===0?null:be(d/c)}),stop:()=>{t&&(t=!1,n!==null&&e?.cancelVideoFrameCallback?.(n),n=null)}}}function Be(r,e,t){return{...r,rvfc:e,rampPainter:t}}var qt=["rose","peach","sand","mint","sky","lilac"];var Yt=4,Zt=4;function Qt(r){if(typeof r!="object"||r===null)return!1;let e=r;if(typeof e.nonce!="string"||e.nonce.length===0||!Array.isArray(e.colours)||e.colours.length!==3||!e.colours.every(n=>qt.includes(n))||!Array.isArray(e.onsetsMs)||e.onsetsMs.length!==3)return!1;let t=-1;for(let n of e.onsetsMs){if(typeof n!="number"||!Number.isFinite(n)||n<=t||n>=2e3)return!1;t=n}return!0}function ze(r,e){let t=e.now??(()=>performance.now()),n=Qt(r)?r:void 0,i=[],a=null,s=null,o=null,u=!1,d=null,c=p=>{d=p;try{e.paint(p)}catch{}},l=p=>{let h=e.frames?.()??null;return h!==null&&o!==null?h.mediaTimeMs+(p-h.presentationTimeMs)-o:p-(s??p)},m=(p,h,g=0)=>{if(u)return;let E=Math.max(0,p-l(t()));a=setTimeout(()=>{if(a=null,!u){if(g<Yt&&l(t())<p-Zt){m(p,h,g+1);return}h()}},E)},f=p=>{if(n!==void 0){if(p>=3){m(2e3,()=>c(null));return}m(n.onsetsMs[p],()=>{let h=l(t());if(h>2e3){d!==null&&c(null);return}let g=n.colours[p];c(g);let E=i.length===0?0:i[i.length-1].tMs;i.push({tMs:Math.max(E,Math.round(h)),colour:g}),f(p+1)})}};return{started(p){if(n===void 0||u||s!==null)return;s=p;let h=e.frames?.()??null;o=h===null?null:h.mediaTimeMs+(p-h.presentationTimeMs),f(0)},stop(){u||(u=!0,a!==null&&clearTimeout(a),a=null,d!==null&&c(null))},report(){return n===void 0?void 0:{nonce:n.nonce,rendered:[...i]}}}}var jt=40;function V(r){if(r===null||typeof r!="object"&&typeof r!="function")return;let e;try{e=r.name}catch{return}return $t(e)}function $t(r){if(typeof r!="string")return;let e=r.replace(/[^A-Za-z]/g,"").slice(0,jt);return e===""?void 0:e}function Xe(r){let e=re(r);if(e!=="generic")return e;switch(V(r)){case"AbortError":return"inuse";case"SecurityError":return"permission";default:return e}}var k=1;function qe(){return typeof OffscreenCanvas=="function"&&typeof createImageBitmap=="function"&&typeof Worker=="function"}function Jt(r,e={}){let t=e.createDetector??x,n=null;r.onmessage=i=>{let a=i.data;if(a.v!==k){a.bitmap?.close?.();return}if(a.type==="init"){t(a.options).then(s=>{n=s;let o={v:k,type:"ready",tier:s.tier,...s.fallbackReason!==void 0?{fallbackReason:s.fallbackReason}:{}};r.postMessage(o)});return}if(a.type==="detect"){let s=o=>{let u={v:k,type:"result",id:a.id,observation:o};r.postMessage(u),a.bitmap.close?.()};if(n===null){s(null);return}n.detect(a.bitmap,a.streamWidth,a.streamHeight).then(s,()=>s(null))}}}typeof self<"u"&&typeof self.importScripts=="function"&&Jt(self);var Z=class r{constructor(e,t){this.pending=new Map;this.nextId=1;this.worker=e,this.tier=t.tier,t.fallbackReason!==void 0&&(this.fallbackReason=t.fallbackReason),e.addEventListener("message",n=>{let i=n.data;if(i.v!==k||i.type!=="result")return;let a=this.pending.get(i.id);this.pending.delete(i.id),a?.(i.observation)})}static create(e,t,n=1e4){return new Promise((i,a)=>{let s=setTimeout(()=>{e.removeEventListener("message",o),e.terminate(),a(new Error(`worker detector not ready within ${n}ms`))},n),o=d=>{let c=d.data;c.v!==k||c.type!=="ready"||(clearTimeout(s),e.removeEventListener("message",o),i(new r(e,c)))};e.addEventListener("message",o);let u={v:k,type:"init",options:t};e.postMessage(u)})}async detect(e,t,n){let i;try{typeof ImageBitmap<"u"&&e instanceof ImageBitmap?i=e:typeof createImageBitmap=="function"?i=await createImageBitmap(e):i=e}catch{return null}let a=this.nextId;return this.nextId+=1,new Promise(s=>{this.pending.set(a,s);let o={v:k,type:"detect",id:a,bitmap:i,streamWidth:t,streamHeight:n};this.worker.postMessage(o,[i])})}destroy(){for(let e of this.pending.values())e(null);this.pending.clear(),this.worker.terminate()}};var er=["size","centering","pose","exposure","sharpness","motion"];function Ye(r){if(r.accepted)return null;if(r.factors.presence<=0)return"no_face";let e="size";for(let t of er)r.factors[t]<r.factors[e]&&(e=t);return e}var D=class{constructor(){this.blocked={};this.acceptedMs=0;this.ticks=0;this.lastAt=null}record(e){let t=this.lastAt===null?0:Math.max(0,e.at-this.lastAt);this.lastAt=e.at,this.ticks+=1;let n=Ye(e);if(n===null){this.acceptedMs+=t;return}let i=this.blocked[n]??{count:0,ms:0};i.count+=1,i.ms+=t,this.blocked[n]=i}summary(){let e={};for(let[t,n]of Object.entries(this.blocked))e[t]={count:n.count,ms:Math.round(n.ms)};return{blocked:e,acceptedMs:Math.round(this.acceptedMs),ticks:this.ticks}}};var st=1e3,j="fcv3.hold_upright",ot=200,$=4,ct=600,ut=1e3,it={sharpness:1,exposure:1,meanLuma:128};function or(r,e){return e.width=r.videoWidth,e.height=r.videoHeight,e.getContext("2d").drawImage(r,0,0),new Promise((t,n)=>e.toBlob(i=>i?t(i):n(new Error("empty-keyframe")),"image/jpeg",.92))}function cr(){return U()==="phone"}var Ee=class{constructor(e){this.handlers=new Map;this.stateValue="idle";this.attempt=0;this.stream=null;this.detector=null;this.scheduler=null;this.gate=null;this.profiler=null;this.lastGuidanceKey=null;this.positioningStartedAt=0;this.cameraRequestedAt=null;this.cameraReadyAt=null;this.faceAcquiredAt=null;this.captureCompleteAt=null;this.fired=!1;this.carriedDegrade=0;this.carriedMeans=[];this.blockStats=null;this.lastGateSnapshotAt=Number.NEGATIVE_INFINITY;this.uprightGuard=!1;this.trackProvenance=null;this.ramp=null;this.snapshotCanvas=null;this.options=e,this.facing=e.facingMode??"user"}get state(){return this.stateValue}on(e,t){let n=this.handlers.get(e);return n||(n=new Set,this.handlers.set(e,n)),n.add(t),()=>n?.delete(t)}emit(e,t){for(let n of[...this.handlers.get(e)??[]])n(t)}async start(e={}){e.facingMode!==void 0&&(this.facing=e.facingMode),this.attempt+=1,await this.run(this.attempt)}get facingMode(){return this.facing}retry(){this.teardownAttempt(),this.start()}switchCamera(){this.facing=this.facing==="user"?"environment":"user",this.teardownAttempt(),this.start()}destroy(){this.attempt+=1,this.teardownAttempt(),this.detector?.destroy(),this.detector=null,this.options.video.srcObject=null}async run(e){let{options:t}=this;this.fired=!1,this.lastGuidanceKey=null,this.carriedDegrade=0,this.carriedMeans=[],this.cameraRequestedAt=null,this.cameraReadyAt=null,this.faceAcquiredAt=null,this.captureCompleteAt=null,this.uprightGuard=(t.isPhone??cr)(),this.setState("preflight");let n=ne();if(n!=="OK"){this.fail(n==="INSECURE_CONTEXT"?"insecure":"unsupported",{phase:"preflight"});return}this.setState("acquiring");let i=t.getUserMedia??(d=>navigator.mediaDevices.getUserMedia(d)),a;this.cameraRequestedAt=this.now();try{a=await i(se(oe(),this.facing))}catch(d){if(e!==this.attempt)return;this.fail(Xe(d),{phase:"acquiring",name:V(d)});return}if(Ve(a),Ke(a),e!==this.attempt){for(let d of a.getTracks())d.stop();return}this.stream=a;let s=a.getVideoTracks?.()[0];if(this.trackProvenance=s===void 0?null:He(s).catch(()=>null),this.facing=ce(a)??this.facing,t.video.srcObject=a,await t.video.play().catch(()=>{}),e!==this.attempt)return;if(this.cameraReadyAt=this.now(),this.detector===null){let d={v3AssetBaseUrl:t.v3AssetBaseUrl},c=t.createDetector??(t.createWorker!==void 0&&qe()?async()=>{try{return await Z.create(t.createWorker(),d)}catch{return x(d)}}:()=>x(d)),l;try{l=await c()}catch(m){e===this.attempt&&this.fail("models",{phase:"models",name:V(m)},m instanceof T?m.fallbackReason:lr(m));return}if(e!==this.attempt){l.destroy();return}this.detector=l,this.options.telemetry?.({type:"detector",tier:l.tier,fallbackReason:l.fallbackReason})}let o=me(),u=t.deviceClass??pe(o);this.profiler=new N(u),this.options.telemetry?.({type:"profile",staticClass:u,activeClass:this.profiler.deviceClass,simd:o.simd}),this.gate=new w(t.thresholds??{}),this.blockStats=new D,this.lastGateSnapshotAt=this.now(),t.rankKeyframes?.()&&Promise.resolve().then(()=>(nt(),rt)).then(d=>ve=d,()=>{}),this.setState("positioning"),this.positioningStartedAt=this.now(),this.startScheduler(e)}get animations(){return this.profiler?.profile.animations??"full"}startScheduler(e){let t=this.profiler;if(t===null)return;if(this.scheduler!==null){let i=this.scheduler.stats();this.carriedDegrade+=i.degradeCount,i.meanDetectMs>0&&this.carriedMeans.push(i.meanDetectMs),this.scheduler.stop()}let n=new G({cadenceHz:t.profile.cadenceHz,video:this.options.video,now:this.options.now,run:()=>this.detectTick(e)});this.scheduler=n,n.start()}async detectTick(e){let{detector:t,gate:n,profiler:i}=this,a=this.options.video;if(e!==this.attempt||t===null||n===null||i===null||this.fired||a.videoWidth===0)return;if(this.isLandscape()){this.holdUpright(e);return}let s=i.deviceClass,o=this.now(),u=this.options.makeSnapshot?.(a,i.profile.inputWidth)??this.defaultSnapshot(a,i.profile.inputWidth),d=null;try{d=await t.detect(u,a.videoWidth,a.videoHeight)}catch{d=null}if(e!==this.attempt||this.fired)return;i.record(this.now()-o),i.deviceClass!==s&&this.startScheduler(e);let c=d===null?it:this.options.measureQuality?.(a,d.box)??this.defaultQuality(a,d.box),l=n.tick({timestampMs:this.now(),observation:d,quality:c,frameWidth:a.videoWidth,frameHeight:a.videoHeight});l.accepted&&this.faceAcquiredAt===null&&(this.faceAcquiredAt=l.at),this.blockStats?.record(l),!l.ready&&l.at-this.lastGateSnapshotAt>=st&&(this.lastGateSnapshotAt=l.at,this.reportGate(!1)),this.emit("checks",{engine:"v3",progress:l.p,q:l.q,factors:l.factors,attempt:e}),l.guidanceKey!==this.lastGuidanceKey&&(this.lastGuidanceKey=l.guidanceKey,this.emit("guidance",{key:l.guidanceKey})),l.ready&&this.stateValue==="positioning"&&(this.fired=!0,this.captureCompleteAt=l.at,this.fire(e))}async fire(e){let{options:t}=this,n=this.scheduler;n?.stop(),this.reportGate(!0);let i=n?.stats()??{degradeCount:0,meanDetectMs:0},a=[...this.carriedMeans,...i.meanDetectMs>0?[i.meanDetectMs]:[]];t.telemetry?.({type:"fired",timeToGateMs:this.now()-this.positioningStartedAt,degradeCount:this.carriedDegrade+i.degradeCount,meanDetectMs:a.length===0?0:a.reduce((y,S)=>y+S,0)/a.length});let s=t.mode??"clip",o=t.rankKeyframes?.()&&ve?ve.default(this,e).catch(()=>this.collectKeyframes(e)):this.collectKeyframes(e);if(s==="photo"){let y=this.watchRotation(e,null),S=await o;if(y(),e!==this.attempt)return;if(S===null){this.fail("generic",{phase:"keyframes"});return}let lt=await this.provenance({n:0,meanGapMs:0,stdGapMs:0,captureLatencyMs:null},!1);if(e!==this.attempt)return;this.finishCapture({keyframe:S.blob,previewDataUrl:S.previewDataUrl,...lt});return}this.setState("recording");let u=t.createRecorder?.()??new P,d=this.stream;if(d===null){this.fail("generic",{phase:"recording"});return}let c=Ue(t.video),l=t.screenRamp?.(),m=l!==void 0,f=ze(l,{paint:y=>{(y===null||e===this.attempt)&&this.emit("ramp",{colour:y})},now:()=>this.now(),frames:c.latest});this.ramp=f;let p=()=>{c.stop(),f.stop(),this.ramp===f&&(this.ramp=null)},h=this.watchRotation(e,u),g=null;o.then(y=>{g=y},()=>{});let E=()=>{e===this.attempt&&g!==null&&this.emit("frozen",{previewDataUrl:g.previewDataUrl})},v,M;try{[v,M]=await Promise.all([u.record(d,E,()=>f.started(this.now())),o])}catch(y){if(h(),p(),e!==this.attempt)return;let S=y.kind;this.fail(S==="cliptoolarge"?"cliptoolarge":"recorder",{phase:"recording",name:V(y)});return}h();let _=c.stats();if(p(),e!==this.attempt)return;if(A(v.blob)){this.fail("cliptoolarge",{phase:"recording"});return}if(M===null){this.fail("generic",{phase:"keyframes"});return}let I=f.report(),J=await this.provenance(_,m);e===this.attempt&&this.finishCapture({clip:v.blob,clipMimeType:v.mimeType,keyframe:M.blob,previewDataUrl:M.previewDataUrl,...I!==void 0&&I.rendered.length>0?{screenRamp:I}:{},...J})}async provenance(e,t){let n=this.trackProvenance;if(n===null)return{};let i,a=new Promise(o=>{i=setTimeout(()=>o(null),ut)}),s=await Promise.race([n,a]);return clearTimeout(i),s===null?{}:{provenance:Be(s,e,t)}}isLandscape(){let e=this.options.video;return this.uprightGuard&&e.videoWidth>e.videoHeight}holdUpright(e){this.gate?.reset(),this.emit("checks",{engine:"v3",progress:0,q:0,factors:{presence:0,centering:0,size:0,pose:0,sharpness:0,exposure:0,motion:0},attempt:e}),this.lastGuidanceKey!==j&&(this.lastGuidanceKey=j,this.emit("guidance",{key:j}))}watchRotation(e,t){if(!this.uprightGuard)return()=>{};let n=this.options.video,i=()=>{if(e!==this.attempt||t!==null&&this.stateValue!=="recording"){o();return}n.videoWidth>0&&this.isLandscape()&&(o(),this.abortRecording(e,t))},a=setInterval(i,ot);n.addEventListener?.("resize",i);let s=!1;function o(){s||(s=!0,clearInterval(a),n.removeEventListener?.("resize",i))}return o}abortRecording(e,t){if(e!==this.attempt)return;this.attempt+=1;let n=this.attempt;try{t?.stop()}catch{}this.ramp?.stop(),this.ramp=null,this.fired=!1,this.captureCompleteAt=null,this.gate=new w(this.options.thresholds??{}),this.blockStats=new D,this.lastGateSnapshotAt=this.now(),this.lastGuidanceKey=null,this.setState("positioning"),this.positioningStartedAt=this.now(),this.holdUpright(n),this.startScheduler(n)}async collectKeyframes(e){let t=this.options.captureKeyframe??(a=>this.defaultKeyframe(a)),n=ct/($-1),i=null;for(let a=0;a<$;a+=1){if(e!==this.attempt)return i;try{let s=await t(this.options.video);(i===null||s.sharpness>i.sharpness)&&(i=s)}catch{}a<$-1&&await ur(n)}return i}finishCapture(e){this.stopTracks(),this.setState("captured");let t=this.captureTiming();this.emit("artifacts",t===void 0?e:{...e,timing:t})}captureTiming(){let e={},t=(n,i,a)=>{i!==null&&a!==null&&(e[n]=Math.max(0,Math.round(a-i)))};return t("cameraReadyMs",this.cameraRequestedAt,this.cameraReadyAt),t("faceAcquireMs",this.cameraReadyAt,this.faceAcquiredAt),t("captureMs",this.faceAcquiredAt,this.captureCompleteAt),Object.keys(e).length>0?e:void 0}async defaultKeyframe(e){let t=document.createElement("canvas"),n=await(this.facing==="user"?ie:or)(e,t),i=t.toDataURL("image/jpeg",.92);return{blob:n,previewDataUrl:i,sharpness:this.centerSharpness(e)}}defaultSnapshot(e,t){try{let n=this.snapshotCanvas??document.createElement("canvas"),i=t/Math.max(1,e.videoWidth),a=Math.max(1,Math.round(e.videoWidth*i)),s=Math.max(1,Math.round(e.videoHeight*i)),o=n.getContext("2d");return o===null?e:(n.width!==a&&(n.width=a),n.height!==s&&(n.height=s),o.drawImage(e,0,0,a,s),this.snapshotCanvas=n,n)}catch{return e}}defaultQuality(e,t){let n=at(e,t,96);return n===null?it:{sharpness:Y(n),exposure:le(n),meanLuma:q(n)}}centerSharpness(e){let t=C(e),n=at(e,{x:t.width*.25,y:t.height*.25,width:t.width*.5,height:t.height*.5},96);return n===null?0:Y(n)}teardownAttempt(){this.scheduler?.stop(),this.scheduler=null,this.reportGate(!0),this.gate=null,this.ramp?.stop(),this.ramp=null,this.stopTracks()}reportGate(e){let t=this.blockStats,n=this.profiler;if(t===null||n===null)return;let i=t.summary();e&&(this.blockStats=null),i.ticks!==0&&this.options.telemetry?.({type:"gate",final:e,activeClass:n.deviceClass,cadenceHz:n.profile.cadenceHz,...i})}stopTracks(){if(this.stream!==null){for(let e of this.stream.getTracks())e.stop();this.stream=null}}fail(e,t,n){this.scheduler?.stop(),this.reportGate(!0),this.stopTracks(),this.setState("error"),this.options.telemetry?.({type:"error",kind:e,fallbackReason:n});let{phase:i,name:a}=t;this.emit("error",{kind:e,retryable:e!=="insecure"&&e!=="unsupported",detail:a===void 0?{phase:i}:{phase:i,name:a}})}setState(e){this.stateValue=e,this.emit("statechange",{state:e})}now(){return this.options.now?.()??performance.now()}},ve;function ur(r){return new Promise(e=>setTimeout(e,r))}function lr(r){return r instanceof Error?r.message:String(r)}function at(r,e,t){try{let n=document.createElement("canvas"),i=t/Math.max(1,e.width);n.width=Math.max(1,Math.round(e.width*i)),n.height=Math.max(1,Math.round(e.height*i));let a=n.getContext("2d");return a===null?null:(a.drawImage(r,e.x,e.y,e.width,e.height,0,0,n.width,n.height),a.getImageData(0,0,n.width,n.height))}catch{return null}}0&&(module.exports={CENTERED_FACTOR,CIRCLE_RADIUS_FACTOR,CLIP_MS,CaptureSessionV3,ClipError,ClipRecorder,DEFAULT_CLIP_MIME,DEFAULT_TIER_ORDER,DEFAULT_V3_ASSET_BASE_URL,DEVICE_PROFILES,DetectScheduler,DetectorLadderError,DeviceProfiler,EXPOSURE_BAND,FaceGateV3,GATE_SNAPSHOT_MS,GateBlockStats,HOLD_UPRIGHT_KEY,IN_CIRCLE_FACTOR,KEYFRAME_CANDIDATES,KEYFRAME_WINDOW_MS,MAX_CLIP_BYTES,MIME_CANDIDATES,PHONE_MAX_SHORT_SIDE,PROVENANCE_WAIT_MS,SHARP_REF,STOP_GRACE_MS,TIMESLICE_MS,UPRIGHT_WATCH_MS,V3_GATE_DEFAULTS,VIDEO_BPS,blockReasonOf,buildCaptureConstraints,buildLivenessV2FormData,cameraPreflight,captureMirroredKeyframe,classifyDevice,createDetector,detectFormFactor,detectIsMobile,errorCopy,exposure,extForMime,intrinsicSize,isClipTooLarge,isMediaRecorderSupported,mapGetUserMediaError,meanLuma,pickMimeType,probeDevice,sharpness,toStreamPixels,trackFacingMode,uiCopy});
|
|
1
|
+
"use strict";var Rt=Object.create;var B=Object.defineProperty;var Dt=Object.getOwnPropertyDescriptor;var It=Object.getOwnPropertyNames;var At=Object.getPrototypeOf,Ot=Object.prototype.hasOwnProperty;var W=(t,e)=>()=>(t&&(e=t(t=0)),e);var K=(t,e)=>{for(var r in e)B(t,r,{get:e[r],enumerable:!0})},Re=(t,e,r,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of It(e))!Ot.call(t,n)&&n!==r&&B(t,n,{get:()=>e[n],enumerable:!(i=Dt(e,n))||i.enumerable});return t};var Pt=(t,e,r)=>(r=t!=null?Rt(At(t)):{},Re(e||!t||!t.__esModule?B(r,"default",{value:t,enumerable:!0}):r,t)),Ft=t=>Re(B({},"__esModule",{value:!0}),t);function Ue(t){let e=(t??"").trim().toLowerCase();return e.length===0?"unknown":er.some(r=>e.includes(r))?"known_virtual":tr.some(r=>r.test(e))?"platform":"unknown"}var er,tr,ze=W(()=>{"use strict";er=["obs","manycam","virtual","snap camera","xsplit","droidcam","iriun","camo"],tr=[/^(front|back|rear)( [a-z ]+)? camera$/i,/^camera2? ?\d+, facing (front|back|external)/i,/facetime/i,/\b(integrated|built-in|builtin) (web)?cam(era)?\b/i,/\b(hd )?web ?cam\b/i,/\([0-9a-f]{4}:[0-9a-f]{4}\)\s*$/i]});var Xe={};K(Xe,{bounded:()=>G,cameraHash:()=>qe,hex16:()=>$,noteCameraTrait:()=>ir});function G(t,e){return new Promise(r=>{let i=setTimeout(()=>r(void 0),e),n=a=>{clearTimeout(i),r(a)};try{t().then(n,()=>n(void 0))}catch{n(void 0)}})}async function $(t){let e=await crypto.subtle.digest("SHA-256",new TextEncoder().encode(JSON.stringify(t)));return Array.from(new Uint8Array(e).subarray(0,8),r=>r.toString(16).padStart(2,"0")).join("")}function nr(t){try{return t.getSettings?.().facingMode==="environment"}catch{return!1}}async function qe(t){try{if(t.readyState==="ended"||nr(t))return;let e={};try{e=t.getCapabilities?.()??{}}catch{}let r=await G(()=>navigator.mediaDevices.enumerateDevices(),rr);return await $([ve(e.width),ve(e.height),ve(e.frameRate),ye(e.facingMode),ye(e.focusMode),ye(e.exposureMode),Ue(t.label),r?.filter(i=>i.kind==="videoinput").length??null])}catch{return}}async function ir(t,e){let r=await qe(t);r&&e.noteCamera(r)}var rr,ye,ve,Se=W(()=>{"use strict";ze();rr=1e3;ye=t=>Array.isArray(t)?[...t].sort():null,ve=t=>{let e=t;return e==null?null:[e.min??null,e.max??null]}});var Qe={};K(Qe,{computePrint:()=>gr,readHints:()=>je});function Ye(t,e){if(typeof t!="string")return;let r=t.trim();return r.length>0&&r.length<=e?r:void 0}async function je(){let t=navigator.userAgentData;if(typeof t?.getHighEntropyValues!="function")return;let e=await G(()=>t.getHighEntropyValues(["model","platformVersion"]),cr);if(e==null)return;let r=Ye(e.model,lr),i=Ye(e.platformVersion,dr),n={...r!==void 0?{model:r}:{},...i!==void 0?{platformVersion:i}:{}};return Object.keys(n).length>0?n:void 0}async function fr(){let[t,e]=await Promise.all([new Ze.Thumbmark({stabilize:["private","iframe"],exclude:["permissions","webrtc","speech"],logging:!1,collect_beacon:!1,timeout:or}).get(),je()]),r=t?.thumbmark;if(typeof r!="string"||r.length<mr||r.length>pr)return;let i={};for(let n of ar){let a=t.components?.[n];a==null||a.timeout==="true"||(i[n]=await $(a))}return{hash:r,c:i,...e!==void 0?{hints:e}:{}}}function hr(){return new Promise(t=>{typeof globalThis.requestIdleCallback=="function"?globalThis.requestIdleCallback(()=>t(),{timeout:ur}):t()})}async function gr(t){return t()||(await hr(),t())?"busy":G(fr,sr)}var Ze,ar,or,sr,cr,ur,lr,dr,mr,pr,$e=W(()=>{"use strict";Ze=require("@thumbmarkjs/thumbmarkjs");Se();ar=["canvas","webgl","audio","fonts","hardware","screen","system","locales","math","plugins"],or=2e3,sr=4e3,cr=1e3,ur=2e3,lr=64,dr=32,mr=8,pr=128});var St={};K(St,{RANK_CANDIDATES:()=>Lr,RANK_TOLERANCE:()=>ee,RANK_WINDOW_MS:()=>Nr,ROLL_ZERO_DEG:()=>Gr,SHARPNESS_REPORT_MAX:()=>yt,YAW_REPORT_MAX:()=>bt,YAW_ZERO_IOD:()=>Vr,collectRankedKeyframes:()=>vt,default:()=>Br,featuresOf:()=>ht,frontalOf:()=>ft,rankKeyframes:()=>gt});function ft(t){let e=t.eyes;if(e===void 0)return{frontal:1,yaw:null,roll:null};let r=e.right.x-e.left.x,i=e.right.y-e.left.y,n=r*r+i*i;if(n===0)return{frontal:1,yaw:null,roll:null};let a=Math.abs(Math.atan2(i,Math.abs(r))*180/Math.PI),o=pt(1-a/30),s=null,l=t.nose;if(l!==void 0){let c=(e.left.x+e.right.x)/2,u=(e.left.y+e.right.y)/2;s=Math.abs(((l.x-c)*r+(l.y-u)*i)/n),o*=pt(1-s/.5)}return{frontal:o,yaw:s,roll:a}}function ht(t,e){return t===null?{face:!1,frontal:0,yaw:null,roll:null,eyes:null,score:0,sharpness:e}:{face:!0,...ft(t),eyes:null,score:t.score,sharpness:e}}function gt(t){let e=t.map((n,a)=>a),r=(n,a)=>{let o=Number.NEGATIVE_INFINITY;for(let s of e)o=Math.max(o,n(t[s]));e=e.filter(s=>n(t[s])>=o-a)};r(n=>n.frontal,ee.frontal),r(n=>n.eyes??1,ee.eyes),r(n=>n.score,ee.score);let i=-1;for(let n of e)(i===-1||t[n].sharpness>t[i].sharpness)&&(i=n);return i}function Hr(t){return{face:t.face,frontal:I(t.frontal),...t.yaw!==null?{yaw:Math.min(I(t.yaw),bt)}:{},...t.roll!==null?{roll:I(t.roll)}:{},...t.eyes!==null?{eyes:I(t.eyes)}:{},score:I(t.score),sharpness:Math.min(I(t.sharpness),yt)}}async function vt(t,e){let{options:r}=t,i=r.video,n=r.now??(()=>performance.now()),a=r.captureKeyframe??(m=>t.defaultKeyframe(m)),o=600/3,s=[],l=[],c=0;for(let m=0;m<4;m+=1){if(e!==t.attempt)return null;let p=t.detector,f=Promise.resolve(null),h,g=0;try{if(p!==null){let k=t.profiler?.profile.inputWidth??160,A=r.makeSnapshot?.(i,k)??t.defaultSnapshot(i,k);h=a(i).then(b=>(g=n(),b));let ne=n();f=p.detect(A,i.videoWidth,i.videoHeight).then(b=>(c+=n()-ne,b),()=>null)}else h=a(i).then(k=>(g=n(),k));let[v,T]=await Promise.all([h,f]);s.push(v),l.push(ht(T,v.sharpness))}catch{h?.catch(()=>{})}let S=g>0?Math.max(0,n()-g):0;m<3&&await new Promise(v=>setTimeout(v,Math.max(0,o-S)))}if(e!==t.attempt)return null;let u=gt(l);if(u===-1)return null;let d=0;l.forEach((m,p)=>{m.sharpness>l[d].sharpness&&(d=p)});try{r.telemetry?.({type:"keyframe",tier:t.detector?.tier??null,chosen:u,sharpest:d,detectMs:Math.round(c),candidates:l.map(Hr)})}catch{}return s[u]??null}var Lr,Nr,Vr,Gr,ee,pt,I,bt,yt,Br,Et=W(()=>{"use strict";Lr=4,Nr=600,Vr=.5,Gr=30,ee={frontal:.1,eyes:.1,score:.05},pt=t=>t<0?0:t>1?1:t;I=t=>Number.isFinite(t)?Math.round(t*1e3)/1e3:0,bt=99,yt=999999;Br=vt});var qr={};K(qr,{CENTERED_FACTOR:()=>Ut,CIRCLE_RADIUS_FACTOR:()=>Wt,CLIP_MS:()=>Ie,CaptureSessionV3:()=>_e,ClipError:()=>y,ClipRecorder:()=>P,DEFAULT_CLIP_MIME:()=>U,DEFAULT_TIER_ORDER:()=>Ve,DEFAULT_V3_ASSET_BASE_URL:()=>Ne,DEVICE_PROFILES:()=>Be,DetectScheduler:()=>V,DetectorLadderError:()=>w,DeviceProfiler:()=>N,EXPOSURE_BAND:()=>L,FaceGateV3:()=>R,GATE_SNAPSHOT_MS:()=>kt,GateBlockStats:()=>D,HOLD_UPRIGHT_KEY:()=>te,IN_CIRCLE_FACTOR:()=>Kt,KEYFRAME_CANDIDATES:()=>re,KEYFRAME_WINDOW_MS:()=>wt,MAX_CLIP_BYTES:()=>z,MIME_CANDIDATES:()=>De,PHONE_MAX_SHORT_SIDE:()=>Pe,PROVENANCE_WAIT_MS:()=>xt,SHARP_REF:()=>cn,STOP_GRACE_MS:()=>Oe,TIMESLICE_MS:()=>Ae,UPRIGHT_WATCH_MS:()=>Ct,V3_GATE_DEFAULTS:()=>He,VIDEO_BPS:()=>ue,blockReasonOf:()=>mt,buildCaptureConstraints:()=>le,buildLivenessV2FormData:()=>Nt,cameraPreflight:()=>se,captureMirroredKeyframe:()=>ce,classifyDevice:()=>be,createDetector:()=>x,detectFormFactor:()=>q,detectIsMobile:()=>de,errorCopy:()=>Vt,exposure:()=>fe,extForMime:()=>ie,intrinsicSize:()=>C,isClipTooLarge:()=>O,isMediaRecorderSupported:()=>Lt,mapGetUserMediaError:()=>oe,meanLuma:()=>j,pickMimeType:()=>ae,probeDevice:()=>ge,sharpness:()=>Q,toStreamPixels:()=>F,trackFacingMode:()=>me,uiCopy:()=>Gt});module.exports=Ft(qr);var De=["video/mp4;codecs=avc1.42E01E,mp4a.40.2","video/mp4;codecs=avc1.42E01E","video/mp4","video/webm;codecs=vp9,opus","video/webm;codecs=vp9","video/webm;codecs=vp8,opus","video/webm;codecs=vp8","video/webm"];function ae(){let t=globalThis.MediaRecorder;return!t||typeof t.isTypeSupported!="function"?"":De.find(e=>t.isTypeSupported(e))??""}var U="video/webm";function oe(t){if(t instanceof TypeError)return"insecure";switch(t?.name??""){case"NotAllowedError":case"PermissionDeniedError":return"permission";case"NotFoundError":case"DevicesNotFoundError":return"notfound";case"NotReadableError":case"TrackStartError":return"inuse";case"OverconstrainedError":case"ConstraintNotSatisfiedError":return"overconstrained";default:return"generic"}}function se(){let t=globalThis;if(typeof t.window<"u"&&t.window.isSecureContext===!1)return"INSECURE_CONTEXT";let e=t.navigator?.mediaDevices;return!e||typeof e.getUserMedia!="function"?"UNSUPPORTED":"OK"}function Lt(){let t=globalThis.MediaRecorder;return typeof t<"u"&&typeof t.isTypeSupported=="function"}var z=8*1024*1024;function O(t){return t.size>z}function ie(t){let e=(t||"").toLowerCase();return e.startsWith("image/jpeg")?"jpg":e.startsWith("video/mp4")?"mp4":(e.startsWith("video/webm"),"webm")}function Nt(t){let{token:e,clip:r,keyframe:i}=t,n=t.ts??Date.now(),a=r.type||U,o=i.type||"image/jpeg",s=new FormData;return s.append("token",e),s.append("clip",new File([r],`liveness-${n}.${ie(a)}`,{type:a})),s.append("keyframe",new File([i],`keyframe-${n}.${ie(o)}`,{type:o})),s}function ce(t,e,r=.92){return new Promise((i,n)=>{let a=t.videoWidth,o=t.videoHeight;if(!a||!o){n(new Error("video-not-ready"));return}let s=e.getContext("2d");if(!s){n(new Error("no-2d-context"));return}e.width=a,e.height=o,s.scale(-1,1),s.drawImage(t,-a,0),e.toBlob(l=>l?i(l):n(new Error("empty-keyframe")),"image/jpeg",r)})}var Vt={permission:{key:"fcv2.err.permission",fr:"Autorisez la cam\xE9ra dans les r\xE9glages du navigateur (ic\xF4ne cam\xE9ra dans la barre d\u2019adresse), puis r\xE9essayez."},notfound:{key:"fcv2.err.notfound",fr:"Aucune cam\xE9ra d\xE9tect\xE9e. Branchez ou activez une cam\xE9ra, puis r\xE9essayez."},inuse:{key:"fcv2.err.inuse",fr:"La cam\xE9ra est utilis\xE9e par une autre application. Fermez-la puis r\xE9essayez."},overconstrained:{key:"fcv2.err.overconstrained",fr:"La cam\xE9ra ne prend pas en charge les r\xE9glages demand\xE9s. Nouvel essai en cours\u2026"},insecure:{key:"fcv2.err.insecure",fr:"La cam\xE9ra n\xE9cessite une connexion s\xE9curis\xE9e (HTTPS). Ouvrez la page en HTTPS."},unsupported:{key:"fcv2.err.unsupported",fr:"Votre navigateur ne prend pas en charge l\u2019enregistrement vid\xE9o. Utilisez un navigateur r\xE9cent."},generic:{key:"fcv2.err.generic",fr:"Cam\xE9ra indisponible. R\xE9essayez ou contactez le support."}},Gt={recording:{key:"fcv2.recording",fr:"Enregistrement en cours\u2026"},uploading:{key:"fcv2.uploading",fr:"Envoi en cours\u2026"},clipTooLarge:{key:"fcv2.err.cliptoolarge",fr:"La vid\xE9o est trop volumineuse. R\xE9essayez dans un endroit mieux \xE9clair\xE9."},retry:{key:"fcv2.retry",fr:"R\xE9essayer"},listen:{key:"fcv2.listen",fr:"\xC9couter"}};var Ie=2500,Ae=1e3,Oe=1500,ue=25e5,y=class extends Error{constructor(e,r){super(r??e),this.kind=e}},P=class{constructor(){this.recorder=null;this.stream=null;this.chunks=[];this.bytes=0;this.hardStopTimer=null;this.graceTimer=null;this.settled=!1}clearTimers(){this.hardStopTimer&&clearTimeout(this.hardStopTimer),this.graceTimer&&clearTimeout(this.graceTimer),this.hardStopTimer=null,this.graceTimer=null}record(e,r,i){if(this.recorder&&!this.settled)return Promise.reject(new y("generic","record() called while a recording is in flight \u2014 ClipRecorder handles one recording at a time"));this.recorder=null,this.clearTimers(),this.chunks=[],this.bytes=0,this.settled=!1,this.stream=e;let n=ae();return new Promise((a,o)=>{let s;try{s=new MediaRecorder(e,n?{mimeType:n,videoBitsPerSecond:ue}:{videoBitsPerSecond:ue})}catch{try{s=new MediaRecorder(e)}catch{o(new y("unsupported"));return}}this.recorder=s;let l=u=>{this.settled||(this.settled=!0,this.clearTimers(),u())},c=()=>l(()=>{let u=s.mimeType||n||U,d=new Blob(this.chunks,{type:u});if(d.size===0){o(new y("generic","empty clip"));return}if(O(d)){o(new y("cliptoolarge"));return}a({blob:d,mimeType:u})});if(s.ondataavailable=u=>{u.data&&u.data.size&&(this.chunks.push(u.data),this.bytes+=u.data.size,this.bytes>z&&l(()=>{try{s.state!=="inactive"&&s.stop()}catch{}o(new y("cliptoolarge"))}))},s.onstop=c,s.onerror=()=>l(()=>o(new y("generic"))),i!==void 0){let u=!1;s.onstart=()=>{if(!(u||this.settled)){u=!0;try{i()}catch{}}}}try{s.start(Ae)}catch{l(()=>o(new y("generic")));return}this.hardStopTimer=setTimeout(()=>{if(this.settled||r?.(),s.state!=="inactive"){try{s.stop()}catch{c()}this.graceTimer=setTimeout(c,Oe)}else c()},Ie)})}stop(e){this.clearTimers();let r=this.recorder;if(r&&r.state!=="inactive")try{r.stop()}catch{}this.recorder=null,(e??this.stream)?.getTracks().forEach(n=>n.stop()),this.stream=null}};function le(t,e){return{video:{width:{ideal:1280,max:1280},height:{ideal:720,max:720},facingMode:e,frameRate:{ideal:24,max:30}},audio:!1}}var Pe=600;function q(){if(typeof window>"u"||typeof navigator>"u")return"desktop";let t=String(navigator.userAgent??"");if(/iPhone|iPod/i.test(t))return"phone";if(/iPad/i.test(t))return"tablet";if(/Android/i.test(t))return/Mobile/i.test(t)?"phone":"tablet";if(/BlackBerry|IEMobile|Opera Mini/i.test(t))return"phone";if(Number(navigator.maxTouchPoints??0)<=1)return"desktop";if(/Macintosh/.test(t))return"tablet";if(!Bt())return"desktop";let r=Ht();return r>0&&r<Pe?"phone":"tablet"}function de(){return q()!=="desktop"}function Ht(){try{let t=window.screen,e=Number(t?.width??0),r=Number(t?.height??0);return e>0&&r>0?Math.min(e,r):0}catch{return 0}}function me(t){try{let r=t?.getVideoTracks?.()[0]?.getSettings?.().facingMode;return r==="user"||r==="environment"?r:null}catch{return null}}function Bt(){try{return typeof window.matchMedia=="function"&&window.matchMedia("(pointer: coarse)").matches}catch{return!1}}var Wt=.45,Kt=.9,Ut=.4;var Fe=1e4,X=class t{constructor(e,r){this.tier="blaze";this.inner=e,r!==void 0&&(this.fallbackReason=r)}static async create(e,r){let i=await import("@mediapipe/tasks-vision"),n=await i.FilesetResolver.forVisionTasks(e),a=await i.FaceDetector.createFromOptions(n,{baseOptions:{modelAssetPath:`${e}/blaze_face_short_range.tflite`,delegate:"CPU"},runningMode:"IMAGE"});return new t(a,r)}async detect(e,r,i){let n;try{n=this.inner.detect(e).detections}catch{return null}let a=zt(n);if(a?.boundingBox===void 0)return null;let o=C(e),s=qt(a.keypoints,o),l=a.keypoints?.[2],c={box:{x:a.boundingBox.originX,y:a.boundingBox.originY,width:a.boundingBox.width,height:a.boundingBox.height},...s!==void 0?{eyes:s}:{},...l!==void 0?{nose:{x:l.x*o.width,y:l.y*o.height}}:{},score:a.categories[0]?.score??0};return F(c,e,r,i)}destroy(){try{this.inner.close()}catch{}}};function zt(t){let e,r=-1;for(let i of t){let n=i.categories[0]?.score??0;n>r&&(e=i,r=n)}return e}function qt(t,e){let r=t?.[0],i=t?.[1];if(r===void 0||i===void 0)return;let n=s=>({x:s.x*e.width,y:s.y*e.height}),[a,o]=[n(r),n(i)];return a.x<=o.x?{left:a,right:o}:{left:o,right:a}}function Xt(){if(typeof OffscreenCanvas=="function")return new OffscreenCanvas(2,2);let t=document.createElement("canvas");return t.width=2,t.height=2,t}async function Le(){let t=globalThis.FaceDetector;if(typeof t!="function")return{ok:!1,reason:"unsupported"};try{let e=new t({fastMode:!0,maxDetectedFaces:1});return await e.detect(Xt()),{ok:!0,instance:e}}catch(e){return{ok:!1,reason:`smoke_failed:${e instanceof Error?e.message:String(e)}`}}}var Y=class{constructor(e,r){this.tier="native";this.inner=e,r!==void 0&&(this.fallbackReason=r)}async detect(e,r,i){let n;try{n=await this.inner.detect(e)}catch{return null}let a=n[0];if(a===void 0)return null;let o=Yt(a.landmarks),s={box:{x:a.boundingBox.x,y:a.boundingBox.y,width:a.boundingBox.width,height:a.boundingBox.height},...o!==void 0?{eyes:o}:{},score:1};return F(s,e,r,i)}destroy(){}};function Yt(t){if(t===void 0)return;let e=t.filter(n=>n.type==="eye").map(n=>n.locations[0]).filter(n=>n!==void 0),[r,i]=e;if(!(r===void 0||i===void 0))return r.x<=i.x?{left:r,right:i}:{left:i,right:r}}var Ne="/models-v3",Ve=["native","blaze"],w=class extends Error{constructor(e){super(`no detector tier available (${e})`),this.name="DetectorLadderError",this.fallbackReason=e}};function C(t){let e=t;if(typeof e.videoWidth=="number"&&e.videoWidth>0)return{width:e.videoWidth,height:e.videoHeight??0};if(typeof e.naturalWidth=="number"&&e.naturalWidth>0)return{width:e.naturalWidth,height:e.naturalHeight??0};let r=typeof e.width=="number"?e.width:0,i=typeof e.height=="number"?e.height:0;return{width:r,height:i}}function F(t,e,r,i){let n=C(e),a=n.width>0?r/n.width:1,o=n.height>0?i/n.height:1,s=l=>({x:l.x*a,y:l.y*o});return{box:{x:t.box.x*a,y:t.box.y*o,width:t.box.width*a,height:t.box.height*o},...t.eyes!==void 0?{eyes:{left:s(t.eyes.left),right:s(t.eyes.right)}}:{},...t.nose!==void 0?{nose:s(t.nose)}:{},score:t.score}}function Zt(t){return t instanceof Error?t.message:String(t)}async function x(t){let e=t.preferred??Ve,r=[];for(let i of e){if(i==="native"){let n=await Le();if(n.ok)return new Y(n.instance,pe(r));r.push(`native:${n.reason}`);continue}try{return await jt(X.create(t.v3AssetBaseUrl??Ne,pe(r)),t.blazeInitTimeoutMs??Fe)}catch(n){r.push(n instanceof Z?"blaze:blaze_init_timeout":`blaze:${Zt(n)}`)}}throw new w(pe(r)??"no_tier_available")}function pe(t){return t.length>0?t.join("; "):void 0}var Z=class extends Error{};function jt(t,e){return new Promise((r,i)=>{let n=setTimeout(()=>{i(new Z(`init exceeded ${e}ms`)),t.then(a=>a.destroy(),()=>{})},e);t.then(a=>{clearTimeout(n),r(a)},a=>{clearTimeout(n),i(a)})})}var cn=180,L=[100,190],Qt=64;function Ge(t,e){return .299*(t[e]??0)+.587*(t[e+1]??0)+.114*(t[e+2]??0)}function j(t){let{data:e,width:r,height:i}=t,n=r*i;if(n===0)return 0;let a=0;for(let o=0;o<n;o+=1)a+=Ge(e,o*4);return a/n}function Q(t){let{data:e,width:r,height:i}=t;if(r<3||i<3)return 0;let n=new Float32Array(r*i);for(let u=0;u<n.length;u+=1)n[u]=Ge(e,u*4);let a=0,o=0,s=0;for(let u=1;u<i-1;u+=1)for(let d=1;d<r-1;d+=1){let m=u*r+d,p=(n[m-r]??0)+(n[m-1]??0)+(n[m+1]??0)+(n[m+r]??0)-4*(n[m]??0);a+=p,o+=p*p,s+=1}if(s===0)return 0;let l=a/s,c=o/s-l*l;return Math.min(1,Math.max(0,c)/180)}function fe(t){let e=j(t),[r,i]=L,n=e<r?r-e:e>i?e-i:0;return Math.max(0,1-n/Qt)}var He=Object.freeze({Q_GOOD:.6,RISE_PER_S:.9,FALL_PER_S:.25,CENTER_FALLOFF_IOD_MULTIPLE:1.35,BOX_EYE_OFFSET_FACTOR:.12,IOD_BOX_PROXY_FACTOR:.42,SIZE_IDEAL_MIN:.12,SIZE_IDEAL_MAX:.3,SIZE_HARD_MIN:.08,SIZE_HARD_MAX:.45,ROLL_MAX_DEG:25,MOTION_VELOCITY_IOD_PER_S:.5,MOTION_TAU_S:.4,MOTION_DEADBAND_IOD_PER_S:.1,READY_WINDOW_MS:500,GUIDE_SIZE:.6,GUIDE_CENTERING:.6,GUIDE_POSE:.6,GUIDE_EXPOSURE:.6,GUIDE_SHARPNESS:.35,GUIDE_MOTION:.5}),_=t=>Math.min(1,Math.max(0,t)),R=class{constructor(e={}){this.p=0;this.lastTickAt=null;this.lastCenter=null;this.velocityEma=0;this.qWindow=[];this.lastSizeDirection="ideal";this.t={...He,...e}}reset(){this.p=0,this.lastTickAt=null,this.lastCenter=null,this.velocityEma=0,this.qWindow=[],this.lastSizeDirection="ideal"}tick(e){let{observation:r,quality:i,timestampMs:n}=e,a=this.lastTickAt===null?0:Math.max(0,(n-this.lastTickAt)/1e3);this.lastTickAt=n;let o={presence:0,centering:0,size:0,pose:0,sharpness:_(i.sharpness),exposure:_(i.exposure),motion:1};if(r!==null){o.presence=1;let u=this.geometryOf(r,e);o.centering=u.centering,o.size=u.size,o.pose=u.pose,o.motion=this.motionOf(u.center,u.iod,n)}else this.lastCenter=null,this.velocityEma=0;let s=Math.min(o.presence,o.centering,o.size,o.pose,o.sharpness,o.exposure,o.motion);this.p=_(this.p+(s>=this.t.Q_GOOD?this.t.RISE_PER_S*s:-this.t.FALL_PER_S*(1-s))*a),this.qWindow.push({at:n,q:s}),this.qWindow=this.qWindow.filter(u=>u.at>=n-this.t.READY_WINDOW_MS);let l=this.qWindow.map(u=>u.q);if(l.length>=3){let u=Math.min(...l),d=l.indexOf(u);l=l.filter((m,p)=>p!==d)}let c=this.p>=1&&l.every(u=>u>=this.t.Q_GOOD);return{at:n,q:s,p:this.p,factors:o,guidanceKey:this.guidanceOf(o,i,s),ready:c,accepted:s>=this.t.Q_GOOD}}geometryOf(e,r){let{box:i,eyes:n}=e,a={x:r.frameWidth/2,y:r.frameHeight/2},o=Math.min(r.frameWidth,r.frameHeight),s=n!==void 0?{x:(n.left.x+n.right.x)/2,y:(n.left.y+n.right.y)/2}:{x:i.x+i.width/2,y:i.y+i.height/2-this.t.BOX_EYE_OFFSET_FACTOR*i.height},l=n!==void 0?Math.hypot(n.right.x-n.left.x,n.right.y-n.left.y):this.t.IOD_BOX_PROXY_FACTOR*i.width,c=Math.hypot(s.x-a.x,s.y-a.y),u=l<=0?0:1-_(c/(this.t.CENTER_FALLOFF_IOD_MULTIPLE*l)),d=o>0?l/o:0;this.lastSizeDirection=d<this.t.SIZE_IDEAL_MIN?"far":d>this.t.SIZE_IDEAL_MAX?"close":"ideal";let m;d<this.t.SIZE_HARD_MIN||d>this.t.SIZE_HARD_MAX?m=0:d<this.t.SIZE_IDEAL_MIN?m=(d-this.t.SIZE_HARD_MIN)/(this.t.SIZE_IDEAL_MIN-this.t.SIZE_HARD_MIN):d>this.t.SIZE_IDEAL_MAX?m=(this.t.SIZE_HARD_MAX-d)/(this.t.SIZE_HARD_MAX-this.t.SIZE_IDEAL_MAX):m=1;let p=1;if(n!==void 0){let f=Math.abs(Math.atan2(n.right.y-n.left.y,n.right.x-n.left.x))*180/Math.PI;p=1-_(f/this.t.ROLL_MAX_DEG)}return{center:s,iod:l,centering:u,size:m,pose:p}}motionOf(e,r,i){let n=this.lastCenter;if(this.lastCenter={...e,at:i},n===null||r<=0)return 1;let a=(i-n.at)/1e3;if(a<=0)return 1;let o=Math.hypot(e.x-n.x,e.y-n.y)/r/a;o<=this.t.MOTION_DEADBAND_IOD_PER_S&&(o=0);let s=1-Math.exp(-a/this.t.MOTION_TAU_S);return this.velocityEma=s*o+(1-s)*this.velocityEma,1-_(this.velocityEma/this.t.MOTION_VELOCITY_IOD_PER_S)}guidanceOf(e,r,i){if(e.presence<=0)return"fcv3.no_face";if(e.size<this.t.GUIDE_SIZE)return this.sizeGuidance();if(e.centering<this.t.GUIDE_CENTERING)return"fcv3.center_face";if(e.pose<this.t.GUIDE_POSE)return"fcv3.straighten";if(e.exposure<this.t.GUIDE_EXPOSURE)return this.exposureGuidance(r);if(e.sharpness<this.t.GUIDE_SHARPNESS)return"fcv3.steady_camera";if(e.motion<this.t.GUIDE_MOTION)return"fcv3.hold_still";if(i<this.t.Q_GOOD){let n=[["size",this.sizeGuidance()],["centering","fcv3.center_face"],["pose","fcv3.straighten"],["exposure",this.exposureGuidance(r)],["sharpness","fcv3.steady_camera"],["motion","fcv3.hold_still"]],a=n[0];for(let o of n)e[o[0]]<e[a[0]]&&(a=o);return a[1]}return"fcv3.hold_still"}sizeGuidance(){return this.lastSizeDirection==="far"?"fcv3.come_closer":"fcv3.move_back"}exposureGuidance(e){let r=(L[0]+L[1])/2;return e.meanLuma<r?"fcv3.more_light":"fcv3.too_bright"}};var Be=Object.freeze({LOW:Object.freeze({cadenceHz:5,inputWidth:128,animations:"reduced"}),MID:Object.freeze({cadenceHz:8,inputWidth:160,animations:"full"}),HIGH:Object.freeze({cadenceHz:10,inputWidth:192,animations:"full"})}),$t=new Uint8Array([0,97,115,109,1,0,0,0,1,5,1,96,0,1,123,3,2,1,0,10,10,1,8,0,65,0,253,15,253,98,11]);function ge(){let t=typeof navigator>"u"?void 0:navigator,e=!1;try{e=typeof WebAssembly<"u"&&WebAssembly.validate($t)}catch{e=!1}return{cores:t?.hardwareConcurrency??2,memGB:t?.deviceMemory??null,simd:e}}function be(t){let e=t.memGB??4;return t.cores<4||e<3?"LOW":t.cores>=8&&e>=6?"HIGH":"MID"}var he=["LOW","MID","HIGH"],N=class{constructor(e){this.samples=[];this.adjusted=!1;this.current=e}get deviceClass(){return this.current}get profile(){return Be[this.current]}record(e){if(this.adjusted||this.samples.length>=10)return this.current;if(this.samples.push(e),this.samples.length<10)return this.current;this.adjusted=!0;let r=this.samples.reduce((i,n)=>i+n,0)/this.samples.length;if(r>70)this.current="LOW";else if(r<25){let i=he.indexOf(this.current);this.current=he[Math.min(he.length-1,i+1)]??this.current}return this.current}};var V=class{constructor(e){this.timer=null;this.frameCallbackId=null;this.running=!1;this.busy=!1;this.lastRunAt=Number.NEGATIVE_INFINITY;this.degradeCount=0;this.durations=[];this.options=e,this.periodMs=1e3/e.cadenceHz}start(){if(this.running)return;this.running=!0;let e=this.options.video;if(typeof e?.requestVideoFrameCallback=="function"){let r=()=>{this.running&&(this.frameCallbackId=e.requestVideoFrameCallback?.(()=>{this.frameCallbackId=null,this.now()-this.lastRunAt>=this.periodMs&&this.tick(),r()}))};r();return}this.timer=setInterval(()=>this.tick(),this.periodMs)}stop(){this.running=!1,this.timer!==null&&(clearInterval(this.timer),this.timer=null),this.frameCallbackId!==null&&(this.options.video?.cancelVideoFrameCallback?.(this.frameCallbackId),this.frameCallbackId=null)}stats(){let e=this.durations.length===0?0:this.durations.reduce((r,i)=>r+i,0)/this.durations.length;return{degradeCount:this.degradeCount,meanDetectMs:e}}now(){return this.options.now?.()??performance.now()}tick(){if(!this.running)return;if(this.busy){this.degradeCount+=1;return}this.busy=!0,this.lastRunAt=this.now();let e=this.now();this.options.run().catch(()=>{}).finally(()=>{this.busy=!1,this.durations.push(this.now()-e),this.durations.length>20&&this.durations.shift()})}};var We="0.1.0-rc.20";var Jt=/FBAN|FBAV|FB_IAB|FBIOS|MessengerForiOS|Instagram|WhatsApp|musical_ly|BytedanceWebview|TikTok|Snapchat|\bLine\/|LinkedInApp|Pinterest|MicroMessenger|; wv\)/i;function Ke(t){let e=t??(typeof navigator>"u"?"":String(navigator.userAgent??""));return Jt.test(e)}var Je="sekyro.did",br=1e4,rt=()=>globalThis.process?.versions?.node,et;function tt(){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,r=>r.toString(16).padStart(2,"0")).join("")}}catch{}}function yr(){try{let t=localStorage.getItem(Je);if(t)return t;let e=tt();return e!==void 0&&localStorage.setItem(Je,e),e}catch{return et??(et=tt()),et}}async function vr(){let t=globalThis.crypto?.subtle;if(!t)return"";let e=navigator,r=JSON.stringify([e.userAgent,e.platform,e.hardwareConcurrency??null,e.deviceMemory??null,e.maxTouchPoints??0,screen.width,screen.height,screen.colorDepth,globalThis.devicePixelRatio??1,Intl.DateTimeFormat().resolvedOptions().timeZone,e.languages?.join(",")??e.language]),i=await t.digest("SHA-256",new TextEncoder().encode(r));return Array.from(new Uint8Array(i),n=>n.toString(16).padStart(2,"0")).join("").slice(0,32)}function Sr(t){let e=new TextEncoder().encode(t),r="";for(let i of e)r+=String.fromCharCode(i);return btoa(r).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}function Er(t){let e,r,i,n,a,o,s=()=>o?.readyState==="live",l=()=>{a!==void 0||!globalThis.crypto?.subtle||rt()||s()||(a=Promise.race([Promise.resolve().then(()=>($e(),Qe)),new Promise(c=>setTimeout(c,br))]).then(c=>c?.computePrint(s)).then(c=>{c==="busy"?a=void 0:n=c}).catch(()=>{}))};return{timezone(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone?.slice(0,64)||void 0}catch{return}},noteCameraLabel(c){c&&(e=c.slice(0,128))},noteCamera(c){r=c},noteCameraTrack(c){o=c},async deviceHeader(){try{i??(i=vr().catch(()=>""));let c=[];navigator.webdriver&&c.push("webdriver"),/HeadlessChrome/.test(navigator.userAgent)&&c.push("headless");let u=await i,d=yr(),m={v:1,platform:"web",sdk:t.sdk.slice(0,64),ids:[...d?[{kind:"web_local",value:d.slice(0,128)}]:[],...u?[{kind:"web_fp",value:u}]:[]],screen:{w:screen.width,h:screen.height,dpr:globalThis.devicePixelRatio??1},...e?{cameraLabel:e}:{},...c.length?{signals:c}:{},...n?{print:{v:2,...n,...r?{camera:r}:{}}}:{},...Ke()?{inApp:!0}:{}},p=Sr(JSON.stringify(m));return l(),p}catch{return}},printReady(){return a??Promise.resolve()}}}var Ee=Symbol.for("sekyro.web.clientContext"),Me=globalThis,Te=Me[Ee]??(Me[Ee]=Er({sdk:`@sekyro/web@${We}`}));function nt(t){try{let e=t.getVideoTracks?.()[0];if(e){if(Te.noteCameraLabel(e.label),Te.noteCameraTrack(e),rt())return;Promise.resolve().then(()=>(Se(),Xe)).then(r=>r.noteCameraTrait(e,Te)).catch(()=>{})}}catch{}}var ke=Symbol.for("sekyro.web.cameraStreams"),Ce=globalThis,Mr=Ce[ke]??(Ce[ke]=new Set);function it(t){try{Mr.add(t)}catch{}}var Tr=["obs","manycam","virtual","snap camera","xsplit","droidcam","iriun","camo"],kr=[/^(front|back|rear)( [a-z ]+)? camera$/i,/^camera2? ?\d+, facing (front|back|external)/i,/facetime/i,/\b(integrated|built-in|builtin) (web)?cam(era)?\b/i,/\b(hd )?web ?cam\b/i,/\([0-9a-f]{4}:[0-9a-f]{4}\)\s*$/i];function Cr(t){let e=(t??"").trim().toLowerCase();return e.length===0?"unknown":Tr.some(r=>e.includes(r))?"known_virtual":kr.some(r=>r.test(e))?"platform":"unknown"}function at(t){if(typeof t!="function")return!1;try{return/\{\s*\[native code\]\s*\}\s*$/.test(Function.prototype.toString.call(t))}catch{return!1}}function wr(t=globalThis){return at(t.navigator?.mediaDevices?.getUserMedia)&&at(t.MediaStreamTrack?.prototype?.getSettings)}async function xr(t,e=globalThis){let r=e.crypto?.subtle?.digest;if(typeof r=="function")try{let i=new Uint8Array(await r.call(e.crypto?.subtle,"SHA-256",new TextEncoder().encode(t)));return Array.from(i.subarray(0,8),n=>n.toString(16).padStart(2,"0")).join("")}catch{return}}async function ot(t,e=globalThis){let r={};try{r=typeof t.getSettings=="function"?t.getSettings()??{}:{}}catch{r={}}let i={};if((r.facingMode==="user"||r.facingMode==="environment"||r.facingMode==="left"||r.facingMode==="right")&&(i.facingMode=r.facingMode),typeof r.frameRate=="number"&&Number.isFinite(r.frameRate)&&(i.frameRate=r.frameRate),typeof r.width=="number"&&Number.isFinite(r.width)&&(i.width=r.width),typeof r.height=="number"&&Number.isFinite(r.height)&&(i.height=r.height),typeof r.deviceId=="string"&&r.deviceId.length>0){let a=await xr(r.deviceId,e);a!==void 0&&(i.deviceIdHash=a)}let n;try{n=t.label}catch{n=void 0}return{trackSettings:i,capabilitiesPresent:typeof t.getCapabilities=="function",labelClass:Cr(n),prototypesIntact:wr(e)}}var we=t=>Math.round(t*100)/100;function st(t){let e=t,r=typeof e?.requestVideoFrameCallback=="function",i=null,n=null,a=0,o=0,s=0,l=0,c=0,u=0,d=()=>{!r||e?.requestVideoFrameCallback===void 0||(i=e.requestVideoFrameCallback((m,p)=>{if(i=null,!r)return;let f=p.presentationTime;if(n!==null){let h=f-n.presentationTimeMs;o+=1;let g=h-s;s+=g/o,l+=g*(h-s)}typeof p.captureTime=="number"&&Number.isFinite(p.captureTime)&&(c+=f-p.captureTime,u+=1),a+=1,n={mediaTimeMs:p.mediaTime*1e3,presentationTimeMs:f},d()}))};return d(),{latest:()=>n,stats:()=>({n:a,meanGapMs:o===0?0:we(s),stdGapMs:o<2?0:we(Math.sqrt(l/(o-1))),captureLatencyMs:u===0?null:we(c/u)}),stop:()=>{r&&(r=!1,i!==null&&e?.cancelVideoFrameCallback?.(i),i=null)}}}function ct(t,e,r){return{...t,rvfc:e,rampPainter:r}}var _r=["rose","peach","sand","mint","sky","lilac"];var Rr=4,Dr=4;function Ir(t){if(typeof t!="object"||t===null)return!1;let e=t;if(typeof e.nonce!="string"||e.nonce.length===0||!Array.isArray(e.colours)||e.colours.length!==3||!e.colours.every(i=>_r.includes(i))||!Array.isArray(e.onsetsMs)||e.onsetsMs.length!==3)return!1;let r=-1;for(let i of e.onsetsMs){if(typeof i!="number"||!Number.isFinite(i)||i<=r||i>=2e3)return!1;r=i}return!0}function ut(t,e){let r=e.now??(()=>performance.now()),i=Ir(t)?t:void 0,n=[],a=null,o=null,s=null,l=!1,c=null,u=f=>{c=f;try{e.paint(f)}catch{}},d=f=>{let h=e.frames?.()??null;return h!==null&&s!==null?h.mediaTimeMs+(f-h.presentationTimeMs)-s:f-(o??f)},m=(f,h,g=0)=>{if(l)return;let S=Math.max(0,f-d(r()));a=setTimeout(()=>{if(a=null,!l){if(g<Rr&&d(r())<f-Dr){m(f,h,g+1);return}h()}},S)},p=f=>{if(i!==void 0){if(f>=3){m(2e3,()=>u(null));return}m(i.onsetsMs[f],()=>{let h=d(r());if(h>2e3){c!==null&&u(null);return}let g=i.colours[f];u(g);let S=n.length===0?0:n[n.length-1].tMs;n.push({tMs:Math.max(S,Math.round(h)),colour:g}),p(f+1)})}};return{started(f){if(i===void 0||l||o!==null)return;o=f;let h=e.frames?.()??null;s=h===null?null:h.mediaTimeMs+(f-h.presentationTimeMs),p(0)},stop(){l||(l=!0,a!==null&&clearTimeout(a),a=null,c!==null&&u(null))},report(){return i===void 0?void 0:{nonce:i.nonce,rendered:[...n]}}}}var Ar=40;function H(t){if(t===null||typeof t!="object"&&typeof t!="function")return;let e;try{e=t.name}catch{return}return Or(e)}function Or(t){if(typeof t!="string")return;let e=t.replace(/[^A-Za-z]/g,"").slice(0,Ar);return e===""?void 0:e}function lt(t){let e=oe(t);if(e!=="generic")return e;switch(H(t)){case"AbortError":return"inuse";case"SecurityError":return"permission";default:return e}}var M=1;function dt(){return typeof OffscreenCanvas=="function"&&typeof createImageBitmap=="function"&&typeof Worker=="function"}function Pr(t,e={}){let r=e.createDetector??x,i=null;t.onmessage=n=>{let a=n.data;if(a.v!==M){a.bitmap?.close?.();return}if(a.type==="init"){r(a.options).then(o=>{i=o;let s={v:M,type:"ready",tier:o.tier,...o.fallbackReason!==void 0?{fallbackReason:o.fallbackReason}:{}};t.postMessage(s)});return}if(a.type==="detect"){let o=s=>{let l={v:M,type:"result",id:a.id,observation:s};t.postMessage(l),a.bitmap.close?.()};if(i===null){o(null);return}i.detect(a.bitmap,a.streamWidth,a.streamHeight).then(o,()=>o(null))}}}typeof self<"u"&&typeof self.importScripts=="function"&&Pr(self);var J=class t{constructor(e,r){this.pending=new Map;this.nextId=1;this.worker=e,this.tier=r.tier,r.fallbackReason!==void 0&&(this.fallbackReason=r.fallbackReason),e.addEventListener("message",i=>{let n=i.data;if(n.v!==M||n.type!=="result")return;let a=this.pending.get(n.id);this.pending.delete(n.id),a?.(n.observation)})}static create(e,r,i=1e4){return new Promise((n,a)=>{let o=setTimeout(()=>{e.removeEventListener("message",s),e.terminate(),a(new Error(`worker detector not ready within ${i}ms`))},i),s=c=>{let u=c.data;u.v!==M||u.type!=="ready"||(clearTimeout(o),e.removeEventListener("message",s),n(new t(e,u)))};e.addEventListener("message",s);let l={v:M,type:"init",options:r};e.postMessage(l)})}async detect(e,r,i){let n;try{typeof ImageBitmap<"u"&&e instanceof ImageBitmap?n=e:typeof createImageBitmap=="function"?n=await createImageBitmap(e):n=e}catch{return null}let a=this.nextId;return this.nextId+=1,new Promise(o=>{this.pending.set(a,o);let s={v:M,type:"detect",id:a,bitmap:n,streamWidth:r,streamHeight:i};this.worker.postMessage(s,[n])})}destroy(){for(let e of this.pending.values())e(null);this.pending.clear(),this.worker.terminate()}};var Fr=["size","centering","pose","exposure","sharpness","motion"];function mt(t){if(t.accepted)return null;if(t.factors.presence<=0)return"no_face";let e="size";for(let r of Fr)t.factors[r]<t.factors[e]&&(e=r);return e}var D=class{constructor(){this.blocked={};this.acceptedMs=0;this.ticks=0;this.lastAt=null}record(e){let r=this.lastAt===null?0:Math.max(0,e.at-this.lastAt);this.lastAt=e.at,this.ticks+=1;let i=mt(e);if(i===null){this.acceptedMs+=r;return}let n=this.blocked[i]??{count:0,ms:0};n.count+=1,n.ms+=r,this.blocked[i]=n}summary(){let e={};for(let[r,i]of Object.entries(this.blocked))e[r]={count:i.count,ms:Math.round(i.ms)};return{blocked:e,acceptedMs:Math.round(this.acceptedMs),ticks:this.ticks}}};var kt=1e3,te="fcv3.hold_upright",Ct=200,re=4,wt=600,xt=1e3,Mt={sharpness:1,exposure:1,meanLuma:128};function Wr(t,e){return e.width=t.videoWidth,e.height=t.videoHeight,e.getContext("2d").drawImage(t,0,0),new Promise((r,i)=>e.toBlob(n=>n?r(n):i(new Error("empty-keyframe")),"image/jpeg",.92))}function Kr(){return q()==="phone"}var _e=class{constructor(e){this.handlers=new Map;this.stateValue="idle";this.attempt=0;this.stream=null;this.detector=null;this.scheduler=null;this.gate=null;this.profiler=null;this.lastGuidanceKey=null;this.positioningStartedAt=0;this.cameraRequestedAt=null;this.cameraReadyAt=null;this.faceAcquiredAt=null;this.captureCompleteAt=null;this.fired=!1;this.carriedDegrade=0;this.carriedMeans=[];this.blockStats=null;this.lastGateSnapshotAt=Number.NEGATIVE_INFINITY;this.uprightGuard=!1;this.trackProvenance=null;this.ramp=null;this.snapshotCanvas=null;this.options=e,this.facing=e.facingMode??"user"}get state(){return this.stateValue}on(e,r){let i=this.handlers.get(e);return i||(i=new Set,this.handlers.set(e,i)),i.add(r),()=>i?.delete(r)}emit(e,r){for(let i of[...this.handlers.get(e)??[]])i(r)}async start(e={}){e.facingMode!==void 0&&(this.facing=e.facingMode),this.attempt+=1,await this.run(this.attempt)}get facingMode(){return this.facing}retry(){this.teardownAttempt(),this.start()}switchCamera(){this.facing=this.facing==="user"?"environment":"user",this.teardownAttempt(),this.start()}destroy(){this.attempt+=1,this.teardownAttempt(),this.detector?.destroy(),this.detector=null,this.options.video.srcObject=null}async run(e){let{options:r}=this;this.fired=!1,this.lastGuidanceKey=null,this.carriedDegrade=0,this.carriedMeans=[],this.cameraRequestedAt=null,this.cameraReadyAt=null,this.faceAcquiredAt=null,this.captureCompleteAt=null,this.uprightGuard=(r.isPhone??Kr)(),this.setState("preflight");let i=se();if(i!=="OK"){this.fail(i==="INSECURE_CONTEXT"?"insecure":"unsupported",{phase:"preflight"});return}this.setState("acquiring");let n=r.getUserMedia??(c=>navigator.mediaDevices.getUserMedia(c)),a;this.cameraRequestedAt=this.now();try{a=await n(le(de(),this.facing))}catch(c){if(e!==this.attempt)return;this.fail(lt(c),{phase:"acquiring",name:H(c)});return}if(nt(a),it(a),e!==this.attempt){for(let c of a.getTracks())c.stop();return}this.stream=a;let o=a.getVideoTracks?.()[0];if(this.trackProvenance=o===void 0?null:ot(o).catch(()=>null),this.facing=me(a)??this.facing,r.video.srcObject=a,await r.video.play().catch(()=>{}),e!==this.attempt)return;if(this.cameraReadyAt=this.now(),this.detector===null){let c={v3AssetBaseUrl:r.v3AssetBaseUrl},u=r.createDetector??(r.createWorker!==void 0&&dt()?async()=>{try{return await J.create(r.createWorker(),c)}catch{return x(c)}}:()=>x(c)),d;try{d=await u()}catch(m){e===this.attempt&&this.fail("models",{phase:"models",name:H(m)},m instanceof w?m.fallbackReason:zr(m));return}if(e!==this.attempt){d.destroy();return}this.detector=d,this.options.telemetry?.({type:"detector",tier:d.tier,fallbackReason:d.fallbackReason})}let s=ge(),l=r.deviceClass??be(s);this.profiler=new N(l),this.options.telemetry?.({type:"profile",staticClass:l,activeClass:this.profiler.deviceClass,simd:s.simd}),this.gate=new R(r.thresholds??{}),this.blockStats=new D,this.lastGateSnapshotAt=this.now(),r.rankKeyframes?.()&&Promise.resolve().then(()=>(Et(),St)).then(c=>xe=c,()=>{}),this.setState("positioning"),this.positioningStartedAt=this.now(),this.startScheduler(e)}get animations(){return this.profiler?.profile.animations??"full"}startScheduler(e){let r=this.profiler;if(r===null)return;if(this.scheduler!==null){let n=this.scheduler.stats();this.carriedDegrade+=n.degradeCount,n.meanDetectMs>0&&this.carriedMeans.push(n.meanDetectMs),this.scheduler.stop()}let i=new V({cadenceHz:r.profile.cadenceHz,video:this.options.video,now:this.options.now,run:()=>this.detectTick(e)});this.scheduler=i,i.start()}async detectTick(e){let{detector:r,gate:i,profiler:n}=this,a=this.options.video;if(e!==this.attempt||r===null||i===null||n===null||this.fired||a.videoWidth===0)return;if(this.isLandscape()){this.holdUpright(e);return}let o=n.deviceClass,s=this.now(),l=this.options.makeSnapshot?.(a,n.profile.inputWidth)??this.defaultSnapshot(a,n.profile.inputWidth),c=null;try{c=await r.detect(l,a.videoWidth,a.videoHeight)}catch{c=null}if(e!==this.attempt||this.fired)return;n.record(this.now()-s),n.deviceClass!==o&&this.startScheduler(e);let u=c===null?Mt:this.options.measureQuality?.(a,c.box)??this.defaultQuality(a,c.box),d=i.tick({timestampMs:this.now(),observation:c,quality:u,frameWidth:a.videoWidth,frameHeight:a.videoHeight});d.accepted&&this.faceAcquiredAt===null&&(this.faceAcquiredAt=d.at),this.blockStats?.record(d),!d.ready&&d.at-this.lastGateSnapshotAt>=kt&&(this.lastGateSnapshotAt=d.at,this.reportGate(!1)),this.emit("checks",{engine:"v3",progress:d.p,q:d.q,factors:d.factors,attempt:e}),d.guidanceKey!==this.lastGuidanceKey&&(this.lastGuidanceKey=d.guidanceKey,this.emit("guidance",{key:d.guidanceKey})),d.ready&&this.stateValue==="positioning"&&(this.fired=!0,this.captureCompleteAt=d.at,this.fire(e))}async fire(e){let{options:r}=this,i=this.scheduler;i?.stop(),this.reportGate(!0);let n=i?.stats()??{degradeCount:0,meanDetectMs:0},a=[...this.carriedMeans,...n.meanDetectMs>0?[n.meanDetectMs]:[]];r.telemetry?.({type:"fired",timeToGateMs:this.now()-this.positioningStartedAt,degradeCount:this.carriedDegrade+n.degradeCount,meanDetectMs:a.length===0?0:a.reduce((b,E)=>b+E,0)/a.length});let o=r.mode??"clip",s=r.rankKeyframes?.()&&xe?xe.default(this,e).catch(()=>this.collectKeyframes(e)):this.collectKeyframes(e);if(o==="photo"){let b=this.watchRotation(e,null),E=await s;if(b(),e!==this.attempt)return;if(E===null){this.fail("generic",{phase:"keyframes"});return}let _t=await this.provenance({n:0,meanGapMs:0,stdGapMs:0,captureLatencyMs:null},!1);if(e!==this.attempt)return;this.finishCapture({keyframe:E.blob,previewDataUrl:E.previewDataUrl,..._t});return}this.setState("recording");let l=r.createRecorder?.()??new P,c=this.stream;if(c===null){this.fail("generic",{phase:"recording"});return}let u=st(r.video),d=r.screenRamp?.(),m=d!==void 0,p=ut(d,{paint:b=>{(b===null||e===this.attempt)&&this.emit("ramp",{colour:b})},now:()=>this.now(),frames:u.latest});this.ramp=p;let f=()=>{u.stop(),p.stop(),this.ramp===p&&(this.ramp=null)},h=this.watchRotation(e,l),g=null;s.then(b=>{g=b},()=>{});let S=()=>{e===this.attempt&&g!==null&&this.emit("frozen",{previewDataUrl:g.previewDataUrl})},v,T;try{[v,T]=await Promise.all([l.record(c,S,()=>p.started(this.now())),s])}catch(b){if(h(),f(),e!==this.attempt)return;let E=b.kind;this.fail(E==="cliptoolarge"?"cliptoolarge":"recorder",{phase:"recording",name:H(b)});return}h();let k=u.stats();if(f(),e!==this.attempt)return;if(O(v.blob)){this.fail("cliptoolarge",{phase:"recording"});return}if(T===null){this.fail("generic",{phase:"keyframes"});return}let A=p.report(),ne=await this.provenance(k,m);e===this.attempt&&this.finishCapture({clip:v.blob,clipMimeType:v.mimeType,keyframe:T.blob,previewDataUrl:T.previewDataUrl,...A!==void 0&&A.rendered.length>0?{screenRamp:A}:{},...ne})}async provenance(e,r){let i=this.trackProvenance;if(i===null)return{};let n,a=new Promise(s=>{n=setTimeout(()=>s(null),xt)}),o=await Promise.race([i,a]);return clearTimeout(n),o===null?{}:{provenance:ct(o,e,r)}}isLandscape(){let e=this.options.video;return this.uprightGuard&&e.videoWidth>e.videoHeight}holdUpright(e){this.gate?.reset(),this.emit("checks",{engine:"v3",progress:0,q:0,factors:{presence:0,centering:0,size:0,pose:0,sharpness:0,exposure:0,motion:0},attempt:e}),this.lastGuidanceKey!==te&&(this.lastGuidanceKey=te,this.emit("guidance",{key:te}))}watchRotation(e,r){if(!this.uprightGuard)return()=>{};let i=this.options.video,n=()=>{if(e!==this.attempt||r!==null&&this.stateValue!=="recording"){s();return}i.videoWidth>0&&this.isLandscape()&&(s(),this.abortRecording(e,r))},a=setInterval(n,Ct);i.addEventListener?.("resize",n);let o=!1;function s(){o||(o=!0,clearInterval(a),i.removeEventListener?.("resize",n))}return s}abortRecording(e,r){if(e!==this.attempt)return;this.attempt+=1;let i=this.attempt;try{r?.stop()}catch{}this.ramp?.stop(),this.ramp=null,this.fired=!1,this.captureCompleteAt=null,this.gate=new R(this.options.thresholds??{}),this.blockStats=new D,this.lastGateSnapshotAt=this.now(),this.lastGuidanceKey=null,this.setState("positioning"),this.positioningStartedAt=this.now(),this.holdUpright(i),this.startScheduler(i)}async collectKeyframes(e){let r=this.options.captureKeyframe??(a=>this.defaultKeyframe(a)),i=wt/(re-1),n=null;for(let a=0;a<re;a+=1){if(e!==this.attempt)return n;try{let o=await r(this.options.video);(n===null||o.sharpness>n.sharpness)&&(n=o)}catch{}a<re-1&&await Ur(i)}return n}finishCapture(e){this.stopTracks(),this.setState("captured");let r=this.captureTiming();this.emit("artifacts",r===void 0?e:{...e,timing:r})}captureTiming(){let e={},r=(i,n,a)=>{n!==null&&a!==null&&(e[i]=Math.max(0,Math.round(a-n)))};return r("cameraReadyMs",this.cameraRequestedAt,this.cameraReadyAt),r("faceAcquireMs",this.cameraReadyAt,this.faceAcquiredAt),r("captureMs",this.faceAcquiredAt,this.captureCompleteAt),Object.keys(e).length>0?e:void 0}async defaultKeyframe(e){let r=document.createElement("canvas"),i=await(this.facing==="user"?ce:Wr)(e,r),n=r.toDataURL("image/jpeg",.92);return{blob:i,previewDataUrl:n,sharpness:this.centerSharpness(e)}}defaultSnapshot(e,r){try{let i=this.snapshotCanvas??document.createElement("canvas"),n=r/Math.max(1,e.videoWidth),a=Math.max(1,Math.round(e.videoWidth*n)),o=Math.max(1,Math.round(e.videoHeight*n)),s=i.getContext("2d");return s===null?e:(i.width!==a&&(i.width=a),i.height!==o&&(i.height=o),s.drawImage(e,0,0,a,o),this.snapshotCanvas=i,i)}catch{return e}}defaultQuality(e,r){let i=Tt(e,r,96);return i===null?Mt:{sharpness:Q(i),exposure:fe(i),meanLuma:j(i)}}centerSharpness(e){let r=C(e),i=Tt(e,{x:r.width*.25,y:r.height*.25,width:r.width*.5,height:r.height*.5},96);return i===null?0:Q(i)}teardownAttempt(){this.scheduler?.stop(),this.scheduler=null,this.reportGate(!0),this.gate=null,this.ramp?.stop(),this.ramp=null,this.stopTracks()}reportGate(e){let r=this.blockStats,i=this.profiler;if(r===null||i===null)return;let n=r.summary();e&&(this.blockStats=null),n.ticks!==0&&this.options.telemetry?.({type:"gate",final:e,activeClass:i.deviceClass,cadenceHz:i.profile.cadenceHz,...n})}stopTracks(){if(this.stream!==null){for(let e of this.stream.getTracks())e.stop();this.stream=null}}fail(e,r,i){this.scheduler?.stop(),this.reportGate(!0),this.stopTracks(),this.setState("error"),this.options.telemetry?.({type:"error",kind:e,fallbackReason:i});let{phase:n,name:a}=r;this.emit("error",{kind:e,retryable:e!=="insecure"&&e!=="unsupported",detail:a===void 0?{phase:n}:{phase:n,name:a}})}setState(e){this.stateValue=e,this.emit("statechange",{state:e})}now(){return this.options.now?.()??performance.now()}},xe;function Ur(t){return new Promise(e=>setTimeout(e,t))}function zr(t){return t instanceof Error?t.message:String(t)}function Tt(t,e,r){try{let i=document.createElement("canvas"),n=r/Math.max(1,e.width);i.width=Math.max(1,Math.round(e.width*n)),i.height=Math.max(1,Math.round(e.height*n));let a=i.getContext("2d");return a===null?null:(a.drawImage(t,e.x,e.y,e.width,e.height,0,0,i.width,i.height),a.getImageData(0,0,i.width,i.height))}catch{return null}}0&&(module.exports={CENTERED_FACTOR,CIRCLE_RADIUS_FACTOR,CLIP_MS,CaptureSessionV3,ClipError,ClipRecorder,DEFAULT_CLIP_MIME,DEFAULT_TIER_ORDER,DEFAULT_V3_ASSET_BASE_URL,DEVICE_PROFILES,DetectScheduler,DetectorLadderError,DeviceProfiler,EXPOSURE_BAND,FaceGateV3,GATE_SNAPSHOT_MS,GateBlockStats,HOLD_UPRIGHT_KEY,IN_CIRCLE_FACTOR,KEYFRAME_CANDIDATES,KEYFRAME_WINDOW_MS,MAX_CLIP_BYTES,MIME_CANDIDATES,PHONE_MAX_SHORT_SIDE,PROVENANCE_WAIT_MS,SHARP_REF,STOP_GRACE_MS,TIMESLICE_MS,UPRIGHT_WATCH_MS,V3_GATE_DEFAULTS,VIDEO_BPS,blockReasonOf,buildCaptureConstraints,buildLivenessV2FormData,cameraPreflight,captureMirroredKeyframe,classifyDevice,createDetector,detectFormFactor,detectIsMobile,errorCopy,exposure,extForMime,intrinsicSize,isClipTooLarge,isMediaRecorderSupported,mapGetUserMediaError,meanLuma,pickMimeType,probeDevice,sharpness,toStreamPixels,trackFacingMode,uiCopy});
|
package/dist/core/index.d.cts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { C as CameraErrorKind } from '../capture-session-v3-
|
|
2
|
-
export { a as CLIP_MS, b as CaptureArtifacts, c as CaptureErrorKind, d as CaptureSessionEvents, e as CaptureSessionV3, f as CaptureSessionV3Events, g as CaptureSessionV3Options, h as CaptureSessionV3StartOptions, i as CaptureState, j as CaptureTiming, k as ClipError, l as ClipErrorKind, m as ClipRecorder, n as ClipResult, D as DEFAULT_CLIP_MIME, o as DEVICE_PROFILES, p as DeviceClass, q as DeviceProbe, r as DeviceProfile, s as DeviceProfiler, E as EscalationClipArtifact, t as EscalationHook, F as FaceGateV3, G as GATE_SNAPSHOT_MS, u as GateBlockEntry, v as GateBlockReason, w as GateBlockStats, x as GateBlockSummary, y as GateChecks, H as HOLD_UPRIGHT_KEY, K as KEYFRAME_CANDIDATES, z as KEYFRAME_WINDOW_MS, M as MAX_CLIP_BYTES, A as MIME_CANDIDATES, P as PROVENANCE_WAIT_MS, S as STOP_GRACE_MS, T as TIMESLICE_MS, U as UPRIGHT_WATCH_MS, V as V3ChecksPayload, B as V3GateFactor, I as V3GateQuality, J as V3GateThresholds, L as V3GateTick, N as V3GateTickInput, O as V3TelemetryEvent, Q as V3_GATE_DEFAULTS, R as VIDEO_BPS, W as blockReasonOf, X as buildLivenessV2FormData, Y as cameraPreflight, Z as classifyDevice, _ as extForMime, $ as isClipTooLarge, a0 as isMediaRecorderSupported, a1 as mapGetUserMediaError, a2 as pickMimeType, a3 as probeDevice } from '../capture-session-v3-
|
|
1
|
+
import { C as CameraErrorKind } from '../capture-session-v3-CNL-GX11.cjs';
|
|
2
|
+
export { a as CLIP_MS, b as CaptureArtifacts, c as CaptureErrorKind, d as CaptureSessionEvents, e as CaptureSessionV3, f as CaptureSessionV3Events, g as CaptureSessionV3Options, h as CaptureSessionV3StartOptions, i as CaptureState, j as CaptureTiming, k as ClipError, l as ClipErrorKind, m as ClipRecorder, n as ClipResult, D as DEFAULT_CLIP_MIME, o as DEVICE_PROFILES, p as DeviceClass, q as DeviceProbe, r as DeviceProfile, s as DeviceProfiler, E as EscalationClipArtifact, t as EscalationHook, F as FaceGateV3, G as GATE_SNAPSHOT_MS, u as GateBlockEntry, v as GateBlockReason, w as GateBlockStats, x as GateBlockSummary, y as GateChecks, H as HOLD_UPRIGHT_KEY, K as KEYFRAME_CANDIDATES, z as KEYFRAME_WINDOW_MS, M as MAX_CLIP_BYTES, A as MIME_CANDIDATES, P as PROVENANCE_WAIT_MS, S as STOP_GRACE_MS, T as TIMESLICE_MS, U as UPRIGHT_WATCH_MS, V as V3ChecksPayload, B as V3GateFactor, I as V3GateQuality, J as V3GateThresholds, L as V3GateTick, N as V3GateTickInput, O as V3TelemetryEvent, Q as V3_GATE_DEFAULTS, R as VIDEO_BPS, W as blockReasonOf, X as buildLivenessV2FormData, Y as cameraPreflight, Z as classifyDevice, _ as extForMime, $ as isClipTooLarge, a0 as isMediaRecorderSupported, a1 as mapGetUserMediaError, a2 as pickMimeType, a3 as probeDevice } from '../capture-session-v3-CNL-GX11.cjs';
|
|
3
3
|
export { C as CENTERED_FACTOR, a as CIRCLE_RADIUS_FACTOR, F as FormFactor, I as IN_CIRCLE_FACTOR, P as PHONE_MAX_SHORT_SIDE, b as buildCaptureConstraints, d as detectFormFactor, c as detectIsMobile, t as trackFacingMode } from '../capture-constraints-B5omafmk.cjs';
|
|
4
4
|
export { C as CreateDetectorOptions, D as DEFAULT_TIER_ORDER, a as DEFAULT_V3_ASSET_BASE_URL, b as Detector, c as DetectorLadderError, F as FaceObservation, d as createDetector, i as intrinsicSize, t as toStreamPixels } from '../detect-worker-DclNxkZT.cjs';
|
|
5
|
-
import '../types-
|
|
5
|
+
import '../types-Dpfg2cO8.cjs';
|
|
6
6
|
|
|
7
7
|
declare function captureMirroredKeyframe(video: HTMLVideoElement, canvas: HTMLCanvasElement, quality?: number): Promise<Blob>;
|
|
8
8
|
|
package/dist/core/index.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { C as CameraErrorKind } from '../capture-session-v3-
|
|
2
|
-
export { a as CLIP_MS, b as CaptureArtifacts, c as CaptureErrorKind, d as CaptureSessionEvents, e as CaptureSessionV3, f as CaptureSessionV3Events, g as CaptureSessionV3Options, h as CaptureSessionV3StartOptions, i as CaptureState, j as CaptureTiming, k as ClipError, l as ClipErrorKind, m as ClipRecorder, n as ClipResult, D as DEFAULT_CLIP_MIME, o as DEVICE_PROFILES, p as DeviceClass, q as DeviceProbe, r as DeviceProfile, s as DeviceProfiler, E as EscalationClipArtifact, t as EscalationHook, F as FaceGateV3, G as GATE_SNAPSHOT_MS, u as GateBlockEntry, v as GateBlockReason, w as GateBlockStats, x as GateBlockSummary, y as GateChecks, H as HOLD_UPRIGHT_KEY, K as KEYFRAME_CANDIDATES, z as KEYFRAME_WINDOW_MS, M as MAX_CLIP_BYTES, A as MIME_CANDIDATES, P as PROVENANCE_WAIT_MS, S as STOP_GRACE_MS, T as TIMESLICE_MS, U as UPRIGHT_WATCH_MS, V as V3ChecksPayload, B as V3GateFactor, I as V3GateQuality, J as V3GateThresholds, L as V3GateTick, N as V3GateTickInput, O as V3TelemetryEvent, Q as V3_GATE_DEFAULTS, R as VIDEO_BPS, W as blockReasonOf, X as buildLivenessV2FormData, Y as cameraPreflight, Z as classifyDevice, _ as extForMime, $ as isClipTooLarge, a0 as isMediaRecorderSupported, a1 as mapGetUserMediaError, a2 as pickMimeType, a3 as probeDevice } from '../capture-session-v3-
|
|
1
|
+
import { C as CameraErrorKind } from '../capture-session-v3-DaBqN8fO.js';
|
|
2
|
+
export { a as CLIP_MS, b as CaptureArtifacts, c as CaptureErrorKind, d as CaptureSessionEvents, e as CaptureSessionV3, f as CaptureSessionV3Events, g as CaptureSessionV3Options, h as CaptureSessionV3StartOptions, i as CaptureState, j as CaptureTiming, k as ClipError, l as ClipErrorKind, m as ClipRecorder, n as ClipResult, D as DEFAULT_CLIP_MIME, o as DEVICE_PROFILES, p as DeviceClass, q as DeviceProbe, r as DeviceProfile, s as DeviceProfiler, E as EscalationClipArtifact, t as EscalationHook, F as FaceGateV3, G as GATE_SNAPSHOT_MS, u as GateBlockEntry, v as GateBlockReason, w as GateBlockStats, x as GateBlockSummary, y as GateChecks, H as HOLD_UPRIGHT_KEY, K as KEYFRAME_CANDIDATES, z as KEYFRAME_WINDOW_MS, M as MAX_CLIP_BYTES, A as MIME_CANDIDATES, P as PROVENANCE_WAIT_MS, S as STOP_GRACE_MS, T as TIMESLICE_MS, U as UPRIGHT_WATCH_MS, V as V3ChecksPayload, B as V3GateFactor, I as V3GateQuality, J as V3GateThresholds, L as V3GateTick, N as V3GateTickInput, O as V3TelemetryEvent, Q as V3_GATE_DEFAULTS, R as VIDEO_BPS, W as blockReasonOf, X as buildLivenessV2FormData, Y as cameraPreflight, Z as classifyDevice, _ as extForMime, $ as isClipTooLarge, a0 as isMediaRecorderSupported, a1 as mapGetUserMediaError, a2 as pickMimeType, a3 as probeDevice } from '../capture-session-v3-DaBqN8fO.js';
|
|
3
3
|
export { C as CENTERED_FACTOR, a as CIRCLE_RADIUS_FACTOR, F as FormFactor, I as IN_CIRCLE_FACTOR, P as PHONE_MAX_SHORT_SIDE, b as buildCaptureConstraints, d as detectFormFactor, c as detectIsMobile, t as trackFacingMode } from '../capture-constraints-B5omafmk.js';
|
|
4
4
|
export { C as CreateDetectorOptions, D as DEFAULT_TIER_ORDER, a as DEFAULT_V3_ASSET_BASE_URL, b as Detector, c as DetectorLadderError, F as FaceObservation, d as createDetector, i as intrinsicSize, t as toStreamPixels } from '../detect-worker-DclNxkZT.js';
|
|
5
|
-
import '../types-
|
|
5
|
+
import '../types-Dpfg2cO8.js';
|
|
6
6
|
|
|
7
7
|
declare function captureMirroredKeyframe(video: HTMLVideoElement, canvas: HTMLCanvasElement, quality?: number): Promise<Blob>;
|
|
8
8
|
|
package/dist/core/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as x,b as k,c as z,d as C,e as L,f as T,k as E,l as N,m as w,n as D,o as G,p as I,q as J,r as M,s as Q,t as W,u as X,v as Y,w as Z}from"../chunk-
|
|
1
|
+
import{a as x,b as k,c as z,d as C,e as L,f as T,k as E,l as N,m as w,n as D,o as G,p as I,q as J,r as M,s as Q,t as W,u as X,v as Y,w as Z}from"../chunk-FGOVIGGL.js";import{a as e,b as r,c as o,d as n,e as a,f as s,g as t,h as i}from"../chunk-FUHDOEBP.js";import{a as P,b as S,c as B,d as F}from"../chunk-POIQGEZM.js";import{a as c,b as p,c as u,d as f,e as m,f as d,g as l,h as v,i as y,j as g}from"../chunk-CQ7SKLMC.js";import{a as O,b as U,c as V,d as j,e as q}from"../chunk-FPXL63KZ.js";import"../chunk-ZLWH4RBO.js";import{a as R,b as h,c as b,d as A,e as H,f as K}from"../chunk-OKWG3PVH.js";var _={permission:{key:"fcv2.err.permission",fr:"Autorisez la cam\xE9ra dans les r\xE9glages du navigateur (ic\xF4ne cam\xE9ra dans la barre d\u2019adresse), puis r\xE9essayez."},notfound:{key:"fcv2.err.notfound",fr:"Aucune cam\xE9ra d\xE9tect\xE9e. Branchez ou activez une cam\xE9ra, puis r\xE9essayez."},inuse:{key:"fcv2.err.inuse",fr:"La cam\xE9ra est utilis\xE9e par une autre application. Fermez-la puis r\xE9essayez."},overconstrained:{key:"fcv2.err.overconstrained",fr:"La cam\xE9ra ne prend pas en charge les r\xE9glages demand\xE9s. Nouvel essai en cours\u2026"},insecure:{key:"fcv2.err.insecure",fr:"La cam\xE9ra n\xE9cessite une connexion s\xE9curis\xE9e (HTTPS). Ouvrez la page en HTTPS."},unsupported:{key:"fcv2.err.unsupported",fr:"Votre navigateur ne prend pas en charge l\u2019enregistrement vid\xE9o. Utilisez un navigateur r\xE9cent."},generic:{key:"fcv2.err.generic",fr:"Cam\xE9ra indisponible. R\xE9essayez ou contactez le support."}},$={recording:{key:"fcv2.recording",fr:"Enregistrement en cours\u2026"},uploading:{key:"fcv2.uploading",fr:"Envoi en cours\u2026"},clipTooLarge:{key:"fcv2.err.cliptoolarge",fr:"La vid\xE9o est trop volumineuse. R\xE9essayez dans un endroit mieux \xE9clair\xE9."},retry:{key:"fcv2.retry",fr:"R\xE9essayer"},listen:{key:"fcv2.listen",fr:"\xC9couter"}};export{i as CENTERED_FACTOR,s as CIRCLE_RADIUS_FACTOR,x as CLIP_MS,Z as CaptureSessionV3,L as ClipError,T as ClipRecorder,u as DEFAULT_CLIP_MIME,h as DEFAULT_TIER_ORDER,R as DEFAULT_V3_ASSET_BASE_URL,P as DEVICE_PROFILES,N as DetectScheduler,b as DetectorLadderError,F as DeviceProfiler,U as EXPOSURE_BAND,D as FaceGateV3,J as GATE_SNAPSHOT_MS,I as GateBlockStats,M as HOLD_UPRIGHT_KEY,t as IN_CIRCLE_FACTOR,W as KEYFRAME_CANDIDATES,X as KEYFRAME_WINDOW_MS,l as MAX_CLIP_BYTES,c as MIME_CANDIDATES,r as PHONE_MAX_SHORT_SIDE,Y as PROVENANCE_WAIT_MS,O as SHARP_REF,z as STOP_GRACE_MS,k as TIMESLICE_MS,Q as UPRIGHT_WATCH_MS,w as V3_GATE_DEFAULTS,C as VIDEO_BPS,G as blockReasonOf,e as buildCaptureConstraints,g as buildLivenessV2FormData,m as cameraPreflight,E as captureMirroredKeyframe,B as classifyDevice,K as createDetector,o as detectFormFactor,n as detectIsMobile,_ as errorCopy,q as exposure,y as extForMime,A as intrinsicSize,v as isClipTooLarge,d as isMediaRecorderSupported,f as mapGetUserMediaError,V as meanLuma,p as pickMimeType,S as probeDevice,j as sharpness,H as toStreamPixels,a as trackFacingMode,$ as uiCopy};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{u as a,v as b,w as c,x as d}from"./chunk-
|
|
1
|
+
import{u as a,v as b,w as c,x as d}from"./chunk-IG466TOP.js";import"./chunk-G6LKLN4U.js";import"./chunk-TDLIXFDT.js";import"./chunk-W2WD7PR2.js";import"./chunk-GT2ZLGF7.js";import"./chunk-FGOVIGGL.js";import"./chunk-FUHDOEBP.js";import"./chunk-POIQGEZM.js";import"./chunk-CQ7SKLMC.js";import"./chunk-FPXL63KZ.js";import"./chunk-ZLWH4RBO.js";import"./chunk-OKWG3PVH.js";import"./chunk-DK5YPBDQ.js";export{a as SAME_FACE_MAX_DROPS,c as createDocumentCapture,d as createDocumentCaptureInternal,b as warmDocumentCapture};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as a,k as b,l as c,m as d,n as e,o as f}from"./chunk-
|
|
1
|
+
import{j as a,k as b,l as c,m as d,n as e,o as f}from"./chunk-KHR4U2SZ.js";import"./chunk-7ZCZY3ZP.js";import"./chunk-BPE5NSQ2.js";import"./chunk-CJHMFPL6.js";import"./chunk-RI3E7GBN.js";import"./chunk-GI3UFGRQ.js";import"./chunk-GT2ZLGF7.js";import"./chunk-FUHDOEBP.js";import"./chunk-CQ7SKLMC.js";export{a as ANALYSIS_LONG_EDGE,b as PORTRAIT_JPEG_QUALITY,e as createPortraitCaptureInternal,c as defaultGrabber,d as observe,f as warmPortraitCapture};
|