smartcomply-web-sdk 1.0.13 → 1.0.15
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/dist/client/Config.js +1 -1
- package/dist/client/Config.js.map +1 -1
- package/dist/client/Smartcomply.d.ts +2 -2
- package/dist/client/Smartcomply.js +4 -4
- package/dist/client/Smartcomply.js.map +1 -1
- package/dist/esm/client/Config.js +1 -1
- package/dist/esm/client/Config.js.map +1 -1
- package/dist/esm/client/Smartcomply.d.ts +2 -2
- package/dist/esm/client/Smartcomply.js +4 -4
- package/dist/esm/client/Smartcomply.js.map +1 -1
- package/dist/esm/modules/onboarding/onboarding.js +1 -1
- package/dist/esm/modules/onboarding/onboarding.js.map +1 -1
- package/dist/modules/onboarding/onboarding.js +1 -1
- package/dist/modules/onboarding/onboarding.js.map +1 -1
- package/dist/smartcomply.browser.js +6 -6
- package/dist/smartcomply.browser.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../src/index.ts", "../src/client/Config.ts", "../src/errors/SDKError.ts", "../src/errors/AuthError.ts", "../src/errors/NetworkError.ts", "../src/client/HttpClient.ts", "../src/modules/onboarding/onboarding.ts", "../src/utils/device.ts", "../src/camera/CameraManager.ts", "../src/camera/VideoRecorder.ts", "../node_modules/@mediapipe/tasks-vision/vision_bundle.mjs", "../src/camera/FaceDetector.ts", "../src/camera/ActionDetector.ts", "../src/modules/liveness/LivenessUI.ts", "../src/modules/liveness/liveness.ts", "../src/client/Smartcomply.ts", "../src/flow/theme.ts", "../src/flow/DocumentCapture.ts", "../src/flow/SmartComplyFlow.ts", "../src/utils/logger.ts", "../src/camera/Permission.ts", "../src/utils/constants.ts", "../src/modules/liveness/uploader.ts"],
|
|
4
|
-
"sourcesContent": ["import { SmartComply } from \"./client/Smartcomply\";\r\nimport { SmartComplyFlow } from \"./flow/SmartComplyFlow\";\r\n\r\nexport default SmartComply;\r\nexport { SmartComply, SmartComplyFlow };\r\n\r\n// Config\r\nexport type { SDKConfig, Environment } from \"./client/Config\";\r\n\r\n// Flow types\r\nexport type { FlowOptions, FlowResult } from \"./flow/SmartComplyFlow\";\r\n\r\n// Onboarding types\r\nexport type {\r\n OnboardingType,\r\n VerifyIdentityRequest,\r\n VerifyIdentityResponse,\r\n SessionResponse,\r\n SDKInitConfig,\r\n} from \"./types/onboarding\";\r\n\r\n// Liveness types\r\nexport type {\r\n ChallengeAction,\r\n LivenessCreateRequest,\r\n LivenessCreateResponse,\r\n LivenessSubmitResponse,\r\n LivenessWebhookPayload,\r\n} from \"./types/liveness\";\r\n\r\n// Response envelope types\r\nexport type {\r\n ApiResponse,\r\n FieldError,\r\n ErrorData,\r\n} from \"./types/common\";\r\n\r\n// Error classes\r\nexport { SDKError } from \"./errors/SDKError\";\r\nexport { AuthError } from \"./errors/AuthError\";\r\nexport { NetworkError } from \"./errors/NetworkError\";\r\n\r\n// Utilities\r\nexport { SDKLogger } from \"./utils/logger\";\r\nexport { collectDeviceMetadata } from \"./utils/device\";\r\nexport type { DeviceMetadata } from \"./utils/device\";\r\nexport {\r\n isCameraSupported,\r\n queryCameraPermission,\r\n requestCameraAccess,\r\n releaseCameraStream,\r\n} from \"./camera/Permission\";\r\nexport type { PermissionStatus, CameraPermissionResult } from \"./camera/Permission\";\r\n\r\n// Liveness uploader (for integrators that need progress reporting)\r\nexport { LivenessUploader } from \"./modules/liveness/uploader\";\r\nexport type { UploadOptions } from \"./modules/liveness/uploader\";\r\n", "export type Environment = \"sandbox\" | \"production\";\r\n\r\nexport const BASE_URLS: Record<Environment, string> = {\r\n sandbox: \"https://dev-adhere.smartcomply.com\",\r\n production: \"https://api.smartcomply.com\"\r\n};\r\n\r\nexport interface SDKConfig {\r\n apiKey: string;\r\n clientId: string; // Required UUID \u2014 used for session creation\r\n environment?: Environment;\r\n timeout?: number;\r\n}\r\n", "export class SDKError extends Error {\r\n statusCode: number;\r\n errorCode?: string;\r\n errorData?: Record<string, unknown>;\r\n\r\n constructor(\r\n message: string,\r\n statusCode: number,\r\n errorCode?: string,\r\n errorData?: Record<string, unknown>\r\n ) {\r\n super(message);\r\n this.name = \"SDKError\";\r\n this.statusCode = statusCode;\r\n this.errorCode = errorCode;\r\n this.errorData = errorData;\r\n }\r\n}\r\n", "import { SDKError } from \"./SDKError\";\r\n\r\n/**\r\n * Thrown when authentication fails (invalid API key, expired session, etc).\r\n */\r\nexport class AuthError extends SDKError {\r\n constructor(message: string, errorCode?: string) {\r\n super(message, 401, errorCode);\r\n this.name = \"AuthError\";\r\n }\r\n}\r\n", "import { SDKError } from \"./SDKError\";\r\n\r\n/**\r\n * Thrown when a network request fails (timeout, no connection, DNS failure, etc).\r\n */\r\nexport class NetworkError extends SDKError {\r\n constructor(message: string) {\r\n super(message, 0, \"NETWORK_ERROR\");\r\n this.name = \"NetworkError\";\r\n }\r\n}\r\n", "import { SDKConfig, BASE_URLS } from \"./Config\";\r\nimport { SDKError } from \"../errors/SDKError\";\r\nimport { AuthError } from \"../errors/AuthError\";\r\nimport { NetworkError } from \"../errors/NetworkError\";\r\nimport { ApiResponse } from \"../types/common\";\r\n\r\n/**\r\n * HTTP client aligned with Adhere backend contract.\r\n *\r\n * Two auth modes:\r\n * - request() \u2192 Authorization: Bearer <apiKey> (session creation)\r\n * - sessionRequest() \u2192 x-access-token: <sessionToken> (all other endpoints)\r\n * - uploadWithSession() \u2192 multipart + x-access-token (file uploads)\r\n */\r\nexport class HttpClient {\r\n private baseUrl: string;\r\n private apiKey: string;\r\n private timeout: number;\r\n private sessionToken: string | null = null;\r\n\r\n constructor(config: SDKConfig) {\r\n this.baseUrl = BASE_URLS[config.environment || \"sandbox\"];\r\n this.apiKey = config.apiKey;\r\n this.timeout = config.timeout || 30000;\r\n }\r\n\r\n setSessionToken(token: string): void {\r\n this.sessionToken = token;\r\n }\r\n\r\n /**\r\n * API-key authenticated request (used for session creation only).\r\n * Header: Authorization: Bearer <apiKey>\r\n */\r\n async request<T>(\r\n method: string,\r\n path: string,\r\n body?: unknown\r\n ): Promise<T> {\r\n return this._fetch<T>(path, {\r\n method,\r\n headers: {\r\n \"Authorization\": `Bearer ${this.apiKey}`,\r\n \"Content-Type\": \"application/json\",\r\n },\r\n body: body ? JSON.stringify(body) : undefined,\r\n });\r\n }\r\n\r\n /**\r\n * Session-token authenticated request (used for all endpoints after session creation).\r\n * Header: x-access-token: <sessionToken>\r\n */\r\n async sessionRequest<T>(\r\n method: string,\r\n path: string,\r\n body?: unknown\r\n ): Promise<T> {\r\n this.requireToken();\r\n\r\n return this._fetch<T>(path, {\r\n method,\r\n headers: {\r\n \"x-access-token\": this.sessionToken!,\r\n \"Content-Type\": \"application/json\",\r\n },\r\n body: body ? JSON.stringify(body) : undefined,\r\n });\r\n }\r\n\r\n /**\r\n * Multipart file upload with session-token auth.\r\n * Header: x-access-token: <sessionToken>\r\n * NOTE: Do NOT set Content-Type \u2014 browser sets it with boundary automatically.\r\n */\r\n async uploadWithSession<T>(path: string, formData: FormData): Promise<T> {\r\n this.requireToken();\r\n\r\n return this._fetch<T>(path, {\r\n method: \"POST\",\r\n headers: {\r\n \"x-access-token\": this.sessionToken!,\r\n },\r\n body: formData,\r\n });\r\n }\r\n\r\n /**\r\n * Unauthenticated GET \u2014 used for public endpoints (e.g. status polling after session revoke).\r\n */\r\n async publicGet<T>(path: string): Promise<T> {\r\n return this._fetch<T>(path, {\r\n method: \"GET\",\r\n headers: { \"Content-Type\": \"application/json\" },\r\n });\r\n }\r\n\r\n /**\r\n * Legacy upload with API key (kept for backward compatibility if needed).\r\n */\r\n async upload<T>(path: string, formData: FormData): Promise<T> {\r\n return this._fetch<T>(path, {\r\n method: \"POST\",\r\n headers: {\r\n \"Authorization\": `Bearer ${this.apiKey}`,\r\n },\r\n body: formData,\r\n });\r\n }\r\n\r\n // ---- Internal ----\r\n\r\n private requireToken(): void {\r\n if (!this.sessionToken) {\r\n throw new AuthError(\r\n \"No session token set. Call sdk.createSession() first.\",\r\n \"NO_SESSION_TOKEN\"\r\n );\r\n }\r\n }\r\n\r\n private async _fetch<T>(path: string, init: RequestInit, retries = 2): Promise<T> {\r\n const controller = new AbortController();\r\n const timer = setTimeout(() => controller.abort(), this.timeout);\r\n\r\n try {\r\n const response = await fetch(`${this.baseUrl}${path}`, {\r\n ...init,\r\n signal: controller.signal,\r\n });\r\n\r\n const contentType = response.headers.get(\"content-type\") || \"\";\r\n if (!contentType.includes(\"application/json\")) {\r\n throw new SDKError(\r\n `Unexpected response from ${path} (${response.status})`,\r\n response.status\r\n );\r\n }\r\n\r\n // Parse the backend's standard response envelope\r\n const envelope: ApiResponse = await response.json();\r\n\r\n if (!response.ok || envelope.status === \"error\") {\r\n const statusCode = response.status;\r\n\r\n // Map specific HTTP statuses to error types\r\n if (statusCode === 401 || statusCode === 403) {\r\n throw new AuthError(\r\n envelope.message || \"Authentication failed\",\r\n envelope.code\r\n );\r\n }\r\n\r\n throw new SDKError(\r\n envelope.message || `Request to ${path} failed`,\r\n statusCode,\r\n envelope.code,\r\n envelope.data as Record<string, unknown>\r\n );\r\n }\r\n\r\n // Return the full envelope for verify responses (so SDK can check status)\r\n // For other endpoints, return unwrapped data\r\n if (path.includes(\"/verify/\")) {\r\n return envelope as T;\r\n }\r\n return envelope.data as T;\r\n\r\n } catch (err: any) {\r\n if (err instanceof SDKError || err instanceof AuthError) throw err;\r\n\r\n // C5: Retry on network errors (not auth/validation errors)\r\n if (retries > 0 && (err.name === \"AbortError\" || err.name === \"TypeError\")) {\r\n clearTimeout(timer);\r\n await new Promise((r) => setTimeout(r, 1000)); // wait 1s before retry\r\n return this._fetch<T>(path, init, retries - 1);\r\n }\r\n\r\n if (err.name === \"AbortError\") {\r\n throw new NetworkError(\"Request timeout. Please check your connection and try again.\");\r\n }\r\n if (err.name === \"TypeError\" && err.message?.includes(\"fetch\")) {\r\n throw new NetworkError(`Network error: ${err.message}`);\r\n }\r\n\r\n throw new SDKError(\r\n err.message || \"Unknown error\",\r\n 0,\r\n \"UNKNOWN_ERROR\"\r\n );\r\n } finally {\r\n clearTimeout(timer);\r\n }\r\n }\r\n}\r\n", "import { HttpClient } from \"../../client/HttpClient\";\r\nimport {\r\n VerifyIdentityRequest,\r\n VerifyIdentityResponse,\r\n} from \"../../types/onboarding\";\r\n\r\n/**\r\n * Onboarding module \u2014 identity verification.\r\n *\r\n * All methods use session-token auth (x-access-token header).\r\n */\r\nexport class OnboardingModule {\r\n constructor(private http: HttpClient) {}\r\n\r\n /**\r\n * Verify a user's identity.\r\n *\r\n * POST /v1/onboarding/verify/\r\n * Auth: x-access-token: <sessionToken>\r\n *\r\n * Sends identity_type_id (from ChannelItem.id) and dynamic fields\r\n * collected from the user based on the channel's field definitions.\r\n *\r\n * Example:\r\n * { identity_type_id: 3, fields: { \"bank_verification_number\": \"12345678901\" } }\r\n */\r\n async verify(params: VerifyIdentityRequest): Promise<VerifyIdentityResponse> {\r\n return this.http.sessionRequest<VerifyIdentityResponse>(\r\n \"POST\",\r\n \"/v1/onboarding/verify/\",\r\n {\r\n identity_type_id: params.identity_type_id,\r\n fields: params.fields,\r\n }\r\n );\r\n }\r\n}\r\n", "/**\r\n * Collects device / browser context metadata.\r\n * All values are derived from standard browser APIs \u2014 no external library needed.\r\n * Sent to the backend at liveness/create so they appear in the webhook\r\n * request_context block.\r\n */\r\nexport interface DeviceMetadata {\r\n device_type: \"mobile\" | \"desktop\" | \"tablet\";\r\n os_name: string;\r\n browser_timezone: string;\r\n fingerprint_id: string;\r\n}\r\n\r\nfunction detectOs(ua: string): string {\r\n if (/Windows NT/i.test(ua)) return \"Windows\";\r\n if (/Mac OS X|Macintosh/i.test(ua)) return \"macOS\";\r\n if (/Android/i.test(ua)) return \"Android\";\r\n if (/iPhone|iPad|iPod/i.test(ua)) return \"iOS\";\r\n if (/Linux/i.test(ua)) return \"Linux\";\r\n if (/CrOS/i.test(ua)) return \"ChromeOS\";\r\n return \"Unknown\";\r\n}\r\n\r\nfunction getOrCreateFingerprintId(): string {\r\n const KEY = \"_adhere_fid\";\r\n try {\r\n let fid = localStorage.getItem(KEY);\r\n if (!fid) {\r\n fid =\r\n typeof crypto !== \"undefined\" && typeof crypto.randomUUID === \"function\"\r\n ? crypto.randomUUID()\r\n : Math.random().toString(36).slice(2) + Date.now().toString(36);\r\n localStorage.setItem(KEY, fid);\r\n }\r\n return fid;\r\n } catch {\r\n // localStorage unavailable (e.g. private browsing with strict settings)\r\n return Math.random().toString(36).slice(2) + Date.now().toString(36);\r\n }\r\n}\r\n\r\nexport function collectDeviceMetadata(): DeviceMetadata {\r\n const ua = navigator.userAgent;\r\n\r\n const isTablet =\r\n /iPad/i.test(ua) ||\r\n (/Android/i.test(ua) && !/Mobile/i.test(ua));\r\n\r\n const isMobile =\r\n !isTablet &&\r\n /Mobi|Android|iPhone|iPod|BlackBerry|IEMobile|Opera Mini/i.test(ua);\r\n\r\n const device_type: DeviceMetadata[\"device_type\"] = isTablet\r\n ? \"tablet\"\r\n : isMobile\r\n ? \"mobile\"\r\n : \"desktop\";\r\n\r\n return {\r\n device_type,\r\n os_name: detectOs(ua),\r\n browser_timezone: Intl.DateTimeFormat().resolvedOptions().timeZone,\r\n fingerprint_id: getOrCreateFingerprintId(),\r\n };\r\n}\r\n", "export class CameraManager {\r\n private stream: MediaStream | null = null;\r\n\r\n async open(constraints?: MediaStreamConstraints): Promise<MediaStream> {\r\n const defaults: MediaStreamConstraints = {\r\n video: {\r\n facingMode: \"user\",\r\n width: { ideal: 1280 },\r\n height: { ideal: 720 },\r\n },\r\n audio: false,\r\n };\r\n\r\n this.stream = await navigator.mediaDevices.getUserMedia(\r\n constraints || defaults\r\n );\r\n\r\n return this.stream;\r\n }\r\n\r\n getStream(): MediaStream | null {\r\n return this.stream;\r\n }\r\n\r\n stop(): void {\r\n if (this.stream) {\r\n this.stream.getTracks().forEach((track) => track.stop());\r\n this.stream = null;\r\n }\r\n }\r\n}\r\n", "export class VideoRecorder {\r\n private recorder: MediaRecorder | null = null;\r\n private chunks: Blob[] = [];\r\n private startedAt: number = 0;\r\n\r\n start(stream: MediaStream): void {\r\n this.chunks = [];\r\n\r\n const mimeType = MediaRecorder.isTypeSupported(\"video/webm;codecs=vp9\")\r\n ? \"video/webm;codecs=vp9\"\r\n : \"video/webm\";\r\n\r\n this.recorder = new MediaRecorder(stream, {\r\n mimeType,\r\n videoBitsPerSecond: 250_000, // ~1.4 MB for 45s \u2014 keeps file under server upload limit\r\n });\r\n\r\n this.recorder.ondataavailable = (e) => {\r\n if (e.data.size > 0) {\r\n this.chunks.push(e.data);\r\n }\r\n };\r\n\r\n this.startedAt = Date.now();\r\n this.recorder.start();\r\n }\r\n\r\n stop(): Promise<{ blob: Blob; durationSeconds: number }> {\r\n return new Promise((resolve, reject) => {\r\n if (!this.recorder || this.recorder.state === \"inactive\") {\r\n reject(new Error(\"Recorder is not active\"));\r\n return;\r\n }\r\n\r\n const stoppedAt = Date.now();\r\n\r\n this.recorder.onstop = () => {\r\n const blob = new Blob(this.chunks, { type: \"video/webm\" });\r\n const durationSeconds = parseFloat(\r\n ((stoppedAt - this.startedAt) / 1000).toFixed(2)\r\n );\r\n this.chunks = [];\r\n resolve({ blob, durationSeconds });\r\n };\r\n\r\n this.recorder.onerror = () => {\r\n reject(new Error(\"Recording failed\"));\r\n };\r\n\r\n this.recorder.stop();\r\n });\r\n }\r\n\r\n isRecording(): boolean {\r\n return this.recorder?.state === \"recording\";\r\n }\r\n}\r\n", "var t=\"undefined\"!=typeof self?self:{};function e(e,n){t:{for(var r=[\"CLOSURE_FLAGS\"],i=t,s=0;s<r.length;s++)if(null==(i=i[r[s]])){r=null;break t}r=i}return null!=(e=r&&r[e])?e:n}function n(){throw Error(\"Invalid UTF8\")}function r(t,e){return e=String.fromCharCode.apply(null,e),null==t?e:t+e}let i,s;const o=\"undefined\"!=typeof TextDecoder;let a;const c=\"undefined\"!=typeof TextEncoder;function h(t){if(c)t=(a||=new TextEncoder).encode(t);else{let n=0;const r=new Uint8Array(3*t.length);for(let i=0;i<t.length;i++){var e=t.charCodeAt(i);if(e<128)r[n++]=e;else{if(e<2048)r[n++]=e>>6|192;else{if(e>=55296&&e<=57343){if(e<=56319&&i<t.length){const s=t.charCodeAt(++i);if(s>=56320&&s<=57343){e=1024*(e-55296)+s-56320+65536,r[n++]=e>>18|240,r[n++]=e>>12&63|128,r[n++]=e>>6&63|128,r[n++]=63&e|128;continue}i--}e=65533}r[n++]=e>>12|224,r[n++]=e>>6&63|128}r[n++]=63&e|128}}t=n===r.length?r:r.subarray(0,n)}return t}function u(e){t.setTimeout((()=>{throw e}),0)}var l,f=e(610401301,!1),d=e(748402147,!0),p=e(824648567,!0),g=e(824656860,e(1,!0));function m(){var e=t.navigator;return e&&(e=e.userAgent)?e:\"\"}const y=t.navigator;function _(t){return _[\" \"](t),t}l=y&&y.userAgentData||null,_[\" \"]=function(){};const v={};let E=null;function w(t){const e=t.length;let n=3*e/4;n%3?n=Math.floor(n):-1!=\"=.\".indexOf(t[e-1])&&(n=-1!=\"=.\".indexOf(t[e-2])?n-2:n-1);const r=new Uint8Array(n);let i=0;return function(t,e){function n(e){for(;r<t.length;){const e=t.charAt(r++),n=E[e];if(null!=n)return n;if(!/^[\\s\\xa0]*$/.test(e))throw Error(\"Unknown base64 encoding at char: \"+e)}return e}T();let r=0;for(;;){const t=n(-1),r=n(0),i=n(64),s=n(64);if(64===s&&-1===t)break;e(t<<2|r>>4),64!=i&&(e(r<<4&240|i>>2),64!=s&&e(i<<6&192|s))}}(t,(function(t){r[i++]=t})),i!==n?r.subarray(0,i):r}function T(){if(!E){E={};var t=\"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789\".split(\"\"),e=[\"+/=\",\"+/\",\"-_=\",\"-_.\",\"-_\"];for(let n=0;n<5;n++){const r=t.concat(e[n].split(\"\"));v[n]=r;for(let t=0;t<r.length;t++){const e=r[t];void 0===E[e]&&(E[e]=t)}}}}var A=\"undefined\"!=typeof Uint8Array,b=!(!(f&&l&&l.brands.length>0)&&(-1!=m().indexOf(\"Trident\")||-1!=m().indexOf(\"MSIE\")))&&\"function\"==typeof btoa;const k=/[-_.]/g,S={\"-\":\"+\",_:\"/\",\".\":\"=\"};function x(t){return S[t]||\"\"}function L(t){if(!b)return w(t);t=k.test(t)?t.replace(k,x):t,t=atob(t);const e=new Uint8Array(t.length);for(let n=0;n<t.length;n++)e[n]=t.charCodeAt(n);return e}function R(t){return A&&null!=t&&t instanceof Uint8Array}var I={};function F(){return C||=new P(null,I)}function M(t){N(I);var e=t.g;return null==(e=null==e||R(e)?e:\"string\"==typeof e?L(e):null)?e:t.g=e}var P=class{h(){return new Uint8Array(M(this)||0)}constructor(t,e){if(N(e),this.g=t,null!=t&&0===t.length)throw Error(\"ByteString should be constructed with non-empty values\")}};let C,O;function N(t){if(t!==I)throw Error(\"illegal external caller\")}function U(t,e){t.__closure__error__context__984382||(t.__closure__error__context__984382={}),t.__closure__error__context__984382.severity=e}function D(t){return U(t=Error(t),\"warning\"),t}function B(t,e){if(null!=t){var n=O??={},r=n[t]||0;r>=e||(n[t]=r+1,U(t=Error(),\"incident\"),u(t))}}function G(){return\"function\"==typeof BigInt}var j=\"function\"==typeof Symbol&&\"symbol\"==typeof Symbol();function V(t,e,n=!1){return\"function\"==typeof Symbol&&\"symbol\"==typeof Symbol()?n&&Symbol.for&&t?Symbol.for(t):null!=t?Symbol(t):Symbol():e}var X=V(\"jas\",void 0,!0),H=V(void 0,\"0di\"),W=V(void 0,\"1oa\"),z=V(void 0,Symbol()),K=V(void 0,\"0ub\"),Y=V(void 0,\"0ubs\"),q=V(void 0,\"0ubsb\"),$=V(void 0,\"0actk\"),J=V(\"m_m\",\"Pa\",!0),Z=V();const Q={Ga:{value:0,configurable:!0,writable:!0,enumerable:!1}},tt=Object.defineProperties,et=j?X:\"Ga\";var nt;const rt=[];function it(t,e){j||et in t||tt(t,Q),t[et]|=e}function st(t,e){j||et in t||tt(t,Q),t[et]=e}function ot(t){return it(t,34),t}function at(t){return it(t,8192),t}st(rt,7),nt=Object.freeze(rt);var ct={};function ht(t,e){return void 0===e?t.h!==ut&&!!(2&(0|t.v[et])):!!(2&e)&&t.h!==ut}const ut={};function lt(t,e){if(null!=t)if(\"string\"==typeof t)t=t?new P(t,I):F();else if(t.constructor!==P)if(R(t))t=t.length?new P(new Uint8Array(t),I):F();else{if(!e)throw Error();t=void 0}return t}class ft{constructor(t,e,n){this.g=t,this.h=e,this.l=n}next(){const t=this.g.next();return t.done||(t.value=this.h.call(this.l,t.value)),t}[Symbol.iterator](){return this}}var dt=Object.freeze({});function pt(t,e,n){const r=128&e?0:-1,i=t.length;var s;(s=!!i)&&(s=null!=(s=t[i-1])&&\"object\"==typeof s&&s.constructor===Object);const o=i+(s?-1:0);for(e=128&e?1:0;e<o;e++)n(e-r,t[e]);if(s){t=t[i-1];for(const e in t)!isNaN(e)&&n(+e,t[e])}}var gt={};function mt(t){return 128&t?gt:void 0}function yt(t){return t.Na=!0,t}var _t=yt((t=>\"number\"==typeof t)),vt=yt((t=>\"string\"==typeof t)),Et=yt((t=>\"boolean\"==typeof t)),wt=\"function\"==typeof t.BigInt&&\"bigint\"==typeof t.BigInt(0);function Tt(t){var e=t;if(vt(e)){if(!/^\\s*(?:-?[1-9]\\d*|0)?\\s*$/.test(e))throw Error(String(e))}else if(_t(e)&&!Number.isSafeInteger(e))throw Error(String(e));return wt?BigInt(t):t=Et(t)?t?\"1\":\"0\":vt(t)?t.trim()||\"0\":String(t)}var At=yt((t=>wt?t>=kt&&t<=xt:\"-\"===t[0]?Lt(t,bt):Lt(t,St)));const bt=Number.MIN_SAFE_INTEGER.toString(),kt=wt?BigInt(Number.MIN_SAFE_INTEGER):void 0,St=Number.MAX_SAFE_INTEGER.toString(),xt=wt?BigInt(Number.MAX_SAFE_INTEGER):void 0;function Lt(t,e){if(t.length>e.length)return!1;if(t.length<e.length||t===e)return!0;for(let n=0;n<t.length;n++){const r=t[n],i=e[n];if(r>i)return!1;if(r<i)return!0}}const Rt=\"function\"==typeof Uint8Array.prototype.slice;let It,Ft=0,Mt=0;function Pt(t){const e=t>>>0;Ft=e,Mt=(t-e)/4294967296>>>0}function Ct(t){if(t<0){Pt(-t);const[e,n]=Ht(Ft,Mt);Ft=e>>>0,Mt=n>>>0}else Pt(t)}function Ot(t){const e=It||=new DataView(new ArrayBuffer(8));e.setFloat32(0,+t,!0),Mt=0,Ft=e.getUint32(0,!0)}function Nt(t,e){const n=4294967296*e+(t>>>0);return Number.isSafeInteger(n)?n:Gt(t,e)}function Ut(t,e){return Tt(G()?BigInt.asUintN(64,(BigInt(e>>>0)<<BigInt(32))+BigInt(t>>>0)):Gt(t,e))}function Dt(t,e){const n=2147483648&e;return n&&(e=~e>>>0,0==(t=1+~t>>>0)&&(e=e+1>>>0)),\"number\"==typeof(t=Nt(t,e))?n?-t:t:n?\"-\"+t:t}function Bt(t,e){return G()?Tt(BigInt.asIntN(64,(BigInt.asUintN(32,BigInt(e))<<BigInt(32))+BigInt.asUintN(32,BigInt(t)))):Tt(Vt(t,e))}function Gt(t,e){if(t>>>=0,(e>>>=0)<=2097151)var n=\"\"+(4294967296*e+t);else G()?n=\"\"+(BigInt(e)<<BigInt(32)|BigInt(t)):(t=(16777215&t)+6777216*(n=16777215&(t>>>24|e<<8))+6710656*(e=e>>16&65535),n+=8147497*e,e*=2,t>=1e7&&(n+=t/1e7>>>0,t%=1e7),n>=1e7&&(e+=n/1e7>>>0,n%=1e7),n=e+jt(n)+jt(t));return n}function jt(t){return t=String(t),\"0000000\".slice(t.length)+t}function Vt(t,e){if(2147483648&e)if(G())t=\"\"+(BigInt(0|e)<<BigInt(32)|BigInt(t>>>0));else{const[n,r]=Ht(t,e);t=\"-\"+Gt(n,r)}else t=Gt(t,e);return t}function Xt(t){if(t.length<16)Ct(Number(t));else if(G())t=BigInt(t),Ft=Number(t&BigInt(4294967295))>>>0,Mt=Number(t>>BigInt(32)&BigInt(4294967295));else{const e=+(\"-\"===t[0]);Mt=Ft=0;const n=t.length;for(let r=e,i=(n-e)%6+e;i<=n;r=i,i+=6){const e=Number(t.slice(r,i));Mt*=1e6,Ft=1e6*Ft+e,Ft>=4294967296&&(Mt+=Math.trunc(Ft/4294967296),Mt>>>=0,Ft>>>=0)}if(e){const[t,e]=Ht(Ft,Mt);Ft=t,Mt=e}}}function Ht(t,e){return e=~e,t?t=1+~t:e+=1,[t,e]}function Wt(t){return Array.prototype.slice.call(t)}const zt=\"function\"==typeof BigInt?BigInt.asIntN:void 0,Kt=\"function\"==typeof BigInt?BigInt.asUintN:void 0,Yt=Number.isSafeInteger,qt=Number.isFinite,$t=Math.trunc,Jt=Tt(0);function Zt(t){if(null!=t&&\"number\"!=typeof t)throw Error(`Value of float/double field must be a number, found ${typeof t}: ${t}`);return t}function Qt(t){return null==t||\"number\"==typeof t?t:\"NaN\"===t||\"Infinity\"===t||\"-Infinity\"===t?Number(t):void 0}function te(t){if(null!=t&&\"boolean\"!=typeof t){var e=typeof t;throw Error(`Expected boolean but got ${\"object\"!=e?e:t?Array.isArray(t)?\"array\":e:\"null\"}: ${t}`)}return t}function ee(t){return null==t||\"boolean\"==typeof t?t:\"number\"==typeof t?!!t:void 0}const ne=/^-?([1-9][0-9]*|0)(\\.[0-9]+)?$/;function re(t){switch(typeof t){case\"bigint\":return!0;case\"number\":return qt(t);case\"string\":return ne.test(t);default:return!1}}function ie(t){if(null==t)return t;if(\"string\"==typeof t&&t)t=+t;else if(\"number\"!=typeof t)return;return qt(t)?0|t:void 0}function se(t){if(null==t)return t;if(\"string\"==typeof t&&t)t=+t;else if(\"number\"!=typeof t)return;return qt(t)?t>>>0:void 0}function oe(t){const e=t.length;return(\"-\"===t[0]?e<20||20===e&&t<=\"-9223372036854775808\":e<19||19===e&&t<=\"9223372036854775807\")?t:(Xt(t),Vt(Ft,Mt))}function ae(t){return t=$t(t),Yt(t)||(Ct(t),t=Dt(Ft,Mt)),t}function ce(t){var e=$t(Number(t));return Yt(e)?String(e):(-1!==(e=t.indexOf(\".\"))&&(t=t.substring(0,e)),oe(t))}function he(t){var e=$t(Number(t));return Yt(e)?Tt(e):(-1!==(e=t.indexOf(\".\"))&&(t=t.substring(0,e)),G()?Tt(zt(64,BigInt(t))):Tt(oe(t)))}function ue(t){return Yt(t)?t=Tt(ae(t)):(t=$t(t),Yt(t)?t=String(t):(Ct(t),t=Vt(Ft,Mt)),t=Tt(t)),t}function le(t){return null==t?t:\"bigint\"==typeof t?(At(t)?t=Number(t):(t=zt(64,t),t=At(t)?Number(t):String(t)),t):re(t)?\"number\"==typeof t?ae(t):ce(t):void 0}function fe(t){const e=typeof t;return null==t?t:\"bigint\"===e?Tt(zt(64,t)):re(t)?\"string\"===e?he(t):ue(t):void 0}function de(t){if(\"string\"!=typeof t)throw Error();return t}function pe(t){if(null!=t&&\"string\"!=typeof t)throw Error();return t}function ge(t){return null==t||\"string\"==typeof t?t:void 0}function me(t,e,n,r){return null!=t&&t[J]===ct?t:Array.isArray(t)?((r=(n=0|t[et])|32&r|2&r)!==n&&st(t,r),new e(t)):(n?2&r?((t=e[H])||(ot((t=new e).v),t=e[H]=t),e=t):e=new e:e=void 0,e)}function ye(t,e,n){if(e)t:{if(!re(e=t))throw D(\"int64\");switch(typeof e){case\"string\":e=he(e);break t;case\"bigint\":e=Tt(zt(64,e));break t;default:e=ue(e)}}else e=fe(t);return null==(t=e)?n?Jt:void 0:t}const _e={};let ve=function(){try{return _(new class extends Map{constructor(){super()}}),!1}catch{return!0}}();class Ee{constructor(){this.g=new Map}get(t){return this.g.get(t)}set(t,e){return this.g.set(t,e),this.size=this.g.size,this}delete(t){return t=this.g.delete(t),this.size=this.g.size,t}clear(){this.g.clear(),this.size=this.g.size}has(t){return this.g.has(t)}entries(){return this.g.entries()}keys(){return this.g.keys()}values(){return this.g.values()}forEach(t,e){return this.g.forEach(t,e)}[Symbol.iterator](){return this.entries()}}const we=ve?(Object.setPrototypeOf(Ee.prototype,Map.prototype),Object.defineProperties(Ee.prototype,{size:{value:0,configurable:!0,enumerable:!0,writable:!0}}),Ee):class extends Map{constructor(){super()}};function Te(t){return t}function Ae(t){if(2&t.J)throw Error(\"Cannot mutate an immutable Map\")}var be=class extends we{constructor(t,e,n=Te,r=Te){super(),this.J=0|t[et],this.K=e,this.S=n,this.fa=this.K?ke:r;for(let i=0;i<t.length;i++){const s=t[i],o=n(s[0],!1,!0);let a=s[1];e?void 0===a&&(a=null):a=r(s[1],!1,!0,void 0,void 0,this.J),super.set(o,a)}}V(t){return at(Array.from(super.entries(),t))}clear(){Ae(this),super.clear()}delete(t){return Ae(this),super.delete(this.S(t,!0,!1))}entries(){if(this.K){var t=super.keys();t=new ft(t,Se,this)}else t=super.entries();return t}values(){if(this.K){var t=super.keys();t=new ft(t,be.prototype.get,this)}else t=super.values();return t}forEach(t,e){this.K?super.forEach(((n,r,i)=>{t.call(e,i.get(r),r,i)})):super.forEach(t,e)}set(t,e){return Ae(this),null==(t=this.S(t,!0,!1))?this:null==e?(super.delete(t),this):super.set(t,this.fa(e,!0,!0,this.K,!1,this.J))}Ma(t){const e=this.S(t[0],!1,!0);t=t[1],t=this.K?void 0===t?null:t:this.fa(t,!1,!0,void 0,!1,this.J),super.set(e,t)}has(t){return super.has(this.S(t,!1,!1))}get(t){t=this.S(t,!1,!1);const e=super.get(t);if(void 0!==e){var n=this.K;return n?((n=this.fa(e,!1,!0,n,this.ra,this.J))!==e&&super.set(t,n),n):e}}[Symbol.iterator](){return this.entries()}};function ke(t,e,n,r,i,s){return t=me(t,r,n,s),i&&(t=Ke(t)),t}function Se(t){return[t,this.get(t)]}let xe;function Le(){return xe||=new be(ot([]),void 0,void 0,void 0,_e)}function Re(t){return z?t[z]:void 0}function Ie(t,e){for(const n in t)!isNaN(n)&&e(t,+n,t[n])}be.prototype.toJSON=void 0;var Fe=class{};const Me={Ka:!0};function Pe(t,e){e<100||B(Y,1)}function Ce(t,e,n,r){const i=void 0!==r;r=!!r;var s,o=z;!i&&j&&o&&(s=t[o])&&Ie(s,Pe),o=[];var a=t.length;let c;s=4294967295;let h=!1;const u=!!(64&e),l=u?128&e?0:-1:void 0;1&e||(c=a&&t[a-1],null!=c&&\"object\"==typeof c&&c.constructor===Object?s=--a:c=void 0,!u||128&e||i||(h=!0,s=s-l+l)),e=void 0;for(var f=0;f<a;f++){let i=t[f];if(null!=i&&null!=(i=n(i,r)))if(u&&f>=s){const t=f-l;(e??={})[t]=i}else o[f]=i}if(c)for(let t in c){if(null==(a=c[t])||null==(a=n(a,r)))continue;let i;f=+t,u&&!Number.isNaN(f)&&(i=f+l)<s?o[i]=a:(e??={})[t]=a}return e&&(h?o.push(e):o[s]=e),i&&z&&(t=Re(t))&&t instanceof Fe&&(o[z]=function(t){const e=new Fe;return Ie(t,((t,n,r)=>{e[n]=Wt(r)})),e.da=t.da,e}(t)),o}function Oe(t){return t[0]=Ne(t[0]),t[1]=Ne(t[1]),t}function Ne(t){switch(typeof t){case\"number\":return Number.isFinite(t)?t:\"\"+t;case\"bigint\":return At(t)?Number(t):\"\"+t;case\"boolean\":return t?1:0;case\"object\":if(Array.isArray(t)){var e=0|t[et];return 0===t.length&&1&e?void 0:Ce(t,e,Ne)}if(null!=t&&t[J]===ct)return Ue(t);if(t instanceof P){if(null==(e=t.g))t=\"\";else if(\"string\"==typeof e)t=e;else{if(b){for(var n=\"\",r=0,i=e.length-10240;r<i;)n+=String.fromCharCode.apply(null,e.subarray(r,r+=10240));n+=String.fromCharCode.apply(null,r?e.subarray(r):e),e=btoa(n)}else{void 0===n&&(n=0),T(),n=v[n],r=Array(Math.floor(e.length/3)),i=n[64]||\"\";let t=0,h=0;for(;t<e.length-2;t+=3){var s=e[t],o=e[t+1],a=e[t+2],c=n[s>>2];s=n[(3&s)<<4|o>>4],o=n[(15&o)<<2|a>>6],a=n[63&a],r[h++]=c+s+o+a}switch(c=0,a=i,e.length-t){case 2:a=n[(15&(c=e[t+1]))<<2]||i;case 1:e=e[t],r[h]=n[e>>2]+n[(3&e)<<4|c>>4]+a+i}e=r.join(\"\")}t=t.g=e}return t}return t instanceof be?t=0!==t.size?t.V(Oe):void 0:void 0}return t}function Ue(t){return Ce(t=t.v,0|t[et],Ne)}let De,Be;function Ge(t,e){return je(t,e[0],e[1])}function je(t,e,n,r=0){if(null==t){var i=32;n?(t=[n],i|=128):t=[],e&&(i=-16760833&i|(1023&e)<<14)}else{if(!Array.isArray(t))throw Error(\"narr\");if(i=0|t[et],d&&1&i)throw Error(\"rfarr\");if(2048&i&&!(2&i)&&function(){if(d)throw Error(\"carr\");B($,5)}(),256&i)throw Error(\"farr\");if(64&i)return(i|r)!==i&&st(t,i|r),t;if(n&&(i|=128,n!==t[0]))throw Error(\"mid\");t:{i|=64;var s=(n=t).length;if(s){var o=s-1;const t=n[o];if(null!=t&&\"object\"==typeof t&&t.constructor===Object){if((o-=e=128&i?0:-1)>=1024)throw Error(\"pvtlmt\");for(var a in t)(s=+a)<o&&(n[s+e]=t[a],delete t[a]);i=-16760833&i|(1023&o)<<14;break t}}if(e){if((a=Math.max(e,s-(128&i?0:-1)))>1024)throw Error(\"spvt\");i=-16760833&i|(1023&a)<<14}}}return st(t,64|i|r),t}function Ve(t,e){if(\"object\"!=typeof t)return t;if(Array.isArray(t)){var n=0|t[et];return 0===t.length&&1&n?void 0:Xe(t,n,e)}if(null!=t&&t[J]===ct)return We(t);if(t instanceof be){if(2&(e=t.J))return t;if(!t.size)return;if(n=ot(t.V()),t.K)for(t=0;t<n.length;t++){const r=n[t];let i=r[1];i=null==i||\"object\"!=typeof i?void 0:null!=i&&i[J]===ct?We(i):Array.isArray(i)?Xe(i,0|i[et],!!(32&e)):void 0,r[1]=i}return n}return t instanceof P?t:void 0}function Xe(t,e,n){return 2&e||(!n||4096&e||16&e?t=ze(t,e,!1,n&&!(16&e)):(it(t,34),4&e&&Object.freeze(t))),t}function He(t,e,n){return t=new t.constructor(e),n&&(t.h=ut),t.m=ut,t}function We(t){const e=t.v,n=0|e[et];return ht(t,n)?t:Je(t,e,n)?He(t,e):ze(e,n)}function ze(t,e,n,r){return r??=!!(34&e),t=Ce(t,e,Ve,r),r=32,n&&(r|=2),st(t,e=16769217&e|r),t}function Ke(t){const e=t.v,n=0|e[et];return ht(t,n)?Je(t,e,n)?He(t,e,!0):new t.constructor(ze(e,n,!1)):t}function Ye(t){if(t.h!==ut)return!1;var e=t.v;return it(e=ze(e,0|e[et]),2048),t.v=e,t.h=void 0,t.m=void 0,!0}function qe(t){if(!Ye(t)&&ht(t,0|t.v[et]))throw Error()}function $e(t,e){void 0===e&&(e=0|t[et]),32&e&&!(4096&e)&&st(t,4096|e)}function Je(t,e,n){return!!(2&n)||!(!(32&n)||4096&n)&&(st(e,2|n),t.h=ut,!0)}const Ze=Tt(0),Qe={};function tn(t,e,n,r,i){if(null!==(e=en(t.v,e,n,i))||r&&t.m!==ut)return e}function en(t,e,n,r){if(-1===e)return null;const i=e+(n?0:-1),s=t.length-1;let o,a;if(!(s<1+(n?0:-1))){if(i>=s)if(o=t[s],null!=o&&\"object\"==typeof o&&o.constructor===Object)n=o[e],a=!0;else{if(i!==s)return;n=o}else n=t[i];if(r&&null!=n){if(null==(r=r(n)))return r;if(!Object.is(r,n))return a?o[e]=r:t[i]=r,r}return n}}function nn(t,e,n,r){qe(t),rn(t=t.v,0|t[et],e,n,r)}function rn(t,e,n,r,i){const s=n+(i?0:-1);var o=t.length-1;if(o>=1+(i?0:-1)&&s>=o){const i=t[o];if(null!=i&&\"object\"==typeof i&&i.constructor===Object)return i[n]=r,e}return s<=o?(t[s]=r,e):(void 0!==r&&(n>=(o=(e??=0|t[et])>>14&1023||536870912)?null!=r&&(t[o+(i?0:-1)]={[n]:r}):t[s]=r),e)}function sn(){return void 0===dt?2:4}function on(t,e,n,r,i){let s=t.v,o=0|s[et];r=ht(t,o)?1:r,i=!!i||3===r,2===r&&Ye(t)&&(s=t.v,o=0|s[et]);let a=(t=cn(s,e))===nt?7:0|t[et],c=hn(a,o);var h=!(4&c);if(h){4&c&&(t=Wt(t),a=0,c=xn(c,o),o=rn(s,o,e,t));let r=0,i=0;for(;r<t.length;r++){const e=n(t[r]);null!=e&&(t[i++]=e)}i<r&&(t.length=i),n=-513&(4|c),c=n&=-1025,c&=-4097}return c!==a&&(st(t,c),2&c&&Object.freeze(t)),an(t,c,s,o,e,r,h,i)}function an(t,e,n,r,i,s,o,a){let c=e;return 1===s||4===s&&(2&e||!(16&e)&&32&r)?un(e)||((e|=!t.length||o&&!(4096&e)||32&r&&!(4096&e||16&e)?2:256)!==c&&st(t,e),Object.freeze(t)):(2===s&&un(e)&&(t=Wt(t),c=0,e=xn(e,r),r=rn(n,r,i,t)),un(e)||(a||(e|=16),e!==c&&st(t,e))),2&e||!(4096&e||16&e)||$e(n,r),t}function cn(t,e,n){return t=en(t,e,n),Array.isArray(t)?t:nt}function hn(t,e){return 2&e&&(t|=2),1|t}function un(t){return!!(2&t)&&!!(4&t)||!!(256&t)}function ln(t){return lt(t,!0)}function fn(t){t=Wt(t);for(let e=0;e<t.length;e++){const n=t[e]=Wt(t[e]);Array.isArray(n[1])&&(n[1]=ot(n[1]))}return at(t)}function dn(t,e,n,r){qe(t),rn(t=t.v,0|t[et],e,(\"0\"===r?0===Number(n):n===r)?void 0:n)}function pn(t,e,n){if(2&e)throw Error();const r=mt(e);let i=cn(t,n,r),s=i===nt?7:0|i[et],o=hn(s,e);return(2&o||un(o)||16&o)&&(o===s||un(o)||st(i,o),i=Wt(i),s=0,o=xn(o,e),rn(t,e,n,i,r)),o&=-13,o!==s&&st(i,o),i}function gn(t,e){var n=Ds;return _n(mn(t=t.v),t,void 0,n)===e?e:-1}function mn(t){if(j)return t[W]??(t[W]=new Map);if(W in t)return t[W];const e=new Map;return Object.defineProperty(t,W,{value:e}),e}function yn(t,e,n,r,i){const s=mn(t),o=_n(s,t,e,n,i);return o!==r&&(o&&(e=rn(t,e,o,void 0,i)),s.set(n,r)),e}function _n(t,e,n,r,i){let s=t.get(r);if(null!=s)return s;s=0;for(let t=0;t<r.length;t++){const o=r[t];null!=en(e,o,i)&&(0!==s&&(n=rn(e,n,s,void 0,i)),s=o)}return t.set(r,s),s}function vn(t,e,n){let r=0|t[et];const i=mt(r),s=en(t,n,i);let o;if(null!=s&&s[J]===ct){if(!ht(s))return Ye(s),s.v;o=s.v}else Array.isArray(s)&&(o=s);if(o){const t=0|o[et];2&t&&(o=ze(o,t))}return o=Ge(o,e),o!==s&&rn(t,r,n,o,i),o}function En(t,e,n,r,i){let s=!1;if(null!=(r=en(t,r,i,(t=>{const r=me(t,n,!1,e);return s=r!==t&&null!=r,r}))))return s&&!ht(r)&&$e(t,e),r}function wn(t,e,n,r){let i=t.v,s=0|i[et];if(null==(e=En(i,s,e,n,r)))return e;if(s=0|i[et],!ht(t,s)){const o=Ke(e);o!==e&&(Ye(t)&&(i=t.v,s=0|i[et]),s=rn(i,s,n,e=o,r),$e(i,s))}return e}function Tn(t,e,n,r,i,s,o,a){var c=ht(t,n);s=c?1:s,o=!!o||3===s,c=a&&!c,(2===s||c)&&Ye(t)&&(n=0|(e=t.v)[et]);var h=(t=cn(e,i))===nt?7:0|t[et],u=hn(h,n);if(a=!(4&u)){var l=t,f=n;const e=!!(2&u);e&&(f|=2);let i=!e,s=!0,o=0,a=0;for(;o<l.length;o++){const t=me(l[o],r,!1,f);if(t instanceof r){if(!e){const e=ht(t);i&&=!e,s&&=e}l[a++]=t}}a<o&&(l.length=a),u|=4,u=s?-4097&u:4096|u,u=i?8|u:-9&u}if(u!==h&&(st(t,u),2&u&&Object.freeze(t)),c&&!(8&u||!t.length&&(1===s||4===s&&(2&u||!(16&u)&&32&n)))){for(un(u)&&(t=Wt(t),u=xn(u,n),n=rn(e,n,i,t)),r=t,c=u,h=0;h<r.length;h++)(l=r[h])!==(u=Ke(l))&&(r[h]=u);c|=8,st(t,u=c=r.length?4096|c:-4097&c)}return an(t,u,e,n,i,s,a,o)}function An(t,e,n){const r=t.v;return Tn(t,r,0|r[et],e,n,sn(),!1,!0)}function bn(t){return null==t&&(t=void 0),t}function kn(t,e,n,r,i){return nn(t,n,r=bn(r),i),r&&!ht(r)&&$e(t.v),t}function Sn(t,e,n,r){t:{var i=r=bn(r);qe(t);const s=t.v;let o=0|s[et];if(null==i){const t=mn(s);if(_n(t,s,o,n)!==e)break t;t.set(n,0)}else o=yn(s,o,n,e);rn(s,o,e,i)}r&&!ht(r)&&$e(t.v)}function xn(t,e){return-273&(2&e?2|t:-3&t)}function Ln(t,e,n,r){var i=r;qe(t),t=Tn(t,r=t.v,0|r[et],n,e,2,!0),i=null!=i?i:new n,t.push(i),e=n=t===nt?7:0|t[et],(i=ht(i))?(n&=-9,1===t.length&&(n&=-4097)):n|=4096,n!==e&&st(t,n),i||$e(r)}function Rn(t,e,n){return ie(tn(t,e,void 0,n))}function In(t){return(g?tn(t,2,void 0,void 0,fe):fe(tn(t,2)))??Ze}function Fn(t,e){return tn(t,e,void 0,void 0,Qt)??0}function Mn(t,e,n){if(null!=n){if(\"number\"!=typeof n)throw D(\"int32\");if(!qt(n))throw D(\"int32\");n|=0}nn(t,e,n)}function Pn(t,e,n){nn(t,e,Zt(n))}function Cn(t,e,n){dn(t,e,pe(n),\"\")}function On(t,e,n){{qe(t);const o=t.v;let a=0|o[et];if(null==n)rn(o,a,e);else{var r=t=n===nt?7:0|n[et],i=un(t),s=i||Object.isFrozen(n);for(i||(t=0),s||(n=Wt(n),r=0,t=xn(t,a),s=!1),t|=5,t|=(4&t?512&t?512:1024&t?1024:0:void 0)??(g?1024:0),i=0;i<n.length;i++){const e=n[i],o=de(e);Object.is(e,o)||(s&&(n=Wt(n),r=0,t=xn(t,a),s=!1),n[i]=o)}t!==r&&(s&&(n=Wt(n),t=xn(t,a)),st(n,t)),rn(o,a,e,n)}}}function Nn(t,e,n){qe(t),on(t,e,ge,2,!0).push(de(n))}var Un=class{constructor(t,e,n){if(this.buffer=t,n&&!e)throw Error();this.g=e}};function Dn(t,e){if(\"string\"==typeof t)return new Un(L(t),e);if(Array.isArray(t))return new Un(new Uint8Array(t),e);if(t.constructor===Uint8Array)return new Un(t,!1);if(t.constructor===ArrayBuffer)return t=new Uint8Array(t),new Un(t,!1);if(t.constructor===P)return e=M(t)||new Uint8Array(0),new Un(e,!0,t);if(t instanceof Uint8Array)return t=t.constructor===Uint8Array?t:new Uint8Array(t.buffer,t.byteOffset,t.byteLength),new Un(t,!1);throw Error()}function Bn(t,e){let n,r=0,i=0,s=0;const o=t.h;let a=t.g;do{n=o[a++],r|=(127&n)<<s,s+=7}while(s<32&&128&n);if(s>32)for(i|=(127&n)>>4,s=3;s<32&&128&n;s+=7)n=o[a++],i|=(127&n)<<s;if(Wn(t,a),!(128&n))return e(r>>>0,i>>>0);throw Error()}function Gn(t){let e=0,n=t.g;const r=n+10,i=t.h;for(;n<r;){const r=i[n++];if(e|=r,0==(128&r))return Wn(t,n),!!(127&e)}throw Error()}function jn(t){const e=t.h;let n=t.g,r=e[n++],i=127&r;if(128&r&&(r=e[n++],i|=(127&r)<<7,128&r&&(r=e[n++],i|=(127&r)<<14,128&r&&(r=e[n++],i|=(127&r)<<21,128&r&&(r=e[n++],i|=r<<28,128&r&&128&e[n++]&&128&e[n++]&&128&e[n++]&&128&e[n++]&&128&e[n++])))))throw Error();return Wn(t,n),i}function Vn(t){return jn(t)>>>0}function Xn(t){var e=t.h;const n=t.g;var r=e[n],i=e[n+1];const s=e[n+2];return e=e[n+3],Wn(t,t.g+4),t=2*((i=(r<<0|i<<8|s<<16|e<<24)>>>0)>>31)+1,r=i>>>23&255,i&=8388607,255==r?i?NaN:t*(1/0):0==r?1401298464324817e-60*t*i:t*Math.pow(2,r-150)*(i+8388608)}function Hn(t){return jn(t)}function Wn(t,e){if(t.g=e,e>t.l)throw Error()}function zn(t,e){if(e<0)throw Error();const n=t.g;if((e=n+e)>t.l)throw Error();return t.g=e,n}function Kn(t,e){if(0==e)return F();var n=zn(t,e);return t.Y&&t.j?n=t.h.subarray(n,n+e):(t=t.h,n=n===(e=n+e)?new Uint8Array(0):Rt?t.slice(n,e):new Uint8Array(t.subarray(n,e))),0==n.length?F():new P(n,I)}var Yn=[];function qn(t,e,n,r){if(ir.length){const i=ir.pop();return i.o(r),i.g.init(t,e,n,r),i}return new rr(t,e,n,r)}function $n(t){t.g.clear(),t.l=-1,t.h=-1,ir.length<100&&ir.push(t)}function Jn(t){var e=t.g;if(e.g==e.l)return!1;t.m=t.g.g;var n=Vn(t.g);if(e=n>>>3,!((n&=7)>=0&&n<=5))throw Error();if(e<1)throw Error();return t.l=e,t.h=n,!0}function Zn(t){switch(t.h){case 0:0!=t.h?Zn(t):Gn(t.g);break;case 1:Wn(t=t.g,t.g+8);break;case 2:if(2!=t.h)Zn(t);else{var e=Vn(t.g);Wn(t=t.g,t.g+e)}break;case 5:Wn(t=t.g,t.g+4);break;case 3:for(e=t.l;;){if(!Jn(t))throw Error();if(4==t.h){if(t.l!=e)throw Error();break}Zn(t)}break;default:throw Error()}}function Qn(t,e,n){const r=t.g.l;var i=Vn(t.g);let s=(i=t.g.g+i)-r;if(s<=0&&(t.g.l=i,n(e,t,void 0,void 0,void 0),s=i-t.g.g),s)throw Error();return t.g.g=i,t.g.l=r,e}function tr(t){var e=Vn(t.g),a=zn(t=t.g,e);if(t=t.h,o){var c,h=t;(c=s)||(c=s=new TextDecoder(\"utf-8\",{fatal:!0})),e=a+e,h=0===a&&e===h.length?h:h.subarray(a,e);try{var u=c.decode(h)}catch(t){if(void 0===i){try{c.decode(new Uint8Array([128]))}catch(t){}try{c.decode(new Uint8Array([97])),i=!0}catch(t){i=!1}}throw!i&&(s=void 0),t}}else{e=(u=a)+e,a=[];let i,s=null;for(;u<e;){var l=t[u++];l<128?a.push(l):l<224?u>=e?n():(i=t[u++],l<194||128!=(192&i)?(u--,n()):a.push((31&l)<<6|63&i)):l<240?u>=e-1?n():(i=t[u++],128!=(192&i)||224===l&&i<160||237===l&&i>=160||128!=(192&(c=t[u++]))?(u--,n()):a.push((15&l)<<12|(63&i)<<6|63&c)):l<=244?u>=e-2?n():(i=t[u++],128!=(192&i)||i-144+(l<<28)>>30!=0||128!=(192&(c=t[u++]))||128!=(192&(h=t[u++]))?(u--,n()):(l=(7&l)<<18|(63&i)<<12|(63&c)<<6|63&h,l-=65536,a.push(55296+(l>>10&1023),56320+(1023&l)))):n(),a.length>=8192&&(s=r(s,a),a.length=0)}u=r(s,a)}return u}function er(t){const e=Vn(t.g);return Kn(t.g,e)}function nr(t,e,n){var r=Vn(t.g);for(r=t.g.g+r;t.g.g<r;)n.push(e(t.g))}var rr=class{constructor(t,e,n,r){if(Yn.length){const i=Yn.pop();i.init(t,e,n,r),t=i}else t=new class{constructor(t,e,n,r){this.h=null,this.j=!1,this.g=this.l=this.m=0,this.init(t,e,n,r)}init(t,e,n,{Y:r=!1,ea:i=!1}={}){this.Y=r,this.ea=i,t&&(t=Dn(t,this.ea),this.h=t.buffer,this.j=t.g,this.m=e||0,this.l=void 0!==n?this.m+n:this.h.length,this.g=this.m)}clear(){this.h=null,this.j=!1,this.g=this.l=this.m=0,this.Y=!1}}(t,e,n,r);this.g=t,this.m=this.g.g,this.h=this.l=-1,this.o(r)}o({ha:t=!1}={}){this.ha=t}},ir=[];function sr(t){return t?/^\\d+$/.test(t)?(Xt(t),new or(Ft,Mt)):null:ar||=new or(0,0)}var or=class{constructor(t,e){this.h=t>>>0,this.g=e>>>0}};let ar;function cr(t){return t?/^-?\\d+$/.test(t)?(Xt(t),new hr(Ft,Mt)):null:ur||=new hr(0,0)}var hr=class{constructor(t,e){this.h=t>>>0,this.g=e>>>0}};let ur;function lr(t,e,n){for(;n>0||e>127;)t.g.push(127&e|128),e=(e>>>7|n<<25)>>>0,n>>>=7;t.g.push(e)}function fr(t,e){for(;e>127;)t.g.push(127&e|128),e>>>=7;t.g.push(e)}function dr(t,e){if(e>=0)fr(t,e);else{for(let n=0;n<9;n++)t.g.push(127&e|128),e>>=7;t.g.push(1)}}function pr(t){var e=Ft;t.g.push(e>>>0&255),t.g.push(e>>>8&255),t.g.push(e>>>16&255),t.g.push(e>>>24&255)}function gr(t,e){0!==e.length&&(t.l.push(e),t.h+=e.length)}function mr(t,e,n){fr(t.g,8*e+n)}function yr(t,e){return mr(t,e,2),e=t.g.end(),gr(t,e),e.push(t.h),e}function _r(t,e){var n=e.pop();for(n=t.h+t.g.length()-n;n>127;)e.push(127&n|128),n>>>=7,t.h++;e.push(n),t.h++}function vr(t,e,n){mr(t,e,2),fr(t.g,n.length),gr(t,t.g.end()),gr(t,n)}function Er(t,e,n,r){null!=n&&(e=yr(t,e),r(n,t),_r(t,e))}function wr(){const t=class{constructor(){throw Error()}};return Object.setPrototypeOf(t,t.prototype),t}var Tr=wr(),Ar=wr(),br=wr(),kr=wr(),Sr=wr(),xr=wr(),Lr=wr(),Rr=wr(),Ir=wr(),Fr=wr();function Mr(t,e,n){var r=t.v;z&&z in r&&(r=r[z])&&delete r[e.g],e.h?e.j(t,e.h,e.g,n,e.l):e.j(t,e.g,n,e.l)}var Pr=class{constructor(t,e){this.v=je(t,e,void 0,2048)}toJSON(){return Ue(this)}j(){var t=Fo,e=this.v,n=t.g,r=z;if(j&&r&&null!=e[r]?.[n]&&B(K,3),e=t.g,Z&&z&&void 0===Z&&(r=(n=this.v)[z])&&(r=r.da))try{r(n,e,Me)}catch(t){u(t)}return t.h?t.m(this,t.h,t.g,t.l):t.m(this,t.g,t.defaultValue,t.l)}clone(){const t=this.v,e=0|t[et];return Je(this,t,e)?He(this,t,!0):new this.constructor(ze(t,e,!1))}};Pr.prototype[J]=ct,Pr.prototype.toString=function(){return this.v.toString()};var Cr=class{constructor(t,e,n){this.g=t,this.h=e,t=Tr,this.l=!!t&&n===t||!1}};function Or(t,e){return new Cr(t,e,Tr)}function Nr(t,e,n,r,i){Er(t,n,Yr(e,r),i)}const Ur=Or((function(t,e,n,r,i){return 2===t.h&&(Qn(t,vn(e,r,n),i),!0)}),Nr),Dr=Or((function(t,e,n,r,i){return 2===t.h&&(Qn(t,vn(e,r,n),i),!0)}),Nr);var Br=Symbol(),Gr=Symbol(),jr=Symbol(),Vr=Symbol(),Xr=Symbol();let Hr,Wr;function zr(t,e,n,r){var i=r[t];if(i)return i;(i={}).qa=r,i.T=function(t){switch(typeof t){case\"boolean\":return De||=[0,void 0,!0];case\"number\":return t>0?void 0:0===t?Be||=[0,void 0]:[-t,void 0];case\"string\":return[0,t];case\"object\":return t}}(r[0]);var s=r[1];let o=1;s&&s.constructor===Object&&(i.ba=s,\"function\"==typeof(s=r[++o])&&(i.ma=!0,Hr??=s,Wr??=r[o+1],s=r[o+=2]));const a={};for(;s&&Array.isArray(s)&&s.length&&\"number\"==typeof s[0]&&s[0]>0;){for(var c=0;c<s.length;c++)a[s[c]]=s;s=r[++o]}for(c=1;void 0!==s;){let t;\"number\"==typeof s&&(c+=s,s=r[++o]);var h=void 0;if(s instanceof Cr?t=s:(t=Ur,o--),t?.l){s=r[++o],h=r;var u=o;\"function\"==typeof s&&(s=s(),h[u]=s),h=s}for(u=c+1,\"number\"==typeof(s=r[++o])&&s<0&&(u-=s,s=r[++o]);c<u;c++){const r=a[c];h?n(i,c,t,h,r):e(i,c,t,r)}}return r[t]=i}function Kr(t){return Array.isArray(t)?t[0]instanceof Cr?t:[Dr,t]:[t,void 0]}function Yr(t,e){return t instanceof Pr?t.v:Array.isArray(t)?Ge(t,e):void 0}function qr(t,e,n,r){const i=n.g;t[e]=r?(t,e,n)=>i(t,e,n,r):i}function $r(t,e,n,r,i){const s=n.g;let o,a;t[e]=(t,e,n)=>s(t,e,n,a||=zr(Gr,qr,$r,r).T,o||=Jr(r),i)}function Jr(t){let e=t[jr];if(null!=e)return e;const n=zr(Gr,qr,$r,t);return e=n.ma?(t,e)=>Hr(t,e,n):(t,e)=>{for(;Jn(e)&&4!=e.h;){var r=e.l,i=n[r];if(null==i){var s=n.ba;s&&(s=s[r])&&(null!=(s=Qr(s))&&(i=n[r]=s))}if(null==i||!i(e,t,r)){if(i=(s=e).m,Zn(s),s.ha)var o=void 0;else o=s.g.g-i,s.g.g=i,o=Kn(s.g,o);i=void 0,s=t,o&&((i=s[z]??(s[z]=new Fe))[r]??(i[r]=[])).push(o)}}return(t=Re(t))&&(t.da=n.qa[Xr]),!0},t[jr]=e,t[Xr]=Zr.bind(t),e}function Zr(t,e,n,r){var i=this[Gr];const s=this[jr],o=Ge(void 0,i.T),a=Re(t);if(a){var c=!1,h=i.ba;if(h){if(i=(e,n,i)=>{if(0!==i.length)if(h[n])for(const t of i){e=qn(t);try{c=!0,s(o,e)}finally{$n(e)}}else r?.(t,n,i)},null==e)Ie(a,i);else if(null!=a){const t=a[e];t&&i(a,e,t)}if(c){let r=0|t[et];if(2&r&&2048&r&&!n?.Ka)throw Error();const i=mt(r),s=(e,s)=>{if(null!=en(t,e,i)){if(1===n?.Qa)return;throw Error()}null!=s&&(r=rn(t,r,e,s,i)),delete a[e]};null==e?pt(o,0|o[et],((t,e)=>{s(t,e)})):s(e,en(o,e,i))}}}}function Qr(t){const e=(t=Kr(t))[0].g;if(t=t[1]){const n=Jr(t),r=zr(Gr,qr,$r,t).T;return(t,i,s)=>e(t,i,s,r,n)}return e}function ti(t,e,n){t[e]=n.h}function ei(t,e,n,r){let i,s;const o=n.h;t[e]=(t,e,n)=>o(t,e,n,s||=zr(Br,ti,ei,r).T,i||=ni(r))}function ni(t){let e=t[Vr];if(!e){const n=zr(Br,ti,ei,t);e=(t,e)=>ri(t,e,n),t[Vr]=e}return e}function ri(t,e,n){pt(t,0|t[et],((t,r)=>{if(null!=r){var i=function(t,e){var n=t[e];if(n)return n;if((n=t.ba)&&(n=n[e])){var r=(n=Kr(n))[0].h;if(n=n[1]){const e=ni(n),i=zr(Br,ti,ei,n).T;n=t.ma?Wr(i,e):(t,n,s)=>r(t,n,s,i,e)}else n=r;return t[e]=n}}(n,t);i?i(e,r,t):t<500||B(q,3)}})),(t=Re(t))&&Ie(t,((t,n,r)=>{for(gr(e,e.g.end()),t=0;t<r.length;t++)gr(e,M(r[t])||new Uint8Array(0))}))}const ii=Tt(0);function si(t,e){if(Array.isArray(e)){var n=0|e[et];if(4&n)return e;for(var r=0,i=0;r<e.length;r++){const n=t(e[r]);null!=n&&(e[i++]=n)}return i<r&&(e.length=i),(t=-1537&(5|n))!==n&&st(e,t),2&t&&Object.freeze(e),e}}function oi(t,e,n){return new Cr(t,e,n)}function ai(t,e,n){return new Cr(t,e,n)}function ci(t,e,n){rn(t,0|t[et],e,n,mt(0|t[et]))}var hi=Or((function(t,e,n,r,i){if(2!==t.h)return!1;if(t=Wt(t=Qn(t,Ge([void 0,void 0],r),i)),i=mt(r=0|e[et]),2&r)throw Error();let s=en(e,n,i);if(s instanceof be)0!=(2&s.J)?(s=s.V(),s.push(t),rn(e,r,n,s,i)):s.Ma(t);else if(Array.isArray(s)){var o=0|s[et];8192&o||st(s,o|=8192),2&o&&(s=fn(s),rn(e,r,n,s,i)),s.push(t)}else rn(e,r,n,at([t]),i);return!0}),(function(t,e,n,r,i){if(e instanceof be)e.forEach(((e,s)=>{Er(t,n,Ge([s,e],r),i)}));else if(Array.isArray(e)){for(let s=0;s<e.length;s++){const o=e[s];Array.isArray(o)&&Er(t,n,Ge(o,r),i)}at(e)}}));function ui(t,e,n){null!=(e=Qt(e))&&(mr(t,n,5),t=t.g,Ot(e),pr(t))}function li(t,e,n){if(e=function(t){if(null==t)return t;const e=typeof t;if(\"bigint\"===e)return String(zt(64,t));if(re(t)){if(\"string\"===e)return ce(t);if(\"number\"===e)return ae(t)}}(e),null!=e){if(\"string\"==typeof e)cr(e);if(null!=e)switch(mr(t,n,0),typeof e){case\"number\":t=t.g,Ct(e),lr(t,Ft,Mt);break;case\"bigint\":n=BigInt.asUintN(64,e),n=new hr(Number(n&BigInt(4294967295)),Number(n>>BigInt(32))),lr(t.g,n.h,n.g);break;default:n=cr(e),lr(t.g,n.h,n.g)}}}function fi(t,e,n){null!=(e=ie(e))&&null!=e&&(mr(t,n,0),dr(t.g,e))}function di(t,e,n){null!=(e=ee(e))&&(mr(t,n,0),t.g.g.push(e?1:0))}function pi(t,e,n){null!=(e=ge(e))&&vr(t,n,h(e))}function gi(t,e,n,r,i){Er(t,n,Yr(e,r),i)}function mi(t,e,n){null!=(e=null==e||\"string\"==typeof e||e instanceof P?e:void 0)&&vr(t,n,Dn(e,!0).buffer)}function yi(t,e,n){return(5===t.h||2===t.h)&&(e=pn(e,0|e[et],n),2==t.h?nr(t,Xn,e):e.push(Xn(t.g)),!0)}var _i=oi((function(t,e,n){return 5===t.h&&(ci(e,n,Xn(t.g)),!0)}),ui,Rr),vi=ai(yi,(function(t,e,n){if(null!=(e=si(Qt,e)))for(let o=0;o<e.length;o++){var r=t,i=n,s=e[o];null!=s&&(mr(r,i,5),r=r.g,Ot(s),pr(r))}}),Rr),Ei=ai(yi,(function(t,e,n){if(null!=(e=si(Qt,e))&&e.length){mr(t,n,2),fr(t.g,4*e.length);for(let r=0;r<e.length;r++)n=t.g,Ot(e[r]),pr(n)}}),Rr),wi=oi((function(t,e,n){return 5===t.h&&(ci(e,n,0===(t=Xn(t.g))?void 0:t),!0)}),ui,Rr),Ti=oi((function(t,e,n){return p?(0!==t.h?t=!1:(ci(e,n,Bn(t.g,Bt)),t=!0),t):0===t.h&&(ci(e,n,Bn(t.g,Dt)),!0)}),li,xr),Ai=oi((function(t,e,n){return p?(0!==t.h?e=!1:(ci(e,n,(t=Bn(t.g,Bt))===ii?void 0:t),e=!0),e):0===t.h&&(ci(e,n,0===(t=Bn(t.g,Dt))?void 0:t),!0)}),li,xr),bi=oi((function(t,e,n){return p?(0!==t.h?t=!1:(ci(e,n,Bn(t.g,Ut)),t=!0),t):0===t.h&&(ci(e,n,Bn(t.g,Nt)),!0)}),(function(t,e,n){if(e=function(t){if(null==t)return t;var e=typeof t;if(\"bigint\"===e)return String(Kt(64,t));if(re(t)){if(\"string\"===e)return e=$t(Number(t)),Yt(e)&&e>=0?t=String(e):(-1!==(e=t.indexOf(\".\"))&&(t=t.substring(0,e)),(e=\"-\"!==t[0]&&((e=t.length)<20||20===e&&t<=\"18446744073709551615\"))||(Xt(t),t=Gt(Ft,Mt))),t;if(\"number\"===e)return(t=$t(t))>=0&&Yt(t)||(Ct(t),t=Nt(Ft,Mt)),t}}(e),null!=e){if(\"string\"==typeof e)sr(e);if(null!=e)switch(mr(t,n,0),typeof e){case\"number\":t=t.g,Ct(e),lr(t,Ft,Mt);break;case\"bigint\":n=BigInt.asUintN(64,e),n=new or(Number(n&BigInt(4294967295)),Number(n>>BigInt(32))),lr(t.g,n.h,n.g);break;default:n=sr(e),lr(t.g,n.h,n.g)}}}),Lr),ki=oi((function(t,e,n){return 0===t.h&&(ci(e,n,jn(t.g)),!0)}),fi,kr),Si=ai((function(t,e,n){return(0===t.h||2===t.h)&&(e=pn(e,0|e[et],n),2==t.h?nr(t,jn,e):e.push(jn(t.g)),!0)}),(function(t,e,n){if(null!=(e=si(ie,e))&&e.length){n=yr(t,n);for(let n=0;n<e.length;n++)dr(t.g,e[n]);_r(t,n)}}),kr),xi=oi((function(t,e,n){return 0===t.h&&(ci(e,n,0===(t=jn(t.g))?void 0:t),!0)}),fi,kr),Li=oi((function(t,e,n){return 0===t.h&&(ci(e,n,Gn(t.g)),!0)}),di,Ar),Ri=oi((function(t,e,n){return 0===t.h&&(ci(e,n,!1===(t=Gn(t.g))?void 0:t),!0)}),di,Ar),Ii=ai((function(t,e,n){return 2===t.h&&(t=tr(t),pn(e,0|e[et],n).push(t),!0)}),(function(t,e,n){if(null!=(e=si(ge,e)))for(let o=0;o<e.length;o++){var r=t,i=n,s=e[o];null!=s&&vr(r,i,h(s))}}),br),Fi=oi((function(t,e,n){return 2===t.h&&(ci(e,n,\"\"===(t=tr(t))?void 0:t),!0)}),pi,br),Mi=oi((function(t,e,n){return 2===t.h&&(ci(e,n,tr(t)),!0)}),pi,br),Pi=function(t,e,n=Tr){return new Cr(t,e,n)}((function(t,e,n,r,i){return 2===t.h&&(r=Ge(void 0,r),pn(e,0|e[et],n).push(r),Qn(t,r,i),!0)}),(function(t,e,n,r,i){if(Array.isArray(e)){for(let s=0;s<e.length;s++)gi(t,e[s],n,r,i);1&(t=0|e[et])||st(e,1|t)}})),Ci=Or((function(t,e,n,r,i,s){if(2!==t.h)return!1;let o=0|e[et];return yn(e,o,s,n,mt(o)),Qn(t,e=vn(e,r,n),i),!0}),gi),Oi=oi((function(t,e,n){return 2===t.h&&(ci(e,n,er(t)),!0)}),mi,Ir),Ni=ai((function(t,e,n){return(0===t.h||2===t.h)&&(e=pn(e,0|e[et],n),2==t.h?nr(t,Vn,e):e.push(Vn(t.g)),!0)}),(function(t,e,n){if(null!=(e=si(se,e)))for(let o=0;o<e.length;o++){var r=t,i=n,s=e[o];null!=s&&(mr(r,i,0),fr(r.g,s))}}),Sr),Ui=oi((function(t,e,n){return 0===t.h&&(ci(e,n,0===(t=Vn(t.g))?void 0:t),!0)}),(function(t,e,n){null!=(e=se(e))&&null!=e&&(mr(t,n,0),fr(t.g,e))}),Sr),Di=oi((function(t,e,n){return 0===t.h&&(ci(e,n,jn(t.g)),!0)}),(function(t,e,n){null!=(e=ie(e))&&(e=parseInt(e,10),mr(t,n,0),dr(t.g,e))}),Fr);class Bi{constructor(t,e){var n=rs;this.g=t,this.h=e,this.m=wn,this.j=kn,this.defaultValue=void 0,this.l=null!=n.Oa?gt:void 0}register(){_(this)}}function Gi(t,e){return new Bi(t,e)}function ji(t,e){return(n,r)=>{{const s={ea:!0};r&&Object.assign(s,r),n=qn(n,void 0,void 0,s);try{const r=new t,s=r.v;Jr(e)(s,n);var i=r}finally{$n(n)}}return i}}function Vi(t){return function(){const e=new class{constructor(){this.l=[],this.h=0,this.g=new class{constructor(){this.g=[]}length(){return this.g.length}end(){const t=this.g;return this.g=[],t}}}};ri(this.v,e,zr(Br,ti,ei,t)),gr(e,e.g.end());const n=new Uint8Array(e.h),r=e.l,i=r.length;let s=0;for(let t=0;t<i;t++){const e=r[t];n.set(e,s),s+=e.length}return e.l=[n],n}}var Xi=class extends Pr{constructor(t){super(t)}},Hi=[0,Fi,oi((function(t,e,n){return 2===t.h&&(ci(e,n,(t=er(t))===F()?void 0:t),!0)}),(function(t,e,n){if(null!=e){if(e instanceof Pr){const r=e.Ra;return void(r?(e=r(e),null!=e&&vr(t,n,Dn(e,!0).buffer)):B(q,3))}if(Array.isArray(e))return void B(q,3)}mi(t,e,n)}),Ir)];let Wi,zi=globalThis.trustedTypes;function Ki(t){var e;return void 0===Wi&&(Wi=function(){let t=null;if(!zi)return t;try{const e=t=>t;t=zi.createPolicy(\"goog#html\",{createHTML:e,createScript:e,createScriptURL:e})}catch(t){}return t}()),t=(e=Wi)?e.createScriptURL(t):t,new class{constructor(t){this.g=t}toString(){return this.g+\"\"}}(t)}function Yi(t,...e){if(0===e.length)return Ki(t[0]);let n=t[0];for(let r=0;r<e.length;r++)n+=encodeURIComponent(e[r])+t[r+1];return Ki(n)}var qi=[0,ki,Di,Li,-1,Si,Di,-1,Li],$i=class extends Pr{constructor(t){super(t)}},Ji=[0,Li,Mi,Li,Di,-1,ai((function(t,e,n){return(0===t.h||2===t.h)&&(e=pn(e,0|e[et],n),2==t.h?nr(t,Hn,e):e.push(jn(t.g)),!0)}),(function(t,e,n){if(null!=(e=si(ie,e))&&e.length){n=yr(t,n);for(let n=0;n<e.length;n++)dr(t.g,e[n]);_r(t,n)}}),Fr),Mi,-1,[0,Li,-1],Di,Li,-1],Zi=[0,3,Li,-1,2,[0,ki],[0,Di,Li],[0,Mi,-1],[0]],Qi=[0,Mi,-2],ts=class extends Pr{constructor(t){super(t)}},es=[0],ns=[0,ki,Li,1,Li,-4],rs=class extends Pr{constructor(t){super(t,2)}},is={};is[336783863]=[0,Mi,Li,-1,ki,[0,[1,2,3,4,5,6,7,8,9],Ci,es,Ci,Ji,Ci,Qi,Ci,ns,Ci,qi,Ci,[0,Mi,-2],Ci,[0,Mi,Di],Ci,Zi,Ci,[0,Di,-1,Li]],[0,Mi],Li,[0,[1,3],[2,4],Ci,[0,Si],-1,Ci,[0,Ii],-1,Pi,[0,Mi,-1]],Mi];var ss=[0,Ai,-1,Ri,-3,Ai,Si,Fi,xi,Ai,-1,Ri,xi,Ri,-2,Fi];function os(t,e){Nn(t,3,e)}function as(t,e){Nn(t,4,e)}var cs=class extends Pr{constructor(t){super(t,500)}o(t){return kn(this,0,7,t)}},hs=[-1,{}],us=[0,Mi,1,hs],ls=[0,Mi,Ii,hs];function fs(t,e){Ln(t,1,cs,e)}function ds(t,e){Nn(t,10,e)}function ps(t,e){Nn(t,15,e)}var gs=class extends Pr{constructor(t){super(t,500)}o(t){return kn(this,0,1001,t)}},ms=[-500,Pi,[-500,Fi,-1,Ii,-3,[-2,is,Li],Pi,Hi,xi,-1,us,ls,Pi,[0,Fi,Ri],Fi,ss,xi,Ii,987,Ii],4,Pi,[-500,Mi,-1,[-1,{}],998,Mi],Pi,[-500,Mi,Ii,-1,[-2,{},Li],997,Ii,-1],xi,Pi,[-500,Mi,Ii,hs,998,Ii],Ii,xi,us,ls,Pi,[0,Fi,-1,hs],Ii,-2,ss,Fi,-1,Ri,[0,Ri,Ui],978,hs,Pi,Hi];gs.prototype.g=Vi(ms);var ys=ji(gs,ms),_s=class extends Pr{constructor(t){super(t)}},vs=class extends Pr{constructor(t){super(t)}g(){return An(this,_s,1)}},Es=[0,Pi,[0,ki,_i,Mi,-1]],ws=ji(vs,Es),Ts=class extends Pr{constructor(t){super(t)}},As=class extends Pr{constructor(t){super(t)}},bs=class extends Pr{constructor(t){super(t)}l(){return wn(this,Ts,2)}g(){return An(this,As,5)}},ks=ji(class extends Pr{constructor(t){super(t)}},[0,Ii,Si,Ei,[0,Di,[0,ki,-3],[0,_i,-3],[0,ki,-1,[0,Pi,[0,ki,-2]]],Pi,[0,_i,-1,Mi,_i]],Mi,-1,Ti,Pi,[0,ki,_i],Ii,Ti]),Ss=class extends Pr{constructor(t){super(t)}},xs=ji(class extends Pr{constructor(t){super(t)}},[0,Pi,[0,_i,-4]]),Ls=class extends Pr{constructor(t){super(t)}},Rs=ji(class extends Pr{constructor(t){super(t)}},[0,Pi,[0,_i,-4]]),Is=class extends Pr{constructor(t){super(t)}},Fs=[0,ki,-1,Ei,Di],Ms=class extends Pr{constructor(t){super(t)}};Ms.prototype.g=Vi([0,_i,-4,Ti]);var Ps=class extends Pr{constructor(t){super(t)}},Cs=ji(class extends Pr{constructor(t){super(t)}},[0,Pi,[0,1,ki,Mi,Es],Ti]),Os=class extends Pr{constructor(t){super(t)}},Ns=class extends Pr{constructor(t){super(t)}na(){const t=tn(this,1,void 0,void 0,ln);return null==t?F():t}},Us=class extends Pr{constructor(t){super(t)}},Ds=[1,2],Bs=ji(class extends Pr{constructor(t){super(t)}},[0,Pi,[0,Ds,Ci,[0,Ei],Ci,[0,Oi],ki,Mi],Ti]),Gs=class extends Pr{constructor(t){super(t)}},js=[0,Mi,ki,_i,Ii,-1],Vs=class extends Pr{constructor(t){super(t)}},Xs=[0,Li,-1],Hs=class extends Pr{constructor(t){super(t)}},Ws=[1,2,3,4,5,6],zs=class extends Pr{constructor(t){super(t)}g(){return null!=tn(this,1,void 0,void 0,ln)}l(){return null!=ge(tn(this,2))}},Ks=class extends Pr{constructor(t){super(t)}g(){return ee(tn(this,2))??!1}},Ys=[0,Oi,Mi,[0,ki,Ti,-1],[0,bi,Ti]],qs=[0,Ys,Li,[0,Ws,Ci,ns,Ci,Ji,Ci,qi,Ci,es,Ci,Qi,Ci,Zi],Di],$s=class extends Pr{constructor(t){super(t)}},Js=[0,qs,_i,-1,ki],Zs=Gi(502141897,$s);is[502141897]=Js;var Qs=ji(class extends Pr{constructor(t){super(t)}},[0,[0,Di,-1,vi,Ni],Fs]),to=class extends Pr{constructor(t){super(t)}},eo=class extends Pr{constructor(t){super(t)}},no=[0,qs,_i,[0,qs],Li],ro=Gi(508968150,eo);is[508968150]=[0,qs,Js,no,_i,[0,[0,Ys]]],is[508968149]=no;var io=class extends Pr{constructor(t){super(t)}l(){return wn(this,Gs,2)}g(){nn(this,2)}},so=[0,qs,js];is[478825465]=so;var oo=class extends Pr{constructor(t){super(t)}},ao=class extends Pr{constructor(t){super(t)}},co=class extends Pr{constructor(t){super(t)}},ho=class extends Pr{constructor(t){super(t)}},uo=class extends Pr{constructor(t){super(t)}},lo=[0,qs,[0,qs],so,-1],fo=[0,qs,_i,ki],po=[0,qs,_i],go=[0,qs,fo,po,_i],mo=Gi(479097054,uo);is[479097054]=[0,qs,go,lo],is[463370452]=lo,is[464864288]=fo;var yo=Gi(462713202,ho);is[462713202]=go,is[474472470]=po;var _o=class extends Pr{constructor(t){super(t)}},vo=class extends Pr{constructor(t){super(t)}},Eo=class extends Pr{constructor(t){super(t)}},wo=class extends Pr{constructor(t){super(t)}},To=[0,qs,_i,-1,ki],Ao=[0,qs,_i,Li];wo.prototype.g=Vi([0,qs,po,[0,qs],Js,no,To,Ao]);var bo=class extends Pr{constructor(t){super(t)}},ko=Gi(456383383,bo);is[456383383]=[0,qs,js];var So=class extends Pr{constructor(t){super(t)}},xo=Gi(476348187,So);is[476348187]=[0,qs,Xs];var Lo=class extends Pr{constructor(t){super(t)}},Ro=class extends Pr{constructor(t){super(t)}},Io=[0,Di,-1],Fo=Gi(458105876,class extends Pr{constructor(t){super(t)}g(){let t;var e=this.v;const n=0|e[et];return t=ht(this,n),e=function(t,e,n,r){var i=Ro;!r&&Ye(t)&&(n=0|(e=t.v)[et]);var s=en(e,2);if(t=!1,null==s){if(r)return Le();s=[]}else if(s.constructor===be){if(!(2&s.J)||r)return s;s=s.V()}else Array.isArray(s)?t=!!(2&(0|s[et])):s=[];if(r){if(!s.length)return Le();t||(t=!0,ot(s))}else t&&(t=!1,at(s),s=fn(s));return!t&&32&n&&it(s,32),n=rn(e,n,2,r=new be(s,i,ye,void 0)),t||$e(e,n),r}(this,e,n,t),!t&&Ro&&(e.ra=!0),e}});is[458105876]=[0,Io,hi,[!0,Ti,[0,Mi,-1,Ii]],[0,Si,Li,Di]];var Mo=class extends Pr{constructor(t){super(t)}},Po=Gi(458105758,Mo);is[458105758]=[0,qs,Mi,Io];var Co=class extends Pr{constructor(t){super(t)}},Oo=[0,wi,-1,Ri],No=class extends Pr{constructor(t){super(t)}},Uo=class extends Pr{constructor(t){super(t)}},Do=[1,2];Uo.prototype.g=Vi([0,Do,Ci,Oo,Ci,[0,Pi,Oo]]);var Bo=class extends Pr{constructor(t){super(t)}},Go=Gi(443442058,Bo);is[443442058]=[0,qs,Mi,ki,_i,Ii,-1,Li,_i],is[514774813]=To;var jo=class extends Pr{constructor(t){super(t)}},Vo=Gi(516587230,jo);function Xo(t,e){return e=e?e.clone():new Gs,void 0!==t.displayNamesLocale?nn(e,1,pe(t.displayNamesLocale)):void 0===t.displayNamesLocale&&nn(e,1),void 0!==t.maxResults?Mn(e,2,t.maxResults):\"maxResults\"in t&&nn(e,2),void 0!==t.scoreThreshold?Pn(e,3,t.scoreThreshold):\"scoreThreshold\"in t&&nn(e,3),void 0!==t.categoryAllowlist?On(e,4,t.categoryAllowlist):\"categoryAllowlist\"in t&&nn(e,4),void 0!==t.categoryDenylist?On(e,5,t.categoryDenylist):\"categoryDenylist\"in t&&nn(e,5),e}function Ho(t){const e=Number(t);return Number.isSafeInteger(e)?e:String(t)}function Wo(t,e=-1,n=\"\"){return{categories:t.map((t=>({index:Rn(t,1)??0??-1,score:Fn(t,2)??0,categoryName:ge(tn(t,3))??\"\"??\"\",displayName:ge(tn(t,4))??\"\"??\"\"}))),headIndex:e,headName:n}}function zo(t){const e={classifications:An(t,Ps,1).map((t=>Wo(wn(t,vs,4)?.g()??[],Rn(t,2)??0,ge(tn(t,3))??\"\")))};return null!=function(t){return le(g?tn(t,2,void 0,void 0,fe):tn(t,2))}(t)&&(e.timestampMs=Ho(In(t))),e}function Ko(t){var e=on(t,3,Qt,sn()),n=on(t,2,ie,sn()),r=on(t,1,ge,sn()),i=on(t,9,ge,sn());const s={categories:[],keypoints:[]};for(let t=0;t<e.length;t++)s.categories.push({score:e[t],index:n[t]??-1,categoryName:r[t]??\"\",displayName:i[t]??\"\"});if((e=wn(t,bs,4)?.l())&&(s.boundingBox={originX:Rn(e,1,Qe)??0,originY:Rn(e,2,Qe)??0,width:Rn(e,3,Qe)??0,height:Rn(e,4,Qe)??0,angle:0}),wn(t,bs,4)?.g().length)for(const e of wn(t,bs,4).g())s.keypoints.push({x:tn(e,1,void 0,Qe,Qt)??0,y:tn(e,2,void 0,Qe,Qt)??0,score:tn(e,4,void 0,Qe,Qt)??0,label:ge(tn(e,3,void 0,Qe))??\"\"});return s}function Yo(t){const e=[];for(const n of An(t,Ls,1))e.push({x:Fn(n,1)??0,y:Fn(n,2)??0,z:Fn(n,3)??0,visibility:Fn(n,4)??0});return e}function qo(t){const e=[];for(const n of An(t,Ss,1))e.push({x:Fn(n,1)??0,y:Fn(n,2)??0,z:Fn(n,3)??0,visibility:Fn(n,4)??0});return e}function $o(t){return Array.from(t,(t=>t>127?t-256:t))}function Jo(t,e){if(t.length!==e.length)throw Error(`Cannot compute cosine similarity between embeddings of different sizes (${t.length} vs. ${e.length}).`);let n=0,r=0,i=0;for(let s=0;s<t.length;s++)n+=t[s]*e[s],r+=t[s]*t[s],i+=e[s]*e[s];if(r<=0||i<=0)throw Error(\"Cannot compute cosine similarity on embedding with 0 norm.\");return n/Math.sqrt(r*i)}let Zo;is[516587230]=[0,qs,To,Ao,_i],is[518928384]=Ao;const Qo=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]);async function ta(){if(void 0===Zo)try{await WebAssembly.instantiate(Qo),Zo=!0}catch{Zo=!1}return Zo}async function ea(t,e=Yi``){const n=await ta()?\"wasm_internal\":\"wasm_nosimd_internal\";return{wasmLoaderPath:`${e}/${t}_${n}.js`,wasmBinaryPath:`${e}/${t}_${n}.wasm`}}var na=class{};function ra(){var t=navigator;return\"undefined\"!=typeof OffscreenCanvas&&(!function(t=navigator){return(t=t.userAgent).includes(\"Safari\")&&!t.includes(\"Chrome\")}(t)||!!((t=t.userAgent.match(/Version\\/([\\d]+).*Safari/))&&t.length>=1&&Number(t[1])>=17))}async function ia(t){if(\"function\"!=typeof importScripts){const e=document.createElement(\"script\");return e.src=t.toString(),e.crossOrigin=\"anonymous\",new Promise(((t,n)=>{e.addEventListener(\"load\",(()=>{t()}),!1),e.addEventListener(\"error\",(t=>{n(t)}),!1),document.body.appendChild(e)}))}try{importScripts(t.toString())}catch(e){if(!(e instanceof TypeError))throw e;await self.import(t.toString())}}function sa(t){return void 0!==t.videoWidth?[t.videoWidth,t.videoHeight]:void 0!==t.naturalWidth?[t.naturalWidth,t.naturalHeight]:void 0!==t.displayWidth?[t.displayWidth,t.displayHeight]:[t.width,t.height]}function oa(t,e,n){t.m||console.error(\"No wasm multistream support detected: ensure dependency inclusion of :gl_graph_runner_internal_multi_input target\"),n(e=t.i.stringToNewUTF8(e)),t.i._free(e)}function aa(t,e,n){if(!t.i.canvas)throw Error(\"No OpenGL canvas configured.\");if(n?t.i._bindTextureToStream(n):t.i._bindTextureToCanvas(),!(n=t.i.canvas.getContext(\"webgl2\")||t.i.canvas.getContext(\"webgl\")))throw Error(\"Failed to obtain WebGL context from the provided canvas. `getContext()` should only be invoked with `webgl` or `webgl2`.\");t.i.gpuOriginForWebTexturesIsBottomLeft&&n.pixelStorei(n.UNPACK_FLIP_Y_WEBGL,!0),n.texImage2D(n.TEXTURE_2D,0,n.RGBA,n.RGBA,n.UNSIGNED_BYTE,e),t.i.gpuOriginForWebTexturesIsBottomLeft&&n.pixelStorei(n.UNPACK_FLIP_Y_WEBGL,!1);const[r,i]=sa(e);return!t.l||r===t.i.canvas.width&&i===t.i.canvas.height||(t.i.canvas.width=r,t.i.canvas.height=i),[r,i]}function ca(t,e,n){t.m||console.error(\"No wasm multistream support detected: ensure dependency inclusion of :gl_graph_runner_internal_multi_input target\");const r=new Uint32Array(e.length);for(let n=0;n<e.length;n++)r[n]=t.i.stringToNewUTF8(e[n]);e=t.i._malloc(4*r.length),t.i.HEAPU32.set(r,e>>2),n(e);for(const e of r)t.i._free(e);t.i._free(e)}function ha(t,e,n){t.i.simpleListeners=t.i.simpleListeners||{},t.i.simpleListeners[e]=n}function ua(t,e,n){let r=[];t.i.simpleListeners=t.i.simpleListeners||{},t.i.simpleListeners[e]=(t,e,i)=>{e?(n(r,i),r=[]):r.push(t)}}na.forVisionTasks=function(t){return ea(\"vision\",t)},na.forTextTasks=function(t){return ea(\"text\",t)},na.forGenAiExperimentalTasks=function(t){return ea(\"genai_experimental\",t)},na.forGenAiTasks=function(t){return ea(\"genai\",t)},na.forAudioTasks=function(t){return ea(\"audio\",t)},na.isSimdSupported=function(){return ta()};async function la(t,e,n,r){return t=await(async(t,e,n,r,i)=>{if(e&&await ia(e),!self.ModuleFactory)throw Error(\"ModuleFactory not set.\");if(n&&(await ia(n),!self.ModuleFactory))throw Error(\"ModuleFactory not set.\");return self.Module&&i&&((e=self.Module).locateFile=i.locateFile,i.mainScriptUrlOrBlob&&(e.mainScriptUrlOrBlob=i.mainScriptUrlOrBlob)),i=await self.ModuleFactory(self.Module||i),self.ModuleFactory=self.Module=void 0,new t(i,r)})(t,n.wasmLoaderPath,n.assetLoaderPath,e,{locateFile:t=>t.endsWith(\".wasm\")?n.wasmBinaryPath.toString():n.assetBinaryPath&&t.endsWith(\".data\")?n.assetBinaryPath.toString():t}),await t.o(r),t}function fa(t,e){const n=wn(t.baseOptions,zs,1)||new zs;\"string\"==typeof e?(nn(n,2,pe(e)),nn(n,1)):e instanceof Uint8Array&&(nn(n,1,lt(e,!1)),nn(n,2)),kn(t.baseOptions,0,1,n)}function da(t){try{const e=t.H.length;if(1===e)throw Error(t.H[0].message);if(e>1)throw Error(\"Encountered multiple errors: \"+t.H.map((t=>t.message)).join(\", \"))}finally{t.H=[]}}function pa(t,e){t.C=Math.max(t.C,e)}function ga(t,e){t.B=new cs,Cn(t.B,2,\"PassThroughCalculator\"),os(t.B,\"free_memory\"),as(t.B,\"free_memory_unused_out\"),ds(e,\"free_memory\"),fs(e,t.B)}function ma(t,e){os(t.B,e),as(t.B,e+\"_unused_out\")}function ya(t){t.g.addBoolToStream(!0,\"free_memory\",t.C)}var _a=class{constructor(t){this.g=t,this.H=[],this.C=0,this.g.setAutoRenderToScreen(!1)}l(t,e=!0){if(e){const e=t.baseOptions||{};if(t.baseOptions?.modelAssetBuffer&&t.baseOptions?.modelAssetPath)throw Error(\"Cannot set both baseOptions.modelAssetPath and baseOptions.modelAssetBuffer\");if(!(wn(this.baseOptions,zs,1)?.g()||wn(this.baseOptions,zs,1)?.l()||t.baseOptions?.modelAssetBuffer||t.baseOptions?.modelAssetPath))throw Error(\"Either baseOptions.modelAssetPath or baseOptions.modelAssetBuffer must be set\");if(function(t,e){let n=wn(t.baseOptions,Hs,3);if(!n){var r=n=new Hs,i=new ts;Sn(r,4,Ws,i)}\"delegate\"in e&&(\"GPU\"===e.delegate?(e=n,r=new $i,Sn(e,2,Ws,r)):(e=n,r=new ts,Sn(e,4,Ws,r))),kn(t.baseOptions,0,3,n)}(this,e),e.modelAssetPath)return fetch(e.modelAssetPath.toString()).then((t=>{if(t.ok)return t.arrayBuffer();throw Error(`Failed to fetch model: ${e.modelAssetPath} (${t.status})`)})).then((t=>{try{this.g.i.FS_unlink(\"/model.dat\")}catch{}this.g.i.FS_createDataFile(\"/\",\"model.dat\",new Uint8Array(t),!0,!1,!1),fa(this,\"/model.dat\"),this.m(),this.L()}));if(e.modelAssetBuffer instanceof Uint8Array)fa(this,e.modelAssetBuffer);else if(e.modelAssetBuffer)return async function(t){const e=[];for(var n=0;;){const{done:r,value:i}=await t.read();if(r)break;e.push(i),n+=i.length}if(0===e.length)return new Uint8Array(0);if(1===e.length)return e[0];t=new Uint8Array(n),n=0;for(const r of e)t.set(r,n),n+=r.length;return t}(e.modelAssetBuffer).then((t=>{fa(this,t),this.m(),this.L()}))}return this.m(),this.L(),Promise.resolve()}L(){}ca(){let t;if(this.g.ca((e=>{t=ys(e)})),!t)throw Error(\"Failed to retrieve CalculatorGraphConfig\");return t}setGraph(t,e){this.g.attachErrorListener(((t,e)=>{this.H.push(Error(e))})),this.g.Ja(),this.g.setGraph(t,e),this.B=void 0,da(this)}finishProcessing(){this.g.finishProcessing(),da(this)}close(){this.B=void 0,this.g.closeGraph()}};function va(t,e){if(!t)throw Error(`Unable to obtain required WebGL resource: ${e}`);return t}_a.prototype.close=_a.prototype.close;class Ea{constructor(t,e,n,r){this.g=t,this.h=e,this.m=n,this.l=r}bind(){this.g.bindVertexArray(this.h)}close(){this.g.deleteVertexArray(this.h),this.g.deleteBuffer(this.m),this.g.deleteBuffer(this.l)}}function wa(t,e,n){const r=t.g;if(n=va(r.createShader(n),\"Failed to create WebGL shader\"),r.shaderSource(n,e),r.compileShader(n),!r.getShaderParameter(n,r.COMPILE_STATUS))throw Error(`Could not compile WebGL shader: ${r.getShaderInfoLog(n)}`);return r.attachShader(t.h,n),n}function Ta(t,e){const n=t.g,r=va(n.createVertexArray(),\"Failed to create vertex array\");n.bindVertexArray(r);const i=va(n.createBuffer(),\"Failed to create buffer\");n.bindBuffer(n.ARRAY_BUFFER,i),n.enableVertexAttribArray(t.O),n.vertexAttribPointer(t.O,2,n.FLOAT,!1,0,0),n.bufferData(n.ARRAY_BUFFER,new Float32Array([-1,-1,-1,1,1,1,1,-1]),n.STATIC_DRAW);const s=va(n.createBuffer(),\"Failed to create buffer\");return n.bindBuffer(n.ARRAY_BUFFER,s),n.enableVertexAttribArray(t.L),n.vertexAttribPointer(t.L,2,n.FLOAT,!1,0,0),n.bufferData(n.ARRAY_BUFFER,new Float32Array(e?[0,1,0,0,1,0,1,1]:[0,0,0,1,1,1,1,0]),n.STATIC_DRAW),n.bindBuffer(n.ARRAY_BUFFER,null),n.bindVertexArray(null),new Ea(n,r,i,s)}function Aa(t,e){if(t.g){if(e!==t.g)throw Error(\"Cannot change GL context once initialized\")}else t.g=e}function ba(t,e,n,r){return Aa(t,e),t.h||(t.m(),t.D()),n?(t.u||(t.u=Ta(t,!0)),n=t.u):(t.A||(t.A=Ta(t,!1)),n=t.A),e.useProgram(t.h),n.bind(),t.l(),t=r(),n.g.bindVertexArray(null),t}function ka(t,e,n){return Aa(t,e),t=va(e.createTexture(),\"Failed to create texture\"),e.bindTexture(e.TEXTURE_2D,t),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,n??e.LINEAR),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,n??e.LINEAR),e.bindTexture(e.TEXTURE_2D,null),t}function Sa(t,e,n){Aa(t,e),t.B||(t.B=va(e.createFramebuffer(),\"Failed to create framebuffe.\")),e.bindFramebuffer(e.FRAMEBUFFER,t.B),e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,n,0)}function xa(t){t.g?.bindFramebuffer(t.g.FRAMEBUFFER,null)}var La=class{H(){return\"\\n precision mediump float;\\n varying vec2 vTex;\\n uniform sampler2D inputTexture;\\n void main() {\\n gl_FragColor = texture2D(inputTexture, vTex);\\n }\\n \"}m(){const t=this.g;if(this.h=va(t.createProgram(),\"Failed to create WebGL program\"),this.X=wa(this,\"\\n attribute vec2 aVertex;\\n attribute vec2 aTex;\\n varying vec2 vTex;\\n void main(void) {\\n gl_Position = vec4(aVertex, 0.0, 1.0);\\n vTex = aTex;\\n }\",t.VERTEX_SHADER),this.W=wa(this,this.H(),t.FRAGMENT_SHADER),t.linkProgram(this.h),!t.getProgramParameter(this.h,t.LINK_STATUS))throw Error(`Error during program linking: ${t.getProgramInfoLog(this.h)}`);this.O=t.getAttribLocation(this.h,\"aVertex\"),this.L=t.getAttribLocation(this.h,\"aTex\")}D(){}l(){}close(){if(this.h){const t=this.g;t.deleteProgram(this.h),t.deleteShader(this.X),t.deleteShader(this.W)}this.B&&this.g.deleteFramebuffer(this.B),this.A&&this.A.close(),this.u&&this.u.close()}};var Ra=class extends La{H(){return\"\\n precision mediump float;\\n uniform sampler2D backgroundTexture;\\n uniform sampler2D maskTexture;\\n uniform sampler2D colorMappingTexture;\\n varying vec2 vTex;\\n void main() {\\n vec4 backgroundColor = texture2D(backgroundTexture, vTex);\\n float category = texture2D(maskTexture, vTex).r;\\n vec4 categoryColor = texture2D(colorMappingTexture, vec2(category, 0.0));\\n gl_FragColor = mix(backgroundColor, categoryColor, categoryColor.a);\\n }\\n \"}D(){const t=this.g;t.activeTexture(t.TEXTURE1),this.C=ka(this,t,t.LINEAR),t.activeTexture(t.TEXTURE2),this.j=ka(this,t,t.NEAREST)}m(){super.m();const t=this.g;this.P=va(t.getUniformLocation(this.h,\"backgroundTexture\"),\"Uniform location\"),this.U=va(t.getUniformLocation(this.h,\"colorMappingTexture\"),\"Uniform location\"),this.M=va(t.getUniformLocation(this.h,\"maskTexture\"),\"Uniform location\")}l(){super.l();const t=this.g;t.uniform1i(this.M,0),t.uniform1i(this.P,1),t.uniform1i(this.U,2)}close(){this.C&&this.g.deleteTexture(this.C),this.j&&this.g.deleteTexture(this.j),super.close()}},Ia=class extends La{H(){return\"\\n precision mediump float;\\n uniform sampler2D maskTexture;\\n uniform sampler2D defaultTexture;\\n uniform sampler2D overlayTexture;\\n varying vec2 vTex;\\n void main() {\\n float confidence = texture2D(maskTexture, vTex).r;\\n vec4 defaultColor = texture2D(defaultTexture, vTex);\\n vec4 overlayColor = texture2D(overlayTexture, vTex);\\n // Apply the alpha from the overlay and merge in the default color\\n overlayColor = mix(defaultColor, overlayColor, overlayColor.a);\\n gl_FragColor = mix(defaultColor, overlayColor, confidence);\\n }\\n \"}D(){const t=this.g;t.activeTexture(t.TEXTURE1),this.j=ka(this,t),t.activeTexture(t.TEXTURE2),this.C=ka(this,t)}m(){super.m();const t=this.g;this.M=va(t.getUniformLocation(this.h,\"defaultTexture\"),\"Uniform location\"),this.P=va(t.getUniformLocation(this.h,\"overlayTexture\"),\"Uniform location\"),this.I=va(t.getUniformLocation(this.h,\"maskTexture\"),\"Uniform location\")}l(){super.l();const t=this.g;t.uniform1i(this.I,0),t.uniform1i(this.M,1),t.uniform1i(this.P,2)}close(){this.j&&this.g.deleteTexture(this.j),this.C&&this.g.deleteTexture(this.C),super.close()}};function Fa(t,e){switch(e){case 0:return t.g.find((t=>t instanceof Uint8Array));case 1:return t.g.find((t=>t instanceof Float32Array));case 2:return t.g.find((t=>\"undefined\"!=typeof WebGLTexture&&t instanceof WebGLTexture));default:throw Error(`Type is not supported: ${e}`)}}function Ma(t){var e=Fa(t,1);if(!e){if(e=Fa(t,0))e=new Float32Array(e).map((t=>t/255));else{e=new Float32Array(t.width*t.height);const r=Ca(t);var n=Na(t);if(Sa(n,r,Pa(t)),\"iPad Simulator;iPhone Simulator;iPod Simulator;iPad;iPhone;iPod\".split(\";\").includes(navigator.platform)||navigator.userAgent.includes(\"Mac\")&&\"document\"in self&&\"ontouchend\"in self.document){n=new Float32Array(t.width*t.height*4),r.readPixels(0,0,t.width,t.height,r.RGBA,r.FLOAT,n);for(let t=0,r=0;t<e.length;++t,r+=4)e[t]=n[r]}else r.readPixels(0,0,t.width,t.height,r.RED,r.FLOAT,e)}t.g.push(e)}return e}function Pa(t){let e=Fa(t,2);if(!e){const n=Ca(t);e=Ua(t);const r=Ma(t),i=Oa(t);n.texImage2D(n.TEXTURE_2D,0,i,t.width,t.height,0,n.RED,n.FLOAT,r),Da(t)}return e}function Ca(t){if(!t.canvas)throw Error(\"Conversion to different image formats require that a canvas is passed when initializing the image.\");return t.h||(t.h=va(t.canvas.getContext(\"webgl2\"),\"You cannot use a canvas that is already bound to a different type of rendering context.\")),t.h}function Oa(t){if(t=Ca(t),!Ba)if(t.getExtension(\"EXT_color_buffer_float\")&&t.getExtension(\"OES_texture_float_linear\")&&t.getExtension(\"EXT_float_blend\"))Ba=t.R32F;else{if(!t.getExtension(\"EXT_color_buffer_half_float\"))throw Error(\"GPU does not fully support 4-channel float32 or float16 formats\");Ba=t.R16F}return Ba}function Na(t){return t.l||(t.l=new La),t.l}function Ua(t){const e=Ca(t);e.viewport(0,0,t.width,t.height),e.activeTexture(e.TEXTURE0);let n=Fa(t,2);return n||(n=ka(Na(t),e,t.m?e.LINEAR:e.NEAREST),t.g.push(n),t.j=!0),e.bindTexture(e.TEXTURE_2D,n),n}function Da(t){t.h.bindTexture(t.h.TEXTURE_2D,null)}var Ba,Ga=class{constructor(t,e,n,r,i,s,o){this.g=t,this.m=e,this.j=n,this.canvas=r,this.l=i,this.width=s,this.height=o,this.j&&(0===--ja&&console.error(\"You seem to be creating MPMask instances without invoking .close(). This leaks resources.\"))}Fa(){return!!Fa(this,0)}ka(){return!!Fa(this,1)}R(){return!!Fa(this,2)}ja(){return(e=Fa(t=this,0))||(e=Ma(t),e=new Uint8Array(e.map((t=>Math.round(255*t)))),t.g.push(e)),e;var t,e}ia(){return Ma(this)}N(){return Pa(this)}clone(){const t=[];for(const e of this.g){let n;if(e instanceof Uint8Array)n=new Uint8Array(e);else if(e instanceof Float32Array)n=new Float32Array(e);else{if(!(e instanceof WebGLTexture))throw Error(`Type is not supported: ${e}`);{const t=Ca(this),e=Na(this);t.activeTexture(t.TEXTURE1),n=ka(e,t,this.m?t.LINEAR:t.NEAREST),t.bindTexture(t.TEXTURE_2D,n);const r=Oa(this);t.texImage2D(t.TEXTURE_2D,0,r,this.width,this.height,0,t.RED,t.FLOAT,null),t.bindTexture(t.TEXTURE_2D,null),Sa(e,t,n),ba(e,t,!1,(()=>{Ua(this),t.clearColor(0,0,0,0),t.clear(t.COLOR_BUFFER_BIT),t.drawArrays(t.TRIANGLE_FAN,0,4),Da(this)})),xa(e),Da(this)}}t.push(n)}return new Ga(t,this.m,this.R(),this.canvas,this.l,this.width,this.height)}close(){this.j&&Ca(this).deleteTexture(Fa(this,2)),ja=-1}};Ga.prototype.close=Ga.prototype.close,Ga.prototype.clone=Ga.prototype.clone,Ga.prototype.getAsWebGLTexture=Ga.prototype.N,Ga.prototype.getAsFloat32Array=Ga.prototype.ia,Ga.prototype.getAsUint8Array=Ga.prototype.ja,Ga.prototype.hasWebGLTexture=Ga.prototype.R,Ga.prototype.hasFloat32Array=Ga.prototype.ka,Ga.prototype.hasUint8Array=Ga.prototype.Fa;var ja=250;const Va={color:\"white\",lineWidth:4,radius:6};function Xa(t){return{...Va,fillColor:(t=t||{}).color,...t}}function Ha(t,e){return t instanceof Function?t(e):t}function Wa(t,e,n){return Math.max(Math.min(e,n),Math.min(Math.max(e,n),t))}function za(t){if(!t.l)throw Error(\"CPU rendering requested but CanvasRenderingContext2D not provided.\");return t.l}function Ka(t){if(!t.j)throw Error(\"GPU rendering requested but WebGL2RenderingContext not provided.\");return t.j}function Ya(t,e,n){if(e.R())n(e.N());else{const r=e.ka()?e.ia():e.ja();t.m=t.m??new La;const i=Ka(t);n((t=new Ga([r],e.m,!1,i.canvas,t.m,e.width,e.height)).N()),t.close()}}function qa(t,e,n,r){const i=function(t){return t.g||(t.g=new Ra),t.g}(t),s=Ka(t),o=Array.isArray(n)?new ImageData(new Uint8ClampedArray(n),1,1):n;ba(i,s,!0,(()=>{!function(t,e,n,r){const i=t.g;if(i.activeTexture(i.TEXTURE0),i.bindTexture(i.TEXTURE_2D,e),i.activeTexture(i.TEXTURE1),i.bindTexture(i.TEXTURE_2D,t.C),i.texImage2D(i.TEXTURE_2D,0,i.RGBA,i.RGBA,i.UNSIGNED_BYTE,n),t.I&&function(t,e){if(t!==e)return!1;t=t.entries(),e=e.entries();for(const[r,i]of t){t=r;const s=i;var n=e.next();if(n.done)return!1;const[o,a]=n.value;if(n=a,t!==o||s[0]!==n[0]||s[1]!==n[1]||s[2]!==n[2]||s[3]!==n[3])return!1}return!!e.next().done}(t.I,r))i.activeTexture(i.TEXTURE2),i.bindTexture(i.TEXTURE_2D,t.j);else{t.I=r;const e=Array(1024).fill(0);r.forEach(((t,n)=>{if(4!==t.length)throw Error(`Color at index ${n} is not a four-channel value.`);e[4*n]=t[0],e[4*n+1]=t[1],e[4*n+2]=t[2],e[4*n+3]=t[3]})),i.activeTexture(i.TEXTURE2),i.bindTexture(i.TEXTURE_2D,t.j),i.texImage2D(i.TEXTURE_2D,0,i.RGBA,256,1,0,i.RGBA,i.UNSIGNED_BYTE,new Uint8Array(e))}}(i,e,o,r),s.clearColor(0,0,0,0),s.clear(s.COLOR_BUFFER_BIT),s.drawArrays(s.TRIANGLE_FAN,0,4);const t=i.g;t.activeTexture(t.TEXTURE0),t.bindTexture(t.TEXTURE_2D,null),t.activeTexture(t.TEXTURE1),t.bindTexture(t.TEXTURE_2D,null),t.activeTexture(t.TEXTURE2),t.bindTexture(t.TEXTURE_2D,null)}))}function $a(t,e,n,r){const i=Ka(t),s=function(t){return t.h||(t.h=new Ia),t.h}(t),o=Array.isArray(n)?new ImageData(new Uint8ClampedArray(n),1,1):n,a=Array.isArray(r)?new ImageData(new Uint8ClampedArray(r),1,1):r;ba(s,i,!0,(()=>{var t=s.g;t.activeTexture(t.TEXTURE0),t.bindTexture(t.TEXTURE_2D,e),t.activeTexture(t.TEXTURE1),t.bindTexture(t.TEXTURE_2D,s.j),t.texImage2D(t.TEXTURE_2D,0,t.RGBA,t.RGBA,t.UNSIGNED_BYTE,o),t.activeTexture(t.TEXTURE2),t.bindTexture(t.TEXTURE_2D,s.C),t.texImage2D(t.TEXTURE_2D,0,t.RGBA,t.RGBA,t.UNSIGNED_BYTE,a),i.clearColor(0,0,0,0),i.clear(i.COLOR_BUFFER_BIT),i.drawArrays(i.TRIANGLE_FAN,0,4),i.bindTexture(i.TEXTURE_2D,null),(t=s.g).activeTexture(t.TEXTURE0),t.bindTexture(t.TEXTURE_2D,null),t.activeTexture(t.TEXTURE1),t.bindTexture(t.TEXTURE_2D,null),t.activeTexture(t.TEXTURE2),t.bindTexture(t.TEXTURE_2D,null)}))}var Ja=class{constructor(t,e){\"undefined\"!=typeof CanvasRenderingContext2D&&t instanceof CanvasRenderingContext2D||t instanceof OffscreenCanvasRenderingContext2D?(this.l=t,this.j=e):this.j=t}ya(t,e){if(t){var n=za(this);e=Xa(e),n.save();var r=n.canvas,i=0;for(const s of t)n.fillStyle=Ha(e.fillColor,{index:i,from:s}),n.strokeStyle=Ha(e.color,{index:i,from:s}),n.lineWidth=Ha(e.lineWidth,{index:i,from:s}),(t=new Path2D).arc(s.x*r.width,s.y*r.height,Ha(e.radius,{index:i,from:s}),0,2*Math.PI),n.fill(t),n.stroke(t),++i;n.restore()}}xa(t,e,n){if(t&&e){var r=za(this);n=Xa(n),r.save();var i=r.canvas,s=0;for(const o of e){r.beginPath(),e=t[o.start];const a=t[o.end];e&&a&&(r.strokeStyle=Ha(n.color,{index:s,from:e,to:a}),r.lineWidth=Ha(n.lineWidth,{index:s,from:e,to:a}),r.moveTo(e.x*i.width,e.y*i.height),r.lineTo(a.x*i.width,a.y*i.height)),++s,r.stroke()}r.restore()}}ua(t,e){const n=za(this);e=Xa(e),n.save(),n.beginPath(),n.lineWidth=Ha(e.lineWidth,{}),n.strokeStyle=Ha(e.color,{}),n.fillStyle=Ha(e.fillColor,{}),n.moveTo(t.originX,t.originY),n.lineTo(t.originX+t.width,t.originY),n.lineTo(t.originX+t.width,t.originY+t.height),n.lineTo(t.originX,t.originY+t.height),n.lineTo(t.originX,t.originY),n.stroke(),n.fill(),n.restore()}va(t,e,n=[0,0,0,255]){this.l?function(t,e,n,r){const i=Ka(t);Ya(t,e,(e=>{qa(t,e,n,r),(e=za(t)).drawImage(i.canvas,0,0,e.canvas.width,e.canvas.height)}))}(this,t,n,e):qa(this,t.N(),n,e)}wa(t,e,n){this.l?function(t,e,n,r){const i=Ka(t);Ya(t,e,(e=>{$a(t,e,n,r),(e=za(t)).drawImage(i.canvas,0,0,e.canvas.width,e.canvas.height)}))}(this,t,e,n):$a(this,t.N(),e,n)}close(){this.g?.close(),this.g=void 0,this.h?.close(),this.h=void 0,this.m?.close(),this.m=void 0}};function Za(t,e){switch(e){case 0:return t.g.find((t=>t instanceof ImageData));case 1:return t.g.find((t=>\"undefined\"!=typeof ImageBitmap&&t instanceof ImageBitmap));case 2:return t.g.find((t=>\"undefined\"!=typeof WebGLTexture&&t instanceof WebGLTexture));default:throw Error(`Type is not supported: ${e}`)}}function Qa(t){var e=Za(t,0);if(!e){e=ec(t);const n=nc(t),r=new Uint8Array(t.width*t.height*4);Sa(n,e,tc(t)),e.readPixels(0,0,t.width,t.height,e.RGBA,e.UNSIGNED_BYTE,r),xa(n),e=new ImageData(new Uint8ClampedArray(r.buffer),t.width,t.height),t.g.push(e)}return e}function tc(t){let e=Za(t,2);if(!e){const n=ec(t);e=rc(t);const r=Za(t,1)||Qa(t);n.texImage2D(n.TEXTURE_2D,0,n.RGBA,n.RGBA,n.UNSIGNED_BYTE,r),ic(t)}return e}function ec(t){if(!t.canvas)throw Error(\"Conversion to different image formats require that a canvas is passed when initializing the image.\");return t.h||(t.h=va(t.canvas.getContext(\"webgl2\"),\"You cannot use a canvas that is already bound to a different type of rendering context.\")),t.h}function nc(t){return t.l||(t.l=new La),t.l}function rc(t){const e=ec(t);e.viewport(0,0,t.width,t.height),e.activeTexture(e.TEXTURE0);let n=Za(t,2);return n||(n=ka(nc(t),e),t.g.push(n),t.m=!0),e.bindTexture(e.TEXTURE_2D,n),n}function ic(t){t.h.bindTexture(t.h.TEXTURE_2D,null)}function sc(t){const e=ec(t);return ba(nc(t),e,!0,(()=>function(t,e){const n=t.canvas;if(n.width===t.width&&n.height===t.height)return e();const r=n.width,i=n.height;return n.width=t.width,n.height=t.height,t=e(),n.width=r,n.height=i,t}(t,(()=>{if(e.bindFramebuffer(e.FRAMEBUFFER,null),e.clearColor(0,0,0,0),e.clear(e.COLOR_BUFFER_BIT),e.drawArrays(e.TRIANGLE_FAN,0,4),!(t.canvas instanceof OffscreenCanvas))throw Error(\"Conversion to ImageBitmap requires that the MediaPipe Tasks is initialized with an OffscreenCanvas\");return t.canvas.transferToImageBitmap()}))))}Ja.prototype.close=Ja.prototype.close,Ja.prototype.drawConfidenceMask=Ja.prototype.wa,Ja.prototype.drawCategoryMask=Ja.prototype.va,Ja.prototype.drawBoundingBox=Ja.prototype.ua,Ja.prototype.drawConnectors=Ja.prototype.xa,Ja.prototype.drawLandmarks=Ja.prototype.ya,Ja.lerp=function(t,e,n,r,i){return Wa(r*(1-(t-e)/(n-e))+i*(1-(n-t)/(n-e)),r,i)},Ja.clamp=Wa;var oc=class{constructor(t,e,n,r,i,s,o){this.g=t,this.j=e,this.m=n,this.canvas=r,this.l=i,this.width=s,this.height=o,(this.j||this.m)&&(0===--ac&&console.error(\"You seem to be creating MPImage instances without invoking .close(). This leaks resources.\"))}Ea(){return!!Za(this,0)}la(){return!!Za(this,1)}R(){return!!Za(this,2)}Ca(){return Qa(this)}Ba(){var t=Za(this,1);return t||(tc(this),rc(this),t=sc(this),ic(this),this.g.push(t),this.j=!0),t}N(){return tc(this)}clone(){const t=[];for(const e of this.g){let n;if(e instanceof ImageData)n=new ImageData(e.data,this.width,this.height);else if(e instanceof WebGLTexture){const t=ec(this),e=nc(this);t.activeTexture(t.TEXTURE1),n=ka(e,t),t.bindTexture(t.TEXTURE_2D,n),t.texImage2D(t.TEXTURE_2D,0,t.RGBA,this.width,this.height,0,t.RGBA,t.UNSIGNED_BYTE,null),t.bindTexture(t.TEXTURE_2D,null),Sa(e,t,n),ba(e,t,!1,(()=>{rc(this),t.clearColor(0,0,0,0),t.clear(t.COLOR_BUFFER_BIT),t.drawArrays(t.TRIANGLE_FAN,0,4),ic(this)})),xa(e),ic(this)}else{if(!(e instanceof ImageBitmap))throw Error(`Type is not supported: ${e}`);tc(this),rc(this),n=sc(this),ic(this)}t.push(n)}return new oc(t,this.la(),this.R(),this.canvas,this.l,this.width,this.height)}close(){this.j&&Za(this,1).close(),this.m&&ec(this).deleteTexture(Za(this,2)),ac=-1}};oc.prototype.close=oc.prototype.close,oc.prototype.clone=oc.prototype.clone,oc.prototype.getAsWebGLTexture=oc.prototype.N,oc.prototype.getAsImageBitmap=oc.prototype.Ba,oc.prototype.getAsImageData=oc.prototype.Ca,oc.prototype.hasWebGLTexture=oc.prototype.R,oc.prototype.hasImageBitmap=oc.prototype.la,oc.prototype.hasImageData=oc.prototype.Ea;var ac=250;function cc(...t){return t.map((([t,e])=>({start:t,end:e})))}const hc=function(t){return class extends t{Ja(){this.i._registerModelResourcesGraphService()}}}((uc=class{constructor(t,e){this.l=!0,this.i=t,this.g=null,this.h=0,this.m=\"function\"==typeof this.i._addIntToInputStream,void 0!==e?this.i.canvas=e:ra()?this.i.canvas=new OffscreenCanvas(1,1):(console.warn(\"OffscreenCanvas not supported and GraphRunner constructor glCanvas parameter is undefined. Creating backup canvas.\"),this.i.canvas=document.createElement(\"canvas\"))}async initializeGraph(t){const e=await(await fetch(t)).arrayBuffer();t=!(t.endsWith(\".pbtxt\")||t.endsWith(\".textproto\")),this.setGraph(new Uint8Array(e),t)}setGraphFromString(t){this.setGraph((new TextEncoder).encode(t),!1)}setGraph(t,e){const n=t.length,r=this.i._malloc(n);this.i.HEAPU8.set(t,r),e?this.i._changeBinaryGraph(n,r):this.i._changeTextGraph(n,r),this.i._free(r)}configureAudio(t,e,n,r,i){this.i._configureAudio||console.warn('Attempting to use configureAudio without support for input audio. Is build dep \":gl_graph_runner_audio\" missing?'),oa(this,r||\"input_audio\",(r=>{oa(this,i=i||\"audio_header\",(i=>{this.i._configureAudio(r,i,t,e??0,n)}))}))}setAutoResizeCanvas(t){this.l=t}setAutoRenderToScreen(t){this.i._setAutoRenderToScreen(t)}setGpuBufferVerticalFlip(t){this.i.gpuOriginForWebTexturesIsBottomLeft=t}ca(t){ha(this,\"__graph_config__\",(e=>{t(e)})),oa(this,\"__graph_config__\",(t=>{this.i._getGraphConfig(t,void 0)})),delete this.i.simpleListeners.__graph_config__}attachErrorListener(t){this.i.errorListener=t}attachEmptyPacketListener(t,e){this.i.emptyPacketListeners=this.i.emptyPacketListeners||{},this.i.emptyPacketListeners[t]=e}addAudioToStream(t,e,n){this.addAudioToStreamWithShape(t,0,0,e,n)}addAudioToStreamWithShape(t,e,n,r,i){const s=4*t.length;this.h!==s&&(this.g&&this.i._free(this.g),this.g=this.i._malloc(s),this.h=s),this.i.HEAPF32.set(t,this.g/4),oa(this,r,(t=>{this.i._addAudioToInputStream(this.g,e,n,t,i)}))}addGpuBufferToStream(t,e,n){oa(this,e,(e=>{const[r,i]=aa(this,t,e);this.i._addBoundTextureToStream(e,r,i,n)}))}addBoolToStream(t,e,n){oa(this,e,(e=>{this.i._addBoolToInputStream(t,e,n)}))}addDoubleToStream(t,e,n){oa(this,e,(e=>{this.i._addDoubleToInputStream(t,e,n)}))}addFloatToStream(t,e,n){oa(this,e,(e=>{this.i._addFloatToInputStream(t,e,n)}))}addIntToStream(t,e,n){oa(this,e,(e=>{this.i._addIntToInputStream(t,e,n)}))}addUintToStream(t,e,n){oa(this,e,(e=>{this.i._addUintToInputStream(t,e,n)}))}addStringToStream(t,e,n){oa(this,e,(e=>{oa(this,t,(t=>{this.i._addStringToInputStream(t,e,n)}))}))}addStringRecordToStream(t,e,n){oa(this,e,(e=>{ca(this,Object.keys(t),(r=>{ca(this,Object.values(t),(i=>{this.i._addFlatHashMapToInputStream(r,i,Object.keys(t).length,e,n)}))}))}))}addProtoToStream(t,e,n,r){oa(this,n,(n=>{oa(this,e,(e=>{const i=this.i._malloc(t.length);this.i.HEAPU8.set(t,i),this.i._addProtoToInputStream(i,t.length,e,n,r),this.i._free(i)}))}))}addEmptyPacketToStream(t,e){oa(this,t,(t=>{this.i._addEmptyPacketToInputStream(t,e)}))}addBoolVectorToStream(t,e,n){oa(this,e,(e=>{const r=this.i._allocateBoolVector(t.length);if(!r)throw Error(\"Unable to allocate new bool vector on heap.\");for(const e of t)this.i._addBoolVectorEntry(r,e);this.i._addBoolVectorToInputStream(r,e,n)}))}addDoubleVectorToStream(t,e,n){oa(this,e,(e=>{const r=this.i._allocateDoubleVector(t.length);if(!r)throw Error(\"Unable to allocate new double vector on heap.\");for(const e of t)this.i._addDoubleVectorEntry(r,e);this.i._addDoubleVectorToInputStream(r,e,n)}))}addFloatVectorToStream(t,e,n){oa(this,e,(e=>{const r=this.i._allocateFloatVector(t.length);if(!r)throw Error(\"Unable to allocate new float vector on heap.\");for(const e of t)this.i._addFloatVectorEntry(r,e);this.i._addFloatVectorToInputStream(r,e,n)}))}addIntVectorToStream(t,e,n){oa(this,e,(e=>{const r=this.i._allocateIntVector(t.length);if(!r)throw Error(\"Unable to allocate new int vector on heap.\");for(const e of t)this.i._addIntVectorEntry(r,e);this.i._addIntVectorToInputStream(r,e,n)}))}addUintVectorToStream(t,e,n){oa(this,e,(e=>{const r=this.i._allocateUintVector(t.length);if(!r)throw Error(\"Unable to allocate new unsigned int vector on heap.\");for(const e of t)this.i._addUintVectorEntry(r,e);this.i._addUintVectorToInputStream(r,e,n)}))}addStringVectorToStream(t,e,n){oa(this,e,(e=>{const r=this.i._allocateStringVector(t.length);if(!r)throw Error(\"Unable to allocate new string vector on heap.\");for(const e of t)oa(this,e,(t=>{this.i._addStringVectorEntry(r,t)}));this.i._addStringVectorToInputStream(r,e,n)}))}addBoolToInputSidePacket(t,e){oa(this,e,(e=>{this.i._addBoolToInputSidePacket(t,e)}))}addDoubleToInputSidePacket(t,e){oa(this,e,(e=>{this.i._addDoubleToInputSidePacket(t,e)}))}addFloatToInputSidePacket(t,e){oa(this,e,(e=>{this.i._addFloatToInputSidePacket(t,e)}))}addIntToInputSidePacket(t,e){oa(this,e,(e=>{this.i._addIntToInputSidePacket(t,e)}))}addUintToInputSidePacket(t,e){oa(this,e,(e=>{this.i._addUintToInputSidePacket(t,e)}))}addStringToInputSidePacket(t,e){oa(this,e,(e=>{oa(this,t,(t=>{this.i._addStringToInputSidePacket(t,e)}))}))}addProtoToInputSidePacket(t,e,n){oa(this,n,(n=>{oa(this,e,(e=>{const r=this.i._malloc(t.length);this.i.HEAPU8.set(t,r),this.i._addProtoToInputSidePacket(r,t.length,e,n),this.i._free(r)}))}))}addBoolVectorToInputSidePacket(t,e){oa(this,e,(e=>{const n=this.i._allocateBoolVector(t.length);if(!n)throw Error(\"Unable to allocate new bool vector on heap.\");for(const e of t)this.i._addBoolVectorEntry(n,e);this.i._addBoolVectorToInputSidePacket(n,e)}))}addDoubleVectorToInputSidePacket(t,e){oa(this,e,(e=>{const n=this.i._allocateDoubleVector(t.length);if(!n)throw Error(\"Unable to allocate new double vector on heap.\");for(const e of t)this.i._addDoubleVectorEntry(n,e);this.i._addDoubleVectorToInputSidePacket(n,e)}))}addFloatVectorToInputSidePacket(t,e){oa(this,e,(e=>{const n=this.i._allocateFloatVector(t.length);if(!n)throw Error(\"Unable to allocate new float vector on heap.\");for(const e of t)this.i._addFloatVectorEntry(n,e);this.i._addFloatVectorToInputSidePacket(n,e)}))}addIntVectorToInputSidePacket(t,e){oa(this,e,(e=>{const n=this.i._allocateIntVector(t.length);if(!n)throw Error(\"Unable to allocate new int vector on heap.\");for(const e of t)this.i._addIntVectorEntry(n,e);this.i._addIntVectorToInputSidePacket(n,e)}))}addUintVectorToInputSidePacket(t,e){oa(this,e,(e=>{const n=this.i._allocateUintVector(t.length);if(!n)throw Error(\"Unable to allocate new unsigned int vector on heap.\");for(const e of t)this.i._addUintVectorEntry(n,e);this.i._addUintVectorToInputSidePacket(n,e)}))}addStringVectorToInputSidePacket(t,e){oa(this,e,(e=>{const n=this.i._allocateStringVector(t.length);if(!n)throw Error(\"Unable to allocate new string vector on heap.\");for(const e of t)oa(this,e,(t=>{this.i._addStringVectorEntry(n,t)}));this.i._addStringVectorToInputSidePacket(n,e)}))}attachBoolListener(t,e){ha(this,t,e),oa(this,t,(t=>{this.i._attachBoolListener(t)}))}attachBoolVectorListener(t,e){ua(this,t,e),oa(this,t,(t=>{this.i._attachBoolVectorListener(t)}))}attachIntListener(t,e){ha(this,t,e),oa(this,t,(t=>{this.i._attachIntListener(t)}))}attachIntVectorListener(t,e){ua(this,t,e),oa(this,t,(t=>{this.i._attachIntVectorListener(t)}))}attachUintListener(t,e){ha(this,t,e),oa(this,t,(t=>{this.i._attachUintListener(t)}))}attachUintVectorListener(t,e){ua(this,t,e),oa(this,t,(t=>{this.i._attachUintVectorListener(t)}))}attachDoubleListener(t,e){ha(this,t,e),oa(this,t,(t=>{this.i._attachDoubleListener(t)}))}attachDoubleVectorListener(t,e){ua(this,t,e),oa(this,t,(t=>{this.i._attachDoubleVectorListener(t)}))}attachFloatListener(t,e){ha(this,t,e),oa(this,t,(t=>{this.i._attachFloatListener(t)}))}attachFloatVectorListener(t,e){ua(this,t,e),oa(this,t,(t=>{this.i._attachFloatVectorListener(t)}))}attachStringListener(t,e){ha(this,t,e),oa(this,t,(t=>{this.i._attachStringListener(t)}))}attachStringVectorListener(t,e){ua(this,t,e),oa(this,t,(t=>{this.i._attachStringVectorListener(t)}))}attachProtoListener(t,e,n){ha(this,t,e),oa(this,t,(t=>{this.i._attachProtoListener(t,n||!1)}))}attachProtoVectorListener(t,e,n){ua(this,t,e),oa(this,t,(t=>{this.i._attachProtoVectorListener(t,n||!1)}))}attachAudioListener(t,e,n){this.i._attachAudioListener||console.warn('Attempting to use attachAudioListener without support for output audio. Is build dep \":gl_graph_runner_audio_out\" missing?'),ha(this,t,((t,n)=>{t=new Float32Array(t.buffer,t.byteOffset,t.length/4),e(t,n)})),oa(this,t,(t=>{this.i._attachAudioListener(t,n||!1)}))}finishProcessing(){this.i._waitUntilIdle()}closeGraph(){this.i._closeGraph(),this.i.simpleListeners=void 0,this.i.emptyPacketListeners=void 0}},class extends uc{get ga(){return this.i}pa(t,e,n){oa(this,e,(e=>{const[r,i]=aa(this,t,e);this.ga._addBoundTextureAsImageToStream(e,r,i,n)}))}Z(t,e){ha(this,t,e),oa(this,t,(t=>{this.ga._attachImageListener(t)}))}aa(t,e){ua(this,t,e),oa(this,t,(t=>{this.ga._attachImageVectorListener(t)}))}}));var uc,lc=class extends hc{};async function fc(t,e,n){return async function(t,e,n,r){return la(t,e,n,r)}(t,n.canvas??(ra()?void 0:document.createElement(\"canvas\")),e,n)}function dc(t,e,n,r){if(t.U){const s=new Ms;if(n?.regionOfInterest){if(!t.oa)throw Error(\"This task doesn't support region-of-interest.\");var i=n.regionOfInterest;if(i.left>=i.right||i.top>=i.bottom)throw Error(\"Expected RectF with left < right and top < bottom.\");if(i.left<0||i.top<0||i.right>1||i.bottom>1)throw Error(\"Expected RectF values to be in [0,1].\");Pn(s,1,(i.left+i.right)/2),Pn(s,2,(i.top+i.bottom)/2),Pn(s,4,i.right-i.left),Pn(s,3,i.bottom-i.top)}else Pn(s,1,.5),Pn(s,2,.5),Pn(s,4,1),Pn(s,3,1);if(n?.rotationDegrees){if(n?.rotationDegrees%90!=0)throw Error(\"Expected rotation to be a multiple of 90\u00B0.\");if(Pn(s,5,-Math.PI*n.rotationDegrees/180),n?.rotationDegrees%180!=0){const[t,r]=sa(e);n=Fn(s,3)*r/t,i=Fn(s,4)*t/r,Pn(s,4,n),Pn(s,3,i)}}t.g.addProtoToStream(s.g(),\"mediapipe.NormalizedRect\",t.U,r)}t.g.pa(e,t.X,r??performance.now()),t.finishProcessing()}function pc(t,e,n){if(t.baseOptions?.g())throw Error(\"Task is not initialized with image mode. 'runningMode' must be set to 'IMAGE'.\");dc(t,e,n,t.C+1)}function gc(t,e,n,r){if(!t.baseOptions?.g())throw Error(\"Task is not initialized with video mode. 'runningMode' must be set to 'VIDEO'.\");dc(t,e,n,r)}function mc(t,e,n,r){var i=e.data;const s=e.width,o=s*(e=e.height);if((i instanceof Uint8Array||i instanceof Float32Array)&&i.length!==o)throw Error(\"Unsupported channel count: \"+i.length/o);return t=new Ga([i],n,!1,t.g.i.canvas,t.P,s,e),r?t.clone():t}var yc=class extends _a{constructor(t,e,n,r){super(t),this.g=t,this.X=e,this.U=n,this.oa=r,this.P=new La}l(t,e=!0){if(\"runningMode\"in t&&nn(this.baseOptions,2,te(!!t.runningMode&&\"IMAGE\"!==t.runningMode)),void 0!==t.canvas&&this.g.i.canvas!==t.canvas)throw Error(\"You must create a new task to reset the canvas.\");return super.l(t,e)}close(){this.P.close(),super.close()}};yc.prototype.close=yc.prototype.close;var _c=class extends yc{constructor(t,e){super(new lc(t,e),\"image_in\",\"norm_rect_in\",!1),this.j={detections:[]},kn(t=this.h=new $s,0,1,e=new Ks),Pn(this.h,2,.5),Pn(this.h,3,.3)}get baseOptions(){return wn(this.h,Ks,1)}set baseOptions(t){kn(this.h,0,1,t)}o(t){return\"minDetectionConfidence\"in t&&Pn(this.h,2,t.minDetectionConfidence??.5),\"minSuppressionThreshold\"in t&&Pn(this.h,3,t.minSuppressionThreshold??.3),this.l(t)}F(t,e){return this.j={detections:[]},pc(this,t,e),this.j}G(t,e,n){return this.j={detections:[]},gc(this,t,n,e),this.j}m(){var t=new gs;ds(t,\"image_in\"),ds(t,\"norm_rect_in\"),ps(t,\"detections\");const e=new rs;Mr(e,Zs,this.h);const n=new cs;Cn(n,2,\"mediapipe.tasks.vision.face_detector.FaceDetectorGraph\"),os(n,\"IMAGE:image_in\"),os(n,\"NORM_RECT:norm_rect_in\"),as(n,\"DETECTIONS:detections\"),n.o(e),fs(t,n),this.g.attachProtoVectorListener(\"detections\",((t,e)=>{for(const e of t)t=ks(e),this.j.detections.push(Ko(t));pa(this,e)})),this.g.attachEmptyPacketListener(\"detections\",(t=>{pa(this,t)})),t=t.g(),this.setGraph(new Uint8Array(t),!0)}};_c.prototype.detectForVideo=_c.prototype.G,_c.prototype.detect=_c.prototype.F,_c.prototype.setOptions=_c.prototype.o,_c.createFromModelPath=async function(t,e){return fc(_c,t,{baseOptions:{modelAssetPath:e}})},_c.createFromModelBuffer=function(t,e){return fc(_c,t,{baseOptions:{modelAssetBuffer:e}})},_c.createFromOptions=function(t,e){return fc(_c,t,e)};var vc=cc([61,146],[146,91],[91,181],[181,84],[84,17],[17,314],[314,405],[405,321],[321,375],[375,291],[61,185],[185,40],[40,39],[39,37],[37,0],[0,267],[267,269],[269,270],[270,409],[409,291],[78,95],[95,88],[88,178],[178,87],[87,14],[14,317],[317,402],[402,318],[318,324],[324,308],[78,191],[191,80],[80,81],[81,82],[82,13],[13,312],[312,311],[311,310],[310,415],[415,308]),Ec=cc([263,249],[249,390],[390,373],[373,374],[374,380],[380,381],[381,382],[382,362],[263,466],[466,388],[388,387],[387,386],[386,385],[385,384],[384,398],[398,362]),wc=cc([276,283],[283,282],[282,295],[295,285],[300,293],[293,334],[334,296],[296,336]),Tc=cc([474,475],[475,476],[476,477],[477,474]),Ac=cc([33,7],[7,163],[163,144],[144,145],[145,153],[153,154],[154,155],[155,133],[33,246],[246,161],[161,160],[160,159],[159,158],[158,157],[157,173],[173,133]),bc=cc([46,53],[53,52],[52,65],[65,55],[70,63],[63,105],[105,66],[66,107]),kc=cc([469,470],[470,471],[471,472],[472,469]),Sc=cc([10,338],[338,297],[297,332],[332,284],[284,251],[251,389],[389,356],[356,454],[454,323],[323,361],[361,288],[288,397],[397,365],[365,379],[379,378],[378,400],[400,377],[377,152],[152,148],[148,176],[176,149],[149,150],[150,136],[136,172],[172,58],[58,132],[132,93],[93,234],[234,127],[127,162],[162,21],[21,54],[54,103],[103,67],[67,109],[109,10]),xc=[...vc,...Ec,...wc,...Ac,...bc,...Sc],Lc=cc([127,34],[34,139],[139,127],[11,0],[0,37],[37,11],[232,231],[231,120],[120,232],[72,37],[37,39],[39,72],[128,121],[121,47],[47,128],[232,121],[121,128],[128,232],[104,69],[69,67],[67,104],[175,171],[171,148],[148,175],[118,50],[50,101],[101,118],[73,39],[39,40],[40,73],[9,151],[151,108],[108,9],[48,115],[115,131],[131,48],[194,204],[204,211],[211,194],[74,40],[40,185],[185,74],[80,42],[42,183],[183,80],[40,92],[92,186],[186,40],[230,229],[229,118],[118,230],[202,212],[212,214],[214,202],[83,18],[18,17],[17,83],[76,61],[61,146],[146,76],[160,29],[29,30],[30,160],[56,157],[157,173],[173,56],[106,204],[204,194],[194,106],[135,214],[214,192],[192,135],[203,165],[165,98],[98,203],[21,71],[71,68],[68,21],[51,45],[45,4],[4,51],[144,24],[24,23],[23,144],[77,146],[146,91],[91,77],[205,50],[50,187],[187,205],[201,200],[200,18],[18,201],[91,106],[106,182],[182,91],[90,91],[91,181],[181,90],[85,84],[84,17],[17,85],[206,203],[203,36],[36,206],[148,171],[171,140],[140,148],[92,40],[40,39],[39,92],[193,189],[189,244],[244,193],[159,158],[158,28],[28,159],[247,246],[246,161],[161,247],[236,3],[3,196],[196,236],[54,68],[68,104],[104,54],[193,168],[168,8],[8,193],[117,228],[228,31],[31,117],[189,193],[193,55],[55,189],[98,97],[97,99],[99,98],[126,47],[47,100],[100,126],[166,79],[79,218],[218,166],[155,154],[154,26],[26,155],[209,49],[49,131],[131,209],[135,136],[136,150],[150,135],[47,126],[126,217],[217,47],[223,52],[52,53],[53,223],[45,51],[51,134],[134,45],[211,170],[170,140],[140,211],[67,69],[69,108],[108,67],[43,106],[106,91],[91,43],[230,119],[119,120],[120,230],[226,130],[130,247],[247,226],[63,53],[53,52],[52,63],[238,20],[20,242],[242,238],[46,70],[70,156],[156,46],[78,62],[62,96],[96,78],[46,53],[53,63],[63,46],[143,34],[34,227],[227,143],[123,117],[117,111],[111,123],[44,125],[125,19],[19,44],[236,134],[134,51],[51,236],[216,206],[206,205],[205,216],[154,153],[153,22],[22,154],[39,37],[37,167],[167,39],[200,201],[201,208],[208,200],[36,142],[142,100],[100,36],[57,212],[212,202],[202,57],[20,60],[60,99],[99,20],[28,158],[158,157],[157,28],[35,226],[226,113],[113,35],[160,159],[159,27],[27,160],[204,202],[202,210],[210,204],[113,225],[225,46],[46,113],[43,202],[202,204],[204,43],[62,76],[76,77],[77,62],[137,123],[123,116],[116,137],[41,38],[38,72],[72,41],[203,129],[129,142],[142,203],[64,98],[98,240],[240,64],[49,102],[102,64],[64,49],[41,73],[73,74],[74,41],[212,216],[216,207],[207,212],[42,74],[74,184],[184,42],[169,170],[170,211],[211,169],[170,149],[149,176],[176,170],[105,66],[66,69],[69,105],[122,6],[6,168],[168,122],[123,147],[147,187],[187,123],[96,77],[77,90],[90,96],[65,55],[55,107],[107,65],[89,90],[90,180],[180,89],[101,100],[100,120],[120,101],[63,105],[105,104],[104,63],[93,137],[137,227],[227,93],[15,86],[86,85],[85,15],[129,102],[102,49],[49,129],[14,87],[87,86],[86,14],[55,8],[8,9],[9,55],[100,47],[47,121],[121,100],[145,23],[23,22],[22,145],[88,89],[89,179],[179,88],[6,122],[122,196],[196,6],[88,95],[95,96],[96,88],[138,172],[172,136],[136,138],[215,58],[58,172],[172,215],[115,48],[48,219],[219,115],[42,80],[80,81],[81,42],[195,3],[3,51],[51,195],[43,146],[146,61],[61,43],[171,175],[175,199],[199,171],[81,82],[82,38],[38,81],[53,46],[46,225],[225,53],[144,163],[163,110],[110,144],[52,65],[65,66],[66,52],[229,228],[228,117],[117,229],[34,127],[127,234],[234,34],[107,108],[108,69],[69,107],[109,108],[108,151],[151,109],[48,64],[64,235],[235,48],[62,78],[78,191],[191,62],[129,209],[209,126],[126,129],[111,35],[35,143],[143,111],[117,123],[123,50],[50,117],[222,65],[65,52],[52,222],[19,125],[125,141],[141,19],[221,55],[55,65],[65,221],[3,195],[195,197],[197,3],[25,7],[7,33],[33,25],[220,237],[237,44],[44,220],[70,71],[71,139],[139,70],[122,193],[193,245],[245,122],[247,130],[130,33],[33,247],[71,21],[21,162],[162,71],[170,169],[169,150],[150,170],[188,174],[174,196],[196,188],[216,186],[186,92],[92,216],[2,97],[97,167],[167,2],[141,125],[125,241],[241,141],[164,167],[167,37],[37,164],[72,38],[38,12],[12,72],[38,82],[82,13],[13,38],[63,68],[68,71],[71,63],[226,35],[35,111],[111,226],[101,50],[50,205],[205,101],[206,92],[92,165],[165,206],[209,198],[198,217],[217,209],[165,167],[167,97],[97,165],[220,115],[115,218],[218,220],[133,112],[112,243],[243,133],[239,238],[238,241],[241,239],[214,135],[135,169],[169,214],[190,173],[173,133],[133,190],[171,208],[208,32],[32,171],[125,44],[44,237],[237,125],[86,87],[87,178],[178,86],[85,86],[86,179],[179,85],[84,85],[85,180],[180,84],[83,84],[84,181],[181,83],[201,83],[83,182],[182,201],[137,93],[93,132],[132,137],[76,62],[62,183],[183,76],[61,76],[76,184],[184,61],[57,61],[61,185],[185,57],[212,57],[57,186],[186,212],[214,207],[207,187],[187,214],[34,143],[143,156],[156,34],[79,239],[239,237],[237,79],[123,137],[137,177],[177,123],[44,1],[1,4],[4,44],[201,194],[194,32],[32,201],[64,102],[102,129],[129,64],[213,215],[215,138],[138,213],[59,166],[166,219],[219,59],[242,99],[99,97],[97,242],[2,94],[94,141],[141,2],[75,59],[59,235],[235,75],[24,110],[110,228],[228,24],[25,130],[130,226],[226,25],[23,24],[24,229],[229,23],[22,23],[23,230],[230,22],[26,22],[22,231],[231,26],[112,26],[26,232],[232,112],[189,190],[190,243],[243,189],[221,56],[56,190],[190,221],[28,56],[56,221],[221,28],[27,28],[28,222],[222,27],[29,27],[27,223],[223,29],[30,29],[29,224],[224,30],[247,30],[30,225],[225,247],[238,79],[79,20],[20,238],[166,59],[59,75],[75,166],[60,75],[75,240],[240,60],[147,177],[177,215],[215,147],[20,79],[79,166],[166,20],[187,147],[147,213],[213,187],[112,233],[233,244],[244,112],[233,128],[128,245],[245,233],[128,114],[114,188],[188,128],[114,217],[217,174],[174,114],[131,115],[115,220],[220,131],[217,198],[198,236],[236,217],[198,131],[131,134],[134,198],[177,132],[132,58],[58,177],[143,35],[35,124],[124,143],[110,163],[163,7],[7,110],[228,110],[110,25],[25,228],[356,389],[389,368],[368,356],[11,302],[302,267],[267,11],[452,350],[350,349],[349,452],[302,303],[303,269],[269,302],[357,343],[343,277],[277,357],[452,453],[453,357],[357,452],[333,332],[332,297],[297,333],[175,152],[152,377],[377,175],[347,348],[348,330],[330,347],[303,304],[304,270],[270,303],[9,336],[336,337],[337,9],[278,279],[279,360],[360,278],[418,262],[262,431],[431,418],[304,408],[408,409],[409,304],[310,415],[415,407],[407,310],[270,409],[409,410],[410,270],[450,348],[348,347],[347,450],[422,430],[430,434],[434,422],[313,314],[314,17],[17,313],[306,307],[307,375],[375,306],[387,388],[388,260],[260,387],[286,414],[414,398],[398,286],[335,406],[406,418],[418,335],[364,367],[367,416],[416,364],[423,358],[358,327],[327,423],[251,284],[284,298],[298,251],[281,5],[5,4],[4,281],[373,374],[374,253],[253,373],[307,320],[320,321],[321,307],[425,427],[427,411],[411,425],[421,313],[313,18],[18,421],[321,405],[405,406],[406,321],[320,404],[404,405],[405,320],[315,16],[16,17],[17,315],[426,425],[425,266],[266,426],[377,400],[400,369],[369,377],[322,391],[391,269],[269,322],[417,465],[465,464],[464,417],[386,257],[257,258],[258,386],[466,260],[260,388],[388,466],[456,399],[399,419],[419,456],[284,332],[332,333],[333,284],[417,285],[285,8],[8,417],[346,340],[340,261],[261,346],[413,441],[441,285],[285,413],[327,460],[460,328],[328,327],[355,371],[371,329],[329,355],[392,439],[439,438],[438,392],[382,341],[341,256],[256,382],[429,420],[420,360],[360,429],[364,394],[394,379],[379,364],[277,343],[343,437],[437,277],[443,444],[444,283],[283,443],[275,440],[440,363],[363,275],[431,262],[262,369],[369,431],[297,338],[338,337],[337,297],[273,375],[375,321],[321,273],[450,451],[451,349],[349,450],[446,342],[342,467],[467,446],[293,334],[334,282],[282,293],[458,461],[461,462],[462,458],[276,353],[353,383],[383,276],[308,324],[324,325],[325,308],[276,300],[300,293],[293,276],[372,345],[345,447],[447,372],[352,345],[345,340],[340,352],[274,1],[1,19],[19,274],[456,248],[248,281],[281,456],[436,427],[427,425],[425,436],[381,256],[256,252],[252,381],[269,391],[391,393],[393,269],[200,199],[199,428],[428,200],[266,330],[330,329],[329,266],[287,273],[273,422],[422,287],[250,462],[462,328],[328,250],[258,286],[286,384],[384,258],[265,353],[353,342],[342,265],[387,259],[259,257],[257,387],[424,431],[431,430],[430,424],[342,353],[353,276],[276,342],[273,335],[335,424],[424,273],[292,325],[325,307],[307,292],[366,447],[447,345],[345,366],[271,303],[303,302],[302,271],[423,266],[266,371],[371,423],[294,455],[455,460],[460,294],[279,278],[278,294],[294,279],[271,272],[272,304],[304,271],[432,434],[434,427],[427,432],[272,407],[407,408],[408,272],[394,430],[430,431],[431,394],[395,369],[369,400],[400,395],[334,333],[333,299],[299,334],[351,417],[417,168],[168,351],[352,280],[280,411],[411,352],[325,319],[319,320],[320,325],[295,296],[296,336],[336,295],[319,403],[403,404],[404,319],[330,348],[348,349],[349,330],[293,298],[298,333],[333,293],[323,454],[454,447],[447,323],[15,16],[16,315],[315,15],[358,429],[429,279],[279,358],[14,15],[15,316],[316,14],[285,336],[336,9],[9,285],[329,349],[349,350],[350,329],[374,380],[380,252],[252,374],[318,402],[402,403],[403,318],[6,197],[197,419],[419,6],[318,319],[319,325],[325,318],[367,364],[364,365],[365,367],[435,367],[367,397],[397,435],[344,438],[438,439],[439,344],[272,271],[271,311],[311,272],[195,5],[5,281],[281,195],[273,287],[287,291],[291,273],[396,428],[428,199],[199,396],[311,271],[271,268],[268,311],[283,444],[444,445],[445,283],[373,254],[254,339],[339,373],[282,334],[334,296],[296,282],[449,347],[347,346],[346,449],[264,447],[447,454],[454,264],[336,296],[296,299],[299,336],[338,10],[10,151],[151,338],[278,439],[439,455],[455,278],[292,407],[407,415],[415,292],[358,371],[371,355],[355,358],[340,345],[345,372],[372,340],[346,347],[347,280],[280,346],[442,443],[443,282],[282,442],[19,94],[94,370],[370,19],[441,442],[442,295],[295,441],[248,419],[419,197],[197,248],[263,255],[255,359],[359,263],[440,275],[275,274],[274,440],[300,383],[383,368],[368,300],[351,412],[412,465],[465,351],[263,467],[467,466],[466,263],[301,368],[368,389],[389,301],[395,378],[378,379],[379,395],[412,351],[351,419],[419,412],[436,426],[426,322],[322,436],[2,164],[164,393],[393,2],[370,462],[462,461],[461,370],[164,0],[0,267],[267,164],[302,11],[11,12],[12,302],[268,12],[12,13],[13,268],[293,300],[300,301],[301,293],[446,261],[261,340],[340,446],[330,266],[266,425],[425,330],[426,423],[423,391],[391,426],[429,355],[355,437],[437,429],[391,327],[327,326],[326,391],[440,457],[457,438],[438,440],[341,382],[382,362],[362,341],[459,457],[457,461],[461,459],[434,430],[430,394],[394,434],[414,463],[463,362],[362,414],[396,369],[369,262],[262,396],[354,461],[461,457],[457,354],[316,403],[403,402],[402,316],[315,404],[404,403],[403,315],[314,405],[405,404],[404,314],[313,406],[406,405],[405,313],[421,418],[418,406],[406,421],[366,401],[401,361],[361,366],[306,408],[408,407],[407,306],[291,409],[409,408],[408,291],[287,410],[410,409],[409,287],[432,436],[436,410],[410,432],[434,416],[416,411],[411,434],[264,368],[368,383],[383,264],[309,438],[438,457],[457,309],[352,376],[376,401],[401,352],[274,275],[275,4],[4,274],[421,428],[428,262],[262,421],[294,327],[327,358],[358,294],[433,416],[416,367],[367,433],[289,455],[455,439],[439,289],[462,370],[370,326],[326,462],[2,326],[326,370],[370,2],[305,460],[460,455],[455,305],[254,449],[449,448],[448,254],[255,261],[261,446],[446,255],[253,450],[450,449],[449,253],[252,451],[451,450],[450,252],[256,452],[452,451],[451,256],[341,453],[453,452],[452,341],[413,464],[464,463],[463,413],[441,413],[413,414],[414,441],[258,442],[442,441],[441,258],[257,443],[443,442],[442,257],[259,444],[444,443],[443,259],[260,445],[445,444],[444,260],[467,342],[342,445],[445,467],[459,458],[458,250],[250,459],[289,392],[392,290],[290,289],[290,328],[328,460],[460,290],[376,433],[433,435],[435,376],[250,290],[290,392],[392,250],[411,416],[416,433],[433,411],[341,463],[463,464],[464,341],[453,464],[464,465],[465,453],[357,465],[465,412],[412,357],[343,412],[412,399],[399,343],[360,363],[363,440],[440,360],[437,399],[399,456],[456,437],[420,456],[456,363],[363,420],[401,435],[435,288],[288,401],[372,383],[383,353],[353,372],[339,255],[255,249],[249,339],[448,261],[261,255],[255,448],[133,243],[243,190],[190,133],[133,155],[155,112],[112,133],[33,246],[246,247],[247,33],[33,130],[130,25],[25,33],[398,384],[384,286],[286,398],[362,398],[398,414],[414,362],[362,463],[463,341],[341,362],[263,359],[359,467],[467,263],[263,249],[249,255],[255,263],[466,467],[467,260],[260,466],[75,60],[60,166],[166,75],[238,239],[239,79],[79,238],[162,127],[127,139],[139,162],[72,11],[11,37],[37,72],[121,232],[232,120],[120,121],[73,72],[72,39],[39,73],[114,128],[128,47],[47,114],[233,232],[232,128],[128,233],[103,104],[104,67],[67,103],[152,175],[175,148],[148,152],[119,118],[118,101],[101,119],[74,73],[73,40],[40,74],[107,9],[9,108],[108,107],[49,48],[48,131],[131,49],[32,194],[194,211],[211,32],[184,74],[74,185],[185,184],[191,80],[80,183],[183,191],[185,40],[40,186],[186,185],[119,230],[230,118],[118,119],[210,202],[202,214],[214,210],[84,83],[83,17],[17,84],[77,76],[76,146],[146,77],[161,160],[160,30],[30,161],[190,56],[56,173],[173,190],[182,106],[106,194],[194,182],[138,135],[135,192],[192,138],[129,203],[203,98],[98,129],[54,21],[21,68],[68,54],[5,51],[51,4],[4,5],[145,144],[144,23],[23,145],[90,77],[77,91],[91,90],[207,205],[205,187],[187,207],[83,201],[201,18],[18,83],[181,91],[91,182],[182,181],[180,90],[90,181],[181,180],[16,85],[85,17],[17,16],[205,206],[206,36],[36,205],[176,148],[148,140],[140,176],[165,92],[92,39],[39,165],[245,193],[193,244],[244,245],[27,159],[159,28],[28,27],[30,247],[247,161],[161,30],[174,236],[236,196],[196,174],[103,54],[54,104],[104,103],[55,193],[193,8],[8,55],[111,117],[117,31],[31,111],[221,189],[189,55],[55,221],[240,98],[98,99],[99,240],[142,126],[126,100],[100,142],[219,166],[166,218],[218,219],[112,155],[155,26],[26,112],[198,209],[209,131],[131,198],[169,135],[135,150],[150,169],[114,47],[47,217],[217,114],[224,223],[223,53],[53,224],[220,45],[45,134],[134,220],[32,211],[211,140],[140,32],[109,67],[67,108],[108,109],[146,43],[43,91],[91,146],[231,230],[230,120],[120,231],[113,226],[226,247],[247,113],[105,63],[63,52],[52,105],[241,238],[238,242],[242,241],[124,46],[46,156],[156,124],[95,78],[78,96],[96,95],[70,46],[46,63],[63,70],[116,143],[143,227],[227,116],[116,123],[123,111],[111,116],[1,44],[44,19],[19,1],[3,236],[236,51],[51,3],[207,216],[216,205],[205,207],[26,154],[154,22],[22,26],[165,39],[39,167],[167,165],[199,200],[200,208],[208,199],[101,36],[36,100],[100,101],[43,57],[57,202],[202,43],[242,20],[20,99],[99,242],[56,28],[28,157],[157,56],[124,35],[35,113],[113,124],[29,160],[160,27],[27,29],[211,204],[204,210],[210,211],[124,113],[113,46],[46,124],[106,43],[43,204],[204,106],[96,62],[62,77],[77,96],[227,137],[137,116],[116,227],[73,41],[41,72],[72,73],[36,203],[203,142],[142,36],[235,64],[64,240],[240,235],[48,49],[49,64],[64,48],[42,41],[41,74],[74,42],[214,212],[212,207],[207,214],[183,42],[42,184],[184,183],[210,169],[169,211],[211,210],[140,170],[170,176],[176,140],[104,105],[105,69],[69,104],[193,122],[122,168],[168,193],[50,123],[123,187],[187,50],[89,96],[96,90],[90,89],[66,65],[65,107],[107,66],[179,89],[89,180],[180,179],[119,101],[101,120],[120,119],[68,63],[63,104],[104,68],[234,93],[93,227],[227,234],[16,15],[15,85],[85,16],[209,129],[129,49],[49,209],[15,14],[14,86],[86,15],[107,55],[55,9],[9,107],[120,100],[100,121],[121,120],[153,145],[145,22],[22,153],[178,88],[88,179],[179,178],[197,6],[6,196],[196,197],[89,88],[88,96],[96,89],[135,138],[138,136],[136,135],[138,215],[215,172],[172,138],[218,115],[115,219],[219,218],[41,42],[42,81],[81,41],[5,195],[195,51],[51,5],[57,43],[43,61],[61,57],[208,171],[171,199],[199,208],[41,81],[81,38],[38,41],[224,53],[53,225],[225,224],[24,144],[144,110],[110,24],[105,52],[52,66],[66,105],[118,229],[229,117],[117,118],[227,34],[34,234],[234,227],[66,107],[107,69],[69,66],[10,109],[109,151],[151,10],[219,48],[48,235],[235,219],[183,62],[62,191],[191,183],[142,129],[129,126],[126,142],[116,111],[111,143],[143,116],[118,117],[117,50],[50,118],[223,222],[222,52],[52,223],[94,19],[19,141],[141,94],[222,221],[221,65],[65,222],[196,3],[3,197],[197,196],[45,220],[220,44],[44,45],[156,70],[70,139],[139,156],[188,122],[122,245],[245,188],[139,71],[71,162],[162,139],[149,170],[170,150],[150,149],[122,188],[188,196],[196,122],[206,216],[216,92],[92,206],[164,2],[2,167],[167,164],[242,141],[141,241],[241,242],[0,164],[164,37],[37,0],[11,72],[72,12],[12,11],[12,38],[38,13],[13,12],[70,63],[63,71],[71,70],[31,226],[226,111],[111,31],[36,101],[101,205],[205,36],[203,206],[206,165],[165,203],[126,209],[209,217],[217,126],[98,165],[165,97],[97,98],[237,220],[220,218],[218,237],[237,239],[239,241],[241,237],[210,214],[214,169],[169,210],[140,171],[171,32],[32,140],[241,125],[125,237],[237,241],[179,86],[86,178],[178,179],[180,85],[85,179],[179,180],[181,84],[84,180],[180,181],[182,83],[83,181],[181,182],[194,201],[201,182],[182,194],[177,137],[137,132],[132,177],[184,76],[76,183],[183,184],[185,61],[61,184],[184,185],[186,57],[57,185],[185,186],[216,212],[212,186],[186,216],[192,214],[214,187],[187,192],[139,34],[34,156],[156,139],[218,79],[79,237],[237,218],[147,123],[123,177],[177,147],[45,44],[44,4],[4,45],[208,201],[201,32],[32,208],[98,64],[64,129],[129,98],[192,213],[213,138],[138,192],[235,59],[59,219],[219,235],[141,242],[242,97],[97,141],[97,2],[2,141],[141,97],[240,75],[75,235],[235,240],[229,24],[24,228],[228,229],[31,25],[25,226],[226,31],[230,23],[23,229],[229,230],[231,22],[22,230],[230,231],[232,26],[26,231],[231,232],[233,112],[112,232],[232,233],[244,189],[189,243],[243,244],[189,221],[221,190],[190,189],[222,28],[28,221],[221,222],[223,27],[27,222],[222,223],[224,29],[29,223],[223,224],[225,30],[30,224],[224,225],[113,247],[247,225],[225,113],[99,60],[60,240],[240,99],[213,147],[147,215],[215,213],[60,20],[20,166],[166,60],[192,187],[187,213],[213,192],[243,112],[112,244],[244,243],[244,233],[233,245],[245,244],[245,128],[128,188],[188,245],[188,114],[114,174],[174,188],[134,131],[131,220],[220,134],[174,217],[217,236],[236,174],[236,198],[198,134],[134,236],[215,177],[177,58],[58,215],[156,143],[143,124],[124,156],[25,110],[110,7],[7,25],[31,228],[228,25],[25,31],[264,356],[356,368],[368,264],[0,11],[11,267],[267,0],[451,452],[452,349],[349,451],[267,302],[302,269],[269,267],[350,357],[357,277],[277,350],[350,452],[452,357],[357,350],[299,333],[333,297],[297,299],[396,175],[175,377],[377,396],[280,347],[347,330],[330,280],[269,303],[303,270],[270,269],[151,9],[9,337],[337,151],[344,278],[278,360],[360,344],[424,418],[418,431],[431,424],[270,304],[304,409],[409,270],[272,310],[310,407],[407,272],[322,270],[270,410],[410,322],[449,450],[450,347],[347,449],[432,422],[422,434],[434,432],[18,313],[313,17],[17,18],[291,306],[306,375],[375,291],[259,387],[387,260],[260,259],[424,335],[335,418],[418,424],[434,364],[364,416],[416,434],[391,423],[423,327],[327,391],[301,251],[251,298],[298,301],[275,281],[281,4],[4,275],[254,373],[373,253],[253,254],[375,307],[307,321],[321,375],[280,425],[425,411],[411,280],[200,421],[421,18],[18,200],[335,321],[321,406],[406,335],[321,320],[320,405],[405,321],[314,315],[315,17],[17,314],[423,426],[426,266],[266,423],[396,377],[377,369],[369,396],[270,322],[322,269],[269,270],[413,417],[417,464],[464,413],[385,386],[386,258],[258,385],[248,456],[456,419],[419,248],[298,284],[284,333],[333,298],[168,417],[417,8],[8,168],[448,346],[346,261],[261,448],[417,413],[413,285],[285,417],[326,327],[327,328],[328,326],[277,355],[355,329],[329,277],[309,392],[392,438],[438,309],[381,382],[382,256],[256,381],[279,429],[429,360],[360,279],[365,364],[364,379],[379,365],[355,277],[277,437],[437,355],[282,443],[443,283],[283,282],[281,275],[275,363],[363,281],[395,431],[431,369],[369,395],[299,297],[297,337],[337,299],[335,273],[273,321],[321,335],[348,450],[450,349],[349,348],[359,446],[446,467],[467,359],[283,293],[293,282],[282,283],[250,458],[458,462],[462,250],[300,276],[276,383],[383,300],[292,308],[308,325],[325,292],[283,276],[276,293],[293,283],[264,372],[372,447],[447,264],[346,352],[352,340],[340,346],[354,274],[274,19],[19,354],[363,456],[456,281],[281,363],[426,436],[436,425],[425,426],[380,381],[381,252],[252,380],[267,269],[269,393],[393,267],[421,200],[200,428],[428,421],[371,266],[266,329],[329,371],[432,287],[287,422],[422,432],[290,250],[250,328],[328,290],[385,258],[258,384],[384,385],[446,265],[265,342],[342,446],[386,387],[387,257],[257,386],[422,424],[424,430],[430,422],[445,342],[342,276],[276,445],[422,273],[273,424],[424,422],[306,292],[292,307],[307,306],[352,366],[366,345],[345,352],[268,271],[271,302],[302,268],[358,423],[423,371],[371,358],[327,294],[294,460],[460,327],[331,279],[279,294],[294,331],[303,271],[271,304],[304,303],[436,432],[432,427],[427,436],[304,272],[272,408],[408,304],[395,394],[394,431],[431,395],[378,395],[395,400],[400,378],[296,334],[334,299],[299,296],[6,351],[351,168],[168,6],[376,352],[352,411],[411,376],[307,325],[325,320],[320,307],[285,295],[295,336],[336,285],[320,319],[319,404],[404,320],[329,330],[330,349],[349,329],[334,293],[293,333],[333,334],[366,323],[323,447],[447,366],[316,15],[15,315],[315,316],[331,358],[358,279],[279,331],[317,14],[14,316],[316,317],[8,285],[285,9],[9,8],[277,329],[329,350],[350,277],[253,374],[374,252],[252,253],[319,318],[318,403],[403,319],[351,6],[6,419],[419,351],[324,318],[318,325],[325,324],[397,367],[367,365],[365,397],[288,435],[435,397],[397,288],[278,344],[344,439],[439,278],[310,272],[272,311],[311,310],[248,195],[195,281],[281,248],[375,273],[273,291],[291,375],[175,396],[396,199],[199,175],[312,311],[311,268],[268,312],[276,283],[283,445],[445,276],[390,373],[373,339],[339,390],[295,282],[282,296],[296,295],[448,449],[449,346],[346,448],[356,264],[264,454],[454,356],[337,336],[336,299],[299,337],[337,338],[338,151],[151,337],[294,278],[278,455],[455,294],[308,292],[292,415],[415,308],[429,358],[358,355],[355,429],[265,340],[340,372],[372,265],[352,346],[346,280],[280,352],[295,442],[442,282],[282,295],[354,19],[19,370],[370,354],[285,441],[441,295],[295,285],[195,248],[248,197],[197,195],[457,440],[440,274],[274,457],[301,300],[300,368],[368,301],[417,351],[351,465],[465,417],[251,301],[301,389],[389,251],[394,395],[395,379],[379,394],[399,412],[412,419],[419,399],[410,436],[436,322],[322,410],[326,2],[2,393],[393,326],[354,370],[370,461],[461,354],[393,164],[164,267],[267,393],[268,302],[302,12],[12,268],[312,268],[268,13],[13,312],[298,293],[293,301],[301,298],[265,446],[446,340],[340,265],[280,330],[330,425],[425,280],[322,426],[426,391],[391,322],[420,429],[429,437],[437,420],[393,391],[391,326],[326,393],[344,440],[440,438],[438,344],[458,459],[459,461],[461,458],[364,434],[434,394],[394,364],[428,396],[396,262],[262,428],[274,354],[354,457],[457,274],[317,316],[316,402],[402,317],[316,315],[315,403],[403,316],[315,314],[314,404],[404,315],[314,313],[313,405],[405,314],[313,421],[421,406],[406,313],[323,366],[366,361],[361,323],[292,306],[306,407],[407,292],[306,291],[291,408],[408,306],[291,287],[287,409],[409,291],[287,432],[432,410],[410,287],[427,434],[434,411],[411,427],[372,264],[264,383],[383,372],[459,309],[309,457],[457,459],[366,352],[352,401],[401,366],[1,274],[274,4],[4,1],[418,421],[421,262],[262,418],[331,294],[294,358],[358,331],[435,433],[433,367],[367,435],[392,289],[289,439],[439,392],[328,462],[462,326],[326,328],[94,2],[2,370],[370,94],[289,305],[305,455],[455,289],[339,254],[254,448],[448,339],[359,255],[255,446],[446,359],[254,253],[253,449],[449,254],[253,252],[252,450],[450,253],[252,256],[256,451],[451,252],[256,341],[341,452],[452,256],[414,413],[413,463],[463,414],[286,441],[441,414],[414,286],[286,258],[258,441],[441,286],[258,257],[257,442],[442,258],[257,259],[259,443],[443,257],[259,260],[260,444],[444,259],[260,467],[467,445],[445,260],[309,459],[459,250],[250,309],[305,289],[289,290],[290,305],[305,290],[290,460],[460,305],[401,376],[376,435],[435,401],[309,250],[250,392],[392,309],[376,411],[411,433],[433,376],[453,341],[341,464],[464,453],[357,453],[453,465],[465,357],[343,357],[357,412],[412,343],[437,343],[343,399],[399,437],[344,360],[360,440],[440,344],[420,437],[437,456],[456,420],[360,420],[420,363],[363,360],[361,401],[401,288],[288,361],[265,372],[372,353],[353,265],[390,339],[339,249],[249,390],[339,448],[448,255],[255,339]);function Rc(t){t.j={faceLandmarks:[],faceBlendshapes:[],facialTransformationMatrixes:[]}}var Ic=class extends yc{constructor(t,e){super(new lc(t,e),\"image_in\",\"norm_rect\",!1),this.j={faceLandmarks:[],faceBlendshapes:[],facialTransformationMatrixes:[]},this.outputFacialTransformationMatrixes=this.outputFaceBlendshapes=!1,kn(t=this.h=new eo,0,1,e=new Ks),this.A=new to,kn(this.h,0,3,this.A),this.u=new $s,kn(this.h,0,2,this.u),Mn(this.u,4,1),Pn(this.u,2,.5),Pn(this.A,2,.5),Pn(this.h,4,.5)}get baseOptions(){return wn(this.h,Ks,1)}set baseOptions(t){kn(this.h,0,1,t)}o(t){return\"numFaces\"in t&&Mn(this.u,4,t.numFaces??1),\"minFaceDetectionConfidence\"in t&&Pn(this.u,2,t.minFaceDetectionConfidence??.5),\"minTrackingConfidence\"in t&&Pn(this.h,4,t.minTrackingConfidence??.5),\"minFacePresenceConfidence\"in t&&Pn(this.A,2,t.minFacePresenceConfidence??.5),\"outputFaceBlendshapes\"in t&&(this.outputFaceBlendshapes=!!t.outputFaceBlendshapes),\"outputFacialTransformationMatrixes\"in t&&(this.outputFacialTransformationMatrixes=!!t.outputFacialTransformationMatrixes),this.l(t)}F(t,e){return Rc(this),pc(this,t,e),this.j}G(t,e,n){return Rc(this),gc(this,t,n,e),this.j}m(){var t=new gs;ds(t,\"image_in\"),ds(t,\"norm_rect\"),ps(t,\"face_landmarks\");const e=new rs;Mr(e,ro,this.h);const n=new cs;Cn(n,2,\"mediapipe.tasks.vision.face_landmarker.FaceLandmarkerGraph\"),os(n,\"IMAGE:image_in\"),os(n,\"NORM_RECT:norm_rect\"),as(n,\"NORM_LANDMARKS:face_landmarks\"),n.o(e),fs(t,n),this.g.attachProtoVectorListener(\"face_landmarks\",((t,e)=>{for(const e of t)t=Rs(e),this.j.faceLandmarks.push(Yo(t));pa(this,e)})),this.g.attachEmptyPacketListener(\"face_landmarks\",(t=>{pa(this,t)})),this.outputFaceBlendshapes&&(ps(t,\"blendshapes\"),as(n,\"BLENDSHAPES:blendshapes\"),this.g.attachProtoVectorListener(\"blendshapes\",((t,e)=>{if(this.outputFaceBlendshapes)for(const e of t)t=ws(e),this.j.faceBlendshapes.push(Wo(t.g()??[]));pa(this,e)})),this.g.attachEmptyPacketListener(\"blendshapes\",(t=>{pa(this,t)}))),this.outputFacialTransformationMatrixes&&(ps(t,\"face_geometry\"),as(n,\"FACE_GEOMETRY:face_geometry\"),this.g.attachProtoVectorListener(\"face_geometry\",((t,e)=>{if(this.outputFacialTransformationMatrixes)for(const e of t)(t=wn(t=Qs(e),Is,2))&&this.j.facialTransformationMatrixes.push({rows:Rn(t,1)??0??0,columns:Rn(t,2)??0??0,data:on(t,3,Qt,sn()).slice()??[]});pa(this,e)})),this.g.attachEmptyPacketListener(\"face_geometry\",(t=>{pa(this,t)}))),t=t.g(),this.setGraph(new Uint8Array(t),!0)}};Ic.prototype.detectForVideo=Ic.prototype.G,Ic.prototype.detect=Ic.prototype.F,Ic.prototype.setOptions=Ic.prototype.o,Ic.createFromModelPath=function(t,e){return fc(Ic,t,{baseOptions:{modelAssetPath:e}})},Ic.createFromModelBuffer=function(t,e){return fc(Ic,t,{baseOptions:{modelAssetBuffer:e}})},Ic.createFromOptions=function(t,e){return fc(Ic,t,e)},Ic.FACE_LANDMARKS_LIPS=vc,Ic.FACE_LANDMARKS_LEFT_EYE=Ec,Ic.FACE_LANDMARKS_LEFT_EYEBROW=wc,Ic.FACE_LANDMARKS_LEFT_IRIS=Tc,Ic.FACE_LANDMARKS_RIGHT_EYE=Ac,Ic.FACE_LANDMARKS_RIGHT_EYEBROW=bc,Ic.FACE_LANDMARKS_RIGHT_IRIS=kc,Ic.FACE_LANDMARKS_FACE_OVAL=Sc,Ic.FACE_LANDMARKS_CONTOURS=xc,Ic.FACE_LANDMARKS_TESSELATION=Lc;var Fc=cc([0,1],[1,2],[2,3],[3,4],[0,5],[5,6],[6,7],[7,8],[5,9],[9,10],[10,11],[11,12],[9,13],[13,14],[14,15],[15,16],[13,17],[0,17],[17,18],[18,19],[19,20]);function Mc(t){t.gestures=[],t.landmarks=[],t.worldLandmarks=[],t.handedness=[]}function Pc(t){return 0===t.gestures.length?{gestures:[],landmarks:[],worldLandmarks:[],handedness:[],handednesses:[]}:{gestures:t.gestures,landmarks:t.landmarks,worldLandmarks:t.worldLandmarks,handedness:t.handedness,handednesses:t.handedness}}function Cc(t,e=!0){const n=[];for(const i of t){var r=ws(i);t=[];for(const n of r.g())r=e&&null!=Rn(n,1)?Rn(n,1)??0:-1,t.push({score:Fn(n,2)??0,index:r,categoryName:ge(tn(n,3))??\"\"??\"\",displayName:ge(tn(n,4))??\"\"??\"\"});n.push(t)}return n}var Oc=class extends yc{constructor(t,e){super(new lc(t,e),\"image_in\",\"norm_rect\",!1),this.gestures=[],this.landmarks=[],this.worldLandmarks=[],this.handedness=[],kn(t=this.j=new uo,0,1,e=new Ks),this.u=new ho,kn(this.j,0,2,this.u),this.D=new co,kn(this.u,0,3,this.D),this.A=new ao,kn(this.u,0,2,this.A),this.h=new oo,kn(this.j,0,3,this.h),Pn(this.A,2,.5),Pn(this.u,4,.5),Pn(this.D,2,.5)}get baseOptions(){return wn(this.j,Ks,1)}set baseOptions(t){kn(this.j,0,1,t)}o(t){if(Mn(this.A,3,t.numHands??1),\"minHandDetectionConfidence\"in t&&Pn(this.A,2,t.minHandDetectionConfidence??.5),\"minTrackingConfidence\"in t&&Pn(this.u,4,t.minTrackingConfidence??.5),\"minHandPresenceConfidence\"in t&&Pn(this.D,2,t.minHandPresenceConfidence??.5),t.cannedGesturesClassifierOptions){var e=new io,n=e,r=Xo(t.cannedGesturesClassifierOptions,wn(this.h,io,3)?.l());kn(n,0,2,r),kn(this.h,0,3,e)}else void 0===t.cannedGesturesClassifierOptions&&wn(this.h,io,3)?.g();return t.customGesturesClassifierOptions?(kn(n=e=new io,0,2,r=Xo(t.customGesturesClassifierOptions,wn(this.h,io,4)?.l())),kn(this.h,0,4,e)):void 0===t.customGesturesClassifierOptions&&wn(this.h,io,4)?.g(),this.l(t)}Ha(t,e){return Mc(this),pc(this,t,e),Pc(this)}Ia(t,e,n){return Mc(this),gc(this,t,n,e),Pc(this)}m(){var t=new gs;ds(t,\"image_in\"),ds(t,\"norm_rect\"),ps(t,\"hand_gestures\"),ps(t,\"hand_landmarks\"),ps(t,\"world_hand_landmarks\"),ps(t,\"handedness\");const e=new rs;Mr(e,mo,this.j);const n=new cs;Cn(n,2,\"mediapipe.tasks.vision.gesture_recognizer.GestureRecognizerGraph\"),os(n,\"IMAGE:image_in\"),os(n,\"NORM_RECT:norm_rect\"),as(n,\"HAND_GESTURES:hand_gestures\"),as(n,\"LANDMARKS:hand_landmarks\"),as(n,\"WORLD_LANDMARKS:world_hand_landmarks\"),as(n,\"HANDEDNESS:handedness\"),n.o(e),fs(t,n),this.g.attachProtoVectorListener(\"hand_landmarks\",((t,e)=>{for(const e of t){t=Rs(e);const n=[];for(const e of An(t,Ls,1))n.push({x:Fn(e,1)??0,y:Fn(e,2)??0,z:Fn(e,3)??0,visibility:Fn(e,4)??0});this.landmarks.push(n)}pa(this,e)})),this.g.attachEmptyPacketListener(\"hand_landmarks\",(t=>{pa(this,t)})),this.g.attachProtoVectorListener(\"world_hand_landmarks\",((t,e)=>{for(const e of t){t=xs(e);const n=[];for(const e of An(t,Ss,1))n.push({x:Fn(e,1)??0,y:Fn(e,2)??0,z:Fn(e,3)??0,visibility:Fn(e,4)??0});this.worldLandmarks.push(n)}pa(this,e)})),this.g.attachEmptyPacketListener(\"world_hand_landmarks\",(t=>{pa(this,t)})),this.g.attachProtoVectorListener(\"hand_gestures\",((t,e)=>{this.gestures.push(...Cc(t,!1)),pa(this,e)})),this.g.attachEmptyPacketListener(\"hand_gestures\",(t=>{pa(this,t)})),this.g.attachProtoVectorListener(\"handedness\",((t,e)=>{this.handedness.push(...Cc(t)),pa(this,e)})),this.g.attachEmptyPacketListener(\"handedness\",(t=>{pa(this,t)})),t=t.g(),this.setGraph(new Uint8Array(t),!0)}};function Nc(t){return{landmarks:t.landmarks,worldLandmarks:t.worldLandmarks,handednesses:t.handedness,handedness:t.handedness}}Oc.prototype.recognizeForVideo=Oc.prototype.Ia,Oc.prototype.recognize=Oc.prototype.Ha,Oc.prototype.setOptions=Oc.prototype.o,Oc.createFromModelPath=function(t,e){return fc(Oc,t,{baseOptions:{modelAssetPath:e}})},Oc.createFromModelBuffer=function(t,e){return fc(Oc,t,{baseOptions:{modelAssetBuffer:e}})},Oc.createFromOptions=function(t,e){return fc(Oc,t,e)},Oc.HAND_CONNECTIONS=Fc;var Uc=class extends yc{constructor(t,e){super(new lc(t,e),\"image_in\",\"norm_rect\",!1),this.landmarks=[],this.worldLandmarks=[],this.handedness=[],kn(t=this.h=new ho,0,1,e=new Ks),this.u=new co,kn(this.h,0,3,this.u),this.j=new ao,kn(this.h,0,2,this.j),Mn(this.j,3,1),Pn(this.j,2,.5),Pn(this.u,2,.5),Pn(this.h,4,.5)}get baseOptions(){return wn(this.h,Ks,1)}set baseOptions(t){kn(this.h,0,1,t)}o(t){return\"numHands\"in t&&Mn(this.j,3,t.numHands??1),\"minHandDetectionConfidence\"in t&&Pn(this.j,2,t.minHandDetectionConfidence??.5),\"minTrackingConfidence\"in t&&Pn(this.h,4,t.minTrackingConfidence??.5),\"minHandPresenceConfidence\"in t&&Pn(this.u,2,t.minHandPresenceConfidence??.5),this.l(t)}F(t,e){return this.landmarks=[],this.worldLandmarks=[],this.handedness=[],pc(this,t,e),Nc(this)}G(t,e,n){return this.landmarks=[],this.worldLandmarks=[],this.handedness=[],gc(this,t,n,e),Nc(this)}m(){var t=new gs;ds(t,\"image_in\"),ds(t,\"norm_rect\"),ps(t,\"hand_landmarks\"),ps(t,\"world_hand_landmarks\"),ps(t,\"handedness\");const e=new rs;Mr(e,yo,this.h);const n=new cs;Cn(n,2,\"mediapipe.tasks.vision.hand_landmarker.HandLandmarkerGraph\"),os(n,\"IMAGE:image_in\"),os(n,\"NORM_RECT:norm_rect\"),as(n,\"LANDMARKS:hand_landmarks\"),as(n,\"WORLD_LANDMARKS:world_hand_landmarks\"),as(n,\"HANDEDNESS:handedness\"),n.o(e),fs(t,n),this.g.attachProtoVectorListener(\"hand_landmarks\",((t,e)=>{for(const e of t)t=Rs(e),this.landmarks.push(Yo(t));pa(this,e)})),this.g.attachEmptyPacketListener(\"hand_landmarks\",(t=>{pa(this,t)})),this.g.attachProtoVectorListener(\"world_hand_landmarks\",((t,e)=>{for(const e of t)t=xs(e),this.worldLandmarks.push(qo(t));pa(this,e)})),this.g.attachEmptyPacketListener(\"world_hand_landmarks\",(t=>{pa(this,t)})),this.g.attachProtoVectorListener(\"handedness\",((t,e)=>{var n=this.handedness,r=n.push;const i=[];for(const e of t){t=ws(e);const n=[];for(const e of t.g())n.push({score:Fn(e,2)??0,index:Rn(e,1)??0??-1,categoryName:ge(tn(e,3))??\"\"??\"\",displayName:ge(tn(e,4))??\"\"??\"\"});i.push(n)}r.call(n,...i),pa(this,e)})),this.g.attachEmptyPacketListener(\"handedness\",(t=>{pa(this,t)})),t=t.g(),this.setGraph(new Uint8Array(t),!0)}};Uc.prototype.detectForVideo=Uc.prototype.G,Uc.prototype.detect=Uc.prototype.F,Uc.prototype.setOptions=Uc.prototype.o,Uc.createFromModelPath=function(t,e){return fc(Uc,t,{baseOptions:{modelAssetPath:e}})},Uc.createFromModelBuffer=function(t,e){return fc(Uc,t,{baseOptions:{modelAssetBuffer:e}})},Uc.createFromOptions=function(t,e){return fc(Uc,t,e)},Uc.HAND_CONNECTIONS=Fc;var Dc=cc([0,1],[1,2],[2,3],[3,7],[0,4],[4,5],[5,6],[6,8],[9,10],[11,12],[11,13],[13,15],[15,17],[15,19],[15,21],[17,19],[12,14],[14,16],[16,18],[16,20],[16,22],[18,20],[11,23],[12,24],[23,24],[23,25],[24,26],[25,27],[26,28],[27,29],[28,30],[29,31],[30,32],[27,31],[28,32]);function Bc(t){t.h={faceLandmarks:[],faceBlendshapes:[],poseLandmarks:[],poseWorldLandmarks:[],poseSegmentationMasks:[],leftHandLandmarks:[],leftHandWorldLandmarks:[],rightHandLandmarks:[],rightHandWorldLandmarks:[]}}function Gc(t){try{if(!t.D)return t.h;t.D(t.h)}finally{ya(t)}}function jc(t,e){t=Rs(t),e.push(Yo(t))}var Vc=class extends yc{constructor(t,e){super(new lc(t,e),\"input_frames_image\",null,!1),this.h={faceLandmarks:[],faceBlendshapes:[],poseLandmarks:[],poseWorldLandmarks:[],poseSegmentationMasks:[],leftHandLandmarks:[],leftHandWorldLandmarks:[],rightHandLandmarks:[],rightHandWorldLandmarks:[]},this.outputPoseSegmentationMasks=this.outputFaceBlendshapes=!1,kn(t=this.j=new wo,0,1,e=new Ks),this.I=new co,kn(this.j,0,2,this.I),this.W=new _o,kn(this.j,0,3,this.W),this.u=new $s,kn(this.j,0,4,this.u),this.O=new to,kn(this.j,0,5,this.O),this.A=new vo,kn(this.j,0,6,this.A),this.M=new Eo,kn(this.j,0,7,this.M),Pn(this.u,2,.5),Pn(this.u,3,.3),Pn(this.O,2,.5),Pn(this.A,2,.5),Pn(this.A,3,.3),Pn(this.M,2,.5),Pn(this.I,2,.5)}get baseOptions(){return wn(this.j,Ks,1)}set baseOptions(t){kn(this.j,0,1,t)}o(t){return\"minFaceDetectionConfidence\"in t&&Pn(this.u,2,t.minFaceDetectionConfidence??.5),\"minFaceSuppressionThreshold\"in t&&Pn(this.u,3,t.minFaceSuppressionThreshold??.3),\"minFacePresenceConfidence\"in t&&Pn(this.O,2,t.minFacePresenceConfidence??.5),\"outputFaceBlendshapes\"in t&&(this.outputFaceBlendshapes=!!t.outputFaceBlendshapes),\"minPoseDetectionConfidence\"in t&&Pn(this.A,2,t.minPoseDetectionConfidence??.5),\"minPoseSuppressionThreshold\"in t&&Pn(this.A,3,t.minPoseSuppressionThreshold??.3),\"minPosePresenceConfidence\"in t&&Pn(this.M,2,t.minPosePresenceConfidence??.5),\"outputPoseSegmentationMasks\"in t&&(this.outputPoseSegmentationMasks=!!t.outputPoseSegmentationMasks),\"minHandLandmarksConfidence\"in t&&Pn(this.I,2,t.minHandLandmarksConfidence??.5),this.l(t)}F(t,e,n){const r=\"function\"!=typeof e?e:{};return this.D=\"function\"==typeof e?e:n,Bc(this),pc(this,t,r),Gc(this)}G(t,e,n,r){const i=\"function\"!=typeof n?n:{};return this.D=\"function\"==typeof n?n:r,Bc(this),gc(this,t,i,e),Gc(this)}m(){var t=new gs;ds(t,\"input_frames_image\"),ps(t,\"pose_landmarks\"),ps(t,\"pose_world_landmarks\"),ps(t,\"face_landmarks\"),ps(t,\"left_hand_landmarks\"),ps(t,\"left_hand_world_landmarks\"),ps(t,\"right_hand_landmarks\"),ps(t,\"right_hand_world_landmarks\");const e=new rs,n=new Xi;Cn(n,1,\"type.googleapis.com/mediapipe.tasks.vision.holistic_landmarker.proto.HolisticLandmarkerGraphOptions\"),function(t,e){if(null!=e)if(Array.isArray(e))nn(t,2,Ce(e,0,Ne));else{if(!(\"string\"==typeof e||e instanceof P||R(e)))throw Error(\"invalid value in Any.value field: \"+e+\" expected a ByteString, a base64 encoded string, a Uint8Array or a jspb array\");dn(t,2,lt(e,!1),F())}}(n,this.j.g());const r=new cs;Cn(r,2,\"mediapipe.tasks.vision.holistic_landmarker.HolisticLandmarkerGraph\"),Ln(r,8,Xi,n),os(r,\"IMAGE:input_frames_image\"),as(r,\"POSE_LANDMARKS:pose_landmarks\"),as(r,\"POSE_WORLD_LANDMARKS:pose_world_landmarks\"),as(r,\"FACE_LANDMARKS:face_landmarks\"),as(r,\"LEFT_HAND_LANDMARKS:left_hand_landmarks\"),as(r,\"LEFT_HAND_WORLD_LANDMARKS:left_hand_world_landmarks\"),as(r,\"RIGHT_HAND_LANDMARKS:right_hand_landmarks\"),as(r,\"RIGHT_HAND_WORLD_LANDMARKS:right_hand_world_landmarks\"),r.o(e),fs(t,r),ga(this,t),this.g.attachProtoListener(\"pose_landmarks\",((t,e)=>{jc(t,this.h.poseLandmarks),pa(this,e)})),this.g.attachEmptyPacketListener(\"pose_landmarks\",(t=>{pa(this,t)})),this.g.attachProtoListener(\"pose_world_landmarks\",((t,e)=>{var n=this.h.poseWorldLandmarks;t=xs(t),n.push(qo(t)),pa(this,e)})),this.g.attachEmptyPacketListener(\"pose_world_landmarks\",(t=>{pa(this,t)})),this.outputPoseSegmentationMasks&&(as(r,\"POSE_SEGMENTATION_MASK:pose_segmentation_mask\"),ma(this,\"pose_segmentation_mask\"),this.g.Z(\"pose_segmentation_mask\",((t,e)=>{this.h.poseSegmentationMasks=[mc(this,t,!0,!this.D)],pa(this,e)})),this.g.attachEmptyPacketListener(\"pose_segmentation_mask\",(t=>{this.h.poseSegmentationMasks=[],pa(this,t)}))),this.g.attachProtoListener(\"face_landmarks\",((t,e)=>{jc(t,this.h.faceLandmarks),pa(this,e)})),this.g.attachEmptyPacketListener(\"face_landmarks\",(t=>{pa(this,t)})),this.outputFaceBlendshapes&&(ps(t,\"extra_blendshapes\"),as(r,\"FACE_BLENDSHAPES:extra_blendshapes\"),this.g.attachProtoListener(\"extra_blendshapes\",((t,e)=>{var n=this.h.faceBlendshapes;this.outputFaceBlendshapes&&(t=ws(t),n.push(Wo(t.g()??[]))),pa(this,e)})),this.g.attachEmptyPacketListener(\"extra_blendshapes\",(t=>{pa(this,t)}))),this.g.attachProtoListener(\"left_hand_landmarks\",((t,e)=>{jc(t,this.h.leftHandLandmarks),pa(this,e)})),this.g.attachEmptyPacketListener(\"left_hand_landmarks\",(t=>{pa(this,t)})),this.g.attachProtoListener(\"left_hand_world_landmarks\",((t,e)=>{var n=this.h.leftHandWorldLandmarks;t=xs(t),n.push(qo(t)),pa(this,e)})),this.g.attachEmptyPacketListener(\"left_hand_world_landmarks\",(t=>{pa(this,t)})),this.g.attachProtoListener(\"right_hand_landmarks\",((t,e)=>{jc(t,this.h.rightHandLandmarks),pa(this,e)})),this.g.attachEmptyPacketListener(\"right_hand_landmarks\",(t=>{pa(this,t)})),this.g.attachProtoListener(\"right_hand_world_landmarks\",((t,e)=>{var n=this.h.rightHandWorldLandmarks;t=xs(t),n.push(qo(t)),pa(this,e)})),this.g.attachEmptyPacketListener(\"right_hand_world_landmarks\",(t=>{pa(this,t)})),t=t.g(),this.setGraph(new Uint8Array(t),!0)}};Vc.prototype.detectForVideo=Vc.prototype.G,Vc.prototype.detect=Vc.prototype.F,Vc.prototype.setOptions=Vc.prototype.o,Vc.createFromModelPath=function(t,e){return fc(Vc,t,{baseOptions:{modelAssetPath:e}})},Vc.createFromModelBuffer=function(t,e){return fc(Vc,t,{baseOptions:{modelAssetBuffer:e}})},Vc.createFromOptions=function(t,e){return fc(Vc,t,e)},Vc.HAND_CONNECTIONS=Fc,Vc.POSE_CONNECTIONS=Dc,Vc.FACE_LANDMARKS_LIPS=vc,Vc.FACE_LANDMARKS_LEFT_EYE=Ec,Vc.FACE_LANDMARKS_LEFT_EYEBROW=wc,Vc.FACE_LANDMARKS_LEFT_IRIS=Tc,Vc.FACE_LANDMARKS_RIGHT_EYE=Ac,Vc.FACE_LANDMARKS_RIGHT_EYEBROW=bc,Vc.FACE_LANDMARKS_RIGHT_IRIS=kc,Vc.FACE_LANDMARKS_FACE_OVAL=Sc,Vc.FACE_LANDMARKS_CONTOURS=xc,Vc.FACE_LANDMARKS_TESSELATION=Lc;var Xc=class extends yc{constructor(t,e){super(new lc(t,e),\"input_image\",\"norm_rect\",!0),this.j={classifications:[]},kn(t=this.h=new bo,0,1,e=new Ks)}get baseOptions(){return wn(this.h,Ks,1)}set baseOptions(t){kn(this.h,0,1,t)}o(t){return kn(this.h,0,2,Xo(t,wn(this.h,Gs,2))),this.l(t)}sa(t,e){return this.j={classifications:[]},pc(this,t,e),this.j}ta(t,e,n){return this.j={classifications:[]},gc(this,t,n,e),this.j}m(){var t=new gs;ds(t,\"input_image\"),ds(t,\"norm_rect\"),ps(t,\"classifications\");const e=new rs;Mr(e,ko,this.h);const n=new cs;Cn(n,2,\"mediapipe.tasks.vision.image_classifier.ImageClassifierGraph\"),os(n,\"IMAGE:input_image\"),os(n,\"NORM_RECT:norm_rect\"),as(n,\"CLASSIFICATIONS:classifications\"),n.o(e),fs(t,n),this.g.attachProtoListener(\"classifications\",((t,e)=>{this.j=zo(Cs(t)),pa(this,e)})),this.g.attachEmptyPacketListener(\"classifications\",(t=>{pa(this,t)})),t=t.g(),this.setGraph(new Uint8Array(t),!0)}};Xc.prototype.classifyForVideo=Xc.prototype.ta,Xc.prototype.classify=Xc.prototype.sa,Xc.prototype.setOptions=Xc.prototype.o,Xc.createFromModelPath=function(t,e){return fc(Xc,t,{baseOptions:{modelAssetPath:e}})},Xc.createFromModelBuffer=function(t,e){return fc(Xc,t,{baseOptions:{modelAssetBuffer:e}})},Xc.createFromOptions=function(t,e){return fc(Xc,t,e)};var Hc=class extends yc{constructor(t,e){super(new lc(t,e),\"image_in\",\"norm_rect\",!0),this.h=new So,this.embeddings={embeddings:[]},kn(t=this.h,0,1,e=new Ks)}get baseOptions(){return wn(this.h,Ks,1)}set baseOptions(t){kn(this.h,0,1,t)}o(t){var e=this.h,n=wn(this.h,Vs,2);return n=n?n.clone():new Vs,void 0!==t.l2Normalize?nn(n,1,te(t.l2Normalize)):\"l2Normalize\"in t&&nn(n,1),void 0!==t.quantize?nn(n,2,te(t.quantize)):\"quantize\"in t&&nn(n,2),kn(e,0,2,n),this.l(t)}za(t,e){return pc(this,t,e),this.embeddings}Aa(t,e,n){return gc(this,t,n,e),this.embeddings}m(){var t=new gs;ds(t,\"image_in\"),ds(t,\"norm_rect\"),ps(t,\"embeddings_out\");const e=new rs;Mr(e,xo,this.h);const n=new cs;Cn(n,2,\"mediapipe.tasks.vision.image_embedder.ImageEmbedderGraph\"),os(n,\"IMAGE:image_in\"),os(n,\"NORM_RECT:norm_rect\"),as(n,\"EMBEDDINGS:embeddings_out\"),n.o(e),fs(t,n),this.g.attachProtoListener(\"embeddings_out\",((t,e)=>{t=Bs(t),this.embeddings=function(t){return{embeddings:An(t,Us,1).map((t=>{const e={headIndex:Rn(t,3)??0??-1,headName:ge(tn(t,4))??\"\"??\"\"};var n=t.v;return void 0!==En(n,0|n[et],Os,gn(t,1))?(t=on(t=wn(t,Os,gn(t,1),void 0),1,Qt,sn()),e.floatEmbedding=t.slice()):(n=new Uint8Array(0),e.quantizedEmbedding=wn(t,Ns,gn(t,2),void 0)?.na()?.h()??n),e})),timestampMs:Ho(In(t))}}(t),pa(this,e)})),this.g.attachEmptyPacketListener(\"embeddings_out\",(t=>{pa(this,t)})),t=t.g(),this.setGraph(new Uint8Array(t),!0)}};Hc.cosineSimilarity=function(t,e){if(t.floatEmbedding&&e.floatEmbedding)t=Jo(t.floatEmbedding,e.floatEmbedding);else{if(!t.quantizedEmbedding||!e.quantizedEmbedding)throw Error(\"Cannot compute cosine similarity between quantized and float embeddings.\");t=Jo($o(t.quantizedEmbedding),$o(e.quantizedEmbedding))}return t},Hc.prototype.embedForVideo=Hc.prototype.Aa,Hc.prototype.embed=Hc.prototype.za,Hc.prototype.setOptions=Hc.prototype.o,Hc.createFromModelPath=function(t,e){return fc(Hc,t,{baseOptions:{modelAssetPath:e}})},Hc.createFromModelBuffer=function(t,e){return fc(Hc,t,{baseOptions:{modelAssetBuffer:e}})},Hc.createFromOptions=function(t,e){return fc(Hc,t,e)};var Wc=class{constructor(t,e,n){this.confidenceMasks=t,this.categoryMask=e,this.qualityScores=n}close(){this.confidenceMasks?.forEach((t=>{t.close()})),this.categoryMask?.close()}};function zc(t){const e=function(t){return An(t,cs,1)}(t.ca()).filter((t=>(ge(tn(t,1))??\"\").includes(\"mediapipe.tasks.TensorsToSegmentationCalculator\")));if(t.u=[],e.length>1)throw Error(\"The graph has more than one mediapipe.tasks.TensorsToSegmentationCalculator.\");1===e.length&&(wn(e[0],rs,7)?.j()?.g()??new Map).forEach(((e,n)=>{t.u[Number(n)]=ge(tn(e,1))??\"\"}))}function Kc(t){t.categoryMask=void 0,t.confidenceMasks=void 0,t.qualityScores=void 0}function Yc(t){try{const e=new Wc(t.confidenceMasks,t.categoryMask,t.qualityScores);if(!t.j)return e;t.j(e)}finally{ya(t)}}Wc.prototype.close=Wc.prototype.close;var qc=class extends yc{constructor(t,e){super(new lc(t,e),\"image_in\",\"norm_rect\",!1),this.u=[],this.outputCategoryMask=!1,this.outputConfidenceMasks=!0,this.h=new Mo,this.A=new Lo,kn(this.h,0,3,this.A),kn(t=this.h,0,1,e=new Ks)}get baseOptions(){return wn(this.h,Ks,1)}set baseOptions(t){kn(this.h,0,1,t)}o(t){return void 0!==t.displayNamesLocale?nn(this.h,2,pe(t.displayNamesLocale)):\"displayNamesLocale\"in t&&nn(this.h,2),\"outputCategoryMask\"in t&&(this.outputCategoryMask=t.outputCategoryMask??!1),\"outputConfidenceMasks\"in t&&(this.outputConfidenceMasks=t.outputConfidenceMasks??!0),super.l(t)}L(){zc(this)}segment(t,e,n){const r=\"function\"!=typeof e?e:{};return this.j=\"function\"==typeof e?e:n,Kc(this),pc(this,t,r),Yc(this)}La(t,e,n,r){const i=\"function\"!=typeof n?n:{};return this.j=\"function\"==typeof n?n:r,Kc(this),gc(this,t,i,e),Yc(this)}Da(){return this.u}m(){var t=new gs;ds(t,\"image_in\"),ds(t,\"norm_rect\");const e=new rs;Mr(e,Po,this.h);const n=new cs;Cn(n,2,\"mediapipe.tasks.vision.image_segmenter.ImageSegmenterGraph\"),os(n,\"IMAGE:image_in\"),os(n,\"NORM_RECT:norm_rect\"),n.o(e),fs(t,n),ga(this,t),this.outputConfidenceMasks&&(ps(t,\"confidence_masks\"),as(n,\"CONFIDENCE_MASKS:confidence_masks\"),ma(this,\"confidence_masks\"),this.g.aa(\"confidence_masks\",((t,e)=>{this.confidenceMasks=t.map((t=>mc(this,t,!0,!this.j))),pa(this,e)})),this.g.attachEmptyPacketListener(\"confidence_masks\",(t=>{this.confidenceMasks=[],pa(this,t)}))),this.outputCategoryMask&&(ps(t,\"category_mask\"),as(n,\"CATEGORY_MASK:category_mask\"),ma(this,\"category_mask\"),this.g.Z(\"category_mask\",((t,e)=>{this.categoryMask=mc(this,t,!1,!this.j),pa(this,e)})),this.g.attachEmptyPacketListener(\"category_mask\",(t=>{this.categoryMask=void 0,pa(this,t)}))),ps(t,\"quality_scores\"),as(n,\"QUALITY_SCORES:quality_scores\"),this.g.attachFloatVectorListener(\"quality_scores\",((t,e)=>{this.qualityScores=t,pa(this,e)})),this.g.attachEmptyPacketListener(\"quality_scores\",(t=>{this.categoryMask=void 0,pa(this,t)})),t=t.g(),this.setGraph(new Uint8Array(t),!0)}};qc.prototype.getLabels=qc.prototype.Da,qc.prototype.segmentForVideo=qc.prototype.La,qc.prototype.segment=qc.prototype.segment,qc.prototype.setOptions=qc.prototype.o,qc.createFromModelPath=function(t,e){return fc(qc,t,{baseOptions:{modelAssetPath:e}})},qc.createFromModelBuffer=function(t,e){return fc(qc,t,{baseOptions:{modelAssetBuffer:e}})},qc.createFromOptions=function(t,e){return fc(qc,t,e)};var $c=class{constructor(t,e,n){this.confidenceMasks=t,this.categoryMask=e,this.qualityScores=n}close(){this.confidenceMasks?.forEach((t=>{t.close()})),this.categoryMask?.close()}};$c.prototype.close=$c.prototype.close;var Jc=class extends yc{constructor(t,e){super(new lc(t,e),\"image_in\",\"norm_rect_in\",!1),this.outputCategoryMask=!1,this.outputConfidenceMasks=!0,this.h=new Mo,this.u=new Lo,kn(this.h,0,3,this.u),kn(t=this.h,0,1,e=new Ks)}get baseOptions(){return wn(this.h,Ks,1)}set baseOptions(t){kn(this.h,0,1,t)}o(t){return\"outputCategoryMask\"in t&&(this.outputCategoryMask=t.outputCategoryMask??!1),\"outputConfidenceMasks\"in t&&(this.outputConfidenceMasks=t.outputConfidenceMasks??!0),super.l(t)}segment(t,e,n,r){const i=\"function\"!=typeof n?n:{};if(this.j=\"function\"==typeof n?n:r,this.qualityScores=this.categoryMask=this.confidenceMasks=void 0,n=this.C+1,r=new Uo,e.keypoint&&e.scribble)throw Error(\"Cannot provide both keypoint and scribble.\");if(e.keypoint){var s=new Co;dn(s,3,te(!0),!1),dn(s,1,Zt(e.keypoint.x),0),dn(s,2,Zt(e.keypoint.y),0),Sn(r,1,Do,s)}else{if(!e.scribble)throw Error(\"Must provide either a keypoint or a scribble.\");{const t=new No;for(s of e.scribble)dn(e=new Co,3,te(!0),!1),dn(e,1,Zt(s.x),0),dn(e,2,Zt(s.y),0),Ln(t,1,Co,e);Sn(r,2,Do,t)}}this.g.addProtoToStream(r.g(),\"mediapipe.tasks.vision.interactive_segmenter.proto.RegionOfInterest\",\"roi_in\",n),pc(this,t,i);t:{try{const t=new $c(this.confidenceMasks,this.categoryMask,this.qualityScores);if(!this.j){var o=t;break t}this.j(t)}finally{ya(this)}o=void 0}return o}m(){var t=new gs;ds(t,\"image_in\"),ds(t,\"roi_in\"),ds(t,\"norm_rect_in\");const e=new rs;Mr(e,Po,this.h);const n=new cs;Cn(n,2,\"mediapipe.tasks.vision.interactive_segmenter.InteractiveSegmenterGraphV2\"),os(n,\"IMAGE:image_in\"),os(n,\"ROI:roi_in\"),os(n,\"NORM_RECT:norm_rect_in\"),n.o(e),fs(t,n),ga(this,t),this.outputConfidenceMasks&&(ps(t,\"confidence_masks\"),as(n,\"CONFIDENCE_MASKS:confidence_masks\"),ma(this,\"confidence_masks\"),this.g.aa(\"confidence_masks\",((t,e)=>{this.confidenceMasks=t.map((t=>mc(this,t,!0,!this.j))),pa(this,e)})),this.g.attachEmptyPacketListener(\"confidence_masks\",(t=>{this.confidenceMasks=[],pa(this,t)}))),this.outputCategoryMask&&(ps(t,\"category_mask\"),as(n,\"CATEGORY_MASK:category_mask\"),ma(this,\"category_mask\"),this.g.Z(\"category_mask\",((t,e)=>{this.categoryMask=mc(this,t,!1,!this.j),pa(this,e)})),this.g.attachEmptyPacketListener(\"category_mask\",(t=>{this.categoryMask=void 0,pa(this,t)}))),ps(t,\"quality_scores\"),as(n,\"QUALITY_SCORES:quality_scores\"),this.g.attachFloatVectorListener(\"quality_scores\",((t,e)=>{this.qualityScores=t,pa(this,e)})),this.g.attachEmptyPacketListener(\"quality_scores\",(t=>{this.categoryMask=void 0,pa(this,t)})),t=t.g(),this.setGraph(new Uint8Array(t),!0)}};Jc.prototype.segment=Jc.prototype.segment,Jc.prototype.setOptions=Jc.prototype.o,Jc.createFromModelPath=function(t,e){return fc(Jc,t,{baseOptions:{modelAssetPath:e}})},Jc.createFromModelBuffer=function(t,e){return fc(Jc,t,{baseOptions:{modelAssetBuffer:e}})},Jc.createFromOptions=function(t,e){return fc(Jc,t,e)};var Zc=class extends yc{constructor(t,e){super(new lc(t,e),\"input_frame_gpu\",\"norm_rect\",!1),this.j={detections:[]},kn(t=this.h=new Bo,0,1,e=new Ks)}get baseOptions(){return wn(this.h,Ks,1)}set baseOptions(t){kn(this.h,0,1,t)}o(t){return void 0!==t.displayNamesLocale?nn(this.h,2,pe(t.displayNamesLocale)):\"displayNamesLocale\"in t&&nn(this.h,2),void 0!==t.maxResults?Mn(this.h,3,t.maxResults):\"maxResults\"in t&&nn(this.h,3),void 0!==t.scoreThreshold?Pn(this.h,4,t.scoreThreshold):\"scoreThreshold\"in t&&nn(this.h,4),void 0!==t.categoryAllowlist?On(this.h,5,t.categoryAllowlist):\"categoryAllowlist\"in t&&nn(this.h,5),void 0!==t.categoryDenylist?On(this.h,6,t.categoryDenylist):\"categoryDenylist\"in t&&nn(this.h,6),this.l(t)}F(t,e){return this.j={detections:[]},pc(this,t,e),this.j}G(t,e,n){return this.j={detections:[]},gc(this,t,n,e),this.j}m(){var t=new gs;ds(t,\"input_frame_gpu\"),ds(t,\"norm_rect\"),ps(t,\"detections\");const e=new rs;Mr(e,Go,this.h);const n=new cs;Cn(n,2,\"mediapipe.tasks.vision.ObjectDetectorGraph\"),os(n,\"IMAGE:input_frame_gpu\"),os(n,\"NORM_RECT:norm_rect\"),as(n,\"DETECTIONS:detections\"),n.o(e),fs(t,n),this.g.attachProtoVectorListener(\"detections\",((t,e)=>{for(const e of t)t=ks(e),this.j.detections.push(Ko(t));pa(this,e)})),this.g.attachEmptyPacketListener(\"detections\",(t=>{pa(this,t)})),t=t.g(),this.setGraph(new Uint8Array(t),!0)}};Zc.prototype.detectForVideo=Zc.prototype.G,Zc.prototype.detect=Zc.prototype.F,Zc.prototype.setOptions=Zc.prototype.o,Zc.createFromModelPath=async function(t,e){return fc(Zc,t,{baseOptions:{modelAssetPath:e}})},Zc.createFromModelBuffer=function(t,e){return fc(Zc,t,{baseOptions:{modelAssetBuffer:e}})},Zc.createFromOptions=function(t,e){return fc(Zc,t,e)};var Qc=class{constructor(t,e,n){this.landmarks=t,this.worldLandmarks=e,this.segmentationMasks=n}close(){this.segmentationMasks?.forEach((t=>{t.close()}))}};function th(t){t.landmarks=[],t.worldLandmarks=[],t.segmentationMasks=void 0}function eh(t){try{const e=new Qc(t.landmarks,t.worldLandmarks,t.segmentationMasks);if(!t.u)return e;t.u(e)}finally{ya(t)}}Qc.prototype.close=Qc.prototype.close;var nh=class extends yc{constructor(t,e){super(new lc(t,e),\"image_in\",\"norm_rect\",!1),this.landmarks=[],this.worldLandmarks=[],this.outputSegmentationMasks=!1,kn(t=this.h=new jo,0,1,e=new Ks),this.A=new Eo,kn(this.h,0,3,this.A),this.j=new vo,kn(this.h,0,2,this.j),Mn(this.j,4,1),Pn(this.j,2,.5),Pn(this.A,2,.5),Pn(this.h,4,.5)}get baseOptions(){return wn(this.h,Ks,1)}set baseOptions(t){kn(this.h,0,1,t)}o(t){return\"numPoses\"in t&&Mn(this.j,4,t.numPoses??1),\"minPoseDetectionConfidence\"in t&&Pn(this.j,2,t.minPoseDetectionConfidence??.5),\"minTrackingConfidence\"in t&&Pn(this.h,4,t.minTrackingConfidence??.5),\"minPosePresenceConfidence\"in t&&Pn(this.A,2,t.minPosePresenceConfidence??.5),\"outputSegmentationMasks\"in t&&(this.outputSegmentationMasks=t.outputSegmentationMasks??!1),this.l(t)}F(t,e,n){const r=\"function\"!=typeof e?e:{};return this.u=\"function\"==typeof e?e:n,th(this),pc(this,t,r),eh(this)}G(t,e,n,r){const i=\"function\"!=typeof n?n:{};return this.u=\"function\"==typeof n?n:r,th(this),gc(this,t,i,e),eh(this)}m(){var t=new gs;ds(t,\"image_in\"),ds(t,\"norm_rect\"),ps(t,\"normalized_landmarks\"),ps(t,\"world_landmarks\"),ps(t,\"segmentation_masks\");const e=new rs;Mr(e,Vo,this.h);const n=new cs;Cn(n,2,\"mediapipe.tasks.vision.pose_landmarker.PoseLandmarkerGraph\"),os(n,\"IMAGE:image_in\"),os(n,\"NORM_RECT:norm_rect\"),as(n,\"NORM_LANDMARKS:normalized_landmarks\"),as(n,\"WORLD_LANDMARKS:world_landmarks\"),n.o(e),fs(t,n),ga(this,t),this.g.attachProtoVectorListener(\"normalized_landmarks\",((t,e)=>{this.landmarks=[];for(const e of t)t=Rs(e),this.landmarks.push(Yo(t));pa(this,e)})),this.g.attachEmptyPacketListener(\"normalized_landmarks\",(t=>{this.landmarks=[],pa(this,t)})),this.g.attachProtoVectorListener(\"world_landmarks\",((t,e)=>{this.worldLandmarks=[];for(const e of t)t=xs(e),this.worldLandmarks.push(qo(t));pa(this,e)})),this.g.attachEmptyPacketListener(\"world_landmarks\",(t=>{this.worldLandmarks=[],pa(this,t)})),this.outputSegmentationMasks&&(as(n,\"SEGMENTATION_MASK:segmentation_masks\"),ma(this,\"segmentation_masks\"),this.g.aa(\"segmentation_masks\",((t,e)=>{this.segmentationMasks=t.map((t=>mc(this,t,!0,!this.u))),pa(this,e)})),this.g.attachEmptyPacketListener(\"segmentation_masks\",(t=>{this.segmentationMasks=[],pa(this,t)}))),t=t.g(),this.setGraph(new Uint8Array(t),!0)}};nh.prototype.detectForVideo=nh.prototype.G,nh.prototype.detect=nh.prototype.F,nh.prototype.setOptions=nh.prototype.o,nh.createFromModelPath=function(t,e){return fc(nh,t,{baseOptions:{modelAssetPath:e}})},nh.createFromModelBuffer=function(t,e){return fc(nh,t,{baseOptions:{modelAssetBuffer:e}})},nh.createFromOptions=function(t,e){return fc(nh,t,e)},nh.POSE_CONNECTIONS=Dc;export{Ja as DrawingUtils,_c as FaceDetector,Ic as FaceLandmarker,na as FilesetResolver,Oc as GestureRecognizer,Uc as HandLandmarker,Vc as HolisticLandmarker,Xc as ImageClassifier,Hc as ImageEmbedder,qc as ImageSegmenter,Wc as ImageSegmenterResult,Jc as InteractiveSegmenter,$c as InteractiveSegmenterResult,oc as MPImage,Ga as MPMask,Zc as ObjectDetector,nh as PoseLandmarker,_a as TaskRunner,yc as VisionTaskRunner};\n//# sourceMappingURL=vision_bundle_mjs.js.map\n", "import {\r\n FilesetResolver,\r\n FaceLandmarker,\r\n FaceLandmarkerResult,\r\n} from \"@mediapipe/tasks-vision\";\r\n\r\nconst WASM_CDN =\r\n \"https://cdn.jsdelivr.net/npm/@mediapipe/tasks-vision@latest/wasm\";\r\nconst MODEL_URL =\r\n \"https://storage.googleapis.com/mediapipe-models/face_landmarker/face_landmarker/float16/latest/face_landmarker.task\";\r\n\r\nexport interface FaceDetectionResult {\r\n faceDetected: boolean;\r\n blendshapes: Map<string, number>;\r\n transformMatrix: number[] | null;\r\n}\r\n\r\nexport class FaceDetectorEngine {\r\n private landmarker: FaceLandmarker | null = null;\r\n\r\n async init(): Promise<void> {\r\n const vision = await FilesetResolver.forVisionTasks(WASM_CDN);\r\n\r\n // Fetch model ourselves to avoid MediaPipe internal path resolution issues\r\n const modelResponse = await fetch(MODEL_URL);\r\n if (!modelResponse.ok) {\r\n throw new Error(`Failed to download face model (${modelResponse.status})`);\r\n }\r\n const modelBuffer = await modelResponse.arrayBuffer();\r\n\r\n this.landmarker = await FaceLandmarker.createFromOptions(vision, {\r\n baseOptions: {\r\n modelAssetBuffer: new Uint8Array(modelBuffer),\r\n },\r\n runningMode: \"VIDEO\",\r\n outputFaceBlendshapes: true,\r\n outputFacialTransformationMatrixes: true,\r\n numFaces: 1,\r\n });\r\n }\r\n\r\n detect(video: HTMLVideoElement, timestamp: number): FaceDetectionResult {\r\n if (!this.landmarker) {\r\n return { faceDetected: false, blendshapes: new Map(), transformMatrix: null };\r\n }\r\n\r\n const result: FaceLandmarkerResult = this.landmarker.detectForVideo(\r\n video,\r\n timestamp\r\n );\r\n\r\n if (!result.faceBlendshapes || result.faceBlendshapes.length === 0) {\r\n return { faceDetected: false, blendshapes: new Map(), transformMatrix: null };\r\n }\r\n\r\n const blendshapes = new Map<string, number>();\r\n for (const bs of result.faceBlendshapes[0].categories) {\r\n blendshapes.set(bs.categoryName, bs.score);\r\n }\r\n\r\n const transformMatrix =\r\n result.facialTransformationMatrixes &&\r\n result.facialTransformationMatrixes.length > 0\r\n ? Array.from(result.facialTransformationMatrixes[0].data) as number[]\r\n : null;\r\n\r\n return { faceDetected: true, blendshapes, transformMatrix };\r\n }\r\n\r\n destroy(): void {\r\n if (this.landmarker) {\r\n this.landmarker.close();\r\n this.landmarker = null;\r\n }\r\n }\r\n}\r\n", "import { FaceDetectionResult } from \"./FaceDetector\";\r\n\r\nexport interface ActionState {\r\n action: string;\r\n detected: boolean;\r\n active: boolean;\r\n confidence: number;\r\n}\r\n\r\n/**\r\n * Per-action detection tuning.\r\n * - threshold : minimum confidence score required to start counting.\r\n * - holdFrames: consecutive frames above threshold before action is confirmed.\r\n *\r\n * BLINK is a fast reflex (~100-200ms) so we use a low threshold and only 2\r\n * frames. Head-turn and mouth-open are sustained movements so they need a\r\n * slightly longer hold to avoid false positives.\r\n */\r\nconst ACTION_CONFIGS: Record<string, { threshold: number; holdFrames: number }> = {\r\n BLINK: { threshold: 0.30, holdFrames: 2 },\r\n TURN_LEFT: { threshold: 0.45, holdFrames: 6 },\r\n TURN_RIGHT: { threshold: 0.45, holdFrames: 6 },\r\n TURN_HEAD: { threshold: 0.45, holdFrames: 6 },\r\n OPEN_MOUTH: { threshold: 0.40, holdFrames: 3 },\r\n};\r\nconst DEFAULT_CONFIG = { threshold: 0.55, holdFrames: 8 };\r\n\r\n/**\r\n * Sequential action detector aligned with backend's 5 UPPERCASE actions:\r\n * BLINK, TURN_LEFT, TURN_RIGHT, TURN_HEAD, OPEN_MOUTH\r\n */\r\nexport class ActionDetector {\r\n private completedActions = new Set<string>();\r\n private holdCounters = new Map<string, number>();\r\n\r\n constructor(private requiredActions: string[]) {}\r\n\r\n check(result: FaceDetectionResult): ActionState[] {\r\n const currentAction = this.getCurrentAction();\r\n\r\n if (!result.faceDetected) {\r\n return this.buildStates(currentAction, 0);\r\n }\r\n\r\n const bs = result.blendshapes;\r\n\r\n // Only check the current active action (sequential flow)\r\n if (currentAction && !this.completedActions.has(currentAction)) {\r\n const conf = this.getConfidence(currentAction, bs, result.transformMatrix);\r\n const cfg = ACTION_CONFIGS[currentAction] ?? DEFAULT_CONFIG;\r\n\r\n if (conf >= cfg.threshold) {\r\n const count = (this.holdCounters.get(currentAction) || 0) + 1;\r\n this.holdCounters.set(currentAction, count);\r\n\r\n if (count >= cfg.holdFrames) {\r\n this.completedActions.add(currentAction);\r\n this.holdCounters.delete(currentAction);\r\n }\r\n } else {\r\n this.holdCounters.set(currentAction, 0);\r\n }\r\n\r\n return this.buildStates(currentAction, conf);\r\n }\r\n\r\n return this.buildStates(currentAction, 0);\r\n }\r\n\r\n getCurrentAction(): string | null {\r\n for (const action of this.requiredActions) {\r\n if (!this.completedActions.has(action)) return action;\r\n }\r\n return null;\r\n }\r\n\r\n private buildStates(\r\n currentAction: string | null,\r\n currentConf: number\r\n ): ActionState[] {\r\n return this.requiredActions.map((action) => ({\r\n action,\r\n detected: this.completedActions.has(action),\r\n active: action === currentAction,\r\n confidence: action === currentAction ? currentConf : 0,\r\n }));\r\n }\r\n\r\n private getConfidence(\r\n action: string,\r\n bs: Map<string, number>,\r\n matrix: number[] | null\r\n ): number {\r\n switch (action) {\r\n case \"BLINK\": {\r\n const left = bs.get(\"eyeBlinkLeft\") || 0;\r\n const right = bs.get(\"eyeBlinkRight\") || 0;\r\n return (left + right) / 2;\r\n }\r\n\r\n case \"TURN_LEFT\": {\r\n const yaw = this.getHeadYaw(matrix);\r\n return yaw < -12 ? Math.min(1, Math.abs(yaw) / 30) : 0;\r\n }\r\n\r\n case \"TURN_RIGHT\": {\r\n const yaw = this.getHeadYaw(matrix);\r\n return yaw > 12 ? Math.min(1, yaw / 30) : 0;\r\n }\r\n\r\n case \"TURN_HEAD\": {\r\n // Any significant yaw (left OR right) counts\r\n const yaw = Math.abs(this.getHeadYaw(matrix));\r\n return yaw > 15 ? Math.min(1, yaw / 30) : 0;\r\n }\r\n\r\n case \"OPEN_MOUTH\":\r\n return bs.get(\"jawOpen\") || 0;\r\n\r\n default:\r\n return 0;\r\n }\r\n }\r\n\r\n private getHeadYaw(matrix: number[] | null): number {\r\n if (!matrix || matrix.length < 16) return 0;\r\n return Math.atan2(matrix[8], matrix[0]) * (180 / Math.PI);\r\n }\r\n\r\n allCompleted(): boolean {\r\n return this.requiredActions.every((a) => this.completedActions.has(a));\r\n }\r\n\r\n completedCount(): number {\r\n return this.completedActions.size;\r\n }\r\n\r\n reset(): void {\r\n this.completedActions.clear();\r\n this.holdCounters.clear();\r\n }\r\n}\r\n", "import { ActionState } from \"../../camera/ActionDetector\";\r\n\r\n/**\r\n * Icons for the 5 backend-supported challenge actions (UPPERCASE).\r\n */\r\nconst ICONS: Record<string, string> = {\r\n BLINK: \"\\uD83D\\uDE09\",\r\n TURN_LEFT: \"\\u2B05\",\r\n TURN_RIGHT: \"\\u27A1\",\r\n TURN_HEAD: \"\\uD83D\\uDE42\",\r\n OPEN_MOUTH: \"\\uD83D\\uDE2E\",\r\n};\r\n\r\n/**\r\n * Large animated SVG/HTML cues shown in the centre of the camera frame\r\n * so the user knows exactly what to do \u2014 like a real liveness test.\r\n */\r\nconst ACTION_CUES: Record<string, string> = {\r\n BLINK: `\r\n <div style=\"display:flex;flex-direction:column;align-items:center;gap:10px;\">\r\n <div style=\"font-size:64px;line-height:1;animation:sc-blink 1.2s ease-in-out infinite;\">\uD83D\uDC41\uFE0F</div>\r\n <div style=\"font-size:13px;font-weight:600;color:#fff;opacity:0.9;letter-spacing:0.5px;\">BLINK YOUR EYES</div>\r\n </div>`,\r\n TURN_LEFT: `\r\n <div style=\"display:flex;flex-direction:column;align-items:center;gap:10px;\">\r\n <div style=\"font-size:56px;line-height:1;animation:sc-slide-left 1s ease-in-out infinite;\">\u2B05\uFE0F</div>\r\n <div style=\"font-size:13px;font-weight:600;color:#fff;opacity:0.9;letter-spacing:0.5px;\">TURN HEAD LEFT</div>\r\n </div>`,\r\n TURN_RIGHT: `\r\n <div style=\"display:flex;flex-direction:column;align-items:center;gap:10px;\">\r\n <div style=\"font-size:56px;line-height:1;animation:sc-slide-right 1s ease-in-out infinite;\">\u27A1\uFE0F</div>\r\n <div style=\"font-size:13px;font-weight:600;color:#fff;opacity:0.9;letter-spacing:0.5px;\">TURN HEAD RIGHT</div>\r\n </div>`,\r\n TURN_HEAD: `\r\n <div style=\"display:flex;flex-direction:column;align-items:center;gap:10px;\">\r\n <div style=\"font-size:56px;line-height:1;animation:sc-turn-head 1.4s ease-in-out infinite;\">\u2194\uFE0F</div>\r\n <div style=\"font-size:13px;font-weight:600;color:#fff;opacity:0.9;letter-spacing:0.5px;\">TURN HEAD SIDE TO SIDE</div>\r\n </div>`,\r\n OPEN_MOUTH: `\r\n <div style=\"display:flex;flex-direction:column;align-items:center;gap:10px;\">\r\n <div style=\"font-size:64px;line-height:1;animation:sc-mouth 1.2s ease-in-out infinite;\">\uD83D\uDE2E</div>\r\n <div style=\"font-size:13px;font-weight:600;color:#fff;opacity:0.9;letter-spacing:0.5px;\">OPEN YOUR MOUTH</div>\r\n </div>`,\r\n};\r\n\r\n/** Keyframe CSS injected once */\r\nfunction injectLivenessKeyframes(): void {\r\n if (document.getElementById(\"sc-liveness-kf\")) return;\r\n const s = document.createElement(\"style\");\r\n s.id = \"sc-liveness-kf\";\r\n s.textContent = `\r\n @keyframes sc-blink {\r\n 0%,100% { transform:scaleY(1); }\r\n 40% { transform:scaleY(0.1); }\r\n 50% { transform:scaleY(1); }\r\n }\r\n @keyframes sc-slide-left {\r\n 0%,100% { transform:translateX(0); opacity:1; }\r\n 50% { transform:translateX(-14px); opacity:0.6; }\r\n }\r\n @keyframes sc-slide-right {\r\n 0%,100% { transform:translateX(0); opacity:1; }\r\n 50% { transform:translateX(14px); opacity:0.6; }\r\n }\r\n @keyframes sc-turn-head {\r\n 0%,100% { transform:translateX(0); }\r\n 25% { transform:translateX(-12px); }\r\n 75% { transform:translateX(12px); }\r\n }\r\n @keyframes sc-mouth {\r\n 0%,100% { transform:scaleY(1); }\r\n 40% { transform:scaleY(1.25); }\r\n 60% { transform:scaleY(1); }\r\n }\r\n @keyframes sc-pop-in {\r\n 0% { transform:scale(0.7); opacity:0; }\r\n 60% { transform:scale(1.05); }\r\n 100% { transform:scale(1); opacity:1; }\r\n }\r\n @keyframes sc-cue-fade {\r\n 0% { opacity:0; transform:translateY(8px); }\r\n 20% { opacity:1; transform:translateY(0); }\r\n 80% { opacity:1; transform:translateY(0); }\r\n 100% { opacity:0; transform:translateY(-8px); }\r\n }\r\n `;\r\n document.head.appendChild(s);\r\n}\r\n\r\n/**\r\n * Challenge shape used by LivenessUI.mount().\r\n */\r\nexport interface UIChallenge {\r\n actions: string[];\r\n time_limit_seconds: number;\r\n instruction: string;\r\n}\r\n\r\nexport class LivenessUI {\r\n private root: HTMLDivElement | null = null;\r\n private videoEl: HTMLVideoElement | null = null;\r\n private instructionEl: HTMLDivElement | null = null;\r\n private stepsEl: HTMLDivElement | null = null;\r\n private progressBarEl: HTMLDivElement | null = null;\r\n private confidenceRingEl: SVGCircleElement | null = null;\r\n private timerEl: HTMLDivElement | null = null;\r\n private overlayEl: HTMLDivElement | null = null;\r\n private actionCueEl: HTMLDivElement | null = null;\r\n private timerInterval: ReturnType<typeof setInterval> | null = null;\r\n private totalActions = 0;\r\n private currentCueAction: string | null = null;\r\n private docCaptureRoot: HTMLDivElement | null = null;\r\n\r\n mount(\r\n container: HTMLElement,\r\n challenge: UIChallenge\r\n ): HTMLVideoElement {\r\n injectLivenessKeyframes();\r\n this.totalActions = challenge.actions.length;\r\n\r\n this.root = document.createElement(\"div\");\r\n this.root.style.cssText = `\r\n position:relative;width:100%;max-width:420px;margin:0 auto;\r\n background:#0a0a0a;border-radius:16px;overflow:hidden;\r\n font-family:system-ui,-apple-system,sans-serif;\r\n box-shadow:0 8px 32px rgba(0,0,0,0.4);\r\n `;\r\n\r\n // Video\r\n this.videoEl = document.createElement(\"video\");\r\n this.videoEl.autoplay = true;\r\n this.videoEl.playsInline = true;\r\n this.videoEl.muted = true;\r\n this.videoEl.style.cssText =\r\n \"width:100%;display:block;transform:scaleX(-1);aspect-ratio:3/4;object-fit:cover;\";\r\n\r\n // Face guide \u2014 oval with confidence ring\r\n const guideWrap = document.createElement(\"div\");\r\n guideWrap.style.cssText = `\r\n position:absolute;top:8%;left:50%;transform:translateX(-50%);\r\n width:180px;height:240px;pointer-events:none;\r\n `;\r\n\r\n const svg = document.createElementNS(\"http://www.w3.org/2000/svg\", \"svg\");\r\n svg.setAttribute(\"viewBox\", \"0 0 180 240\");\r\n svg.style.cssText = \"width:100%;height:100%;\";\r\n\r\n // Background oval (guide)\r\n const bgOval = document.createElementNS(\r\n \"http://www.w3.org/2000/svg\",\r\n \"ellipse\"\r\n );\r\n bgOval.setAttribute(\"cx\", \"90\");\r\n bgOval.setAttribute(\"cy\", \"120\");\r\n bgOval.setAttribute(\"rx\", \"85\");\r\n bgOval.setAttribute(\"ry\", \"115\");\r\n bgOval.setAttribute(\"fill\", \"none\");\r\n bgOval.setAttribute(\"stroke\", \"rgba(255,255,255,0.25)\");\r\n bgOval.setAttribute(\"stroke-width\", \"2.5\");\r\n bgOval.setAttribute(\"stroke-dasharray\", \"8 4\");\r\n\r\n // Confidence progress ring\r\n const confOval = document.createElementNS(\r\n \"http://www.w3.org/2000/svg\",\r\n \"ellipse\"\r\n );\r\n confOval.setAttribute(\"cx\", \"90\");\r\n confOval.setAttribute(\"cy\", \"120\");\r\n confOval.setAttribute(\"rx\", \"85\");\r\n confOval.setAttribute(\"ry\", \"115\");\r\n confOval.setAttribute(\"fill\", \"none\");\r\n confOval.setAttribute(\"stroke\", \"#22c55e\");\r\n confOval.setAttribute(\"stroke-width\", \"3.5\");\r\n const circumference =\r\n 2 * Math.PI * Math.sqrt((85 * 85 + 115 * 115) / 2);\r\n confOval.setAttribute(\r\n \"stroke-dasharray\",\r\n `${circumference}`\r\n );\r\n confOval.setAttribute(\"stroke-dashoffset\", `${circumference}`);\r\n confOval.style.cssText =\r\n \"transition:stroke-dashoffset 0.15s ease;transform:rotate(-90deg);transform-origin:90px 120px;\";\r\n this.confidenceRingEl = confOval as unknown as SVGCircleElement;\r\n\r\n svg.appendChild(bgOval);\r\n svg.appendChild(confOval);\r\n guideWrap.appendChild(svg);\r\n\r\n // Top bar \u2014 instruction\r\n const topBar = document.createElement(\"div\");\r\n topBar.style.cssText = `\r\n position:absolute;top:0;left:0;right:0;\r\n background:linear-gradient(180deg,rgba(0,0,0,0.7) 0%,transparent 100%);\r\n padding:16px 16px 32px;\r\n `;\r\n\r\n this.instructionEl = document.createElement(\"div\");\r\n this.instructionEl.style.cssText = `\r\n color:#fff;font-size:15px;font-weight:600;text-align:center;\r\n line-height:1.4;\r\n `;\r\n this.instructionEl.textContent = challenge.instruction;\r\n topBar.appendChild(this.instructionEl);\r\n\r\n // Bottom panel\r\n const bottomPanel = document.createElement(\"div\");\r\n bottomPanel.style.cssText = `\r\n position:absolute;bottom:0;left:0;right:0;\r\n background:linear-gradient(0deg,rgba(0,0,0,0.85) 0%,rgba(0,0,0,0.6) 60%,transparent 100%);\r\n padding:24px 16px 16px;\r\n `;\r\n\r\n // Progress bar\r\n const progressWrap = document.createElement(\"div\");\r\n progressWrap.style.cssText = `\r\n height:3px;background:rgba(255,255,255,0.15);border-radius:2px;\r\n margin-bottom:14px;overflow:hidden;\r\n `;\r\n this.progressBarEl = document.createElement(\"div\");\r\n this.progressBarEl.style.cssText = `\r\n height:100%;width:0%;background:linear-gradient(90deg,#22c55e,#4ade80);\r\n border-radius:2px;transition:width 0.4s ease;\r\n `;\r\n progressWrap.appendChild(this.progressBarEl);\r\n bottomPanel.appendChild(progressWrap);\r\n\r\n // Steps list\r\n this.stepsEl = document.createElement(\"div\");\r\n this.stepsEl.style.cssText = `\r\n display:flex;flex-direction:column;gap:8px;margin-bottom:12px;\r\n `;\r\n\r\n for (let i = 0; i < challenge.actions.length; i++) {\r\n const action = challenge.actions[i];\r\n const step = document.createElement(\"div\");\r\n step.dataset.action = action;\r\n step.style.cssText = `\r\n display:flex;align-items:center;gap:10px;\r\n padding:8px 12px;border-radius:10px;\r\n background:rgba(255,255,255,0.06);\r\n transition:all 0.3s ease;\r\n opacity:${i === 0 ? \"1\" : \"0.4\"};\r\n `;\r\n\r\n const num = document.createElement(\"div\");\r\n num.className = \"sc-step-num\";\r\n num.style.cssText = `\r\n width:28px;height:28px;border-radius:50%;\r\n display:flex;align-items:center;justify-content:center;\r\n font-size:13px;font-weight:700;color:#fff;\r\n background:rgba(255,255,255,0.12);\r\n border:2px solid rgba(255,255,255,0.2);\r\n transition:all 0.3s ease;flex-shrink:0;\r\n `;\r\n num.textContent = String(i + 1);\r\n\r\n const label = document.createElement(\"div\");\r\n label.style.cssText = \"color:#fff;font-size:13px;flex:1;\";\r\n label.textContent = this.describeAction(action);\r\n\r\n const icon = document.createElement(\"div\");\r\n icon.className = \"sc-step-icon\";\r\n icon.style.cssText = \"font-size:18px;flex-shrink:0;\";\r\n icon.textContent = ICONS[action] || \"\";\r\n\r\n step.appendChild(num);\r\n step.appendChild(label);\r\n step.appendChild(icon);\r\n this.stepsEl.appendChild(step);\r\n }\r\n\r\n bottomPanel.appendChild(this.stepsEl);\r\n\r\n // Timer\r\n this.timerEl = document.createElement(\"div\");\r\n this.timerEl.style.cssText = `\r\n text-align:center;color:rgba(255,255,255,0.5);\r\n font-size:11px;font-variant-numeric:tabular-nums;\r\n `;\r\n bottomPanel.appendChild(this.timerEl);\r\n\r\n // Result overlay (used for success / failure / timeout)\r\n this.overlayEl = document.createElement(\"div\");\r\n this.overlayEl.style.cssText = `\r\n position:absolute;inset:0;display:none;align-items:center;\r\n justify-content:center;z-index:10;\r\n background:rgba(0,0,0,0.85);backdrop-filter:blur(8px);\r\n transition:opacity 0.3s ease;\r\n `;\r\n\r\n // Action cue \u2014 large centred animation shown when an action is active\r\n this.actionCueEl = document.createElement(\"div\");\r\n this.actionCueEl.style.cssText = `\r\n position:absolute;\r\n top:50%;left:50%;transform:translate(-50%,-50%);\r\n z-index:5;pointer-events:none;\r\n display:none;\r\n text-align:center;\r\n background:rgba(0,0,0,0.55);\r\n backdrop-filter:blur(4px);\r\n border-radius:20px;\r\n padding:18px 28px;\r\n min-width:160px;\r\n border:1.5px solid rgba(255,255,255,0.15);\r\n `;\r\n\r\n // Assemble\r\n this.root.appendChild(this.videoEl);\r\n this.root.appendChild(guideWrap);\r\n this.root.appendChild(topBar);\r\n this.root.appendChild(bottomPanel);\r\n this.root.appendChild(this.actionCueEl);\r\n this.root.appendChild(this.overlayEl);\r\n\r\n container.appendChild(this.root);\r\n this.startTimer(challenge.time_limit_seconds);\r\n\r\n return this.videoEl;\r\n }\r\n\r\n updateActions(states: ActionState[]): void {\r\n if (!this.stepsEl || !this.progressBarEl) return;\r\n\r\n let completed = 0;\r\n const activeState = states.find((s) => s.active && !s.detected) ?? null;\r\n const activeAction = activeState?.action ?? null;\r\n\r\n for (const state of states) {\r\n const step = this.stepsEl.querySelector(\r\n `[data-action=\"${state.action}\"]`\r\n ) as HTMLDivElement | null;\r\n if (!step) continue;\r\n\r\n const num = step.querySelector(\".sc-step-num\") as HTMLElement | null;\r\n\r\n if (state.detected) {\r\n completed++;\r\n step.style.opacity = \"1\";\r\n step.style.background = \"rgba(34,197,94,0.15)\";\r\n if (num) {\r\n num.style.background = \"#22c55e\";\r\n num.style.borderColor = \"#22c55e\";\r\n num.textContent = \"\\u2713\";\r\n }\r\n } else if (state.active) {\r\n step.style.opacity = \"1\";\r\n step.style.background = \"rgba(59,130,246,0.15)\";\r\n if (num) {\r\n num.style.borderColor = \"#3b82f6\";\r\n num.style.background = \"rgba(59,130,246,0.3)\";\r\n }\r\n }\r\n }\r\n\r\n // Update progress bar\r\n const pct = this.totalActions > 0 ? (completed / this.totalActions) * 100 : 0;\r\n this.progressBarEl.style.width = `${pct}%`;\r\n\r\n // Update confidence ring for the active action\r\n if (this.confidenceRingEl) {\r\n const circumference =\r\n 2 * Math.PI * Math.sqrt((85 * 85 + 115 * 115) / 2);\r\n const conf = activeState ? activeState.confidence : 0;\r\n const offset = circumference * (1 - conf);\r\n this.confidenceRingEl.setAttribute(\"stroke-dashoffset\", `${offset}`);\r\n this.confidenceRingEl.setAttribute(\r\n \"stroke\",\r\n conf > 0.6 ? \"#22c55e\" : \"#3b82f6\"\r\n );\r\n }\r\n\r\n // Show / switch large animated action cue\r\n this.updateActionCue(activeAction);\r\n }\r\n\r\n private updateActionCue(action: string | null): void {\r\n if (!this.actionCueEl) return;\r\n\r\n // No active action \u2192 hide cue\r\n if (!action) {\r\n this.actionCueEl.style.display = \"none\";\r\n this.currentCueAction = null;\r\n return;\r\n }\r\n\r\n // Same action already showing \u2014 no DOM thrash\r\n if (action === this.currentCueAction) return;\r\n\r\n this.currentCueAction = action;\r\n const cueHtml = ACTION_CUES[action];\r\n if (!cueHtml) {\r\n this.actionCueEl.style.display = \"none\";\r\n return;\r\n }\r\n\r\n // Inject content and animate in\r\n this.actionCueEl.innerHTML = cueHtml;\r\n this.actionCueEl.style.display = \"block\";\r\n this.actionCueEl.style.animation = \"none\";\r\n // Force reflow then trigger animation\r\n void this.actionCueEl.offsetWidth;\r\n this.actionCueEl.style.animation = \"sc-pop-in 0.3s ease forwards\";\r\n }\r\n\r\n updateInstruction(text: string): void {\r\n if (this.instructionEl) {\r\n this.instructionEl.textContent = text;\r\n }\r\n }\r\n\r\n stopTimer(): void {\r\n if (this.timerInterval) {\r\n clearInterval(this.timerInterval);\r\n this.timerInterval = null;\r\n }\r\n if (this.timerEl) {\r\n this.timerEl.textContent = \"\";\r\n }\r\n }\r\n\r\n showResult(status: \"processing\" | \"failed\", verificationId?: number): Promise<void> {\r\n return new Promise((resolve) => {\r\n if (!this.overlayEl) { resolve(); return; }\r\n\r\n if (this.actionCueEl) this.actionCueEl.style.display = \"none\";\r\n this.stopTimer();\r\n\r\n const isProcessing = status === \"processing\";\r\n this.overlayEl.style.display = \"flex\";\r\n\r\n this.overlayEl.innerHTML = `\r\n <div style=\"text-align:center;color:#fff;animation:sc-pop-in 0.35s ease;padding:24px;\">\r\n <div style=\"\r\n width:80px;height:80px;border-radius:50%;margin:0 auto 20px;\r\n display:flex;align-items:center;justify-content:center;\r\n font-size:36px;\r\n background:${isProcessing ? \"rgba(34,197,94,0.2)\" : \"rgba(239,68,68,0.2)\"};\r\n border:3px solid ${isProcessing ? \"#22c55e\" : \"#ef4444\"};\r\n \">${isProcessing ? \"\\u2713\" : \"\\u2717\"}</div>\r\n <div style=\"font-size:19px;font-weight:700;margin-bottom:8px;\">\r\n ${isProcessing ? \"Identity Check Submitted\" : \"Submission Failed\"}\r\n </div>\r\n <div style=\"font-size:13px;opacity:0.65;line-height:1.6;margin-bottom:${verificationId ? \"16px\" : \"0\"};\">\r\n ${isProcessing\r\n ? \"Your identity is being verified.<br>You\\'ll be notified of the outcome shortly.\"\r\n : \"Something went wrong. Please try again.\"}\r\n </div>\r\n ${verificationId ? `\r\n <div style=\"\r\n margin-top:4px;padding:8px 14px;border-radius:8px;\r\n background:rgba(255,255,255,0.08);display:inline-block;\r\n font-size:11px;color:rgba(255,255,255,0.5);letter-spacing:0.3px;\r\n \">Ref: #${verificationId}</div>` : \"\"}\r\n </div>\r\n `;\r\n\r\n setTimeout(resolve, 2800);\r\n });\r\n }\r\n\r\n /**\r\n * Show timeout screen with an optional retry callback.\r\n * Resolves immediately so the orchestrator can move to next step.\r\n */\r\n showTimeout(onRetry: () => void): Promise<void> {\r\n return new Promise((resolve) => {\r\n if (!this.overlayEl) { resolve(); return; }\r\n\r\n if (this.actionCueEl) this.actionCueEl.style.display = \"none\";\r\n this.stopTimer();\r\n\r\n this.overlayEl.style.display = \"flex\";\r\n this.overlayEl.innerHTML = `\r\n <div style=\"text-align:center;color:#fff;animation:sc-pop-in 0.35s ease;padding:24px;\">\r\n <div style=\"\r\n width:80px;height:80px;border-radius:50%;margin:0 auto 16px;\r\n display:flex;align-items:center;justify-content:center;\r\n font-size:36px;\r\n background:rgba(251,191,36,0.15);\r\n border:3px solid #fbbf24;\r\n \">\u23F1</div>\r\n <div style=\"font-size:18px;font-weight:700;margin-bottom:8px;\">Time's Up</div>\r\n <div style=\"font-size:13px;opacity:0.65;margin-bottom:20px;\">\r\n You ran out of time. Please try again.\r\n </div>\r\n <button id=\"sc-retry-btn\" style=\"\r\n padding:12px 28px;border-radius:10px;\r\n background:#3b82f6;color:#fff;\r\n border:none;cursor:pointer;\r\n font-size:14px;font-weight:600;\r\n width:100%;max-width:200px;\r\n \">Try Again</button>\r\n </div>\r\n `;\r\n\r\n // Wire retry button\r\n const retryBtn = this.overlayEl.querySelector(\"#sc-retry-btn\") as HTMLButtonElement | null;\r\n if (retryBtn) {\r\n retryBtn.addEventListener(\"click\", () => {\r\n onRetry();\r\n resolve();\r\n });\r\n } else {\r\n // fallback \u2014 auto-resolve after 5s\r\n setTimeout(resolve, 5000);\r\n }\r\n });\r\n }\r\n\r\n getVideoElement(): HTMLVideoElement | null {\r\n return this.videoEl;\r\n }\r\n\r\n /**\r\n * Mount a document scanning step before the liveness challenge.\r\n * Reuses the already-open camera stream \u2014 no second permission prompt.\r\n * Resolves with the captured document Blob.\r\n */\r\n mountDocumentCapture(container: HTMLElement, stream: MediaStream): Promise<Blob> {\r\n return new Promise((resolve, reject) => {\r\n injectLivenessKeyframes();\r\n\r\n const docRoot = document.createElement(\"div\");\r\n docRoot.style.cssText = `\r\n position:relative;width:100%;max-width:420px;margin:0 auto;\r\n background:#0a0a0a;border-radius:16px;overflow:hidden;\r\n font-family:system-ui,-apple-system,sans-serif;\r\n box-shadow:0 8px 32px rgba(0,0,0,0.4);\r\n `;\r\n this.docCaptureRoot = docRoot;\r\n\r\n const docVideo = document.createElement(\"video\");\r\n docVideo.autoplay = true;\r\n docVideo.playsInline = true;\r\n docVideo.muted = true;\r\n docVideo.style.cssText = \"width:100%;display:block;aspect-ratio:4/3;object-fit:cover;\";\r\n docVideo.srcObject = stream;\r\n\r\n // Rectangle guide with blue corner accents\r\n const guideOverlay = document.createElement(\"div\");\r\n guideOverlay.style.cssText = \"position:absolute;inset:0;pointer-events:none;display:flex;align-items:center;justify-content:center;\";\r\n guideOverlay.innerHTML = `\r\n <div style=\"width:83%;height:53%;border:2px dashed rgba(255,255,255,0.55);border-radius:10px;box-shadow:0 0 0 2000px rgba(0,0,0,0.45);position:relative;\">\r\n <div style=\"position:absolute;top:-2px;left:-2px;width:18px;height:18px;border-top:3px solid #3b82f6;border-left:3px solid #3b82f6;border-radius:4px 0 0 0;\"></div>\r\n <div style=\"position:absolute;top:-2px;right:-2px;width:18px;height:18px;border-top:3px solid #3b82f6;border-right:3px solid #3b82f6;border-radius:0 4px 0 0;\"></div>\r\n <div style=\"position:absolute;bottom:-2px;left:-2px;width:18px;height:18px;border-bottom:3px solid #3b82f6;border-left:3px solid #3b82f6;border-radius:0 0 0 4px;\"></div>\r\n <div style=\"position:absolute;bottom:-2px;right:-2px;width:18px;height:18px;border-bottom:3px solid #3b82f6;border-right:3px solid #3b82f6;border-radius:0 0 4px 0;\"></div>\r\n </div>\r\n `;\r\n\r\n const header = document.createElement(\"div\");\r\n header.style.cssText = \"position:absolute;top:0;left:0;right:0;background:linear-gradient(180deg,rgba(0,0,0,0.88) 0%,transparent 100%);padding:18px 16px 40px;text-align:center;\";\r\n header.innerHTML = `\r\n <div style=\"color:#fff;font-size:16px;font-weight:700;margin-bottom:6px;\">Scan Your ID Document</div>\r\n <div style=\"color:rgba(255,255,255,0.6);font-size:12px;line-height:1.6;\">\r\n Fit your document inside the frame.<br>Make sure all text and corners are visible.\r\n </div>\r\n `;\r\n\r\n const bottomPanel = document.createElement(\"div\");\r\n bottomPanel.style.cssText = \"position:absolute;bottom:0;left:0;right:0;background:linear-gradient(0deg,rgba(0,0,0,0.92) 0%,rgba(0,0,0,0.6) 70%,transparent 100%);padding:16px 16px;\";\r\n bottomPanel.innerHTML = `\r\n <div style=\"font-size:11px;color:rgba(255,255,255,0.4);text-align:center;margin-bottom:12px;\">\r\n \uD83D\uDCA1 Good lighting \u00B7 No glare \u00B7 All 4 corners visible\r\n </div>\r\n <button id=\"sc-capture-doc-btn\" style=\"width:100%;padding:12px;border-radius:12px;background:#3b82f6;color:#fff;border:none;cursor:pointer;font-size:15px;font-weight:700;margin-bottom:8px;\">\r\n Capture Document\r\n </button>\r\n <label style=\"width:100%;display:flex;align-items:center;justify-content:center;gap:6px;padding:9px;border-radius:12px;border:1.5px solid rgba(255,255,255,0.18);cursor:pointer;color:rgba(255,255,255,0.6);font-size:13px;font-weight:500;\">\r\n <span>\uD83D\uDCC1</span><span>Upload from gallery instead</span>\r\n <input id=\"sc-upload-doc-input\" type=\"file\" accept=\"image/*\" style=\"display:none;\" />\r\n </label>\r\n `;\r\n\r\n docRoot.appendChild(docVideo);\r\n docRoot.appendChild(guideOverlay);\r\n docRoot.appendChild(header);\r\n docRoot.appendChild(bottomPanel);\r\n container.appendChild(docRoot);\r\n\r\n docVideo.play().catch(() => {});\r\n\r\n const cleanup = () => {\r\n if (docRoot.parentElement) docRoot.parentElement.removeChild(docRoot);\r\n this.docCaptureRoot = null;\r\n };\r\n\r\n const captureBtn = bottomPanel.querySelector(\"#sc-capture-doc-btn\") as HTMLButtonElement;\r\n if (captureBtn) {\r\n captureBtn.addEventListener(\"click\", () => {\r\n try {\r\n const canvas = document.createElement(\"canvas\");\r\n canvas.width = docVideo.videoWidth || 1280;\r\n canvas.height = docVideo.videoHeight || 720;\r\n const ctx = canvas.getContext(\"2d\");\r\n if (!ctx) { reject(new Error(\"Canvas context unavailable\")); return; }\r\n ctx.drawImage(docVideo, 0, 0);\r\n canvas.toBlob((blob) => {\r\n if (blob) { cleanup(); resolve(blob); }\r\n else { reject(new Error(\"Failed to capture document image\")); }\r\n }, \"image/jpeg\", 0.92);\r\n } catch (err) { reject(err); }\r\n });\r\n }\r\n\r\n const uploadInput = bottomPanel.querySelector(\"#sc-upload-doc-input\") as HTMLInputElement;\r\n if (uploadInput) {\r\n uploadInput.addEventListener(\"change\", () => {\r\n const file = uploadInput.files?.[0];\r\n if (file) { cleanup(); resolve(file); }\r\n });\r\n }\r\n });\r\n }\r\n\r\n unmount(): void {\r\n this.stopTimer();\r\n if (this.docCaptureRoot && this.docCaptureRoot.parentElement) {\r\n this.docCaptureRoot.parentElement.removeChild(this.docCaptureRoot);\r\n this.docCaptureRoot = null;\r\n }\r\n if (this.root && this.root.parentElement) {\r\n this.root.parentElement.removeChild(this.root);\r\n }\r\n this.root = null;\r\n this.videoEl = null;\r\n this.instructionEl = null;\r\n this.stepsEl = null;\r\n this.progressBarEl = null;\r\n this.confidenceRingEl = null;\r\n this.timerEl = null;\r\n this.overlayEl = null;\r\n this.actionCueEl = null;\r\n }\r\n\r\n private startTimer(seconds: number): void {\r\n let remaining = seconds;\r\n\r\n const update = () => {\r\n if (!this.timerEl) return;\r\n const m = Math.floor(remaining / 60);\r\n const s = remaining % 60;\r\n const display = m > 0 ? `${m}:${String(s).padStart(2, \"0\")}` : `${s}s`;\r\n this.timerEl.textContent = `${display} remaining`;\r\n\r\n if (remaining <= 5) {\r\n this.timerEl.style.color = \"#ef4444\";\r\n }\r\n };\r\n\r\n update();\r\n this.timerInterval = setInterval(() => {\r\n remaining--;\r\n update();\r\n if (remaining <= 0 && this.timerInterval) {\r\n clearInterval(this.timerInterval);\r\n }\r\n }, 1000);\r\n }\r\n\r\n private describeAction(action: string): string {\r\n const labels: Record<string, string> = {\r\n BLINK: \"Blink your eyes\",\r\n TURN_LEFT: \"Turn your head left\",\r\n TURN_RIGHT: \"Turn your head right\",\r\n TURN_HEAD: \"Turn your head side to side\",\r\n OPEN_MOUTH: \"Open your mouth wide\",\r\n };\r\n return labels[action] || action.replace(/_/g, \" \").toLowerCase();\r\n }\r\n}\r\n", "import { HttpClient } from \"../../client/HttpClient\";\r\nimport {\r\n ChallengeAction,\r\n LivenessCreateRequest,\r\n LivenessCreateResponse,\r\n LivenessSubmitResponse,\r\n} from \"../../types/liveness\";\r\nimport { collectDeviceMetadata } from \"../../utils/device\";\r\nimport { CameraManager } from \"../../camera/CameraManager\";\r\nimport { VideoRecorder } from \"../../camera/VideoRecorder\";\r\nimport { FaceDetectorEngine } from \"../../camera/FaceDetector\";\r\nimport { ActionDetector } from \"../../camera/ActionDetector\";\r\nimport { LivenessUI } from \"./LivenessUI\";\r\n\r\n/**\r\n * Liveness module \u2014 3-step flow aligned with Adhere backend.\r\n *\r\n * Flow:\r\n * Step 1: liveness.create() \u2192 POST /v1/liveness/create/ (multipart)\r\n * Step 2: [camera runs, user performs challenge actions]\r\n * Step 3: liveness.submit() \u2192 POST /v1/liveness/submit/ (multipart)\r\n *\r\n * After submit, the backend returns status: \"processing\".\r\n * Final results are delivered via webhook (liveness.completed event).\r\n */\r\nexport class LivenessModule {\r\n constructor(private http: HttpClient) { }\r\n\r\n /**\r\n * Step 1: Create a liveness challenge entry.\r\n *\r\n * POST /v1/liveness/create/\r\n * Auth: x-access-token: <sessionToken>\r\n * Content-Type: multipart/form-data\r\n */\r\n async create(params: LivenessCreateRequest): Promise<LivenessCreateResponse> {\r\n const formData = new FormData();\r\n formData.append(\"identifier\", params.identifier);\r\n formData.append(\"identifier_type\", params.identifier_type);\r\n formData.append(\"country\", params.country);\r\n formData.append(\r\n \"challenge_actions\",\r\n JSON.stringify(params.challenge_actions)\r\n );\r\n if (params.autoshot_file) {\r\n formData.append(\"autoshot\", params.autoshot_file, \"autoshot.jpg\");\r\n }\r\n \r\n // Handle document upload - support both legacy and new front/back fields\r\n if (params.document) {\r\n formData.append(\"document\", params.document, \"document.jpg\");\r\n if (params.document_back) {\r\n formData.append(\"document_back\", params.document_back, \"document_back.jpg\");\r\n }\r\n } else if (params.document_front) {\r\n // Legacy support - map to document for backward compatibility\r\n formData.append(\"document\", params.document_front, \"document_front.jpg\");\r\n if (params.document_back) {\r\n formData.append(\"document_back\", params.document_back, \"document_back.jpg\");\r\n }\r\n } else if (params.id_file) {\r\n // Legacy support - map to document for backward compatibility\r\n formData.append(\"document\", params.id_file, \"id_document.jpg\");\r\n }\r\n \r\n if (params.identity_check) {\r\n formData.append(\"identity_check\", String(params.identity_check));\r\n }\r\n if (params.snapshot_file) {\r\n formData.append(\"snapshot\", params.snapshot_file, \"snapshot.jpg\");\r\n }\r\n if (params.device_type) {\r\n formData.append(\"device_type\", params.device_type);\r\n }\r\n if (params.os_name) {\r\n formData.append(\"os_name\", params.os_name);\r\n }\r\n if (params.browser_timezone) {\r\n formData.append(\"browser_timezone\", params.browser_timezone);\r\n }\r\n if (params.fingerprint_id) {\r\n formData.append(\"fingerprint_id\", params.fingerprint_id);\r\n }\r\n\r\n return this.http.uploadWithSession<LivenessCreateResponse>(\r\n \"/v1/liveness/create/\",\r\n formData\r\n );\r\n }\r\n\r\n /**\r\n * Step 3: Submit liveness video recording.\r\n *\r\n * POST /v1/liveness/submit/\r\n * Auth: x-access-token: <sessionToken>\r\n * Content-Type: multipart/form-data\r\n *\r\n * Note: After submission, the session is revoked (single-use).\r\n * The backend returns status: \"processing\" \u2014 results come via webhook.\r\n */\r\n async submit(\r\n entryId: number,\r\n videoBlob: Blob,\r\n snapshotBlob: Blob,\r\n autoshotBlob?: Blob,\r\n videoDurationSeconds?: number,\r\n videoSizeBytes?: number\r\n ): Promise<LivenessSubmitResponse> {\r\n const formData = new FormData();\r\n formData.append(\"entry\", String(entryId));\r\n formData.append(\"video\", videoBlob, \"liveness.webm\");\r\n formData.append(\"snapshot\", snapshotBlob, \"snapshot.jpg\");\r\n if (autoshotBlob) {\r\n formData.append(\"autoshot\", autoshotBlob, \"autoshot.jpg\");\r\n }\r\n if (videoDurationSeconds !== undefined) {\r\n formData.append(\"video_duration_seconds\", String(videoDurationSeconds));\r\n }\r\n if (videoSizeBytes !== undefined) {\r\n formData.append(\"video_size_bytes\", String(videoSizeBytes));\r\n }\r\n\r\n return this.http.uploadWithSession<LivenessSubmitResponse>(\r\n \"/v1/liveness/submit/\",\r\n formData\r\n );\r\n }\r\n\r\n /**\r\n * Poll the public SDK status endpoint for the final verification result.\r\n * Safe to call after the session has been revoked (no auth required).\r\n *\r\n * GET /v1/liveness/<entryId>/sdk-result/\r\n */\r\n async pollResult(entryId: number): Promise<{\r\n id: number;\r\n status: string;\r\n failure_reason: string | null;\r\n completed_at: string | null;\r\n }> {\r\n return (this.http as any).publicGet(`/v1/liveness/${entryId}/sdk-result/`);\r\n }\r\n\r\n /**\r\n * Full liveness check \u2014 orchestrates the entire flow:\r\n *\r\n * 1. Take autoshot selfie from camera\r\n * 2. Create liveness entry on backend (with challenge actions + selfie + optional doc)\r\n * 3. Run action detection loop (camera + MediaPipe)\r\n * 4. Record video and submit to backend\r\n * 5. Return submit response (status: \"processing\")\r\n *\r\n * @param container - DOM element to mount the liveness UI into\r\n * @param params - identifier info and optional document image\r\n * @param actions - override challenge actions (default: BLINK, TURN_LEFT, OPEN_MOUTH)\r\n */\r\n async startCheck(\r\n container: HTMLElement,\r\n params: {\r\n identifier: string;\r\n identifier_type: string;\r\n country: string;\r\n id_file?: File | Blob; // Legacy support\r\n document?: File | Blob; // Front document field (matches backend)\r\n document_front?: File | Blob; // Legacy support for backward compatibility\r\n document_back?: File | Blob; // Back document field (optional)\r\n identity_check?: number;\r\n verification_type?: \"data_verification\" | \"document_verification\" | \"liveness_only\";\r\n },\r\n actions?: ChallengeAction[],\r\n existingEntryId?: number\r\n ): Promise<LivenessSubmitResponse> {\r\n const camera = new CameraManager();\r\n const recorder = new VideoRecorder();\r\n const faceEngine = new FaceDetectorEngine();\r\n const ui = new LivenessUI();\r\n\r\n // Tracks whether cleanup has already been called (so the finally block\r\n // doesn't double-destroy when retry takes over).\r\n let cleanedUp = false;\r\n const cleanup = () => {\r\n if (cleanedUp) return;\r\n cleanedUp = true;\r\n faceEngine.destroy();\r\n camera.stop();\r\n ui.unmount();\r\n };\r\n\r\n try {\r\n // 1. Open camera (with permission error handling)\r\n let stream: MediaStream;\r\n try {\r\n stream = await camera.open();\r\n } catch (camErr: any) {\r\n if (camErr.name === \"NotAllowedError\" || camErr.name === \"PermissionDeniedError\") {\r\n throw new Error(\"Camera access denied. Please allow camera permission in your browser settings and try again.\");\r\n }\r\n if (camErr.name === \"NotFoundError\" || camErr.name === \"DevicesNotFoundError\") {\r\n throw new Error(\"No camera found. Please connect a camera and try again.\");\r\n }\r\n throw new Error(`Camera error: ${camErr.message || \"Unable to access camera\"}`);\r\n }\r\n\r\n // 2. Document capture step \u2014 document_verification only, when no id_file pre-supplied\r\n let capturedDocBlob: Blob | undefined = params.id_file as Blob | undefined;\r\n if (!capturedDocBlob && params.verification_type === \"document_verification\") {\r\n capturedDocBlob = await ui.mountDocumentCapture(container, stream);\r\n }\r\n\r\n // 3. Create a temporary video element to capture autoshot\r\n const tempVideo = document.createElement(\"video\");\r\n tempVideo.srcObject = stream;\r\n tempVideo.muted = true;\r\n tempVideo.playsInline = true;\r\n await tempVideo.play();\r\n\r\n // Wait for face to be detected before capturing autoshot\r\n ui.mount(container, { actions: [], time_limit_seconds: 0, instruction: \"Centre your face in the oval\" });\r\n const uiVideo = ui.getVideoElement();\r\n if (uiVideo) {\r\n uiVideo.srcObject = stream;\r\n await uiVideo.play();\r\n } else {\r\n tempVideo.style.cssText = \"width:100%;border-radius:12px;transform:scaleX(-1);\";\r\n container.appendChild(tempVideo);\r\n }\r\n\r\n await faceEngine.init();\r\n ui.updateInstruction(\"Centre your face in the oval\");\r\n\r\n // Wait until face is stably centred (5 consecutive detected frames, max 12 s)\r\n const videoForDetection = uiVideo || tempVideo;\r\n await new Promise<void>((resolve) => {\r\n let attempts = 0;\r\n let stableFrames = 0;\r\n const STABLE_REQUIRED = 5;\r\n const maxAttempts = 120; // 12 seconds at 100ms intervals\r\n const checkFace = () => {\r\n attempts++;\r\n if (videoForDetection.readyState >= 2) {\r\n const detection = faceEngine.detect(videoForDetection, performance.now());\r\n if (detection.faceDetected) {\r\n stableFrames++;\r\n if (stableFrames >= STABLE_REQUIRED) {\r\n resolve();\r\n return;\r\n }\r\n } else {\r\n stableFrames = 0; // reset on any lost-face frame\r\n ui.updateInstruction(\"Move your face into the oval\");\r\n }\r\n }\r\n if (attempts >= maxAttempts) {\r\n resolve(); // proceed anyway after timeout\r\n return;\r\n }\r\n setTimeout(checkFace, 100);\r\n };\r\n checkFace();\r\n });\r\n\r\n ui.updateInstruction(\"Hold still \u2014 capturing your selfie...\");\r\n await new Promise((r) => setTimeout(r, 700)); // wait for camera auto-focus\r\n\r\n // 3. Capture autoshot (selfie) \u2014 face stable, camera focused\r\n const autoshotBlob = await this.captureFrame(videoForDetection);\r\n tempVideo.pause();\r\n\r\n // Validate autoshot blob is not empty\r\n if (!autoshotBlob || autoshotBlob.size === 0) {\r\n throw new Error(\"Failed to capture autoshot selfie. Please ensure camera is working.\");\r\n }\r\n\r\n // 4. Create liveness entry on backend (skip if retrying with existing entry)\r\n const challengeActions = actions || [\"BLINK\", \"TURN_LEFT\", \"OPEN_MOUTH\"];\r\n let entry: LivenessCreateResponse;\r\n\r\n if (existingEntryId) {\r\n // Reuse existing entry on retry (D1: prevent duplicate wallet charges)\r\n entry = { id: existingEntryId, challenge_actions: challengeActions, status: \"pending\", client_id: \"\", expires_at: null };\r\n } else {\r\n const deviceMeta = collectDeviceMetadata();\r\n entry = await this.create({\r\n identifier: params.identifier,\r\n identifier_type: params.identifier_type,\r\n country: params.country,\r\n challenge_actions: challengeActions,\r\n autoshot_file: autoshotBlob,\r\n document: params.document || params.document_front || params.id_file || capturedDocBlob,\r\n document_back: params.document_back,\r\n identity_check: params.identity_check,\r\n device_type: deviceMeta.device_type,\r\n os_name: deviceMeta.os_name,\r\n browser_timezone: deviceMeta.browser_timezone,\r\n fingerprint_id: deviceMeta.fingerprint_id,\r\n });\r\n }\r\n\r\n // 5. Mount UI with challenge actions from backend\r\n const uiChallenge = {\r\n actions: entry.challenge_actions,\r\n time_limit_seconds: 45,\r\n instruction: \"Complete each action below to verify it's you\",\r\n };\r\n\r\n // Re-mount UI with challenge actions (face engine already initialized)\r\n ui.unmount();\r\n const videoEl = ui.mount(container, uiChallenge);\r\n videoEl.srcObject = stream;\r\n await videoEl.play();\r\n\r\n // 7. Start recording\r\n recorder.start(stream);\r\n ui.updateInstruction(uiChallenge.instruction);\r\n\r\n // 8. Run detection loop (sequential \u2014 one action at a time)\r\n const actionDetector = new ActionDetector(entry.challenge_actions);\r\n let lastAction: string | null = null;\r\n\r\n const detectionResult = await new Promise<\"completed\" | \"timeout\">(\r\n (resolve) => {\r\n let animFrameId: number;\r\n\r\n const timeout = setTimeout(() => {\r\n cancelAnimationFrame(animFrameId);\r\n resolve(\"timeout\");\r\n }, uiChallenge.time_limit_seconds * 1000);\r\n\r\n const detectLoop = () => {\r\n if (videoEl.readyState >= 2) {\r\n const detection = faceEngine.detect(\r\n videoEl,\r\n performance.now()\r\n );\r\n\r\n const states = actionDetector.check(detection);\r\n ui.updateActions(states);\r\n\r\n const current = actionDetector.getCurrentAction();\r\n\r\n if (!detection.faceDetected) {\r\n ui.updateInstruction(\"Move your face into the oval\");\r\n } else if (current) {\r\n if (current !== lastAction) {\r\n lastAction = current;\r\n ui.updateInstruction(this.describeAction(current));\r\n }\r\n } else {\r\n ui.updateInstruction(\"All actions completed! \u2713\");\r\n }\r\n\r\n if (actionDetector.allCompleted()) {\r\n clearTimeout(timeout);\r\n cancelAnimationFrame(animFrameId);\r\n resolve(\"completed\");\r\n return;\r\n }\r\n }\r\n\r\n animFrameId = requestAnimationFrame(detectLoop);\r\n };\r\n\r\n detectLoop();\r\n }\r\n );\r\n\r\n // \u2500\u2500 On timeout: show retry screen, clean up, restart \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\r\n if (detectionResult === \"timeout\") {\r\n // IMPORTANT: mark cleanedUp=true BEFORE returning the new Promise so\r\n // the outer `finally` block does NOT call cleanup() immediately \u2014\r\n // which would destroy the UI before the user sees the timeout screen.\r\n cleanedUp = true;\r\n\r\n recorder.stop().catch(() => { }); // discard partial recording\r\n\r\n return new Promise<LivenessSubmitResponse>((resolveRetry, rejectRetry) => {\r\n ui.showTimeout(() => {\r\n // User clicked \"Try Again\" \u2014 now it is safe to destroy this attempt\r\n faceEngine.destroy();\r\n camera.stop();\r\n ui.unmount();\r\n\r\n // Restart liveness with same entry ID to prevent duplicate charges (D1)\r\n // Pass capturedDocBlob forward so document scan step is not repeated\r\n this.startCheck(container, { ...params, id_file: capturedDocBlob }, actions, entry.id)\r\n .then(resolveRetry)\r\n .catch(rejectRetry);\r\n });\r\n // showTimeout waits for the user to click \u2014 the promise stays pending.\r\n });\r\n }\r\n\r\n // \u2500\u2500 On completion: stop recording, submit, show success \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\r\n\r\n // Wait for user to return to neutral face after last action before\r\n // capturing snapshot \u2014 prevents mid-action pose from skewing DeepFace\r\n // embeddings (open mouth / head turned = high cosine distance).\r\n ui.updateInstruction(\"Almost done \u2014 hold still...\");\r\n await new Promise((r) => setTimeout(r, 800));\r\n\r\n // Capture a snapshot frame while the video is still playing\r\n const snapshotBlob = await this.captureFrame(videoEl);\r\n\r\n // 9. Stop recording\r\n const { blob: videoBlob, durationSeconds } = await recorder.stop();\r\n\r\n // 10. Submit to backend \u2014 always include autoshot so document-flow\r\n // entries (which bypassed create() via existingEntryId) still get it.\r\n const submitResult = await this.submit(\r\n entry.id,\r\n videoBlob,\r\n snapshotBlob,\r\n autoshotBlob,\r\n durationSeconds,\r\n videoBlob.size\r\n );\r\n\r\n // 11. Show success overlay briefly before the flow advances\r\n await ui.showResult(\r\n submitResult.status === \"processing\" ? \"processing\" : \"failed\",\r\n submitResult.id\r\n );\r\n\r\n return submitResult;\r\n\r\n } finally {\r\n cleanup();\r\n }\r\n }\r\n\r\n /**\r\n * Capture a single sharp frame from a video element as a JPEG Blob.\r\n * Retries up to maxAttempts times (300 ms apart) if the Laplacian blur\r\n * score is below threshold, then falls back to the best frame captured.\r\n */\r\n private async captureFrame(\r\n video: HTMLVideoElement,\r\n maxAttempts = 4\r\n ): Promise<Blob> {\r\n const MIN_BLUR_SCORE = 80; // Laplacian variance \u2014 above this = acceptably sharp\r\n const RETRY_DELAY_MS = 300;\r\n let bestBlob: Blob | null = null;\r\n let bestScore = -1;\r\n\r\n for (let attempt = 0; attempt < maxAttempts; attempt++) {\r\n const canvas = document.createElement(\"canvas\");\r\n canvas.width = video.videoWidth || 640;\r\n canvas.height = video.videoHeight || 480;\r\n const ctx = canvas.getContext(\"2d\");\r\n if (!ctx) throw new Error(\"Failed to get canvas context\");\r\n ctx.drawImage(video, 0, 0);\r\n\r\n const score = this._computeBlurScore(canvas);\r\n\r\n const blob = await new Promise<Blob | null>((res) =>\r\n canvas.toBlob((b) => res(b), \"image/jpeg\", 0.92)\r\n );\r\n\r\n if (blob && score > bestScore) {\r\n bestBlob = blob;\r\n bestScore = score;\r\n }\r\n\r\n if (score >= MIN_BLUR_SCORE) break; // sharp enough \u2014 stop early\r\n\r\n if (attempt < maxAttempts - 1) {\r\n await new Promise((r) => setTimeout(r, RETRY_DELAY_MS));\r\n }\r\n }\r\n\r\n if (bestBlob) return bestBlob;\r\n throw new Error(\"Failed to capture frame\");\r\n }\r\n\r\n /**\r\n * Laplacian variance blur metric on a centre-cropped region (320\u00D7240 max).\r\n * Higher score = sharper image. Score < 80 is considered blurry.\r\n */\r\n private _computeBlurScore(canvas: HTMLCanvasElement): number {\r\n const ctx = canvas.getContext(\"2d\");\r\n if (!ctx) return 0;\r\n\r\n // Sample a 320\u00D7240 centre crop for performance\r\n const sw = Math.min(canvas.width, 320);\r\n const sh = Math.min(canvas.height, 240);\r\n const sx = Math.floor((canvas.width - sw) / 2);\r\n const sy = Math.floor((canvas.height - sh) / 2);\r\n\r\n const { data, width, height } = ctx.getImageData(sx, sy, sw, sh);\r\n\r\n // Convert to greyscale\r\n const gray = new Float32Array(width * height);\r\n for (let i = 0; i < width * height; i++) {\r\n gray[i] =\r\n 0.299 * data[i * 4] +\r\n 0.587 * data[i * 4 + 1] +\r\n 0.114 * data[i * 4 + 2];\r\n }\r\n\r\n // Laplacian convolution [0,1,0 / 1,-4,1 / 0,1,0] \u2014 sum of squared responses\r\n let sum = 0;\r\n let n = 0;\r\n for (let y = 1; y < height - 1; y++) {\r\n for (let x = 1; x < width - 1; x++) {\r\n const l =\r\n gray[(y - 1) * width + x] +\r\n gray[(y + 1) * width + x] +\r\n gray[y * width + (x - 1)] +\r\n gray[y * width + (x + 1)] -\r\n 4 * gray[y * width + x];\r\n sum += l * l;\r\n n++;\r\n }\r\n }\r\n return n > 0 ? sum / n : 0;\r\n }\r\n\r\n private describeAction(action: string): string {\r\n const descriptions: Record<string, string> = {\r\n BLINK: \"Blink your eyes\",\r\n TURN_LEFT: \"Turn your head left\",\r\n TURN_RIGHT: \"Turn your head right\",\r\n TURN_HEAD: \"Turn your head side to side\",\r\n OPEN_MOUTH: \"Open your mouth wide\",\r\n };\r\n return descriptions[action] || action.replace(/_/g, \" \").toLowerCase();\r\n }\r\n}\r\n", "import { SDKConfig } from \"./Config\";\r\nimport { HttpClient } from \"./HttpClient\";\r\nimport { OnboardingModule } from \"../modules/onboarding/onboarding\";\r\nimport { LivenessModule } from \"../modules/liveness/liveness\";\r\nimport {\r\n SessionResponse,\r\n SDKInitConfig,\r\n} from \"../types/onboarding\";\r\n\r\n/**\r\n * SmartComply SDK \u2014 main entry point.\r\n *\r\n * Usage:\r\n * const sdk = new SmartComply({ apiKey: \"pk_...\", clientId: \"uuid-...\", environment: \"sandbox\" });\r\n * const session = await sdk.createSession();\r\n * const config = await sdk.initializeConfig();\r\n * // ... use sdk.onboarding and sdk.liveness modules\r\n */\r\nexport class SmartComply {\r\n private http: HttpClient;\r\n private clientId: string;\r\n private _sessionToken: string | null = null;\r\n private _sessionExpiresAt: string | null = null;\r\n private _sdkConfig: SDKInitConfig | null = null;\r\n\r\n public onboarding: OnboardingModule;\r\n public liveness: LivenessModule;\r\n\r\n constructor(config: SDKConfig) {\r\n if (!config.apiKey) {\r\n throw new Error(\"SmartComply: apiKey is required\");\r\n }\r\n if (!config.clientId) {\r\n throw new Error(\"SmartComply: clientId is required (UUID from your SDK config)\");\r\n }\r\n\r\n this.clientId = config.clientId;\r\n this.http = new HttpClient(config);\r\n\r\n this.onboarding = new OnboardingModule(this.http);\r\n this.liveness = new LivenessModule(this.http);\r\n }\r\n\r\n /** Current session token (null if not created yet) */\r\n get sessionToken(): string | null {\r\n return this._sessionToken;\r\n }\r\n\r\n /** Session expiration ISO timestamp */\r\n get sessionExpiresAt(): string | null {\r\n return this._sessionExpiresAt;\r\n }\r\n\r\n /** SDK config fetched from backend (null until initializeConfig() is called) */\r\n get sdkConfig(): SDKInitConfig | null {\r\n return this._sdkConfig;\r\n }\r\n\r\n /**\r\n * Create a new SDK session.\r\n *\r\n * POST /v1/session/create/\r\n * Auth: Authorization: Bearer <apiKey>\r\n * Body: { client_id: \"<uuid>\" }\r\n *\r\n * Returns: { token: \"...\", expires_at: \"...\" }\r\n */\r\n async createSession(): Promise<SessionResponse> {\r\n const response = await this.http.request<SessionResponse>(\r\n \"POST\",\r\n \"/v1/session/create/\",\r\n { client_id: this.clientId }\r\n );\r\n\r\n this._sessionToken = response.token;\r\n this._sessionExpiresAt = response.expires_at;\r\n\r\n // Set the session token on the HTTP client for subsequent requests\r\n this.http.setSessionToken(response.token);\r\n\r\n return response;\r\n }\r\n\r\n /**\r\n * Fetch SDK configuration from the backend.\r\n * Must be called after createSession().\r\n *\r\n * GET /v1/initialize/\r\n * Auth: x-access-token: <sessionToken>\r\n *\r\n * Returns: { brand_name, theme, verification_type, channels, redirect_url, ... }\r\n */\r\n async initializeConfig(): Promise<SDKInitConfig> {\r\n const config = await this.http.sessionRequest<SDKInitConfig>(\r\n \"GET\",\r\n \"/v1/initialize/\"\r\n );\r\n\r\n this._sdkConfig = config;\r\n return config;\r\n }\r\n}\r\n", "/**\r\n * Theme system for the SmartComply Flow widget.\r\n * Maps to backend's SDKConfig.THEME_CHOICES:\r\n * default, midnight_blue, sunset_gold, forest_emerald\r\n */\r\n\r\nexport interface ThemeColors {\r\n primary: string;\r\n primaryHover: string;\r\n primaryGlow: string;\r\n bg: string;\r\n cardBg: string;\r\n inputBg: string;\r\n text: string;\r\n textSecondary: string;\r\n textMuted: string;\r\n border: string;\r\n borderFocus: string;\r\n success: string;\r\n successBg: string;\r\n error: string;\r\n errorBg: string;\r\n warning: string;\r\n overlay: string;\r\n shimmer: string;\r\n shadow: string;\r\n isDark: boolean;\r\n}\r\n\r\nexport const THEMES: Record<string, ThemeColors> = {\r\n default: {\r\n primary: \"#3b82f6\",\r\n primaryHover: \"#2563eb\",\r\n primaryGlow: \"rgba(59, 130, 246, 0.25)\",\r\n bg: \"#ffffff\",\r\n cardBg: \"#f8fafc\",\r\n inputBg: \"#f1f5f9\",\r\n text: \"#0f172a\",\r\n textSecondary: \"#475569\",\r\n textMuted: \"#94a3b8\",\r\n border: \"#e2e8f0\",\r\n borderFocus: \"#3b82f6\",\r\n success: \"#22c55e\",\r\n successBg: \"rgba(34, 197, 94, 0.1)\",\r\n error: \"#ef4444\",\r\n errorBg: \"rgba(239, 68, 68, 0.1)\",\r\n warning: \"#f59e0b\",\r\n overlay: \"rgba(15, 23, 42, 0.6)\",\r\n shimmer: \"rgba(59, 130, 246, 0.08)\",\r\n shadow: \"0 20px 60px rgba(0, 0, 0, 0.15), 0 0 0 1px rgba(0, 0, 0, 0.05)\",\r\n isDark: false,\r\n },\r\n\r\n midnight_blue: {\r\n primary: \"#60a5fa\",\r\n primaryHover: \"#93bbfd\",\r\n primaryGlow: \"rgba(96, 165, 250, 0.2)\",\r\n bg: \"#0b1120\",\r\n cardBg: \"#111d33\",\r\n inputBg: \"#162032\",\r\n text: \"#f1f5f9\",\r\n textSecondary: \"#94a3b8\",\r\n textMuted: \"#64748b\",\r\n border: \"#1e3a5f\",\r\n borderFocus: \"#60a5fa\",\r\n success: \"#4ade80\",\r\n successBg: \"rgba(74, 222, 128, 0.1)\",\r\n error: \"#f87171\",\r\n errorBg: \"rgba(248, 113, 113, 0.1)\",\r\n warning: \"#fbbf24\",\r\n overlay: \"rgba(0, 0, 0, 0.75)\",\r\n shimmer: \"rgba(96, 165, 250, 0.06)\",\r\n shadow: \"0 20px 60px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(96, 165, 250, 0.1)\",\r\n isDark: true,\r\n },\r\n\r\n sunset_gold: {\r\n primary: \"#f59e0b\",\r\n primaryHover: \"#d97706\",\r\n primaryGlow: \"rgba(245, 158, 11, 0.2)\",\r\n bg: \"#fffdf7\",\r\n cardBg: \"#fef9ee\",\r\n inputBg: \"#fef3c7\",\r\n text: \"#1c1917\",\r\n textSecondary: \"#57534e\",\r\n textMuted: \"#a8a29e\",\r\n border: \"#fed7aa\",\r\n borderFocus: \"#f59e0b\",\r\n success: \"#22c55e\",\r\n successBg: \"rgba(34, 197, 94, 0.1)\",\r\n error: \"#ef4444\",\r\n errorBg: \"rgba(239, 68, 68, 0.1)\",\r\n warning: \"#f59e0b\",\r\n overlay: \"rgba(28, 25, 23, 0.6)\",\r\n shimmer: \"rgba(245, 158, 11, 0.08)\",\r\n shadow: \"0 20px 60px rgba(0, 0, 0, 0.12), 0 0 0 1px rgba(245, 158, 11, 0.1)\",\r\n isDark: false,\r\n },\r\n\r\n forest_emerald: {\r\n primary: \"#10b981\",\r\n primaryHover: \"#059669\",\r\n primaryGlow: \"rgba(16, 185, 129, 0.2)\",\r\n bg: \"#f7fdf9\",\r\n cardBg: \"#ecfdf5\",\r\n inputBg: \"#d1fae5\",\r\n text: \"#1a1a2e\",\r\n textSecondary: \"#4b5563\",\r\n textMuted: \"#9ca3af\",\r\n border: \"#a7f3d0\",\r\n borderFocus: \"#10b981\",\r\n success: \"#22c55e\",\r\n successBg: \"rgba(34, 197, 94, 0.1)\",\r\n error: \"#ef4444\",\r\n errorBg: \"rgba(239, 68, 68, 0.1)\",\r\n warning: \"#f59e0b\",\r\n overlay: \"rgba(26, 26, 46, 0.6)\",\r\n shimmer: \"rgba(16, 185, 129, 0.08)\",\r\n shadow: \"0 20px 60px rgba(0, 0, 0, 0.12), 0 0 0 1px rgba(16, 185, 129, 0.1)\",\r\n isDark: false,\r\n },\r\n};\r\n\r\nexport function getTheme(name: string): ThemeColors {\r\n return THEMES[name] || THEMES.default;\r\n}\r\n", "import { ThemeColors } from \"./theme\";\r\n\r\n/**\r\n * Document capture UI \u2014 camera-based or file-upload for ID documents.\r\n *\r\n * Supports:\r\n * - Camera capture (rear camera preferred on mobile)\r\n * - File upload fallback\r\n * - Preview with retake/confirm\r\n * - Front and back document capture for documents requiring both sides\r\n */\r\nexport interface DocumentCaptureResult {\r\n front: Blob;\r\n back?: Blob; // Optional for documents that don't require back side\r\n}\r\n\r\nexport class DocumentCapture {\r\n private root: HTMLDivElement | null = null;\r\n private videoEl: HTMLVideoElement | null = null;\r\n private stream: MediaStream | null = null;\r\n private resolveCapture: ((result: DocumentCaptureResult) => void) | null = null;\r\n private rejectCapture: ((err: Error) => void) | null = null;\r\n private frontBlob: Blob | null = null;\r\n private backBlob: Blob | null = null;\r\n private currentSide: 'front' | 'back' = 'front';\r\n\r\n /**\r\n * Mount the document capture UI and return a promise that resolves\r\n * with the captured document image(s).\r\n */\r\n capture(\r\n container: HTMLElement,\r\n theme: ThemeColors,\r\n documentType: string\r\n ): Promise<DocumentCaptureResult> {\r\n return new Promise((resolve, reject) => {\r\n // Validate input parameters\r\n if (!container) {\r\n reject(new Error(\"Container element is required\"));\r\n return;\r\n }\r\n if (!theme) {\r\n reject(new Error(\"Theme configuration is required\"));\r\n return;\r\n }\r\n if (!documentType || typeof documentType !== 'string') {\r\n reject(new Error(\"Document type is required and must be a string\"));\r\n return;\r\n }\r\n \r\n // Check if already capturing\r\n if (this.resolveCapture || this.rejectCapture) {\r\n reject(new Error(\"Document capture is already in progress\"));\r\n return;\r\n }\r\n\r\n this.resolveCapture = resolve;\r\n this.rejectCapture = reject;\r\n this.frontBlob = null;\r\n this.backBlob = null;\r\n this.currentSide = 'front';\r\n this.renderChoiceScreen(container, theme, documentType);\r\n });\r\n }\r\n\r\n destroy(): void {\r\n // Stop any ongoing camera streams\r\n this.stopCamera();\r\n \r\n // Clean up DOM elements\r\n if (this.root && this.root.parentElement) {\r\n this.root.parentElement.removeChild(this.root);\r\n }\r\n this.root = null;\r\n \r\n // Clean up any pending promises\r\n if (this.rejectCapture) {\r\n this.rejectCapture(new Error(\"Document capture was cancelled\"));\r\n this.rejectCapture = null;\r\n }\r\n this.resolveCapture = null;\r\n \r\n // Clean up blob data\r\n this.frontBlob = null;\r\n this.backBlob = null;\r\n this.currentSide = 'front';\r\n }\r\n\r\n private requiresBackSide(documentType: string): boolean {\r\n const type = documentType.toLowerCase();\r\n return type.includes(\"voter\") || \r\n type.includes(\"nin\") || \r\n type.includes(\"driver\") || \r\n type.includes(\"license\") || \r\n type.includes(\"national id\") ||\r\n type.includes(\"national id card\") ||\r\n type.includes(\"ghana\");\r\n }\r\n\r\n private renderChoiceScreen(\r\n container: HTMLElement,\r\n theme: ThemeColors,\r\n documentType: string\r\n ): void {\r\n this.root = document.createElement(\"div\");\r\n this.root.style.cssText = \"display:flex;flex-direction:column;align-items:center;gap:24px;padding:24px 20px;max-width:100%;\";\r\n\r\n const docLabel = this.getDocumentLabel(documentType);\r\n const requiresBack = this.requiresBackSide(documentType);\r\n const isCapturingFront = this.currentSide === 'front';\r\n\r\n // Header with enhanced illustration\r\n const header = document.createElement(\"div\");\r\n header.style.cssText = \"display:flex;flex-direction:column;align-items:center;gap:16px;text-align:center;\";\r\n \r\n // Enhanced illustration with gradient background\r\n const iconContainer = document.createElement(\"div\");\r\n iconContainer.style.cssText = `\r\n width:120px;height:120px;border-radius:24px;\r\n display:flex;align-items:center;justify-content:center;\r\n background:linear-gradient(135deg, ${theme.primary}15, ${theme.primary}05);\r\n border:3px solid ${theme.primary}30;\r\n position:relative;overflow:hidden;\r\n box-shadow:0 8px 32px ${theme.primary}20;\r\n `;\r\n \r\n const icon = document.createElement(\"div\");\r\n icon.style.cssText = \"font-size:48px;animation:float 3s ease-in-out infinite;\";\r\n icon.textContent = \"\uD83E\uDEAA\";\r\n iconContainer.appendChild(icon);\r\n \r\n // Add floating animation\r\n if (!document.head.querySelector('style[data-float-animation]')) {\r\n const style = document.createElement('style');\r\n style.setAttribute('data-float-animation', 'true');\r\n style.textContent = `\r\n @keyframes float {\r\n 0%, 100% { transform: translateY(0px); }\r\n 50% { transform: translateY(-10px); }\r\n }\r\n `;\r\n document.head.appendChild(style);\r\n }\r\n \r\n header.appendChild(iconContainer);\r\n\r\n // Enhanced title and subtitle\r\n const title = document.createElement(\"div\");\r\n title.style.cssText = `color:${theme.text};font-size:20px;font-weight:700;text-align:center;line-height:1.4;`;\r\n let labelText = `Capture your ${docLabel}`;\r\n if (requiresBack) {\r\n labelText += ` (${isCapturingFront ? 'Front Side' : 'Back Side'})`;\r\n }\r\n title.textContent = labelText;\r\n header.appendChild(title);\r\n\r\n const subtitle = document.createElement(\"div\");\r\n subtitle.style.cssText = `color:${theme.textSecondary};font-size:14px;text-align:center;line-height:1.5;max-width:280px;`;\r\n subtitle.textContent = \"Choose how you'd like to provide your document\";\r\n header.appendChild(subtitle);\r\n\r\n this.root.appendChild(header);\r\n\r\n // Enhanced progress indicator for multi-sided documents\r\n if (requiresBack) {\r\n const progress = document.createElement(\"div\");\r\n progress.style.cssText = `\r\n display:flex;flex-direction:column;align-items:center;gap:12px;\r\n padding:16px 20px;background:${theme.primary}08;border-radius:16px;\r\n border:1px solid ${theme.primary}20;width:100%;max-width:320px;\r\n `;\r\n progress.innerHTML = `\r\n <div style=\"display:flex;gap:8px;align-items:center;\">\r\n <div style=\"width:12px;height:12px;border-radius:50%;background:${isCapturingFront ? theme.primary : theme.border};transition:all 0.3s ease;\"></div>\r\n <div style=\"width:32px;height:2px;background:${theme.border};border-radius:1px;\"></div>\r\n <div style=\"width:12px;height:12px;border-radius:50%;background:${!isCapturingFront ? theme.primary : theme.border};transition:all 0.3s ease;\"></div>\r\n </div>\r\n <span style=\"color:${theme.text};font-size:13px;font-weight:600;\">${isCapturingFront ? 'Step 1 of 2' : 'Step 2 of 2'}</span>\r\n `;\r\n this.root.appendChild(progress);\r\n }\r\n\r\n // Enhanced action buttons container\r\n const actionsContainer = document.createElement(\"div\");\r\n actionsContainer.style.cssText = \"display:flex;flex-direction:column;gap:16px;width:100%;max-width:320px;\";\r\n\r\n // Camera button with enhanced design\r\n const cameraBtn = this.createEnhancedButton(\r\n \"\uD83D\uDCF7 Take Photo with Camera\",\r\n theme,\r\n true,\r\n \"Open camera to capture document\"\r\n );\r\n cameraBtn.addEventListener(\"click\", () => {\r\n this.showLoadingState(\"Opening camera...\", theme);\r\n this.root!.innerHTML = \"\";\r\n setTimeout(() => {\r\n this.renderCameraView(this.root!, theme, documentType);\r\n }, 500);\r\n });\r\n actionsContainer.appendChild(cameraBtn);\r\n\r\n // Upload button with enhanced design\r\n const uploadBtn = this.createEnhancedButton(\r\n \"\uD83D\uDCC1 Choose from Gallery\",\r\n theme,\r\n false,\r\n \"Upload document image from device\"\r\n );\r\n uploadBtn.addEventListener(\"click\", () => {\r\n this.handleFileUpload(container, theme);\r\n });\r\n actionsContainer.appendChild(uploadBtn);\r\n\r\n this.root.appendChild(actionsContainer);\r\n\r\n // Enhanced tips section\r\n const tips = document.createElement(\"div\");\r\n tips.style.cssText = `\r\n width:100%;padding:16px 20px;border-radius:16px;\r\n background:${theme.shimmer};border:1px solid ${theme.border};\r\n margin-top:8px;\r\n `;\r\n \r\n const tipsTitle = document.createElement(\"div\");\r\n tipsTitle.style.cssText = `font-weight:700;color:${theme.text};margin-bottom:12px;font-size:14px;display:flex;align-items:center;gap:8px;`;\r\n tipsTitle.innerHTML = `\uD83D\uDCA1 Tips for best results`;\r\n tips.appendChild(tipsTitle);\r\n \r\n const tipsList = document.createElement(\"div\");\r\n tipsList.style.cssText = `display:grid;gap:8px;font-size:13px;color:${theme.textSecondary};line-height:1.6;`;\r\n tipsList.innerHTML = `\r\n <div style=\"display:flex;gap:8px;align-items:flex-start;\">\r\n <span style=\"color:${theme.primary};font-weight:bold;\">\u2713</span>\r\n <span>Lay document flat on a solid surface</span>\r\n </div>\r\n <div style=\"display:flex;gap:8px;align-items:flex-start;\">\r\n <span style=\"color:${theme.primary};font-weight:bold;\">\u2713</span>\r\n <span>Ensure all four corners are visible</span>\r\n </div>\r\n <div style=\"display:flex;gap:8px;align-items:flex-start;\">\r\n <span style=\"color:${theme.primary};font-weight:bold;\">\u2713</span>\r\n <span>Use good lighting, avoid glare</span>\r\n </div>\r\n <div style=\"display:flex;gap:8px;align-items:flex-start;\">\r\n <span style=\"color:${theme.primary};font-weight:bold;\">\u2713</span>\r\n <span>Make sure all text is clearly readable</span>\r\n </div>\r\n `;\r\n tips.appendChild(tipsList);\r\n this.root.appendChild(tips);\r\n\r\n // File input (hidden)\r\n const fileInput = document.createElement(\"input\");\r\n fileInput.type = \"file\";\r\n fileInput.accept = \"image/jpeg,image/png\";\r\n fileInput.style.display = \"none\";\r\n fileInput.id = \"sc-doc-file-input\";\r\n fileInput.addEventListener(\"change\", (e) => {\r\n const file = (e.target as HTMLInputElement).files?.[0];\r\n if (file) {\r\n // Validate file\r\n const validationError = this.validateFile(file);\r\n if (validationError) {\r\n this.showError(validationError);\r\n return;\r\n }\r\n \r\n this.showLoadingState(\"Processing image...\", theme);\r\n this.compressImage(file, 1280, 960, 0.85)\r\n .then((compressed) => this.handleFileUploadComplete(compressed, container, theme, documentType))\r\n .catch(() => this.handleFileUploadComplete(file, container, theme, documentType)); // fallback to original if compress fails\r\n }\r\n });\r\n this.root.appendChild(fileInput);\r\n\r\n container.appendChild(this.root);\r\n }\r\n\r\n private renderCameraView(\r\n container: HTMLElement,\r\n theme: ThemeColors,\r\n documentType: string\r\n ): void {\r\n const wrapper = document.createElement(\"div\");\r\n wrapper.style.cssText = \"position:relative;width:100%;border-radius:12px;overflow:hidden;background:#000;\";\r\n\r\n this.videoEl = document.createElement(\"video\");\r\n this.videoEl.autoplay = true;\r\n this.videoEl.playsInline = true;\r\n this.videoEl.muted = true;\r\n this.videoEl.style.cssText = \"width:100%;display:block;aspect-ratio:4/3;object-fit:cover;\";\r\n wrapper.appendChild(this.videoEl);\r\n\r\n // Guide overlay \u2014 rectangular\r\n const guide = document.createElement(\"div\");\r\n guide.style.cssText = `\r\n position:absolute;inset:0;display:flex;align-items:center;justify-content:center;\r\n pointer-events:none;\r\n `;\r\n const rect = document.createElement(\"div\");\r\n rect.style.cssText = `\r\n width:85%;height:60%;border:2px solid rgba(255,255,255,0.6);\r\n border-radius:12px;box-shadow:0 0 0 9999px rgba(0,0,0,0.4);\r\n `;\r\n guide.appendChild(rect);\r\n wrapper.appendChild(guide);\r\n\r\n // Guide label\r\n const guideLbl = document.createElement(\"div\");\r\n guideLbl.style.cssText = `\r\n position:absolute;bottom:60px;left:0;right:0;text-align:center;\r\n color:#fff;font-size:13px;font-weight:600;\r\n text-shadow:0 1px 3px rgba(0,0,0,0.5);\r\n `;\r\n guideLbl.textContent = `Align your ${this.getDocumentLabel(documentType)} within the frame`;\r\n wrapper.appendChild(guideLbl);\r\n\r\n container.appendChild(wrapper);\r\n\r\n // Capture button\r\n const captureBtn = document.createElement(\"button\");\r\n captureBtn.style.cssText = `\r\n display:block;margin:16px auto 0;width:64px;height:64px;\r\n border-radius:50%;border:4px solid ${theme.primary};\r\n background:transparent;cursor:pointer;position:relative;\r\n transition:all 0.2s ease;\r\n `;\r\n const inner = document.createElement(\"div\");\r\n inner.style.cssText = `\r\n width:48px;height:48px;border-radius:50%;background:${theme.primary};\r\n position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);\r\n transition:all 0.15s ease;\r\n `;\r\n captureBtn.appendChild(inner);\r\n captureBtn.addEventListener(\"mousedown\", () => {\r\n inner.style.transform = \"translate(-50%,-50%) scale(0.9)\";\r\n });\r\n captureBtn.addEventListener(\"mouseup\", () => {\r\n inner.style.transform = \"translate(-50%,-50%) scale(1)\";\r\n });\r\n captureBtn.addEventListener(\"click\", () => {\r\n this.captureFrame(container, theme, documentType);\r\n });\r\n container.appendChild(captureBtn);\r\n\r\n // Open camera\r\n this.openCamera();\r\n }\r\n\r\n private async openCamera(): Promise<void> {\r\n // Check browser compatibility\r\n if (!navigator.mediaDevices || !navigator.mediaDevices.getUserMedia) {\r\n this.rejectCapture?.(new Error(\"Camera access is not supported in this browser. Please use a modern browser like Chrome, Firefox, or Safari.\"));\r\n return;\r\n }\r\n\r\n const maxRetries = 3;\r\n let retryCount = 0;\r\n\r\n const attemptCameraAccess = async (constraints: MediaStreamConstraints): Promise<MediaStream> => {\r\n try {\r\n return await navigator.mediaDevices.getUserMedia(constraints);\r\n } catch (err: any) {\r\n console.warn(`Camera access attempt ${retryCount + 1} failed:`, err);\r\n \r\n if (retryCount < maxRetries - 1) {\r\n retryCount++;\r\n await new Promise(resolve => setTimeout(resolve, 1000 * retryCount)); // Exponential backoff\r\n return attemptCameraAccess(constraints);\r\n }\r\n throw err;\r\n }\r\n };\r\n\r\n try {\r\n // Try rear camera first\r\n this.stream = await attemptCameraAccess({\r\n video: {\r\n facingMode: { ideal: \"environment\" },\r\n width: { ideal: 1280 },\r\n height: { ideal: 960 },\r\n },\r\n });\r\n } catch (err: any) {\r\n console.warn(\"Rear camera failed, trying any camera:\", err);\r\n \r\n // Fallback to any camera\r\n try {\r\n this.stream = await attemptCameraAccess({\r\n video: { width: { ideal: 1280 } },\r\n });\r\n } catch (fallbackErr: any) {\r\n const errorMessage = this.getCameraErrorMessage(fallbackErr);\r\n this.rejectCapture?.(new Error(errorMessage));\r\n return;\r\n }\r\n }\r\n\r\n if (this.videoEl) {\r\n this.videoEl.srcObject = this.stream;\r\n }\r\n }\r\n\r\n private getCameraErrorMessage(error: any): string {\r\n if (error.name === 'NotAllowedError') {\r\n return \"Camera access denied. Please allow camera permissions and try again.\";\r\n } else if (error.name === 'NotFoundError') {\r\n return \"No camera found. Please ensure your device has a working camera.\";\r\n } else if (error.name === 'NotReadableError') {\r\n return \"Camera is already in use by another application. Please close other apps using the camera and try again.\";\r\n } else if (error.name === 'OverconstrainedError') {\r\n return \"Camera constraints not supported. Trying with different settings...\";\r\n } else {\r\n return \"Camera access failed. Please check your camera permissions and try again.\";\r\n }\r\n }\r\n\r\n private captureFrame(container: HTMLElement, theme: ThemeColors, documentType: string): void {\r\n if (!this.videoEl) return;\r\n\r\n const MAX_W = 1280;\r\n const MAX_H = 960;\r\n const vw = this.videoEl.videoWidth || MAX_W;\r\n const vh = this.videoEl.videoHeight || MAX_H;\r\n const ratio = Math.min(MAX_W / vw, MAX_H / vh, 1);\r\n\r\n const canvas = document.createElement(\"canvas\");\r\n canvas.width = Math.round(vw * ratio);\r\n canvas.height = Math.round(vh * ratio);\r\n const ctx = canvas.getContext(\"2d\");\r\n if (!ctx) return;\r\n\r\n ctx.drawImage(this.videoEl, 0, 0, canvas.width, canvas.height);\r\n\r\n canvas.toBlob(\r\n (blob) => {\r\n if (blob) {\r\n this.stopCamera();\r\n this.showPreview(container, theme, blob, documentType);\r\n }\r\n },\r\n \"image/jpeg\",\r\n 0.85\r\n );\r\n }\r\n\r\n private showPreview(\r\n container: HTMLElement,\r\n theme: ThemeColors,\r\n imageData: Blob | File,\r\n documentType: string\r\n ): void {\r\n if (this.root) this.root.innerHTML = \"\";\r\n else {\r\n this.root = document.createElement(\"div\");\r\n container.appendChild(this.root);\r\n }\r\n\r\n this.root.style.cssText = \"display:flex;flex-direction:column;align-items:center;gap:16px;\";\r\n\r\n // Preview image\r\n const img = document.createElement(\"img\");\r\n const imageUrl = URL.createObjectURL(imageData);\r\n img.src = imageUrl;\r\n img.style.cssText = `\r\n width:100%;max-height:300px;object-fit:contain;border-radius:12px;\r\n border:2px solid ${theme.border};\r\n `;\r\n this.root.appendChild(img);\r\n\r\n // Store URL for cleanup\r\n (img as any)._blobUrl = imageUrl;\r\n\r\n const label = document.createElement(\"div\");\r\n label.style.cssText = `color:${theme.textSecondary};font-size:13px;text-align:center;font-weight:500;`;\r\n label.textContent = \"Does the photo look clear?\";\r\n this.root.appendChild(label);\r\n\r\n const sublabel = document.createElement(\"div\");\r\n sublabel.style.cssText = `color:${theme.textMuted};font-size:11px;text-align:center;line-height:1.6;`;\r\n sublabel.textContent = \"All text must be readable and all four corners must be visible.\";\r\n this.root.appendChild(sublabel);\r\n\r\n // Buttons\r\n const btnRow = document.createElement(\"div\");\r\n btnRow.style.cssText = \"display:flex;gap:12px;width:100%;\";\r\n\r\n const retakeBtn = this.createButton(\"Retake\", theme, false);\r\n retakeBtn.style.flex = \"1\";\r\n retakeBtn.addEventListener(\"click\", () => {\r\n if ((img as any)._blobUrl) {\r\n URL.revokeObjectURL((img as any)._blobUrl);\r\n }\r\n this.root!.innerHTML = \"\";\r\n this.renderChoiceScreen(container, theme, documentType);\r\n });\r\n\r\n const useBtn = this.createButton(\"Use Photo \u2713\", theme, true);\r\n useBtn.style.flex = \"1\";\r\n useBtn.addEventListener(\"click\", () => {\r\n if ((img as any)._blobUrl) {\r\n URL.revokeObjectURL((img as any)._blobUrl);\r\n }\r\n useBtn.textContent = \"Processing...\";\r\n useBtn.disabled = true;\r\n this.compressImage(imageData, 1280, 960, 0.85)\r\n .then((compressed) => this.handleCaptureComplete(compressed, container, theme, documentType))\r\n .catch(() => this.handleCaptureComplete(imageData, container, theme, documentType)); // fallback to original\r\n });\r\n\r\n btnRow.appendChild(retakeBtn);\r\n btnRow.appendChild(useBtn);\r\n this.root.appendChild(btnRow);\r\n }\r\n\r\n private handleCaptureComplete(\r\n imageData: Blob,\r\n container: HTMLElement,\r\n theme: ThemeColors,\r\n documentType: string\r\n ): void {\r\n const requiresBack = this.requiresBackSide(documentType);\r\n const wasCapturingFront = this.currentSide === 'front';\r\n \r\n // Store the captured image\r\n if (wasCapturingFront) {\r\n this.frontBlob = imageData;\r\n } else {\r\n this.backBlob = imageData;\r\n }\r\n \r\n // If we need back side and haven't captured it yet, move to back side\r\n if (requiresBack && wasCapturingFront) {\r\n this.currentSide = 'back';\r\n this.root!.innerHTML = \"\";\r\n this.renderChoiceScreen(container, theme, documentType);\r\n return;\r\n }\r\n\r\n // All captures complete, resolve with result\r\n if (!this.frontBlob) {\r\n this.rejectCapture?.(new Error(\"No front image captured. Please try again.\"));\r\n return;\r\n }\r\n \r\n const result: DocumentCaptureResult = {\r\n front: this.frontBlob,\r\n back: this.backBlob || undefined\r\n };\r\n this.resolveCapture?.(result);\r\n }\r\n\r\n private handleFileUploadComplete(\r\n imageData: Blob,\r\n container: HTMLElement,\r\n theme: ThemeColors,\r\n documentType: string\r\n ): void {\r\n // Show preview first, then handle completion\r\n this.showPreview(container, theme, imageData, documentType);\r\n }\r\n\r\n private validateFile(file: File): string | null {\r\n // Check file type\r\n const allowedTypes = ['image/jpeg', 'image/jpg', 'image/png'];\r\n if (!allowedTypes.includes(file.type)) {\r\n return \"Invalid file type. Please upload a JPEG or PNG image.\";\r\n }\r\n \r\n // Check file size (max 10MB)\r\n const maxSize = 10 * 1024 * 1024;\r\n if (file.size > maxSize) {\r\n return \"File is too large. Please upload an image smaller than 10MB.\";\r\n }\r\n \r\n // Check minimum file size (at least 1KB to avoid empty files)\r\n if (file.size < 1024) {\r\n return \"File is too small. Please upload a valid image file.\";\r\n }\r\n \r\n return null;\r\n }\r\n\r\n private handleFileUpload(container: HTMLElement, theme: ThemeColors): void {\r\n const input = this.root?.querySelector(\"#sc-doc-file-input\") as HTMLInputElement;\r\n if (input) input.click();\r\n }\r\n\r\n private stopCamera(): void {\r\n if (this.stream) {\r\n this.stream.getTracks().forEach((t) => t.stop());\r\n this.stream = null;\r\n }\r\n if (this.videoEl) {\r\n this.videoEl.srcObject = null;\r\n this.videoEl = null;\r\n }\r\n }\r\n\r\n private createEnhancedButton(\r\n label: string,\r\n theme: ThemeColors,\r\n isPrimary: boolean,\r\n ariaLabel: string\r\n ): HTMLButtonElement {\r\n const btn = document.createElement(\"button\");\r\n btn.textContent = label;\r\n btn.setAttribute(\"aria-label\", ariaLabel);\r\n btn.style.cssText = `\r\n padding:18px 24px;border-radius:16px;font-size:16px;font-weight:600;\r\n cursor:pointer;transition:all 0.3s ease;border:none;width:100%;\r\n min-height:56px;touch-action:manipulation;-webkit-tap-highlight-color:transparent;\r\n position:relative;overflow:hidden;\r\n ${\r\n isPrimary\r\n ? `background:linear-gradient(135deg, ${theme.primary}, ${theme.primary}DD);color:#fff;box-shadow:0 8px 24px ${theme.primary}25, 0 4px 12px ${theme.primary}15;`\r\n : `background:${theme.inputBg};color:${theme.text};border:2px solid ${theme.border};box-shadow:0 2px 8px ${theme.border}20;`\r\n }\r\n `;\r\n \r\n // Add ripple effect\r\n btn.addEventListener(\"click\", (e) => {\r\n const ripple = document.createElement(\"span\");\r\n const rect = btn.getBoundingClientRect();\r\n const size = Math.max(rect.width, rect.height);\r\n const x = e.clientX - rect.left - size / 2;\r\n const y = e.clientY - rect.top - size / 2;\r\n \r\n ripple.style.cssText = `\r\n position:absolute;width:${size}px;height:${size}px;\r\n left:${x}px;top:${y}px;border-radius:50%;\r\n background:${isPrimary ? 'rgba(255,255,255,0.3)' : theme.primary + '20'};\r\n transform:scale(0);animation:ripple 0.6s ease-out;\r\n pointer-events:none;\r\n `;\r\n btn.appendChild(ripple);\r\n setTimeout(() => ripple.remove(), 600);\r\n });\r\n \r\n btn.addEventListener(\"mouseenter\", () => {\r\n btn.style.transform = \"translateY(-2px)\";\r\n if (isPrimary) {\r\n btn.style.boxShadow = `0 12px 32px ${theme.primary}30, 0 6px 16px ${theme.primary}20`;\r\n } else {\r\n btn.style.boxShadow = `0 4px 16px ${theme.border}30, 0 2px 8px ${theme.border}20`;\r\n btn.style.borderColor = theme.primary;\r\n }\r\n });\r\n btn.addEventListener(\"mouseleave\", () => {\r\n btn.style.transform = \"translateY(0)\";\r\n if (isPrimary) {\r\n btn.style.boxShadow = `0 8px 24px ${theme.primary}25, 0 4px 12px ${theme.primary}15`;\r\n } else {\r\n btn.style.boxShadow = `0 2px 8px ${theme.border}20`;\r\n btn.style.borderColor = theme.border;\r\n }\r\n });\r\n \r\n // Add ripple animation\r\n if (!document.head.querySelector('style[data-ripple-animation]')) {\r\n const style = document.createElement('style');\r\n style.setAttribute('data-ripple-animation', 'true');\r\n style.textContent = `\r\n @keyframes ripple {\r\n to { transform: scale(4); opacity: 0; }\r\n }\r\n `;\r\n document.head.appendChild(style);\r\n }\r\n \r\n return btn;\r\n }\r\n\r\n private showLoadingState(message: string, theme: ThemeColors): void {\r\n if (!this.root) return;\r\n \r\n this.root.innerHTML = \"\";\r\n this.root.style.cssText = \"display:flex;flex-direction:column;align-items:center;justify-content:center;gap:20px;padding:40px 20px;min-height:300px;\";\r\n \r\n // Enhanced loading spinner\r\n const spinnerContainer = document.createElement(\"div\");\r\n spinnerContainer.style.cssText = \"position:relative;width:80px;height:80px;\";\r\n \r\n const spinner = document.createElement(\"div\");\r\n spinner.style.cssText = `\r\n position:absolute;inset:0;border-radius:50%;\r\n border:4px solid ${theme.border};\r\n border-top-color:${theme.primary};\r\n animation:sc-spin 1s linear infinite;\r\n `;\r\n spinnerContainer.appendChild(spinner);\r\n \r\n const centerIcon = document.createElement(\"div\");\r\n centerIcon.style.cssText = `\r\n position:absolute;inset:0;display:flex;align-items:center;justify-content:center;\r\n font-size:28px;animation:pulse 2s ease-in-out infinite;\r\n `;\r\n centerIcon.textContent = \"\uD83D\uDCC4\";\r\n spinnerContainer.appendChild(centerIcon);\r\n \r\n this.root.appendChild(spinnerContainer);\r\n \r\n // Loading message\r\n const loadingText = document.createElement(\"div\");\r\n loadingText.style.cssText = `\r\n color:${theme.text};font-size:16px;font-weight:600;text-align:center;\r\n animation:fadeIn 0.5s ease-out;\r\n `;\r\n loadingText.textContent = message;\r\n this.root.appendChild(loadingText);\r\n \r\n // Add pulse animation\r\n if (!document.head.querySelector('style[data-pulse-animation]')) {\r\n const style = document.createElement('style');\r\n style.setAttribute('data-pulse-animation', 'true');\r\n style.textContent = `\r\n @keyframes pulse {\r\n 0%, 100% { transform: scale(1); opacity: 1; }\r\n 50% { transform: scale(1.1); opacity: 0.8; }\r\n }\r\n @keyframes fadeIn {\r\n from { opacity: 0; transform: translateY(10px); }\r\n to { opacity: 1; transform: translateY(0); }\r\n }\r\n `;\r\n document.head.appendChild(style);\r\n }\r\n }\r\n\r\n private showError(message: string): void {\r\n if (!this.root) return;\r\n \r\n const errorContainer = document.createElement(\"div\");\r\n errorContainer.style.cssText = `\r\n display:flex;align-items:center;gap:12px;padding:16px;\r\n background:#ff444415;border:1px solid #ff444430;border-radius:12px;\r\n color:#ff4444;font-size:14px;margin-top:16px;animation:shake 0.5s ease-in-out;\r\n `;\r\n errorContainer.innerHTML = `\r\n <span style=\"font-size:18px;\">\u26A0\uFE0F</span>\r\n <span>${message}</span>\r\n `;\r\n \r\n // Add shake animation\r\n if (!document.head.querySelector('style[data-shake-animation]')) {\r\n const style = document.createElement('style');\r\n style.setAttribute('data-shake-animation', 'true');\r\n style.textContent = `\r\n @keyframes shake {\r\n 0%, 100% { transform: translateX(0); }\r\n 25% { transform: translateX(-5px); }\r\n 75% { transform: translateX(5px); }\r\n }\r\n `;\r\n document.head.appendChild(style);\r\n }\r\n \r\n this.root.appendChild(errorContainer);\r\n setTimeout(() => errorContainer.remove(), 5000);\r\n }\r\n\r\n private createButton(\r\n label: string,\r\n theme: ThemeColors,\r\n isPrimary: boolean\r\n ): HTMLButtonElement {\r\n const btn = document.createElement(\"button\");\r\n btn.textContent = label;\r\n btn.style.cssText = `\r\n padding:16px 24px;border-radius:12px;font-size:16px;font-weight:600;\r\n cursor:pointer;transition:all 0.2s ease;border:none;width:100%;\r\n min-height:52px;touch-action:manipulation;-webkit-tap-highlight-color:transparent;\r\n ${\r\n isPrimary\r\n ? `background:${theme.primary};color:#fff;box-shadow:0 4px 12px ${theme.primary}30;`\r\n : `background:${theme.inputBg};color:${theme.text};border:2px solid ${theme.border};`\r\n }\r\n `;\r\n btn.addEventListener(\"mouseenter\", () => {\r\n btn.style.transform = \"translateY(-1px)\";\r\n if (isPrimary) btn.style.background = theme.primaryHover;\r\n });\r\n btn.addEventListener(\"mouseleave\", () => {\r\n btn.style.transform = \"translateY(0)\";\r\n if (isPrimary) btn.style.background = theme.primary;\r\n });\r\n return btn;\r\n }\r\n\r\n private compressImage(\r\n source: Blob | File,\r\n maxWidth: number,\r\n maxHeight: number,\r\n quality: number\r\n ): Promise<Blob> {\r\n return new Promise((resolve, reject) => {\r\n // Read EXIF orientation FIRST so we can correct rotation before canvas draw.\r\n // Canvas ignores EXIF metadata \u2014 without this, phone uploads arrive rotated.\r\n this._readExifOrientation(source).then((orientation) => {\r\n const url = URL.createObjectURL(source);\r\n const imgEl = document.createElement(\"img\");\r\n imgEl.onload = () => {\r\n URL.revokeObjectURL(url);\r\n let { naturalWidth: w, naturalHeight: h } = imgEl;\r\n\r\n // For orientations 5-8 the image is rotated 90\u00B0/270\u00B0 \u2014 swap dimensions\r\n const swapped = orientation >= 5 && orientation <= 8;\r\n const srcW = swapped ? h : w;\r\n const srcH = swapped ? w : h;\r\n const ratio = Math.min(maxWidth / srcW, maxHeight / srcH, 1);\r\n const outW = Math.round(srcW * ratio);\r\n const outH = Math.round(srcH * ratio);\r\n\r\n const canvas = document.createElement(\"canvas\");\r\n canvas.width = outW;\r\n canvas.height = outH;\r\n const ctx = canvas.getContext(\"2d\");\r\n if (!ctx) { reject(new Error(\"Canvas unavailable\")); return; }\r\n\r\n // Apply EXIF rotation transform before drawing\r\n ctx.save();\r\n if (orientation === 2) { ctx.transform(-1, 0, 0, 1, outW, 0); }\r\n else if (orientation === 3) { ctx.transform(-1, 0, 0, -1, outW, outH); }\r\n else if (orientation === 4) { ctx.transform( 1, 0, 0, -1, 0, outH); }\r\n else if (orientation === 5) { ctx.transform( 0, 1, 1, 0, 0, 0); }\r\n else if (orientation === 6) { ctx.transform( 0, 1, -1, 0, outH, 0); }\r\n else if (orientation === 7) { ctx.transform( 0, -1, -1, 0, outH, outW); }\r\n else if (orientation === 8) { ctx.transform( 0, -1, 1, 0, 0, outW); }\r\n ctx.drawImage(imgEl, 0, 0, swapped ? outH : outW, swapped ? outW : outH);\r\n ctx.restore();\r\n\r\n canvas.toBlob(\r\n (blob) => { blob ? resolve(blob) : reject(new Error(\"Compression failed\")); },\r\n \"image/jpeg\",\r\n quality\r\n );\r\n };\r\n imgEl.onerror = () => { URL.revokeObjectURL(url); reject(new Error(\"Image load failed\")); };\r\n imgEl.src = url;\r\n }).catch(() => {\r\n // If EXIF read fails, fall back to simple compression without rotation\r\n const url = URL.createObjectURL(source);\r\n const imgEl = document.createElement(\"img\");\r\n imgEl.onload = () => {\r\n URL.revokeObjectURL(url);\r\n let { naturalWidth: w, naturalHeight: h } = imgEl;\r\n const ratio = Math.min(maxWidth / w, maxHeight / h, 1);\r\n const canvas = document.createElement(\"canvas\");\r\n canvas.width = Math.round(w * ratio);\r\n canvas.height = Math.round(h * ratio);\r\n const ctx = canvas.getContext(\"2d\");\r\n if (!ctx) { reject(new Error(\"Canvas unavailable\")); return; }\r\n ctx.drawImage(imgEl, 0, 0, canvas.width, canvas.height);\r\n canvas.toBlob(\r\n (blob) => { blob ? resolve(blob) : reject(new Error(\"Compression failed\")); },\r\n \"image/jpeg\",\r\n quality\r\n );\r\n };\r\n imgEl.onerror = () => { URL.revokeObjectURL(url); reject(new Error(\"Image load failed\")); };\r\n imgEl.src = url;\r\n });\r\n });\r\n }\r\n\r\n /**\r\n * Read JPEG EXIF orientation tag (1\u20138) from a Blob/File.\r\n * Returns 1 (no rotation) if EXIF is absent or unreadable.\r\n */\r\n private _readExifOrientation(source: Blob | File): Promise<number> {\r\n return new Promise((resolve) => {\r\n const reader = new FileReader();\r\n reader.onload = (e) => {\r\n try {\r\n const buf = e.target?.result as ArrayBuffer;\r\n const view = new DataView(buf);\r\n if (view.getUint16(0, false) !== 0xFFD8) { resolve(1); return; } // not JPEG\r\n let offset = 2;\r\n while (offset < view.byteLength) {\r\n const marker = view.getUint16(offset, false);\r\n offset += 2;\r\n if (marker === 0xFFE1) { // APP1 \u2014 may contain EXIF\r\n if (view.getUint32(offset + 2, false) !== 0x45786966) { resolve(1); return; }\r\n const little = view.getUint16(offset + 8, false) === 0x4949;\r\n const ifdOff = offset + 8 + view.getUint32(offset + 12, little);\r\n const tags = view.getUint16(ifdOff, little);\r\n for (let i = 0; i < tags; i++) {\r\n if (view.getUint16(ifdOff + 2 + 12 * i, little) === 0x0112) {\r\n resolve(view.getUint16(ifdOff + 2 + 12 * i + 8, little));\r\n return;\r\n }\r\n }\r\n resolve(1); return;\r\n } else if ((marker & 0xFF00) !== 0xFF00) {\r\n break;\r\n } else {\r\n offset += view.getUint16(offset, false);\r\n }\r\n }\r\n resolve(1);\r\n } catch { resolve(1); }\r\n };\r\n reader.onerror = () => resolve(1);\r\n // Only need the first 64KB \u2014 EXIF is always in the first APP1 segment\r\n reader.readAsArrayBuffer(source.slice(0, 65536));\r\n });\r\n }\r\n\r\n private getDocumentLabel(type: string): string {\r\n const t = type.toLowerCase();\r\n if (t.includes(\"passport\")) return \"passport\";\r\n if (t.includes(\"driver\") || t.includes(\"licen\")) return \"driver's license\";\r\n if (t.includes(\"voter\") || t.includes(\"pvc\")) return \"voter's card\";\r\n if (t.includes(\"national\") || t.includes(\"nin\") || t.includes(\"national id\")) return \"national ID card\";\r\n if (t.includes(\"bvn\")) return \"BVN card\";\r\n return \"identity document\";\r\n }\r\n}\r\n", "import { SmartComply } from \"../client/Smartcomply\";\r\nimport { SDKInitConfig, VerifyIdentityResponse } from \"../types/onboarding\";\r\nimport { LivenessSubmitResponse, ChallengeAction } from \"../types/liveness\";\r\nimport { ThemeColors, getTheme } from \"./theme\";\r\nimport { DocumentCapture, DocumentCaptureResult } from \"./DocumentCapture\";\r\nimport { Environment } from \"../client/Config\";\r\nimport { collectDeviceMetadata } from \"../utils/device\";\r\n\r\n// \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\r\n// Public Types\r\n// \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\r\n\r\nexport interface FlowOptions {\r\n apiKey: string;\r\n clientId: string;\r\n environment?: Environment;\r\n timeout?: number;\r\n onComplete?: (result: FlowResult) => void;\r\n onError?: (error: Error) => void;\r\n onClose?: () => void;\r\n}\r\n\r\nexport interface FlowResult {\r\n entryId: number;\r\n sessionId: string | null;\r\n status: string;\r\n submittedAt: string | null;\r\n verificationResult?: VerifyIdentityResponse;\r\n}\r\n\r\n// \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\r\n// Step definitions\r\n// \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\r\n\r\ntype StepName =\r\n | \"loading\"\r\n | \"welcome\"\r\n | \"country\"\r\n | \"id_type\"\r\n | \"id_input\"\r\n | \"document_capture\"\r\n | \"processing\"\r\n | \"liveness\"\r\n | \"result\"\r\n | \"error\";\r\n\r\nconst STEP_ORDER: StepName[] = [\r\n \"loading\",\r\n \"welcome\",\r\n \"country\",\r\n \"id_type\",\r\n \"id_input\", // or document_capture\r\n \"document_capture\",\r\n \"processing\",\r\n \"liveness\",\r\n \"result\",\r\n];\r\n\r\nconst COUNTRY_LABELS: Record<string, string> = {\r\n nigeria: \"\uD83C\uDDF3\uD83C\uDDEC Nigeria\",\r\n global: \"\uD83C\uDF0D Other Countries\",\r\n ghana: \"\uD83C\uDDEC\uD83C\uDDED Ghana\",\r\n kenya: \"\uD83C\uDDF0\uD83C\uDDEA Kenya\",\r\n south_africa: \"\uD83C\uDDFF\uD83C\uDDE6 South Africa\",\r\n united_states: \"\uD83C\uDDFA\uD83C\uDDF8 United States\",\r\n united_kingdom: \"\uD83C\uDDEC\uD83C\uDDE7 United Kingdom\",\r\n};\r\n\r\nfunction resolveIdTypeInfo(\r\n typeName: string,\r\n isDocumentFlow: boolean\r\n): { icon: string; desc: string; requiresBack?: boolean } {\r\n const u = typeName.toUpperCase();\r\n const withFace = u.includes(\"WITH FACE\") || u.includes(\"FACE\");\r\n const advanced = u.includes(\"ADVANCED\");\r\n\r\n // Helper function to check if document requires back side\r\n const requiresBackSide = (type: string): boolean => {\r\n const t = type.toLowerCase();\r\n return t.includes(\"voter\") || \r\n t.includes(\"nin\") || \r\n t.includes(\"driver\") || \r\n t.includes(\"license\") || \r\n t.includes(\"national id\") ||\r\n t.includes(\"national id card\");\r\n };\r\n\r\n // BVN \u2014 always 11 digits\r\n if (u.includes(\"BVN\") || u.includes(\"BANK VERIFICATION\")) {\r\n const extra = withFace ? \" + selfie photo\" : \"\";\r\n return { icon: \"\uD83C\uDFE6\", desc: `Enter your 11-digit BVN${extra}`, requiresBack: false };\r\n }\r\n\r\n // NIN \u2014 always 11 digits\r\n if (u.includes(\"NIN\") || u.includes(\"NATIONAL IDENTITY NUMBER\")) {\r\n const extra = withFace ? \" + selfie photo\" : \"\";\r\n return { icon: \"\uD83C\uDD94\", desc: `Enter your 11-digit NIN${extra}`, requiresBack: false };\r\n }\r\n\r\n // Ghana Card / Ghana National ID\r\n if (u.includes(\"GHANA\")) {\r\n if (isDocumentFlow) return { icon: \"\uD83E\uDEAA\", desc: \"Capture or upload your Ghana Card\", requiresBack: true };\r\n const extra = withFace ? \" + selfie photo\" : \"\";\r\n return { icon: \"\uD83E\uDEAA\", desc: `Enter your Ghana Card number${extra}`, requiresBack: false };\r\n }\r\n\r\n // SSNIT (Ghana social security)\r\n if (u.includes(\"SSNIT\"))\r\n return { icon: \"\uD83C\uDFDB\uFE0F\", desc: \"Enter your SSNIT number\", requiresBack: false };\r\n\r\n // Kenya National ID\r\n if (u.includes(\"KENYA\") || (u.includes(\"NATIONAL\") && u.includes(\"KENYA\")))\r\n return { icon: \"\uD83C\uDD94\", desc: \"Enter your Kenya National ID number\", requiresBack: false };\r\n\r\n // TIN\r\n if (u.includes(\"TIN\") || u.includes(\"TAX IDENTIFICATION\"))\r\n return { icon: \"\uD83E\uDDFE\", desc: \"Enter your Tax Identification Number (TIN)\", requiresBack: false };\r\n\r\n // CAC / Company registration\r\n if (u.includes(\"CAC\") || u.includes(\"CORPORATE AFFAIRS\") || u.includes(\"COMPANY\"))\r\n return { icon: \"\uD83C\uDFE2\", desc: advanced ? \"Enter RC number, company name & type\" : \"Enter your company registration number\", requiresBack: false };\r\n\r\n // Voter / PVC\r\n if (u.includes(\"VOTER\") || u.includes(\"PVC\")) {\r\n const requiresBack = requiresBackSide(typeName);\r\n return { \r\n icon: \"\uD83D\uDDF3\uFE0F\", \r\n desc: isDocumentFlow \r\n ? `Capture or upload your voter's card${requiresBack ? \" (front & back)\" : \"\"}` \r\n : \"Enter your voter ID number\",\r\n requiresBack: isDocumentFlow ? requiresBack : false\r\n };\r\n }\r\n\r\n // Passport\r\n if (u.includes(\"PASSPORT\"))\r\n return { icon: \"\uD83D\uDCD8\", desc: isDocumentFlow ? \"Capture or upload your passport\" : \"Enter your passport number\", requiresBack: false };\r\n\r\n // Driver's license\r\n if (u.includes(\"DRIVER\") || u.includes(\"LICENSE\") || u.includes(\"LICENCE\")) {\r\n const requiresBack = requiresBackSide(typeName);\r\n return { \r\n icon: \"\uD83D\uDE97\", \r\n desc: isDocumentFlow \r\n ? `Capture or upload your driver's license${requiresBack ? \" (front & back)\" : \"\"}` \r\n : \"Enter your driver's license number\",\r\n requiresBack: isDocumentFlow ? requiresBack : false\r\n };\r\n }\r\n\r\n // National ID card (generic)\r\n if (u.includes(\"NATIONAL ID\") || (u.includes(\"NATIONAL\") && u.includes(\"CARD\"))) {\r\n const requiresBack = requiresBackSide(typeName);\r\n return { \r\n icon: \"\uD83E\uDEAA\", \r\n desc: isDocumentFlow \r\n ? `Capture or upload your ID card${requiresBack ? \" (front & back)\" : \"\"}` \r\n : \"Enter your National ID number\",\r\n requiresBack: isDocumentFlow ? requiresBack : false\r\n };\r\n }\r\n\r\n // Face liveness / comparison\r\n if (u.includes(\"LIVENESS\") || u.includes(\"FACE COMPARISON\") || u.includes(\"FACE MATCH\"))\r\n return { icon: \"\uD83E\uDD33\", desc: \"We'll capture a short selfie video to verify you\", requiresBack: false };\r\n\r\n return {\r\n icon: isDocumentFlow ? \"\uD83D\uDCC4\" : \"\uD83C\uDD94\",\r\n desc: isDocumentFlow ? \"Capture or upload your document\" : \"Enter your ID number\",\r\n requiresBack: false,\r\n };\r\n}\r\n\r\n// \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\r\n// SmartComplyFlow\r\n// \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\r\n\r\n// Add CSS animation keyframes for spin animations\r\nconst style = document.createElement('style');\r\nstyle.textContent = `\r\n @keyframes sc-spin {\r\n 0% { transform: rotate(0deg); }\r\n 100% { transform: rotate(360deg); }\r\n }\r\n`;\r\nif (!document.head.querySelector('style[data-sc-animations]')) {\r\n style.setAttribute('data-sc-animations', 'true');\r\n document.head.appendChild(style);\r\n}\r\n\r\nexport class SmartComplyFlow {\r\n private sdk: SmartComply;\r\n private options: FlowOptions;\r\n private theme: ThemeColors = getTheme(\"default\");\r\n\r\n // DOM\r\n private overlay: HTMLDivElement | null = null;\r\n private modal: HTMLDivElement | null = null;\r\n private contentArea: HTMLDivElement | null = null;\r\n private progressBar: HTMLDivElement | null = null;\r\n private stepLabel: HTMLDivElement | null = null;\r\n private brandLabel: HTMLDivElement | null = null;\r\n\r\n // State\r\n private sdkConfig: SDKInitConfig | null = null;\r\n private currentStep: StepName = \"loading\";\r\n private selectedCountry: string = \"\";\r\n private selectedChannelId: number = 0;\r\n private selectedChannelFields: { type: string; label: string; options?: string[] }[] = [];\r\n private selectedIdType: string = \"\"; // Canonical code (e.g., \"national_id\", \"nin_with_face\")\r\n private selectedIdTypeName: string = \"\"; // Display name (e.g., \"National Identity Number with Face (NIN)\")\r\n private collectedFields: Record<string, string> = {};\r\n private idNumber: string = \"\";\r\n private documentBlob: Blob | null = null;\r\n private documentBackBlob: Blob | null = null;\r\n private identityCheckId: number | null = null;\r\n private verificationResult: VerifyIdentityResponse | null = null;\r\n private livenessEntryId: number | null = null;\r\n private isDestroyed = false;\r\n private headerBackBtn: HTMLButtonElement | null = null;\r\n\r\n // Session expiry\r\n private sessionExpiryTimer: ReturnType<typeof setTimeout> | null = null;\r\n\r\n // Status polling (result screen)\r\n private _pollStatusTimer: ReturnType<typeof setTimeout> | null = null;\r\n\r\n // Components\r\n private docCapture: DocumentCapture | null = null;\r\n\r\n private constructor(options: FlowOptions) {\r\n this.options = options;\r\n this.sdk = new SmartComply({\r\n apiKey: options.apiKey,\r\n clientId: options.clientId,\r\n environment: options.environment || \"sandbox\",\r\n timeout: options.timeout,\r\n });\r\n }\r\n\r\n /**\r\n * Open the SmartComply verification flow.\r\n *\r\n * Usage:\r\n * SmartComplyFlow.open({\r\n * apiKey: \"pk_live_...\",\r\n * clientId: \"uuid-...\",\r\n * environment: \"production\",\r\n * onComplete: (result) => console.log(\"Done!\", result),\r\n * onError: (err) => console.error(err),\r\n * onClose: () => console.log(\"Closed\"),\r\n * });\r\n */\r\n static open(options: FlowOptions): SmartComplyFlow {\r\n const flow = new SmartComplyFlow(options);\r\n flow.mount();\r\n flow.initialize();\r\n return flow;\r\n }\r\n\r\n /**\r\n * Close and destroy the flow widget.\r\n */\r\n close(): void {\r\n this.isDestroyed = true;\r\n this.docCapture?.destroy();\r\n if (this.sessionExpiryTimer) {\r\n clearTimeout(this.sessionExpiryTimer);\r\n this.sessionExpiryTimer = null;\r\n }\r\n if (this._pollStatusTimer) {\r\n clearTimeout(this._pollStatusTimer);\r\n this._pollStatusTimer = null;\r\n }\r\n\r\n if (this.overlay) {\r\n this.overlay.style.opacity = \"0\";\r\n setTimeout(() => {\r\n if (this.overlay?.parentElement) {\r\n this.overlay.parentElement.removeChild(this.overlay);\r\n }\r\n this.overlay = null;\r\n this.modal = null;\r\n this.contentArea = null;\r\n }, 300);\r\n }\r\n\r\n this.options.onClose?.();\r\n }\r\n\r\n // \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\r\n // Initialization\r\n // \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\r\n\r\n private mount(): void {\r\n // Inject keyframes\r\n this.injectStyles();\r\n\r\n // Overlay\r\n this.overlay = document.createElement(\"div\");\r\n this.overlay.id = \"sc-flow-overlay\";\r\n this.overlay.style.cssText = `\r\n position:fixed;inset:0;z-index:99999;\r\n display:flex;align-items:center;justify-content:center;\r\n background:${this.theme.overlay};\r\n backdrop-filter:blur(6px);-webkit-backdrop-filter:blur(6px);\r\n opacity:0;transition:opacity 0.3s ease;\r\n font-family:'Inter','Segoe UI',system-ui,-apple-system,sans-serif;\r\n `;\r\n\r\n // Modal\r\n this.modal = document.createElement(\"div\");\r\n this.modal.id = \"sc-flow-modal\";\r\n this.modal.style.cssText = `\r\n width:100%;max-width:440px;max-height:92vh;\r\n background:${this.theme.bg};\r\n border-radius:20px;overflow:hidden;\r\n box-shadow:${this.theme.shadow};\r\n display:flex;flex-direction:column;\r\n transform:translateY(20px) scale(0.97);\r\n transition:transform 0.35s cubic-bezier(0.16,1,0.3,1);\r\n `;\r\n\r\n // Header\r\n const header = this.createHeader();\r\n this.modal.appendChild(header);\r\n\r\n // Progress bar\r\n const progressWrap = document.createElement(\"div\");\r\n progressWrap.style.cssText = `height:3px;background:${this.theme.shimmer};`;\r\n this.progressBar = document.createElement(\"div\");\r\n this.progressBar.style.cssText = `\r\n height:100%;width:0%;background:linear-gradient(90deg,${this.theme.primary},${this.theme.primaryHover});\r\n border-radius:0 2px 2px 0;transition:width 0.5s ease;\r\n `;\r\n progressWrap.appendChild(this.progressBar);\r\n this.modal.appendChild(progressWrap);\r\n\r\n // Content area (scrollable)\r\n this.contentArea = document.createElement(\"div\");\r\n this.contentArea.id = \"sc-flow-content\";\r\n this.contentArea.style.cssText = `\r\n flex:1;overflow-y:auto;padding:20px 24px;\r\n -webkit-overflow-scrolling:touch;\r\n `;\r\n this.modal.appendChild(this.contentArea);\r\n\r\n // Footer\r\n const footer = this.createFooter();\r\n this.modal.appendChild(footer);\r\n\r\n this.overlay.appendChild(this.modal);\r\n document.body.appendChild(this.overlay);\r\n\r\n // Animate in\r\n requestAnimationFrame(() => {\r\n if (this.overlay) this.overlay.style.opacity = \"1\";\r\n if (this.modal) this.modal.style.transform = \"translateY(0) scale(1)\";\r\n });\r\n }\r\n\r\n private async initialize(): Promise<void> {\r\n this.showStep(\"loading\");\r\n\r\n try {\r\n // Create session\r\n await this.sdk.createSession();\r\n\r\n // C4: Start session expiry timer (warn 2 min before 30-min expiry)\r\n const expiresAt = this.sdk.sessionExpiresAt;\r\n if (expiresAt) {\r\n const expiresMs = new Date(expiresAt).getTime() - Date.now();\r\n const warnMs = Math.max(expiresMs - 120000, 0); // warn 2 min before\r\n this.sessionExpiryTimer = setTimeout(() => {\r\n if (!this.isDestroyed && this.currentStep !== \"result\") {\r\n this.showErrorStep(\"Your session is about to expire. Please complete verification quickly or restart.\");\r\n }\r\n }, warnMs);\r\n }\r\n\r\n // Load config\r\n this.sdkConfig = await this.sdk.initializeConfig();\r\n\r\n // Apply theme from config\r\n if (this.sdkConfig.theme) {\r\n this.theme = getTheme(this.sdkConfig.theme);\r\n this.applyTheme();\r\n }\r\n\r\n // Update brand name\r\n if (this.brandLabel && this.sdkConfig.brand_name) {\r\n this.brandLabel.textContent = this.sdkConfig.brand_name;\r\n }\r\n\r\n if (this.isDestroyed) return;\r\n\r\n this.showStep(\"welcome\");\r\n\r\n } catch (err: any) {\r\n this.showErrorStep(err.message || \"Failed to initialize. Please try again.\");\r\n }\r\n }\r\n\r\n // \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\r\n // Step rendering\r\n // \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\r\n\r\n private showStep(step: StepName): void {\r\n this.currentStep = step;\r\n if (!this.contentArea) return;\r\n\r\n // Update progress\r\n this.updateProgress();\r\n\r\n // Animate out current content\r\n const oldContent = this.contentArea.firstChild as HTMLElement | null;\r\n if (oldContent) {\r\n oldContent.style.cssText += \"opacity:0;transform:translateX(-20px);transition:all 0.2s ease;\";\r\n setTimeout(() => {\r\n if (this.contentArea) this.contentArea.innerHTML = \"\";\r\n this.renderStep(step);\r\n }, 200);\r\n } else {\r\n this.renderStep(step);\r\n }\r\n }\r\n\r\n private renderStep(step: StepName): void {\r\n if (!this.contentArea) return;\r\n\r\n const wrapper = document.createElement(\"div\");\r\n wrapper.style.cssText = \"opacity:0;transform:translateX(20px);transition:all 0.3s ease;\";\r\n\r\n switch (step) {\r\n case \"loading\":\r\n this.renderLoading(wrapper);\r\n break;\r\n case \"welcome\":\r\n this.renderWelcome(wrapper);\r\n break;\r\n case \"country\":\r\n this.renderCountrySelect(wrapper);\r\n break;\r\n case \"id_type\":\r\n this.renderIdTypeSelect(wrapper);\r\n break;\r\n case \"id_input\":\r\n this.renderIdInput(wrapper);\r\n break;\r\n case \"document_capture\":\r\n this.renderDocumentCapture(wrapper);\r\n break;\r\n case \"processing\":\r\n this.renderProcessing(wrapper);\r\n break;\r\n case \"liveness\":\r\n this.renderLiveness(wrapper);\r\n break;\r\n case \"result\":\r\n this.renderResult(wrapper);\r\n break;\r\n case \"error\":\r\n break; // handled separately\r\n }\r\n\r\n this.contentArea.appendChild(wrapper);\r\n\r\n // Animate in\r\n requestAnimationFrame(() => {\r\n wrapper.style.opacity = \"1\";\r\n wrapper.style.transform = \"translateX(0)\";\r\n });\r\n }\r\n\r\n // \u2500\u2500 Loading \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\r\n\r\n private renderLoading(container: HTMLElement): void {\r\n container.style.cssText += \"display:flex;flex-direction:column;align-items:center;justify-content:center;min-height:300px;gap:16px;\";\r\n\r\n const spinnerWrap = document.createElement(\"div\");\r\n spinnerWrap.style.cssText = \"position:relative;width:60px;height:60px;flex-shrink:0;\";\r\n\r\n const ring = document.createElement(\"div\");\r\n ring.style.cssText = `\r\n position:absolute;inset:0;border-radius:50%;\r\n border:3px solid ${this.theme.border};\r\n border-top-color:${this.theme.primary};\r\n animation:sc-spin 0.9s linear infinite;\r\n `;\r\n const centre = document.createElement(\"div\");\r\n centre.style.cssText = `\r\n position:absolute;inset:0;\r\n display:flex;align-items:center;justify-content:center;\r\n font-size:22px;\r\n `;\r\n centre.textContent = \"\\uD83D\\uDEE1\\uFE0F\";\r\n spinnerWrap.appendChild(ring);\r\n spinnerWrap.appendChild(centre);\r\n container.appendChild(spinnerWrap);\r\n\r\n const label = document.createElement(\"div\");\r\n label.style.cssText = `color:${this.theme.text};font-size:15px;font-weight:600;`;\r\n label.textContent = \"Setting up secure session\";\r\n container.appendChild(label);\r\n\r\n const sub = document.createElement(\"div\");\r\n sub.style.cssText = `color:${this.theme.textMuted};font-size:12px;text-align:center;max-width:220px;line-height:1.5;`;\r\n sub.textContent = \"Connecting to the verification service...\";\r\n container.appendChild(sub);\r\n }\r\n\r\n // \u2500\u2500 Welcome \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\r\n\r\n private renderWelcome(container: HTMLElement): void {\r\n container.style.cssText += \"display:flex;flex-direction:column;align-items:center;text-align:center;gap:14px;\";\r\n\r\n const isDocFlow = this.isDocumentFlow();\r\n\r\n // Icon + badge row (side by side to save vertical space)\r\n const topRow = document.createElement(\"div\");\r\n topRow.style.cssText = \"display:flex;flex-direction:column;align-items:center;gap:10px;\";\r\n\r\n const iconWrap = document.createElement(\"div\");\r\n iconWrap.style.cssText = `\r\n width:58px;height:58px;border-radius:16px;\r\n display:flex;align-items:center;justify-content:center;\r\n font-size:26px;\r\n background:linear-gradient(135deg,${this.theme.primary}22,${this.theme.primaryGlow});\r\n border:1.5px solid ${this.theme.primary}33;\r\n `;\r\n iconWrap.textContent = isDocFlow ? \"\uD83E\uDEAA\" : \"\uD83D\uDEE1\uFE0F\";\r\n topRow.appendChild(iconWrap);\r\n\r\n const badge = document.createElement(\"div\");\r\n badge.style.cssText = `\r\n display:inline-flex;align-items:center;gap:5px;\r\n padding:3px 11px;border-radius:999px;\r\n font-size:10.5px;font-weight:600;letter-spacing:0.2px;\r\n background:${this.theme.primary}15;\r\n color:${this.theme.primary};\r\n border:1px solid ${this.theme.primary}30;\r\n `;\r\n badge.textContent = isDocFlow ? \"\uD83D\uDCC4 Document Verification\" : \"\uD83D\uDD0D Data Verification\";\r\n topRow.appendChild(badge);\r\n container.appendChild(topRow);\r\n\r\n // Title + subtitle (compact)\r\n const titleWrap = document.createElement(\"div\");\r\n titleWrap.style.cssText = \"display:flex;flex-direction:column;gap:5px;\";\r\n\r\n const title = document.createElement(\"h2\");\r\n title.style.cssText = `\r\n color:${this.theme.text};font-size:20px;font-weight:700;\r\n margin:0;line-height:1.2;\r\n `;\r\n title.textContent = \"Identity Verification\";\r\n titleWrap.appendChild(title);\r\n\r\n const desc = document.createElement(\"p\");\r\n desc.style.cssText = `\r\n color:${this.theme.textSecondary};font-size:13px;line-height:1.5;\r\n margin:0;max-width:300px;\r\n `;\r\n desc.textContent = isDocFlow\r\n ? \"Scan your ID document and take a quick selfie to confirm your identity.\"\r\n : \"Enter your ID details and take a quick selfie to confirm your identity.\";\r\n titleWrap.appendChild(desc);\r\n container.appendChild(titleWrap);\r\n\r\n // Steps preview \u2014 compact rows\r\n const steps = isDocFlow\r\n ? [\r\n { icon: \"\uD83E\uDEAA\", text: \"Choose your document type\", sub: \"Passport, National ID, Driver License\" },\r\n { icon: \"\uD83D\uDCF7\", text: \"Scan your document\", sub: \"Upload or capture a photo of your ID\" },\r\n { icon: \"\uD83E\uDD33\", text: \"Face check\", sub: \"Quick selfie to confirm it's you\" },\r\n ]\r\n : [\r\n { icon: \"\uD83C\uDD94\", text: \"Choose your ID type\", sub: \"NIN, BVN, Voter's Card and more\" },\r\n { icon: \"\uD83D\uDCDD\", text: \"Enter your ID details\", sub: \"Exactly as shown on your ID\" },\r\n { icon: \"\uD83E\uDD33\", text: \"Face check\", sub: \"Quick selfie to confirm it's you\" },\r\n ];\r\n\r\n const stepsWrap = document.createElement(\"div\");\r\n stepsWrap.style.cssText = `\r\n width:100%;display:flex;flex-direction:column;gap:0;\r\n border-radius:12px;overflow:hidden;\r\n border:1.5px solid ${this.theme.border};\r\n `;\r\n\r\n steps.forEach((step, i) => {\r\n const row = document.createElement(\"div\");\r\n row.style.cssText = `\r\n display:flex;align-items:center;gap:12px;\r\n padding:9px 14px;\r\n background:${this.theme.cardBg};\r\n ${i < steps.length - 1 ? `border-bottom:1px solid ${this.theme.border};` : \"\"}\r\n `;\r\n\r\n const iconEl = document.createElement(\"div\");\r\n iconEl.style.cssText = `\r\n width:28px;height:28px;border-radius:8px;flex-shrink:0;\r\n display:flex;align-items:center;justify-content:center;\r\n font-size:13px;\r\n background:${this.theme.primary}12;\r\n border:1px solid ${this.theme.primary}20;\r\n `;\r\n iconEl.textContent = step.icon;\r\n\r\n const textWrap = document.createElement(\"div\");\r\n textWrap.style.cssText = \"display:flex;flex-direction:column;gap:1px;text-align:left;\";\r\n\r\n const textEl = document.createElement(\"span\");\r\n textEl.style.cssText = `color:${this.theme.text};font-size:12.5px;font-weight:600;`;\r\n textEl.textContent = step.text;\r\n\r\n const subEl = document.createElement(\"span\");\r\n subEl.style.cssText = `color:${this.theme.textMuted};font-size:10.5px;`;\r\n subEl.textContent = step.sub;\r\n\r\n textWrap.appendChild(textEl);\r\n textWrap.appendChild(subEl);\r\n row.appendChild(iconEl);\r\n row.appendChild(textWrap);\r\n stepsWrap.appendChild(row);\r\n });\r\n\r\n container.appendChild(stepsWrap);\r\n\r\n // CTA\r\n const btn = this.createPrimaryButton(\"Get Started \u2192\");\r\n btn.style.cssText += \"margin-top:2px;\";\r\n btn.addEventListener(\"click\", () => this.showStep(\"country\"));\r\n container.appendChild(btn);\r\n\r\n // Trust badge\r\n const trust = document.createElement(\"div\");\r\n trust.style.cssText = `\r\n display:flex;align-items:center;gap:6px;\r\n color:${this.theme.textMuted};font-size:10.5px;\r\n `;\r\n trust.textContent = \"\uD83D\uDD12 End-to-end encrypted \u00B7 Powered by Adhere\";\r\n container.appendChild(trust);\r\n }\r\n\r\n // \u2500\u2500 Country Select \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\r\n\r\n private renderCountrySelect(container: HTMLElement): void {\r\n container.style.cssText += \"display:flex;flex-direction:column;gap:16px;\";\r\n\r\n const channels = this.sdkConfig?.channels || {};\r\n const countries = Object.keys(channels);\r\n\r\n // Auto-skip country selection if only one country available\r\n if (countries.length === 1) {\r\n this.selectedCountry = countries[0];\r\n this.showStep(\"id_type\");\r\n return;\r\n }\r\n\r\n const title = this.createStepTitle(\"Select your country\");\r\n container.appendChild(title);\r\n\r\n const subtitle = document.createElement(\"div\");\r\n subtitle.style.cssText = `color:${this.theme.textSecondary};font-size:13px;margin-top:-8px;`;\r\n subtitle.textContent = \"Choose the country that issued your ID\";\r\n container.appendChild(subtitle);\r\n\r\n for (const country of countries) {\r\n const card = this.createOptionCard(\r\n COUNTRY_LABELS[country] || country,\r\n `${channels[country].length} ID type${channels[country].length > 1 ? \"s\" : \"\"} available`,\r\n () => {\r\n this.selectedCountry = country;\r\n this.showStep(\"id_type\");\r\n }\r\n );\r\n container.appendChild(card);\r\n }\r\n }\r\n\r\n // \u2500\u2500 ID Type Select \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\r\n\r\n private renderIdTypeSelect(container: HTMLElement): void {\r\n container.style.cssText += \"display:flex;flex-direction:column;gap:16px;\";\r\n\r\n const globalDocFlow = this.isDocumentFlow();\r\n\r\n const title = this.createStepTitle(globalDocFlow ? \"Select document type\" : \"Select ID type\");\r\n container.appendChild(title);\r\n\r\n const subtitle = document.createElement(\"div\");\r\n subtitle.style.cssText = `color:${this.theme.textSecondary};font-size:13px;margin-top:-8px;`;\r\n subtitle.textContent = globalDocFlow\r\n ? \"Choose the document you want to scan\"\r\n : \"Choose the ID you want to verify\";\r\n container.appendChild(subtitle);\r\n\r\n const channels = this.sdkConfig?.channels || {};\r\n const idTypes = channels[this.selectedCountry] || [];\r\n\r\n for (const idType of idTypes) {\r\n const typeName = typeof idType === \"string\" ? idType : idType.name;\r\n // Use code (canonical) for API calls, fallback to name for backward compatibility\r\n const typeCode = typeof idType === \"string\" ? idType : (idType.code || idType.name);\r\n // Detect per-channel: does THIS specific channel have upload fields?\r\n const channelFields: any[] = typeof idType !== \"string\" ? (idType.fields || []) : [];\r\n const isThisDocFlow = channelFields.some((f: any) => f.type === \"upload\") || globalDocFlow;\r\n const info = resolveIdTypeInfo(typeName, isThisDocFlow);\r\n\r\n // Add back side indicator to subtitle if needed\r\n let subtitle = info.desc;\r\n if (info.requiresBack && isThisDocFlow) {\r\n subtitle += \" \u26A0\uFE0F Both sides required\";\r\n }\r\n\r\n const card = this.createOptionCard(\r\n `${info.icon} ${typeName}`,\r\n subtitle,\r\n () => {\r\n this.selectedIdType = typeCode; // Store canonical code for API\r\n this.selectedIdTypeName = typeName; // Keep display name for UI\r\n // Always reset first to avoid stale state when user goes back and changes selection\r\n this.selectedChannelId = 0;\r\n this.selectedChannelFields = [];\r\n if (typeof idType !== \"string\") {\r\n this.selectedChannelId = idType.id;\r\n this.selectedChannelFields = idType.fields || []; // guard null/undefined from backend\r\n }\r\n this.collectedFields = {};\r\n // Route: use explicit verification_type when set (more reliable than inspecting all channels)\r\n // Fallback to per-channel upload field check for mixed / unconfigured setups\r\n const hasUpload = (this.selectedChannelFields).some((f: any) => f.type === \"upload\");\r\n const vType = this.sdkConfig?.verification_type;\r\n const vTypes: string[] = vType ? (Array.isArray(vType) ? vType : [vType]) : [];\r\n const isDocChannel = hasUpload || (vTypes.length > 0 && vTypes.includes(\"document_verification\"));\r\n this.showStep(isDocChannel ? \"document_capture\" : \"id_input\");\r\n }\r\n );\r\n container.appendChild(card);\r\n }\r\n\r\n }\r\n\r\n // \u2500\u2500 ID Input (data verification \u2014 dynamic fields) \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\r\n\r\n private renderIdInput(container: HTMLElement): void {\r\n container.style.cssText += \"display:flex;flex-direction:column;gap:16px;\";\r\n\r\n const dataFields = this.selectedChannelFields.filter((f) => f.type !== \"upload\");\r\n const info = resolveIdTypeInfo(this.selectedIdTypeName || this.selectedIdType, false);\r\n\r\n const title = this.createStepTitle(`${info.icon} ${this.selectedIdTypeName || this.selectedIdType}`);\r\n container.appendChild(title);\r\n\r\n const subtitle = document.createElement(\"div\");\r\n subtitle.style.cssText = `color:${this.theme.textSecondary};font-size:13px;margin-top:-8px;`;\r\n subtitle.textContent = dataFields.length > 0\r\n ? `Enter your ${this.selectedIdTypeName || this.selectedIdType} details exactly as they appear on your ID.`\r\n : \"Fill in the fields below to continue.\";\r\n container.appendChild(subtitle);\r\n\r\n // Edge case: no data fields configured \u2014 show fallback and allow submission\r\n if (dataFields.length === 0) {\r\n const empty = document.createElement(\"div\");\r\n empty.style.cssText = `\r\n padding:16px;border-radius:10px;\r\n background:${this.theme.cardBg};border:1px solid ${this.theme.border};\r\n color:${this.theme.textSecondary};font-size:13px;text-align:center;\r\n `;\r\n empty.textContent = \"No additional details required. Click below to continue.\";\r\n container.appendChild(empty);\r\n const autoBtn = this.createPrimaryButton(\"Continue\");\r\n autoBtn.addEventListener(\"click\", () => this.showStep(\"liveness\"));\r\n container.appendChild(autoBtn);\r\n return;\r\n }\r\n\r\n // Track input elements for validation\r\n const inputEls: { field: any; el: HTMLInputElement | HTMLSelectElement }[] = [];\r\n\r\n for (const field of dataFields) {\r\n const fieldKey = field.label.toLowerCase().replace(/[^a-z0-9]+/g, \"_\");\r\n\r\n const fieldWrap = document.createElement(\"div\");\r\n fieldWrap.style.cssText = \"display:flex;flex-direction:column;gap:6px;\";\r\n\r\n const label = document.createElement(\"label\");\r\n label.style.cssText = `color:${this.theme.textMuted};font-size:10px;font-weight:700;letter-spacing:0.6px;text-transform:uppercase;`;\r\n label.textContent = field.label;\r\n fieldWrap.appendChild(label);\r\n\r\n if (field.type === \"dropdown\" || field.type === \"select\") {\r\n // Dropdown field\r\n const select = document.createElement(\"select\");\r\n select.style.cssText = `\r\n width:100%;padding:13px 16px;border-radius:12px;\r\n font-size:15px;\r\n background:${this.theme.inputBg};\r\n color:${this.theme.text};\r\n border:2px solid ${this.theme.border};\r\n outline:none;box-sizing:border-box;\r\n cursor:pointer;transition:border-color 0.2s ease;\r\n `;\r\n const placeholder = document.createElement(\"option\");\r\n placeholder.value = \"\";\r\n placeholder.textContent = `Select ${field.label}`;\r\n placeholder.disabled = true;\r\n placeholder.selected = true;\r\n select.appendChild(placeholder);\r\n\r\n for (const opt of field.options || []) {\r\n const option = document.createElement(\"option\");\r\n option.value = opt;\r\n option.textContent = opt;\r\n select.appendChild(option);\r\n }\r\n\r\n select.addEventListener(\"focus\", () => { select.style.borderColor = this.theme.primary; });\r\n select.addEventListener(\"blur\", () => { select.style.borderColor = this.theme.border; });\r\n select.addEventListener(\"change\", () => {\r\n this.collectedFields[fieldKey] = select.value;\r\n updateSubmitState();\r\n });\r\n fieldWrap.appendChild(select);\r\n inputEls.push({ field, el: select });\r\n } else if (field.type === \"image\" || field.type === \"file\") {\r\n // File upload field \u2014 converts to base64 for API submission\r\n const fileInput = document.createElement(\"input\");\r\n fileInput.type = \"file\";\r\n fileInput.accept = \"image/*\";\r\n fileInput.style.cssText = `\r\n width:100%;padding:12px 16px;border-radius:12px;\r\n font-size:14px;font-weight:500;\r\n background:${this.theme.inputBg};\r\n color:${this.theme.text};\r\n border:2px dashed ${this.theme.border};\r\n outline:none;transition:border-color 0.2s ease;\r\n box-sizing:border-box;cursor:pointer;\r\n `;\r\n fileInput.addEventListener(\"focus\", () => {\r\n fileInput.style.borderColor = this.theme.primary;\r\n });\r\n fileInput.addEventListener(\"blur\", () => {\r\n fileInput.style.borderColor = this.theme.border;\r\n });\r\n fileInput.addEventListener(\"change\", () => {\r\n const file = fileInput.files?.[0];\r\n if (file) {\r\n const reader = new FileReader();\r\n reader.onload = () => {\r\n const base64 = (reader.result as string).split(\",\")[1] || \"\";\r\n this.collectedFields[fieldKey] = base64;\r\n updateSubmitState();\r\n };\r\n reader.readAsDataURL(file);\r\n }\r\n });\r\n fieldWrap.appendChild(fileInput);\r\n inputEls.push({ field, el: fileInput as any });\r\n } else {\r\n // Text input field\r\n const input = document.createElement(\"input\");\r\n input.type = \"text\";\r\n input.placeholder = `Enter ${field.label}`;\r\n input.maxLength = 50;\r\n input.style.cssText = `\r\n width:100%;padding:14px 16px;border-radius:12px;\r\n font-size:16px;font-weight:500;\r\n background:${this.theme.inputBg};\r\n color:${this.theme.text};\r\n border:2px solid ${this.theme.border};\r\n outline:none;transition:border-color 0.2s ease;\r\n box-sizing:border-box;\r\n letter-spacing:0.5px;\r\n `;\r\n input.addEventListener(\"focus\", () => {\r\n input.style.borderColor = this.theme.primary;\r\n });\r\n input.addEventListener(\"blur\", () => {\r\n input.style.borderColor = this.theme.border;\r\n });\r\n input.addEventListener(\"input\", () => {\r\n this.collectedFields[fieldKey] = input.value.trim();\r\n updateSubmitState();\r\n });\r\n fieldWrap.appendChild(input);\r\n inputEls.push({ field, el: input });\r\n }\r\n container.appendChild(fieldWrap);\r\n }\r\n\r\n // Error area\r\n const errorEl = document.createElement(\"div\");\r\n errorEl.id = \"sc-id-error\";\r\n errorEl.style.cssText = `\r\n color:${this.theme.error};font-size:13px;display:none;\r\n padding:8px 12px;border-radius:8px;background:${this.theme.errorBg};\r\n `;\r\n container.appendChild(errorEl);\r\n\r\n // Submit\r\n const submitBtn = this.createPrimaryButton(\"Verify & Continue\");\r\n submitBtn.disabled = true;\r\n submitBtn.style.opacity = \"0.5\";\r\n\r\n const updateSubmitState = () => {\r\n const allFilled = inputEls.every(({ el }) => el.value.trim().length > 0);\r\n submitBtn.disabled = !allFilled;\r\n submitBtn.style.opacity = allFilled ? \"1\" : \"0.5\";\r\n };\r\n\r\n submitBtn.addEventListener(\"click\", async () => {\r\n submitBtn.disabled = true;\r\n submitBtn.innerHTML = `<span style=\"display:inline-flex;align-items:center;justify-content:center;gap:8px;\"><span style=\"width:13px;height:13px;border-radius:50%;border:2px solid rgba(255,255,255,0.3);border-top-color:#fff;animation:sc-spin 0.6s linear infinite;display:inline-block;flex-shrink:0;\"></span>Verifying...</span>`;\r\n errorEl.style.display = \"none\";\r\n\r\n try {\r\n this.verificationResult = await this.sdk.onboarding.verify({\r\n identity_type_id: this.selectedChannelId,\r\n fields: { ...this.collectedFields },\r\n });\r\n\r\n if (this.verificationResult.status === \"verified\" || this.verificationResult.status === \"success\") {\r\n // Save the first collected field value as identifier for liveness\r\n const fieldValues = Object.values(this.collectedFields);\r\n this.idNumber = fieldValues[0] || \"\";\r\n // A4: Save identity_check_id from verify response to pass to liveness\r\n this.identityCheckId = (this.verificationResult as any).data?.identity_check_id || null;\r\n this.showStep(\"liveness\");\r\n } else {\r\n errorEl.textContent = this.verificationResult.message || \"Verification failed. Please check your details.\";\r\n errorEl.style.display = \"block\";\r\n submitBtn.textContent = \"Verify & Continue\";\r\n submitBtn.disabled = false;\r\n submitBtn.style.opacity = \"1\";\r\n }\r\n } catch (err: any) {\r\n // C3: Show field-level errors if available\r\n const fieldErrors = err.data?.errors;\r\n if (Array.isArray(fieldErrors) && fieldErrors.length > 0) {\r\n const messages = fieldErrors.map((e: any) => `${e.field}: ${e.message}`).join(\"\\n\");\r\n errorEl.textContent = messages;\r\n } else {\r\n errorEl.textContent = err.message || \"Verification failed\";\r\n }\r\n errorEl.style.display = \"block\";\r\n submitBtn.textContent = \"Verify & Continue\";\r\n submitBtn.disabled = false;\r\n submitBtn.style.opacity = \"1\";\r\n }\r\n });\r\n container.appendChild(submitBtn);\r\n\r\n\r\n // Focus first input\r\n const firstInput = inputEls[0]?.el;\r\n if (firstInput && firstInput instanceof HTMLInputElement) {\r\n setTimeout(() => firstInput.focus(), 350);\r\n }\r\n }\r\n\r\n // \u2500\u2500 Document Capture \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\r\n\r\n \r\n private renderDocumentCapture(container: HTMLElement): void {\r\n container.style.cssText += \"display:flex;flex-direction:column;gap:16px;\";\r\n\r\n const title = this.createStepTitle(`Capture ${this.selectedIdTypeName || this.selectedIdType || \"your document\"}`);\r\n container.appendChild(title);\r\n\r\n const subtitle = document.createElement(\"div\");\r\n subtitle.style.cssText = `color:${this.theme.textSecondary};font-size:13px;margin-top:-8px;`;\r\n subtitle.textContent = \"Upload or capture your document photo. Ensure it's clear and readable.\";\r\n container.appendChild(subtitle);\r\n\r\n const captureContainer = document.createElement(\"div\");\r\n captureContainer.style.cssText = `\r\n width: 100%;\r\n max-width: 400px;\r\n margin: 0 auto;\r\n position: relative;\r\n overflow: hidden;\r\n border-radius: 12px;\r\n background: ${this.theme.cardBg};\r\n border: 2px solid ${this.theme.border};\r\n `;\r\n container.appendChild(captureContainer);\r\n\r\n // Use the new DocumentCapture component with front/back support\r\n this.docCapture = new DocumentCapture();\r\n this.docCapture\r\n .capture(captureContainer, this.theme, this.selectedIdTypeName || this.selectedIdType)\r\n .then(async (result: DocumentCaptureResult) => {\r\n await this.processDocumentCaptureResult(result, captureContainer, container);\r\n })\r\n .catch((err: any) => {\r\n console.error(\"Document capture failed:\", err);\r\n this.showErrorStep(err.message || \"Document capture failed. Please try again.\");\r\n });\r\n }\r\n\r\n // \u2500\u2500 Processing \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\r\n\r\n private renderProcessing(container: HTMLElement): void {\r\n container.style.cssText += \"display:flex;flex-direction:column;align-items:center;gap:20px;padding:20px 16px;min-height:400px;\";\r\n\r\n // Processing animation\r\n const animationWrap = document.createElement(\"div\");\r\n animationWrap.style.cssText = \"position:relative;width:80px;height:80px;\";\r\n\r\n const spinner = document.createElement(\"div\");\r\n spinner.style.cssText = `\r\n position:absolute;inset:0;border-radius:50%;\r\n border:4px solid ${this.theme.border};\r\n border-top-color:${this.theme.primary};\r\n animation:sc-spin 1s linear infinite;\r\n `;\r\n animationWrap.appendChild(spinner);\r\n\r\n const centerIcon = document.createElement(\"div\");\r\n centerIcon.style.cssText = `\r\n position:absolute;inset:0;display:flex;align-items:center;justify-content:center;\r\n font-size:28px;\r\n `;\r\n centerIcon.textContent = \"\uD83D\uDD0D\";\r\n animationWrap.appendChild(centerIcon);\r\n container.appendChild(animationWrap);\r\n\r\n // Processing text\r\n const title = document.createElement(\"div\");\r\n title.style.cssText = `color:${this.theme.text};font-size:18px;font-weight:600;text-align:center;`;\r\n title.textContent = \"Processing Your Documents\";\r\n container.appendChild(title);\r\n\r\n const subtitle = document.createElement(\"div\");\r\n subtitle.style.cssText = `color:${this.theme.textSecondary};font-size:13px;text-align:center;max-width:280px;line-height:1.5;`;\r\n subtitle.textContent = \"Scanning and verifying your identity documents. This may take a few moments.\";\r\n container.appendChild(subtitle);\r\n\r\n // Processing steps\r\n const stepsContainer = document.createElement(\"div\");\r\n stepsContainer.style.cssText = `\r\n width:100%;max-width:400px;display:flex;flex-direction:column;gap:12px;\r\n margin-top:16px;\r\n `;\r\n\r\n const steps = [\r\n { id: 'uploading', text: 'Uploading documents', icon: '\uD83D\uDCE4' },\r\n { id: 'scanning', text: 'Scanning for information', icon: '\uD83D\uDD0D' },\r\n { id: 'verifying', text: 'Verifying authenticity', icon: '\u2713' },\r\n { id: 'analyzing', text: 'Analyzing document quality', icon: '\uD83D\uDD2C' }\r\n ];\r\n\r\n steps.forEach((step, index) => {\r\n const stepEl = document.createElement(\"div\");\r\n stepEl.style.cssText = `\r\n display:flex;align-items:center;gap:12px;padding:12px;border-radius:10px;\r\n background:${this.theme.cardBg};border:1px solid ${this.theme.border};\r\n transition:all 0.3s ease;\r\n `;\r\n stepEl.id = `processing-step-${step.id}`;\r\n\r\n const iconEl = document.createElement(\"div\");\r\n iconEl.style.cssText = `\r\n width:32px;height:32px;border-radius:8px;display:flex;align-items:center;justify-content:center;\r\n font-size:14px;background:${this.theme.shimmer};border:1px solid ${this.theme.border};\r\n `;\r\n iconEl.textContent = step.icon;\r\n iconEl.id = `step-icon-${step.id}`;\r\n\r\n const textEl = document.createElement(\"div\");\r\n textEl.style.cssText = `flex:1;color:${this.theme.textSecondary};font-size:13px;font-weight:500;`;\r\n textEl.textContent = step.text;\r\n textEl.id = `step-text-${step.id}`;\r\n\r\n const statusEl = document.createElement(\"div\");\r\n statusEl.style.cssText = `\r\n width:20px;height:20px;border-radius:50%;\r\n border:2px solid ${this.theme.border};\r\n position:relative;\r\n `;\r\n statusEl.id = `step-status-${step.id}`;\r\n\r\n stepEl.appendChild(iconEl);\r\n stepEl.appendChild(textEl);\r\n stepEl.appendChild(statusEl);\r\n stepsContainer.appendChild(stepEl);\r\n });\r\n\r\n container.appendChild(stepsContainer);\r\n\r\n // Start processing animation\r\n this.startProcessingAnimation();\r\n }\r\n\r\n private startProcessingAnimation(): void {\r\n const steps = ['uploading', 'scanning', 'verifying', 'analyzing'];\r\n let currentStepIndex = 0;\r\n\r\n const animateStep = (stepId: string) => {\r\n // Update step appearance\r\n const stepEl = document.getElementById(`processing-step-${stepId}`);\r\n const iconEl = document.getElementById(`step-icon-${stepId}`);\r\n const textEl = document.getElementById(`step-text-${stepId}`);\r\n const statusEl = document.getElementById(`step-status-${stepId}`);\r\n\r\n if (stepEl && iconEl && textEl && statusEl) {\r\n // Active state\r\n stepEl.style.borderColor = this.theme.primary;\r\n stepEl.style.background = `${this.theme.primary}10`;\r\n iconEl.style.background = this.theme.primary;\r\n iconEl.style.color = 'white';\r\n textEl.style.color = this.theme.text;\r\n textEl.style.fontWeight = '600';\r\n\r\n // Add spinner to status\r\n statusEl.innerHTML = `\r\n <div style=\"\r\n position:absolute;inset:2px;border-radius:50%;\r\n border:2px solid ${this.theme.border};\r\n border-top-color:${this.theme.primary};\r\n animation:sc-spin 0.8s linear infinite;\r\n \"></div>\r\n `;\r\n }\r\n\r\n // Move to next step after delay\r\n setTimeout(() => {\r\n // Complete current step\r\n if (stepEl && iconEl && textEl && statusEl) {\r\n stepEl.style.borderColor = this.theme.success;\r\n stepEl.style.background = `${this.theme.success}10`;\r\n iconEl.style.background = this.theme.success;\r\n statusEl.innerHTML = `\r\n <div style=\"\r\n position:absolute;inset:3px;border-radius:50%;\r\n background:${this.theme.success};\r\n display:flex;align-items:center;justify-content:center;\r\n color:white;font-size:10px;font-weight:bold;\r\n \">\u2713</div>\r\n `;\r\n }\r\n\r\n currentStepIndex++;\r\n if (currentStepIndex < steps.length) {\r\n animateStep(steps[currentStepIndex]);\r\n }\r\n }, 2000); // 2 seconds per step\r\n };\r\n\r\n // Start animation\r\n setTimeout(() => animateStep(steps[0]), 500);\r\n }\r\n\r\n \r\n /**\r\n * Process document capture result with front/back support\r\n */\r\n private async processDocumentCaptureResult(\r\n result: DocumentCaptureResult,\r\n captureContainer: HTMLElement,\r\n container: HTMLElement\r\n ): Promise<void> {\r\n // Store both front and back blobs\r\n this.documentBlob = result.front;\r\n this.documentBackBlob = result.back || null;\r\n \r\n // Process the front image through the existing flow\r\n await this.processDocumentBlob(result.front, captureContainer, container);\r\n \r\n // Log back image capture\r\n if (result.back) {\r\n console.log(\"Back image captured, size:\", result.back.size);\r\n }\r\n }\r\n\r\n /**\r\n * Process document blob - common method for both CameraView and DocumentCapture\r\n */\r\n private async processDocumentBlob(\r\n blob: Blob,\r\n captureContainer: HTMLElement,\r\n container: HTMLElement\r\n ): Promise<void> {\r\n const maxRetries = 2;\r\n let retryCount = 0;\r\n\r\n const attemptProcessing = async (): Promise<void> => {\r\n try {\r\n // Validate blob\r\n if (!blob || blob.size === 0) {\r\n throw new Error(\"Failed to capture document. Please try again.\");\r\n }\r\n if (blob.size > 2 * 1024 * 1024) {\r\n throw new Error(\"Document image is too large. Please retake in better lighting or use a clearer photo.\");\r\n }\r\n \r\n this.documentBlob = blob;\r\n\r\n // Show scanning state\r\n captureContainer.innerHTML = `\r\n <div style=\"display:flex;flex-direction:column;align-items:center;gap:14px;padding:28px 20px;\">\r\n <div style=\"position:relative;width:52px;height:52px;\">\r\n <div style=\"position:absolute;inset:0;border-radius:50%;border:3px solid ${this.theme.border};border-top-color:${this.theme.primary};animation:sc-spin 0.8s linear infinite;\"></div>\r\n <div style=\"position:absolute;inset:0;display:flex;align-items:center;justify-content:center;font-size:20px;\">\uD83D\uDD0D</div>\r\n </div>\r\n <div style=\"color:${this.theme.text};font-size:14px;font-weight:600;\">Scanning document...</div>\r\n <div style=\"color:${this.theme.textSecondary};font-size:12px;text-align:center;max-width:200px;line-height:1.5;\">Running OCR and verifying your identity</div>\r\n </div>`;\r\n\r\n // Create liveness entry with document\r\n const identifier = `DOC-${Date.now()}`;\r\n const COUNTRY_CODES: Record<string, string> = {\r\n nigeria: \"NG\", ghana: \"GH\", kenya: \"KE\",\r\n south_africa: \"ZA\", united_states: \"US\", united_kingdom: \"GB\", global: \"US\",\r\n };\r\n const country = COUNTRY_CODES[this.selectedCountry] || this.selectedCountry.toUpperCase().slice(0, 2);\r\n\r\n const deviceMeta = collectDeviceMetadata();\r\n let createResult;\r\n try {\r\n createResult = await this.sdk.liveness.create({\r\n identifier,\r\n identifier_type: this.selectedIdType,\r\n country,\r\n challenge_actions: [\"BLINK\", \"TURN_LEFT\", \"OPEN_MOUTH\"],\r\n document: blob,\r\n document_back: this.documentBackBlob || undefined,\r\n device_type: deviceMeta.device_type,\r\n os_name: deviceMeta.os_name,\r\n browser_timezone: deviceMeta.browser_timezone,\r\n fingerprint_id: deviceMeta.fingerprint_id,\r\n });\r\n } catch (apiError: any) {\r\n // Handle specific network and API errors\r\n if (apiError.message?.includes('fetch') || apiError.message?.includes('network') || apiError.code === 'NETWORK_ERROR') {\r\n throw new Error(\"Network connection failed. Please check your internet connection and try again.\");\r\n } else if (apiError.message?.includes('413') || apiError.message?.includes('too large')) {\r\n throw new Error(\"Document image is too large. Please use a smaller image or retake the photo.\");\r\n } else if (apiError.message?.includes('415') || apiError.message?.includes('format')) {\r\n throw new Error(\"Unsupported image format. Please use JPEG or PNG images.\");\r\n } else if (apiError.message?.includes('401') || apiError.message?.includes('unauthorized')) {\r\n throw new Error(\"Session expired. Please refresh the page and try again.\");\r\n } else if (apiError.message?.includes('429') || apiError.message?.includes('rate limit')) {\r\n throw new Error(\"Too many requests. Please wait a moment and try again.\");\r\n } else {\r\n throw new Error(apiError.message || \"Failed to process document. Please try again.\");\r\n }\r\n }\r\n\r\n this.livenessEntryId = createResult.id;\r\n\r\n // Check if document was expired\r\n const docOcr = (createResult as any).document_ocr;\r\n if (docOcr && docOcr.status === \"expired\") {\r\n throw new Error(docOcr.message || \"Document has expired. Please use a valid document.\");\r\n }\r\n\r\n // Check image quality\r\n const imgQuality = docOcr?.image_quality;\r\n const isBlurry = imgQuality?.is_blurry === true;\r\n const lowConfidence = imgQuality?.ocr_confidence !== undefined && imgQuality.ocr_confidence < 0.45;\r\n if (isBlurry || lowConfidence) {\r\n throw new Error(\"Image quality too low. Please ensure the document is well-lit and clearly visible.\");\r\n }\r\n\r\n // Show processing step instead of immediate success\r\n this.showStep(\"processing\");\r\n \r\n // Simulate processing time and then proceed to liveness\r\n setTimeout(() => {\r\n this.showStep(\"liveness\");\r\n }, 8000); // 8 seconds total processing time (4 steps \u00D7 2 seconds each)\r\n\r\n } catch (err: any) {\r\n console.error(\"Document processing failed:\", err);\r\n \r\n if (retryCount < maxRetries) {\r\n retryCount++;\r\n console.log(`Retrying document processing (attempt ${retryCount}/${maxRetries})`);\r\n \r\n // Show retry message\r\n if (captureContainer) {\r\n captureContainer.innerHTML = `\r\n <div style=\"display:flex;flex-direction:column;align-items:center;gap:16px;padding:28px 20px;text-align:center;\">\r\n <div style=\"position:relative;width:52px;height:52px;\">\r\n <div style=\"position:absolute;inset:0;border-radius:50%;border:3px solid ${this.theme.border};border-top-color:${this.theme.primary};animation:sc-spin 0.8s linear infinite;\"></div>\r\n <div style=\"position:absolute;inset:0;display:flex;align-items:center;justify-content:center;font-size:20px;\">\uD83D\uDD04</div>\r\n </div>\r\n <div style=\"color:${this.theme.text};font-size:14px;font-weight:600;\">Retrying...</div>\r\n <div style=\"color:${this.theme.textSecondary};font-size:12px;max-width:240px;line-height:1.5;\">Attempt ${retryCount} of ${maxRetries}</div>\r\n </div>`;\r\n }\r\n \r\n // Wait before retry\r\n await new Promise(resolve => setTimeout(resolve, 2000));\r\n return attemptProcessing();\r\n } else {\r\n // Final retry failed, show detailed error\r\n this.handleDocumentProcessingError(err, captureContainer);\r\n }\r\n }\r\n };\r\n\r\n await attemptProcessing();\r\n }\r\n\r\n private handleDocumentProcessingError(error: any, captureContainer: HTMLElement): void {\r\n let errorMessage = \"Document verification failed. Please try again.\";\r\n let canRetry = true;\r\n\r\n if (error.message) {\r\n if (error.message.includes(\"expired\")) {\r\n errorMessage = \"Document has expired. Please use a valid document.\";\r\n canRetry = false;\r\n } else if (error.message.includes(\"quality too low\")) {\r\n errorMessage = \"Image quality too low. Please ensure the document is well-lit and clearly visible.\";\r\n } else if (error.message.includes(\"Network\") || error.message.includes(\"fetch\")) {\r\n errorMessage = \"Network connection failed. Please check your internet connection and try again.\";\r\n } else if (error.message.includes(\"413\") || error.message.includes(\"too large\")) {\r\n errorMessage = \"Document image is too large. Please use a smaller image or retake the photo.\";\r\n } else if (error.message.includes(\"415\") || error.message.includes(\"format\")) {\r\n errorMessage = \"Unsupported image format. Please use JPEG or PNG images.\";\r\n }\r\n }\r\n\r\n if (captureContainer) {\r\n captureContainer.innerHTML = `\r\n <div style=\"display:flex;flex-direction:column;align-items:center;gap:16px;padding:28px 20px;text-align:center;\">\r\n <div style=\"width:56px;height:56px;border-radius:50%;background:${this.theme.errorBg || '#FEE'};border:3px solid ${this.theme.error || '#DC3545'};display:flex;align-items:center;justify-content:center;font-size:26px;\">\u274C</div>\r\n <div style=\"color:${this.theme.text};font-size:14px;font-weight:700;\">Verification Failed</div>\r\n <div style=\"color:${this.theme.textSecondary};font-size:13px;max-width:240px;line-height:1.6;\">${errorMessage}</div>\r\n ${canRetry ? `\r\n <button id=\"retry-btn\" style=\"\r\n margin-top:8px;padding:12px 24px;border-radius:8px;\r\n background:${this.theme.primary};color:white;\r\n border:none;font-size:14px;font-weight:600;cursor:pointer;\r\n transition:all 0.2s ease;\r\n \">Try Again</button>\r\n ` : ''}\r\n </div>`;\r\n\r\n if (canRetry) {\r\n const retryBtn = captureContainer.querySelector(\"#retry-btn\") as HTMLButtonElement;\r\n if (retryBtn) {\r\n retryBtn.addEventListener(\"click\", () => {\r\n this.showStep(\"document_capture\");\r\n });\r\n }\r\n }\r\n } else {\r\n this.showErrorStep(errorMessage);\r\n }\r\n }\r\n\r\n // \u2500\u2500 Liveness \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\r\n\r\n private renderLiveness(container: HTMLElement): void {\r\n container.style.cssText += \"display:flex;flex-direction:column;gap:16px;\";\r\n\r\n const title = this.createStepTitle(\"Face verification\");\r\n container.appendChild(title);\r\n\r\n const desc = document.createElement(\"div\");\r\n desc.style.cssText = `color:${this.theme.textSecondary};font-size:13px;margin-top:-8px;line-height:1.5;`;\r\n desc.textContent = \"Position your face in the oval and follow the on-screen instructions.\";\r\n container.appendChild(desc);\r\n\r\n // Liveness mount point\r\n const livenessContainer = document.createElement(\"div\");\r\n livenessContainer.style.cssText = \"margin:8px 0;\";\r\n container.appendChild(livenessContainer);\r\n\r\n const identifier = this.idNumber || `DOC-${Date.now()}`;\r\n const COUNTRY_CODES: Record<string, string> = {\r\n nigeria: \"NG\",\r\n ghana: \"GH\",\r\n kenya: \"KE\",\r\n south_africa: \"ZA\",\r\n united_states: \"US\",\r\n united_kingdom: \"GB\",\r\n global: \"US\",\r\n };\r\n const country = COUNTRY_CODES[this.selectedCountry] || this.selectedCountry.toUpperCase().slice(0, 2);\r\n\r\n // Start liveness check (this handles camera, detection, recording, submission)\r\n // If livenessEntryId exists (document flow), reuse it instead of creating a new one\r\n this.sdk.liveness\r\n .startCheck(\r\n livenessContainer,\r\n {\r\n identifier,\r\n identifier_type: this.selectedIdType,\r\n country,\r\n document: this.documentBlob || undefined,\r\n document_back: this.documentBackBlob || undefined,\r\n identity_check: this.identityCheckId || undefined,\r\n },\r\n [\"BLINK\", \"TURN_LEFT\", \"OPEN_MOUTH\"] as ChallengeAction[],\r\n this.livenessEntryId || undefined\r\n )\r\n .then((result) => {\r\n this.showResult(result);\r\n })\r\n .catch((err) => {\r\n this.showErrorStep(err.message || \"Liveness verification failed. Please try again.\");\r\n });\r\n }\r\n\r\n // \u2500\u2500 Result \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\r\n\r\n private showResult(submitResult: LivenessSubmitResponse): void {\r\n this.currentStep = \"result\";\r\n this.updateProgress();\r\n\r\n if (!this.contentArea) return;\r\n this.contentArea.innerHTML = \"\";\r\n\r\n const wrapper = document.createElement(\"div\");\r\n wrapper.style.cssText = `\r\n display:flex;flex-direction:column;align-items:center;\r\n text-align:center;gap:16px;padding:20px 0;\r\n opacity:0;transform:scale(0.95);transition:all 0.4s ease;\r\n `;\r\n\r\n // Icon \u2014 starts as a spinner, updates when status resolves\r\n const iconWrap = document.createElement(\"div\");\r\n iconWrap.style.cssText = `\r\n width:80px;height:80px;border-radius:50%;\r\n display:flex;align-items:center;justify-content:center;\r\n font-size:36px;\r\n background:${this.theme.cardBg};\r\n border:3px solid ${this.theme.border};\r\n `;\r\n iconWrap.innerHTML = `<div style=\"width:32px;height:32px;border-radius:50%;border:3px solid ${this.theme.border};border-top-color:${this.theme.primary};animation:sc-spin 0.9s linear infinite;\"></div>`;\r\n wrapper.appendChild(iconWrap);\r\n\r\n const title = document.createElement(\"h2\");\r\n title.style.cssText = `color:${this.theme.text};font-size:20px;font-weight:700;margin:0;`;\r\n title.textContent = \"Verification Submitted\";\r\n wrapper.appendChild(title);\r\n\r\n const desc = document.createElement(\"p\");\r\n desc.style.cssText = `color:${this.theme.textSecondary};font-size:14px;line-height:1.6;margin:0;max-width:300px;`;\r\n desc.textContent = \"Processing your identity check. This takes around 30 seconds.\";\r\n wrapper.appendChild(desc);\r\n\r\n // Details card\r\n const details = document.createElement(\"div\");\r\n details.style.cssText = `\r\n width:100%;padding:16px;border-radius:12px;\r\n background:${this.theme.cardBg};border:1px solid ${this.theme.border};\r\n text-align:left;\r\n `;\r\n // Status badge \u2014 mutable DOM node so polling can update it\r\n const statusBadge = document.createElement(\"span\");\r\n statusBadge.style.cssText = `font-size:12px;font-weight:600;color:${this.theme.warning};`;\r\n statusBadge.textContent = \"Processing\u2026\";\r\n\r\n const statusRow = document.createElement(\"div\");\r\n statusRow.style.cssText = \"display:flex;justify-content:space-between;margin-bottom:8px;\";\r\n statusRow.innerHTML = `<span style=\"color:${this.theme.textMuted};font-size:12px;\">Status</span>`;\r\n statusRow.appendChild(statusBadge);\r\n\r\n // Build rows via DOM (not innerHTML+=) to keep statusBadge live in the document\r\n const entryRow = document.createElement(\"div\");\r\n entryRow.style.cssText = \"display:flex;justify-content:space-between;margin-bottom:8px;\";\r\n entryRow.innerHTML = `\r\n <span style=\"color:${this.theme.textMuted};font-size:12px;\">Entry ID</span>\r\n <span style=\"color:${this.theme.text};font-size:12px;font-weight:600;\">${submitResult.id}</span>\r\n `;\r\n details.appendChild(entryRow);\r\n details.appendChild(statusRow);\r\n\r\n const submittedRow = document.createElement(\"div\");\r\n submittedRow.style.cssText = \"display:flex;justify-content:space-between;margin-top:8px;\";\r\n submittedRow.innerHTML = `\r\n <span style=\"color:${this.theme.textMuted};font-size:12px;\">Submitted</span>\r\n <span style=\"color:${this.theme.text};font-size:12px;\">${submitResult.submitted_at ? new Date(submitResult.submitted_at).toLocaleString() : \"Just now\"}</span>\r\n `;\r\n details.appendChild(submittedRow);\r\n wrapper.appendChild(details);\r\n\r\n // Failure reason \u2014 hidden until status = failed\r\n const failureMsg = document.createElement(\"div\");\r\n failureMsg.style.cssText = `\r\n display:none;width:100%;padding:12px 14px;border-radius:10px;\r\n background:${this.theme.errorBg};border:1px solid ${this.theme.error};\r\n color:${this.theme.error};font-size:12px;text-align:left;line-height:1.5;\r\n `;\r\n wrapper.appendChild(failureMsg);\r\n\r\n // Done button\r\n const doneBtn = this.createPrimaryButton(\"Done\");\r\n let finalStatus = submitResult.status as string;\r\n doneBtn.addEventListener(\"click\", () => {\r\n if (this._pollStatusTimer) { clearTimeout(this._pollStatusTimer); this._pollStatusTimer = null; }\r\n this.options.onComplete?.({\r\n entryId: submitResult.id,\r\n sessionId: this.sdk.sessionToken,\r\n status: finalStatus,\r\n submittedAt: submitResult.submitted_at,\r\n verificationResult: this.verificationResult || undefined,\r\n });\r\n this.close();\r\n });\r\n wrapper.appendChild(doneBtn);\r\n\r\n this.contentArea.appendChild(wrapper);\r\n\r\n requestAnimationFrame(() => {\r\n wrapper.style.opacity = \"1\";\r\n wrapper.style.transform = \"scale(1)\";\r\n });\r\n\r\n // Start polling for the async result\r\n this._startStatusPolling(\r\n submitResult.id,\r\n iconWrap,\r\n statusBadge,\r\n title,\r\n desc,\r\n failureMsg,\r\n (resolved) => { finalStatus = resolved; }\r\n );\r\n }\r\n\r\n private _startStatusPolling(\r\n entryId: number,\r\n iconWrap: HTMLElement,\r\n statusBadge: HTMLElement,\r\n title: HTMLElement,\r\n desc: HTMLElement,\r\n failureMsg: HTMLElement,\r\n onResolved: (status: string) => void\r\n ): void {\r\n const MAX_POLLS = 25; // 25 \u00D7 3 s = 75 s + 4 s initial = ~79 s max\r\n let polls = 0;\r\n\r\n // Hard 30 s UI timer \u2014 stops spinner even if backend is still processing\r\n let uiTimeoutId: ReturnType<typeof setTimeout> | null = setTimeout(() => {\r\n if (!this.isDestroyed) applyTimeout();\r\n }, 30000);\r\n const clearUiTimeout = () => { if (uiTimeoutId) { clearTimeout(uiTimeoutId); uiTimeoutId = null; } };\r\n\r\n const applyTimeout = () => {\r\n iconWrap.innerHTML = \"\u23F1\";\r\n iconWrap.style.background = this.theme.cardBg;\r\n iconWrap.style.border = `3px solid ${this.theme.warning}`;\r\n iconWrap.style.color = this.theme.warning;\r\n iconWrap.style.fontSize = \"30px\";\r\n statusBadge.style.color = this.theme.textMuted;\r\n statusBadge.textContent = \"Still processing\u2026\";\r\n title.textContent = \"Verification In Progress\";\r\n desc.textContent = \"Your verification is being processed. Your result will be delivered via your dashboard or webhook. You can safely close this.\";\r\n };\r\n\r\n const applyPassed = () => {\r\n clearUiTimeout();\r\n iconWrap.innerHTML = \"\u2713\";\r\n iconWrap.style.background = this.theme.successBg;\r\n iconWrap.style.border = `3px solid ${this.theme.success}`;\r\n iconWrap.style.color = this.theme.success;\r\n iconWrap.style.fontSize = \"36px\";\r\n statusBadge.style.color = this.theme.success;\r\n statusBadge.textContent = \"Verified \u2713\";\r\n title.textContent = \"Identity Verified\";\r\n desc.textContent = \"Your identity check passed successfully.\";\r\n };\r\n\r\n const applyFailed = (reason: string | null) => {\r\n clearUiTimeout();\r\n iconWrap.innerHTML = \"\u2715\";\r\n iconWrap.style.background = this.theme.errorBg;\r\n iconWrap.style.border = `3px solid ${this.theme.error}`;\r\n iconWrap.style.color = this.theme.error;\r\n iconWrap.style.fontSize = \"32px\";\r\n statusBadge.style.color = this.theme.error;\r\n statusBadge.textContent = \"Failed\";\r\n title.textContent = \"Verification Failed\";\r\n desc.textContent = \"Your identity check could not be completed.\";\r\n if (reason) {\r\n failureMsg.textContent = reason;\r\n failureMsg.style.display = \"block\";\r\n }\r\n };\r\n\r\n const poll = async () => {\r\n if (this.isDestroyed) return;\r\n polls++;\r\n try {\r\n const result = await this.sdk.liveness.pollResult(entryId);\r\n if (result.status === \"passed\") {\r\n onResolved(\"passed\");\r\n applyPassed();\r\n return;\r\n }\r\n if (result.status === \"failed\" || result.status === \"expired_document\") {\r\n onResolved(result.status);\r\n applyFailed(result.failure_reason);\r\n return;\r\n }\r\n // Still pending/processing \u2014 schedule next poll if budget remains\r\n if (polls < MAX_POLLS && !this.isDestroyed) {\r\n this._pollStatusTimer = setTimeout(poll, 3000);\r\n } else if (!this.isDestroyed) {\r\n applyTimeout(); // budget exhausted \u2014 stop spinner, show timeout state\r\n }\r\n } catch {\r\n // Network hiccup \u2014 retry with a slightly longer delay\r\n if (polls < MAX_POLLS && !this.isDestroyed) {\r\n this._pollStatusTimer = setTimeout(poll, 5000);\r\n } else if (!this.isDestroyed) {\r\n applyTimeout(); // budget exhausted \u2014 stop spinner\r\n }\r\n }\r\n };\r\n\r\n // First poll after 4 s \u2014 gives Celery task time to complete\r\n this._pollStatusTimer = setTimeout(poll, 4000);\r\n }\r\n\r\n private renderResult(_container: HTMLElement): void {\r\n // Handled by showResult() directly\r\n }\r\n\r\n // \u2500\u2500 Error \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\r\n\r\n private showErrorStep(message: string): void {\r\n this.currentStep = \"error\";\r\n if (!this.contentArea) return;\r\n this.contentArea.innerHTML = \"\";\r\n\r\n const wrapper = document.createElement(\"div\");\r\n wrapper.style.cssText = `\r\n display:flex;flex-direction:column;align-items:center;\r\n text-align:center;gap:16px;padding:20px 0;\r\n `;\r\n\r\n const isCameraErr = /camera|permission|notallowed|notfound/i.test(message);\r\n const isNetworkErr = /network|timeout|connection|fetch/i.test(message);\r\n const isAuthErr = /session|token|expired|authentication/i.test(message);\r\n const errorIcon = isCameraErr ? \"\\uD83D\\uDCF7\" : isNetworkErr ? \"\\uD83D\\uDCE1\" : isAuthErr ? \"\\u23F1\" : \"\\u2717\";\r\n const errorTitle = isCameraErr ? \"Camera Access Required\"\r\n : isNetworkErr ? \"Connection Problem\"\r\n : isAuthErr ? \"Session Expired\"\r\n : \"Verification Failed\";\r\n\r\n const iconWrap = document.createElement(\"div\");\r\n iconWrap.style.cssText = `\r\n width:72px;height:72px;border-radius:50%;\r\n display:flex;align-items:center;justify-content:center;\r\n font-size:${errorIcon === \"\\u2717\" ? \"32px\" : \"28px\"};\r\n background:${this.theme.errorBg};\r\n border:3px solid ${this.theme.error};\r\n `;\r\n iconWrap.textContent = errorIcon;\r\n wrapper.appendChild(iconWrap);\r\n\r\n const title = document.createElement(\"h2\");\r\n title.style.cssText = `color:${this.theme.text};font-size:18px;font-weight:700;margin:0;`;\r\n title.textContent = errorTitle;\r\n wrapper.appendChild(title);\r\n\r\n const desc = document.createElement(\"p\");\r\n desc.style.cssText = `color:${this.theme.textSecondary};font-size:14px;line-height:1.6;margin:0;max-width:300px;`;\r\n desc.textContent = message;\r\n wrapper.appendChild(desc);\r\n\r\n const retryBtn = this.createPrimaryButton(\"Try Again\");\r\n retryBtn.addEventListener(\"click\", () => {\r\n // If session already exists, go back to welcome without re-initializing\r\n // (re-initializing would fail with CLIENT_ID_ALREADY_USED)\r\n if (this.sdk.sessionToken && this.sdkConfig) {\r\n this.showStep(\"welcome\");\r\n } else {\r\n // Only re-initialize if session was never created\r\n this.initialize();\r\n }\r\n });\r\n wrapper.appendChild(retryBtn);\r\n\r\n const closeBtn = this.createSecondaryButton(\"Close\");\r\n closeBtn.addEventListener(\"click\", () => {\r\n this.options.onError?.(new Error(message));\r\n this.close();\r\n });\r\n wrapper.appendChild(closeBtn);\r\n\r\n this.contentArea.appendChild(wrapper);\r\n }\r\n\r\n // \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\r\n // UI Helpers\r\n // \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\r\n\r\n private createHeader(): HTMLElement {\r\n const header = document.createElement(\"div\");\r\n header.style.cssText = `\r\n display:flex;align-items:center;justify-content:space-between;\r\n padding:14px 20px;border-bottom:1px solid ${this.theme.border};\r\n `;\r\n\r\n // Left: back button + brand\r\n const leftArea = document.createElement(\"div\");\r\n leftArea.style.cssText = \"display:flex;align-items:center;gap:8px;min-width:0;\";\r\n\r\n this.headerBackBtn = document.createElement(\"button\");\r\n this.headerBackBtn.innerHTML = \"←\";\r\n this.headerBackBtn.style.cssText = `\r\n width:30px;height:30px;border-radius:8px;flex-shrink:0;\r\n display:none;align-items:center;justify-content:center;\r\n border:1.5px solid ${this.theme.border};cursor:pointer;\r\n font-size:16px;line-height:1;\r\n background:${this.theme.cardBg};color:${this.theme.text};\r\n transition:all 0.2s ease;\r\n `;\r\n this.headerBackBtn.addEventListener(\"mouseenter\", () => {\r\n if (this.headerBackBtn) {\r\n this.headerBackBtn.style.background = this.theme.shimmer;\r\n }\r\n });\r\n this.headerBackBtn.addEventListener(\"mouseleave\", () => {\r\n if (this.headerBackBtn) {\r\n this.headerBackBtn.style.background = this.theme.cardBg;\r\n }\r\n });\r\n leftArea.appendChild(this.headerBackBtn);\r\n\r\n this.brandLabel = document.createElement(\"div\");\r\n this.brandLabel.style.cssText = `\r\n font-size:15px;font-weight:700;color:${this.theme.text};\r\n white-space:nowrap;overflow:hidden;text-overflow:ellipsis;\r\n `;\r\n this.brandLabel.textContent = this.sdkConfig?.brand_name || \"SmartComply\";\r\n leftArea.appendChild(this.brandLabel);\r\n header.appendChild(leftArea);\r\n\r\n // Step indicator\r\n this.stepLabel = document.createElement(\"div\");\r\n this.stepLabel.style.cssText = `\r\n font-size:12px;color:${this.theme.textMuted};\r\n font-variant-numeric:tabular-nums;flex-shrink:0;\r\n `;\r\n header.appendChild(this.stepLabel);\r\n\r\n // Close button\r\n const closeBtn = document.createElement(\"button\");\r\n closeBtn.innerHTML = \"\u2715\";\r\n closeBtn.style.cssText = `\r\n width:32px;height:32px;border-radius:8px;flex-shrink:0;\r\n display:flex;align-items:center;justify-content:center;\r\n border:none;cursor:pointer;font-size:16px;\r\n background:${this.theme.shimmer};color:${this.theme.textMuted};\r\n transition:all 0.2s ease;\r\n `;\r\n closeBtn.addEventListener(\"mouseenter\", () => {\r\n closeBtn.style.background = this.theme.errorBg;\r\n closeBtn.style.color = this.theme.error;\r\n });\r\n closeBtn.addEventListener(\"mouseleave\", () => {\r\n closeBtn.style.background = this.theme.shimmer;\r\n closeBtn.style.color = this.theme.textMuted;\r\n });\r\n closeBtn.addEventListener(\"click\", () => this.close());\r\n header.appendChild(closeBtn);\r\n\r\n return header;\r\n }\r\n\r\n private createFooter(): HTMLElement {\r\n const footer = document.createElement(\"div\");\r\n footer.style.cssText = `\r\n padding:12px 20px;border-top:1px solid ${this.theme.border};\r\n display:flex;align-items:center;justify-content:center;gap:6px;\r\n `;\r\n\r\n const powered = document.createElement(\"span\");\r\n powered.style.cssText = `font-size:11px;color:${this.theme.textMuted};`;\r\n powered.textContent = \"Powered by \";\r\n\r\n const brand = document.createElement(\"span\");\r\n brand.style.cssText = `font-size:11px;font-weight:700;color:${this.theme.primary};`;\r\n brand.textContent = \"Adhere\";\r\n\r\n footer.appendChild(powered);\r\n footer.appendChild(brand);\r\n return footer;\r\n }\r\n\r\n private createStepTitle(text: string): HTMLElement {\r\n const el = document.createElement(\"h3\");\r\n el.style.cssText = `\r\n color:${this.theme.text};font-size:18px;font-weight:700;\r\n margin:0;\r\n `;\r\n el.textContent = text;\r\n return el;\r\n }\r\n\r\n private createOptionCard(\r\n title: string,\r\n subtitle: string,\r\n onClick: () => void\r\n ): HTMLElement {\r\n const card = document.createElement(\"button\");\r\n card.style.cssText = `\r\n width:100%;padding:16px;border-radius:12px;\r\n background:${this.theme.cardBg};\r\n border:2px solid ${this.theme.border};\r\n cursor:pointer;text-align:left;\r\n display:flex;align-items:center;justify-content:space-between;\r\n transition:all 0.2s ease;\r\n `;\r\n card.addEventListener(\"mouseenter\", () => {\r\n card.style.borderColor = this.theme.primary;\r\n card.style.background = this.theme.shimmer;\r\n card.style.transform = \"translateY(-1px)\";\r\n });\r\n card.addEventListener(\"mouseleave\", () => {\r\n card.style.borderColor = this.theme.border;\r\n card.style.background = this.theme.cardBg;\r\n card.style.transform = \"translateY(0)\";\r\n });\r\n card.addEventListener(\"click\", onClick);\r\n\r\n const textWrap = document.createElement(\"div\");\r\n\r\n const titleEl = document.createElement(\"div\");\r\n titleEl.style.cssText = `color:${this.theme.text};font-size:14px;font-weight:600;`;\r\n titleEl.textContent = title;\r\n textWrap.appendChild(titleEl);\r\n\r\n if (subtitle) {\r\n const subEl = document.createElement(\"div\");\r\n subEl.style.cssText = `color:${this.theme.textMuted};font-size:12px;margin-top:2px;`;\r\n subEl.textContent = subtitle;\r\n textWrap.appendChild(subEl);\r\n }\r\n\r\n const arrow = document.createElement(\"span\");\r\n arrow.style.cssText = `color:${this.theme.textMuted};font-size:18px;flex-shrink:0;`;\r\n arrow.textContent = \"\u2192\";\r\n\r\n card.appendChild(textWrap);\r\n card.appendChild(arrow);\r\n return card;\r\n }\r\n\r\n private createPrimaryButton(text: string): HTMLButtonElement {\r\n const btn = document.createElement(\"button\");\r\n btn.textContent = text;\r\n btn.style.cssText = `\r\n width:100%;padding:14px;border-radius:12px;\r\n font-size:15px;font-weight:600;\r\n background:${this.theme.primary};color:#fff;\r\n border:none;cursor:pointer;\r\n transition:all 0.2s ease;\r\n box-shadow:0 2px 8px ${this.theme.primaryGlow};\r\n `;\r\n btn.addEventListener(\"mouseenter\", () => {\r\n btn.style.background = this.theme.primaryHover;\r\n btn.style.transform = \"translateY(-1px)\";\r\n });\r\n btn.addEventListener(\"mouseleave\", () => {\r\n btn.style.background = this.theme.primary;\r\n btn.style.transform = \"translateY(0)\";\r\n });\r\n return btn;\r\n }\r\n\r\n private createSecondaryButton(text: string): HTMLButtonElement {\r\n const btn = document.createElement(\"button\");\r\n btn.textContent = text;\r\n btn.style.cssText = `\r\n width:100%;padding:12px;border-radius:12px;\r\n font-size:14px;font-weight:500;\r\n background:transparent;color:${this.theme.textSecondary};\r\n border:none;cursor:pointer;\r\n transition:all 0.2s ease;\r\n `;\r\n btn.addEventListener(\"mouseenter\", () => {\r\n btn.style.color = this.theme.text;\r\n });\r\n btn.addEventListener(\"mouseleave\", () => {\r\n btn.style.color = this.theme.textSecondary;\r\n });\r\n return btn;\r\n }\r\n\r\n private isDocumentFlow(): boolean {\r\n // 1. Check verification_type \u2014 handle both string and array from backend\r\n const vType = this.sdkConfig?.verification_type;\r\n if (vType) {\r\n const types: string[] = Array.isArray(vType) ? vType : [vType];\r\n if (types.includes(\"document_verification\")) return true;\r\n if (types.includes(\"data_verification\")) return false;\r\n }\r\n // 2. Fallback: inspect channel fields \u2014 any upload field = document flow\r\n const channels = this.sdkConfig?.channels || {};\r\n const allFields = (Object.values(channels) as any[])\r\n .flat()\r\n .flatMap((ch: any) => ch.fields || []);\r\n return allFields.some((f: any) => f.type === \"upload\");\r\n }\r\n\r\n private updateProgress(): void {\r\n const isDocFlow = this.isDocumentFlow();\r\n const countries = Object.keys(this.sdkConfig?.channels || {});\r\n const singleCountry = countries.length <= 1;\r\n\r\n // User-action steps only (what the user actually does \u2014 no loading/welcome/result)\r\n const actionSteps: StepName[] = (\r\n [\"country\", \"id_type\", isDocFlow ? \"document_capture\" : \"id_input\", \"liveness\"] as StepName[]\r\n ).filter((s) => !(s === \"country\" && singleCountry));\r\n\r\n const totalSteps = actionSteps.length;\r\n const actionIndex = actionSteps.indexOf(this.currentStep);\r\n\r\n const pct =\r\n this.currentStep === \"result\" ? 100\r\n : actionIndex >= 0 ? ((actionIndex + 1) / totalSteps) * 100\r\n : 0;\r\n\r\n if (this.progressBar) {\r\n this.progressBar.style.width = `${pct}%`;\r\n }\r\n if (this.stepLabel) {\r\n if (this.currentStep === \"loading\" || this.currentStep === \"welcome\") {\r\n this.stepLabel.textContent = \"\";\r\n } else if (this.currentStep === \"result\") {\r\n this.stepLabel.textContent = \"Complete \u2713\";\r\n } else if (actionIndex >= 0) {\r\n this.stepLabel.textContent = `Step ${actionIndex + 1} of ${totalSteps}`;\r\n } else {\r\n this.stepLabel.textContent = \"\";\r\n }\r\n }\r\n\r\n // Back button \u2014 show in header for navigable steps, hidden elsewhere\r\n if (this.headerBackBtn) {\r\n const countries = Object.keys(this.sdkConfig?.channels || {});\r\n const backTargets: Partial<Record<StepName, () => void>> = {\r\n id_type: () => this.showStep(countries.length > 1 ? \"country\" : \"welcome\"),\r\n country: () => this.showStep(\"welcome\"),\r\n id_input: () => this.showStep(\"id_type\"),\r\n document_capture: () => { this.docCapture?.destroy(); this.showStep(\"id_type\"); },\r\n };\r\n const backAction = backTargets[this.currentStep];\r\n if (backAction) {\r\n this.headerBackBtn.style.display = \"flex\";\r\n const newBtn = this.headerBackBtn.cloneNode(true) as HTMLButtonElement;\r\n newBtn.style.cssText = this.headerBackBtn.style.cssText;\r\n this.headerBackBtn.parentNode?.replaceChild(newBtn, this.headerBackBtn);\r\n this.headerBackBtn = newBtn;\r\n this.headerBackBtn.addEventListener(\"mouseenter\", () => {\r\n if (this.headerBackBtn) this.headerBackBtn.style.background = this.theme.shimmer;\r\n });\r\n this.headerBackBtn.addEventListener(\"mouseleave\", () => {\r\n if (this.headerBackBtn) this.headerBackBtn.style.background = this.theme.cardBg;\r\n });\r\n this.headerBackBtn.addEventListener(\"click\", backAction);\r\n } else {\r\n this.headerBackBtn.style.display = \"none\";\r\n }\r\n }\r\n }\r\n\r\n private applyTheme(): void {\r\n if (this.overlay) {\r\n this.overlay.style.background = this.theme.overlay;\r\n }\r\n if (this.modal) {\r\n this.modal.style.background = this.theme.bg;\r\n this.modal.style.boxShadow = this.theme.shadow;\r\n }\r\n }\r\n\r\n private injectStyles(): void {\r\n if (document.getElementById(\"sc-flow-styles\")) return;\r\n\r\n const style = document.createElement(\"style\");\r\n style.id = \"sc-flow-styles\";\r\n style.textContent = `\r\n @keyframes sc-spin {\r\n to { transform: rotate(360deg); }\r\n }\r\n @keyframes sc-pop {\r\n 0% { transform: scale(0.8); opacity: 0; }\r\n 50% { transform: scale(1.05); }\r\n 100% { transform: scale(1); opacity: 1; }\r\n }\r\n #sc-flow-modal * {\r\n box-sizing: border-box;\r\n }\r\n #sc-flow-modal::-webkit-scrollbar {\r\n width: 4px;\r\n }\r\n #sc-flow-content::-webkit-scrollbar {\r\n width: 4px;\r\n }\r\n #sc-flow-content::-webkit-scrollbar-thumb {\r\n background: rgba(128,128,128,0.3);\r\n border-radius: 4px;\r\n }\r\n `;\r\n document.head.appendChild(style);\r\n }\r\n}\r\n", "/**\r\n * Lightweight SDK logger.\r\n *\r\n * Debug output is suppressed in production. Enable verbose logging by calling\r\n * SDKLogger.setDebug(true) before initialising the SDK, or by setting the\r\n * global flag: window.__SC_DEBUG__ = true\r\n */\r\n\r\nconst PREFIX = \"[SmartComply SDK]\";\r\n\r\nfunction isDebugEnabled(): boolean {\r\n try {\r\n return !!(window as any).__SC_DEBUG__;\r\n } catch {\r\n return false;\r\n }\r\n}\r\n\r\nexport const SDKLogger = {\r\n /** Emit an informational message (debug mode only). */\r\n info(message: string, ...args: unknown[]): void {\r\n if (!isDebugEnabled()) return;\r\n console.info(`${PREFIX} \u2139 ${message}`, ...args);\r\n },\r\n\r\n /** Emit a warning (always visible). */\r\n warn(message: string, ...args: unknown[]): void {\r\n console.warn(`${PREFIX} \u26A0 ${message}`, ...args);\r\n },\r\n\r\n /** Emit an error (always visible). */\r\n error(message: string, ...args: unknown[]): void {\r\n console.error(`${PREFIX} \u2716 ${message}`, ...args);\r\n },\r\n\r\n /** Emit a debug trace (debug mode only \u2014 lowest priority). */\r\n debug(message: string, ...args: unknown[]): void {\r\n if (!isDebugEnabled()) return;\r\n console.debug(`${PREFIX} \u2B21 ${message}`, ...args);\r\n },\r\n\r\n /** Log a timed group of related messages (debug mode only). */\r\n group(label: string, fn: () => void): void {\r\n if (!isDebugEnabled()) { fn(); return; }\r\n console.group(`${PREFIX} ${label}`);\r\n fn();\r\n console.groupEnd();\r\n },\r\n\r\n /**\r\n * Enable or disable verbose debug output at runtime.\r\n *\r\n * Example:\r\n * import { SDKLogger } from \"smartcomply-web-sdk\";\r\n * SDKLogger.setDebug(true);\r\n */\r\n setDebug(enabled: boolean): void {\r\n try {\r\n (window as any).__SC_DEBUG__ = enabled;\r\n } catch {\r\n /* no-op in non-browser environments */\r\n }\r\n },\r\n};\r\n", "/**\r\n * Camera permission utilities.\r\n *\r\n * Provides helpers to check, request and handle camera permissions in a\r\n * browser-consistent way. All functions are purely async and do NOT throw \u2014\r\n * they return a typed result so callers can handle each case explicitly.\r\n */\r\n\r\nexport type PermissionStatus =\r\n | \"granted\" // camera already accessible\r\n | \"prompt\" // permission dialog will appear on request\r\n | \"denied\" // user previously denied; cannot request again\r\n | \"unsupported\" // Permissions API or getUserMedia not available\r\n | \"unknown\"; // couldn't determine status\r\n\r\nexport interface CameraPermissionResult {\r\n status: PermissionStatus;\r\n /** Human-readable reason (populated on denied / unsupported). */\r\n reason?: string;\r\n}\r\n\r\n/**\r\n * Query the current camera permission state without prompting the user.\r\n *\r\n * Uses the Permissions API when available, falls back to \"unknown\" on older\r\n * browsers (e.g. Safari < 16).\r\n */\r\nexport async function queryCameraPermission(): Promise<CameraPermissionResult> {\r\n if (typeof navigator === \"undefined\" || !navigator.mediaDevices) {\r\n return { status: \"unsupported\", reason: \"getUserMedia is not supported in this browser.\" };\r\n }\r\n\r\n if (!navigator.permissions?.query) {\r\n return { status: \"unknown\" };\r\n }\r\n\r\n try {\r\n const result = await navigator.permissions.query({ name: \"camera\" as PermissionName });\r\n return { status: result.state as PermissionStatus };\r\n } catch {\r\n return { status: \"unknown\" };\r\n }\r\n}\r\n\r\n/**\r\n * Request camera access and return the resulting MediaStream.\r\n *\r\n * Maps browser-specific errors onto actionable `CameraPermissionResult`\r\n * values so callers can show the right UI instead of catching raw DOMExceptions.\r\n *\r\n * @param constraints - Optional MediaStreamConstraints override.\r\n */\r\nexport async function requestCameraAccess(\r\n constraints?: MediaStreamConstraints\r\n): Promise<{ stream: MediaStream; permission: CameraPermissionResult }> {\r\n const defaults: MediaStreamConstraints = {\r\n video: { facingMode: \"user\", width: { ideal: 640 }, height: { ideal: 480 } },\r\n audio: false,\r\n };\r\n\r\n try {\r\n const stream = await navigator.mediaDevices.getUserMedia(constraints ?? defaults);\r\n return { stream, permission: { status: \"granted\" } };\r\n } catch (err: any) {\r\n const name: string = err?.name ?? \"\";\r\n\r\n if (name === \"NotAllowedError\" || name === \"PermissionDeniedError\") {\r\n return {\r\n stream: null as any,\r\n permission: {\r\n status: \"denied\",\r\n reason: \"Camera access was denied. Please allow camera permissions in your browser settings and try again.\",\r\n },\r\n };\r\n }\r\n\r\n if (name === \"NotFoundError\" || name === \"DevicesNotFoundError\") {\r\n return {\r\n stream: null as any,\r\n permission: {\r\n status: \"unsupported\",\r\n reason: \"No camera was found. Please connect a camera and try again.\",\r\n },\r\n };\r\n }\r\n\r\n if (name === \"NotReadableError\" || name === \"TrackStartError\") {\r\n return {\r\n stream: null as any,\r\n permission: {\r\n status: \"unknown\",\r\n reason: \"Camera is already in use by another application. Please close it and try again.\",\r\n },\r\n };\r\n }\r\n\r\n return {\r\n stream: null as any,\r\n permission: {\r\n status: \"unknown\",\r\n reason: err?.message ?? \"Unable to access the camera.\",\r\n },\r\n };\r\n }\r\n}\r\n\r\n/**\r\n * Stop all tracks on a MediaStream and release the camera.\r\n * Safe to call with null/undefined.\r\n */\r\nexport function releaseCameraStream(stream: MediaStream | null | undefined): void {\r\n if (!stream) return;\r\n stream.getTracks().forEach((t) => t.stop());\r\n}\r\n\r\n/**\r\n * Returns true if the browser supports the camera APIs needed by the SDK.\r\n */\r\nexport function isCameraSupported(): boolean {\r\n return (\r\n typeof navigator !== \"undefined\" &&\r\n !!navigator.mediaDevices?.getUserMedia &&\r\n typeof MediaRecorder !== \"undefined\"\r\n );\r\n}\r\n", "/**\r\n * SDK-wide constants \u2014 single source of truth for limits, defaults and\r\n * backend-defined magic values.\r\n */\r\n\r\n// \u2500\u2500 API endpoints \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\r\n\r\nexport const ENDPOINTS = {\r\n SESSION_CREATE: \"/v1/session/create/\",\r\n SDK_INITIALIZE: \"/v1/initialize/\",\r\n ONBOARDING_VERIFY: \"/v1/onboarding/verify/\",\r\n LIVENESS_CREATE: \"/v1/liveness/create/\",\r\n LIVENESS_SUBMIT: \"/v1/liveness/submit/\",\r\n AVAILABLE_CHANNELS: \"/v1/available-channels/\",\r\n} as const;\r\n\r\n// \u2500\u2500 Session \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\r\n\r\n/** Backend session TTL in milliseconds (30 minutes). */\r\nexport const SESSION_TTL_MS = 30 * 60 * 1000;\r\n\r\n/** Warn the user this many ms before session expires. */\r\nexport const SESSION_WARN_BEFORE_MS = 2 * 60 * 1000;\r\n\r\n// \u2500\u2500 Network \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\r\n\r\n/** Default request timeout in milliseconds. */\r\nexport const DEFAULT_TIMEOUT_MS = 30_000;\r\n\r\n/** Number of automatic retries on transient network errors. */\r\nexport const MAX_RETRIES = 2;\r\n\r\n/** Delay between retries in milliseconds. */\r\nexport const RETRY_DELAY_MS = 1_000;\r\n\r\n// \u2500\u2500 File uploads \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\r\n\r\n/** Maximum document image size the backend accepts (5 MB). */\r\nexport const MAX_DOCUMENT_BYTES = 5 * 1024 * 1024;\r\n\r\n/** Maximum video size the backend accepts (50 MB). */\r\nexport const MAX_VIDEO_BYTES = 50 * 1024 * 1024;\r\n\r\n/** Maximum snapshot / autoshot size (2 MB). */\r\nexport const MAX_SNAPSHOT_BYTES = 2 * 1024 * 1024;\r\n\r\n/** Accepted MIME types for document images. */\r\nexport const ACCEPTED_IMAGE_TYPES = [\"image/jpeg\", \"image/png\", \"image/webp\"] as const;\r\n\r\n/** JPEG quality used when encoding captured frames (0\u20131). */\r\nexport const CAPTURE_JPEG_QUALITY = 0.92;\r\n\r\n// \u2500\u2500 Liveness challenge \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\r\n\r\n/** Backend-accepted challenge actions (UPPERCASE). */\r\nexport const CHALLENGE_ACTIONS = [\"BLINK\", \"TURN_LEFT\", \"TURN_RIGHT\", \"TURN_HEAD\", \"OPEN_MOUTH\"] as const;\r\n\r\n/** Default set sent when the caller does not specify actions. */\r\nexport const DEFAULT_CHALLENGE_ACTIONS = [\"BLINK\", \"TURN_LEFT\", \"OPEN_MOUTH\"] as const;\r\n\r\n/** Time limit per liveness attempt in seconds. */\r\nexport const LIVENESS_TIME_LIMIT_SECONDS = 45;\r\n\r\n/** Milliseconds to pause after all actions before capturing the final snapshot. */\r\nexport const POST_ACTION_SETTLE_MS = 800;\r\n\r\n// \u2500\u2500 Camera \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\r\n\r\n/** Ideal resolution for the front-facing liveness camera. */\r\nexport const CAMERA_IDEAL_WIDTH = 640;\r\nexport const CAMERA_IDEAL_HEIGHT = 480;\r\n\r\n/** Ideal resolution for rear-facing document capture camera. */\r\nexport const DOC_CAMERA_IDEAL_WIDTH = 1280;\r\nexport const DOC_CAMERA_IDEAL_HEIGHT = 960;\r\n\r\n/** Video bitrate used by MediaRecorder for liveness recordings (~1.4 MB / 45 s). */\r\nexport const RECORDING_BITS_PER_SECOND = 250_000;\r\n\r\n// \u2500\u2500 Face detection \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\r\n\r\n/** Max milliseconds to wait for an initial face detection before proceeding. */\r\nexport const FACE_DETECT_TIMEOUT_MS = 10_000;\r\n\r\n/** Polling interval for the face-present check (ms). */\r\nexport const FACE_DETECT_POLL_MS = 100;\r\n\r\n// \u2500\u2500 UI / UX \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\r\n\r\n/** How long (ms) the success overlay is shown before the flow advances. */\r\nexport const RESULT_OVERLAY_DURATION_MS = 2_800;\r\n\r\n/** localStorage key used to persist the browser fingerprint ID. */\r\nexport const FINGERPRINT_STORAGE_KEY = \"_adhere_fid\";\r\n\r\n/** z-index for the SDK overlay \u2014 high enough to sit above any app content. */\r\nexport const OVERLAY_Z_INDEX = 99_999;\r\n", "/**\r\n * LivenessUploader \u2014 thin wrapper around the HttpClient's uploadWithSession()\r\n * that adds:\r\n * - Progress callbacks (onProgress)\r\n * - Upload cancellation via AbortController\r\n * - Automatic retry on transient network failure (configurable)\r\n *\r\n * Used internally by LivenessModule.create() and LivenessModule.submit() when\r\n * the caller needs progress reporting (e.g. for a progress bar during video\r\n * upload on slow connections).\r\n */\r\n\r\nimport { HttpClient } from \"../../client/HttpClient\";\r\nimport { MAX_RETRIES, RETRY_DELAY_MS } from \"../../utils/constants\";\r\nimport { SDKLogger } from \"../../utils/logger\";\r\n\r\nexport interface UploadOptions {\r\n /** Called with a value 0\u20131 as the upload progresses. */\r\n onProgress?: (fraction: number) => void;\r\n\r\n /** Optional AbortSignal to cancel the upload mid-flight. */\r\n signal?: AbortSignal;\r\n\r\n /** Override the default number of retries on transient errors. */\r\n retries?: number;\r\n}\r\n\r\nexport class LivenessUploader {\r\n constructor(private http: HttpClient) {}\r\n\r\n /**\r\n * Upload a FormData payload to `path` with optional progress and\r\n * cancellation support.\r\n *\r\n * Falls back to the standard `uploadWithSession()` on browsers that do not\r\n * support XMLHttpRequest upload progress (very rare).\r\n */\r\n async upload<T>(\r\n path: string,\r\n formData: FormData,\r\n options: UploadOptions = {}\r\n ): Promise<T> {\r\n const { onProgress, signal, retries = MAX_RETRIES } = options;\r\n\r\n // If no progress callback is needed, delegate straight to HttpClient\r\n // which already has retry logic built in.\r\n if (!onProgress) {\r\n return this.http.uploadWithSession<T>(path, formData);\r\n }\r\n\r\n return this.uploadWithProgress<T>(path, formData, onProgress, signal, retries);\r\n }\r\n\r\n // \u2500\u2500 Private \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\r\n\r\n private async uploadWithProgress<T>(\r\n path: string,\r\n formData: FormData,\r\n onProgress: (fraction: number) => void,\r\n signal: AbortSignal | undefined,\r\n retriesLeft: number\r\n ): Promise<T> {\r\n const sessionToken = (this.http as any).sessionToken as string | null;\r\n if (!sessionToken) {\r\n throw new Error(\"SDK: No session token. Call sdk.createSession() first.\");\r\n }\r\n\r\n const baseUrl: string = (this.http as any).baseUrl as string;\r\n\r\n return new Promise<T>((resolve, reject) => {\r\n const xhr = new XMLHttpRequest();\r\n\r\n // Propagate AbortSignal to XHR\r\n if (signal) {\r\n if (signal.aborted) {\r\n reject(new DOMException(\"Upload cancelled\", \"AbortError\"));\r\n return;\r\n }\r\n signal.addEventListener(\"abort\", () => xhr.abort(), { once: true });\r\n }\r\n\r\n xhr.open(\"POST\", `${baseUrl}${path}`, true);\r\n xhr.setRequestHeader(\"x-access-token\", sessionToken);\r\n\r\n xhr.upload.onprogress = (evt) => {\r\n if (evt.lengthComputable) {\r\n onProgress(evt.loaded / evt.total);\r\n }\r\n };\r\n\r\n xhr.onload = () => {\r\n onProgress(1);\r\n\r\n let envelope: any;\r\n try {\r\n envelope = JSON.parse(xhr.responseText);\r\n } catch {\r\n reject(new Error(`SDK: Non-JSON response from ${path} (${xhr.status})`));\r\n return;\r\n }\r\n\r\n if (xhr.status >= 200 && xhr.status < 300 && envelope.status !== \"error\") {\r\n SDKLogger.info(`Upload to ${path} succeeded`, { status: xhr.status });\r\n resolve(envelope.data as T);\r\n } else {\r\n const err = new Error(envelope.message || `Upload to ${path} failed (${xhr.status})`);\r\n (err as any).statusCode = xhr.status;\r\n (err as any).code = envelope.code;\r\n reject(err);\r\n }\r\n };\r\n\r\n xhr.onerror = async () => {\r\n SDKLogger.warn(`Upload to ${path} failed \u2014 network error`, { retriesLeft });\r\n\r\n if (retriesLeft > 0) {\r\n await new Promise((r) => setTimeout(r, RETRY_DELAY_MS));\r\n try {\r\n const result = await this.uploadWithProgress<T>(\r\n path, formData, onProgress, signal, retriesLeft - 1\r\n );\r\n resolve(result);\r\n } catch (retryErr) {\r\n reject(retryErr);\r\n }\r\n } else {\r\n reject(new Error(`SDK: Upload to ${path} failed after all retries.`));\r\n }\r\n };\r\n\r\n xhr.onabort = () => {\r\n reject(new DOMException(\"Upload cancelled by user\", \"AbortError\"));\r\n };\r\n\r\n xhr.send(formData);\r\n });\r\n }\r\n}\r\n"],
|
|
4
|
+
"sourcesContent": ["import { SmartComply } from \"./client/Smartcomply\";\r\nimport { SmartComplyFlow } from \"./flow/SmartComplyFlow\";\r\n\r\nexport default SmartComply;\r\nexport { SmartComply, SmartComplyFlow };\r\n\r\n// Config\r\nexport type { SDKConfig, Environment } from \"./client/Config\";\r\n\r\n// Flow types\r\nexport type { FlowOptions, FlowResult } from \"./flow/SmartComplyFlow\";\r\n\r\n// Onboarding types\r\nexport type {\r\n OnboardingType,\r\n VerifyIdentityRequest,\r\n VerifyIdentityResponse,\r\n SessionResponse,\r\n SDKInitConfig,\r\n} from \"./types/onboarding\";\r\n\r\n// Liveness types\r\nexport type {\r\n ChallengeAction,\r\n LivenessCreateRequest,\r\n LivenessCreateResponse,\r\n LivenessSubmitResponse,\r\n LivenessWebhookPayload,\r\n} from \"./types/liveness\";\r\n\r\n// Response envelope types\r\nexport type {\r\n ApiResponse,\r\n FieldError,\r\n ErrorData,\r\n} from \"./types/common\";\r\n\r\n// Error classes\r\nexport { SDKError } from \"./errors/SDKError\";\r\nexport { AuthError } from \"./errors/AuthError\";\r\nexport { NetworkError } from \"./errors/NetworkError\";\r\n\r\n// Utilities\r\nexport { SDKLogger } from \"./utils/logger\";\r\nexport { collectDeviceMetadata } from \"./utils/device\";\r\nexport type { DeviceMetadata } from \"./utils/device\";\r\nexport {\r\n isCameraSupported,\r\n queryCameraPermission,\r\n requestCameraAccess,\r\n releaseCameraStream,\r\n} from \"./camera/Permission\";\r\nexport type { PermissionStatus, CameraPermissionResult } from \"./camera/Permission\";\r\n\r\n// Liveness uploader (for integrators that need progress reporting)\r\nexport { LivenessUploader } from \"./modules/liveness/uploader\";\r\nexport type { UploadOptions } from \"./modules/liveness/uploader\";\r\n", "export type Environment = \"sandbox\" | \"production\";\r\n\r\nexport const BASE_URLS: Record<Environment, string> = {\r\n sandbox: \"https://dev-adhere.smartcomply.com\",\r\n production: \"https://adhere-api.smartcomply.com\"\r\n};\r\n\r\nexport interface SDKConfig {\r\n apiKey: string;\r\n clientId: string; // Required UUID \u2014 used for session creation\r\n environment?: Environment;\r\n timeout?: number;\r\n}\r\n", "export class SDKError extends Error {\r\n statusCode: number;\r\n errorCode?: string;\r\n errorData?: Record<string, unknown>;\r\n\r\n constructor(\r\n message: string,\r\n statusCode: number,\r\n errorCode?: string,\r\n errorData?: Record<string, unknown>\r\n ) {\r\n super(message);\r\n this.name = \"SDKError\";\r\n this.statusCode = statusCode;\r\n this.errorCode = errorCode;\r\n this.errorData = errorData;\r\n }\r\n}\r\n", "import { SDKError } from \"./SDKError\";\r\n\r\n/**\r\n * Thrown when authentication fails (invalid API key, expired session, etc).\r\n */\r\nexport class AuthError extends SDKError {\r\n constructor(message: string, errorCode?: string) {\r\n super(message, 401, errorCode);\r\n this.name = \"AuthError\";\r\n }\r\n}\r\n", "import { SDKError } from \"./SDKError\";\r\n\r\n/**\r\n * Thrown when a network request fails (timeout, no connection, DNS failure, etc).\r\n */\r\nexport class NetworkError extends SDKError {\r\n constructor(message: string) {\r\n super(message, 0, \"NETWORK_ERROR\");\r\n this.name = \"NetworkError\";\r\n }\r\n}\r\n", "import { SDKConfig, BASE_URLS } from \"./Config\";\r\nimport { SDKError } from \"../errors/SDKError\";\r\nimport { AuthError } from \"../errors/AuthError\";\r\nimport { NetworkError } from \"../errors/NetworkError\";\r\nimport { ApiResponse } from \"../types/common\";\r\n\r\n/**\r\n * HTTP client aligned with Adhere backend contract.\r\n *\r\n * Two auth modes:\r\n * - request() \u2192 Authorization: Bearer <apiKey> (session creation)\r\n * - sessionRequest() \u2192 x-access-token: <sessionToken> (all other endpoints)\r\n * - uploadWithSession() \u2192 multipart + x-access-token (file uploads)\r\n */\r\nexport class HttpClient {\r\n private baseUrl: string;\r\n private apiKey: string;\r\n private timeout: number;\r\n private sessionToken: string | null = null;\r\n\r\n constructor(config: SDKConfig) {\r\n this.baseUrl = BASE_URLS[config.environment || \"sandbox\"];\r\n this.apiKey = config.apiKey;\r\n this.timeout = config.timeout || 30000;\r\n }\r\n\r\n setSessionToken(token: string): void {\r\n this.sessionToken = token;\r\n }\r\n\r\n /**\r\n * API-key authenticated request (used for session creation only).\r\n * Header: Authorization: Bearer <apiKey>\r\n */\r\n async request<T>(\r\n method: string,\r\n path: string,\r\n body?: unknown\r\n ): Promise<T> {\r\n return this._fetch<T>(path, {\r\n method,\r\n headers: {\r\n \"Authorization\": `Bearer ${this.apiKey}`,\r\n \"Content-Type\": \"application/json\",\r\n },\r\n body: body ? JSON.stringify(body) : undefined,\r\n });\r\n }\r\n\r\n /**\r\n * Session-token authenticated request (used for all endpoints after session creation).\r\n * Header: x-access-token: <sessionToken>\r\n */\r\n async sessionRequest<T>(\r\n method: string,\r\n path: string,\r\n body?: unknown\r\n ): Promise<T> {\r\n this.requireToken();\r\n\r\n return this._fetch<T>(path, {\r\n method,\r\n headers: {\r\n \"x-access-token\": this.sessionToken!,\r\n \"Content-Type\": \"application/json\",\r\n },\r\n body: body ? JSON.stringify(body) : undefined,\r\n });\r\n }\r\n\r\n /**\r\n * Multipart file upload with session-token auth.\r\n * Header: x-access-token: <sessionToken>\r\n * NOTE: Do NOT set Content-Type \u2014 browser sets it with boundary automatically.\r\n */\r\n async uploadWithSession<T>(path: string, formData: FormData): Promise<T> {\r\n this.requireToken();\r\n\r\n return this._fetch<T>(path, {\r\n method: \"POST\",\r\n headers: {\r\n \"x-access-token\": this.sessionToken!,\r\n },\r\n body: formData,\r\n });\r\n }\r\n\r\n /**\r\n * Unauthenticated GET \u2014 used for public endpoints (e.g. status polling after session revoke).\r\n */\r\n async publicGet<T>(path: string): Promise<T> {\r\n return this._fetch<T>(path, {\r\n method: \"GET\",\r\n headers: { \"Content-Type\": \"application/json\" },\r\n });\r\n }\r\n\r\n /**\r\n * Legacy upload with API key (kept for backward compatibility if needed).\r\n */\r\n async upload<T>(path: string, formData: FormData): Promise<T> {\r\n return this._fetch<T>(path, {\r\n method: \"POST\",\r\n headers: {\r\n \"Authorization\": `Bearer ${this.apiKey}`,\r\n },\r\n body: formData,\r\n });\r\n }\r\n\r\n // ---- Internal ----\r\n\r\n private requireToken(): void {\r\n if (!this.sessionToken) {\r\n throw new AuthError(\r\n \"No session token set. Call sdk.createSession() first.\",\r\n \"NO_SESSION_TOKEN\"\r\n );\r\n }\r\n }\r\n\r\n private async _fetch<T>(path: string, init: RequestInit, retries = 2): Promise<T> {\r\n const controller = new AbortController();\r\n const timer = setTimeout(() => controller.abort(), this.timeout);\r\n\r\n try {\r\n const response = await fetch(`${this.baseUrl}${path}`, {\r\n ...init,\r\n signal: controller.signal,\r\n });\r\n\r\n const contentType = response.headers.get(\"content-type\") || \"\";\r\n if (!contentType.includes(\"application/json\")) {\r\n throw new SDKError(\r\n `Unexpected response from ${path} (${response.status})`,\r\n response.status\r\n );\r\n }\r\n\r\n // Parse the backend's standard response envelope\r\n const envelope: ApiResponse = await response.json();\r\n\r\n if (!response.ok || envelope.status === \"error\") {\r\n const statusCode = response.status;\r\n\r\n // Map specific HTTP statuses to error types\r\n if (statusCode === 401 || statusCode === 403) {\r\n throw new AuthError(\r\n envelope.message || \"Authentication failed\",\r\n envelope.code\r\n );\r\n }\r\n\r\n throw new SDKError(\r\n envelope.message || `Request to ${path} failed`,\r\n statusCode,\r\n envelope.code,\r\n envelope.data as Record<string, unknown>\r\n );\r\n }\r\n\r\n // Return the full envelope for verify responses (so SDK can check status)\r\n // For other endpoints, return unwrapped data\r\n if (path.includes(\"/verify/\")) {\r\n return envelope as T;\r\n }\r\n return envelope.data as T;\r\n\r\n } catch (err: any) {\r\n if (err instanceof SDKError || err instanceof AuthError) throw err;\r\n\r\n // C5: Retry on network errors (not auth/validation errors)\r\n if (retries > 0 && (err.name === \"AbortError\" || err.name === \"TypeError\")) {\r\n clearTimeout(timer);\r\n await new Promise((r) => setTimeout(r, 1000)); // wait 1s before retry\r\n return this._fetch<T>(path, init, retries - 1);\r\n }\r\n\r\n if (err.name === \"AbortError\") {\r\n throw new NetworkError(\"Request timeout. Please check your connection and try again.\");\r\n }\r\n if (err.name === \"TypeError\" && err.message?.includes(\"fetch\")) {\r\n throw new NetworkError(`Network error: ${err.message}`);\r\n }\r\n\r\n throw new SDKError(\r\n err.message || \"Unknown error\",\r\n 0,\r\n \"UNKNOWN_ERROR\"\r\n );\r\n } finally {\r\n clearTimeout(timer);\r\n }\r\n }\r\n}\r\n", "import { HttpClient } from \"../../client/HttpClient\";\r\nimport {\r\n VerifyIdentityRequest,\r\n VerifyIdentityResponse,\r\n} from \"../../types/onboarding\";\r\n\r\n/**\r\n * Onboarding module \u2014 identity verification.\r\n *\r\n * All methods use session-token auth (x-access-token header).\r\n */\r\nexport class OnboardingModule {\r\n constructor(private http: HttpClient) {}\r\n\r\n /**\r\n * Verify a user's identity.\r\n *\r\n * POST /v1/onboarding/verify/\r\n * Auth: x-access-token: <sessionToken>\r\n *\r\n * Sends identity_type_id (from ChannelItem.id) and dynamic fields\r\n * collected from the user based on the channel's field definitions.\r\n *\r\n * Example:\r\n * { identity_type_id: 3, fields: { \"bank_verification_number\": \"12345678901\" } }\r\n */\r\n async verify(params: VerifyIdentityRequest): Promise<VerifyIdentityResponse> {\r\n return this.http.sessionRequest<VerifyIdentityResponse>(\r\n \"POST\",\r\n \"/v1/sdk/onboarding/verify/\",\r\n {\r\n identity_type_id: params.identity_type_id,\r\n fields: params.fields,\r\n }\r\n );\r\n }\r\n}\r\n", "/**\r\n * Collects device / browser context metadata.\r\n * All values are derived from standard browser APIs \u2014 no external library needed.\r\n * Sent to the backend at liveness/create so they appear in the webhook\r\n * request_context block.\r\n */\r\nexport interface DeviceMetadata {\r\n device_type: \"mobile\" | \"desktop\" | \"tablet\";\r\n os_name: string;\r\n browser_timezone: string;\r\n fingerprint_id: string;\r\n}\r\n\r\nfunction detectOs(ua: string): string {\r\n if (/Windows NT/i.test(ua)) return \"Windows\";\r\n if (/Mac OS X|Macintosh/i.test(ua)) return \"macOS\";\r\n if (/Android/i.test(ua)) return \"Android\";\r\n if (/iPhone|iPad|iPod/i.test(ua)) return \"iOS\";\r\n if (/Linux/i.test(ua)) return \"Linux\";\r\n if (/CrOS/i.test(ua)) return \"ChromeOS\";\r\n return \"Unknown\";\r\n}\r\n\r\nfunction getOrCreateFingerprintId(): string {\r\n const KEY = \"_adhere_fid\";\r\n try {\r\n let fid = localStorage.getItem(KEY);\r\n if (!fid) {\r\n fid =\r\n typeof crypto !== \"undefined\" && typeof crypto.randomUUID === \"function\"\r\n ? crypto.randomUUID()\r\n : Math.random().toString(36).slice(2) + Date.now().toString(36);\r\n localStorage.setItem(KEY, fid);\r\n }\r\n return fid;\r\n } catch {\r\n // localStorage unavailable (e.g. private browsing with strict settings)\r\n return Math.random().toString(36).slice(2) + Date.now().toString(36);\r\n }\r\n}\r\n\r\nexport function collectDeviceMetadata(): DeviceMetadata {\r\n const ua = navigator.userAgent;\r\n\r\n const isTablet =\r\n /iPad/i.test(ua) ||\r\n (/Android/i.test(ua) && !/Mobile/i.test(ua));\r\n\r\n const isMobile =\r\n !isTablet &&\r\n /Mobi|Android|iPhone|iPod|BlackBerry|IEMobile|Opera Mini/i.test(ua);\r\n\r\n const device_type: DeviceMetadata[\"device_type\"] = isTablet\r\n ? \"tablet\"\r\n : isMobile\r\n ? \"mobile\"\r\n : \"desktop\";\r\n\r\n return {\r\n device_type,\r\n os_name: detectOs(ua),\r\n browser_timezone: Intl.DateTimeFormat().resolvedOptions().timeZone,\r\n fingerprint_id: getOrCreateFingerprintId(),\r\n };\r\n}\r\n", "export class CameraManager {\r\n private stream: MediaStream | null = null;\r\n\r\n async open(constraints?: MediaStreamConstraints): Promise<MediaStream> {\r\n const defaults: MediaStreamConstraints = {\r\n video: {\r\n facingMode: \"user\",\r\n width: { ideal: 1280 },\r\n height: { ideal: 720 },\r\n },\r\n audio: false,\r\n };\r\n\r\n this.stream = await navigator.mediaDevices.getUserMedia(\r\n constraints || defaults\r\n );\r\n\r\n return this.stream;\r\n }\r\n\r\n getStream(): MediaStream | null {\r\n return this.stream;\r\n }\r\n\r\n stop(): void {\r\n if (this.stream) {\r\n this.stream.getTracks().forEach((track) => track.stop());\r\n this.stream = null;\r\n }\r\n }\r\n}\r\n", "export class VideoRecorder {\r\n private recorder: MediaRecorder | null = null;\r\n private chunks: Blob[] = [];\r\n private startedAt: number = 0;\r\n\r\n start(stream: MediaStream): void {\r\n this.chunks = [];\r\n\r\n const mimeType = MediaRecorder.isTypeSupported(\"video/webm;codecs=vp9\")\r\n ? \"video/webm;codecs=vp9\"\r\n : \"video/webm\";\r\n\r\n this.recorder = new MediaRecorder(stream, {\r\n mimeType,\r\n videoBitsPerSecond: 250_000, // ~1.4 MB for 45s \u2014 keeps file under server upload limit\r\n });\r\n\r\n this.recorder.ondataavailable = (e) => {\r\n if (e.data.size > 0) {\r\n this.chunks.push(e.data);\r\n }\r\n };\r\n\r\n this.startedAt = Date.now();\r\n this.recorder.start();\r\n }\r\n\r\n stop(): Promise<{ blob: Blob; durationSeconds: number }> {\r\n return new Promise((resolve, reject) => {\r\n if (!this.recorder || this.recorder.state === \"inactive\") {\r\n reject(new Error(\"Recorder is not active\"));\r\n return;\r\n }\r\n\r\n const stoppedAt = Date.now();\r\n\r\n this.recorder.onstop = () => {\r\n const blob = new Blob(this.chunks, { type: \"video/webm\" });\r\n const durationSeconds = parseFloat(\r\n ((stoppedAt - this.startedAt) / 1000).toFixed(2)\r\n );\r\n this.chunks = [];\r\n resolve({ blob, durationSeconds });\r\n };\r\n\r\n this.recorder.onerror = () => {\r\n reject(new Error(\"Recording failed\"));\r\n };\r\n\r\n this.recorder.stop();\r\n });\r\n }\r\n\r\n isRecording(): boolean {\r\n return this.recorder?.state === \"recording\";\r\n }\r\n}\r\n", "var t=\"undefined\"!=typeof self?self:{};function e(e,n){t:{for(var r=[\"CLOSURE_FLAGS\"],i=t,s=0;s<r.length;s++)if(null==(i=i[r[s]])){r=null;break t}r=i}return null!=(e=r&&r[e])?e:n}function n(){throw Error(\"Invalid UTF8\")}function r(t,e){return e=String.fromCharCode.apply(null,e),null==t?e:t+e}let i,s;const o=\"undefined\"!=typeof TextDecoder;let a;const c=\"undefined\"!=typeof TextEncoder;function h(t){if(c)t=(a||=new TextEncoder).encode(t);else{let n=0;const r=new Uint8Array(3*t.length);for(let i=0;i<t.length;i++){var e=t.charCodeAt(i);if(e<128)r[n++]=e;else{if(e<2048)r[n++]=e>>6|192;else{if(e>=55296&&e<=57343){if(e<=56319&&i<t.length){const s=t.charCodeAt(++i);if(s>=56320&&s<=57343){e=1024*(e-55296)+s-56320+65536,r[n++]=e>>18|240,r[n++]=e>>12&63|128,r[n++]=e>>6&63|128,r[n++]=63&e|128;continue}i--}e=65533}r[n++]=e>>12|224,r[n++]=e>>6&63|128}r[n++]=63&e|128}}t=n===r.length?r:r.subarray(0,n)}return t}function u(e){t.setTimeout((()=>{throw e}),0)}var l,f=e(610401301,!1),d=e(748402147,!0),p=e(824648567,!0),g=e(824656860,e(1,!0));function m(){var e=t.navigator;return e&&(e=e.userAgent)?e:\"\"}const y=t.navigator;function _(t){return _[\" \"](t),t}l=y&&y.userAgentData||null,_[\" \"]=function(){};const v={};let E=null;function w(t){const e=t.length;let n=3*e/4;n%3?n=Math.floor(n):-1!=\"=.\".indexOf(t[e-1])&&(n=-1!=\"=.\".indexOf(t[e-2])?n-2:n-1);const r=new Uint8Array(n);let i=0;return function(t,e){function n(e){for(;r<t.length;){const e=t.charAt(r++),n=E[e];if(null!=n)return n;if(!/^[\\s\\xa0]*$/.test(e))throw Error(\"Unknown base64 encoding at char: \"+e)}return e}T();let r=0;for(;;){const t=n(-1),r=n(0),i=n(64),s=n(64);if(64===s&&-1===t)break;e(t<<2|r>>4),64!=i&&(e(r<<4&240|i>>2),64!=s&&e(i<<6&192|s))}}(t,(function(t){r[i++]=t})),i!==n?r.subarray(0,i):r}function T(){if(!E){E={};var t=\"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789\".split(\"\"),e=[\"+/=\",\"+/\",\"-_=\",\"-_.\",\"-_\"];for(let n=0;n<5;n++){const r=t.concat(e[n].split(\"\"));v[n]=r;for(let t=0;t<r.length;t++){const e=r[t];void 0===E[e]&&(E[e]=t)}}}}var A=\"undefined\"!=typeof Uint8Array,b=!(!(f&&l&&l.brands.length>0)&&(-1!=m().indexOf(\"Trident\")||-1!=m().indexOf(\"MSIE\")))&&\"function\"==typeof btoa;const k=/[-_.]/g,S={\"-\":\"+\",_:\"/\",\".\":\"=\"};function x(t){return S[t]||\"\"}function L(t){if(!b)return w(t);t=k.test(t)?t.replace(k,x):t,t=atob(t);const e=new Uint8Array(t.length);for(let n=0;n<t.length;n++)e[n]=t.charCodeAt(n);return e}function R(t){return A&&null!=t&&t instanceof Uint8Array}var I={};function F(){return C||=new P(null,I)}function M(t){N(I);var e=t.g;return null==(e=null==e||R(e)?e:\"string\"==typeof e?L(e):null)?e:t.g=e}var P=class{h(){return new Uint8Array(M(this)||0)}constructor(t,e){if(N(e),this.g=t,null!=t&&0===t.length)throw Error(\"ByteString should be constructed with non-empty values\")}};let C,O;function N(t){if(t!==I)throw Error(\"illegal external caller\")}function U(t,e){t.__closure__error__context__984382||(t.__closure__error__context__984382={}),t.__closure__error__context__984382.severity=e}function D(t){return U(t=Error(t),\"warning\"),t}function B(t,e){if(null!=t){var n=O??={},r=n[t]||0;r>=e||(n[t]=r+1,U(t=Error(),\"incident\"),u(t))}}function G(){return\"function\"==typeof BigInt}var j=\"function\"==typeof Symbol&&\"symbol\"==typeof Symbol();function V(t,e,n=!1){return\"function\"==typeof Symbol&&\"symbol\"==typeof Symbol()?n&&Symbol.for&&t?Symbol.for(t):null!=t?Symbol(t):Symbol():e}var X=V(\"jas\",void 0,!0),H=V(void 0,\"0di\"),W=V(void 0,\"1oa\"),z=V(void 0,Symbol()),K=V(void 0,\"0ub\"),Y=V(void 0,\"0ubs\"),q=V(void 0,\"0ubsb\"),$=V(void 0,\"0actk\"),J=V(\"m_m\",\"Pa\",!0),Z=V();const Q={Ga:{value:0,configurable:!0,writable:!0,enumerable:!1}},tt=Object.defineProperties,et=j?X:\"Ga\";var nt;const rt=[];function it(t,e){j||et in t||tt(t,Q),t[et]|=e}function st(t,e){j||et in t||tt(t,Q),t[et]=e}function ot(t){return it(t,34),t}function at(t){return it(t,8192),t}st(rt,7),nt=Object.freeze(rt);var ct={};function ht(t,e){return void 0===e?t.h!==ut&&!!(2&(0|t.v[et])):!!(2&e)&&t.h!==ut}const ut={};function lt(t,e){if(null!=t)if(\"string\"==typeof t)t=t?new P(t,I):F();else if(t.constructor!==P)if(R(t))t=t.length?new P(new Uint8Array(t),I):F();else{if(!e)throw Error();t=void 0}return t}class ft{constructor(t,e,n){this.g=t,this.h=e,this.l=n}next(){const t=this.g.next();return t.done||(t.value=this.h.call(this.l,t.value)),t}[Symbol.iterator](){return this}}var dt=Object.freeze({});function pt(t,e,n){const r=128&e?0:-1,i=t.length;var s;(s=!!i)&&(s=null!=(s=t[i-1])&&\"object\"==typeof s&&s.constructor===Object);const o=i+(s?-1:0);for(e=128&e?1:0;e<o;e++)n(e-r,t[e]);if(s){t=t[i-1];for(const e in t)!isNaN(e)&&n(+e,t[e])}}var gt={};function mt(t){return 128&t?gt:void 0}function yt(t){return t.Na=!0,t}var _t=yt((t=>\"number\"==typeof t)),vt=yt((t=>\"string\"==typeof t)),Et=yt((t=>\"boolean\"==typeof t)),wt=\"function\"==typeof t.BigInt&&\"bigint\"==typeof t.BigInt(0);function Tt(t){var e=t;if(vt(e)){if(!/^\\s*(?:-?[1-9]\\d*|0)?\\s*$/.test(e))throw Error(String(e))}else if(_t(e)&&!Number.isSafeInteger(e))throw Error(String(e));return wt?BigInt(t):t=Et(t)?t?\"1\":\"0\":vt(t)?t.trim()||\"0\":String(t)}var At=yt((t=>wt?t>=kt&&t<=xt:\"-\"===t[0]?Lt(t,bt):Lt(t,St)));const bt=Number.MIN_SAFE_INTEGER.toString(),kt=wt?BigInt(Number.MIN_SAFE_INTEGER):void 0,St=Number.MAX_SAFE_INTEGER.toString(),xt=wt?BigInt(Number.MAX_SAFE_INTEGER):void 0;function Lt(t,e){if(t.length>e.length)return!1;if(t.length<e.length||t===e)return!0;for(let n=0;n<t.length;n++){const r=t[n],i=e[n];if(r>i)return!1;if(r<i)return!0}}const Rt=\"function\"==typeof Uint8Array.prototype.slice;let It,Ft=0,Mt=0;function Pt(t){const e=t>>>0;Ft=e,Mt=(t-e)/4294967296>>>0}function Ct(t){if(t<0){Pt(-t);const[e,n]=Ht(Ft,Mt);Ft=e>>>0,Mt=n>>>0}else Pt(t)}function Ot(t){const e=It||=new DataView(new ArrayBuffer(8));e.setFloat32(0,+t,!0),Mt=0,Ft=e.getUint32(0,!0)}function Nt(t,e){const n=4294967296*e+(t>>>0);return Number.isSafeInteger(n)?n:Gt(t,e)}function Ut(t,e){return Tt(G()?BigInt.asUintN(64,(BigInt(e>>>0)<<BigInt(32))+BigInt(t>>>0)):Gt(t,e))}function Dt(t,e){const n=2147483648&e;return n&&(e=~e>>>0,0==(t=1+~t>>>0)&&(e=e+1>>>0)),\"number\"==typeof(t=Nt(t,e))?n?-t:t:n?\"-\"+t:t}function Bt(t,e){return G()?Tt(BigInt.asIntN(64,(BigInt.asUintN(32,BigInt(e))<<BigInt(32))+BigInt.asUintN(32,BigInt(t)))):Tt(Vt(t,e))}function Gt(t,e){if(t>>>=0,(e>>>=0)<=2097151)var n=\"\"+(4294967296*e+t);else G()?n=\"\"+(BigInt(e)<<BigInt(32)|BigInt(t)):(t=(16777215&t)+6777216*(n=16777215&(t>>>24|e<<8))+6710656*(e=e>>16&65535),n+=8147497*e,e*=2,t>=1e7&&(n+=t/1e7>>>0,t%=1e7),n>=1e7&&(e+=n/1e7>>>0,n%=1e7),n=e+jt(n)+jt(t));return n}function jt(t){return t=String(t),\"0000000\".slice(t.length)+t}function Vt(t,e){if(2147483648&e)if(G())t=\"\"+(BigInt(0|e)<<BigInt(32)|BigInt(t>>>0));else{const[n,r]=Ht(t,e);t=\"-\"+Gt(n,r)}else t=Gt(t,e);return t}function Xt(t){if(t.length<16)Ct(Number(t));else if(G())t=BigInt(t),Ft=Number(t&BigInt(4294967295))>>>0,Mt=Number(t>>BigInt(32)&BigInt(4294967295));else{const e=+(\"-\"===t[0]);Mt=Ft=0;const n=t.length;for(let r=e,i=(n-e)%6+e;i<=n;r=i,i+=6){const e=Number(t.slice(r,i));Mt*=1e6,Ft=1e6*Ft+e,Ft>=4294967296&&(Mt+=Math.trunc(Ft/4294967296),Mt>>>=0,Ft>>>=0)}if(e){const[t,e]=Ht(Ft,Mt);Ft=t,Mt=e}}}function Ht(t,e){return e=~e,t?t=1+~t:e+=1,[t,e]}function Wt(t){return Array.prototype.slice.call(t)}const zt=\"function\"==typeof BigInt?BigInt.asIntN:void 0,Kt=\"function\"==typeof BigInt?BigInt.asUintN:void 0,Yt=Number.isSafeInteger,qt=Number.isFinite,$t=Math.trunc,Jt=Tt(0);function Zt(t){if(null!=t&&\"number\"!=typeof t)throw Error(`Value of float/double field must be a number, found ${typeof t}: ${t}`);return t}function Qt(t){return null==t||\"number\"==typeof t?t:\"NaN\"===t||\"Infinity\"===t||\"-Infinity\"===t?Number(t):void 0}function te(t){if(null!=t&&\"boolean\"!=typeof t){var e=typeof t;throw Error(`Expected boolean but got ${\"object\"!=e?e:t?Array.isArray(t)?\"array\":e:\"null\"}: ${t}`)}return t}function ee(t){return null==t||\"boolean\"==typeof t?t:\"number\"==typeof t?!!t:void 0}const ne=/^-?([1-9][0-9]*|0)(\\.[0-9]+)?$/;function re(t){switch(typeof t){case\"bigint\":return!0;case\"number\":return qt(t);case\"string\":return ne.test(t);default:return!1}}function ie(t){if(null==t)return t;if(\"string\"==typeof t&&t)t=+t;else if(\"number\"!=typeof t)return;return qt(t)?0|t:void 0}function se(t){if(null==t)return t;if(\"string\"==typeof t&&t)t=+t;else if(\"number\"!=typeof t)return;return qt(t)?t>>>0:void 0}function oe(t){const e=t.length;return(\"-\"===t[0]?e<20||20===e&&t<=\"-9223372036854775808\":e<19||19===e&&t<=\"9223372036854775807\")?t:(Xt(t),Vt(Ft,Mt))}function ae(t){return t=$t(t),Yt(t)||(Ct(t),t=Dt(Ft,Mt)),t}function ce(t){var e=$t(Number(t));return Yt(e)?String(e):(-1!==(e=t.indexOf(\".\"))&&(t=t.substring(0,e)),oe(t))}function he(t){var e=$t(Number(t));return Yt(e)?Tt(e):(-1!==(e=t.indexOf(\".\"))&&(t=t.substring(0,e)),G()?Tt(zt(64,BigInt(t))):Tt(oe(t)))}function ue(t){return Yt(t)?t=Tt(ae(t)):(t=$t(t),Yt(t)?t=String(t):(Ct(t),t=Vt(Ft,Mt)),t=Tt(t)),t}function le(t){return null==t?t:\"bigint\"==typeof t?(At(t)?t=Number(t):(t=zt(64,t),t=At(t)?Number(t):String(t)),t):re(t)?\"number\"==typeof t?ae(t):ce(t):void 0}function fe(t){const e=typeof t;return null==t?t:\"bigint\"===e?Tt(zt(64,t)):re(t)?\"string\"===e?he(t):ue(t):void 0}function de(t){if(\"string\"!=typeof t)throw Error();return t}function pe(t){if(null!=t&&\"string\"!=typeof t)throw Error();return t}function ge(t){return null==t||\"string\"==typeof t?t:void 0}function me(t,e,n,r){return null!=t&&t[J]===ct?t:Array.isArray(t)?((r=(n=0|t[et])|32&r|2&r)!==n&&st(t,r),new e(t)):(n?2&r?((t=e[H])||(ot((t=new e).v),t=e[H]=t),e=t):e=new e:e=void 0,e)}function ye(t,e,n){if(e)t:{if(!re(e=t))throw D(\"int64\");switch(typeof e){case\"string\":e=he(e);break t;case\"bigint\":e=Tt(zt(64,e));break t;default:e=ue(e)}}else e=fe(t);return null==(t=e)?n?Jt:void 0:t}const _e={};let ve=function(){try{return _(new class extends Map{constructor(){super()}}),!1}catch{return!0}}();class Ee{constructor(){this.g=new Map}get(t){return this.g.get(t)}set(t,e){return this.g.set(t,e),this.size=this.g.size,this}delete(t){return t=this.g.delete(t),this.size=this.g.size,t}clear(){this.g.clear(),this.size=this.g.size}has(t){return this.g.has(t)}entries(){return this.g.entries()}keys(){return this.g.keys()}values(){return this.g.values()}forEach(t,e){return this.g.forEach(t,e)}[Symbol.iterator](){return this.entries()}}const we=ve?(Object.setPrototypeOf(Ee.prototype,Map.prototype),Object.defineProperties(Ee.prototype,{size:{value:0,configurable:!0,enumerable:!0,writable:!0}}),Ee):class extends Map{constructor(){super()}};function Te(t){return t}function Ae(t){if(2&t.J)throw Error(\"Cannot mutate an immutable Map\")}var be=class extends we{constructor(t,e,n=Te,r=Te){super(),this.J=0|t[et],this.K=e,this.S=n,this.fa=this.K?ke:r;for(let i=0;i<t.length;i++){const s=t[i],o=n(s[0],!1,!0);let a=s[1];e?void 0===a&&(a=null):a=r(s[1],!1,!0,void 0,void 0,this.J),super.set(o,a)}}V(t){return at(Array.from(super.entries(),t))}clear(){Ae(this),super.clear()}delete(t){return Ae(this),super.delete(this.S(t,!0,!1))}entries(){if(this.K){var t=super.keys();t=new ft(t,Se,this)}else t=super.entries();return t}values(){if(this.K){var t=super.keys();t=new ft(t,be.prototype.get,this)}else t=super.values();return t}forEach(t,e){this.K?super.forEach(((n,r,i)=>{t.call(e,i.get(r),r,i)})):super.forEach(t,e)}set(t,e){return Ae(this),null==(t=this.S(t,!0,!1))?this:null==e?(super.delete(t),this):super.set(t,this.fa(e,!0,!0,this.K,!1,this.J))}Ma(t){const e=this.S(t[0],!1,!0);t=t[1],t=this.K?void 0===t?null:t:this.fa(t,!1,!0,void 0,!1,this.J),super.set(e,t)}has(t){return super.has(this.S(t,!1,!1))}get(t){t=this.S(t,!1,!1);const e=super.get(t);if(void 0!==e){var n=this.K;return n?((n=this.fa(e,!1,!0,n,this.ra,this.J))!==e&&super.set(t,n),n):e}}[Symbol.iterator](){return this.entries()}};function ke(t,e,n,r,i,s){return t=me(t,r,n,s),i&&(t=Ke(t)),t}function Se(t){return[t,this.get(t)]}let xe;function Le(){return xe||=new be(ot([]),void 0,void 0,void 0,_e)}function Re(t){return z?t[z]:void 0}function Ie(t,e){for(const n in t)!isNaN(n)&&e(t,+n,t[n])}be.prototype.toJSON=void 0;var Fe=class{};const Me={Ka:!0};function Pe(t,e){e<100||B(Y,1)}function Ce(t,e,n,r){const i=void 0!==r;r=!!r;var s,o=z;!i&&j&&o&&(s=t[o])&&Ie(s,Pe),o=[];var a=t.length;let c;s=4294967295;let h=!1;const u=!!(64&e),l=u?128&e?0:-1:void 0;1&e||(c=a&&t[a-1],null!=c&&\"object\"==typeof c&&c.constructor===Object?s=--a:c=void 0,!u||128&e||i||(h=!0,s=s-l+l)),e=void 0;for(var f=0;f<a;f++){let i=t[f];if(null!=i&&null!=(i=n(i,r)))if(u&&f>=s){const t=f-l;(e??={})[t]=i}else o[f]=i}if(c)for(let t in c){if(null==(a=c[t])||null==(a=n(a,r)))continue;let i;f=+t,u&&!Number.isNaN(f)&&(i=f+l)<s?o[i]=a:(e??={})[t]=a}return e&&(h?o.push(e):o[s]=e),i&&z&&(t=Re(t))&&t instanceof Fe&&(o[z]=function(t){const e=new Fe;return Ie(t,((t,n,r)=>{e[n]=Wt(r)})),e.da=t.da,e}(t)),o}function Oe(t){return t[0]=Ne(t[0]),t[1]=Ne(t[1]),t}function Ne(t){switch(typeof t){case\"number\":return Number.isFinite(t)?t:\"\"+t;case\"bigint\":return At(t)?Number(t):\"\"+t;case\"boolean\":return t?1:0;case\"object\":if(Array.isArray(t)){var e=0|t[et];return 0===t.length&&1&e?void 0:Ce(t,e,Ne)}if(null!=t&&t[J]===ct)return Ue(t);if(t instanceof P){if(null==(e=t.g))t=\"\";else if(\"string\"==typeof e)t=e;else{if(b){for(var n=\"\",r=0,i=e.length-10240;r<i;)n+=String.fromCharCode.apply(null,e.subarray(r,r+=10240));n+=String.fromCharCode.apply(null,r?e.subarray(r):e),e=btoa(n)}else{void 0===n&&(n=0),T(),n=v[n],r=Array(Math.floor(e.length/3)),i=n[64]||\"\";let t=0,h=0;for(;t<e.length-2;t+=3){var s=e[t],o=e[t+1],a=e[t+2],c=n[s>>2];s=n[(3&s)<<4|o>>4],o=n[(15&o)<<2|a>>6],a=n[63&a],r[h++]=c+s+o+a}switch(c=0,a=i,e.length-t){case 2:a=n[(15&(c=e[t+1]))<<2]||i;case 1:e=e[t],r[h]=n[e>>2]+n[(3&e)<<4|c>>4]+a+i}e=r.join(\"\")}t=t.g=e}return t}return t instanceof be?t=0!==t.size?t.V(Oe):void 0:void 0}return t}function Ue(t){return Ce(t=t.v,0|t[et],Ne)}let De,Be;function Ge(t,e){return je(t,e[0],e[1])}function je(t,e,n,r=0){if(null==t){var i=32;n?(t=[n],i|=128):t=[],e&&(i=-16760833&i|(1023&e)<<14)}else{if(!Array.isArray(t))throw Error(\"narr\");if(i=0|t[et],d&&1&i)throw Error(\"rfarr\");if(2048&i&&!(2&i)&&function(){if(d)throw Error(\"carr\");B($,5)}(),256&i)throw Error(\"farr\");if(64&i)return(i|r)!==i&&st(t,i|r),t;if(n&&(i|=128,n!==t[0]))throw Error(\"mid\");t:{i|=64;var s=(n=t).length;if(s){var o=s-1;const t=n[o];if(null!=t&&\"object\"==typeof t&&t.constructor===Object){if((o-=e=128&i?0:-1)>=1024)throw Error(\"pvtlmt\");for(var a in t)(s=+a)<o&&(n[s+e]=t[a],delete t[a]);i=-16760833&i|(1023&o)<<14;break t}}if(e){if((a=Math.max(e,s-(128&i?0:-1)))>1024)throw Error(\"spvt\");i=-16760833&i|(1023&a)<<14}}}return st(t,64|i|r),t}function Ve(t,e){if(\"object\"!=typeof t)return t;if(Array.isArray(t)){var n=0|t[et];return 0===t.length&&1&n?void 0:Xe(t,n,e)}if(null!=t&&t[J]===ct)return We(t);if(t instanceof be){if(2&(e=t.J))return t;if(!t.size)return;if(n=ot(t.V()),t.K)for(t=0;t<n.length;t++){const r=n[t];let i=r[1];i=null==i||\"object\"!=typeof i?void 0:null!=i&&i[J]===ct?We(i):Array.isArray(i)?Xe(i,0|i[et],!!(32&e)):void 0,r[1]=i}return n}return t instanceof P?t:void 0}function Xe(t,e,n){return 2&e||(!n||4096&e||16&e?t=ze(t,e,!1,n&&!(16&e)):(it(t,34),4&e&&Object.freeze(t))),t}function He(t,e,n){return t=new t.constructor(e),n&&(t.h=ut),t.m=ut,t}function We(t){const e=t.v,n=0|e[et];return ht(t,n)?t:Je(t,e,n)?He(t,e):ze(e,n)}function ze(t,e,n,r){return r??=!!(34&e),t=Ce(t,e,Ve,r),r=32,n&&(r|=2),st(t,e=16769217&e|r),t}function Ke(t){const e=t.v,n=0|e[et];return ht(t,n)?Je(t,e,n)?He(t,e,!0):new t.constructor(ze(e,n,!1)):t}function Ye(t){if(t.h!==ut)return!1;var e=t.v;return it(e=ze(e,0|e[et]),2048),t.v=e,t.h=void 0,t.m=void 0,!0}function qe(t){if(!Ye(t)&&ht(t,0|t.v[et]))throw Error()}function $e(t,e){void 0===e&&(e=0|t[et]),32&e&&!(4096&e)&&st(t,4096|e)}function Je(t,e,n){return!!(2&n)||!(!(32&n)||4096&n)&&(st(e,2|n),t.h=ut,!0)}const Ze=Tt(0),Qe={};function tn(t,e,n,r,i){if(null!==(e=en(t.v,e,n,i))||r&&t.m!==ut)return e}function en(t,e,n,r){if(-1===e)return null;const i=e+(n?0:-1),s=t.length-1;let o,a;if(!(s<1+(n?0:-1))){if(i>=s)if(o=t[s],null!=o&&\"object\"==typeof o&&o.constructor===Object)n=o[e],a=!0;else{if(i!==s)return;n=o}else n=t[i];if(r&&null!=n){if(null==(r=r(n)))return r;if(!Object.is(r,n))return a?o[e]=r:t[i]=r,r}return n}}function nn(t,e,n,r){qe(t),rn(t=t.v,0|t[et],e,n,r)}function rn(t,e,n,r,i){const s=n+(i?0:-1);var o=t.length-1;if(o>=1+(i?0:-1)&&s>=o){const i=t[o];if(null!=i&&\"object\"==typeof i&&i.constructor===Object)return i[n]=r,e}return s<=o?(t[s]=r,e):(void 0!==r&&(n>=(o=(e??=0|t[et])>>14&1023||536870912)?null!=r&&(t[o+(i?0:-1)]={[n]:r}):t[s]=r),e)}function sn(){return void 0===dt?2:4}function on(t,e,n,r,i){let s=t.v,o=0|s[et];r=ht(t,o)?1:r,i=!!i||3===r,2===r&&Ye(t)&&(s=t.v,o=0|s[et]);let a=(t=cn(s,e))===nt?7:0|t[et],c=hn(a,o);var h=!(4&c);if(h){4&c&&(t=Wt(t),a=0,c=xn(c,o),o=rn(s,o,e,t));let r=0,i=0;for(;r<t.length;r++){const e=n(t[r]);null!=e&&(t[i++]=e)}i<r&&(t.length=i),n=-513&(4|c),c=n&=-1025,c&=-4097}return c!==a&&(st(t,c),2&c&&Object.freeze(t)),an(t,c,s,o,e,r,h,i)}function an(t,e,n,r,i,s,o,a){let c=e;return 1===s||4===s&&(2&e||!(16&e)&&32&r)?un(e)||((e|=!t.length||o&&!(4096&e)||32&r&&!(4096&e||16&e)?2:256)!==c&&st(t,e),Object.freeze(t)):(2===s&&un(e)&&(t=Wt(t),c=0,e=xn(e,r),r=rn(n,r,i,t)),un(e)||(a||(e|=16),e!==c&&st(t,e))),2&e||!(4096&e||16&e)||$e(n,r),t}function cn(t,e,n){return t=en(t,e,n),Array.isArray(t)?t:nt}function hn(t,e){return 2&e&&(t|=2),1|t}function un(t){return!!(2&t)&&!!(4&t)||!!(256&t)}function ln(t){return lt(t,!0)}function fn(t){t=Wt(t);for(let e=0;e<t.length;e++){const n=t[e]=Wt(t[e]);Array.isArray(n[1])&&(n[1]=ot(n[1]))}return at(t)}function dn(t,e,n,r){qe(t),rn(t=t.v,0|t[et],e,(\"0\"===r?0===Number(n):n===r)?void 0:n)}function pn(t,e,n){if(2&e)throw Error();const r=mt(e);let i=cn(t,n,r),s=i===nt?7:0|i[et],o=hn(s,e);return(2&o||un(o)||16&o)&&(o===s||un(o)||st(i,o),i=Wt(i),s=0,o=xn(o,e),rn(t,e,n,i,r)),o&=-13,o!==s&&st(i,o),i}function gn(t,e){var n=Ds;return _n(mn(t=t.v),t,void 0,n)===e?e:-1}function mn(t){if(j)return t[W]??(t[W]=new Map);if(W in t)return t[W];const e=new Map;return Object.defineProperty(t,W,{value:e}),e}function yn(t,e,n,r,i){const s=mn(t),o=_n(s,t,e,n,i);return o!==r&&(o&&(e=rn(t,e,o,void 0,i)),s.set(n,r)),e}function _n(t,e,n,r,i){let s=t.get(r);if(null!=s)return s;s=0;for(let t=0;t<r.length;t++){const o=r[t];null!=en(e,o,i)&&(0!==s&&(n=rn(e,n,s,void 0,i)),s=o)}return t.set(r,s),s}function vn(t,e,n){let r=0|t[et];const i=mt(r),s=en(t,n,i);let o;if(null!=s&&s[J]===ct){if(!ht(s))return Ye(s),s.v;o=s.v}else Array.isArray(s)&&(o=s);if(o){const t=0|o[et];2&t&&(o=ze(o,t))}return o=Ge(o,e),o!==s&&rn(t,r,n,o,i),o}function En(t,e,n,r,i){let s=!1;if(null!=(r=en(t,r,i,(t=>{const r=me(t,n,!1,e);return s=r!==t&&null!=r,r}))))return s&&!ht(r)&&$e(t,e),r}function wn(t,e,n,r){let i=t.v,s=0|i[et];if(null==(e=En(i,s,e,n,r)))return e;if(s=0|i[et],!ht(t,s)){const o=Ke(e);o!==e&&(Ye(t)&&(i=t.v,s=0|i[et]),s=rn(i,s,n,e=o,r),$e(i,s))}return e}function Tn(t,e,n,r,i,s,o,a){var c=ht(t,n);s=c?1:s,o=!!o||3===s,c=a&&!c,(2===s||c)&&Ye(t)&&(n=0|(e=t.v)[et]);var h=(t=cn(e,i))===nt?7:0|t[et],u=hn(h,n);if(a=!(4&u)){var l=t,f=n;const e=!!(2&u);e&&(f|=2);let i=!e,s=!0,o=0,a=0;for(;o<l.length;o++){const t=me(l[o],r,!1,f);if(t instanceof r){if(!e){const e=ht(t);i&&=!e,s&&=e}l[a++]=t}}a<o&&(l.length=a),u|=4,u=s?-4097&u:4096|u,u=i?8|u:-9&u}if(u!==h&&(st(t,u),2&u&&Object.freeze(t)),c&&!(8&u||!t.length&&(1===s||4===s&&(2&u||!(16&u)&&32&n)))){for(un(u)&&(t=Wt(t),u=xn(u,n),n=rn(e,n,i,t)),r=t,c=u,h=0;h<r.length;h++)(l=r[h])!==(u=Ke(l))&&(r[h]=u);c|=8,st(t,u=c=r.length?4096|c:-4097&c)}return an(t,u,e,n,i,s,a,o)}function An(t,e,n){const r=t.v;return Tn(t,r,0|r[et],e,n,sn(),!1,!0)}function bn(t){return null==t&&(t=void 0),t}function kn(t,e,n,r,i){return nn(t,n,r=bn(r),i),r&&!ht(r)&&$e(t.v),t}function Sn(t,e,n,r){t:{var i=r=bn(r);qe(t);const s=t.v;let o=0|s[et];if(null==i){const t=mn(s);if(_n(t,s,o,n)!==e)break t;t.set(n,0)}else o=yn(s,o,n,e);rn(s,o,e,i)}r&&!ht(r)&&$e(t.v)}function xn(t,e){return-273&(2&e?2|t:-3&t)}function Ln(t,e,n,r){var i=r;qe(t),t=Tn(t,r=t.v,0|r[et],n,e,2,!0),i=null!=i?i:new n,t.push(i),e=n=t===nt?7:0|t[et],(i=ht(i))?(n&=-9,1===t.length&&(n&=-4097)):n|=4096,n!==e&&st(t,n),i||$e(r)}function Rn(t,e,n){return ie(tn(t,e,void 0,n))}function In(t){return(g?tn(t,2,void 0,void 0,fe):fe(tn(t,2)))??Ze}function Fn(t,e){return tn(t,e,void 0,void 0,Qt)??0}function Mn(t,e,n){if(null!=n){if(\"number\"!=typeof n)throw D(\"int32\");if(!qt(n))throw D(\"int32\");n|=0}nn(t,e,n)}function Pn(t,e,n){nn(t,e,Zt(n))}function Cn(t,e,n){dn(t,e,pe(n),\"\")}function On(t,e,n){{qe(t);const o=t.v;let a=0|o[et];if(null==n)rn(o,a,e);else{var r=t=n===nt?7:0|n[et],i=un(t),s=i||Object.isFrozen(n);for(i||(t=0),s||(n=Wt(n),r=0,t=xn(t,a),s=!1),t|=5,t|=(4&t?512&t?512:1024&t?1024:0:void 0)??(g?1024:0),i=0;i<n.length;i++){const e=n[i],o=de(e);Object.is(e,o)||(s&&(n=Wt(n),r=0,t=xn(t,a),s=!1),n[i]=o)}t!==r&&(s&&(n=Wt(n),t=xn(t,a)),st(n,t)),rn(o,a,e,n)}}}function Nn(t,e,n){qe(t),on(t,e,ge,2,!0).push(de(n))}var Un=class{constructor(t,e,n){if(this.buffer=t,n&&!e)throw Error();this.g=e}};function Dn(t,e){if(\"string\"==typeof t)return new Un(L(t),e);if(Array.isArray(t))return new Un(new Uint8Array(t),e);if(t.constructor===Uint8Array)return new Un(t,!1);if(t.constructor===ArrayBuffer)return t=new Uint8Array(t),new Un(t,!1);if(t.constructor===P)return e=M(t)||new Uint8Array(0),new Un(e,!0,t);if(t instanceof Uint8Array)return t=t.constructor===Uint8Array?t:new Uint8Array(t.buffer,t.byteOffset,t.byteLength),new Un(t,!1);throw Error()}function Bn(t,e){let n,r=0,i=0,s=0;const o=t.h;let a=t.g;do{n=o[a++],r|=(127&n)<<s,s+=7}while(s<32&&128&n);if(s>32)for(i|=(127&n)>>4,s=3;s<32&&128&n;s+=7)n=o[a++],i|=(127&n)<<s;if(Wn(t,a),!(128&n))return e(r>>>0,i>>>0);throw Error()}function Gn(t){let e=0,n=t.g;const r=n+10,i=t.h;for(;n<r;){const r=i[n++];if(e|=r,0==(128&r))return Wn(t,n),!!(127&e)}throw Error()}function jn(t){const e=t.h;let n=t.g,r=e[n++],i=127&r;if(128&r&&(r=e[n++],i|=(127&r)<<7,128&r&&(r=e[n++],i|=(127&r)<<14,128&r&&(r=e[n++],i|=(127&r)<<21,128&r&&(r=e[n++],i|=r<<28,128&r&&128&e[n++]&&128&e[n++]&&128&e[n++]&&128&e[n++]&&128&e[n++])))))throw Error();return Wn(t,n),i}function Vn(t){return jn(t)>>>0}function Xn(t){var e=t.h;const n=t.g;var r=e[n],i=e[n+1];const s=e[n+2];return e=e[n+3],Wn(t,t.g+4),t=2*((i=(r<<0|i<<8|s<<16|e<<24)>>>0)>>31)+1,r=i>>>23&255,i&=8388607,255==r?i?NaN:t*(1/0):0==r?1401298464324817e-60*t*i:t*Math.pow(2,r-150)*(i+8388608)}function Hn(t){return jn(t)}function Wn(t,e){if(t.g=e,e>t.l)throw Error()}function zn(t,e){if(e<0)throw Error();const n=t.g;if((e=n+e)>t.l)throw Error();return t.g=e,n}function Kn(t,e){if(0==e)return F();var n=zn(t,e);return t.Y&&t.j?n=t.h.subarray(n,n+e):(t=t.h,n=n===(e=n+e)?new Uint8Array(0):Rt?t.slice(n,e):new Uint8Array(t.subarray(n,e))),0==n.length?F():new P(n,I)}var Yn=[];function qn(t,e,n,r){if(ir.length){const i=ir.pop();return i.o(r),i.g.init(t,e,n,r),i}return new rr(t,e,n,r)}function $n(t){t.g.clear(),t.l=-1,t.h=-1,ir.length<100&&ir.push(t)}function Jn(t){var e=t.g;if(e.g==e.l)return!1;t.m=t.g.g;var n=Vn(t.g);if(e=n>>>3,!((n&=7)>=0&&n<=5))throw Error();if(e<1)throw Error();return t.l=e,t.h=n,!0}function Zn(t){switch(t.h){case 0:0!=t.h?Zn(t):Gn(t.g);break;case 1:Wn(t=t.g,t.g+8);break;case 2:if(2!=t.h)Zn(t);else{var e=Vn(t.g);Wn(t=t.g,t.g+e)}break;case 5:Wn(t=t.g,t.g+4);break;case 3:for(e=t.l;;){if(!Jn(t))throw Error();if(4==t.h){if(t.l!=e)throw Error();break}Zn(t)}break;default:throw Error()}}function Qn(t,e,n){const r=t.g.l;var i=Vn(t.g);let s=(i=t.g.g+i)-r;if(s<=0&&(t.g.l=i,n(e,t,void 0,void 0,void 0),s=i-t.g.g),s)throw Error();return t.g.g=i,t.g.l=r,e}function tr(t){var e=Vn(t.g),a=zn(t=t.g,e);if(t=t.h,o){var c,h=t;(c=s)||(c=s=new TextDecoder(\"utf-8\",{fatal:!0})),e=a+e,h=0===a&&e===h.length?h:h.subarray(a,e);try{var u=c.decode(h)}catch(t){if(void 0===i){try{c.decode(new Uint8Array([128]))}catch(t){}try{c.decode(new Uint8Array([97])),i=!0}catch(t){i=!1}}throw!i&&(s=void 0),t}}else{e=(u=a)+e,a=[];let i,s=null;for(;u<e;){var l=t[u++];l<128?a.push(l):l<224?u>=e?n():(i=t[u++],l<194||128!=(192&i)?(u--,n()):a.push((31&l)<<6|63&i)):l<240?u>=e-1?n():(i=t[u++],128!=(192&i)||224===l&&i<160||237===l&&i>=160||128!=(192&(c=t[u++]))?(u--,n()):a.push((15&l)<<12|(63&i)<<6|63&c)):l<=244?u>=e-2?n():(i=t[u++],128!=(192&i)||i-144+(l<<28)>>30!=0||128!=(192&(c=t[u++]))||128!=(192&(h=t[u++]))?(u--,n()):(l=(7&l)<<18|(63&i)<<12|(63&c)<<6|63&h,l-=65536,a.push(55296+(l>>10&1023),56320+(1023&l)))):n(),a.length>=8192&&(s=r(s,a),a.length=0)}u=r(s,a)}return u}function er(t){const e=Vn(t.g);return Kn(t.g,e)}function nr(t,e,n){var r=Vn(t.g);for(r=t.g.g+r;t.g.g<r;)n.push(e(t.g))}var rr=class{constructor(t,e,n,r){if(Yn.length){const i=Yn.pop();i.init(t,e,n,r),t=i}else t=new class{constructor(t,e,n,r){this.h=null,this.j=!1,this.g=this.l=this.m=0,this.init(t,e,n,r)}init(t,e,n,{Y:r=!1,ea:i=!1}={}){this.Y=r,this.ea=i,t&&(t=Dn(t,this.ea),this.h=t.buffer,this.j=t.g,this.m=e||0,this.l=void 0!==n?this.m+n:this.h.length,this.g=this.m)}clear(){this.h=null,this.j=!1,this.g=this.l=this.m=0,this.Y=!1}}(t,e,n,r);this.g=t,this.m=this.g.g,this.h=this.l=-1,this.o(r)}o({ha:t=!1}={}){this.ha=t}},ir=[];function sr(t){return t?/^\\d+$/.test(t)?(Xt(t),new or(Ft,Mt)):null:ar||=new or(0,0)}var or=class{constructor(t,e){this.h=t>>>0,this.g=e>>>0}};let ar;function cr(t){return t?/^-?\\d+$/.test(t)?(Xt(t),new hr(Ft,Mt)):null:ur||=new hr(0,0)}var hr=class{constructor(t,e){this.h=t>>>0,this.g=e>>>0}};let ur;function lr(t,e,n){for(;n>0||e>127;)t.g.push(127&e|128),e=(e>>>7|n<<25)>>>0,n>>>=7;t.g.push(e)}function fr(t,e){for(;e>127;)t.g.push(127&e|128),e>>>=7;t.g.push(e)}function dr(t,e){if(e>=0)fr(t,e);else{for(let n=0;n<9;n++)t.g.push(127&e|128),e>>=7;t.g.push(1)}}function pr(t){var e=Ft;t.g.push(e>>>0&255),t.g.push(e>>>8&255),t.g.push(e>>>16&255),t.g.push(e>>>24&255)}function gr(t,e){0!==e.length&&(t.l.push(e),t.h+=e.length)}function mr(t,e,n){fr(t.g,8*e+n)}function yr(t,e){return mr(t,e,2),e=t.g.end(),gr(t,e),e.push(t.h),e}function _r(t,e){var n=e.pop();for(n=t.h+t.g.length()-n;n>127;)e.push(127&n|128),n>>>=7,t.h++;e.push(n),t.h++}function vr(t,e,n){mr(t,e,2),fr(t.g,n.length),gr(t,t.g.end()),gr(t,n)}function Er(t,e,n,r){null!=n&&(e=yr(t,e),r(n,t),_r(t,e))}function wr(){const t=class{constructor(){throw Error()}};return Object.setPrototypeOf(t,t.prototype),t}var Tr=wr(),Ar=wr(),br=wr(),kr=wr(),Sr=wr(),xr=wr(),Lr=wr(),Rr=wr(),Ir=wr(),Fr=wr();function Mr(t,e,n){var r=t.v;z&&z in r&&(r=r[z])&&delete r[e.g],e.h?e.j(t,e.h,e.g,n,e.l):e.j(t,e.g,n,e.l)}var Pr=class{constructor(t,e){this.v=je(t,e,void 0,2048)}toJSON(){return Ue(this)}j(){var t=Fo,e=this.v,n=t.g,r=z;if(j&&r&&null!=e[r]?.[n]&&B(K,3),e=t.g,Z&&z&&void 0===Z&&(r=(n=this.v)[z])&&(r=r.da))try{r(n,e,Me)}catch(t){u(t)}return t.h?t.m(this,t.h,t.g,t.l):t.m(this,t.g,t.defaultValue,t.l)}clone(){const t=this.v,e=0|t[et];return Je(this,t,e)?He(this,t,!0):new this.constructor(ze(t,e,!1))}};Pr.prototype[J]=ct,Pr.prototype.toString=function(){return this.v.toString()};var Cr=class{constructor(t,e,n){this.g=t,this.h=e,t=Tr,this.l=!!t&&n===t||!1}};function Or(t,e){return new Cr(t,e,Tr)}function Nr(t,e,n,r,i){Er(t,n,Yr(e,r),i)}const Ur=Or((function(t,e,n,r,i){return 2===t.h&&(Qn(t,vn(e,r,n),i),!0)}),Nr),Dr=Or((function(t,e,n,r,i){return 2===t.h&&(Qn(t,vn(e,r,n),i),!0)}),Nr);var Br=Symbol(),Gr=Symbol(),jr=Symbol(),Vr=Symbol(),Xr=Symbol();let Hr,Wr;function zr(t,e,n,r){var i=r[t];if(i)return i;(i={}).qa=r,i.T=function(t){switch(typeof t){case\"boolean\":return De||=[0,void 0,!0];case\"number\":return t>0?void 0:0===t?Be||=[0,void 0]:[-t,void 0];case\"string\":return[0,t];case\"object\":return t}}(r[0]);var s=r[1];let o=1;s&&s.constructor===Object&&(i.ba=s,\"function\"==typeof(s=r[++o])&&(i.ma=!0,Hr??=s,Wr??=r[o+1],s=r[o+=2]));const a={};for(;s&&Array.isArray(s)&&s.length&&\"number\"==typeof s[0]&&s[0]>0;){for(var c=0;c<s.length;c++)a[s[c]]=s;s=r[++o]}for(c=1;void 0!==s;){let t;\"number\"==typeof s&&(c+=s,s=r[++o]);var h=void 0;if(s instanceof Cr?t=s:(t=Ur,o--),t?.l){s=r[++o],h=r;var u=o;\"function\"==typeof s&&(s=s(),h[u]=s),h=s}for(u=c+1,\"number\"==typeof(s=r[++o])&&s<0&&(u-=s,s=r[++o]);c<u;c++){const r=a[c];h?n(i,c,t,h,r):e(i,c,t,r)}}return r[t]=i}function Kr(t){return Array.isArray(t)?t[0]instanceof Cr?t:[Dr,t]:[t,void 0]}function Yr(t,e){return t instanceof Pr?t.v:Array.isArray(t)?Ge(t,e):void 0}function qr(t,e,n,r){const i=n.g;t[e]=r?(t,e,n)=>i(t,e,n,r):i}function $r(t,e,n,r,i){const s=n.g;let o,a;t[e]=(t,e,n)=>s(t,e,n,a||=zr(Gr,qr,$r,r).T,o||=Jr(r),i)}function Jr(t){let e=t[jr];if(null!=e)return e;const n=zr(Gr,qr,$r,t);return e=n.ma?(t,e)=>Hr(t,e,n):(t,e)=>{for(;Jn(e)&&4!=e.h;){var r=e.l,i=n[r];if(null==i){var s=n.ba;s&&(s=s[r])&&(null!=(s=Qr(s))&&(i=n[r]=s))}if(null==i||!i(e,t,r)){if(i=(s=e).m,Zn(s),s.ha)var o=void 0;else o=s.g.g-i,s.g.g=i,o=Kn(s.g,o);i=void 0,s=t,o&&((i=s[z]??(s[z]=new Fe))[r]??(i[r]=[])).push(o)}}return(t=Re(t))&&(t.da=n.qa[Xr]),!0},t[jr]=e,t[Xr]=Zr.bind(t),e}function Zr(t,e,n,r){var i=this[Gr];const s=this[jr],o=Ge(void 0,i.T),a=Re(t);if(a){var c=!1,h=i.ba;if(h){if(i=(e,n,i)=>{if(0!==i.length)if(h[n])for(const t of i){e=qn(t);try{c=!0,s(o,e)}finally{$n(e)}}else r?.(t,n,i)},null==e)Ie(a,i);else if(null!=a){const t=a[e];t&&i(a,e,t)}if(c){let r=0|t[et];if(2&r&&2048&r&&!n?.Ka)throw Error();const i=mt(r),s=(e,s)=>{if(null!=en(t,e,i)){if(1===n?.Qa)return;throw Error()}null!=s&&(r=rn(t,r,e,s,i)),delete a[e]};null==e?pt(o,0|o[et],((t,e)=>{s(t,e)})):s(e,en(o,e,i))}}}}function Qr(t){const e=(t=Kr(t))[0].g;if(t=t[1]){const n=Jr(t),r=zr(Gr,qr,$r,t).T;return(t,i,s)=>e(t,i,s,r,n)}return e}function ti(t,e,n){t[e]=n.h}function ei(t,e,n,r){let i,s;const o=n.h;t[e]=(t,e,n)=>o(t,e,n,s||=zr(Br,ti,ei,r).T,i||=ni(r))}function ni(t){let e=t[Vr];if(!e){const n=zr(Br,ti,ei,t);e=(t,e)=>ri(t,e,n),t[Vr]=e}return e}function ri(t,e,n){pt(t,0|t[et],((t,r)=>{if(null!=r){var i=function(t,e){var n=t[e];if(n)return n;if((n=t.ba)&&(n=n[e])){var r=(n=Kr(n))[0].h;if(n=n[1]){const e=ni(n),i=zr(Br,ti,ei,n).T;n=t.ma?Wr(i,e):(t,n,s)=>r(t,n,s,i,e)}else n=r;return t[e]=n}}(n,t);i?i(e,r,t):t<500||B(q,3)}})),(t=Re(t))&&Ie(t,((t,n,r)=>{for(gr(e,e.g.end()),t=0;t<r.length;t++)gr(e,M(r[t])||new Uint8Array(0))}))}const ii=Tt(0);function si(t,e){if(Array.isArray(e)){var n=0|e[et];if(4&n)return e;for(var r=0,i=0;r<e.length;r++){const n=t(e[r]);null!=n&&(e[i++]=n)}return i<r&&(e.length=i),(t=-1537&(5|n))!==n&&st(e,t),2&t&&Object.freeze(e),e}}function oi(t,e,n){return new Cr(t,e,n)}function ai(t,e,n){return new Cr(t,e,n)}function ci(t,e,n){rn(t,0|t[et],e,n,mt(0|t[et]))}var hi=Or((function(t,e,n,r,i){if(2!==t.h)return!1;if(t=Wt(t=Qn(t,Ge([void 0,void 0],r),i)),i=mt(r=0|e[et]),2&r)throw Error();let s=en(e,n,i);if(s instanceof be)0!=(2&s.J)?(s=s.V(),s.push(t),rn(e,r,n,s,i)):s.Ma(t);else if(Array.isArray(s)){var o=0|s[et];8192&o||st(s,o|=8192),2&o&&(s=fn(s),rn(e,r,n,s,i)),s.push(t)}else rn(e,r,n,at([t]),i);return!0}),(function(t,e,n,r,i){if(e instanceof be)e.forEach(((e,s)=>{Er(t,n,Ge([s,e],r),i)}));else if(Array.isArray(e)){for(let s=0;s<e.length;s++){const o=e[s];Array.isArray(o)&&Er(t,n,Ge(o,r),i)}at(e)}}));function ui(t,e,n){null!=(e=Qt(e))&&(mr(t,n,5),t=t.g,Ot(e),pr(t))}function li(t,e,n){if(e=function(t){if(null==t)return t;const e=typeof t;if(\"bigint\"===e)return String(zt(64,t));if(re(t)){if(\"string\"===e)return ce(t);if(\"number\"===e)return ae(t)}}(e),null!=e){if(\"string\"==typeof e)cr(e);if(null!=e)switch(mr(t,n,0),typeof e){case\"number\":t=t.g,Ct(e),lr(t,Ft,Mt);break;case\"bigint\":n=BigInt.asUintN(64,e),n=new hr(Number(n&BigInt(4294967295)),Number(n>>BigInt(32))),lr(t.g,n.h,n.g);break;default:n=cr(e),lr(t.g,n.h,n.g)}}}function fi(t,e,n){null!=(e=ie(e))&&null!=e&&(mr(t,n,0),dr(t.g,e))}function di(t,e,n){null!=(e=ee(e))&&(mr(t,n,0),t.g.g.push(e?1:0))}function pi(t,e,n){null!=(e=ge(e))&&vr(t,n,h(e))}function gi(t,e,n,r,i){Er(t,n,Yr(e,r),i)}function mi(t,e,n){null!=(e=null==e||\"string\"==typeof e||e instanceof P?e:void 0)&&vr(t,n,Dn(e,!0).buffer)}function yi(t,e,n){return(5===t.h||2===t.h)&&(e=pn(e,0|e[et],n),2==t.h?nr(t,Xn,e):e.push(Xn(t.g)),!0)}var _i=oi((function(t,e,n){return 5===t.h&&(ci(e,n,Xn(t.g)),!0)}),ui,Rr),vi=ai(yi,(function(t,e,n){if(null!=(e=si(Qt,e)))for(let o=0;o<e.length;o++){var r=t,i=n,s=e[o];null!=s&&(mr(r,i,5),r=r.g,Ot(s),pr(r))}}),Rr),Ei=ai(yi,(function(t,e,n){if(null!=(e=si(Qt,e))&&e.length){mr(t,n,2),fr(t.g,4*e.length);for(let r=0;r<e.length;r++)n=t.g,Ot(e[r]),pr(n)}}),Rr),wi=oi((function(t,e,n){return 5===t.h&&(ci(e,n,0===(t=Xn(t.g))?void 0:t),!0)}),ui,Rr),Ti=oi((function(t,e,n){return p?(0!==t.h?t=!1:(ci(e,n,Bn(t.g,Bt)),t=!0),t):0===t.h&&(ci(e,n,Bn(t.g,Dt)),!0)}),li,xr),Ai=oi((function(t,e,n){return p?(0!==t.h?e=!1:(ci(e,n,(t=Bn(t.g,Bt))===ii?void 0:t),e=!0),e):0===t.h&&(ci(e,n,0===(t=Bn(t.g,Dt))?void 0:t),!0)}),li,xr),bi=oi((function(t,e,n){return p?(0!==t.h?t=!1:(ci(e,n,Bn(t.g,Ut)),t=!0),t):0===t.h&&(ci(e,n,Bn(t.g,Nt)),!0)}),(function(t,e,n){if(e=function(t){if(null==t)return t;var e=typeof t;if(\"bigint\"===e)return String(Kt(64,t));if(re(t)){if(\"string\"===e)return e=$t(Number(t)),Yt(e)&&e>=0?t=String(e):(-1!==(e=t.indexOf(\".\"))&&(t=t.substring(0,e)),(e=\"-\"!==t[0]&&((e=t.length)<20||20===e&&t<=\"18446744073709551615\"))||(Xt(t),t=Gt(Ft,Mt))),t;if(\"number\"===e)return(t=$t(t))>=0&&Yt(t)||(Ct(t),t=Nt(Ft,Mt)),t}}(e),null!=e){if(\"string\"==typeof e)sr(e);if(null!=e)switch(mr(t,n,0),typeof e){case\"number\":t=t.g,Ct(e),lr(t,Ft,Mt);break;case\"bigint\":n=BigInt.asUintN(64,e),n=new or(Number(n&BigInt(4294967295)),Number(n>>BigInt(32))),lr(t.g,n.h,n.g);break;default:n=sr(e),lr(t.g,n.h,n.g)}}}),Lr),ki=oi((function(t,e,n){return 0===t.h&&(ci(e,n,jn(t.g)),!0)}),fi,kr),Si=ai((function(t,e,n){return(0===t.h||2===t.h)&&(e=pn(e,0|e[et],n),2==t.h?nr(t,jn,e):e.push(jn(t.g)),!0)}),(function(t,e,n){if(null!=(e=si(ie,e))&&e.length){n=yr(t,n);for(let n=0;n<e.length;n++)dr(t.g,e[n]);_r(t,n)}}),kr),xi=oi((function(t,e,n){return 0===t.h&&(ci(e,n,0===(t=jn(t.g))?void 0:t),!0)}),fi,kr),Li=oi((function(t,e,n){return 0===t.h&&(ci(e,n,Gn(t.g)),!0)}),di,Ar),Ri=oi((function(t,e,n){return 0===t.h&&(ci(e,n,!1===(t=Gn(t.g))?void 0:t),!0)}),di,Ar),Ii=ai((function(t,e,n){return 2===t.h&&(t=tr(t),pn(e,0|e[et],n).push(t),!0)}),(function(t,e,n){if(null!=(e=si(ge,e)))for(let o=0;o<e.length;o++){var r=t,i=n,s=e[o];null!=s&&vr(r,i,h(s))}}),br),Fi=oi((function(t,e,n){return 2===t.h&&(ci(e,n,\"\"===(t=tr(t))?void 0:t),!0)}),pi,br),Mi=oi((function(t,e,n){return 2===t.h&&(ci(e,n,tr(t)),!0)}),pi,br),Pi=function(t,e,n=Tr){return new Cr(t,e,n)}((function(t,e,n,r,i){return 2===t.h&&(r=Ge(void 0,r),pn(e,0|e[et],n).push(r),Qn(t,r,i),!0)}),(function(t,e,n,r,i){if(Array.isArray(e)){for(let s=0;s<e.length;s++)gi(t,e[s],n,r,i);1&(t=0|e[et])||st(e,1|t)}})),Ci=Or((function(t,e,n,r,i,s){if(2!==t.h)return!1;let o=0|e[et];return yn(e,o,s,n,mt(o)),Qn(t,e=vn(e,r,n),i),!0}),gi),Oi=oi((function(t,e,n){return 2===t.h&&(ci(e,n,er(t)),!0)}),mi,Ir),Ni=ai((function(t,e,n){return(0===t.h||2===t.h)&&(e=pn(e,0|e[et],n),2==t.h?nr(t,Vn,e):e.push(Vn(t.g)),!0)}),(function(t,e,n){if(null!=(e=si(se,e)))for(let o=0;o<e.length;o++){var r=t,i=n,s=e[o];null!=s&&(mr(r,i,0),fr(r.g,s))}}),Sr),Ui=oi((function(t,e,n){return 0===t.h&&(ci(e,n,0===(t=Vn(t.g))?void 0:t),!0)}),(function(t,e,n){null!=(e=se(e))&&null!=e&&(mr(t,n,0),fr(t.g,e))}),Sr),Di=oi((function(t,e,n){return 0===t.h&&(ci(e,n,jn(t.g)),!0)}),(function(t,e,n){null!=(e=ie(e))&&(e=parseInt(e,10),mr(t,n,0),dr(t.g,e))}),Fr);class Bi{constructor(t,e){var n=rs;this.g=t,this.h=e,this.m=wn,this.j=kn,this.defaultValue=void 0,this.l=null!=n.Oa?gt:void 0}register(){_(this)}}function Gi(t,e){return new Bi(t,e)}function ji(t,e){return(n,r)=>{{const s={ea:!0};r&&Object.assign(s,r),n=qn(n,void 0,void 0,s);try{const r=new t,s=r.v;Jr(e)(s,n);var i=r}finally{$n(n)}}return i}}function Vi(t){return function(){const e=new class{constructor(){this.l=[],this.h=0,this.g=new class{constructor(){this.g=[]}length(){return this.g.length}end(){const t=this.g;return this.g=[],t}}}};ri(this.v,e,zr(Br,ti,ei,t)),gr(e,e.g.end());const n=new Uint8Array(e.h),r=e.l,i=r.length;let s=0;for(let t=0;t<i;t++){const e=r[t];n.set(e,s),s+=e.length}return e.l=[n],n}}var Xi=class extends Pr{constructor(t){super(t)}},Hi=[0,Fi,oi((function(t,e,n){return 2===t.h&&(ci(e,n,(t=er(t))===F()?void 0:t),!0)}),(function(t,e,n){if(null!=e){if(e instanceof Pr){const r=e.Ra;return void(r?(e=r(e),null!=e&&vr(t,n,Dn(e,!0).buffer)):B(q,3))}if(Array.isArray(e))return void B(q,3)}mi(t,e,n)}),Ir)];let Wi,zi=globalThis.trustedTypes;function Ki(t){var e;return void 0===Wi&&(Wi=function(){let t=null;if(!zi)return t;try{const e=t=>t;t=zi.createPolicy(\"goog#html\",{createHTML:e,createScript:e,createScriptURL:e})}catch(t){}return t}()),t=(e=Wi)?e.createScriptURL(t):t,new class{constructor(t){this.g=t}toString(){return this.g+\"\"}}(t)}function Yi(t,...e){if(0===e.length)return Ki(t[0]);let n=t[0];for(let r=0;r<e.length;r++)n+=encodeURIComponent(e[r])+t[r+1];return Ki(n)}var qi=[0,ki,Di,Li,-1,Si,Di,-1,Li],$i=class extends Pr{constructor(t){super(t)}},Ji=[0,Li,Mi,Li,Di,-1,ai((function(t,e,n){return(0===t.h||2===t.h)&&(e=pn(e,0|e[et],n),2==t.h?nr(t,Hn,e):e.push(jn(t.g)),!0)}),(function(t,e,n){if(null!=(e=si(ie,e))&&e.length){n=yr(t,n);for(let n=0;n<e.length;n++)dr(t.g,e[n]);_r(t,n)}}),Fr),Mi,-1,[0,Li,-1],Di,Li,-1],Zi=[0,3,Li,-1,2,[0,ki],[0,Di,Li],[0,Mi,-1],[0]],Qi=[0,Mi,-2],ts=class extends Pr{constructor(t){super(t)}},es=[0],ns=[0,ki,Li,1,Li,-4],rs=class extends Pr{constructor(t){super(t,2)}},is={};is[336783863]=[0,Mi,Li,-1,ki,[0,[1,2,3,4,5,6,7,8,9],Ci,es,Ci,Ji,Ci,Qi,Ci,ns,Ci,qi,Ci,[0,Mi,-2],Ci,[0,Mi,Di],Ci,Zi,Ci,[0,Di,-1,Li]],[0,Mi],Li,[0,[1,3],[2,4],Ci,[0,Si],-1,Ci,[0,Ii],-1,Pi,[0,Mi,-1]],Mi];var ss=[0,Ai,-1,Ri,-3,Ai,Si,Fi,xi,Ai,-1,Ri,xi,Ri,-2,Fi];function os(t,e){Nn(t,3,e)}function as(t,e){Nn(t,4,e)}var cs=class extends Pr{constructor(t){super(t,500)}o(t){return kn(this,0,7,t)}},hs=[-1,{}],us=[0,Mi,1,hs],ls=[0,Mi,Ii,hs];function fs(t,e){Ln(t,1,cs,e)}function ds(t,e){Nn(t,10,e)}function ps(t,e){Nn(t,15,e)}var gs=class extends Pr{constructor(t){super(t,500)}o(t){return kn(this,0,1001,t)}},ms=[-500,Pi,[-500,Fi,-1,Ii,-3,[-2,is,Li],Pi,Hi,xi,-1,us,ls,Pi,[0,Fi,Ri],Fi,ss,xi,Ii,987,Ii],4,Pi,[-500,Mi,-1,[-1,{}],998,Mi],Pi,[-500,Mi,Ii,-1,[-2,{},Li],997,Ii,-1],xi,Pi,[-500,Mi,Ii,hs,998,Ii],Ii,xi,us,ls,Pi,[0,Fi,-1,hs],Ii,-2,ss,Fi,-1,Ri,[0,Ri,Ui],978,hs,Pi,Hi];gs.prototype.g=Vi(ms);var ys=ji(gs,ms),_s=class extends Pr{constructor(t){super(t)}},vs=class extends Pr{constructor(t){super(t)}g(){return An(this,_s,1)}},Es=[0,Pi,[0,ki,_i,Mi,-1]],ws=ji(vs,Es),Ts=class extends Pr{constructor(t){super(t)}},As=class extends Pr{constructor(t){super(t)}},bs=class extends Pr{constructor(t){super(t)}l(){return wn(this,Ts,2)}g(){return An(this,As,5)}},ks=ji(class extends Pr{constructor(t){super(t)}},[0,Ii,Si,Ei,[0,Di,[0,ki,-3],[0,_i,-3],[0,ki,-1,[0,Pi,[0,ki,-2]]],Pi,[0,_i,-1,Mi,_i]],Mi,-1,Ti,Pi,[0,ki,_i],Ii,Ti]),Ss=class extends Pr{constructor(t){super(t)}},xs=ji(class extends Pr{constructor(t){super(t)}},[0,Pi,[0,_i,-4]]),Ls=class extends Pr{constructor(t){super(t)}},Rs=ji(class extends Pr{constructor(t){super(t)}},[0,Pi,[0,_i,-4]]),Is=class extends Pr{constructor(t){super(t)}},Fs=[0,ki,-1,Ei,Di],Ms=class extends Pr{constructor(t){super(t)}};Ms.prototype.g=Vi([0,_i,-4,Ti]);var Ps=class extends Pr{constructor(t){super(t)}},Cs=ji(class extends Pr{constructor(t){super(t)}},[0,Pi,[0,1,ki,Mi,Es],Ti]),Os=class extends Pr{constructor(t){super(t)}},Ns=class extends Pr{constructor(t){super(t)}na(){const t=tn(this,1,void 0,void 0,ln);return null==t?F():t}},Us=class extends Pr{constructor(t){super(t)}},Ds=[1,2],Bs=ji(class extends Pr{constructor(t){super(t)}},[0,Pi,[0,Ds,Ci,[0,Ei],Ci,[0,Oi],ki,Mi],Ti]),Gs=class extends Pr{constructor(t){super(t)}},js=[0,Mi,ki,_i,Ii,-1],Vs=class extends Pr{constructor(t){super(t)}},Xs=[0,Li,-1],Hs=class extends Pr{constructor(t){super(t)}},Ws=[1,2,3,4,5,6],zs=class extends Pr{constructor(t){super(t)}g(){return null!=tn(this,1,void 0,void 0,ln)}l(){return null!=ge(tn(this,2))}},Ks=class extends Pr{constructor(t){super(t)}g(){return ee(tn(this,2))??!1}},Ys=[0,Oi,Mi,[0,ki,Ti,-1],[0,bi,Ti]],qs=[0,Ys,Li,[0,Ws,Ci,ns,Ci,Ji,Ci,qi,Ci,es,Ci,Qi,Ci,Zi],Di],$s=class extends Pr{constructor(t){super(t)}},Js=[0,qs,_i,-1,ki],Zs=Gi(502141897,$s);is[502141897]=Js;var Qs=ji(class extends Pr{constructor(t){super(t)}},[0,[0,Di,-1,vi,Ni],Fs]),to=class extends Pr{constructor(t){super(t)}},eo=class extends Pr{constructor(t){super(t)}},no=[0,qs,_i,[0,qs],Li],ro=Gi(508968150,eo);is[508968150]=[0,qs,Js,no,_i,[0,[0,Ys]]],is[508968149]=no;var io=class extends Pr{constructor(t){super(t)}l(){return wn(this,Gs,2)}g(){nn(this,2)}},so=[0,qs,js];is[478825465]=so;var oo=class extends Pr{constructor(t){super(t)}},ao=class extends Pr{constructor(t){super(t)}},co=class extends Pr{constructor(t){super(t)}},ho=class extends Pr{constructor(t){super(t)}},uo=class extends Pr{constructor(t){super(t)}},lo=[0,qs,[0,qs],so,-1],fo=[0,qs,_i,ki],po=[0,qs,_i],go=[0,qs,fo,po,_i],mo=Gi(479097054,uo);is[479097054]=[0,qs,go,lo],is[463370452]=lo,is[464864288]=fo;var yo=Gi(462713202,ho);is[462713202]=go,is[474472470]=po;var _o=class extends Pr{constructor(t){super(t)}},vo=class extends Pr{constructor(t){super(t)}},Eo=class extends Pr{constructor(t){super(t)}},wo=class extends Pr{constructor(t){super(t)}},To=[0,qs,_i,-1,ki],Ao=[0,qs,_i,Li];wo.prototype.g=Vi([0,qs,po,[0,qs],Js,no,To,Ao]);var bo=class extends Pr{constructor(t){super(t)}},ko=Gi(456383383,bo);is[456383383]=[0,qs,js];var So=class extends Pr{constructor(t){super(t)}},xo=Gi(476348187,So);is[476348187]=[0,qs,Xs];var Lo=class extends Pr{constructor(t){super(t)}},Ro=class extends Pr{constructor(t){super(t)}},Io=[0,Di,-1],Fo=Gi(458105876,class extends Pr{constructor(t){super(t)}g(){let t;var e=this.v;const n=0|e[et];return t=ht(this,n),e=function(t,e,n,r){var i=Ro;!r&&Ye(t)&&(n=0|(e=t.v)[et]);var s=en(e,2);if(t=!1,null==s){if(r)return Le();s=[]}else if(s.constructor===be){if(!(2&s.J)||r)return s;s=s.V()}else Array.isArray(s)?t=!!(2&(0|s[et])):s=[];if(r){if(!s.length)return Le();t||(t=!0,ot(s))}else t&&(t=!1,at(s),s=fn(s));return!t&&32&n&&it(s,32),n=rn(e,n,2,r=new be(s,i,ye,void 0)),t||$e(e,n),r}(this,e,n,t),!t&&Ro&&(e.ra=!0),e}});is[458105876]=[0,Io,hi,[!0,Ti,[0,Mi,-1,Ii]],[0,Si,Li,Di]];var Mo=class extends Pr{constructor(t){super(t)}},Po=Gi(458105758,Mo);is[458105758]=[0,qs,Mi,Io];var Co=class extends Pr{constructor(t){super(t)}},Oo=[0,wi,-1,Ri],No=class extends Pr{constructor(t){super(t)}},Uo=class extends Pr{constructor(t){super(t)}},Do=[1,2];Uo.prototype.g=Vi([0,Do,Ci,Oo,Ci,[0,Pi,Oo]]);var Bo=class extends Pr{constructor(t){super(t)}},Go=Gi(443442058,Bo);is[443442058]=[0,qs,Mi,ki,_i,Ii,-1,Li,_i],is[514774813]=To;var jo=class extends Pr{constructor(t){super(t)}},Vo=Gi(516587230,jo);function Xo(t,e){return e=e?e.clone():new Gs,void 0!==t.displayNamesLocale?nn(e,1,pe(t.displayNamesLocale)):void 0===t.displayNamesLocale&&nn(e,1),void 0!==t.maxResults?Mn(e,2,t.maxResults):\"maxResults\"in t&&nn(e,2),void 0!==t.scoreThreshold?Pn(e,3,t.scoreThreshold):\"scoreThreshold\"in t&&nn(e,3),void 0!==t.categoryAllowlist?On(e,4,t.categoryAllowlist):\"categoryAllowlist\"in t&&nn(e,4),void 0!==t.categoryDenylist?On(e,5,t.categoryDenylist):\"categoryDenylist\"in t&&nn(e,5),e}function Ho(t){const e=Number(t);return Number.isSafeInteger(e)?e:String(t)}function Wo(t,e=-1,n=\"\"){return{categories:t.map((t=>({index:Rn(t,1)??0??-1,score:Fn(t,2)??0,categoryName:ge(tn(t,3))??\"\"??\"\",displayName:ge(tn(t,4))??\"\"??\"\"}))),headIndex:e,headName:n}}function zo(t){const e={classifications:An(t,Ps,1).map((t=>Wo(wn(t,vs,4)?.g()??[],Rn(t,2)??0,ge(tn(t,3))??\"\")))};return null!=function(t){return le(g?tn(t,2,void 0,void 0,fe):tn(t,2))}(t)&&(e.timestampMs=Ho(In(t))),e}function Ko(t){var e=on(t,3,Qt,sn()),n=on(t,2,ie,sn()),r=on(t,1,ge,sn()),i=on(t,9,ge,sn());const s={categories:[],keypoints:[]};for(let t=0;t<e.length;t++)s.categories.push({score:e[t],index:n[t]??-1,categoryName:r[t]??\"\",displayName:i[t]??\"\"});if((e=wn(t,bs,4)?.l())&&(s.boundingBox={originX:Rn(e,1,Qe)??0,originY:Rn(e,2,Qe)??0,width:Rn(e,3,Qe)??0,height:Rn(e,4,Qe)??0,angle:0}),wn(t,bs,4)?.g().length)for(const e of wn(t,bs,4).g())s.keypoints.push({x:tn(e,1,void 0,Qe,Qt)??0,y:tn(e,2,void 0,Qe,Qt)??0,score:tn(e,4,void 0,Qe,Qt)??0,label:ge(tn(e,3,void 0,Qe))??\"\"});return s}function Yo(t){const e=[];for(const n of An(t,Ls,1))e.push({x:Fn(n,1)??0,y:Fn(n,2)??0,z:Fn(n,3)??0,visibility:Fn(n,4)??0});return e}function qo(t){const e=[];for(const n of An(t,Ss,1))e.push({x:Fn(n,1)??0,y:Fn(n,2)??0,z:Fn(n,3)??0,visibility:Fn(n,4)??0});return e}function $o(t){return Array.from(t,(t=>t>127?t-256:t))}function Jo(t,e){if(t.length!==e.length)throw Error(`Cannot compute cosine similarity between embeddings of different sizes (${t.length} vs. ${e.length}).`);let n=0,r=0,i=0;for(let s=0;s<t.length;s++)n+=t[s]*e[s],r+=t[s]*t[s],i+=e[s]*e[s];if(r<=0||i<=0)throw Error(\"Cannot compute cosine similarity on embedding with 0 norm.\");return n/Math.sqrt(r*i)}let Zo;is[516587230]=[0,qs,To,Ao,_i],is[518928384]=Ao;const Qo=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]);async function ta(){if(void 0===Zo)try{await WebAssembly.instantiate(Qo),Zo=!0}catch{Zo=!1}return Zo}async function ea(t,e=Yi``){const n=await ta()?\"wasm_internal\":\"wasm_nosimd_internal\";return{wasmLoaderPath:`${e}/${t}_${n}.js`,wasmBinaryPath:`${e}/${t}_${n}.wasm`}}var na=class{};function ra(){var t=navigator;return\"undefined\"!=typeof OffscreenCanvas&&(!function(t=navigator){return(t=t.userAgent).includes(\"Safari\")&&!t.includes(\"Chrome\")}(t)||!!((t=t.userAgent.match(/Version\\/([\\d]+).*Safari/))&&t.length>=1&&Number(t[1])>=17))}async function ia(t){if(\"function\"!=typeof importScripts){const e=document.createElement(\"script\");return e.src=t.toString(),e.crossOrigin=\"anonymous\",new Promise(((t,n)=>{e.addEventListener(\"load\",(()=>{t()}),!1),e.addEventListener(\"error\",(t=>{n(t)}),!1),document.body.appendChild(e)}))}try{importScripts(t.toString())}catch(e){if(!(e instanceof TypeError))throw e;await self.import(t.toString())}}function sa(t){return void 0!==t.videoWidth?[t.videoWidth,t.videoHeight]:void 0!==t.naturalWidth?[t.naturalWidth,t.naturalHeight]:void 0!==t.displayWidth?[t.displayWidth,t.displayHeight]:[t.width,t.height]}function oa(t,e,n){t.m||console.error(\"No wasm multistream support detected: ensure dependency inclusion of :gl_graph_runner_internal_multi_input target\"),n(e=t.i.stringToNewUTF8(e)),t.i._free(e)}function aa(t,e,n){if(!t.i.canvas)throw Error(\"No OpenGL canvas configured.\");if(n?t.i._bindTextureToStream(n):t.i._bindTextureToCanvas(),!(n=t.i.canvas.getContext(\"webgl2\")||t.i.canvas.getContext(\"webgl\")))throw Error(\"Failed to obtain WebGL context from the provided canvas. `getContext()` should only be invoked with `webgl` or `webgl2`.\");t.i.gpuOriginForWebTexturesIsBottomLeft&&n.pixelStorei(n.UNPACK_FLIP_Y_WEBGL,!0),n.texImage2D(n.TEXTURE_2D,0,n.RGBA,n.RGBA,n.UNSIGNED_BYTE,e),t.i.gpuOriginForWebTexturesIsBottomLeft&&n.pixelStorei(n.UNPACK_FLIP_Y_WEBGL,!1);const[r,i]=sa(e);return!t.l||r===t.i.canvas.width&&i===t.i.canvas.height||(t.i.canvas.width=r,t.i.canvas.height=i),[r,i]}function ca(t,e,n){t.m||console.error(\"No wasm multistream support detected: ensure dependency inclusion of :gl_graph_runner_internal_multi_input target\");const r=new Uint32Array(e.length);for(let n=0;n<e.length;n++)r[n]=t.i.stringToNewUTF8(e[n]);e=t.i._malloc(4*r.length),t.i.HEAPU32.set(r,e>>2),n(e);for(const e of r)t.i._free(e);t.i._free(e)}function ha(t,e,n){t.i.simpleListeners=t.i.simpleListeners||{},t.i.simpleListeners[e]=n}function ua(t,e,n){let r=[];t.i.simpleListeners=t.i.simpleListeners||{},t.i.simpleListeners[e]=(t,e,i)=>{e?(n(r,i),r=[]):r.push(t)}}na.forVisionTasks=function(t){return ea(\"vision\",t)},na.forTextTasks=function(t){return ea(\"text\",t)},na.forGenAiExperimentalTasks=function(t){return ea(\"genai_experimental\",t)},na.forGenAiTasks=function(t){return ea(\"genai\",t)},na.forAudioTasks=function(t){return ea(\"audio\",t)},na.isSimdSupported=function(){return ta()};async function la(t,e,n,r){return t=await(async(t,e,n,r,i)=>{if(e&&await ia(e),!self.ModuleFactory)throw Error(\"ModuleFactory not set.\");if(n&&(await ia(n),!self.ModuleFactory))throw Error(\"ModuleFactory not set.\");return self.Module&&i&&((e=self.Module).locateFile=i.locateFile,i.mainScriptUrlOrBlob&&(e.mainScriptUrlOrBlob=i.mainScriptUrlOrBlob)),i=await self.ModuleFactory(self.Module||i),self.ModuleFactory=self.Module=void 0,new t(i,r)})(t,n.wasmLoaderPath,n.assetLoaderPath,e,{locateFile:t=>t.endsWith(\".wasm\")?n.wasmBinaryPath.toString():n.assetBinaryPath&&t.endsWith(\".data\")?n.assetBinaryPath.toString():t}),await t.o(r),t}function fa(t,e){const n=wn(t.baseOptions,zs,1)||new zs;\"string\"==typeof e?(nn(n,2,pe(e)),nn(n,1)):e instanceof Uint8Array&&(nn(n,1,lt(e,!1)),nn(n,2)),kn(t.baseOptions,0,1,n)}function da(t){try{const e=t.H.length;if(1===e)throw Error(t.H[0].message);if(e>1)throw Error(\"Encountered multiple errors: \"+t.H.map((t=>t.message)).join(\", \"))}finally{t.H=[]}}function pa(t,e){t.C=Math.max(t.C,e)}function ga(t,e){t.B=new cs,Cn(t.B,2,\"PassThroughCalculator\"),os(t.B,\"free_memory\"),as(t.B,\"free_memory_unused_out\"),ds(e,\"free_memory\"),fs(e,t.B)}function ma(t,e){os(t.B,e),as(t.B,e+\"_unused_out\")}function ya(t){t.g.addBoolToStream(!0,\"free_memory\",t.C)}var _a=class{constructor(t){this.g=t,this.H=[],this.C=0,this.g.setAutoRenderToScreen(!1)}l(t,e=!0){if(e){const e=t.baseOptions||{};if(t.baseOptions?.modelAssetBuffer&&t.baseOptions?.modelAssetPath)throw Error(\"Cannot set both baseOptions.modelAssetPath and baseOptions.modelAssetBuffer\");if(!(wn(this.baseOptions,zs,1)?.g()||wn(this.baseOptions,zs,1)?.l()||t.baseOptions?.modelAssetBuffer||t.baseOptions?.modelAssetPath))throw Error(\"Either baseOptions.modelAssetPath or baseOptions.modelAssetBuffer must be set\");if(function(t,e){let n=wn(t.baseOptions,Hs,3);if(!n){var r=n=new Hs,i=new ts;Sn(r,4,Ws,i)}\"delegate\"in e&&(\"GPU\"===e.delegate?(e=n,r=new $i,Sn(e,2,Ws,r)):(e=n,r=new ts,Sn(e,4,Ws,r))),kn(t.baseOptions,0,3,n)}(this,e),e.modelAssetPath)return fetch(e.modelAssetPath.toString()).then((t=>{if(t.ok)return t.arrayBuffer();throw Error(`Failed to fetch model: ${e.modelAssetPath} (${t.status})`)})).then((t=>{try{this.g.i.FS_unlink(\"/model.dat\")}catch{}this.g.i.FS_createDataFile(\"/\",\"model.dat\",new Uint8Array(t),!0,!1,!1),fa(this,\"/model.dat\"),this.m(),this.L()}));if(e.modelAssetBuffer instanceof Uint8Array)fa(this,e.modelAssetBuffer);else if(e.modelAssetBuffer)return async function(t){const e=[];for(var n=0;;){const{done:r,value:i}=await t.read();if(r)break;e.push(i),n+=i.length}if(0===e.length)return new Uint8Array(0);if(1===e.length)return e[0];t=new Uint8Array(n),n=0;for(const r of e)t.set(r,n),n+=r.length;return t}(e.modelAssetBuffer).then((t=>{fa(this,t),this.m(),this.L()}))}return this.m(),this.L(),Promise.resolve()}L(){}ca(){let t;if(this.g.ca((e=>{t=ys(e)})),!t)throw Error(\"Failed to retrieve CalculatorGraphConfig\");return t}setGraph(t,e){this.g.attachErrorListener(((t,e)=>{this.H.push(Error(e))})),this.g.Ja(),this.g.setGraph(t,e),this.B=void 0,da(this)}finishProcessing(){this.g.finishProcessing(),da(this)}close(){this.B=void 0,this.g.closeGraph()}};function va(t,e){if(!t)throw Error(`Unable to obtain required WebGL resource: ${e}`);return t}_a.prototype.close=_a.prototype.close;class Ea{constructor(t,e,n,r){this.g=t,this.h=e,this.m=n,this.l=r}bind(){this.g.bindVertexArray(this.h)}close(){this.g.deleteVertexArray(this.h),this.g.deleteBuffer(this.m),this.g.deleteBuffer(this.l)}}function wa(t,e,n){const r=t.g;if(n=va(r.createShader(n),\"Failed to create WebGL shader\"),r.shaderSource(n,e),r.compileShader(n),!r.getShaderParameter(n,r.COMPILE_STATUS))throw Error(`Could not compile WebGL shader: ${r.getShaderInfoLog(n)}`);return r.attachShader(t.h,n),n}function Ta(t,e){const n=t.g,r=va(n.createVertexArray(),\"Failed to create vertex array\");n.bindVertexArray(r);const i=va(n.createBuffer(),\"Failed to create buffer\");n.bindBuffer(n.ARRAY_BUFFER,i),n.enableVertexAttribArray(t.O),n.vertexAttribPointer(t.O,2,n.FLOAT,!1,0,0),n.bufferData(n.ARRAY_BUFFER,new Float32Array([-1,-1,-1,1,1,1,1,-1]),n.STATIC_DRAW);const s=va(n.createBuffer(),\"Failed to create buffer\");return n.bindBuffer(n.ARRAY_BUFFER,s),n.enableVertexAttribArray(t.L),n.vertexAttribPointer(t.L,2,n.FLOAT,!1,0,0),n.bufferData(n.ARRAY_BUFFER,new Float32Array(e?[0,1,0,0,1,0,1,1]:[0,0,0,1,1,1,1,0]),n.STATIC_DRAW),n.bindBuffer(n.ARRAY_BUFFER,null),n.bindVertexArray(null),new Ea(n,r,i,s)}function Aa(t,e){if(t.g){if(e!==t.g)throw Error(\"Cannot change GL context once initialized\")}else t.g=e}function ba(t,e,n,r){return Aa(t,e),t.h||(t.m(),t.D()),n?(t.u||(t.u=Ta(t,!0)),n=t.u):(t.A||(t.A=Ta(t,!1)),n=t.A),e.useProgram(t.h),n.bind(),t.l(),t=r(),n.g.bindVertexArray(null),t}function ka(t,e,n){return Aa(t,e),t=va(e.createTexture(),\"Failed to create texture\"),e.bindTexture(e.TEXTURE_2D,t),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,n??e.LINEAR),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,n??e.LINEAR),e.bindTexture(e.TEXTURE_2D,null),t}function Sa(t,e,n){Aa(t,e),t.B||(t.B=va(e.createFramebuffer(),\"Failed to create framebuffe.\")),e.bindFramebuffer(e.FRAMEBUFFER,t.B),e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,n,0)}function xa(t){t.g?.bindFramebuffer(t.g.FRAMEBUFFER,null)}var La=class{H(){return\"\\n precision mediump float;\\n varying vec2 vTex;\\n uniform sampler2D inputTexture;\\n void main() {\\n gl_FragColor = texture2D(inputTexture, vTex);\\n }\\n \"}m(){const t=this.g;if(this.h=va(t.createProgram(),\"Failed to create WebGL program\"),this.X=wa(this,\"\\n attribute vec2 aVertex;\\n attribute vec2 aTex;\\n varying vec2 vTex;\\n void main(void) {\\n gl_Position = vec4(aVertex, 0.0, 1.0);\\n vTex = aTex;\\n }\",t.VERTEX_SHADER),this.W=wa(this,this.H(),t.FRAGMENT_SHADER),t.linkProgram(this.h),!t.getProgramParameter(this.h,t.LINK_STATUS))throw Error(`Error during program linking: ${t.getProgramInfoLog(this.h)}`);this.O=t.getAttribLocation(this.h,\"aVertex\"),this.L=t.getAttribLocation(this.h,\"aTex\")}D(){}l(){}close(){if(this.h){const t=this.g;t.deleteProgram(this.h),t.deleteShader(this.X),t.deleteShader(this.W)}this.B&&this.g.deleteFramebuffer(this.B),this.A&&this.A.close(),this.u&&this.u.close()}};var Ra=class extends La{H(){return\"\\n precision mediump float;\\n uniform sampler2D backgroundTexture;\\n uniform sampler2D maskTexture;\\n uniform sampler2D colorMappingTexture;\\n varying vec2 vTex;\\n void main() {\\n vec4 backgroundColor = texture2D(backgroundTexture, vTex);\\n float category = texture2D(maskTexture, vTex).r;\\n vec4 categoryColor = texture2D(colorMappingTexture, vec2(category, 0.0));\\n gl_FragColor = mix(backgroundColor, categoryColor, categoryColor.a);\\n }\\n \"}D(){const t=this.g;t.activeTexture(t.TEXTURE1),this.C=ka(this,t,t.LINEAR),t.activeTexture(t.TEXTURE2),this.j=ka(this,t,t.NEAREST)}m(){super.m();const t=this.g;this.P=va(t.getUniformLocation(this.h,\"backgroundTexture\"),\"Uniform location\"),this.U=va(t.getUniformLocation(this.h,\"colorMappingTexture\"),\"Uniform location\"),this.M=va(t.getUniformLocation(this.h,\"maskTexture\"),\"Uniform location\")}l(){super.l();const t=this.g;t.uniform1i(this.M,0),t.uniform1i(this.P,1),t.uniform1i(this.U,2)}close(){this.C&&this.g.deleteTexture(this.C),this.j&&this.g.deleteTexture(this.j),super.close()}},Ia=class extends La{H(){return\"\\n precision mediump float;\\n uniform sampler2D maskTexture;\\n uniform sampler2D defaultTexture;\\n uniform sampler2D overlayTexture;\\n varying vec2 vTex;\\n void main() {\\n float confidence = texture2D(maskTexture, vTex).r;\\n vec4 defaultColor = texture2D(defaultTexture, vTex);\\n vec4 overlayColor = texture2D(overlayTexture, vTex);\\n // Apply the alpha from the overlay and merge in the default color\\n overlayColor = mix(defaultColor, overlayColor, overlayColor.a);\\n gl_FragColor = mix(defaultColor, overlayColor, confidence);\\n }\\n \"}D(){const t=this.g;t.activeTexture(t.TEXTURE1),this.j=ka(this,t),t.activeTexture(t.TEXTURE2),this.C=ka(this,t)}m(){super.m();const t=this.g;this.M=va(t.getUniformLocation(this.h,\"defaultTexture\"),\"Uniform location\"),this.P=va(t.getUniformLocation(this.h,\"overlayTexture\"),\"Uniform location\"),this.I=va(t.getUniformLocation(this.h,\"maskTexture\"),\"Uniform location\")}l(){super.l();const t=this.g;t.uniform1i(this.I,0),t.uniform1i(this.M,1),t.uniform1i(this.P,2)}close(){this.j&&this.g.deleteTexture(this.j),this.C&&this.g.deleteTexture(this.C),super.close()}};function Fa(t,e){switch(e){case 0:return t.g.find((t=>t instanceof Uint8Array));case 1:return t.g.find((t=>t instanceof Float32Array));case 2:return t.g.find((t=>\"undefined\"!=typeof WebGLTexture&&t instanceof WebGLTexture));default:throw Error(`Type is not supported: ${e}`)}}function Ma(t){var e=Fa(t,1);if(!e){if(e=Fa(t,0))e=new Float32Array(e).map((t=>t/255));else{e=new Float32Array(t.width*t.height);const r=Ca(t);var n=Na(t);if(Sa(n,r,Pa(t)),\"iPad Simulator;iPhone Simulator;iPod Simulator;iPad;iPhone;iPod\".split(\";\").includes(navigator.platform)||navigator.userAgent.includes(\"Mac\")&&\"document\"in self&&\"ontouchend\"in self.document){n=new Float32Array(t.width*t.height*4),r.readPixels(0,0,t.width,t.height,r.RGBA,r.FLOAT,n);for(let t=0,r=0;t<e.length;++t,r+=4)e[t]=n[r]}else r.readPixels(0,0,t.width,t.height,r.RED,r.FLOAT,e)}t.g.push(e)}return e}function Pa(t){let e=Fa(t,2);if(!e){const n=Ca(t);e=Ua(t);const r=Ma(t),i=Oa(t);n.texImage2D(n.TEXTURE_2D,0,i,t.width,t.height,0,n.RED,n.FLOAT,r),Da(t)}return e}function Ca(t){if(!t.canvas)throw Error(\"Conversion to different image formats require that a canvas is passed when initializing the image.\");return t.h||(t.h=va(t.canvas.getContext(\"webgl2\"),\"You cannot use a canvas that is already bound to a different type of rendering context.\")),t.h}function Oa(t){if(t=Ca(t),!Ba)if(t.getExtension(\"EXT_color_buffer_float\")&&t.getExtension(\"OES_texture_float_linear\")&&t.getExtension(\"EXT_float_blend\"))Ba=t.R32F;else{if(!t.getExtension(\"EXT_color_buffer_half_float\"))throw Error(\"GPU does not fully support 4-channel float32 or float16 formats\");Ba=t.R16F}return Ba}function Na(t){return t.l||(t.l=new La),t.l}function Ua(t){const e=Ca(t);e.viewport(0,0,t.width,t.height),e.activeTexture(e.TEXTURE0);let n=Fa(t,2);return n||(n=ka(Na(t),e,t.m?e.LINEAR:e.NEAREST),t.g.push(n),t.j=!0),e.bindTexture(e.TEXTURE_2D,n),n}function Da(t){t.h.bindTexture(t.h.TEXTURE_2D,null)}var Ba,Ga=class{constructor(t,e,n,r,i,s,o){this.g=t,this.m=e,this.j=n,this.canvas=r,this.l=i,this.width=s,this.height=o,this.j&&(0===--ja&&console.error(\"You seem to be creating MPMask instances without invoking .close(). This leaks resources.\"))}Fa(){return!!Fa(this,0)}ka(){return!!Fa(this,1)}R(){return!!Fa(this,2)}ja(){return(e=Fa(t=this,0))||(e=Ma(t),e=new Uint8Array(e.map((t=>Math.round(255*t)))),t.g.push(e)),e;var t,e}ia(){return Ma(this)}N(){return Pa(this)}clone(){const t=[];for(const e of this.g){let n;if(e instanceof Uint8Array)n=new Uint8Array(e);else if(e instanceof Float32Array)n=new Float32Array(e);else{if(!(e instanceof WebGLTexture))throw Error(`Type is not supported: ${e}`);{const t=Ca(this),e=Na(this);t.activeTexture(t.TEXTURE1),n=ka(e,t,this.m?t.LINEAR:t.NEAREST),t.bindTexture(t.TEXTURE_2D,n);const r=Oa(this);t.texImage2D(t.TEXTURE_2D,0,r,this.width,this.height,0,t.RED,t.FLOAT,null),t.bindTexture(t.TEXTURE_2D,null),Sa(e,t,n),ba(e,t,!1,(()=>{Ua(this),t.clearColor(0,0,0,0),t.clear(t.COLOR_BUFFER_BIT),t.drawArrays(t.TRIANGLE_FAN,0,4),Da(this)})),xa(e),Da(this)}}t.push(n)}return new Ga(t,this.m,this.R(),this.canvas,this.l,this.width,this.height)}close(){this.j&&Ca(this).deleteTexture(Fa(this,2)),ja=-1}};Ga.prototype.close=Ga.prototype.close,Ga.prototype.clone=Ga.prototype.clone,Ga.prototype.getAsWebGLTexture=Ga.prototype.N,Ga.prototype.getAsFloat32Array=Ga.prototype.ia,Ga.prototype.getAsUint8Array=Ga.prototype.ja,Ga.prototype.hasWebGLTexture=Ga.prototype.R,Ga.prototype.hasFloat32Array=Ga.prototype.ka,Ga.prototype.hasUint8Array=Ga.prototype.Fa;var ja=250;const Va={color:\"white\",lineWidth:4,radius:6};function Xa(t){return{...Va,fillColor:(t=t||{}).color,...t}}function Ha(t,e){return t instanceof Function?t(e):t}function Wa(t,e,n){return Math.max(Math.min(e,n),Math.min(Math.max(e,n),t))}function za(t){if(!t.l)throw Error(\"CPU rendering requested but CanvasRenderingContext2D not provided.\");return t.l}function Ka(t){if(!t.j)throw Error(\"GPU rendering requested but WebGL2RenderingContext not provided.\");return t.j}function Ya(t,e,n){if(e.R())n(e.N());else{const r=e.ka()?e.ia():e.ja();t.m=t.m??new La;const i=Ka(t);n((t=new Ga([r],e.m,!1,i.canvas,t.m,e.width,e.height)).N()),t.close()}}function qa(t,e,n,r){const i=function(t){return t.g||(t.g=new Ra),t.g}(t),s=Ka(t),o=Array.isArray(n)?new ImageData(new Uint8ClampedArray(n),1,1):n;ba(i,s,!0,(()=>{!function(t,e,n,r){const i=t.g;if(i.activeTexture(i.TEXTURE0),i.bindTexture(i.TEXTURE_2D,e),i.activeTexture(i.TEXTURE1),i.bindTexture(i.TEXTURE_2D,t.C),i.texImage2D(i.TEXTURE_2D,0,i.RGBA,i.RGBA,i.UNSIGNED_BYTE,n),t.I&&function(t,e){if(t!==e)return!1;t=t.entries(),e=e.entries();for(const[r,i]of t){t=r;const s=i;var n=e.next();if(n.done)return!1;const[o,a]=n.value;if(n=a,t!==o||s[0]!==n[0]||s[1]!==n[1]||s[2]!==n[2]||s[3]!==n[3])return!1}return!!e.next().done}(t.I,r))i.activeTexture(i.TEXTURE2),i.bindTexture(i.TEXTURE_2D,t.j);else{t.I=r;const e=Array(1024).fill(0);r.forEach(((t,n)=>{if(4!==t.length)throw Error(`Color at index ${n} is not a four-channel value.`);e[4*n]=t[0],e[4*n+1]=t[1],e[4*n+2]=t[2],e[4*n+3]=t[3]})),i.activeTexture(i.TEXTURE2),i.bindTexture(i.TEXTURE_2D,t.j),i.texImage2D(i.TEXTURE_2D,0,i.RGBA,256,1,0,i.RGBA,i.UNSIGNED_BYTE,new Uint8Array(e))}}(i,e,o,r),s.clearColor(0,0,0,0),s.clear(s.COLOR_BUFFER_BIT),s.drawArrays(s.TRIANGLE_FAN,0,4);const t=i.g;t.activeTexture(t.TEXTURE0),t.bindTexture(t.TEXTURE_2D,null),t.activeTexture(t.TEXTURE1),t.bindTexture(t.TEXTURE_2D,null),t.activeTexture(t.TEXTURE2),t.bindTexture(t.TEXTURE_2D,null)}))}function $a(t,e,n,r){const i=Ka(t),s=function(t){return t.h||(t.h=new Ia),t.h}(t),o=Array.isArray(n)?new ImageData(new Uint8ClampedArray(n),1,1):n,a=Array.isArray(r)?new ImageData(new Uint8ClampedArray(r),1,1):r;ba(s,i,!0,(()=>{var t=s.g;t.activeTexture(t.TEXTURE0),t.bindTexture(t.TEXTURE_2D,e),t.activeTexture(t.TEXTURE1),t.bindTexture(t.TEXTURE_2D,s.j),t.texImage2D(t.TEXTURE_2D,0,t.RGBA,t.RGBA,t.UNSIGNED_BYTE,o),t.activeTexture(t.TEXTURE2),t.bindTexture(t.TEXTURE_2D,s.C),t.texImage2D(t.TEXTURE_2D,0,t.RGBA,t.RGBA,t.UNSIGNED_BYTE,a),i.clearColor(0,0,0,0),i.clear(i.COLOR_BUFFER_BIT),i.drawArrays(i.TRIANGLE_FAN,0,4),i.bindTexture(i.TEXTURE_2D,null),(t=s.g).activeTexture(t.TEXTURE0),t.bindTexture(t.TEXTURE_2D,null),t.activeTexture(t.TEXTURE1),t.bindTexture(t.TEXTURE_2D,null),t.activeTexture(t.TEXTURE2),t.bindTexture(t.TEXTURE_2D,null)}))}var Ja=class{constructor(t,e){\"undefined\"!=typeof CanvasRenderingContext2D&&t instanceof CanvasRenderingContext2D||t instanceof OffscreenCanvasRenderingContext2D?(this.l=t,this.j=e):this.j=t}ya(t,e){if(t){var n=za(this);e=Xa(e),n.save();var r=n.canvas,i=0;for(const s of t)n.fillStyle=Ha(e.fillColor,{index:i,from:s}),n.strokeStyle=Ha(e.color,{index:i,from:s}),n.lineWidth=Ha(e.lineWidth,{index:i,from:s}),(t=new Path2D).arc(s.x*r.width,s.y*r.height,Ha(e.radius,{index:i,from:s}),0,2*Math.PI),n.fill(t),n.stroke(t),++i;n.restore()}}xa(t,e,n){if(t&&e){var r=za(this);n=Xa(n),r.save();var i=r.canvas,s=0;for(const o of e){r.beginPath(),e=t[o.start];const a=t[o.end];e&&a&&(r.strokeStyle=Ha(n.color,{index:s,from:e,to:a}),r.lineWidth=Ha(n.lineWidth,{index:s,from:e,to:a}),r.moveTo(e.x*i.width,e.y*i.height),r.lineTo(a.x*i.width,a.y*i.height)),++s,r.stroke()}r.restore()}}ua(t,e){const n=za(this);e=Xa(e),n.save(),n.beginPath(),n.lineWidth=Ha(e.lineWidth,{}),n.strokeStyle=Ha(e.color,{}),n.fillStyle=Ha(e.fillColor,{}),n.moveTo(t.originX,t.originY),n.lineTo(t.originX+t.width,t.originY),n.lineTo(t.originX+t.width,t.originY+t.height),n.lineTo(t.originX,t.originY+t.height),n.lineTo(t.originX,t.originY),n.stroke(),n.fill(),n.restore()}va(t,e,n=[0,0,0,255]){this.l?function(t,e,n,r){const i=Ka(t);Ya(t,e,(e=>{qa(t,e,n,r),(e=za(t)).drawImage(i.canvas,0,0,e.canvas.width,e.canvas.height)}))}(this,t,n,e):qa(this,t.N(),n,e)}wa(t,e,n){this.l?function(t,e,n,r){const i=Ka(t);Ya(t,e,(e=>{$a(t,e,n,r),(e=za(t)).drawImage(i.canvas,0,0,e.canvas.width,e.canvas.height)}))}(this,t,e,n):$a(this,t.N(),e,n)}close(){this.g?.close(),this.g=void 0,this.h?.close(),this.h=void 0,this.m?.close(),this.m=void 0}};function Za(t,e){switch(e){case 0:return t.g.find((t=>t instanceof ImageData));case 1:return t.g.find((t=>\"undefined\"!=typeof ImageBitmap&&t instanceof ImageBitmap));case 2:return t.g.find((t=>\"undefined\"!=typeof WebGLTexture&&t instanceof WebGLTexture));default:throw Error(`Type is not supported: ${e}`)}}function Qa(t){var e=Za(t,0);if(!e){e=ec(t);const n=nc(t),r=new Uint8Array(t.width*t.height*4);Sa(n,e,tc(t)),e.readPixels(0,0,t.width,t.height,e.RGBA,e.UNSIGNED_BYTE,r),xa(n),e=new ImageData(new Uint8ClampedArray(r.buffer),t.width,t.height),t.g.push(e)}return e}function tc(t){let e=Za(t,2);if(!e){const n=ec(t);e=rc(t);const r=Za(t,1)||Qa(t);n.texImage2D(n.TEXTURE_2D,0,n.RGBA,n.RGBA,n.UNSIGNED_BYTE,r),ic(t)}return e}function ec(t){if(!t.canvas)throw Error(\"Conversion to different image formats require that a canvas is passed when initializing the image.\");return t.h||(t.h=va(t.canvas.getContext(\"webgl2\"),\"You cannot use a canvas that is already bound to a different type of rendering context.\")),t.h}function nc(t){return t.l||(t.l=new La),t.l}function rc(t){const e=ec(t);e.viewport(0,0,t.width,t.height),e.activeTexture(e.TEXTURE0);let n=Za(t,2);return n||(n=ka(nc(t),e),t.g.push(n),t.m=!0),e.bindTexture(e.TEXTURE_2D,n),n}function ic(t){t.h.bindTexture(t.h.TEXTURE_2D,null)}function sc(t){const e=ec(t);return ba(nc(t),e,!0,(()=>function(t,e){const n=t.canvas;if(n.width===t.width&&n.height===t.height)return e();const r=n.width,i=n.height;return n.width=t.width,n.height=t.height,t=e(),n.width=r,n.height=i,t}(t,(()=>{if(e.bindFramebuffer(e.FRAMEBUFFER,null),e.clearColor(0,0,0,0),e.clear(e.COLOR_BUFFER_BIT),e.drawArrays(e.TRIANGLE_FAN,0,4),!(t.canvas instanceof OffscreenCanvas))throw Error(\"Conversion to ImageBitmap requires that the MediaPipe Tasks is initialized with an OffscreenCanvas\");return t.canvas.transferToImageBitmap()}))))}Ja.prototype.close=Ja.prototype.close,Ja.prototype.drawConfidenceMask=Ja.prototype.wa,Ja.prototype.drawCategoryMask=Ja.prototype.va,Ja.prototype.drawBoundingBox=Ja.prototype.ua,Ja.prototype.drawConnectors=Ja.prototype.xa,Ja.prototype.drawLandmarks=Ja.prototype.ya,Ja.lerp=function(t,e,n,r,i){return Wa(r*(1-(t-e)/(n-e))+i*(1-(n-t)/(n-e)),r,i)},Ja.clamp=Wa;var oc=class{constructor(t,e,n,r,i,s,o){this.g=t,this.j=e,this.m=n,this.canvas=r,this.l=i,this.width=s,this.height=o,(this.j||this.m)&&(0===--ac&&console.error(\"You seem to be creating MPImage instances without invoking .close(). This leaks resources.\"))}Ea(){return!!Za(this,0)}la(){return!!Za(this,1)}R(){return!!Za(this,2)}Ca(){return Qa(this)}Ba(){var t=Za(this,1);return t||(tc(this),rc(this),t=sc(this),ic(this),this.g.push(t),this.j=!0),t}N(){return tc(this)}clone(){const t=[];for(const e of this.g){let n;if(e instanceof ImageData)n=new ImageData(e.data,this.width,this.height);else if(e instanceof WebGLTexture){const t=ec(this),e=nc(this);t.activeTexture(t.TEXTURE1),n=ka(e,t),t.bindTexture(t.TEXTURE_2D,n),t.texImage2D(t.TEXTURE_2D,0,t.RGBA,this.width,this.height,0,t.RGBA,t.UNSIGNED_BYTE,null),t.bindTexture(t.TEXTURE_2D,null),Sa(e,t,n),ba(e,t,!1,(()=>{rc(this),t.clearColor(0,0,0,0),t.clear(t.COLOR_BUFFER_BIT),t.drawArrays(t.TRIANGLE_FAN,0,4),ic(this)})),xa(e),ic(this)}else{if(!(e instanceof ImageBitmap))throw Error(`Type is not supported: ${e}`);tc(this),rc(this),n=sc(this),ic(this)}t.push(n)}return new oc(t,this.la(),this.R(),this.canvas,this.l,this.width,this.height)}close(){this.j&&Za(this,1).close(),this.m&&ec(this).deleteTexture(Za(this,2)),ac=-1}};oc.prototype.close=oc.prototype.close,oc.prototype.clone=oc.prototype.clone,oc.prototype.getAsWebGLTexture=oc.prototype.N,oc.prototype.getAsImageBitmap=oc.prototype.Ba,oc.prototype.getAsImageData=oc.prototype.Ca,oc.prototype.hasWebGLTexture=oc.prototype.R,oc.prototype.hasImageBitmap=oc.prototype.la,oc.prototype.hasImageData=oc.prototype.Ea;var ac=250;function cc(...t){return t.map((([t,e])=>({start:t,end:e})))}const hc=function(t){return class extends t{Ja(){this.i._registerModelResourcesGraphService()}}}((uc=class{constructor(t,e){this.l=!0,this.i=t,this.g=null,this.h=0,this.m=\"function\"==typeof this.i._addIntToInputStream,void 0!==e?this.i.canvas=e:ra()?this.i.canvas=new OffscreenCanvas(1,1):(console.warn(\"OffscreenCanvas not supported and GraphRunner constructor glCanvas parameter is undefined. Creating backup canvas.\"),this.i.canvas=document.createElement(\"canvas\"))}async initializeGraph(t){const e=await(await fetch(t)).arrayBuffer();t=!(t.endsWith(\".pbtxt\")||t.endsWith(\".textproto\")),this.setGraph(new Uint8Array(e),t)}setGraphFromString(t){this.setGraph((new TextEncoder).encode(t),!1)}setGraph(t,e){const n=t.length,r=this.i._malloc(n);this.i.HEAPU8.set(t,r),e?this.i._changeBinaryGraph(n,r):this.i._changeTextGraph(n,r),this.i._free(r)}configureAudio(t,e,n,r,i){this.i._configureAudio||console.warn('Attempting to use configureAudio without support for input audio. Is build dep \":gl_graph_runner_audio\" missing?'),oa(this,r||\"input_audio\",(r=>{oa(this,i=i||\"audio_header\",(i=>{this.i._configureAudio(r,i,t,e??0,n)}))}))}setAutoResizeCanvas(t){this.l=t}setAutoRenderToScreen(t){this.i._setAutoRenderToScreen(t)}setGpuBufferVerticalFlip(t){this.i.gpuOriginForWebTexturesIsBottomLeft=t}ca(t){ha(this,\"__graph_config__\",(e=>{t(e)})),oa(this,\"__graph_config__\",(t=>{this.i._getGraphConfig(t,void 0)})),delete this.i.simpleListeners.__graph_config__}attachErrorListener(t){this.i.errorListener=t}attachEmptyPacketListener(t,e){this.i.emptyPacketListeners=this.i.emptyPacketListeners||{},this.i.emptyPacketListeners[t]=e}addAudioToStream(t,e,n){this.addAudioToStreamWithShape(t,0,0,e,n)}addAudioToStreamWithShape(t,e,n,r,i){const s=4*t.length;this.h!==s&&(this.g&&this.i._free(this.g),this.g=this.i._malloc(s),this.h=s),this.i.HEAPF32.set(t,this.g/4),oa(this,r,(t=>{this.i._addAudioToInputStream(this.g,e,n,t,i)}))}addGpuBufferToStream(t,e,n){oa(this,e,(e=>{const[r,i]=aa(this,t,e);this.i._addBoundTextureToStream(e,r,i,n)}))}addBoolToStream(t,e,n){oa(this,e,(e=>{this.i._addBoolToInputStream(t,e,n)}))}addDoubleToStream(t,e,n){oa(this,e,(e=>{this.i._addDoubleToInputStream(t,e,n)}))}addFloatToStream(t,e,n){oa(this,e,(e=>{this.i._addFloatToInputStream(t,e,n)}))}addIntToStream(t,e,n){oa(this,e,(e=>{this.i._addIntToInputStream(t,e,n)}))}addUintToStream(t,e,n){oa(this,e,(e=>{this.i._addUintToInputStream(t,e,n)}))}addStringToStream(t,e,n){oa(this,e,(e=>{oa(this,t,(t=>{this.i._addStringToInputStream(t,e,n)}))}))}addStringRecordToStream(t,e,n){oa(this,e,(e=>{ca(this,Object.keys(t),(r=>{ca(this,Object.values(t),(i=>{this.i._addFlatHashMapToInputStream(r,i,Object.keys(t).length,e,n)}))}))}))}addProtoToStream(t,e,n,r){oa(this,n,(n=>{oa(this,e,(e=>{const i=this.i._malloc(t.length);this.i.HEAPU8.set(t,i),this.i._addProtoToInputStream(i,t.length,e,n,r),this.i._free(i)}))}))}addEmptyPacketToStream(t,e){oa(this,t,(t=>{this.i._addEmptyPacketToInputStream(t,e)}))}addBoolVectorToStream(t,e,n){oa(this,e,(e=>{const r=this.i._allocateBoolVector(t.length);if(!r)throw Error(\"Unable to allocate new bool vector on heap.\");for(const e of t)this.i._addBoolVectorEntry(r,e);this.i._addBoolVectorToInputStream(r,e,n)}))}addDoubleVectorToStream(t,e,n){oa(this,e,(e=>{const r=this.i._allocateDoubleVector(t.length);if(!r)throw Error(\"Unable to allocate new double vector on heap.\");for(const e of t)this.i._addDoubleVectorEntry(r,e);this.i._addDoubleVectorToInputStream(r,e,n)}))}addFloatVectorToStream(t,e,n){oa(this,e,(e=>{const r=this.i._allocateFloatVector(t.length);if(!r)throw Error(\"Unable to allocate new float vector on heap.\");for(const e of t)this.i._addFloatVectorEntry(r,e);this.i._addFloatVectorToInputStream(r,e,n)}))}addIntVectorToStream(t,e,n){oa(this,e,(e=>{const r=this.i._allocateIntVector(t.length);if(!r)throw Error(\"Unable to allocate new int vector on heap.\");for(const e of t)this.i._addIntVectorEntry(r,e);this.i._addIntVectorToInputStream(r,e,n)}))}addUintVectorToStream(t,e,n){oa(this,e,(e=>{const r=this.i._allocateUintVector(t.length);if(!r)throw Error(\"Unable to allocate new unsigned int vector on heap.\");for(const e of t)this.i._addUintVectorEntry(r,e);this.i._addUintVectorToInputStream(r,e,n)}))}addStringVectorToStream(t,e,n){oa(this,e,(e=>{const r=this.i._allocateStringVector(t.length);if(!r)throw Error(\"Unable to allocate new string vector on heap.\");for(const e of t)oa(this,e,(t=>{this.i._addStringVectorEntry(r,t)}));this.i._addStringVectorToInputStream(r,e,n)}))}addBoolToInputSidePacket(t,e){oa(this,e,(e=>{this.i._addBoolToInputSidePacket(t,e)}))}addDoubleToInputSidePacket(t,e){oa(this,e,(e=>{this.i._addDoubleToInputSidePacket(t,e)}))}addFloatToInputSidePacket(t,e){oa(this,e,(e=>{this.i._addFloatToInputSidePacket(t,e)}))}addIntToInputSidePacket(t,e){oa(this,e,(e=>{this.i._addIntToInputSidePacket(t,e)}))}addUintToInputSidePacket(t,e){oa(this,e,(e=>{this.i._addUintToInputSidePacket(t,e)}))}addStringToInputSidePacket(t,e){oa(this,e,(e=>{oa(this,t,(t=>{this.i._addStringToInputSidePacket(t,e)}))}))}addProtoToInputSidePacket(t,e,n){oa(this,n,(n=>{oa(this,e,(e=>{const r=this.i._malloc(t.length);this.i.HEAPU8.set(t,r),this.i._addProtoToInputSidePacket(r,t.length,e,n),this.i._free(r)}))}))}addBoolVectorToInputSidePacket(t,e){oa(this,e,(e=>{const n=this.i._allocateBoolVector(t.length);if(!n)throw Error(\"Unable to allocate new bool vector on heap.\");for(const e of t)this.i._addBoolVectorEntry(n,e);this.i._addBoolVectorToInputSidePacket(n,e)}))}addDoubleVectorToInputSidePacket(t,e){oa(this,e,(e=>{const n=this.i._allocateDoubleVector(t.length);if(!n)throw Error(\"Unable to allocate new double vector on heap.\");for(const e of t)this.i._addDoubleVectorEntry(n,e);this.i._addDoubleVectorToInputSidePacket(n,e)}))}addFloatVectorToInputSidePacket(t,e){oa(this,e,(e=>{const n=this.i._allocateFloatVector(t.length);if(!n)throw Error(\"Unable to allocate new float vector on heap.\");for(const e of t)this.i._addFloatVectorEntry(n,e);this.i._addFloatVectorToInputSidePacket(n,e)}))}addIntVectorToInputSidePacket(t,e){oa(this,e,(e=>{const n=this.i._allocateIntVector(t.length);if(!n)throw Error(\"Unable to allocate new int vector on heap.\");for(const e of t)this.i._addIntVectorEntry(n,e);this.i._addIntVectorToInputSidePacket(n,e)}))}addUintVectorToInputSidePacket(t,e){oa(this,e,(e=>{const n=this.i._allocateUintVector(t.length);if(!n)throw Error(\"Unable to allocate new unsigned int vector on heap.\");for(const e of t)this.i._addUintVectorEntry(n,e);this.i._addUintVectorToInputSidePacket(n,e)}))}addStringVectorToInputSidePacket(t,e){oa(this,e,(e=>{const n=this.i._allocateStringVector(t.length);if(!n)throw Error(\"Unable to allocate new string vector on heap.\");for(const e of t)oa(this,e,(t=>{this.i._addStringVectorEntry(n,t)}));this.i._addStringVectorToInputSidePacket(n,e)}))}attachBoolListener(t,e){ha(this,t,e),oa(this,t,(t=>{this.i._attachBoolListener(t)}))}attachBoolVectorListener(t,e){ua(this,t,e),oa(this,t,(t=>{this.i._attachBoolVectorListener(t)}))}attachIntListener(t,e){ha(this,t,e),oa(this,t,(t=>{this.i._attachIntListener(t)}))}attachIntVectorListener(t,e){ua(this,t,e),oa(this,t,(t=>{this.i._attachIntVectorListener(t)}))}attachUintListener(t,e){ha(this,t,e),oa(this,t,(t=>{this.i._attachUintListener(t)}))}attachUintVectorListener(t,e){ua(this,t,e),oa(this,t,(t=>{this.i._attachUintVectorListener(t)}))}attachDoubleListener(t,e){ha(this,t,e),oa(this,t,(t=>{this.i._attachDoubleListener(t)}))}attachDoubleVectorListener(t,e){ua(this,t,e),oa(this,t,(t=>{this.i._attachDoubleVectorListener(t)}))}attachFloatListener(t,e){ha(this,t,e),oa(this,t,(t=>{this.i._attachFloatListener(t)}))}attachFloatVectorListener(t,e){ua(this,t,e),oa(this,t,(t=>{this.i._attachFloatVectorListener(t)}))}attachStringListener(t,e){ha(this,t,e),oa(this,t,(t=>{this.i._attachStringListener(t)}))}attachStringVectorListener(t,e){ua(this,t,e),oa(this,t,(t=>{this.i._attachStringVectorListener(t)}))}attachProtoListener(t,e,n){ha(this,t,e),oa(this,t,(t=>{this.i._attachProtoListener(t,n||!1)}))}attachProtoVectorListener(t,e,n){ua(this,t,e),oa(this,t,(t=>{this.i._attachProtoVectorListener(t,n||!1)}))}attachAudioListener(t,e,n){this.i._attachAudioListener||console.warn('Attempting to use attachAudioListener without support for output audio. Is build dep \":gl_graph_runner_audio_out\" missing?'),ha(this,t,((t,n)=>{t=new Float32Array(t.buffer,t.byteOffset,t.length/4),e(t,n)})),oa(this,t,(t=>{this.i._attachAudioListener(t,n||!1)}))}finishProcessing(){this.i._waitUntilIdle()}closeGraph(){this.i._closeGraph(),this.i.simpleListeners=void 0,this.i.emptyPacketListeners=void 0}},class extends uc{get ga(){return this.i}pa(t,e,n){oa(this,e,(e=>{const[r,i]=aa(this,t,e);this.ga._addBoundTextureAsImageToStream(e,r,i,n)}))}Z(t,e){ha(this,t,e),oa(this,t,(t=>{this.ga._attachImageListener(t)}))}aa(t,e){ua(this,t,e),oa(this,t,(t=>{this.ga._attachImageVectorListener(t)}))}}));var uc,lc=class extends hc{};async function fc(t,e,n){return async function(t,e,n,r){return la(t,e,n,r)}(t,n.canvas??(ra()?void 0:document.createElement(\"canvas\")),e,n)}function dc(t,e,n,r){if(t.U){const s=new Ms;if(n?.regionOfInterest){if(!t.oa)throw Error(\"This task doesn't support region-of-interest.\");var i=n.regionOfInterest;if(i.left>=i.right||i.top>=i.bottom)throw Error(\"Expected RectF with left < right and top < bottom.\");if(i.left<0||i.top<0||i.right>1||i.bottom>1)throw Error(\"Expected RectF values to be in [0,1].\");Pn(s,1,(i.left+i.right)/2),Pn(s,2,(i.top+i.bottom)/2),Pn(s,4,i.right-i.left),Pn(s,3,i.bottom-i.top)}else Pn(s,1,.5),Pn(s,2,.5),Pn(s,4,1),Pn(s,3,1);if(n?.rotationDegrees){if(n?.rotationDegrees%90!=0)throw Error(\"Expected rotation to be a multiple of 90\u00B0.\");if(Pn(s,5,-Math.PI*n.rotationDegrees/180),n?.rotationDegrees%180!=0){const[t,r]=sa(e);n=Fn(s,3)*r/t,i=Fn(s,4)*t/r,Pn(s,4,n),Pn(s,3,i)}}t.g.addProtoToStream(s.g(),\"mediapipe.NormalizedRect\",t.U,r)}t.g.pa(e,t.X,r??performance.now()),t.finishProcessing()}function pc(t,e,n){if(t.baseOptions?.g())throw Error(\"Task is not initialized with image mode. 'runningMode' must be set to 'IMAGE'.\");dc(t,e,n,t.C+1)}function gc(t,e,n,r){if(!t.baseOptions?.g())throw Error(\"Task is not initialized with video mode. 'runningMode' must be set to 'VIDEO'.\");dc(t,e,n,r)}function mc(t,e,n,r){var i=e.data;const s=e.width,o=s*(e=e.height);if((i instanceof Uint8Array||i instanceof Float32Array)&&i.length!==o)throw Error(\"Unsupported channel count: \"+i.length/o);return t=new Ga([i],n,!1,t.g.i.canvas,t.P,s,e),r?t.clone():t}var yc=class extends _a{constructor(t,e,n,r){super(t),this.g=t,this.X=e,this.U=n,this.oa=r,this.P=new La}l(t,e=!0){if(\"runningMode\"in t&&nn(this.baseOptions,2,te(!!t.runningMode&&\"IMAGE\"!==t.runningMode)),void 0!==t.canvas&&this.g.i.canvas!==t.canvas)throw Error(\"You must create a new task to reset the canvas.\");return super.l(t,e)}close(){this.P.close(),super.close()}};yc.prototype.close=yc.prototype.close;var _c=class extends yc{constructor(t,e){super(new lc(t,e),\"image_in\",\"norm_rect_in\",!1),this.j={detections:[]},kn(t=this.h=new $s,0,1,e=new Ks),Pn(this.h,2,.5),Pn(this.h,3,.3)}get baseOptions(){return wn(this.h,Ks,1)}set baseOptions(t){kn(this.h,0,1,t)}o(t){return\"minDetectionConfidence\"in t&&Pn(this.h,2,t.minDetectionConfidence??.5),\"minSuppressionThreshold\"in t&&Pn(this.h,3,t.minSuppressionThreshold??.3),this.l(t)}F(t,e){return this.j={detections:[]},pc(this,t,e),this.j}G(t,e,n){return this.j={detections:[]},gc(this,t,n,e),this.j}m(){var t=new gs;ds(t,\"image_in\"),ds(t,\"norm_rect_in\"),ps(t,\"detections\");const e=new rs;Mr(e,Zs,this.h);const n=new cs;Cn(n,2,\"mediapipe.tasks.vision.face_detector.FaceDetectorGraph\"),os(n,\"IMAGE:image_in\"),os(n,\"NORM_RECT:norm_rect_in\"),as(n,\"DETECTIONS:detections\"),n.o(e),fs(t,n),this.g.attachProtoVectorListener(\"detections\",((t,e)=>{for(const e of t)t=ks(e),this.j.detections.push(Ko(t));pa(this,e)})),this.g.attachEmptyPacketListener(\"detections\",(t=>{pa(this,t)})),t=t.g(),this.setGraph(new Uint8Array(t),!0)}};_c.prototype.detectForVideo=_c.prototype.G,_c.prototype.detect=_c.prototype.F,_c.prototype.setOptions=_c.prototype.o,_c.createFromModelPath=async function(t,e){return fc(_c,t,{baseOptions:{modelAssetPath:e}})},_c.createFromModelBuffer=function(t,e){return fc(_c,t,{baseOptions:{modelAssetBuffer:e}})},_c.createFromOptions=function(t,e){return fc(_c,t,e)};var vc=cc([61,146],[146,91],[91,181],[181,84],[84,17],[17,314],[314,405],[405,321],[321,375],[375,291],[61,185],[185,40],[40,39],[39,37],[37,0],[0,267],[267,269],[269,270],[270,409],[409,291],[78,95],[95,88],[88,178],[178,87],[87,14],[14,317],[317,402],[402,318],[318,324],[324,308],[78,191],[191,80],[80,81],[81,82],[82,13],[13,312],[312,311],[311,310],[310,415],[415,308]),Ec=cc([263,249],[249,390],[390,373],[373,374],[374,380],[380,381],[381,382],[382,362],[263,466],[466,388],[388,387],[387,386],[386,385],[385,384],[384,398],[398,362]),wc=cc([276,283],[283,282],[282,295],[295,285],[300,293],[293,334],[334,296],[296,336]),Tc=cc([474,475],[475,476],[476,477],[477,474]),Ac=cc([33,7],[7,163],[163,144],[144,145],[145,153],[153,154],[154,155],[155,133],[33,246],[246,161],[161,160],[160,159],[159,158],[158,157],[157,173],[173,133]),bc=cc([46,53],[53,52],[52,65],[65,55],[70,63],[63,105],[105,66],[66,107]),kc=cc([469,470],[470,471],[471,472],[472,469]),Sc=cc([10,338],[338,297],[297,332],[332,284],[284,251],[251,389],[389,356],[356,454],[454,323],[323,361],[361,288],[288,397],[397,365],[365,379],[379,378],[378,400],[400,377],[377,152],[152,148],[148,176],[176,149],[149,150],[150,136],[136,172],[172,58],[58,132],[132,93],[93,234],[234,127],[127,162],[162,21],[21,54],[54,103],[103,67],[67,109],[109,10]),xc=[...vc,...Ec,...wc,...Ac,...bc,...Sc],Lc=cc([127,34],[34,139],[139,127],[11,0],[0,37],[37,11],[232,231],[231,120],[120,232],[72,37],[37,39],[39,72],[128,121],[121,47],[47,128],[232,121],[121,128],[128,232],[104,69],[69,67],[67,104],[175,171],[171,148],[148,175],[118,50],[50,101],[101,118],[73,39],[39,40],[40,73],[9,151],[151,108],[108,9],[48,115],[115,131],[131,48],[194,204],[204,211],[211,194],[74,40],[40,185],[185,74],[80,42],[42,183],[183,80],[40,92],[92,186],[186,40],[230,229],[229,118],[118,230],[202,212],[212,214],[214,202],[83,18],[18,17],[17,83],[76,61],[61,146],[146,76],[160,29],[29,30],[30,160],[56,157],[157,173],[173,56],[106,204],[204,194],[194,106],[135,214],[214,192],[192,135],[203,165],[165,98],[98,203],[21,71],[71,68],[68,21],[51,45],[45,4],[4,51],[144,24],[24,23],[23,144],[77,146],[146,91],[91,77],[205,50],[50,187],[187,205],[201,200],[200,18],[18,201],[91,106],[106,182],[182,91],[90,91],[91,181],[181,90],[85,84],[84,17],[17,85],[206,203],[203,36],[36,206],[148,171],[171,140],[140,148],[92,40],[40,39],[39,92],[193,189],[189,244],[244,193],[159,158],[158,28],[28,159],[247,246],[246,161],[161,247],[236,3],[3,196],[196,236],[54,68],[68,104],[104,54],[193,168],[168,8],[8,193],[117,228],[228,31],[31,117],[189,193],[193,55],[55,189],[98,97],[97,99],[99,98],[126,47],[47,100],[100,126],[166,79],[79,218],[218,166],[155,154],[154,26],[26,155],[209,49],[49,131],[131,209],[135,136],[136,150],[150,135],[47,126],[126,217],[217,47],[223,52],[52,53],[53,223],[45,51],[51,134],[134,45],[211,170],[170,140],[140,211],[67,69],[69,108],[108,67],[43,106],[106,91],[91,43],[230,119],[119,120],[120,230],[226,130],[130,247],[247,226],[63,53],[53,52],[52,63],[238,20],[20,242],[242,238],[46,70],[70,156],[156,46],[78,62],[62,96],[96,78],[46,53],[53,63],[63,46],[143,34],[34,227],[227,143],[123,117],[117,111],[111,123],[44,125],[125,19],[19,44],[236,134],[134,51],[51,236],[216,206],[206,205],[205,216],[154,153],[153,22],[22,154],[39,37],[37,167],[167,39],[200,201],[201,208],[208,200],[36,142],[142,100],[100,36],[57,212],[212,202],[202,57],[20,60],[60,99],[99,20],[28,158],[158,157],[157,28],[35,226],[226,113],[113,35],[160,159],[159,27],[27,160],[204,202],[202,210],[210,204],[113,225],[225,46],[46,113],[43,202],[202,204],[204,43],[62,76],[76,77],[77,62],[137,123],[123,116],[116,137],[41,38],[38,72],[72,41],[203,129],[129,142],[142,203],[64,98],[98,240],[240,64],[49,102],[102,64],[64,49],[41,73],[73,74],[74,41],[212,216],[216,207],[207,212],[42,74],[74,184],[184,42],[169,170],[170,211],[211,169],[170,149],[149,176],[176,170],[105,66],[66,69],[69,105],[122,6],[6,168],[168,122],[123,147],[147,187],[187,123],[96,77],[77,90],[90,96],[65,55],[55,107],[107,65],[89,90],[90,180],[180,89],[101,100],[100,120],[120,101],[63,105],[105,104],[104,63],[93,137],[137,227],[227,93],[15,86],[86,85],[85,15],[129,102],[102,49],[49,129],[14,87],[87,86],[86,14],[55,8],[8,9],[9,55],[100,47],[47,121],[121,100],[145,23],[23,22],[22,145],[88,89],[89,179],[179,88],[6,122],[122,196],[196,6],[88,95],[95,96],[96,88],[138,172],[172,136],[136,138],[215,58],[58,172],[172,215],[115,48],[48,219],[219,115],[42,80],[80,81],[81,42],[195,3],[3,51],[51,195],[43,146],[146,61],[61,43],[171,175],[175,199],[199,171],[81,82],[82,38],[38,81],[53,46],[46,225],[225,53],[144,163],[163,110],[110,144],[52,65],[65,66],[66,52],[229,228],[228,117],[117,229],[34,127],[127,234],[234,34],[107,108],[108,69],[69,107],[109,108],[108,151],[151,109],[48,64],[64,235],[235,48],[62,78],[78,191],[191,62],[129,209],[209,126],[126,129],[111,35],[35,143],[143,111],[117,123],[123,50],[50,117],[222,65],[65,52],[52,222],[19,125],[125,141],[141,19],[221,55],[55,65],[65,221],[3,195],[195,197],[197,3],[25,7],[7,33],[33,25],[220,237],[237,44],[44,220],[70,71],[71,139],[139,70],[122,193],[193,245],[245,122],[247,130],[130,33],[33,247],[71,21],[21,162],[162,71],[170,169],[169,150],[150,170],[188,174],[174,196],[196,188],[216,186],[186,92],[92,216],[2,97],[97,167],[167,2],[141,125],[125,241],[241,141],[164,167],[167,37],[37,164],[72,38],[38,12],[12,72],[38,82],[82,13],[13,38],[63,68],[68,71],[71,63],[226,35],[35,111],[111,226],[101,50],[50,205],[205,101],[206,92],[92,165],[165,206],[209,198],[198,217],[217,209],[165,167],[167,97],[97,165],[220,115],[115,218],[218,220],[133,112],[112,243],[243,133],[239,238],[238,241],[241,239],[214,135],[135,169],[169,214],[190,173],[173,133],[133,190],[171,208],[208,32],[32,171],[125,44],[44,237],[237,125],[86,87],[87,178],[178,86],[85,86],[86,179],[179,85],[84,85],[85,180],[180,84],[83,84],[84,181],[181,83],[201,83],[83,182],[182,201],[137,93],[93,132],[132,137],[76,62],[62,183],[183,76],[61,76],[76,184],[184,61],[57,61],[61,185],[185,57],[212,57],[57,186],[186,212],[214,207],[207,187],[187,214],[34,143],[143,156],[156,34],[79,239],[239,237],[237,79],[123,137],[137,177],[177,123],[44,1],[1,4],[4,44],[201,194],[194,32],[32,201],[64,102],[102,129],[129,64],[213,215],[215,138],[138,213],[59,166],[166,219],[219,59],[242,99],[99,97],[97,242],[2,94],[94,141],[141,2],[75,59],[59,235],[235,75],[24,110],[110,228],[228,24],[25,130],[130,226],[226,25],[23,24],[24,229],[229,23],[22,23],[23,230],[230,22],[26,22],[22,231],[231,26],[112,26],[26,232],[232,112],[189,190],[190,243],[243,189],[221,56],[56,190],[190,221],[28,56],[56,221],[221,28],[27,28],[28,222],[222,27],[29,27],[27,223],[223,29],[30,29],[29,224],[224,30],[247,30],[30,225],[225,247],[238,79],[79,20],[20,238],[166,59],[59,75],[75,166],[60,75],[75,240],[240,60],[147,177],[177,215],[215,147],[20,79],[79,166],[166,20],[187,147],[147,213],[213,187],[112,233],[233,244],[244,112],[233,128],[128,245],[245,233],[128,114],[114,188],[188,128],[114,217],[217,174],[174,114],[131,115],[115,220],[220,131],[217,198],[198,236],[236,217],[198,131],[131,134],[134,198],[177,132],[132,58],[58,177],[143,35],[35,124],[124,143],[110,163],[163,7],[7,110],[228,110],[110,25],[25,228],[356,389],[389,368],[368,356],[11,302],[302,267],[267,11],[452,350],[350,349],[349,452],[302,303],[303,269],[269,302],[357,343],[343,277],[277,357],[452,453],[453,357],[357,452],[333,332],[332,297],[297,333],[175,152],[152,377],[377,175],[347,348],[348,330],[330,347],[303,304],[304,270],[270,303],[9,336],[336,337],[337,9],[278,279],[279,360],[360,278],[418,262],[262,431],[431,418],[304,408],[408,409],[409,304],[310,415],[415,407],[407,310],[270,409],[409,410],[410,270],[450,348],[348,347],[347,450],[422,430],[430,434],[434,422],[313,314],[314,17],[17,313],[306,307],[307,375],[375,306],[387,388],[388,260],[260,387],[286,414],[414,398],[398,286],[335,406],[406,418],[418,335],[364,367],[367,416],[416,364],[423,358],[358,327],[327,423],[251,284],[284,298],[298,251],[281,5],[5,4],[4,281],[373,374],[374,253],[253,373],[307,320],[320,321],[321,307],[425,427],[427,411],[411,425],[421,313],[313,18],[18,421],[321,405],[405,406],[406,321],[320,404],[404,405],[405,320],[315,16],[16,17],[17,315],[426,425],[425,266],[266,426],[377,400],[400,369],[369,377],[322,391],[391,269],[269,322],[417,465],[465,464],[464,417],[386,257],[257,258],[258,386],[466,260],[260,388],[388,466],[456,399],[399,419],[419,456],[284,332],[332,333],[333,284],[417,285],[285,8],[8,417],[346,340],[340,261],[261,346],[413,441],[441,285],[285,413],[327,460],[460,328],[328,327],[355,371],[371,329],[329,355],[392,439],[439,438],[438,392],[382,341],[341,256],[256,382],[429,420],[420,360],[360,429],[364,394],[394,379],[379,364],[277,343],[343,437],[437,277],[443,444],[444,283],[283,443],[275,440],[440,363],[363,275],[431,262],[262,369],[369,431],[297,338],[338,337],[337,297],[273,375],[375,321],[321,273],[450,451],[451,349],[349,450],[446,342],[342,467],[467,446],[293,334],[334,282],[282,293],[458,461],[461,462],[462,458],[276,353],[353,383],[383,276],[308,324],[324,325],[325,308],[276,300],[300,293],[293,276],[372,345],[345,447],[447,372],[352,345],[345,340],[340,352],[274,1],[1,19],[19,274],[456,248],[248,281],[281,456],[436,427],[427,425],[425,436],[381,256],[256,252],[252,381],[269,391],[391,393],[393,269],[200,199],[199,428],[428,200],[266,330],[330,329],[329,266],[287,273],[273,422],[422,287],[250,462],[462,328],[328,250],[258,286],[286,384],[384,258],[265,353],[353,342],[342,265],[387,259],[259,257],[257,387],[424,431],[431,430],[430,424],[342,353],[353,276],[276,342],[273,335],[335,424],[424,273],[292,325],[325,307],[307,292],[366,447],[447,345],[345,366],[271,303],[303,302],[302,271],[423,266],[266,371],[371,423],[294,455],[455,460],[460,294],[279,278],[278,294],[294,279],[271,272],[272,304],[304,271],[432,434],[434,427],[427,432],[272,407],[407,408],[408,272],[394,430],[430,431],[431,394],[395,369],[369,400],[400,395],[334,333],[333,299],[299,334],[351,417],[417,168],[168,351],[352,280],[280,411],[411,352],[325,319],[319,320],[320,325],[295,296],[296,336],[336,295],[319,403],[403,404],[404,319],[330,348],[348,349],[349,330],[293,298],[298,333],[333,293],[323,454],[454,447],[447,323],[15,16],[16,315],[315,15],[358,429],[429,279],[279,358],[14,15],[15,316],[316,14],[285,336],[336,9],[9,285],[329,349],[349,350],[350,329],[374,380],[380,252],[252,374],[318,402],[402,403],[403,318],[6,197],[197,419],[419,6],[318,319],[319,325],[325,318],[367,364],[364,365],[365,367],[435,367],[367,397],[397,435],[344,438],[438,439],[439,344],[272,271],[271,311],[311,272],[195,5],[5,281],[281,195],[273,287],[287,291],[291,273],[396,428],[428,199],[199,396],[311,271],[271,268],[268,311],[283,444],[444,445],[445,283],[373,254],[254,339],[339,373],[282,334],[334,296],[296,282],[449,347],[347,346],[346,449],[264,447],[447,454],[454,264],[336,296],[296,299],[299,336],[338,10],[10,151],[151,338],[278,439],[439,455],[455,278],[292,407],[407,415],[415,292],[358,371],[371,355],[355,358],[340,345],[345,372],[372,340],[346,347],[347,280],[280,346],[442,443],[443,282],[282,442],[19,94],[94,370],[370,19],[441,442],[442,295],[295,441],[248,419],[419,197],[197,248],[263,255],[255,359],[359,263],[440,275],[275,274],[274,440],[300,383],[383,368],[368,300],[351,412],[412,465],[465,351],[263,467],[467,466],[466,263],[301,368],[368,389],[389,301],[395,378],[378,379],[379,395],[412,351],[351,419],[419,412],[436,426],[426,322],[322,436],[2,164],[164,393],[393,2],[370,462],[462,461],[461,370],[164,0],[0,267],[267,164],[302,11],[11,12],[12,302],[268,12],[12,13],[13,268],[293,300],[300,301],[301,293],[446,261],[261,340],[340,446],[330,266],[266,425],[425,330],[426,423],[423,391],[391,426],[429,355],[355,437],[437,429],[391,327],[327,326],[326,391],[440,457],[457,438],[438,440],[341,382],[382,362],[362,341],[459,457],[457,461],[461,459],[434,430],[430,394],[394,434],[414,463],[463,362],[362,414],[396,369],[369,262],[262,396],[354,461],[461,457],[457,354],[316,403],[403,402],[402,316],[315,404],[404,403],[403,315],[314,405],[405,404],[404,314],[313,406],[406,405],[405,313],[421,418],[418,406],[406,421],[366,401],[401,361],[361,366],[306,408],[408,407],[407,306],[291,409],[409,408],[408,291],[287,410],[410,409],[409,287],[432,436],[436,410],[410,432],[434,416],[416,411],[411,434],[264,368],[368,383],[383,264],[309,438],[438,457],[457,309],[352,376],[376,401],[401,352],[274,275],[275,4],[4,274],[421,428],[428,262],[262,421],[294,327],[327,358],[358,294],[433,416],[416,367],[367,433],[289,455],[455,439],[439,289],[462,370],[370,326],[326,462],[2,326],[326,370],[370,2],[305,460],[460,455],[455,305],[254,449],[449,448],[448,254],[255,261],[261,446],[446,255],[253,450],[450,449],[449,253],[252,451],[451,450],[450,252],[256,452],[452,451],[451,256],[341,453],[453,452],[452,341],[413,464],[464,463],[463,413],[441,413],[413,414],[414,441],[258,442],[442,441],[441,258],[257,443],[443,442],[442,257],[259,444],[444,443],[443,259],[260,445],[445,444],[444,260],[467,342],[342,445],[445,467],[459,458],[458,250],[250,459],[289,392],[392,290],[290,289],[290,328],[328,460],[460,290],[376,433],[433,435],[435,376],[250,290],[290,392],[392,250],[411,416],[416,433],[433,411],[341,463],[463,464],[464,341],[453,464],[464,465],[465,453],[357,465],[465,412],[412,357],[343,412],[412,399],[399,343],[360,363],[363,440],[440,360],[437,399],[399,456],[456,437],[420,456],[456,363],[363,420],[401,435],[435,288],[288,401],[372,383],[383,353],[353,372],[339,255],[255,249],[249,339],[448,261],[261,255],[255,448],[133,243],[243,190],[190,133],[133,155],[155,112],[112,133],[33,246],[246,247],[247,33],[33,130],[130,25],[25,33],[398,384],[384,286],[286,398],[362,398],[398,414],[414,362],[362,463],[463,341],[341,362],[263,359],[359,467],[467,263],[263,249],[249,255],[255,263],[466,467],[467,260],[260,466],[75,60],[60,166],[166,75],[238,239],[239,79],[79,238],[162,127],[127,139],[139,162],[72,11],[11,37],[37,72],[121,232],[232,120],[120,121],[73,72],[72,39],[39,73],[114,128],[128,47],[47,114],[233,232],[232,128],[128,233],[103,104],[104,67],[67,103],[152,175],[175,148],[148,152],[119,118],[118,101],[101,119],[74,73],[73,40],[40,74],[107,9],[9,108],[108,107],[49,48],[48,131],[131,49],[32,194],[194,211],[211,32],[184,74],[74,185],[185,184],[191,80],[80,183],[183,191],[185,40],[40,186],[186,185],[119,230],[230,118],[118,119],[210,202],[202,214],[214,210],[84,83],[83,17],[17,84],[77,76],[76,146],[146,77],[161,160],[160,30],[30,161],[190,56],[56,173],[173,190],[182,106],[106,194],[194,182],[138,135],[135,192],[192,138],[129,203],[203,98],[98,129],[54,21],[21,68],[68,54],[5,51],[51,4],[4,5],[145,144],[144,23],[23,145],[90,77],[77,91],[91,90],[207,205],[205,187],[187,207],[83,201],[201,18],[18,83],[181,91],[91,182],[182,181],[180,90],[90,181],[181,180],[16,85],[85,17],[17,16],[205,206],[206,36],[36,205],[176,148],[148,140],[140,176],[165,92],[92,39],[39,165],[245,193],[193,244],[244,245],[27,159],[159,28],[28,27],[30,247],[247,161],[161,30],[174,236],[236,196],[196,174],[103,54],[54,104],[104,103],[55,193],[193,8],[8,55],[111,117],[117,31],[31,111],[221,189],[189,55],[55,221],[240,98],[98,99],[99,240],[142,126],[126,100],[100,142],[219,166],[166,218],[218,219],[112,155],[155,26],[26,112],[198,209],[209,131],[131,198],[169,135],[135,150],[150,169],[114,47],[47,217],[217,114],[224,223],[223,53],[53,224],[220,45],[45,134],[134,220],[32,211],[211,140],[140,32],[109,67],[67,108],[108,109],[146,43],[43,91],[91,146],[231,230],[230,120],[120,231],[113,226],[226,247],[247,113],[105,63],[63,52],[52,105],[241,238],[238,242],[242,241],[124,46],[46,156],[156,124],[95,78],[78,96],[96,95],[70,46],[46,63],[63,70],[116,143],[143,227],[227,116],[116,123],[123,111],[111,116],[1,44],[44,19],[19,1],[3,236],[236,51],[51,3],[207,216],[216,205],[205,207],[26,154],[154,22],[22,26],[165,39],[39,167],[167,165],[199,200],[200,208],[208,199],[101,36],[36,100],[100,101],[43,57],[57,202],[202,43],[242,20],[20,99],[99,242],[56,28],[28,157],[157,56],[124,35],[35,113],[113,124],[29,160],[160,27],[27,29],[211,204],[204,210],[210,211],[124,113],[113,46],[46,124],[106,43],[43,204],[204,106],[96,62],[62,77],[77,96],[227,137],[137,116],[116,227],[73,41],[41,72],[72,73],[36,203],[203,142],[142,36],[235,64],[64,240],[240,235],[48,49],[49,64],[64,48],[42,41],[41,74],[74,42],[214,212],[212,207],[207,214],[183,42],[42,184],[184,183],[210,169],[169,211],[211,210],[140,170],[170,176],[176,140],[104,105],[105,69],[69,104],[193,122],[122,168],[168,193],[50,123],[123,187],[187,50],[89,96],[96,90],[90,89],[66,65],[65,107],[107,66],[179,89],[89,180],[180,179],[119,101],[101,120],[120,119],[68,63],[63,104],[104,68],[234,93],[93,227],[227,234],[16,15],[15,85],[85,16],[209,129],[129,49],[49,209],[15,14],[14,86],[86,15],[107,55],[55,9],[9,107],[120,100],[100,121],[121,120],[153,145],[145,22],[22,153],[178,88],[88,179],[179,178],[197,6],[6,196],[196,197],[89,88],[88,96],[96,89],[135,138],[138,136],[136,135],[138,215],[215,172],[172,138],[218,115],[115,219],[219,218],[41,42],[42,81],[81,41],[5,195],[195,51],[51,5],[57,43],[43,61],[61,57],[208,171],[171,199],[199,208],[41,81],[81,38],[38,41],[224,53],[53,225],[225,224],[24,144],[144,110],[110,24],[105,52],[52,66],[66,105],[118,229],[229,117],[117,118],[227,34],[34,234],[234,227],[66,107],[107,69],[69,66],[10,109],[109,151],[151,10],[219,48],[48,235],[235,219],[183,62],[62,191],[191,183],[142,129],[129,126],[126,142],[116,111],[111,143],[143,116],[118,117],[117,50],[50,118],[223,222],[222,52],[52,223],[94,19],[19,141],[141,94],[222,221],[221,65],[65,222],[196,3],[3,197],[197,196],[45,220],[220,44],[44,45],[156,70],[70,139],[139,156],[188,122],[122,245],[245,188],[139,71],[71,162],[162,139],[149,170],[170,150],[150,149],[122,188],[188,196],[196,122],[206,216],[216,92],[92,206],[164,2],[2,167],[167,164],[242,141],[141,241],[241,242],[0,164],[164,37],[37,0],[11,72],[72,12],[12,11],[12,38],[38,13],[13,12],[70,63],[63,71],[71,70],[31,226],[226,111],[111,31],[36,101],[101,205],[205,36],[203,206],[206,165],[165,203],[126,209],[209,217],[217,126],[98,165],[165,97],[97,98],[237,220],[220,218],[218,237],[237,239],[239,241],[241,237],[210,214],[214,169],[169,210],[140,171],[171,32],[32,140],[241,125],[125,237],[237,241],[179,86],[86,178],[178,179],[180,85],[85,179],[179,180],[181,84],[84,180],[180,181],[182,83],[83,181],[181,182],[194,201],[201,182],[182,194],[177,137],[137,132],[132,177],[184,76],[76,183],[183,184],[185,61],[61,184],[184,185],[186,57],[57,185],[185,186],[216,212],[212,186],[186,216],[192,214],[214,187],[187,192],[139,34],[34,156],[156,139],[218,79],[79,237],[237,218],[147,123],[123,177],[177,147],[45,44],[44,4],[4,45],[208,201],[201,32],[32,208],[98,64],[64,129],[129,98],[192,213],[213,138],[138,192],[235,59],[59,219],[219,235],[141,242],[242,97],[97,141],[97,2],[2,141],[141,97],[240,75],[75,235],[235,240],[229,24],[24,228],[228,229],[31,25],[25,226],[226,31],[230,23],[23,229],[229,230],[231,22],[22,230],[230,231],[232,26],[26,231],[231,232],[233,112],[112,232],[232,233],[244,189],[189,243],[243,244],[189,221],[221,190],[190,189],[222,28],[28,221],[221,222],[223,27],[27,222],[222,223],[224,29],[29,223],[223,224],[225,30],[30,224],[224,225],[113,247],[247,225],[225,113],[99,60],[60,240],[240,99],[213,147],[147,215],[215,213],[60,20],[20,166],[166,60],[192,187],[187,213],[213,192],[243,112],[112,244],[244,243],[244,233],[233,245],[245,244],[245,128],[128,188],[188,245],[188,114],[114,174],[174,188],[134,131],[131,220],[220,134],[174,217],[217,236],[236,174],[236,198],[198,134],[134,236],[215,177],[177,58],[58,215],[156,143],[143,124],[124,156],[25,110],[110,7],[7,25],[31,228],[228,25],[25,31],[264,356],[356,368],[368,264],[0,11],[11,267],[267,0],[451,452],[452,349],[349,451],[267,302],[302,269],[269,267],[350,357],[357,277],[277,350],[350,452],[452,357],[357,350],[299,333],[333,297],[297,299],[396,175],[175,377],[377,396],[280,347],[347,330],[330,280],[269,303],[303,270],[270,269],[151,9],[9,337],[337,151],[344,278],[278,360],[360,344],[424,418],[418,431],[431,424],[270,304],[304,409],[409,270],[272,310],[310,407],[407,272],[322,270],[270,410],[410,322],[449,450],[450,347],[347,449],[432,422],[422,434],[434,432],[18,313],[313,17],[17,18],[291,306],[306,375],[375,291],[259,387],[387,260],[260,259],[424,335],[335,418],[418,424],[434,364],[364,416],[416,434],[391,423],[423,327],[327,391],[301,251],[251,298],[298,301],[275,281],[281,4],[4,275],[254,373],[373,253],[253,254],[375,307],[307,321],[321,375],[280,425],[425,411],[411,280],[200,421],[421,18],[18,200],[335,321],[321,406],[406,335],[321,320],[320,405],[405,321],[314,315],[315,17],[17,314],[423,426],[426,266],[266,423],[396,377],[377,369],[369,396],[270,322],[322,269],[269,270],[413,417],[417,464],[464,413],[385,386],[386,258],[258,385],[248,456],[456,419],[419,248],[298,284],[284,333],[333,298],[168,417],[417,8],[8,168],[448,346],[346,261],[261,448],[417,413],[413,285],[285,417],[326,327],[327,328],[328,326],[277,355],[355,329],[329,277],[309,392],[392,438],[438,309],[381,382],[382,256],[256,381],[279,429],[429,360],[360,279],[365,364],[364,379],[379,365],[355,277],[277,437],[437,355],[282,443],[443,283],[283,282],[281,275],[275,363],[363,281],[395,431],[431,369],[369,395],[299,297],[297,337],[337,299],[335,273],[273,321],[321,335],[348,450],[450,349],[349,348],[359,446],[446,467],[467,359],[283,293],[293,282],[282,283],[250,458],[458,462],[462,250],[300,276],[276,383],[383,300],[292,308],[308,325],[325,292],[283,276],[276,293],[293,283],[264,372],[372,447],[447,264],[346,352],[352,340],[340,346],[354,274],[274,19],[19,354],[363,456],[456,281],[281,363],[426,436],[436,425],[425,426],[380,381],[381,252],[252,380],[267,269],[269,393],[393,267],[421,200],[200,428],[428,421],[371,266],[266,329],[329,371],[432,287],[287,422],[422,432],[290,250],[250,328],[328,290],[385,258],[258,384],[384,385],[446,265],[265,342],[342,446],[386,387],[387,257],[257,386],[422,424],[424,430],[430,422],[445,342],[342,276],[276,445],[422,273],[273,424],[424,422],[306,292],[292,307],[307,306],[352,366],[366,345],[345,352],[268,271],[271,302],[302,268],[358,423],[423,371],[371,358],[327,294],[294,460],[460,327],[331,279],[279,294],[294,331],[303,271],[271,304],[304,303],[436,432],[432,427],[427,436],[304,272],[272,408],[408,304],[395,394],[394,431],[431,395],[378,395],[395,400],[400,378],[296,334],[334,299],[299,296],[6,351],[351,168],[168,6],[376,352],[352,411],[411,376],[307,325],[325,320],[320,307],[285,295],[295,336],[336,285],[320,319],[319,404],[404,320],[329,330],[330,349],[349,329],[334,293],[293,333],[333,334],[366,323],[323,447],[447,366],[316,15],[15,315],[315,316],[331,358],[358,279],[279,331],[317,14],[14,316],[316,317],[8,285],[285,9],[9,8],[277,329],[329,350],[350,277],[253,374],[374,252],[252,253],[319,318],[318,403],[403,319],[351,6],[6,419],[419,351],[324,318],[318,325],[325,324],[397,367],[367,365],[365,397],[288,435],[435,397],[397,288],[278,344],[344,439],[439,278],[310,272],[272,311],[311,310],[248,195],[195,281],[281,248],[375,273],[273,291],[291,375],[175,396],[396,199],[199,175],[312,311],[311,268],[268,312],[276,283],[283,445],[445,276],[390,373],[373,339],[339,390],[295,282],[282,296],[296,295],[448,449],[449,346],[346,448],[356,264],[264,454],[454,356],[337,336],[336,299],[299,337],[337,338],[338,151],[151,337],[294,278],[278,455],[455,294],[308,292],[292,415],[415,308],[429,358],[358,355],[355,429],[265,340],[340,372],[372,265],[352,346],[346,280],[280,352],[295,442],[442,282],[282,295],[354,19],[19,370],[370,354],[285,441],[441,295],[295,285],[195,248],[248,197],[197,195],[457,440],[440,274],[274,457],[301,300],[300,368],[368,301],[417,351],[351,465],[465,417],[251,301],[301,389],[389,251],[394,395],[395,379],[379,394],[399,412],[412,419],[419,399],[410,436],[436,322],[322,410],[326,2],[2,393],[393,326],[354,370],[370,461],[461,354],[393,164],[164,267],[267,393],[268,302],[302,12],[12,268],[312,268],[268,13],[13,312],[298,293],[293,301],[301,298],[265,446],[446,340],[340,265],[280,330],[330,425],[425,280],[322,426],[426,391],[391,322],[420,429],[429,437],[437,420],[393,391],[391,326],[326,393],[344,440],[440,438],[438,344],[458,459],[459,461],[461,458],[364,434],[434,394],[394,364],[428,396],[396,262],[262,428],[274,354],[354,457],[457,274],[317,316],[316,402],[402,317],[316,315],[315,403],[403,316],[315,314],[314,404],[404,315],[314,313],[313,405],[405,314],[313,421],[421,406],[406,313],[323,366],[366,361],[361,323],[292,306],[306,407],[407,292],[306,291],[291,408],[408,306],[291,287],[287,409],[409,291],[287,432],[432,410],[410,287],[427,434],[434,411],[411,427],[372,264],[264,383],[383,372],[459,309],[309,457],[457,459],[366,352],[352,401],[401,366],[1,274],[274,4],[4,1],[418,421],[421,262],[262,418],[331,294],[294,358],[358,331],[435,433],[433,367],[367,435],[392,289],[289,439],[439,392],[328,462],[462,326],[326,328],[94,2],[2,370],[370,94],[289,305],[305,455],[455,289],[339,254],[254,448],[448,339],[359,255],[255,446],[446,359],[254,253],[253,449],[449,254],[253,252],[252,450],[450,253],[252,256],[256,451],[451,252],[256,341],[341,452],[452,256],[414,413],[413,463],[463,414],[286,441],[441,414],[414,286],[286,258],[258,441],[441,286],[258,257],[257,442],[442,258],[257,259],[259,443],[443,257],[259,260],[260,444],[444,259],[260,467],[467,445],[445,260],[309,459],[459,250],[250,309],[305,289],[289,290],[290,305],[305,290],[290,460],[460,305],[401,376],[376,435],[435,401],[309,250],[250,392],[392,309],[376,411],[411,433],[433,376],[453,341],[341,464],[464,453],[357,453],[453,465],[465,357],[343,357],[357,412],[412,343],[437,343],[343,399],[399,437],[344,360],[360,440],[440,344],[420,437],[437,456],[456,420],[360,420],[420,363],[363,360],[361,401],[401,288],[288,361],[265,372],[372,353],[353,265],[390,339],[339,249],[249,390],[339,448],[448,255],[255,339]);function Rc(t){t.j={faceLandmarks:[],faceBlendshapes:[],facialTransformationMatrixes:[]}}var Ic=class extends yc{constructor(t,e){super(new lc(t,e),\"image_in\",\"norm_rect\",!1),this.j={faceLandmarks:[],faceBlendshapes:[],facialTransformationMatrixes:[]},this.outputFacialTransformationMatrixes=this.outputFaceBlendshapes=!1,kn(t=this.h=new eo,0,1,e=new Ks),this.A=new to,kn(this.h,0,3,this.A),this.u=new $s,kn(this.h,0,2,this.u),Mn(this.u,4,1),Pn(this.u,2,.5),Pn(this.A,2,.5),Pn(this.h,4,.5)}get baseOptions(){return wn(this.h,Ks,1)}set baseOptions(t){kn(this.h,0,1,t)}o(t){return\"numFaces\"in t&&Mn(this.u,4,t.numFaces??1),\"minFaceDetectionConfidence\"in t&&Pn(this.u,2,t.minFaceDetectionConfidence??.5),\"minTrackingConfidence\"in t&&Pn(this.h,4,t.minTrackingConfidence??.5),\"minFacePresenceConfidence\"in t&&Pn(this.A,2,t.minFacePresenceConfidence??.5),\"outputFaceBlendshapes\"in t&&(this.outputFaceBlendshapes=!!t.outputFaceBlendshapes),\"outputFacialTransformationMatrixes\"in t&&(this.outputFacialTransformationMatrixes=!!t.outputFacialTransformationMatrixes),this.l(t)}F(t,e){return Rc(this),pc(this,t,e),this.j}G(t,e,n){return Rc(this),gc(this,t,n,e),this.j}m(){var t=new gs;ds(t,\"image_in\"),ds(t,\"norm_rect\"),ps(t,\"face_landmarks\");const e=new rs;Mr(e,ro,this.h);const n=new cs;Cn(n,2,\"mediapipe.tasks.vision.face_landmarker.FaceLandmarkerGraph\"),os(n,\"IMAGE:image_in\"),os(n,\"NORM_RECT:norm_rect\"),as(n,\"NORM_LANDMARKS:face_landmarks\"),n.o(e),fs(t,n),this.g.attachProtoVectorListener(\"face_landmarks\",((t,e)=>{for(const e of t)t=Rs(e),this.j.faceLandmarks.push(Yo(t));pa(this,e)})),this.g.attachEmptyPacketListener(\"face_landmarks\",(t=>{pa(this,t)})),this.outputFaceBlendshapes&&(ps(t,\"blendshapes\"),as(n,\"BLENDSHAPES:blendshapes\"),this.g.attachProtoVectorListener(\"blendshapes\",((t,e)=>{if(this.outputFaceBlendshapes)for(const e of t)t=ws(e),this.j.faceBlendshapes.push(Wo(t.g()??[]));pa(this,e)})),this.g.attachEmptyPacketListener(\"blendshapes\",(t=>{pa(this,t)}))),this.outputFacialTransformationMatrixes&&(ps(t,\"face_geometry\"),as(n,\"FACE_GEOMETRY:face_geometry\"),this.g.attachProtoVectorListener(\"face_geometry\",((t,e)=>{if(this.outputFacialTransformationMatrixes)for(const e of t)(t=wn(t=Qs(e),Is,2))&&this.j.facialTransformationMatrixes.push({rows:Rn(t,1)??0??0,columns:Rn(t,2)??0??0,data:on(t,3,Qt,sn()).slice()??[]});pa(this,e)})),this.g.attachEmptyPacketListener(\"face_geometry\",(t=>{pa(this,t)}))),t=t.g(),this.setGraph(new Uint8Array(t),!0)}};Ic.prototype.detectForVideo=Ic.prototype.G,Ic.prototype.detect=Ic.prototype.F,Ic.prototype.setOptions=Ic.prototype.o,Ic.createFromModelPath=function(t,e){return fc(Ic,t,{baseOptions:{modelAssetPath:e}})},Ic.createFromModelBuffer=function(t,e){return fc(Ic,t,{baseOptions:{modelAssetBuffer:e}})},Ic.createFromOptions=function(t,e){return fc(Ic,t,e)},Ic.FACE_LANDMARKS_LIPS=vc,Ic.FACE_LANDMARKS_LEFT_EYE=Ec,Ic.FACE_LANDMARKS_LEFT_EYEBROW=wc,Ic.FACE_LANDMARKS_LEFT_IRIS=Tc,Ic.FACE_LANDMARKS_RIGHT_EYE=Ac,Ic.FACE_LANDMARKS_RIGHT_EYEBROW=bc,Ic.FACE_LANDMARKS_RIGHT_IRIS=kc,Ic.FACE_LANDMARKS_FACE_OVAL=Sc,Ic.FACE_LANDMARKS_CONTOURS=xc,Ic.FACE_LANDMARKS_TESSELATION=Lc;var Fc=cc([0,1],[1,2],[2,3],[3,4],[0,5],[5,6],[6,7],[7,8],[5,9],[9,10],[10,11],[11,12],[9,13],[13,14],[14,15],[15,16],[13,17],[0,17],[17,18],[18,19],[19,20]);function Mc(t){t.gestures=[],t.landmarks=[],t.worldLandmarks=[],t.handedness=[]}function Pc(t){return 0===t.gestures.length?{gestures:[],landmarks:[],worldLandmarks:[],handedness:[],handednesses:[]}:{gestures:t.gestures,landmarks:t.landmarks,worldLandmarks:t.worldLandmarks,handedness:t.handedness,handednesses:t.handedness}}function Cc(t,e=!0){const n=[];for(const i of t){var r=ws(i);t=[];for(const n of r.g())r=e&&null!=Rn(n,1)?Rn(n,1)??0:-1,t.push({score:Fn(n,2)??0,index:r,categoryName:ge(tn(n,3))??\"\"??\"\",displayName:ge(tn(n,4))??\"\"??\"\"});n.push(t)}return n}var Oc=class extends yc{constructor(t,e){super(new lc(t,e),\"image_in\",\"norm_rect\",!1),this.gestures=[],this.landmarks=[],this.worldLandmarks=[],this.handedness=[],kn(t=this.j=new uo,0,1,e=new Ks),this.u=new ho,kn(this.j,0,2,this.u),this.D=new co,kn(this.u,0,3,this.D),this.A=new ao,kn(this.u,0,2,this.A),this.h=new oo,kn(this.j,0,3,this.h),Pn(this.A,2,.5),Pn(this.u,4,.5),Pn(this.D,2,.5)}get baseOptions(){return wn(this.j,Ks,1)}set baseOptions(t){kn(this.j,0,1,t)}o(t){if(Mn(this.A,3,t.numHands??1),\"minHandDetectionConfidence\"in t&&Pn(this.A,2,t.minHandDetectionConfidence??.5),\"minTrackingConfidence\"in t&&Pn(this.u,4,t.minTrackingConfidence??.5),\"minHandPresenceConfidence\"in t&&Pn(this.D,2,t.minHandPresenceConfidence??.5),t.cannedGesturesClassifierOptions){var e=new io,n=e,r=Xo(t.cannedGesturesClassifierOptions,wn(this.h,io,3)?.l());kn(n,0,2,r),kn(this.h,0,3,e)}else void 0===t.cannedGesturesClassifierOptions&&wn(this.h,io,3)?.g();return t.customGesturesClassifierOptions?(kn(n=e=new io,0,2,r=Xo(t.customGesturesClassifierOptions,wn(this.h,io,4)?.l())),kn(this.h,0,4,e)):void 0===t.customGesturesClassifierOptions&&wn(this.h,io,4)?.g(),this.l(t)}Ha(t,e){return Mc(this),pc(this,t,e),Pc(this)}Ia(t,e,n){return Mc(this),gc(this,t,n,e),Pc(this)}m(){var t=new gs;ds(t,\"image_in\"),ds(t,\"norm_rect\"),ps(t,\"hand_gestures\"),ps(t,\"hand_landmarks\"),ps(t,\"world_hand_landmarks\"),ps(t,\"handedness\");const e=new rs;Mr(e,mo,this.j);const n=new cs;Cn(n,2,\"mediapipe.tasks.vision.gesture_recognizer.GestureRecognizerGraph\"),os(n,\"IMAGE:image_in\"),os(n,\"NORM_RECT:norm_rect\"),as(n,\"HAND_GESTURES:hand_gestures\"),as(n,\"LANDMARKS:hand_landmarks\"),as(n,\"WORLD_LANDMARKS:world_hand_landmarks\"),as(n,\"HANDEDNESS:handedness\"),n.o(e),fs(t,n),this.g.attachProtoVectorListener(\"hand_landmarks\",((t,e)=>{for(const e of t){t=Rs(e);const n=[];for(const e of An(t,Ls,1))n.push({x:Fn(e,1)??0,y:Fn(e,2)??0,z:Fn(e,3)??0,visibility:Fn(e,4)??0});this.landmarks.push(n)}pa(this,e)})),this.g.attachEmptyPacketListener(\"hand_landmarks\",(t=>{pa(this,t)})),this.g.attachProtoVectorListener(\"world_hand_landmarks\",((t,e)=>{for(const e of t){t=xs(e);const n=[];for(const e of An(t,Ss,1))n.push({x:Fn(e,1)??0,y:Fn(e,2)??0,z:Fn(e,3)??0,visibility:Fn(e,4)??0});this.worldLandmarks.push(n)}pa(this,e)})),this.g.attachEmptyPacketListener(\"world_hand_landmarks\",(t=>{pa(this,t)})),this.g.attachProtoVectorListener(\"hand_gestures\",((t,e)=>{this.gestures.push(...Cc(t,!1)),pa(this,e)})),this.g.attachEmptyPacketListener(\"hand_gestures\",(t=>{pa(this,t)})),this.g.attachProtoVectorListener(\"handedness\",((t,e)=>{this.handedness.push(...Cc(t)),pa(this,e)})),this.g.attachEmptyPacketListener(\"handedness\",(t=>{pa(this,t)})),t=t.g(),this.setGraph(new Uint8Array(t),!0)}};function Nc(t){return{landmarks:t.landmarks,worldLandmarks:t.worldLandmarks,handednesses:t.handedness,handedness:t.handedness}}Oc.prototype.recognizeForVideo=Oc.prototype.Ia,Oc.prototype.recognize=Oc.prototype.Ha,Oc.prototype.setOptions=Oc.prototype.o,Oc.createFromModelPath=function(t,e){return fc(Oc,t,{baseOptions:{modelAssetPath:e}})},Oc.createFromModelBuffer=function(t,e){return fc(Oc,t,{baseOptions:{modelAssetBuffer:e}})},Oc.createFromOptions=function(t,e){return fc(Oc,t,e)},Oc.HAND_CONNECTIONS=Fc;var Uc=class extends yc{constructor(t,e){super(new lc(t,e),\"image_in\",\"norm_rect\",!1),this.landmarks=[],this.worldLandmarks=[],this.handedness=[],kn(t=this.h=new ho,0,1,e=new Ks),this.u=new co,kn(this.h,0,3,this.u),this.j=new ao,kn(this.h,0,2,this.j),Mn(this.j,3,1),Pn(this.j,2,.5),Pn(this.u,2,.5),Pn(this.h,4,.5)}get baseOptions(){return wn(this.h,Ks,1)}set baseOptions(t){kn(this.h,0,1,t)}o(t){return\"numHands\"in t&&Mn(this.j,3,t.numHands??1),\"minHandDetectionConfidence\"in t&&Pn(this.j,2,t.minHandDetectionConfidence??.5),\"minTrackingConfidence\"in t&&Pn(this.h,4,t.minTrackingConfidence??.5),\"minHandPresenceConfidence\"in t&&Pn(this.u,2,t.minHandPresenceConfidence??.5),this.l(t)}F(t,e){return this.landmarks=[],this.worldLandmarks=[],this.handedness=[],pc(this,t,e),Nc(this)}G(t,e,n){return this.landmarks=[],this.worldLandmarks=[],this.handedness=[],gc(this,t,n,e),Nc(this)}m(){var t=new gs;ds(t,\"image_in\"),ds(t,\"norm_rect\"),ps(t,\"hand_landmarks\"),ps(t,\"world_hand_landmarks\"),ps(t,\"handedness\");const e=new rs;Mr(e,yo,this.h);const n=new cs;Cn(n,2,\"mediapipe.tasks.vision.hand_landmarker.HandLandmarkerGraph\"),os(n,\"IMAGE:image_in\"),os(n,\"NORM_RECT:norm_rect\"),as(n,\"LANDMARKS:hand_landmarks\"),as(n,\"WORLD_LANDMARKS:world_hand_landmarks\"),as(n,\"HANDEDNESS:handedness\"),n.o(e),fs(t,n),this.g.attachProtoVectorListener(\"hand_landmarks\",((t,e)=>{for(const e of t)t=Rs(e),this.landmarks.push(Yo(t));pa(this,e)})),this.g.attachEmptyPacketListener(\"hand_landmarks\",(t=>{pa(this,t)})),this.g.attachProtoVectorListener(\"world_hand_landmarks\",((t,e)=>{for(const e of t)t=xs(e),this.worldLandmarks.push(qo(t));pa(this,e)})),this.g.attachEmptyPacketListener(\"world_hand_landmarks\",(t=>{pa(this,t)})),this.g.attachProtoVectorListener(\"handedness\",((t,e)=>{var n=this.handedness,r=n.push;const i=[];for(const e of t){t=ws(e);const n=[];for(const e of t.g())n.push({score:Fn(e,2)??0,index:Rn(e,1)??0??-1,categoryName:ge(tn(e,3))??\"\"??\"\",displayName:ge(tn(e,4))??\"\"??\"\"});i.push(n)}r.call(n,...i),pa(this,e)})),this.g.attachEmptyPacketListener(\"handedness\",(t=>{pa(this,t)})),t=t.g(),this.setGraph(new Uint8Array(t),!0)}};Uc.prototype.detectForVideo=Uc.prototype.G,Uc.prototype.detect=Uc.prototype.F,Uc.prototype.setOptions=Uc.prototype.o,Uc.createFromModelPath=function(t,e){return fc(Uc,t,{baseOptions:{modelAssetPath:e}})},Uc.createFromModelBuffer=function(t,e){return fc(Uc,t,{baseOptions:{modelAssetBuffer:e}})},Uc.createFromOptions=function(t,e){return fc(Uc,t,e)},Uc.HAND_CONNECTIONS=Fc;var Dc=cc([0,1],[1,2],[2,3],[3,7],[0,4],[4,5],[5,6],[6,8],[9,10],[11,12],[11,13],[13,15],[15,17],[15,19],[15,21],[17,19],[12,14],[14,16],[16,18],[16,20],[16,22],[18,20],[11,23],[12,24],[23,24],[23,25],[24,26],[25,27],[26,28],[27,29],[28,30],[29,31],[30,32],[27,31],[28,32]);function Bc(t){t.h={faceLandmarks:[],faceBlendshapes:[],poseLandmarks:[],poseWorldLandmarks:[],poseSegmentationMasks:[],leftHandLandmarks:[],leftHandWorldLandmarks:[],rightHandLandmarks:[],rightHandWorldLandmarks:[]}}function Gc(t){try{if(!t.D)return t.h;t.D(t.h)}finally{ya(t)}}function jc(t,e){t=Rs(t),e.push(Yo(t))}var Vc=class extends yc{constructor(t,e){super(new lc(t,e),\"input_frames_image\",null,!1),this.h={faceLandmarks:[],faceBlendshapes:[],poseLandmarks:[],poseWorldLandmarks:[],poseSegmentationMasks:[],leftHandLandmarks:[],leftHandWorldLandmarks:[],rightHandLandmarks:[],rightHandWorldLandmarks:[]},this.outputPoseSegmentationMasks=this.outputFaceBlendshapes=!1,kn(t=this.j=new wo,0,1,e=new Ks),this.I=new co,kn(this.j,0,2,this.I),this.W=new _o,kn(this.j,0,3,this.W),this.u=new $s,kn(this.j,0,4,this.u),this.O=new to,kn(this.j,0,5,this.O),this.A=new vo,kn(this.j,0,6,this.A),this.M=new Eo,kn(this.j,0,7,this.M),Pn(this.u,2,.5),Pn(this.u,3,.3),Pn(this.O,2,.5),Pn(this.A,2,.5),Pn(this.A,3,.3),Pn(this.M,2,.5),Pn(this.I,2,.5)}get baseOptions(){return wn(this.j,Ks,1)}set baseOptions(t){kn(this.j,0,1,t)}o(t){return\"minFaceDetectionConfidence\"in t&&Pn(this.u,2,t.minFaceDetectionConfidence??.5),\"minFaceSuppressionThreshold\"in t&&Pn(this.u,3,t.minFaceSuppressionThreshold??.3),\"minFacePresenceConfidence\"in t&&Pn(this.O,2,t.minFacePresenceConfidence??.5),\"outputFaceBlendshapes\"in t&&(this.outputFaceBlendshapes=!!t.outputFaceBlendshapes),\"minPoseDetectionConfidence\"in t&&Pn(this.A,2,t.minPoseDetectionConfidence??.5),\"minPoseSuppressionThreshold\"in t&&Pn(this.A,3,t.minPoseSuppressionThreshold??.3),\"minPosePresenceConfidence\"in t&&Pn(this.M,2,t.minPosePresenceConfidence??.5),\"outputPoseSegmentationMasks\"in t&&(this.outputPoseSegmentationMasks=!!t.outputPoseSegmentationMasks),\"minHandLandmarksConfidence\"in t&&Pn(this.I,2,t.minHandLandmarksConfidence??.5),this.l(t)}F(t,e,n){const r=\"function\"!=typeof e?e:{};return this.D=\"function\"==typeof e?e:n,Bc(this),pc(this,t,r),Gc(this)}G(t,e,n,r){const i=\"function\"!=typeof n?n:{};return this.D=\"function\"==typeof n?n:r,Bc(this),gc(this,t,i,e),Gc(this)}m(){var t=new gs;ds(t,\"input_frames_image\"),ps(t,\"pose_landmarks\"),ps(t,\"pose_world_landmarks\"),ps(t,\"face_landmarks\"),ps(t,\"left_hand_landmarks\"),ps(t,\"left_hand_world_landmarks\"),ps(t,\"right_hand_landmarks\"),ps(t,\"right_hand_world_landmarks\");const e=new rs,n=new Xi;Cn(n,1,\"type.googleapis.com/mediapipe.tasks.vision.holistic_landmarker.proto.HolisticLandmarkerGraphOptions\"),function(t,e){if(null!=e)if(Array.isArray(e))nn(t,2,Ce(e,0,Ne));else{if(!(\"string\"==typeof e||e instanceof P||R(e)))throw Error(\"invalid value in Any.value field: \"+e+\" expected a ByteString, a base64 encoded string, a Uint8Array or a jspb array\");dn(t,2,lt(e,!1),F())}}(n,this.j.g());const r=new cs;Cn(r,2,\"mediapipe.tasks.vision.holistic_landmarker.HolisticLandmarkerGraph\"),Ln(r,8,Xi,n),os(r,\"IMAGE:input_frames_image\"),as(r,\"POSE_LANDMARKS:pose_landmarks\"),as(r,\"POSE_WORLD_LANDMARKS:pose_world_landmarks\"),as(r,\"FACE_LANDMARKS:face_landmarks\"),as(r,\"LEFT_HAND_LANDMARKS:left_hand_landmarks\"),as(r,\"LEFT_HAND_WORLD_LANDMARKS:left_hand_world_landmarks\"),as(r,\"RIGHT_HAND_LANDMARKS:right_hand_landmarks\"),as(r,\"RIGHT_HAND_WORLD_LANDMARKS:right_hand_world_landmarks\"),r.o(e),fs(t,r),ga(this,t),this.g.attachProtoListener(\"pose_landmarks\",((t,e)=>{jc(t,this.h.poseLandmarks),pa(this,e)})),this.g.attachEmptyPacketListener(\"pose_landmarks\",(t=>{pa(this,t)})),this.g.attachProtoListener(\"pose_world_landmarks\",((t,e)=>{var n=this.h.poseWorldLandmarks;t=xs(t),n.push(qo(t)),pa(this,e)})),this.g.attachEmptyPacketListener(\"pose_world_landmarks\",(t=>{pa(this,t)})),this.outputPoseSegmentationMasks&&(as(r,\"POSE_SEGMENTATION_MASK:pose_segmentation_mask\"),ma(this,\"pose_segmentation_mask\"),this.g.Z(\"pose_segmentation_mask\",((t,e)=>{this.h.poseSegmentationMasks=[mc(this,t,!0,!this.D)],pa(this,e)})),this.g.attachEmptyPacketListener(\"pose_segmentation_mask\",(t=>{this.h.poseSegmentationMasks=[],pa(this,t)}))),this.g.attachProtoListener(\"face_landmarks\",((t,e)=>{jc(t,this.h.faceLandmarks),pa(this,e)})),this.g.attachEmptyPacketListener(\"face_landmarks\",(t=>{pa(this,t)})),this.outputFaceBlendshapes&&(ps(t,\"extra_blendshapes\"),as(r,\"FACE_BLENDSHAPES:extra_blendshapes\"),this.g.attachProtoListener(\"extra_blendshapes\",((t,e)=>{var n=this.h.faceBlendshapes;this.outputFaceBlendshapes&&(t=ws(t),n.push(Wo(t.g()??[]))),pa(this,e)})),this.g.attachEmptyPacketListener(\"extra_blendshapes\",(t=>{pa(this,t)}))),this.g.attachProtoListener(\"left_hand_landmarks\",((t,e)=>{jc(t,this.h.leftHandLandmarks),pa(this,e)})),this.g.attachEmptyPacketListener(\"left_hand_landmarks\",(t=>{pa(this,t)})),this.g.attachProtoListener(\"left_hand_world_landmarks\",((t,e)=>{var n=this.h.leftHandWorldLandmarks;t=xs(t),n.push(qo(t)),pa(this,e)})),this.g.attachEmptyPacketListener(\"left_hand_world_landmarks\",(t=>{pa(this,t)})),this.g.attachProtoListener(\"right_hand_landmarks\",((t,e)=>{jc(t,this.h.rightHandLandmarks),pa(this,e)})),this.g.attachEmptyPacketListener(\"right_hand_landmarks\",(t=>{pa(this,t)})),this.g.attachProtoListener(\"right_hand_world_landmarks\",((t,e)=>{var n=this.h.rightHandWorldLandmarks;t=xs(t),n.push(qo(t)),pa(this,e)})),this.g.attachEmptyPacketListener(\"right_hand_world_landmarks\",(t=>{pa(this,t)})),t=t.g(),this.setGraph(new Uint8Array(t),!0)}};Vc.prototype.detectForVideo=Vc.prototype.G,Vc.prototype.detect=Vc.prototype.F,Vc.prototype.setOptions=Vc.prototype.o,Vc.createFromModelPath=function(t,e){return fc(Vc,t,{baseOptions:{modelAssetPath:e}})},Vc.createFromModelBuffer=function(t,e){return fc(Vc,t,{baseOptions:{modelAssetBuffer:e}})},Vc.createFromOptions=function(t,e){return fc(Vc,t,e)},Vc.HAND_CONNECTIONS=Fc,Vc.POSE_CONNECTIONS=Dc,Vc.FACE_LANDMARKS_LIPS=vc,Vc.FACE_LANDMARKS_LEFT_EYE=Ec,Vc.FACE_LANDMARKS_LEFT_EYEBROW=wc,Vc.FACE_LANDMARKS_LEFT_IRIS=Tc,Vc.FACE_LANDMARKS_RIGHT_EYE=Ac,Vc.FACE_LANDMARKS_RIGHT_EYEBROW=bc,Vc.FACE_LANDMARKS_RIGHT_IRIS=kc,Vc.FACE_LANDMARKS_FACE_OVAL=Sc,Vc.FACE_LANDMARKS_CONTOURS=xc,Vc.FACE_LANDMARKS_TESSELATION=Lc;var Xc=class extends yc{constructor(t,e){super(new lc(t,e),\"input_image\",\"norm_rect\",!0),this.j={classifications:[]},kn(t=this.h=new bo,0,1,e=new Ks)}get baseOptions(){return wn(this.h,Ks,1)}set baseOptions(t){kn(this.h,0,1,t)}o(t){return kn(this.h,0,2,Xo(t,wn(this.h,Gs,2))),this.l(t)}sa(t,e){return this.j={classifications:[]},pc(this,t,e),this.j}ta(t,e,n){return this.j={classifications:[]},gc(this,t,n,e),this.j}m(){var t=new gs;ds(t,\"input_image\"),ds(t,\"norm_rect\"),ps(t,\"classifications\");const e=new rs;Mr(e,ko,this.h);const n=new cs;Cn(n,2,\"mediapipe.tasks.vision.image_classifier.ImageClassifierGraph\"),os(n,\"IMAGE:input_image\"),os(n,\"NORM_RECT:norm_rect\"),as(n,\"CLASSIFICATIONS:classifications\"),n.o(e),fs(t,n),this.g.attachProtoListener(\"classifications\",((t,e)=>{this.j=zo(Cs(t)),pa(this,e)})),this.g.attachEmptyPacketListener(\"classifications\",(t=>{pa(this,t)})),t=t.g(),this.setGraph(new Uint8Array(t),!0)}};Xc.prototype.classifyForVideo=Xc.prototype.ta,Xc.prototype.classify=Xc.prototype.sa,Xc.prototype.setOptions=Xc.prototype.o,Xc.createFromModelPath=function(t,e){return fc(Xc,t,{baseOptions:{modelAssetPath:e}})},Xc.createFromModelBuffer=function(t,e){return fc(Xc,t,{baseOptions:{modelAssetBuffer:e}})},Xc.createFromOptions=function(t,e){return fc(Xc,t,e)};var Hc=class extends yc{constructor(t,e){super(new lc(t,e),\"image_in\",\"norm_rect\",!0),this.h=new So,this.embeddings={embeddings:[]},kn(t=this.h,0,1,e=new Ks)}get baseOptions(){return wn(this.h,Ks,1)}set baseOptions(t){kn(this.h,0,1,t)}o(t){var e=this.h,n=wn(this.h,Vs,2);return n=n?n.clone():new Vs,void 0!==t.l2Normalize?nn(n,1,te(t.l2Normalize)):\"l2Normalize\"in t&&nn(n,1),void 0!==t.quantize?nn(n,2,te(t.quantize)):\"quantize\"in t&&nn(n,2),kn(e,0,2,n),this.l(t)}za(t,e){return pc(this,t,e),this.embeddings}Aa(t,e,n){return gc(this,t,n,e),this.embeddings}m(){var t=new gs;ds(t,\"image_in\"),ds(t,\"norm_rect\"),ps(t,\"embeddings_out\");const e=new rs;Mr(e,xo,this.h);const n=new cs;Cn(n,2,\"mediapipe.tasks.vision.image_embedder.ImageEmbedderGraph\"),os(n,\"IMAGE:image_in\"),os(n,\"NORM_RECT:norm_rect\"),as(n,\"EMBEDDINGS:embeddings_out\"),n.o(e),fs(t,n),this.g.attachProtoListener(\"embeddings_out\",((t,e)=>{t=Bs(t),this.embeddings=function(t){return{embeddings:An(t,Us,1).map((t=>{const e={headIndex:Rn(t,3)??0??-1,headName:ge(tn(t,4))??\"\"??\"\"};var n=t.v;return void 0!==En(n,0|n[et],Os,gn(t,1))?(t=on(t=wn(t,Os,gn(t,1),void 0),1,Qt,sn()),e.floatEmbedding=t.slice()):(n=new Uint8Array(0),e.quantizedEmbedding=wn(t,Ns,gn(t,2),void 0)?.na()?.h()??n),e})),timestampMs:Ho(In(t))}}(t),pa(this,e)})),this.g.attachEmptyPacketListener(\"embeddings_out\",(t=>{pa(this,t)})),t=t.g(),this.setGraph(new Uint8Array(t),!0)}};Hc.cosineSimilarity=function(t,e){if(t.floatEmbedding&&e.floatEmbedding)t=Jo(t.floatEmbedding,e.floatEmbedding);else{if(!t.quantizedEmbedding||!e.quantizedEmbedding)throw Error(\"Cannot compute cosine similarity between quantized and float embeddings.\");t=Jo($o(t.quantizedEmbedding),$o(e.quantizedEmbedding))}return t},Hc.prototype.embedForVideo=Hc.prototype.Aa,Hc.prototype.embed=Hc.prototype.za,Hc.prototype.setOptions=Hc.prototype.o,Hc.createFromModelPath=function(t,e){return fc(Hc,t,{baseOptions:{modelAssetPath:e}})},Hc.createFromModelBuffer=function(t,e){return fc(Hc,t,{baseOptions:{modelAssetBuffer:e}})},Hc.createFromOptions=function(t,e){return fc(Hc,t,e)};var Wc=class{constructor(t,e,n){this.confidenceMasks=t,this.categoryMask=e,this.qualityScores=n}close(){this.confidenceMasks?.forEach((t=>{t.close()})),this.categoryMask?.close()}};function zc(t){const e=function(t){return An(t,cs,1)}(t.ca()).filter((t=>(ge(tn(t,1))??\"\").includes(\"mediapipe.tasks.TensorsToSegmentationCalculator\")));if(t.u=[],e.length>1)throw Error(\"The graph has more than one mediapipe.tasks.TensorsToSegmentationCalculator.\");1===e.length&&(wn(e[0],rs,7)?.j()?.g()??new Map).forEach(((e,n)=>{t.u[Number(n)]=ge(tn(e,1))??\"\"}))}function Kc(t){t.categoryMask=void 0,t.confidenceMasks=void 0,t.qualityScores=void 0}function Yc(t){try{const e=new Wc(t.confidenceMasks,t.categoryMask,t.qualityScores);if(!t.j)return e;t.j(e)}finally{ya(t)}}Wc.prototype.close=Wc.prototype.close;var qc=class extends yc{constructor(t,e){super(new lc(t,e),\"image_in\",\"norm_rect\",!1),this.u=[],this.outputCategoryMask=!1,this.outputConfidenceMasks=!0,this.h=new Mo,this.A=new Lo,kn(this.h,0,3,this.A),kn(t=this.h,0,1,e=new Ks)}get baseOptions(){return wn(this.h,Ks,1)}set baseOptions(t){kn(this.h,0,1,t)}o(t){return void 0!==t.displayNamesLocale?nn(this.h,2,pe(t.displayNamesLocale)):\"displayNamesLocale\"in t&&nn(this.h,2),\"outputCategoryMask\"in t&&(this.outputCategoryMask=t.outputCategoryMask??!1),\"outputConfidenceMasks\"in t&&(this.outputConfidenceMasks=t.outputConfidenceMasks??!0),super.l(t)}L(){zc(this)}segment(t,e,n){const r=\"function\"!=typeof e?e:{};return this.j=\"function\"==typeof e?e:n,Kc(this),pc(this,t,r),Yc(this)}La(t,e,n,r){const i=\"function\"!=typeof n?n:{};return this.j=\"function\"==typeof n?n:r,Kc(this),gc(this,t,i,e),Yc(this)}Da(){return this.u}m(){var t=new gs;ds(t,\"image_in\"),ds(t,\"norm_rect\");const e=new rs;Mr(e,Po,this.h);const n=new cs;Cn(n,2,\"mediapipe.tasks.vision.image_segmenter.ImageSegmenterGraph\"),os(n,\"IMAGE:image_in\"),os(n,\"NORM_RECT:norm_rect\"),n.o(e),fs(t,n),ga(this,t),this.outputConfidenceMasks&&(ps(t,\"confidence_masks\"),as(n,\"CONFIDENCE_MASKS:confidence_masks\"),ma(this,\"confidence_masks\"),this.g.aa(\"confidence_masks\",((t,e)=>{this.confidenceMasks=t.map((t=>mc(this,t,!0,!this.j))),pa(this,e)})),this.g.attachEmptyPacketListener(\"confidence_masks\",(t=>{this.confidenceMasks=[],pa(this,t)}))),this.outputCategoryMask&&(ps(t,\"category_mask\"),as(n,\"CATEGORY_MASK:category_mask\"),ma(this,\"category_mask\"),this.g.Z(\"category_mask\",((t,e)=>{this.categoryMask=mc(this,t,!1,!this.j),pa(this,e)})),this.g.attachEmptyPacketListener(\"category_mask\",(t=>{this.categoryMask=void 0,pa(this,t)}))),ps(t,\"quality_scores\"),as(n,\"QUALITY_SCORES:quality_scores\"),this.g.attachFloatVectorListener(\"quality_scores\",((t,e)=>{this.qualityScores=t,pa(this,e)})),this.g.attachEmptyPacketListener(\"quality_scores\",(t=>{this.categoryMask=void 0,pa(this,t)})),t=t.g(),this.setGraph(new Uint8Array(t),!0)}};qc.prototype.getLabels=qc.prototype.Da,qc.prototype.segmentForVideo=qc.prototype.La,qc.prototype.segment=qc.prototype.segment,qc.prototype.setOptions=qc.prototype.o,qc.createFromModelPath=function(t,e){return fc(qc,t,{baseOptions:{modelAssetPath:e}})},qc.createFromModelBuffer=function(t,e){return fc(qc,t,{baseOptions:{modelAssetBuffer:e}})},qc.createFromOptions=function(t,e){return fc(qc,t,e)};var $c=class{constructor(t,e,n){this.confidenceMasks=t,this.categoryMask=e,this.qualityScores=n}close(){this.confidenceMasks?.forEach((t=>{t.close()})),this.categoryMask?.close()}};$c.prototype.close=$c.prototype.close;var Jc=class extends yc{constructor(t,e){super(new lc(t,e),\"image_in\",\"norm_rect_in\",!1),this.outputCategoryMask=!1,this.outputConfidenceMasks=!0,this.h=new Mo,this.u=new Lo,kn(this.h,0,3,this.u),kn(t=this.h,0,1,e=new Ks)}get baseOptions(){return wn(this.h,Ks,1)}set baseOptions(t){kn(this.h,0,1,t)}o(t){return\"outputCategoryMask\"in t&&(this.outputCategoryMask=t.outputCategoryMask??!1),\"outputConfidenceMasks\"in t&&(this.outputConfidenceMasks=t.outputConfidenceMasks??!0),super.l(t)}segment(t,e,n,r){const i=\"function\"!=typeof n?n:{};if(this.j=\"function\"==typeof n?n:r,this.qualityScores=this.categoryMask=this.confidenceMasks=void 0,n=this.C+1,r=new Uo,e.keypoint&&e.scribble)throw Error(\"Cannot provide both keypoint and scribble.\");if(e.keypoint){var s=new Co;dn(s,3,te(!0),!1),dn(s,1,Zt(e.keypoint.x),0),dn(s,2,Zt(e.keypoint.y),0),Sn(r,1,Do,s)}else{if(!e.scribble)throw Error(\"Must provide either a keypoint or a scribble.\");{const t=new No;for(s of e.scribble)dn(e=new Co,3,te(!0),!1),dn(e,1,Zt(s.x),0),dn(e,2,Zt(s.y),0),Ln(t,1,Co,e);Sn(r,2,Do,t)}}this.g.addProtoToStream(r.g(),\"mediapipe.tasks.vision.interactive_segmenter.proto.RegionOfInterest\",\"roi_in\",n),pc(this,t,i);t:{try{const t=new $c(this.confidenceMasks,this.categoryMask,this.qualityScores);if(!this.j){var o=t;break t}this.j(t)}finally{ya(this)}o=void 0}return o}m(){var t=new gs;ds(t,\"image_in\"),ds(t,\"roi_in\"),ds(t,\"norm_rect_in\");const e=new rs;Mr(e,Po,this.h);const n=new cs;Cn(n,2,\"mediapipe.tasks.vision.interactive_segmenter.InteractiveSegmenterGraphV2\"),os(n,\"IMAGE:image_in\"),os(n,\"ROI:roi_in\"),os(n,\"NORM_RECT:norm_rect_in\"),n.o(e),fs(t,n),ga(this,t),this.outputConfidenceMasks&&(ps(t,\"confidence_masks\"),as(n,\"CONFIDENCE_MASKS:confidence_masks\"),ma(this,\"confidence_masks\"),this.g.aa(\"confidence_masks\",((t,e)=>{this.confidenceMasks=t.map((t=>mc(this,t,!0,!this.j))),pa(this,e)})),this.g.attachEmptyPacketListener(\"confidence_masks\",(t=>{this.confidenceMasks=[],pa(this,t)}))),this.outputCategoryMask&&(ps(t,\"category_mask\"),as(n,\"CATEGORY_MASK:category_mask\"),ma(this,\"category_mask\"),this.g.Z(\"category_mask\",((t,e)=>{this.categoryMask=mc(this,t,!1,!this.j),pa(this,e)})),this.g.attachEmptyPacketListener(\"category_mask\",(t=>{this.categoryMask=void 0,pa(this,t)}))),ps(t,\"quality_scores\"),as(n,\"QUALITY_SCORES:quality_scores\"),this.g.attachFloatVectorListener(\"quality_scores\",((t,e)=>{this.qualityScores=t,pa(this,e)})),this.g.attachEmptyPacketListener(\"quality_scores\",(t=>{this.categoryMask=void 0,pa(this,t)})),t=t.g(),this.setGraph(new Uint8Array(t),!0)}};Jc.prototype.segment=Jc.prototype.segment,Jc.prototype.setOptions=Jc.prototype.o,Jc.createFromModelPath=function(t,e){return fc(Jc,t,{baseOptions:{modelAssetPath:e}})},Jc.createFromModelBuffer=function(t,e){return fc(Jc,t,{baseOptions:{modelAssetBuffer:e}})},Jc.createFromOptions=function(t,e){return fc(Jc,t,e)};var Zc=class extends yc{constructor(t,e){super(new lc(t,e),\"input_frame_gpu\",\"norm_rect\",!1),this.j={detections:[]},kn(t=this.h=new Bo,0,1,e=new Ks)}get baseOptions(){return wn(this.h,Ks,1)}set baseOptions(t){kn(this.h,0,1,t)}o(t){return void 0!==t.displayNamesLocale?nn(this.h,2,pe(t.displayNamesLocale)):\"displayNamesLocale\"in t&&nn(this.h,2),void 0!==t.maxResults?Mn(this.h,3,t.maxResults):\"maxResults\"in t&&nn(this.h,3),void 0!==t.scoreThreshold?Pn(this.h,4,t.scoreThreshold):\"scoreThreshold\"in t&&nn(this.h,4),void 0!==t.categoryAllowlist?On(this.h,5,t.categoryAllowlist):\"categoryAllowlist\"in t&&nn(this.h,5),void 0!==t.categoryDenylist?On(this.h,6,t.categoryDenylist):\"categoryDenylist\"in t&&nn(this.h,6),this.l(t)}F(t,e){return this.j={detections:[]},pc(this,t,e),this.j}G(t,e,n){return this.j={detections:[]},gc(this,t,n,e),this.j}m(){var t=new gs;ds(t,\"input_frame_gpu\"),ds(t,\"norm_rect\"),ps(t,\"detections\");const e=new rs;Mr(e,Go,this.h);const n=new cs;Cn(n,2,\"mediapipe.tasks.vision.ObjectDetectorGraph\"),os(n,\"IMAGE:input_frame_gpu\"),os(n,\"NORM_RECT:norm_rect\"),as(n,\"DETECTIONS:detections\"),n.o(e),fs(t,n),this.g.attachProtoVectorListener(\"detections\",((t,e)=>{for(const e of t)t=ks(e),this.j.detections.push(Ko(t));pa(this,e)})),this.g.attachEmptyPacketListener(\"detections\",(t=>{pa(this,t)})),t=t.g(),this.setGraph(new Uint8Array(t),!0)}};Zc.prototype.detectForVideo=Zc.prototype.G,Zc.prototype.detect=Zc.prototype.F,Zc.prototype.setOptions=Zc.prototype.o,Zc.createFromModelPath=async function(t,e){return fc(Zc,t,{baseOptions:{modelAssetPath:e}})},Zc.createFromModelBuffer=function(t,e){return fc(Zc,t,{baseOptions:{modelAssetBuffer:e}})},Zc.createFromOptions=function(t,e){return fc(Zc,t,e)};var Qc=class{constructor(t,e,n){this.landmarks=t,this.worldLandmarks=e,this.segmentationMasks=n}close(){this.segmentationMasks?.forEach((t=>{t.close()}))}};function th(t){t.landmarks=[],t.worldLandmarks=[],t.segmentationMasks=void 0}function eh(t){try{const e=new Qc(t.landmarks,t.worldLandmarks,t.segmentationMasks);if(!t.u)return e;t.u(e)}finally{ya(t)}}Qc.prototype.close=Qc.prototype.close;var nh=class extends yc{constructor(t,e){super(new lc(t,e),\"image_in\",\"norm_rect\",!1),this.landmarks=[],this.worldLandmarks=[],this.outputSegmentationMasks=!1,kn(t=this.h=new jo,0,1,e=new Ks),this.A=new Eo,kn(this.h,0,3,this.A),this.j=new vo,kn(this.h,0,2,this.j),Mn(this.j,4,1),Pn(this.j,2,.5),Pn(this.A,2,.5),Pn(this.h,4,.5)}get baseOptions(){return wn(this.h,Ks,1)}set baseOptions(t){kn(this.h,0,1,t)}o(t){return\"numPoses\"in t&&Mn(this.j,4,t.numPoses??1),\"minPoseDetectionConfidence\"in t&&Pn(this.j,2,t.minPoseDetectionConfidence??.5),\"minTrackingConfidence\"in t&&Pn(this.h,4,t.minTrackingConfidence??.5),\"minPosePresenceConfidence\"in t&&Pn(this.A,2,t.minPosePresenceConfidence??.5),\"outputSegmentationMasks\"in t&&(this.outputSegmentationMasks=t.outputSegmentationMasks??!1),this.l(t)}F(t,e,n){const r=\"function\"!=typeof e?e:{};return this.u=\"function\"==typeof e?e:n,th(this),pc(this,t,r),eh(this)}G(t,e,n,r){const i=\"function\"!=typeof n?n:{};return this.u=\"function\"==typeof n?n:r,th(this),gc(this,t,i,e),eh(this)}m(){var t=new gs;ds(t,\"image_in\"),ds(t,\"norm_rect\"),ps(t,\"normalized_landmarks\"),ps(t,\"world_landmarks\"),ps(t,\"segmentation_masks\");const e=new rs;Mr(e,Vo,this.h);const n=new cs;Cn(n,2,\"mediapipe.tasks.vision.pose_landmarker.PoseLandmarkerGraph\"),os(n,\"IMAGE:image_in\"),os(n,\"NORM_RECT:norm_rect\"),as(n,\"NORM_LANDMARKS:normalized_landmarks\"),as(n,\"WORLD_LANDMARKS:world_landmarks\"),n.o(e),fs(t,n),ga(this,t),this.g.attachProtoVectorListener(\"normalized_landmarks\",((t,e)=>{this.landmarks=[];for(const e of t)t=Rs(e),this.landmarks.push(Yo(t));pa(this,e)})),this.g.attachEmptyPacketListener(\"normalized_landmarks\",(t=>{this.landmarks=[],pa(this,t)})),this.g.attachProtoVectorListener(\"world_landmarks\",((t,e)=>{this.worldLandmarks=[];for(const e of t)t=xs(e),this.worldLandmarks.push(qo(t));pa(this,e)})),this.g.attachEmptyPacketListener(\"world_landmarks\",(t=>{this.worldLandmarks=[],pa(this,t)})),this.outputSegmentationMasks&&(as(n,\"SEGMENTATION_MASK:segmentation_masks\"),ma(this,\"segmentation_masks\"),this.g.aa(\"segmentation_masks\",((t,e)=>{this.segmentationMasks=t.map((t=>mc(this,t,!0,!this.u))),pa(this,e)})),this.g.attachEmptyPacketListener(\"segmentation_masks\",(t=>{this.segmentationMasks=[],pa(this,t)}))),t=t.g(),this.setGraph(new Uint8Array(t),!0)}};nh.prototype.detectForVideo=nh.prototype.G,nh.prototype.detect=nh.prototype.F,nh.prototype.setOptions=nh.prototype.o,nh.createFromModelPath=function(t,e){return fc(nh,t,{baseOptions:{modelAssetPath:e}})},nh.createFromModelBuffer=function(t,e){return fc(nh,t,{baseOptions:{modelAssetBuffer:e}})},nh.createFromOptions=function(t,e){return fc(nh,t,e)},nh.POSE_CONNECTIONS=Dc;export{Ja as DrawingUtils,_c as FaceDetector,Ic as FaceLandmarker,na as FilesetResolver,Oc as GestureRecognizer,Uc as HandLandmarker,Vc as HolisticLandmarker,Xc as ImageClassifier,Hc as ImageEmbedder,qc as ImageSegmenter,Wc as ImageSegmenterResult,Jc as InteractiveSegmenter,$c as InteractiveSegmenterResult,oc as MPImage,Ga as MPMask,Zc as ObjectDetector,nh as PoseLandmarker,_a as TaskRunner,yc as VisionTaskRunner};\n//# sourceMappingURL=vision_bundle_mjs.js.map\n", "import {\r\n FilesetResolver,\r\n FaceLandmarker,\r\n FaceLandmarkerResult,\r\n} from \"@mediapipe/tasks-vision\";\r\n\r\nconst WASM_CDN =\r\n \"https://cdn.jsdelivr.net/npm/@mediapipe/tasks-vision@latest/wasm\";\r\nconst MODEL_URL =\r\n \"https://storage.googleapis.com/mediapipe-models/face_landmarker/face_landmarker/float16/latest/face_landmarker.task\";\r\n\r\nexport interface FaceDetectionResult {\r\n faceDetected: boolean;\r\n blendshapes: Map<string, number>;\r\n transformMatrix: number[] | null;\r\n}\r\n\r\nexport class FaceDetectorEngine {\r\n private landmarker: FaceLandmarker | null = null;\r\n\r\n async init(): Promise<void> {\r\n const vision = await FilesetResolver.forVisionTasks(WASM_CDN);\r\n\r\n // Fetch model ourselves to avoid MediaPipe internal path resolution issues\r\n const modelResponse = await fetch(MODEL_URL);\r\n if (!modelResponse.ok) {\r\n throw new Error(`Failed to download face model (${modelResponse.status})`);\r\n }\r\n const modelBuffer = await modelResponse.arrayBuffer();\r\n\r\n this.landmarker = await FaceLandmarker.createFromOptions(vision, {\r\n baseOptions: {\r\n modelAssetBuffer: new Uint8Array(modelBuffer),\r\n },\r\n runningMode: \"VIDEO\",\r\n outputFaceBlendshapes: true,\r\n outputFacialTransformationMatrixes: true,\r\n numFaces: 1,\r\n });\r\n }\r\n\r\n detect(video: HTMLVideoElement, timestamp: number): FaceDetectionResult {\r\n if (!this.landmarker) {\r\n return { faceDetected: false, blendshapes: new Map(), transformMatrix: null };\r\n }\r\n\r\n const result: FaceLandmarkerResult = this.landmarker.detectForVideo(\r\n video,\r\n timestamp\r\n );\r\n\r\n if (!result.faceBlendshapes || result.faceBlendshapes.length === 0) {\r\n return { faceDetected: false, blendshapes: new Map(), transformMatrix: null };\r\n }\r\n\r\n const blendshapes = new Map<string, number>();\r\n for (const bs of result.faceBlendshapes[0].categories) {\r\n blendshapes.set(bs.categoryName, bs.score);\r\n }\r\n\r\n const transformMatrix =\r\n result.facialTransformationMatrixes &&\r\n result.facialTransformationMatrixes.length > 0\r\n ? Array.from(result.facialTransformationMatrixes[0].data) as number[]\r\n : null;\r\n\r\n return { faceDetected: true, blendshapes, transformMatrix };\r\n }\r\n\r\n destroy(): void {\r\n if (this.landmarker) {\r\n this.landmarker.close();\r\n this.landmarker = null;\r\n }\r\n }\r\n}\r\n", "import { FaceDetectionResult } from \"./FaceDetector\";\r\n\r\nexport interface ActionState {\r\n action: string;\r\n detected: boolean;\r\n active: boolean;\r\n confidence: number;\r\n}\r\n\r\n/**\r\n * Per-action detection tuning.\r\n * - threshold : minimum confidence score required to start counting.\r\n * - holdFrames: consecutive frames above threshold before action is confirmed.\r\n *\r\n * BLINK is a fast reflex (~100-200ms) so we use a low threshold and only 2\r\n * frames. Head-turn and mouth-open are sustained movements so they need a\r\n * slightly longer hold to avoid false positives.\r\n */\r\nconst ACTION_CONFIGS: Record<string, { threshold: number; holdFrames: number }> = {\r\n BLINK: { threshold: 0.30, holdFrames: 2 },\r\n TURN_LEFT: { threshold: 0.45, holdFrames: 6 },\r\n TURN_RIGHT: { threshold: 0.45, holdFrames: 6 },\r\n TURN_HEAD: { threshold: 0.45, holdFrames: 6 },\r\n OPEN_MOUTH: { threshold: 0.40, holdFrames: 3 },\r\n};\r\nconst DEFAULT_CONFIG = { threshold: 0.55, holdFrames: 8 };\r\n\r\n/**\r\n * Sequential action detector aligned with backend's 5 UPPERCASE actions:\r\n * BLINK, TURN_LEFT, TURN_RIGHT, TURN_HEAD, OPEN_MOUTH\r\n */\r\nexport class ActionDetector {\r\n private completedActions = new Set<string>();\r\n private holdCounters = new Map<string, number>();\r\n\r\n constructor(private requiredActions: string[]) {}\r\n\r\n check(result: FaceDetectionResult): ActionState[] {\r\n const currentAction = this.getCurrentAction();\r\n\r\n if (!result.faceDetected) {\r\n return this.buildStates(currentAction, 0);\r\n }\r\n\r\n const bs = result.blendshapes;\r\n\r\n // Only check the current active action (sequential flow)\r\n if (currentAction && !this.completedActions.has(currentAction)) {\r\n const conf = this.getConfidence(currentAction, bs, result.transformMatrix);\r\n const cfg = ACTION_CONFIGS[currentAction] ?? DEFAULT_CONFIG;\r\n\r\n if (conf >= cfg.threshold) {\r\n const count = (this.holdCounters.get(currentAction) || 0) + 1;\r\n this.holdCounters.set(currentAction, count);\r\n\r\n if (count >= cfg.holdFrames) {\r\n this.completedActions.add(currentAction);\r\n this.holdCounters.delete(currentAction);\r\n }\r\n } else {\r\n this.holdCounters.set(currentAction, 0);\r\n }\r\n\r\n return this.buildStates(currentAction, conf);\r\n }\r\n\r\n return this.buildStates(currentAction, 0);\r\n }\r\n\r\n getCurrentAction(): string | null {\r\n for (const action of this.requiredActions) {\r\n if (!this.completedActions.has(action)) return action;\r\n }\r\n return null;\r\n }\r\n\r\n private buildStates(\r\n currentAction: string | null,\r\n currentConf: number\r\n ): ActionState[] {\r\n return this.requiredActions.map((action) => ({\r\n action,\r\n detected: this.completedActions.has(action),\r\n active: action === currentAction,\r\n confidence: action === currentAction ? currentConf : 0,\r\n }));\r\n }\r\n\r\n private getConfidence(\r\n action: string,\r\n bs: Map<string, number>,\r\n matrix: number[] | null\r\n ): number {\r\n switch (action) {\r\n case \"BLINK\": {\r\n const left = bs.get(\"eyeBlinkLeft\") || 0;\r\n const right = bs.get(\"eyeBlinkRight\") || 0;\r\n return (left + right) / 2;\r\n }\r\n\r\n case \"TURN_LEFT\": {\r\n const yaw = this.getHeadYaw(matrix);\r\n return yaw < -12 ? Math.min(1, Math.abs(yaw) / 30) : 0;\r\n }\r\n\r\n case \"TURN_RIGHT\": {\r\n const yaw = this.getHeadYaw(matrix);\r\n return yaw > 12 ? Math.min(1, yaw / 30) : 0;\r\n }\r\n\r\n case \"TURN_HEAD\": {\r\n // Any significant yaw (left OR right) counts\r\n const yaw = Math.abs(this.getHeadYaw(matrix));\r\n return yaw > 15 ? Math.min(1, yaw / 30) : 0;\r\n }\r\n\r\n case \"OPEN_MOUTH\":\r\n return bs.get(\"jawOpen\") || 0;\r\n\r\n default:\r\n return 0;\r\n }\r\n }\r\n\r\n private getHeadYaw(matrix: number[] | null): number {\r\n if (!matrix || matrix.length < 16) return 0;\r\n return Math.atan2(matrix[8], matrix[0]) * (180 / Math.PI);\r\n }\r\n\r\n allCompleted(): boolean {\r\n return this.requiredActions.every((a) => this.completedActions.has(a));\r\n }\r\n\r\n completedCount(): number {\r\n return this.completedActions.size;\r\n }\r\n\r\n reset(): void {\r\n this.completedActions.clear();\r\n this.holdCounters.clear();\r\n }\r\n}\r\n", "import { ActionState } from \"../../camera/ActionDetector\";\r\n\r\n/**\r\n * Icons for the 5 backend-supported challenge actions (UPPERCASE).\r\n */\r\nconst ICONS: Record<string, string> = {\r\n BLINK: \"\\uD83D\\uDE09\",\r\n TURN_LEFT: \"\\u2B05\",\r\n TURN_RIGHT: \"\\u27A1\",\r\n TURN_HEAD: \"\\uD83D\\uDE42\",\r\n OPEN_MOUTH: \"\\uD83D\\uDE2E\",\r\n};\r\n\r\n/**\r\n * Large animated SVG/HTML cues shown in the centre of the camera frame\r\n * so the user knows exactly what to do \u2014 like a real liveness test.\r\n */\r\nconst ACTION_CUES: Record<string, string> = {\r\n BLINK: `\r\n <div style=\"display:flex;flex-direction:column;align-items:center;gap:10px;\">\r\n <div style=\"font-size:64px;line-height:1;animation:sc-blink 1.2s ease-in-out infinite;\">\uD83D\uDC41\uFE0F</div>\r\n <div style=\"font-size:13px;font-weight:600;color:#fff;opacity:0.9;letter-spacing:0.5px;\">BLINK YOUR EYES</div>\r\n </div>`,\r\n TURN_LEFT: `\r\n <div style=\"display:flex;flex-direction:column;align-items:center;gap:10px;\">\r\n <div style=\"font-size:56px;line-height:1;animation:sc-slide-left 1s ease-in-out infinite;\">\u2B05\uFE0F</div>\r\n <div style=\"font-size:13px;font-weight:600;color:#fff;opacity:0.9;letter-spacing:0.5px;\">TURN HEAD LEFT</div>\r\n </div>`,\r\n TURN_RIGHT: `\r\n <div style=\"display:flex;flex-direction:column;align-items:center;gap:10px;\">\r\n <div style=\"font-size:56px;line-height:1;animation:sc-slide-right 1s ease-in-out infinite;\">\u27A1\uFE0F</div>\r\n <div style=\"font-size:13px;font-weight:600;color:#fff;opacity:0.9;letter-spacing:0.5px;\">TURN HEAD RIGHT</div>\r\n </div>`,\r\n TURN_HEAD: `\r\n <div style=\"display:flex;flex-direction:column;align-items:center;gap:10px;\">\r\n <div style=\"font-size:56px;line-height:1;animation:sc-turn-head 1.4s ease-in-out infinite;\">\u2194\uFE0F</div>\r\n <div style=\"font-size:13px;font-weight:600;color:#fff;opacity:0.9;letter-spacing:0.5px;\">TURN HEAD SIDE TO SIDE</div>\r\n </div>`,\r\n OPEN_MOUTH: `\r\n <div style=\"display:flex;flex-direction:column;align-items:center;gap:10px;\">\r\n <div style=\"font-size:64px;line-height:1;animation:sc-mouth 1.2s ease-in-out infinite;\">\uD83D\uDE2E</div>\r\n <div style=\"font-size:13px;font-weight:600;color:#fff;opacity:0.9;letter-spacing:0.5px;\">OPEN YOUR MOUTH</div>\r\n </div>`,\r\n};\r\n\r\n/** Keyframe CSS injected once */\r\nfunction injectLivenessKeyframes(): void {\r\n if (document.getElementById(\"sc-liveness-kf\")) return;\r\n const s = document.createElement(\"style\");\r\n s.id = \"sc-liveness-kf\";\r\n s.textContent = `\r\n @keyframes sc-blink {\r\n 0%,100% { transform:scaleY(1); }\r\n 40% { transform:scaleY(0.1); }\r\n 50% { transform:scaleY(1); }\r\n }\r\n @keyframes sc-slide-left {\r\n 0%,100% { transform:translateX(0); opacity:1; }\r\n 50% { transform:translateX(-14px); opacity:0.6; }\r\n }\r\n @keyframes sc-slide-right {\r\n 0%,100% { transform:translateX(0); opacity:1; }\r\n 50% { transform:translateX(14px); opacity:0.6; }\r\n }\r\n @keyframes sc-turn-head {\r\n 0%,100% { transform:translateX(0); }\r\n 25% { transform:translateX(-12px); }\r\n 75% { transform:translateX(12px); }\r\n }\r\n @keyframes sc-mouth {\r\n 0%,100% { transform:scaleY(1); }\r\n 40% { transform:scaleY(1.25); }\r\n 60% { transform:scaleY(1); }\r\n }\r\n @keyframes sc-pop-in {\r\n 0% { transform:scale(0.7); opacity:0; }\r\n 60% { transform:scale(1.05); }\r\n 100% { transform:scale(1); opacity:1; }\r\n }\r\n @keyframes sc-cue-fade {\r\n 0% { opacity:0; transform:translateY(8px); }\r\n 20% { opacity:1; transform:translateY(0); }\r\n 80% { opacity:1; transform:translateY(0); }\r\n 100% { opacity:0; transform:translateY(-8px); }\r\n }\r\n `;\r\n document.head.appendChild(s);\r\n}\r\n\r\n/**\r\n * Challenge shape used by LivenessUI.mount().\r\n */\r\nexport interface UIChallenge {\r\n actions: string[];\r\n time_limit_seconds: number;\r\n instruction: string;\r\n}\r\n\r\nexport class LivenessUI {\r\n private root: HTMLDivElement | null = null;\r\n private videoEl: HTMLVideoElement | null = null;\r\n private instructionEl: HTMLDivElement | null = null;\r\n private stepsEl: HTMLDivElement | null = null;\r\n private progressBarEl: HTMLDivElement | null = null;\r\n private confidenceRingEl: SVGCircleElement | null = null;\r\n private timerEl: HTMLDivElement | null = null;\r\n private overlayEl: HTMLDivElement | null = null;\r\n private actionCueEl: HTMLDivElement | null = null;\r\n private timerInterval: ReturnType<typeof setInterval> | null = null;\r\n private totalActions = 0;\r\n private currentCueAction: string | null = null;\r\n private docCaptureRoot: HTMLDivElement | null = null;\r\n\r\n mount(\r\n container: HTMLElement,\r\n challenge: UIChallenge\r\n ): HTMLVideoElement {\r\n injectLivenessKeyframes();\r\n this.totalActions = challenge.actions.length;\r\n\r\n this.root = document.createElement(\"div\");\r\n this.root.style.cssText = `\r\n position:relative;width:100%;max-width:420px;margin:0 auto;\r\n background:#0a0a0a;border-radius:16px;overflow:hidden;\r\n font-family:system-ui,-apple-system,sans-serif;\r\n box-shadow:0 8px 32px rgba(0,0,0,0.4);\r\n `;\r\n\r\n // Video\r\n this.videoEl = document.createElement(\"video\");\r\n this.videoEl.autoplay = true;\r\n this.videoEl.playsInline = true;\r\n this.videoEl.muted = true;\r\n this.videoEl.style.cssText =\r\n \"width:100%;display:block;transform:scaleX(-1);aspect-ratio:3/4;object-fit:cover;\";\r\n\r\n // Face guide \u2014 oval with confidence ring\r\n const guideWrap = document.createElement(\"div\");\r\n guideWrap.style.cssText = `\r\n position:absolute;top:8%;left:50%;transform:translateX(-50%);\r\n width:180px;height:240px;pointer-events:none;\r\n `;\r\n\r\n const svg = document.createElementNS(\"http://www.w3.org/2000/svg\", \"svg\");\r\n svg.setAttribute(\"viewBox\", \"0 0 180 240\");\r\n svg.style.cssText = \"width:100%;height:100%;\";\r\n\r\n // Background oval (guide)\r\n const bgOval = document.createElementNS(\r\n \"http://www.w3.org/2000/svg\",\r\n \"ellipse\"\r\n );\r\n bgOval.setAttribute(\"cx\", \"90\");\r\n bgOval.setAttribute(\"cy\", \"120\");\r\n bgOval.setAttribute(\"rx\", \"85\");\r\n bgOval.setAttribute(\"ry\", \"115\");\r\n bgOval.setAttribute(\"fill\", \"none\");\r\n bgOval.setAttribute(\"stroke\", \"rgba(255,255,255,0.25)\");\r\n bgOval.setAttribute(\"stroke-width\", \"2.5\");\r\n bgOval.setAttribute(\"stroke-dasharray\", \"8 4\");\r\n\r\n // Confidence progress ring\r\n const confOval = document.createElementNS(\r\n \"http://www.w3.org/2000/svg\",\r\n \"ellipse\"\r\n );\r\n confOval.setAttribute(\"cx\", \"90\");\r\n confOval.setAttribute(\"cy\", \"120\");\r\n confOval.setAttribute(\"rx\", \"85\");\r\n confOval.setAttribute(\"ry\", \"115\");\r\n confOval.setAttribute(\"fill\", \"none\");\r\n confOval.setAttribute(\"stroke\", \"#22c55e\");\r\n confOval.setAttribute(\"stroke-width\", \"3.5\");\r\n const circumference =\r\n 2 * Math.PI * Math.sqrt((85 * 85 + 115 * 115) / 2);\r\n confOval.setAttribute(\r\n \"stroke-dasharray\",\r\n `${circumference}`\r\n );\r\n confOval.setAttribute(\"stroke-dashoffset\", `${circumference}`);\r\n confOval.style.cssText =\r\n \"transition:stroke-dashoffset 0.15s ease;transform:rotate(-90deg);transform-origin:90px 120px;\";\r\n this.confidenceRingEl = confOval as unknown as SVGCircleElement;\r\n\r\n svg.appendChild(bgOval);\r\n svg.appendChild(confOval);\r\n guideWrap.appendChild(svg);\r\n\r\n // Top bar \u2014 instruction\r\n const topBar = document.createElement(\"div\");\r\n topBar.style.cssText = `\r\n position:absolute;top:0;left:0;right:0;\r\n background:linear-gradient(180deg,rgba(0,0,0,0.7) 0%,transparent 100%);\r\n padding:16px 16px 32px;\r\n `;\r\n\r\n this.instructionEl = document.createElement(\"div\");\r\n this.instructionEl.style.cssText = `\r\n color:#fff;font-size:15px;font-weight:600;text-align:center;\r\n line-height:1.4;\r\n `;\r\n this.instructionEl.textContent = challenge.instruction;\r\n topBar.appendChild(this.instructionEl);\r\n\r\n // Bottom panel\r\n const bottomPanel = document.createElement(\"div\");\r\n bottomPanel.style.cssText = `\r\n position:absolute;bottom:0;left:0;right:0;\r\n background:linear-gradient(0deg,rgba(0,0,0,0.85) 0%,rgba(0,0,0,0.6) 60%,transparent 100%);\r\n padding:24px 16px 16px;\r\n `;\r\n\r\n // Progress bar\r\n const progressWrap = document.createElement(\"div\");\r\n progressWrap.style.cssText = `\r\n height:3px;background:rgba(255,255,255,0.15);border-radius:2px;\r\n margin-bottom:14px;overflow:hidden;\r\n `;\r\n this.progressBarEl = document.createElement(\"div\");\r\n this.progressBarEl.style.cssText = `\r\n height:100%;width:0%;background:linear-gradient(90deg,#22c55e,#4ade80);\r\n border-radius:2px;transition:width 0.4s ease;\r\n `;\r\n progressWrap.appendChild(this.progressBarEl);\r\n bottomPanel.appendChild(progressWrap);\r\n\r\n // Steps list\r\n this.stepsEl = document.createElement(\"div\");\r\n this.stepsEl.style.cssText = `\r\n display:flex;flex-direction:column;gap:8px;margin-bottom:12px;\r\n `;\r\n\r\n for (let i = 0; i < challenge.actions.length; i++) {\r\n const action = challenge.actions[i];\r\n const step = document.createElement(\"div\");\r\n step.dataset.action = action;\r\n step.style.cssText = `\r\n display:flex;align-items:center;gap:10px;\r\n padding:8px 12px;border-radius:10px;\r\n background:rgba(255,255,255,0.06);\r\n transition:all 0.3s ease;\r\n opacity:${i === 0 ? \"1\" : \"0.4\"};\r\n `;\r\n\r\n const num = document.createElement(\"div\");\r\n num.className = \"sc-step-num\";\r\n num.style.cssText = `\r\n width:28px;height:28px;border-radius:50%;\r\n display:flex;align-items:center;justify-content:center;\r\n font-size:13px;font-weight:700;color:#fff;\r\n background:rgba(255,255,255,0.12);\r\n border:2px solid rgba(255,255,255,0.2);\r\n transition:all 0.3s ease;flex-shrink:0;\r\n `;\r\n num.textContent = String(i + 1);\r\n\r\n const label = document.createElement(\"div\");\r\n label.style.cssText = \"color:#fff;font-size:13px;flex:1;\";\r\n label.textContent = this.describeAction(action);\r\n\r\n const icon = document.createElement(\"div\");\r\n icon.className = \"sc-step-icon\";\r\n icon.style.cssText = \"font-size:18px;flex-shrink:0;\";\r\n icon.textContent = ICONS[action] || \"\";\r\n\r\n step.appendChild(num);\r\n step.appendChild(label);\r\n step.appendChild(icon);\r\n this.stepsEl.appendChild(step);\r\n }\r\n\r\n bottomPanel.appendChild(this.stepsEl);\r\n\r\n // Timer\r\n this.timerEl = document.createElement(\"div\");\r\n this.timerEl.style.cssText = `\r\n text-align:center;color:rgba(255,255,255,0.5);\r\n font-size:11px;font-variant-numeric:tabular-nums;\r\n `;\r\n bottomPanel.appendChild(this.timerEl);\r\n\r\n // Result overlay (used for success / failure / timeout)\r\n this.overlayEl = document.createElement(\"div\");\r\n this.overlayEl.style.cssText = `\r\n position:absolute;inset:0;display:none;align-items:center;\r\n justify-content:center;z-index:10;\r\n background:rgba(0,0,0,0.85);backdrop-filter:blur(8px);\r\n transition:opacity 0.3s ease;\r\n `;\r\n\r\n // Action cue \u2014 large centred animation shown when an action is active\r\n this.actionCueEl = document.createElement(\"div\");\r\n this.actionCueEl.style.cssText = `\r\n position:absolute;\r\n top:50%;left:50%;transform:translate(-50%,-50%);\r\n z-index:5;pointer-events:none;\r\n display:none;\r\n text-align:center;\r\n background:rgba(0,0,0,0.55);\r\n backdrop-filter:blur(4px);\r\n border-radius:20px;\r\n padding:18px 28px;\r\n min-width:160px;\r\n border:1.5px solid rgba(255,255,255,0.15);\r\n `;\r\n\r\n // Assemble\r\n this.root.appendChild(this.videoEl);\r\n this.root.appendChild(guideWrap);\r\n this.root.appendChild(topBar);\r\n this.root.appendChild(bottomPanel);\r\n this.root.appendChild(this.actionCueEl);\r\n this.root.appendChild(this.overlayEl);\r\n\r\n container.appendChild(this.root);\r\n this.startTimer(challenge.time_limit_seconds);\r\n\r\n return this.videoEl;\r\n }\r\n\r\n updateActions(states: ActionState[]): void {\r\n if (!this.stepsEl || !this.progressBarEl) return;\r\n\r\n let completed = 0;\r\n const activeState = states.find((s) => s.active && !s.detected) ?? null;\r\n const activeAction = activeState?.action ?? null;\r\n\r\n for (const state of states) {\r\n const step = this.stepsEl.querySelector(\r\n `[data-action=\"${state.action}\"]`\r\n ) as HTMLDivElement | null;\r\n if (!step) continue;\r\n\r\n const num = step.querySelector(\".sc-step-num\") as HTMLElement | null;\r\n\r\n if (state.detected) {\r\n completed++;\r\n step.style.opacity = \"1\";\r\n step.style.background = \"rgba(34,197,94,0.15)\";\r\n if (num) {\r\n num.style.background = \"#22c55e\";\r\n num.style.borderColor = \"#22c55e\";\r\n num.textContent = \"\\u2713\";\r\n }\r\n } else if (state.active) {\r\n step.style.opacity = \"1\";\r\n step.style.background = \"rgba(59,130,246,0.15)\";\r\n if (num) {\r\n num.style.borderColor = \"#3b82f6\";\r\n num.style.background = \"rgba(59,130,246,0.3)\";\r\n }\r\n }\r\n }\r\n\r\n // Update progress bar\r\n const pct = this.totalActions > 0 ? (completed / this.totalActions) * 100 : 0;\r\n this.progressBarEl.style.width = `${pct}%`;\r\n\r\n // Update confidence ring for the active action\r\n if (this.confidenceRingEl) {\r\n const circumference =\r\n 2 * Math.PI * Math.sqrt((85 * 85 + 115 * 115) / 2);\r\n const conf = activeState ? activeState.confidence : 0;\r\n const offset = circumference * (1 - conf);\r\n this.confidenceRingEl.setAttribute(\"stroke-dashoffset\", `${offset}`);\r\n this.confidenceRingEl.setAttribute(\r\n \"stroke\",\r\n conf > 0.6 ? \"#22c55e\" : \"#3b82f6\"\r\n );\r\n }\r\n\r\n // Show / switch large animated action cue\r\n this.updateActionCue(activeAction);\r\n }\r\n\r\n private updateActionCue(action: string | null): void {\r\n if (!this.actionCueEl) return;\r\n\r\n // No active action \u2192 hide cue\r\n if (!action) {\r\n this.actionCueEl.style.display = \"none\";\r\n this.currentCueAction = null;\r\n return;\r\n }\r\n\r\n // Same action already showing \u2014 no DOM thrash\r\n if (action === this.currentCueAction) return;\r\n\r\n this.currentCueAction = action;\r\n const cueHtml = ACTION_CUES[action];\r\n if (!cueHtml) {\r\n this.actionCueEl.style.display = \"none\";\r\n return;\r\n }\r\n\r\n // Inject content and animate in\r\n this.actionCueEl.innerHTML = cueHtml;\r\n this.actionCueEl.style.display = \"block\";\r\n this.actionCueEl.style.animation = \"none\";\r\n // Force reflow then trigger animation\r\n void this.actionCueEl.offsetWidth;\r\n this.actionCueEl.style.animation = \"sc-pop-in 0.3s ease forwards\";\r\n }\r\n\r\n updateInstruction(text: string): void {\r\n if (this.instructionEl) {\r\n this.instructionEl.textContent = text;\r\n }\r\n }\r\n\r\n stopTimer(): void {\r\n if (this.timerInterval) {\r\n clearInterval(this.timerInterval);\r\n this.timerInterval = null;\r\n }\r\n if (this.timerEl) {\r\n this.timerEl.textContent = \"\";\r\n }\r\n }\r\n\r\n showResult(status: \"processing\" | \"failed\", verificationId?: number): Promise<void> {\r\n return new Promise((resolve) => {\r\n if (!this.overlayEl) { resolve(); return; }\r\n\r\n if (this.actionCueEl) this.actionCueEl.style.display = \"none\";\r\n this.stopTimer();\r\n\r\n const isProcessing = status === \"processing\";\r\n this.overlayEl.style.display = \"flex\";\r\n\r\n this.overlayEl.innerHTML = `\r\n <div style=\"text-align:center;color:#fff;animation:sc-pop-in 0.35s ease;padding:24px;\">\r\n <div style=\"\r\n width:80px;height:80px;border-radius:50%;margin:0 auto 20px;\r\n display:flex;align-items:center;justify-content:center;\r\n font-size:36px;\r\n background:${isProcessing ? \"rgba(34,197,94,0.2)\" : \"rgba(239,68,68,0.2)\"};\r\n border:3px solid ${isProcessing ? \"#22c55e\" : \"#ef4444\"};\r\n \">${isProcessing ? \"\\u2713\" : \"\\u2717\"}</div>\r\n <div style=\"font-size:19px;font-weight:700;margin-bottom:8px;\">\r\n ${isProcessing ? \"Identity Check Submitted\" : \"Submission Failed\"}\r\n </div>\r\n <div style=\"font-size:13px;opacity:0.65;line-height:1.6;margin-bottom:${verificationId ? \"16px\" : \"0\"};\">\r\n ${isProcessing\r\n ? \"Your identity is being verified.<br>You\\'ll be notified of the outcome shortly.\"\r\n : \"Something went wrong. Please try again.\"}\r\n </div>\r\n ${verificationId ? `\r\n <div style=\"\r\n margin-top:4px;padding:8px 14px;border-radius:8px;\r\n background:rgba(255,255,255,0.08);display:inline-block;\r\n font-size:11px;color:rgba(255,255,255,0.5);letter-spacing:0.3px;\r\n \">Ref: #${verificationId}</div>` : \"\"}\r\n </div>\r\n `;\r\n\r\n setTimeout(resolve, 2800);\r\n });\r\n }\r\n\r\n /**\r\n * Show timeout screen with an optional retry callback.\r\n * Resolves immediately so the orchestrator can move to next step.\r\n */\r\n showTimeout(onRetry: () => void): Promise<void> {\r\n return new Promise((resolve) => {\r\n if (!this.overlayEl) { resolve(); return; }\r\n\r\n if (this.actionCueEl) this.actionCueEl.style.display = \"none\";\r\n this.stopTimer();\r\n\r\n this.overlayEl.style.display = \"flex\";\r\n this.overlayEl.innerHTML = `\r\n <div style=\"text-align:center;color:#fff;animation:sc-pop-in 0.35s ease;padding:24px;\">\r\n <div style=\"\r\n width:80px;height:80px;border-radius:50%;margin:0 auto 16px;\r\n display:flex;align-items:center;justify-content:center;\r\n font-size:36px;\r\n background:rgba(251,191,36,0.15);\r\n border:3px solid #fbbf24;\r\n \">\u23F1</div>\r\n <div style=\"font-size:18px;font-weight:700;margin-bottom:8px;\">Time's Up</div>\r\n <div style=\"font-size:13px;opacity:0.65;margin-bottom:20px;\">\r\n You ran out of time. Please try again.\r\n </div>\r\n <button id=\"sc-retry-btn\" style=\"\r\n padding:12px 28px;border-radius:10px;\r\n background:#3b82f6;color:#fff;\r\n border:none;cursor:pointer;\r\n font-size:14px;font-weight:600;\r\n width:100%;max-width:200px;\r\n \">Try Again</button>\r\n </div>\r\n `;\r\n\r\n // Wire retry button\r\n const retryBtn = this.overlayEl.querySelector(\"#sc-retry-btn\") as HTMLButtonElement | null;\r\n if (retryBtn) {\r\n retryBtn.addEventListener(\"click\", () => {\r\n onRetry();\r\n resolve();\r\n });\r\n } else {\r\n // fallback \u2014 auto-resolve after 5s\r\n setTimeout(resolve, 5000);\r\n }\r\n });\r\n }\r\n\r\n getVideoElement(): HTMLVideoElement | null {\r\n return this.videoEl;\r\n }\r\n\r\n /**\r\n * Mount a document scanning step before the liveness challenge.\r\n * Reuses the already-open camera stream \u2014 no second permission prompt.\r\n * Resolves with the captured document Blob.\r\n */\r\n mountDocumentCapture(container: HTMLElement, stream: MediaStream): Promise<Blob> {\r\n return new Promise((resolve, reject) => {\r\n injectLivenessKeyframes();\r\n\r\n const docRoot = document.createElement(\"div\");\r\n docRoot.style.cssText = `\r\n position:relative;width:100%;max-width:420px;margin:0 auto;\r\n background:#0a0a0a;border-radius:16px;overflow:hidden;\r\n font-family:system-ui,-apple-system,sans-serif;\r\n box-shadow:0 8px 32px rgba(0,0,0,0.4);\r\n `;\r\n this.docCaptureRoot = docRoot;\r\n\r\n const docVideo = document.createElement(\"video\");\r\n docVideo.autoplay = true;\r\n docVideo.playsInline = true;\r\n docVideo.muted = true;\r\n docVideo.style.cssText = \"width:100%;display:block;aspect-ratio:4/3;object-fit:cover;\";\r\n docVideo.srcObject = stream;\r\n\r\n // Rectangle guide with blue corner accents\r\n const guideOverlay = document.createElement(\"div\");\r\n guideOverlay.style.cssText = \"position:absolute;inset:0;pointer-events:none;display:flex;align-items:center;justify-content:center;\";\r\n guideOverlay.innerHTML = `\r\n <div style=\"width:83%;height:53%;border:2px dashed rgba(255,255,255,0.55);border-radius:10px;box-shadow:0 0 0 2000px rgba(0,0,0,0.45);position:relative;\">\r\n <div style=\"position:absolute;top:-2px;left:-2px;width:18px;height:18px;border-top:3px solid #3b82f6;border-left:3px solid #3b82f6;border-radius:4px 0 0 0;\"></div>\r\n <div style=\"position:absolute;top:-2px;right:-2px;width:18px;height:18px;border-top:3px solid #3b82f6;border-right:3px solid #3b82f6;border-radius:0 4px 0 0;\"></div>\r\n <div style=\"position:absolute;bottom:-2px;left:-2px;width:18px;height:18px;border-bottom:3px solid #3b82f6;border-left:3px solid #3b82f6;border-radius:0 0 0 4px;\"></div>\r\n <div style=\"position:absolute;bottom:-2px;right:-2px;width:18px;height:18px;border-bottom:3px solid #3b82f6;border-right:3px solid #3b82f6;border-radius:0 0 4px 0;\"></div>\r\n </div>\r\n `;\r\n\r\n const header = document.createElement(\"div\");\r\n header.style.cssText = \"position:absolute;top:0;left:0;right:0;background:linear-gradient(180deg,rgba(0,0,0,0.88) 0%,transparent 100%);padding:18px 16px 40px;text-align:center;\";\r\n header.innerHTML = `\r\n <div style=\"color:#fff;font-size:16px;font-weight:700;margin-bottom:6px;\">Scan Your ID Document</div>\r\n <div style=\"color:rgba(255,255,255,0.6);font-size:12px;line-height:1.6;\">\r\n Fit your document inside the frame.<br>Make sure all text and corners are visible.\r\n </div>\r\n `;\r\n\r\n const bottomPanel = document.createElement(\"div\");\r\n bottomPanel.style.cssText = \"position:absolute;bottom:0;left:0;right:0;background:linear-gradient(0deg,rgba(0,0,0,0.92) 0%,rgba(0,0,0,0.6) 70%,transparent 100%);padding:16px 16px;\";\r\n bottomPanel.innerHTML = `\r\n <div style=\"font-size:11px;color:rgba(255,255,255,0.4);text-align:center;margin-bottom:12px;\">\r\n \uD83D\uDCA1 Good lighting \u00B7 No glare \u00B7 All 4 corners visible\r\n </div>\r\n <button id=\"sc-capture-doc-btn\" style=\"width:100%;padding:12px;border-radius:12px;background:#3b82f6;color:#fff;border:none;cursor:pointer;font-size:15px;font-weight:700;margin-bottom:8px;\">\r\n Capture Document\r\n </button>\r\n <label style=\"width:100%;display:flex;align-items:center;justify-content:center;gap:6px;padding:9px;border-radius:12px;border:1.5px solid rgba(255,255,255,0.18);cursor:pointer;color:rgba(255,255,255,0.6);font-size:13px;font-weight:500;\">\r\n <span>\uD83D\uDCC1</span><span>Upload from gallery instead</span>\r\n <input id=\"sc-upload-doc-input\" type=\"file\" accept=\"image/*\" style=\"display:none;\" />\r\n </label>\r\n `;\r\n\r\n docRoot.appendChild(docVideo);\r\n docRoot.appendChild(guideOverlay);\r\n docRoot.appendChild(header);\r\n docRoot.appendChild(bottomPanel);\r\n container.appendChild(docRoot);\r\n\r\n docVideo.play().catch(() => {});\r\n\r\n const cleanup = () => {\r\n if (docRoot.parentElement) docRoot.parentElement.removeChild(docRoot);\r\n this.docCaptureRoot = null;\r\n };\r\n\r\n const captureBtn = bottomPanel.querySelector(\"#sc-capture-doc-btn\") as HTMLButtonElement;\r\n if (captureBtn) {\r\n captureBtn.addEventListener(\"click\", () => {\r\n try {\r\n const canvas = document.createElement(\"canvas\");\r\n canvas.width = docVideo.videoWidth || 1280;\r\n canvas.height = docVideo.videoHeight || 720;\r\n const ctx = canvas.getContext(\"2d\");\r\n if (!ctx) { reject(new Error(\"Canvas context unavailable\")); return; }\r\n ctx.drawImage(docVideo, 0, 0);\r\n canvas.toBlob((blob) => {\r\n if (blob) { cleanup(); resolve(blob); }\r\n else { reject(new Error(\"Failed to capture document image\")); }\r\n }, \"image/jpeg\", 0.92);\r\n } catch (err) { reject(err); }\r\n });\r\n }\r\n\r\n const uploadInput = bottomPanel.querySelector(\"#sc-upload-doc-input\") as HTMLInputElement;\r\n if (uploadInput) {\r\n uploadInput.addEventListener(\"change\", () => {\r\n const file = uploadInput.files?.[0];\r\n if (file) { cleanup(); resolve(file); }\r\n });\r\n }\r\n });\r\n }\r\n\r\n unmount(): void {\r\n this.stopTimer();\r\n if (this.docCaptureRoot && this.docCaptureRoot.parentElement) {\r\n this.docCaptureRoot.parentElement.removeChild(this.docCaptureRoot);\r\n this.docCaptureRoot = null;\r\n }\r\n if (this.root && this.root.parentElement) {\r\n this.root.parentElement.removeChild(this.root);\r\n }\r\n this.root = null;\r\n this.videoEl = null;\r\n this.instructionEl = null;\r\n this.stepsEl = null;\r\n this.progressBarEl = null;\r\n this.confidenceRingEl = null;\r\n this.timerEl = null;\r\n this.overlayEl = null;\r\n this.actionCueEl = null;\r\n }\r\n\r\n private startTimer(seconds: number): void {\r\n let remaining = seconds;\r\n\r\n const update = () => {\r\n if (!this.timerEl) return;\r\n const m = Math.floor(remaining / 60);\r\n const s = remaining % 60;\r\n const display = m > 0 ? `${m}:${String(s).padStart(2, \"0\")}` : `${s}s`;\r\n this.timerEl.textContent = `${display} remaining`;\r\n\r\n if (remaining <= 5) {\r\n this.timerEl.style.color = \"#ef4444\";\r\n }\r\n };\r\n\r\n update();\r\n this.timerInterval = setInterval(() => {\r\n remaining--;\r\n update();\r\n if (remaining <= 0 && this.timerInterval) {\r\n clearInterval(this.timerInterval);\r\n }\r\n }, 1000);\r\n }\r\n\r\n private describeAction(action: string): string {\r\n const labels: Record<string, string> = {\r\n BLINK: \"Blink your eyes\",\r\n TURN_LEFT: \"Turn your head left\",\r\n TURN_RIGHT: \"Turn your head right\",\r\n TURN_HEAD: \"Turn your head side to side\",\r\n OPEN_MOUTH: \"Open your mouth wide\",\r\n };\r\n return labels[action] || action.replace(/_/g, \" \").toLowerCase();\r\n }\r\n}\r\n", "import { HttpClient } from \"../../client/HttpClient\";\r\nimport {\r\n ChallengeAction,\r\n LivenessCreateRequest,\r\n LivenessCreateResponse,\r\n LivenessSubmitResponse,\r\n} from \"../../types/liveness\";\r\nimport { collectDeviceMetadata } from \"../../utils/device\";\r\nimport { CameraManager } from \"../../camera/CameraManager\";\r\nimport { VideoRecorder } from \"../../camera/VideoRecorder\";\r\nimport { FaceDetectorEngine } from \"../../camera/FaceDetector\";\r\nimport { ActionDetector } from \"../../camera/ActionDetector\";\r\nimport { LivenessUI } from \"./LivenessUI\";\r\n\r\n/**\r\n * Liveness module \u2014 3-step flow aligned with Adhere backend.\r\n *\r\n * Flow:\r\n * Step 1: liveness.create() \u2192 POST /v1/liveness/create/ (multipart)\r\n * Step 2: [camera runs, user performs challenge actions]\r\n * Step 3: liveness.submit() \u2192 POST /v1/liveness/submit/ (multipart)\r\n *\r\n * After submit, the backend returns status: \"processing\".\r\n * Final results are delivered via webhook (liveness.completed event).\r\n */\r\nexport class LivenessModule {\r\n constructor(private http: HttpClient) { }\r\n\r\n /**\r\n * Step 1: Create a liveness challenge entry.\r\n *\r\n * POST /v1/liveness/create/\r\n * Auth: x-access-token: <sessionToken>\r\n * Content-Type: multipart/form-data\r\n */\r\n async create(params: LivenessCreateRequest): Promise<LivenessCreateResponse> {\r\n const formData = new FormData();\r\n formData.append(\"identifier\", params.identifier);\r\n formData.append(\"identifier_type\", params.identifier_type);\r\n formData.append(\"country\", params.country);\r\n formData.append(\r\n \"challenge_actions\",\r\n JSON.stringify(params.challenge_actions)\r\n );\r\n if (params.autoshot_file) {\r\n formData.append(\"autoshot\", params.autoshot_file, \"autoshot.jpg\");\r\n }\r\n \r\n // Handle document upload - support both legacy and new front/back fields\r\n if (params.document) {\r\n formData.append(\"document\", params.document, \"document.jpg\");\r\n if (params.document_back) {\r\n formData.append(\"document_back\", params.document_back, \"document_back.jpg\");\r\n }\r\n } else if (params.document_front) {\r\n // Legacy support - map to document for backward compatibility\r\n formData.append(\"document\", params.document_front, \"document_front.jpg\");\r\n if (params.document_back) {\r\n formData.append(\"document_back\", params.document_back, \"document_back.jpg\");\r\n }\r\n } else if (params.id_file) {\r\n // Legacy support - map to document for backward compatibility\r\n formData.append(\"document\", params.id_file, \"id_document.jpg\");\r\n }\r\n \r\n if (params.identity_check) {\r\n formData.append(\"identity_check\", String(params.identity_check));\r\n }\r\n if (params.snapshot_file) {\r\n formData.append(\"snapshot\", params.snapshot_file, \"snapshot.jpg\");\r\n }\r\n if (params.device_type) {\r\n formData.append(\"device_type\", params.device_type);\r\n }\r\n if (params.os_name) {\r\n formData.append(\"os_name\", params.os_name);\r\n }\r\n if (params.browser_timezone) {\r\n formData.append(\"browser_timezone\", params.browser_timezone);\r\n }\r\n if (params.fingerprint_id) {\r\n formData.append(\"fingerprint_id\", params.fingerprint_id);\r\n }\r\n\r\n return this.http.uploadWithSession<LivenessCreateResponse>(\r\n \"/v1/liveness/create/\",\r\n formData\r\n );\r\n }\r\n\r\n /**\r\n * Step 3: Submit liveness video recording.\r\n *\r\n * POST /v1/liveness/submit/\r\n * Auth: x-access-token: <sessionToken>\r\n * Content-Type: multipart/form-data\r\n *\r\n * Note: After submission, the session is revoked (single-use).\r\n * The backend returns status: \"processing\" \u2014 results come via webhook.\r\n */\r\n async submit(\r\n entryId: number,\r\n videoBlob: Blob,\r\n snapshotBlob: Blob,\r\n autoshotBlob?: Blob,\r\n videoDurationSeconds?: number,\r\n videoSizeBytes?: number\r\n ): Promise<LivenessSubmitResponse> {\r\n const formData = new FormData();\r\n formData.append(\"entry\", String(entryId));\r\n formData.append(\"video\", videoBlob, \"liveness.webm\");\r\n formData.append(\"snapshot\", snapshotBlob, \"snapshot.jpg\");\r\n if (autoshotBlob) {\r\n formData.append(\"autoshot\", autoshotBlob, \"autoshot.jpg\");\r\n }\r\n if (videoDurationSeconds !== undefined) {\r\n formData.append(\"video_duration_seconds\", String(videoDurationSeconds));\r\n }\r\n if (videoSizeBytes !== undefined) {\r\n formData.append(\"video_size_bytes\", String(videoSizeBytes));\r\n }\r\n\r\n return this.http.uploadWithSession<LivenessSubmitResponse>(\r\n \"/v1/liveness/submit/\",\r\n formData\r\n );\r\n }\r\n\r\n /**\r\n * Poll the public SDK status endpoint for the final verification result.\r\n * Safe to call after the session has been revoked (no auth required).\r\n *\r\n * GET /v1/liveness/<entryId>/sdk-result/\r\n */\r\n async pollResult(entryId: number): Promise<{\r\n id: number;\r\n status: string;\r\n failure_reason: string | null;\r\n completed_at: string | null;\r\n }> {\r\n return (this.http as any).publicGet(`/v1/liveness/${entryId}/sdk-result/`);\r\n }\r\n\r\n /**\r\n * Full liveness check \u2014 orchestrates the entire flow:\r\n *\r\n * 1. Take autoshot selfie from camera\r\n * 2. Create liveness entry on backend (with challenge actions + selfie + optional doc)\r\n * 3. Run action detection loop (camera + MediaPipe)\r\n * 4. Record video and submit to backend\r\n * 5. Return submit response (status: \"processing\")\r\n *\r\n * @param container - DOM element to mount the liveness UI into\r\n * @param params - identifier info and optional document image\r\n * @param actions - override challenge actions (default: BLINK, TURN_LEFT, OPEN_MOUTH)\r\n */\r\n async startCheck(\r\n container: HTMLElement,\r\n params: {\r\n identifier: string;\r\n identifier_type: string;\r\n country: string;\r\n id_file?: File | Blob; // Legacy support\r\n document?: File | Blob; // Front document field (matches backend)\r\n document_front?: File | Blob; // Legacy support for backward compatibility\r\n document_back?: File | Blob; // Back document field (optional)\r\n identity_check?: number;\r\n verification_type?: \"data_verification\" | \"document_verification\" | \"liveness_only\";\r\n },\r\n actions?: ChallengeAction[],\r\n existingEntryId?: number\r\n ): Promise<LivenessSubmitResponse> {\r\n const camera = new CameraManager();\r\n const recorder = new VideoRecorder();\r\n const faceEngine = new FaceDetectorEngine();\r\n const ui = new LivenessUI();\r\n\r\n // Tracks whether cleanup has already been called (so the finally block\r\n // doesn't double-destroy when retry takes over).\r\n let cleanedUp = false;\r\n const cleanup = () => {\r\n if (cleanedUp) return;\r\n cleanedUp = true;\r\n faceEngine.destroy();\r\n camera.stop();\r\n ui.unmount();\r\n };\r\n\r\n try {\r\n // 1. Open camera (with permission error handling)\r\n let stream: MediaStream;\r\n try {\r\n stream = await camera.open();\r\n } catch (camErr: any) {\r\n if (camErr.name === \"NotAllowedError\" || camErr.name === \"PermissionDeniedError\") {\r\n throw new Error(\"Camera access denied. Please allow camera permission in your browser settings and try again.\");\r\n }\r\n if (camErr.name === \"NotFoundError\" || camErr.name === \"DevicesNotFoundError\") {\r\n throw new Error(\"No camera found. Please connect a camera and try again.\");\r\n }\r\n throw new Error(`Camera error: ${camErr.message || \"Unable to access camera\"}`);\r\n }\r\n\r\n // 2. Document capture step \u2014 document_verification only, when no id_file pre-supplied\r\n let capturedDocBlob: Blob | undefined = params.id_file as Blob | undefined;\r\n if (!capturedDocBlob && params.verification_type === \"document_verification\") {\r\n capturedDocBlob = await ui.mountDocumentCapture(container, stream);\r\n }\r\n\r\n // 3. Create a temporary video element to capture autoshot\r\n const tempVideo = document.createElement(\"video\");\r\n tempVideo.srcObject = stream;\r\n tempVideo.muted = true;\r\n tempVideo.playsInline = true;\r\n await tempVideo.play();\r\n\r\n // Wait for face to be detected before capturing autoshot\r\n ui.mount(container, { actions: [], time_limit_seconds: 0, instruction: \"Centre your face in the oval\" });\r\n const uiVideo = ui.getVideoElement();\r\n if (uiVideo) {\r\n uiVideo.srcObject = stream;\r\n await uiVideo.play();\r\n } else {\r\n tempVideo.style.cssText = \"width:100%;border-radius:12px;transform:scaleX(-1);\";\r\n container.appendChild(tempVideo);\r\n }\r\n\r\n await faceEngine.init();\r\n ui.updateInstruction(\"Centre your face in the oval\");\r\n\r\n // Wait until face is stably centred (5 consecutive detected frames, max 12 s)\r\n const videoForDetection = uiVideo || tempVideo;\r\n await new Promise<void>((resolve) => {\r\n let attempts = 0;\r\n let stableFrames = 0;\r\n const STABLE_REQUIRED = 5;\r\n const maxAttempts = 120; // 12 seconds at 100ms intervals\r\n const checkFace = () => {\r\n attempts++;\r\n if (videoForDetection.readyState >= 2) {\r\n const detection = faceEngine.detect(videoForDetection, performance.now());\r\n if (detection.faceDetected) {\r\n stableFrames++;\r\n if (stableFrames >= STABLE_REQUIRED) {\r\n resolve();\r\n return;\r\n }\r\n } else {\r\n stableFrames = 0; // reset on any lost-face frame\r\n ui.updateInstruction(\"Move your face into the oval\");\r\n }\r\n }\r\n if (attempts >= maxAttempts) {\r\n resolve(); // proceed anyway after timeout\r\n return;\r\n }\r\n setTimeout(checkFace, 100);\r\n };\r\n checkFace();\r\n });\r\n\r\n ui.updateInstruction(\"Hold still \u2014 capturing your selfie...\");\r\n await new Promise((r) => setTimeout(r, 700)); // wait for camera auto-focus\r\n\r\n // 3. Capture autoshot (selfie) \u2014 face stable, camera focused\r\n const autoshotBlob = await this.captureFrame(videoForDetection);\r\n tempVideo.pause();\r\n\r\n // Validate autoshot blob is not empty\r\n if (!autoshotBlob || autoshotBlob.size === 0) {\r\n throw new Error(\"Failed to capture autoshot selfie. Please ensure camera is working.\");\r\n }\r\n\r\n // 4. Create liveness entry on backend (skip if retrying with existing entry)\r\n const challengeActions = actions || [\"BLINK\", \"TURN_LEFT\", \"OPEN_MOUTH\"];\r\n let entry: LivenessCreateResponse;\r\n\r\n if (existingEntryId) {\r\n // Reuse existing entry on retry (D1: prevent duplicate wallet charges)\r\n entry = { id: existingEntryId, challenge_actions: challengeActions, status: \"pending\", client_id: \"\", expires_at: null };\r\n } else {\r\n const deviceMeta = collectDeviceMetadata();\r\n entry = await this.create({\r\n identifier: params.identifier,\r\n identifier_type: params.identifier_type,\r\n country: params.country,\r\n challenge_actions: challengeActions,\r\n autoshot_file: autoshotBlob,\r\n document: params.document || params.document_front || params.id_file || capturedDocBlob,\r\n document_back: params.document_back,\r\n identity_check: params.identity_check,\r\n device_type: deviceMeta.device_type,\r\n os_name: deviceMeta.os_name,\r\n browser_timezone: deviceMeta.browser_timezone,\r\n fingerprint_id: deviceMeta.fingerprint_id,\r\n });\r\n }\r\n\r\n // 5. Mount UI with challenge actions from backend\r\n const uiChallenge = {\r\n actions: entry.challenge_actions,\r\n time_limit_seconds: 45,\r\n instruction: \"Complete each action below to verify it's you\",\r\n };\r\n\r\n // Re-mount UI with challenge actions (face engine already initialized)\r\n ui.unmount();\r\n const videoEl = ui.mount(container, uiChallenge);\r\n videoEl.srcObject = stream;\r\n await videoEl.play();\r\n\r\n // 7. Start recording\r\n recorder.start(stream);\r\n ui.updateInstruction(uiChallenge.instruction);\r\n\r\n // 8. Run detection loop (sequential \u2014 one action at a time)\r\n const actionDetector = new ActionDetector(entry.challenge_actions);\r\n let lastAction: string | null = null;\r\n\r\n const detectionResult = await new Promise<\"completed\" | \"timeout\">(\r\n (resolve) => {\r\n let animFrameId: number;\r\n\r\n const timeout = setTimeout(() => {\r\n cancelAnimationFrame(animFrameId);\r\n resolve(\"timeout\");\r\n }, uiChallenge.time_limit_seconds * 1000);\r\n\r\n const detectLoop = () => {\r\n if (videoEl.readyState >= 2) {\r\n const detection = faceEngine.detect(\r\n videoEl,\r\n performance.now()\r\n );\r\n\r\n const states = actionDetector.check(detection);\r\n ui.updateActions(states);\r\n\r\n const current = actionDetector.getCurrentAction();\r\n\r\n if (!detection.faceDetected) {\r\n ui.updateInstruction(\"Move your face into the oval\");\r\n } else if (current) {\r\n if (current !== lastAction) {\r\n lastAction = current;\r\n ui.updateInstruction(this.describeAction(current));\r\n }\r\n } else {\r\n ui.updateInstruction(\"All actions completed! \u2713\");\r\n }\r\n\r\n if (actionDetector.allCompleted()) {\r\n clearTimeout(timeout);\r\n cancelAnimationFrame(animFrameId);\r\n resolve(\"completed\");\r\n return;\r\n }\r\n }\r\n\r\n animFrameId = requestAnimationFrame(detectLoop);\r\n };\r\n\r\n detectLoop();\r\n }\r\n );\r\n\r\n // \u2500\u2500 On timeout: show retry screen, clean up, restart \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\r\n if (detectionResult === \"timeout\") {\r\n // IMPORTANT: mark cleanedUp=true BEFORE returning the new Promise so\r\n // the outer `finally` block does NOT call cleanup() immediately \u2014\r\n // which would destroy the UI before the user sees the timeout screen.\r\n cleanedUp = true;\r\n\r\n recorder.stop().catch(() => { }); // discard partial recording\r\n\r\n return new Promise<LivenessSubmitResponse>((resolveRetry, rejectRetry) => {\r\n ui.showTimeout(() => {\r\n // User clicked \"Try Again\" \u2014 now it is safe to destroy this attempt\r\n faceEngine.destroy();\r\n camera.stop();\r\n ui.unmount();\r\n\r\n // Restart liveness with same entry ID to prevent duplicate charges (D1)\r\n // Pass capturedDocBlob forward so document scan step is not repeated\r\n this.startCheck(container, { ...params, id_file: capturedDocBlob }, actions, entry.id)\r\n .then(resolveRetry)\r\n .catch(rejectRetry);\r\n });\r\n // showTimeout waits for the user to click \u2014 the promise stays pending.\r\n });\r\n }\r\n\r\n // \u2500\u2500 On completion: stop recording, submit, show success \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\r\n\r\n // Wait for user to return to neutral face after last action before\r\n // capturing snapshot \u2014 prevents mid-action pose from skewing DeepFace\r\n // embeddings (open mouth / head turned = high cosine distance).\r\n ui.updateInstruction(\"Almost done \u2014 hold still...\");\r\n await new Promise((r) => setTimeout(r, 800));\r\n\r\n // Capture a snapshot frame while the video is still playing\r\n const snapshotBlob = await this.captureFrame(videoEl);\r\n\r\n // 9. Stop recording\r\n const { blob: videoBlob, durationSeconds } = await recorder.stop();\r\n\r\n // 10. Submit to backend \u2014 always include autoshot so document-flow\r\n // entries (which bypassed create() via existingEntryId) still get it.\r\n const submitResult = await this.submit(\r\n entry.id,\r\n videoBlob,\r\n snapshotBlob,\r\n autoshotBlob,\r\n durationSeconds,\r\n videoBlob.size\r\n );\r\n\r\n // 11. Show success overlay briefly before the flow advances\r\n await ui.showResult(\r\n submitResult.status === \"processing\" ? \"processing\" : \"failed\",\r\n submitResult.id\r\n );\r\n\r\n return submitResult;\r\n\r\n } finally {\r\n cleanup();\r\n }\r\n }\r\n\r\n /**\r\n * Capture a single sharp frame from a video element as a JPEG Blob.\r\n * Retries up to maxAttempts times (300 ms apart) if the Laplacian blur\r\n * score is below threshold, then falls back to the best frame captured.\r\n */\r\n private async captureFrame(\r\n video: HTMLVideoElement,\r\n maxAttempts = 4\r\n ): Promise<Blob> {\r\n const MIN_BLUR_SCORE = 80; // Laplacian variance \u2014 above this = acceptably sharp\r\n const RETRY_DELAY_MS = 300;\r\n let bestBlob: Blob | null = null;\r\n let bestScore = -1;\r\n\r\n for (let attempt = 0; attempt < maxAttempts; attempt++) {\r\n const canvas = document.createElement(\"canvas\");\r\n canvas.width = video.videoWidth || 640;\r\n canvas.height = video.videoHeight || 480;\r\n const ctx = canvas.getContext(\"2d\");\r\n if (!ctx) throw new Error(\"Failed to get canvas context\");\r\n ctx.drawImage(video, 0, 0);\r\n\r\n const score = this._computeBlurScore(canvas);\r\n\r\n const blob = await new Promise<Blob | null>((res) =>\r\n canvas.toBlob((b) => res(b), \"image/jpeg\", 0.92)\r\n );\r\n\r\n if (blob && score > bestScore) {\r\n bestBlob = blob;\r\n bestScore = score;\r\n }\r\n\r\n if (score >= MIN_BLUR_SCORE) break; // sharp enough \u2014 stop early\r\n\r\n if (attempt < maxAttempts - 1) {\r\n await new Promise((r) => setTimeout(r, RETRY_DELAY_MS));\r\n }\r\n }\r\n\r\n if (bestBlob) return bestBlob;\r\n throw new Error(\"Failed to capture frame\");\r\n }\r\n\r\n /**\r\n * Laplacian variance blur metric on a centre-cropped region (320\u00D7240 max).\r\n * Higher score = sharper image. Score < 80 is considered blurry.\r\n */\r\n private _computeBlurScore(canvas: HTMLCanvasElement): number {\r\n const ctx = canvas.getContext(\"2d\");\r\n if (!ctx) return 0;\r\n\r\n // Sample a 320\u00D7240 centre crop for performance\r\n const sw = Math.min(canvas.width, 320);\r\n const sh = Math.min(canvas.height, 240);\r\n const sx = Math.floor((canvas.width - sw) / 2);\r\n const sy = Math.floor((canvas.height - sh) / 2);\r\n\r\n const { data, width, height } = ctx.getImageData(sx, sy, sw, sh);\r\n\r\n // Convert to greyscale\r\n const gray = new Float32Array(width * height);\r\n for (let i = 0; i < width * height; i++) {\r\n gray[i] =\r\n 0.299 * data[i * 4] +\r\n 0.587 * data[i * 4 + 1] +\r\n 0.114 * data[i * 4 + 2];\r\n }\r\n\r\n // Laplacian convolution [0,1,0 / 1,-4,1 / 0,1,0] \u2014 sum of squared responses\r\n let sum = 0;\r\n let n = 0;\r\n for (let y = 1; y < height - 1; y++) {\r\n for (let x = 1; x < width - 1; x++) {\r\n const l =\r\n gray[(y - 1) * width + x] +\r\n gray[(y + 1) * width + x] +\r\n gray[y * width + (x - 1)] +\r\n gray[y * width + (x + 1)] -\r\n 4 * gray[y * width + x];\r\n sum += l * l;\r\n n++;\r\n }\r\n }\r\n return n > 0 ? sum / n : 0;\r\n }\r\n\r\n private describeAction(action: string): string {\r\n const descriptions: Record<string, string> = {\r\n BLINK: \"Blink your eyes\",\r\n TURN_LEFT: \"Turn your head left\",\r\n TURN_RIGHT: \"Turn your head right\",\r\n TURN_HEAD: \"Turn your head side to side\",\r\n OPEN_MOUTH: \"Open your mouth wide\",\r\n };\r\n return descriptions[action] || action.replace(/_/g, \" \").toLowerCase();\r\n }\r\n}\r\n", "import { SDKConfig } from \"./Config\";\r\nimport { HttpClient } from \"./HttpClient\";\r\nimport { OnboardingModule } from \"../modules/onboarding/onboarding\";\r\nimport { LivenessModule } from \"../modules/liveness/liveness\";\r\nimport {\r\n SessionResponse,\r\n SDKInitConfig,\r\n} from \"../types/onboarding\";\r\n\r\n/**\r\n * SmartComply SDK \u2014 main entry point.\r\n *\r\n * Usage:\r\n * const sdk = new SmartComply({ apiKey: \"pk_...\", clientId: \"uuid-...\", environment: \"sandbox\" });\r\n * const session = await sdk.createSession();\r\n * const config = await sdk.initializeConfig();\r\n * // ... use sdk.onboarding and sdk.liveness modules\r\n */\r\nexport class SmartComply {\r\n private http: HttpClient;\r\n private clientId: string;\r\n private _sessionToken: string | null = null;\r\n private _sessionExpiresAt: string | null = null;\r\n private _sdkConfig: SDKInitConfig | null = null;\r\n\r\n public onboarding: OnboardingModule;\r\n public liveness: LivenessModule;\r\n\r\n constructor(config: SDKConfig) {\r\n if (!config.apiKey) {\r\n throw new Error(\"SmartComply: apiKey is required\");\r\n }\r\n if (!config.clientId) {\r\n throw new Error(\"SmartComply: clientId is required (UUID from your SDK config)\");\r\n }\r\n\r\n this.clientId = config.clientId;\r\n this.http = new HttpClient(config);\r\n\r\n this.onboarding = new OnboardingModule(this.http);\r\n this.liveness = new LivenessModule(this.http);\r\n }\r\n\r\n /** Current session token (null if not created yet) */\r\n get sessionToken(): string | null {\r\n return this._sessionToken;\r\n }\r\n\r\n /** Session expiration ISO timestamp */\r\n get sessionExpiresAt(): string | null {\r\n return this._sessionExpiresAt;\r\n }\r\n\r\n /** SDK config fetched from backend (null until initializeConfig() is called) */\r\n get sdkConfig(): SDKInitConfig | null {\r\n return this._sdkConfig;\r\n }\r\n\r\n /**\r\n * Create a new SDK session.\r\n *\r\n * POST /v1/sdk/session/create/\r\n * Auth: Authorization: Bearer <apiKey>\r\n * Body: { client_id: \"<uuid>\" }\r\n *\r\n * Returns: { token: \"...\", expires_at: \"...\" }\r\n */\r\n async createSession(): Promise<SessionResponse> {\r\n const response = await this.http.request<SessionResponse>(\r\n \"POST\",\r\n \"/v1/sdk/session/create/\",\r\n { client_id: this.clientId }\r\n );\r\n\r\n this._sessionToken = response.token;\r\n this._sessionExpiresAt = response.expires_at;\r\n\r\n // Set the session token on the HTTP client for subsequent requests\r\n this.http.setSessionToken(response.token);\r\n\r\n return response;\r\n }\r\n\r\n /**\r\n * Fetch SDK configuration from the backend.\r\n * Must be called after createSession().\r\n *\r\n * GET /v1/sdk/initialize/\r\n * Auth: x-access-token: <sessionToken>\r\n *\r\n * Returns: { brand_name, theme, verification_type, channels, redirect_url, ... }\r\n */\r\n async initializeConfig(): Promise<SDKInitConfig> {\r\n const config = await this.http.sessionRequest<SDKInitConfig>(\r\n \"GET\",\r\n \"/v1/sdk/initialize/\"\r\n );\r\n\r\n this._sdkConfig = config;\r\n return config;\r\n }\r\n}\r\n", "/**\r\n * Theme system for the SmartComply Flow widget.\r\n * Maps to backend's SDKConfig.THEME_CHOICES:\r\n * default, midnight_blue, sunset_gold, forest_emerald\r\n */\r\n\r\nexport interface ThemeColors {\r\n primary: string;\r\n primaryHover: string;\r\n primaryGlow: string;\r\n bg: string;\r\n cardBg: string;\r\n inputBg: string;\r\n text: string;\r\n textSecondary: string;\r\n textMuted: string;\r\n border: string;\r\n borderFocus: string;\r\n success: string;\r\n successBg: string;\r\n error: string;\r\n errorBg: string;\r\n warning: string;\r\n overlay: string;\r\n shimmer: string;\r\n shadow: string;\r\n isDark: boolean;\r\n}\r\n\r\nexport const THEMES: Record<string, ThemeColors> = {\r\n default: {\r\n primary: \"#3b82f6\",\r\n primaryHover: \"#2563eb\",\r\n primaryGlow: \"rgba(59, 130, 246, 0.25)\",\r\n bg: \"#ffffff\",\r\n cardBg: \"#f8fafc\",\r\n inputBg: \"#f1f5f9\",\r\n text: \"#0f172a\",\r\n textSecondary: \"#475569\",\r\n textMuted: \"#94a3b8\",\r\n border: \"#e2e8f0\",\r\n borderFocus: \"#3b82f6\",\r\n success: \"#22c55e\",\r\n successBg: \"rgba(34, 197, 94, 0.1)\",\r\n error: \"#ef4444\",\r\n errorBg: \"rgba(239, 68, 68, 0.1)\",\r\n warning: \"#f59e0b\",\r\n overlay: \"rgba(15, 23, 42, 0.6)\",\r\n shimmer: \"rgba(59, 130, 246, 0.08)\",\r\n shadow: \"0 20px 60px rgba(0, 0, 0, 0.15), 0 0 0 1px rgba(0, 0, 0, 0.05)\",\r\n isDark: false,\r\n },\r\n\r\n midnight_blue: {\r\n primary: \"#60a5fa\",\r\n primaryHover: \"#93bbfd\",\r\n primaryGlow: \"rgba(96, 165, 250, 0.2)\",\r\n bg: \"#0b1120\",\r\n cardBg: \"#111d33\",\r\n inputBg: \"#162032\",\r\n text: \"#f1f5f9\",\r\n textSecondary: \"#94a3b8\",\r\n textMuted: \"#64748b\",\r\n border: \"#1e3a5f\",\r\n borderFocus: \"#60a5fa\",\r\n success: \"#4ade80\",\r\n successBg: \"rgba(74, 222, 128, 0.1)\",\r\n error: \"#f87171\",\r\n errorBg: \"rgba(248, 113, 113, 0.1)\",\r\n warning: \"#fbbf24\",\r\n overlay: \"rgba(0, 0, 0, 0.75)\",\r\n shimmer: \"rgba(96, 165, 250, 0.06)\",\r\n shadow: \"0 20px 60px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(96, 165, 250, 0.1)\",\r\n isDark: true,\r\n },\r\n\r\n sunset_gold: {\r\n primary: \"#f59e0b\",\r\n primaryHover: \"#d97706\",\r\n primaryGlow: \"rgba(245, 158, 11, 0.2)\",\r\n bg: \"#fffdf7\",\r\n cardBg: \"#fef9ee\",\r\n inputBg: \"#fef3c7\",\r\n text: \"#1c1917\",\r\n textSecondary: \"#57534e\",\r\n textMuted: \"#a8a29e\",\r\n border: \"#fed7aa\",\r\n borderFocus: \"#f59e0b\",\r\n success: \"#22c55e\",\r\n successBg: \"rgba(34, 197, 94, 0.1)\",\r\n error: \"#ef4444\",\r\n errorBg: \"rgba(239, 68, 68, 0.1)\",\r\n warning: \"#f59e0b\",\r\n overlay: \"rgba(28, 25, 23, 0.6)\",\r\n shimmer: \"rgba(245, 158, 11, 0.08)\",\r\n shadow: \"0 20px 60px rgba(0, 0, 0, 0.12), 0 0 0 1px rgba(245, 158, 11, 0.1)\",\r\n isDark: false,\r\n },\r\n\r\n forest_emerald: {\r\n primary: \"#10b981\",\r\n primaryHover: \"#059669\",\r\n primaryGlow: \"rgba(16, 185, 129, 0.2)\",\r\n bg: \"#f7fdf9\",\r\n cardBg: \"#ecfdf5\",\r\n inputBg: \"#d1fae5\",\r\n text: \"#1a1a2e\",\r\n textSecondary: \"#4b5563\",\r\n textMuted: \"#9ca3af\",\r\n border: \"#a7f3d0\",\r\n borderFocus: \"#10b981\",\r\n success: \"#22c55e\",\r\n successBg: \"rgba(34, 197, 94, 0.1)\",\r\n error: \"#ef4444\",\r\n errorBg: \"rgba(239, 68, 68, 0.1)\",\r\n warning: \"#f59e0b\",\r\n overlay: \"rgba(26, 26, 46, 0.6)\",\r\n shimmer: \"rgba(16, 185, 129, 0.08)\",\r\n shadow: \"0 20px 60px rgba(0, 0, 0, 0.12), 0 0 0 1px rgba(16, 185, 129, 0.1)\",\r\n isDark: false,\r\n },\r\n};\r\n\r\nexport function getTheme(name: string): ThemeColors {\r\n return THEMES[name] || THEMES.default;\r\n}\r\n", "import { ThemeColors } from \"./theme\";\r\n\r\n/**\r\n * Document capture UI \u2014 camera-based or file-upload for ID documents.\r\n *\r\n * Supports:\r\n * - Camera capture (rear camera preferred on mobile)\r\n * - File upload fallback\r\n * - Preview with retake/confirm\r\n * - Front and back document capture for documents requiring both sides\r\n */\r\nexport interface DocumentCaptureResult {\r\n front: Blob;\r\n back?: Blob; // Optional for documents that don't require back side\r\n}\r\n\r\nexport class DocumentCapture {\r\n private root: HTMLDivElement | null = null;\r\n private videoEl: HTMLVideoElement | null = null;\r\n private stream: MediaStream | null = null;\r\n private resolveCapture: ((result: DocumentCaptureResult) => void) | null = null;\r\n private rejectCapture: ((err: Error) => void) | null = null;\r\n private frontBlob: Blob | null = null;\r\n private backBlob: Blob | null = null;\r\n private currentSide: 'front' | 'back' = 'front';\r\n\r\n /**\r\n * Mount the document capture UI and return a promise that resolves\r\n * with the captured document image(s).\r\n */\r\n capture(\r\n container: HTMLElement,\r\n theme: ThemeColors,\r\n documentType: string\r\n ): Promise<DocumentCaptureResult> {\r\n return new Promise((resolve, reject) => {\r\n // Validate input parameters\r\n if (!container) {\r\n reject(new Error(\"Container element is required\"));\r\n return;\r\n }\r\n if (!theme) {\r\n reject(new Error(\"Theme configuration is required\"));\r\n return;\r\n }\r\n if (!documentType || typeof documentType !== 'string') {\r\n reject(new Error(\"Document type is required and must be a string\"));\r\n return;\r\n }\r\n \r\n // Check if already capturing\r\n if (this.resolveCapture || this.rejectCapture) {\r\n reject(new Error(\"Document capture is already in progress\"));\r\n return;\r\n }\r\n\r\n this.resolveCapture = resolve;\r\n this.rejectCapture = reject;\r\n this.frontBlob = null;\r\n this.backBlob = null;\r\n this.currentSide = 'front';\r\n this.renderChoiceScreen(container, theme, documentType);\r\n });\r\n }\r\n\r\n destroy(): void {\r\n // Stop any ongoing camera streams\r\n this.stopCamera();\r\n \r\n // Clean up DOM elements\r\n if (this.root && this.root.parentElement) {\r\n this.root.parentElement.removeChild(this.root);\r\n }\r\n this.root = null;\r\n \r\n // Clean up any pending promises\r\n if (this.rejectCapture) {\r\n this.rejectCapture(new Error(\"Document capture was cancelled\"));\r\n this.rejectCapture = null;\r\n }\r\n this.resolveCapture = null;\r\n \r\n // Clean up blob data\r\n this.frontBlob = null;\r\n this.backBlob = null;\r\n this.currentSide = 'front';\r\n }\r\n\r\n private requiresBackSide(documentType: string): boolean {\r\n const type = documentType.toLowerCase();\r\n return type.includes(\"voter\") || \r\n type.includes(\"nin\") || \r\n type.includes(\"driver\") || \r\n type.includes(\"license\") || \r\n type.includes(\"national id\") ||\r\n type.includes(\"national id card\") ||\r\n type.includes(\"ghana\");\r\n }\r\n\r\n private renderChoiceScreen(\r\n container: HTMLElement,\r\n theme: ThemeColors,\r\n documentType: string\r\n ): void {\r\n this.root = document.createElement(\"div\");\r\n this.root.style.cssText = \"display:flex;flex-direction:column;align-items:center;gap:24px;padding:24px 20px;max-width:100%;\";\r\n\r\n const docLabel = this.getDocumentLabel(documentType);\r\n const requiresBack = this.requiresBackSide(documentType);\r\n const isCapturingFront = this.currentSide === 'front';\r\n\r\n // Header with enhanced illustration\r\n const header = document.createElement(\"div\");\r\n header.style.cssText = \"display:flex;flex-direction:column;align-items:center;gap:16px;text-align:center;\";\r\n \r\n // Enhanced illustration with gradient background\r\n const iconContainer = document.createElement(\"div\");\r\n iconContainer.style.cssText = `\r\n width:120px;height:120px;border-radius:24px;\r\n display:flex;align-items:center;justify-content:center;\r\n background:linear-gradient(135deg, ${theme.primary}15, ${theme.primary}05);\r\n border:3px solid ${theme.primary}30;\r\n position:relative;overflow:hidden;\r\n box-shadow:0 8px 32px ${theme.primary}20;\r\n `;\r\n \r\n const icon = document.createElement(\"div\");\r\n icon.style.cssText = \"font-size:48px;animation:float 3s ease-in-out infinite;\";\r\n icon.textContent = \"\uD83E\uDEAA\";\r\n iconContainer.appendChild(icon);\r\n \r\n // Add floating animation\r\n if (!document.head.querySelector('style[data-float-animation]')) {\r\n const style = document.createElement('style');\r\n style.setAttribute('data-float-animation', 'true');\r\n style.textContent = `\r\n @keyframes float {\r\n 0%, 100% { transform: translateY(0px); }\r\n 50% { transform: translateY(-10px); }\r\n }\r\n `;\r\n document.head.appendChild(style);\r\n }\r\n \r\n header.appendChild(iconContainer);\r\n\r\n // Enhanced title and subtitle\r\n const title = document.createElement(\"div\");\r\n title.style.cssText = `color:${theme.text};font-size:20px;font-weight:700;text-align:center;line-height:1.4;`;\r\n let labelText = `Capture your ${docLabel}`;\r\n if (requiresBack) {\r\n labelText += ` (${isCapturingFront ? 'Front Side' : 'Back Side'})`;\r\n }\r\n title.textContent = labelText;\r\n header.appendChild(title);\r\n\r\n const subtitle = document.createElement(\"div\");\r\n subtitle.style.cssText = `color:${theme.textSecondary};font-size:14px;text-align:center;line-height:1.5;max-width:280px;`;\r\n subtitle.textContent = \"Choose how you'd like to provide your document\";\r\n header.appendChild(subtitle);\r\n\r\n this.root.appendChild(header);\r\n\r\n // Enhanced progress indicator for multi-sided documents\r\n if (requiresBack) {\r\n const progress = document.createElement(\"div\");\r\n progress.style.cssText = `\r\n display:flex;flex-direction:column;align-items:center;gap:12px;\r\n padding:16px 20px;background:${theme.primary}08;border-radius:16px;\r\n border:1px solid ${theme.primary}20;width:100%;max-width:320px;\r\n `;\r\n progress.innerHTML = `\r\n <div style=\"display:flex;gap:8px;align-items:center;\">\r\n <div style=\"width:12px;height:12px;border-radius:50%;background:${isCapturingFront ? theme.primary : theme.border};transition:all 0.3s ease;\"></div>\r\n <div style=\"width:32px;height:2px;background:${theme.border};border-radius:1px;\"></div>\r\n <div style=\"width:12px;height:12px;border-radius:50%;background:${!isCapturingFront ? theme.primary : theme.border};transition:all 0.3s ease;\"></div>\r\n </div>\r\n <span style=\"color:${theme.text};font-size:13px;font-weight:600;\">${isCapturingFront ? 'Step 1 of 2' : 'Step 2 of 2'}</span>\r\n `;\r\n this.root.appendChild(progress);\r\n }\r\n\r\n // Enhanced action buttons container\r\n const actionsContainer = document.createElement(\"div\");\r\n actionsContainer.style.cssText = \"display:flex;flex-direction:column;gap:16px;width:100%;max-width:320px;\";\r\n\r\n // Camera button with enhanced design\r\n const cameraBtn = this.createEnhancedButton(\r\n \"\uD83D\uDCF7 Take Photo with Camera\",\r\n theme,\r\n true,\r\n \"Open camera to capture document\"\r\n );\r\n cameraBtn.addEventListener(\"click\", () => {\r\n this.showLoadingState(\"Opening camera...\", theme);\r\n this.root!.innerHTML = \"\";\r\n setTimeout(() => {\r\n this.renderCameraView(this.root!, theme, documentType);\r\n }, 500);\r\n });\r\n actionsContainer.appendChild(cameraBtn);\r\n\r\n // Upload button with enhanced design\r\n const uploadBtn = this.createEnhancedButton(\r\n \"\uD83D\uDCC1 Choose from Gallery\",\r\n theme,\r\n false,\r\n \"Upload document image from device\"\r\n );\r\n uploadBtn.addEventListener(\"click\", () => {\r\n this.handleFileUpload(container, theme);\r\n });\r\n actionsContainer.appendChild(uploadBtn);\r\n\r\n this.root.appendChild(actionsContainer);\r\n\r\n // Enhanced tips section\r\n const tips = document.createElement(\"div\");\r\n tips.style.cssText = `\r\n width:100%;padding:16px 20px;border-radius:16px;\r\n background:${theme.shimmer};border:1px solid ${theme.border};\r\n margin-top:8px;\r\n `;\r\n \r\n const tipsTitle = document.createElement(\"div\");\r\n tipsTitle.style.cssText = `font-weight:700;color:${theme.text};margin-bottom:12px;font-size:14px;display:flex;align-items:center;gap:8px;`;\r\n tipsTitle.innerHTML = `\uD83D\uDCA1 Tips for best results`;\r\n tips.appendChild(tipsTitle);\r\n \r\n const tipsList = document.createElement(\"div\");\r\n tipsList.style.cssText = `display:grid;gap:8px;font-size:13px;color:${theme.textSecondary};line-height:1.6;`;\r\n tipsList.innerHTML = `\r\n <div style=\"display:flex;gap:8px;align-items:flex-start;\">\r\n <span style=\"color:${theme.primary};font-weight:bold;\">\u2713</span>\r\n <span>Lay document flat on a solid surface</span>\r\n </div>\r\n <div style=\"display:flex;gap:8px;align-items:flex-start;\">\r\n <span style=\"color:${theme.primary};font-weight:bold;\">\u2713</span>\r\n <span>Ensure all four corners are visible</span>\r\n </div>\r\n <div style=\"display:flex;gap:8px;align-items:flex-start;\">\r\n <span style=\"color:${theme.primary};font-weight:bold;\">\u2713</span>\r\n <span>Use good lighting, avoid glare</span>\r\n </div>\r\n <div style=\"display:flex;gap:8px;align-items:flex-start;\">\r\n <span style=\"color:${theme.primary};font-weight:bold;\">\u2713</span>\r\n <span>Make sure all text is clearly readable</span>\r\n </div>\r\n `;\r\n tips.appendChild(tipsList);\r\n this.root.appendChild(tips);\r\n\r\n // File input (hidden)\r\n const fileInput = document.createElement(\"input\");\r\n fileInput.type = \"file\";\r\n fileInput.accept = \"image/jpeg,image/png\";\r\n fileInput.style.display = \"none\";\r\n fileInput.id = \"sc-doc-file-input\";\r\n fileInput.addEventListener(\"change\", (e) => {\r\n const file = (e.target as HTMLInputElement).files?.[0];\r\n if (file) {\r\n // Validate file\r\n const validationError = this.validateFile(file);\r\n if (validationError) {\r\n this.showError(validationError);\r\n return;\r\n }\r\n \r\n this.showLoadingState(\"Processing image...\", theme);\r\n this.compressImage(file, 1280, 960, 0.85)\r\n .then((compressed) => this.handleFileUploadComplete(compressed, container, theme, documentType))\r\n .catch(() => this.handleFileUploadComplete(file, container, theme, documentType)); // fallback to original if compress fails\r\n }\r\n });\r\n this.root.appendChild(fileInput);\r\n\r\n container.appendChild(this.root);\r\n }\r\n\r\n private renderCameraView(\r\n container: HTMLElement,\r\n theme: ThemeColors,\r\n documentType: string\r\n ): void {\r\n const wrapper = document.createElement(\"div\");\r\n wrapper.style.cssText = \"position:relative;width:100%;border-radius:12px;overflow:hidden;background:#000;\";\r\n\r\n this.videoEl = document.createElement(\"video\");\r\n this.videoEl.autoplay = true;\r\n this.videoEl.playsInline = true;\r\n this.videoEl.muted = true;\r\n this.videoEl.style.cssText = \"width:100%;display:block;aspect-ratio:4/3;object-fit:cover;\";\r\n wrapper.appendChild(this.videoEl);\r\n\r\n // Guide overlay \u2014 rectangular\r\n const guide = document.createElement(\"div\");\r\n guide.style.cssText = `\r\n position:absolute;inset:0;display:flex;align-items:center;justify-content:center;\r\n pointer-events:none;\r\n `;\r\n const rect = document.createElement(\"div\");\r\n rect.style.cssText = `\r\n width:85%;height:60%;border:2px solid rgba(255,255,255,0.6);\r\n border-radius:12px;box-shadow:0 0 0 9999px rgba(0,0,0,0.4);\r\n `;\r\n guide.appendChild(rect);\r\n wrapper.appendChild(guide);\r\n\r\n // Guide label\r\n const guideLbl = document.createElement(\"div\");\r\n guideLbl.style.cssText = `\r\n position:absolute;bottom:60px;left:0;right:0;text-align:center;\r\n color:#fff;font-size:13px;font-weight:600;\r\n text-shadow:0 1px 3px rgba(0,0,0,0.5);\r\n `;\r\n guideLbl.textContent = `Align your ${this.getDocumentLabel(documentType)} within the frame`;\r\n wrapper.appendChild(guideLbl);\r\n\r\n container.appendChild(wrapper);\r\n\r\n // Capture button\r\n const captureBtn = document.createElement(\"button\");\r\n captureBtn.style.cssText = `\r\n display:block;margin:16px auto 0;width:64px;height:64px;\r\n border-radius:50%;border:4px solid ${theme.primary};\r\n background:transparent;cursor:pointer;position:relative;\r\n transition:all 0.2s ease;\r\n `;\r\n const inner = document.createElement(\"div\");\r\n inner.style.cssText = `\r\n width:48px;height:48px;border-radius:50%;background:${theme.primary};\r\n position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);\r\n transition:all 0.15s ease;\r\n `;\r\n captureBtn.appendChild(inner);\r\n captureBtn.addEventListener(\"mousedown\", () => {\r\n inner.style.transform = \"translate(-50%,-50%) scale(0.9)\";\r\n });\r\n captureBtn.addEventListener(\"mouseup\", () => {\r\n inner.style.transform = \"translate(-50%,-50%) scale(1)\";\r\n });\r\n captureBtn.addEventListener(\"click\", () => {\r\n this.captureFrame(container, theme, documentType);\r\n });\r\n container.appendChild(captureBtn);\r\n\r\n // Open camera\r\n this.openCamera();\r\n }\r\n\r\n private async openCamera(): Promise<void> {\r\n // Check browser compatibility\r\n if (!navigator.mediaDevices || !navigator.mediaDevices.getUserMedia) {\r\n this.rejectCapture?.(new Error(\"Camera access is not supported in this browser. Please use a modern browser like Chrome, Firefox, or Safari.\"));\r\n return;\r\n }\r\n\r\n const maxRetries = 3;\r\n let retryCount = 0;\r\n\r\n const attemptCameraAccess = async (constraints: MediaStreamConstraints): Promise<MediaStream> => {\r\n try {\r\n return await navigator.mediaDevices.getUserMedia(constraints);\r\n } catch (err: any) {\r\n console.warn(`Camera access attempt ${retryCount + 1} failed:`, err);\r\n \r\n if (retryCount < maxRetries - 1) {\r\n retryCount++;\r\n await new Promise(resolve => setTimeout(resolve, 1000 * retryCount)); // Exponential backoff\r\n return attemptCameraAccess(constraints);\r\n }\r\n throw err;\r\n }\r\n };\r\n\r\n try {\r\n // Try rear camera first\r\n this.stream = await attemptCameraAccess({\r\n video: {\r\n facingMode: { ideal: \"environment\" },\r\n width: { ideal: 1280 },\r\n height: { ideal: 960 },\r\n },\r\n });\r\n } catch (err: any) {\r\n console.warn(\"Rear camera failed, trying any camera:\", err);\r\n \r\n // Fallback to any camera\r\n try {\r\n this.stream = await attemptCameraAccess({\r\n video: { width: { ideal: 1280 } },\r\n });\r\n } catch (fallbackErr: any) {\r\n const errorMessage = this.getCameraErrorMessage(fallbackErr);\r\n this.rejectCapture?.(new Error(errorMessage));\r\n return;\r\n }\r\n }\r\n\r\n if (this.videoEl) {\r\n this.videoEl.srcObject = this.stream;\r\n }\r\n }\r\n\r\n private getCameraErrorMessage(error: any): string {\r\n if (error.name === 'NotAllowedError') {\r\n return \"Camera access denied. Please allow camera permissions and try again.\";\r\n } else if (error.name === 'NotFoundError') {\r\n return \"No camera found. Please ensure your device has a working camera.\";\r\n } else if (error.name === 'NotReadableError') {\r\n return \"Camera is already in use by another application. Please close other apps using the camera and try again.\";\r\n } else if (error.name === 'OverconstrainedError') {\r\n return \"Camera constraints not supported. Trying with different settings...\";\r\n } else {\r\n return \"Camera access failed. Please check your camera permissions and try again.\";\r\n }\r\n }\r\n\r\n private captureFrame(container: HTMLElement, theme: ThemeColors, documentType: string): void {\r\n if (!this.videoEl) return;\r\n\r\n const MAX_W = 1280;\r\n const MAX_H = 960;\r\n const vw = this.videoEl.videoWidth || MAX_W;\r\n const vh = this.videoEl.videoHeight || MAX_H;\r\n const ratio = Math.min(MAX_W / vw, MAX_H / vh, 1);\r\n\r\n const canvas = document.createElement(\"canvas\");\r\n canvas.width = Math.round(vw * ratio);\r\n canvas.height = Math.round(vh * ratio);\r\n const ctx = canvas.getContext(\"2d\");\r\n if (!ctx) return;\r\n\r\n ctx.drawImage(this.videoEl, 0, 0, canvas.width, canvas.height);\r\n\r\n canvas.toBlob(\r\n (blob) => {\r\n if (blob) {\r\n this.stopCamera();\r\n this.showPreview(container, theme, blob, documentType);\r\n }\r\n },\r\n \"image/jpeg\",\r\n 0.85\r\n );\r\n }\r\n\r\n private showPreview(\r\n container: HTMLElement,\r\n theme: ThemeColors,\r\n imageData: Blob | File,\r\n documentType: string\r\n ): void {\r\n if (this.root) this.root.innerHTML = \"\";\r\n else {\r\n this.root = document.createElement(\"div\");\r\n container.appendChild(this.root);\r\n }\r\n\r\n this.root.style.cssText = \"display:flex;flex-direction:column;align-items:center;gap:16px;\";\r\n\r\n // Preview image\r\n const img = document.createElement(\"img\");\r\n const imageUrl = URL.createObjectURL(imageData);\r\n img.src = imageUrl;\r\n img.style.cssText = `\r\n width:100%;max-height:300px;object-fit:contain;border-radius:12px;\r\n border:2px solid ${theme.border};\r\n `;\r\n this.root.appendChild(img);\r\n\r\n // Store URL for cleanup\r\n (img as any)._blobUrl = imageUrl;\r\n\r\n const label = document.createElement(\"div\");\r\n label.style.cssText = `color:${theme.textSecondary};font-size:13px;text-align:center;font-weight:500;`;\r\n label.textContent = \"Does the photo look clear?\";\r\n this.root.appendChild(label);\r\n\r\n const sublabel = document.createElement(\"div\");\r\n sublabel.style.cssText = `color:${theme.textMuted};font-size:11px;text-align:center;line-height:1.6;`;\r\n sublabel.textContent = \"All text must be readable and all four corners must be visible.\";\r\n this.root.appendChild(sublabel);\r\n\r\n // Buttons\r\n const btnRow = document.createElement(\"div\");\r\n btnRow.style.cssText = \"display:flex;gap:12px;width:100%;\";\r\n\r\n const retakeBtn = this.createButton(\"Retake\", theme, false);\r\n retakeBtn.style.flex = \"1\";\r\n retakeBtn.addEventListener(\"click\", () => {\r\n if ((img as any)._blobUrl) {\r\n URL.revokeObjectURL((img as any)._blobUrl);\r\n }\r\n this.root!.innerHTML = \"\";\r\n this.renderChoiceScreen(container, theme, documentType);\r\n });\r\n\r\n const useBtn = this.createButton(\"Use Photo \u2713\", theme, true);\r\n useBtn.style.flex = \"1\";\r\n useBtn.addEventListener(\"click\", () => {\r\n if ((img as any)._blobUrl) {\r\n URL.revokeObjectURL((img as any)._blobUrl);\r\n }\r\n useBtn.textContent = \"Processing...\";\r\n useBtn.disabled = true;\r\n this.compressImage(imageData, 1280, 960, 0.85)\r\n .then((compressed) => this.handleCaptureComplete(compressed, container, theme, documentType))\r\n .catch(() => this.handleCaptureComplete(imageData, container, theme, documentType)); // fallback to original\r\n });\r\n\r\n btnRow.appendChild(retakeBtn);\r\n btnRow.appendChild(useBtn);\r\n this.root.appendChild(btnRow);\r\n }\r\n\r\n private handleCaptureComplete(\r\n imageData: Blob,\r\n container: HTMLElement,\r\n theme: ThemeColors,\r\n documentType: string\r\n ): void {\r\n const requiresBack = this.requiresBackSide(documentType);\r\n const wasCapturingFront = this.currentSide === 'front';\r\n \r\n // Store the captured image\r\n if (wasCapturingFront) {\r\n this.frontBlob = imageData;\r\n } else {\r\n this.backBlob = imageData;\r\n }\r\n \r\n // If we need back side and haven't captured it yet, move to back side\r\n if (requiresBack && wasCapturingFront) {\r\n this.currentSide = 'back';\r\n this.root!.innerHTML = \"\";\r\n this.renderChoiceScreen(container, theme, documentType);\r\n return;\r\n }\r\n\r\n // All captures complete, resolve with result\r\n if (!this.frontBlob) {\r\n this.rejectCapture?.(new Error(\"No front image captured. Please try again.\"));\r\n return;\r\n }\r\n \r\n const result: DocumentCaptureResult = {\r\n front: this.frontBlob,\r\n back: this.backBlob || undefined\r\n };\r\n this.resolveCapture?.(result);\r\n }\r\n\r\n private handleFileUploadComplete(\r\n imageData: Blob,\r\n container: HTMLElement,\r\n theme: ThemeColors,\r\n documentType: string\r\n ): void {\r\n // Show preview first, then handle completion\r\n this.showPreview(container, theme, imageData, documentType);\r\n }\r\n\r\n private validateFile(file: File): string | null {\r\n // Check file type\r\n const allowedTypes = ['image/jpeg', 'image/jpg', 'image/png'];\r\n if (!allowedTypes.includes(file.type)) {\r\n return \"Invalid file type. Please upload a JPEG or PNG image.\";\r\n }\r\n \r\n // Check file size (max 10MB)\r\n const maxSize = 10 * 1024 * 1024;\r\n if (file.size > maxSize) {\r\n return \"File is too large. Please upload an image smaller than 10MB.\";\r\n }\r\n \r\n // Check minimum file size (at least 1KB to avoid empty files)\r\n if (file.size < 1024) {\r\n return \"File is too small. Please upload a valid image file.\";\r\n }\r\n \r\n return null;\r\n }\r\n\r\n private handleFileUpload(container: HTMLElement, theme: ThemeColors): void {\r\n const input = this.root?.querySelector(\"#sc-doc-file-input\") as HTMLInputElement;\r\n if (input) input.click();\r\n }\r\n\r\n private stopCamera(): void {\r\n if (this.stream) {\r\n this.stream.getTracks().forEach((t) => t.stop());\r\n this.stream = null;\r\n }\r\n if (this.videoEl) {\r\n this.videoEl.srcObject = null;\r\n this.videoEl = null;\r\n }\r\n }\r\n\r\n private createEnhancedButton(\r\n label: string,\r\n theme: ThemeColors,\r\n isPrimary: boolean,\r\n ariaLabel: string\r\n ): HTMLButtonElement {\r\n const btn = document.createElement(\"button\");\r\n btn.textContent = label;\r\n btn.setAttribute(\"aria-label\", ariaLabel);\r\n btn.style.cssText = `\r\n padding:18px 24px;border-radius:16px;font-size:16px;font-weight:600;\r\n cursor:pointer;transition:all 0.3s ease;border:none;width:100%;\r\n min-height:56px;touch-action:manipulation;-webkit-tap-highlight-color:transparent;\r\n position:relative;overflow:hidden;\r\n ${\r\n isPrimary\r\n ? `background:linear-gradient(135deg, ${theme.primary}, ${theme.primary}DD);color:#fff;box-shadow:0 8px 24px ${theme.primary}25, 0 4px 12px ${theme.primary}15;`\r\n : `background:${theme.inputBg};color:${theme.text};border:2px solid ${theme.border};box-shadow:0 2px 8px ${theme.border}20;`\r\n }\r\n `;\r\n \r\n // Add ripple effect\r\n btn.addEventListener(\"click\", (e) => {\r\n const ripple = document.createElement(\"span\");\r\n const rect = btn.getBoundingClientRect();\r\n const size = Math.max(rect.width, rect.height);\r\n const x = e.clientX - rect.left - size / 2;\r\n const y = e.clientY - rect.top - size / 2;\r\n \r\n ripple.style.cssText = `\r\n position:absolute;width:${size}px;height:${size}px;\r\n left:${x}px;top:${y}px;border-radius:50%;\r\n background:${isPrimary ? 'rgba(255,255,255,0.3)' : theme.primary + '20'};\r\n transform:scale(0);animation:ripple 0.6s ease-out;\r\n pointer-events:none;\r\n `;\r\n btn.appendChild(ripple);\r\n setTimeout(() => ripple.remove(), 600);\r\n });\r\n \r\n btn.addEventListener(\"mouseenter\", () => {\r\n btn.style.transform = \"translateY(-2px)\";\r\n if (isPrimary) {\r\n btn.style.boxShadow = `0 12px 32px ${theme.primary}30, 0 6px 16px ${theme.primary}20`;\r\n } else {\r\n btn.style.boxShadow = `0 4px 16px ${theme.border}30, 0 2px 8px ${theme.border}20`;\r\n btn.style.borderColor = theme.primary;\r\n }\r\n });\r\n btn.addEventListener(\"mouseleave\", () => {\r\n btn.style.transform = \"translateY(0)\";\r\n if (isPrimary) {\r\n btn.style.boxShadow = `0 8px 24px ${theme.primary}25, 0 4px 12px ${theme.primary}15`;\r\n } else {\r\n btn.style.boxShadow = `0 2px 8px ${theme.border}20`;\r\n btn.style.borderColor = theme.border;\r\n }\r\n });\r\n \r\n // Add ripple animation\r\n if (!document.head.querySelector('style[data-ripple-animation]')) {\r\n const style = document.createElement('style');\r\n style.setAttribute('data-ripple-animation', 'true');\r\n style.textContent = `\r\n @keyframes ripple {\r\n to { transform: scale(4); opacity: 0; }\r\n }\r\n `;\r\n document.head.appendChild(style);\r\n }\r\n \r\n return btn;\r\n }\r\n\r\n private showLoadingState(message: string, theme: ThemeColors): void {\r\n if (!this.root) return;\r\n \r\n this.root.innerHTML = \"\";\r\n this.root.style.cssText = \"display:flex;flex-direction:column;align-items:center;justify-content:center;gap:20px;padding:40px 20px;min-height:300px;\";\r\n \r\n // Enhanced loading spinner\r\n const spinnerContainer = document.createElement(\"div\");\r\n spinnerContainer.style.cssText = \"position:relative;width:80px;height:80px;\";\r\n \r\n const spinner = document.createElement(\"div\");\r\n spinner.style.cssText = `\r\n position:absolute;inset:0;border-radius:50%;\r\n border:4px solid ${theme.border};\r\n border-top-color:${theme.primary};\r\n animation:sc-spin 1s linear infinite;\r\n `;\r\n spinnerContainer.appendChild(spinner);\r\n \r\n const centerIcon = document.createElement(\"div\");\r\n centerIcon.style.cssText = `\r\n position:absolute;inset:0;display:flex;align-items:center;justify-content:center;\r\n font-size:28px;animation:pulse 2s ease-in-out infinite;\r\n `;\r\n centerIcon.textContent = \"\uD83D\uDCC4\";\r\n spinnerContainer.appendChild(centerIcon);\r\n \r\n this.root.appendChild(spinnerContainer);\r\n \r\n // Loading message\r\n const loadingText = document.createElement(\"div\");\r\n loadingText.style.cssText = `\r\n color:${theme.text};font-size:16px;font-weight:600;text-align:center;\r\n animation:fadeIn 0.5s ease-out;\r\n `;\r\n loadingText.textContent = message;\r\n this.root.appendChild(loadingText);\r\n \r\n // Add pulse animation\r\n if (!document.head.querySelector('style[data-pulse-animation]')) {\r\n const style = document.createElement('style');\r\n style.setAttribute('data-pulse-animation', 'true');\r\n style.textContent = `\r\n @keyframes pulse {\r\n 0%, 100% { transform: scale(1); opacity: 1; }\r\n 50% { transform: scale(1.1); opacity: 0.8; }\r\n }\r\n @keyframes fadeIn {\r\n from { opacity: 0; transform: translateY(10px); }\r\n to { opacity: 1; transform: translateY(0); }\r\n }\r\n `;\r\n document.head.appendChild(style);\r\n }\r\n }\r\n\r\n private showError(message: string): void {\r\n if (!this.root) return;\r\n \r\n const errorContainer = document.createElement(\"div\");\r\n errorContainer.style.cssText = `\r\n display:flex;align-items:center;gap:12px;padding:16px;\r\n background:#ff444415;border:1px solid #ff444430;border-radius:12px;\r\n color:#ff4444;font-size:14px;margin-top:16px;animation:shake 0.5s ease-in-out;\r\n `;\r\n errorContainer.innerHTML = `\r\n <span style=\"font-size:18px;\">\u26A0\uFE0F</span>\r\n <span>${message}</span>\r\n `;\r\n \r\n // Add shake animation\r\n if (!document.head.querySelector('style[data-shake-animation]')) {\r\n const style = document.createElement('style');\r\n style.setAttribute('data-shake-animation', 'true');\r\n style.textContent = `\r\n @keyframes shake {\r\n 0%, 100% { transform: translateX(0); }\r\n 25% { transform: translateX(-5px); }\r\n 75% { transform: translateX(5px); }\r\n }\r\n `;\r\n document.head.appendChild(style);\r\n }\r\n \r\n this.root.appendChild(errorContainer);\r\n setTimeout(() => errorContainer.remove(), 5000);\r\n }\r\n\r\n private createButton(\r\n label: string,\r\n theme: ThemeColors,\r\n isPrimary: boolean\r\n ): HTMLButtonElement {\r\n const btn = document.createElement(\"button\");\r\n btn.textContent = label;\r\n btn.style.cssText = `\r\n padding:16px 24px;border-radius:12px;font-size:16px;font-weight:600;\r\n cursor:pointer;transition:all 0.2s ease;border:none;width:100%;\r\n min-height:52px;touch-action:manipulation;-webkit-tap-highlight-color:transparent;\r\n ${\r\n isPrimary\r\n ? `background:${theme.primary};color:#fff;box-shadow:0 4px 12px ${theme.primary}30;`\r\n : `background:${theme.inputBg};color:${theme.text};border:2px solid ${theme.border};`\r\n }\r\n `;\r\n btn.addEventListener(\"mouseenter\", () => {\r\n btn.style.transform = \"translateY(-1px)\";\r\n if (isPrimary) btn.style.background = theme.primaryHover;\r\n });\r\n btn.addEventListener(\"mouseleave\", () => {\r\n btn.style.transform = \"translateY(0)\";\r\n if (isPrimary) btn.style.background = theme.primary;\r\n });\r\n return btn;\r\n }\r\n\r\n private compressImage(\r\n source: Blob | File,\r\n maxWidth: number,\r\n maxHeight: number,\r\n quality: number\r\n ): Promise<Blob> {\r\n return new Promise((resolve, reject) => {\r\n // Read EXIF orientation FIRST so we can correct rotation before canvas draw.\r\n // Canvas ignores EXIF metadata \u2014 without this, phone uploads arrive rotated.\r\n this._readExifOrientation(source).then((orientation) => {\r\n const url = URL.createObjectURL(source);\r\n const imgEl = document.createElement(\"img\");\r\n imgEl.onload = () => {\r\n URL.revokeObjectURL(url);\r\n let { naturalWidth: w, naturalHeight: h } = imgEl;\r\n\r\n // For orientations 5-8 the image is rotated 90\u00B0/270\u00B0 \u2014 swap dimensions\r\n const swapped = orientation >= 5 && orientation <= 8;\r\n const srcW = swapped ? h : w;\r\n const srcH = swapped ? w : h;\r\n const ratio = Math.min(maxWidth / srcW, maxHeight / srcH, 1);\r\n const outW = Math.round(srcW * ratio);\r\n const outH = Math.round(srcH * ratio);\r\n\r\n const canvas = document.createElement(\"canvas\");\r\n canvas.width = outW;\r\n canvas.height = outH;\r\n const ctx = canvas.getContext(\"2d\");\r\n if (!ctx) { reject(new Error(\"Canvas unavailable\")); return; }\r\n\r\n // Apply EXIF rotation transform before drawing\r\n ctx.save();\r\n if (orientation === 2) { ctx.transform(-1, 0, 0, 1, outW, 0); }\r\n else if (orientation === 3) { ctx.transform(-1, 0, 0, -1, outW, outH); }\r\n else if (orientation === 4) { ctx.transform( 1, 0, 0, -1, 0, outH); }\r\n else if (orientation === 5) { ctx.transform( 0, 1, 1, 0, 0, 0); }\r\n else if (orientation === 6) { ctx.transform( 0, 1, -1, 0, outH, 0); }\r\n else if (orientation === 7) { ctx.transform( 0, -1, -1, 0, outH, outW); }\r\n else if (orientation === 8) { ctx.transform( 0, -1, 1, 0, 0, outW); }\r\n ctx.drawImage(imgEl, 0, 0, swapped ? outH : outW, swapped ? outW : outH);\r\n ctx.restore();\r\n\r\n canvas.toBlob(\r\n (blob) => { blob ? resolve(blob) : reject(new Error(\"Compression failed\")); },\r\n \"image/jpeg\",\r\n quality\r\n );\r\n };\r\n imgEl.onerror = () => { URL.revokeObjectURL(url); reject(new Error(\"Image load failed\")); };\r\n imgEl.src = url;\r\n }).catch(() => {\r\n // If EXIF read fails, fall back to simple compression without rotation\r\n const url = URL.createObjectURL(source);\r\n const imgEl = document.createElement(\"img\");\r\n imgEl.onload = () => {\r\n URL.revokeObjectURL(url);\r\n let { naturalWidth: w, naturalHeight: h } = imgEl;\r\n const ratio = Math.min(maxWidth / w, maxHeight / h, 1);\r\n const canvas = document.createElement(\"canvas\");\r\n canvas.width = Math.round(w * ratio);\r\n canvas.height = Math.round(h * ratio);\r\n const ctx = canvas.getContext(\"2d\");\r\n if (!ctx) { reject(new Error(\"Canvas unavailable\")); return; }\r\n ctx.drawImage(imgEl, 0, 0, canvas.width, canvas.height);\r\n canvas.toBlob(\r\n (blob) => { blob ? resolve(blob) : reject(new Error(\"Compression failed\")); },\r\n \"image/jpeg\",\r\n quality\r\n );\r\n };\r\n imgEl.onerror = () => { URL.revokeObjectURL(url); reject(new Error(\"Image load failed\")); };\r\n imgEl.src = url;\r\n });\r\n });\r\n }\r\n\r\n /**\r\n * Read JPEG EXIF orientation tag (1\u20138) from a Blob/File.\r\n * Returns 1 (no rotation) if EXIF is absent or unreadable.\r\n */\r\n private _readExifOrientation(source: Blob | File): Promise<number> {\r\n return new Promise((resolve) => {\r\n const reader = new FileReader();\r\n reader.onload = (e) => {\r\n try {\r\n const buf = e.target?.result as ArrayBuffer;\r\n const view = new DataView(buf);\r\n if (view.getUint16(0, false) !== 0xFFD8) { resolve(1); return; } // not JPEG\r\n let offset = 2;\r\n while (offset < view.byteLength) {\r\n const marker = view.getUint16(offset, false);\r\n offset += 2;\r\n if (marker === 0xFFE1) { // APP1 \u2014 may contain EXIF\r\n if (view.getUint32(offset + 2, false) !== 0x45786966) { resolve(1); return; }\r\n const little = view.getUint16(offset + 8, false) === 0x4949;\r\n const ifdOff = offset + 8 + view.getUint32(offset + 12, little);\r\n const tags = view.getUint16(ifdOff, little);\r\n for (let i = 0; i < tags; i++) {\r\n if (view.getUint16(ifdOff + 2 + 12 * i, little) === 0x0112) {\r\n resolve(view.getUint16(ifdOff + 2 + 12 * i + 8, little));\r\n return;\r\n }\r\n }\r\n resolve(1); return;\r\n } else if ((marker & 0xFF00) !== 0xFF00) {\r\n break;\r\n } else {\r\n offset += view.getUint16(offset, false);\r\n }\r\n }\r\n resolve(1);\r\n } catch { resolve(1); }\r\n };\r\n reader.onerror = () => resolve(1);\r\n // Only need the first 64KB \u2014 EXIF is always in the first APP1 segment\r\n reader.readAsArrayBuffer(source.slice(0, 65536));\r\n });\r\n }\r\n\r\n private getDocumentLabel(type: string): string {\r\n const t = type.toLowerCase();\r\n if (t.includes(\"passport\")) return \"passport\";\r\n if (t.includes(\"driver\") || t.includes(\"licen\")) return \"driver's license\";\r\n if (t.includes(\"voter\") || t.includes(\"pvc\")) return \"voter's card\";\r\n if (t.includes(\"national\") || t.includes(\"nin\") || t.includes(\"national id\")) return \"national ID card\";\r\n if (t.includes(\"bvn\")) return \"BVN card\";\r\n return \"identity document\";\r\n }\r\n}\r\n", "import { SmartComply } from \"../client/Smartcomply\";\r\nimport { SDKInitConfig, VerifyIdentityResponse } from \"../types/onboarding\";\r\nimport { LivenessSubmitResponse, ChallengeAction } from \"../types/liveness\";\r\nimport { ThemeColors, getTheme } from \"./theme\";\r\nimport { DocumentCapture, DocumentCaptureResult } from \"./DocumentCapture\";\r\nimport { Environment } from \"../client/Config\";\r\nimport { collectDeviceMetadata } from \"../utils/device\";\r\n\r\n// \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\r\n// Public Types\r\n// \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\r\n\r\nexport interface FlowOptions {\r\n apiKey: string;\r\n clientId: string;\r\n environment?: Environment;\r\n timeout?: number;\r\n onComplete?: (result: FlowResult) => void;\r\n onError?: (error: Error) => void;\r\n onClose?: () => void;\r\n}\r\n\r\nexport interface FlowResult {\r\n entryId: number;\r\n sessionId: string | null;\r\n status: string;\r\n submittedAt: string | null;\r\n verificationResult?: VerifyIdentityResponse;\r\n}\r\n\r\n// \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\r\n// Step definitions\r\n// \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\r\n\r\ntype StepName =\r\n | \"loading\"\r\n | \"welcome\"\r\n | \"country\"\r\n | \"id_type\"\r\n | \"id_input\"\r\n | \"document_capture\"\r\n | \"processing\"\r\n | \"liveness\"\r\n | \"result\"\r\n | \"error\";\r\n\r\nconst STEP_ORDER: StepName[] = [\r\n \"loading\",\r\n \"welcome\",\r\n \"country\",\r\n \"id_type\",\r\n \"id_input\", // or document_capture\r\n \"document_capture\",\r\n \"processing\",\r\n \"liveness\",\r\n \"result\",\r\n];\r\n\r\nconst COUNTRY_LABELS: Record<string, string> = {\r\n nigeria: \"\uD83C\uDDF3\uD83C\uDDEC Nigeria\",\r\n global: \"\uD83C\uDF0D Other Countries\",\r\n ghana: \"\uD83C\uDDEC\uD83C\uDDED Ghana\",\r\n kenya: \"\uD83C\uDDF0\uD83C\uDDEA Kenya\",\r\n south_africa: \"\uD83C\uDDFF\uD83C\uDDE6 South Africa\",\r\n united_states: \"\uD83C\uDDFA\uD83C\uDDF8 United States\",\r\n united_kingdom: \"\uD83C\uDDEC\uD83C\uDDE7 United Kingdom\",\r\n};\r\n\r\nfunction resolveIdTypeInfo(\r\n typeName: string,\r\n isDocumentFlow: boolean\r\n): { icon: string; desc: string; requiresBack?: boolean } {\r\n const u = typeName.toUpperCase();\r\n const withFace = u.includes(\"WITH FACE\") || u.includes(\"FACE\");\r\n const advanced = u.includes(\"ADVANCED\");\r\n\r\n // Helper function to check if document requires back side\r\n const requiresBackSide = (type: string): boolean => {\r\n const t = type.toLowerCase();\r\n return t.includes(\"voter\") || \r\n t.includes(\"nin\") || \r\n t.includes(\"driver\") || \r\n t.includes(\"license\") || \r\n t.includes(\"national id\") ||\r\n t.includes(\"national id card\");\r\n };\r\n\r\n // BVN \u2014 always 11 digits\r\n if (u.includes(\"BVN\") || u.includes(\"BANK VERIFICATION\")) {\r\n const extra = withFace ? \" + selfie photo\" : \"\";\r\n return { icon: \"\uD83C\uDFE6\", desc: `Enter your 11-digit BVN${extra}`, requiresBack: false };\r\n }\r\n\r\n // NIN \u2014 always 11 digits\r\n if (u.includes(\"NIN\") || u.includes(\"NATIONAL IDENTITY NUMBER\")) {\r\n const extra = withFace ? \" + selfie photo\" : \"\";\r\n return { icon: \"\uD83C\uDD94\", desc: `Enter your 11-digit NIN${extra}`, requiresBack: false };\r\n }\r\n\r\n // Ghana Card / Ghana National ID\r\n if (u.includes(\"GHANA\")) {\r\n if (isDocumentFlow) return { icon: \"\uD83E\uDEAA\", desc: \"Capture or upload your Ghana Card\", requiresBack: true };\r\n const extra = withFace ? \" + selfie photo\" : \"\";\r\n return { icon: \"\uD83E\uDEAA\", desc: `Enter your Ghana Card number${extra}`, requiresBack: false };\r\n }\r\n\r\n // SSNIT (Ghana social security)\r\n if (u.includes(\"SSNIT\"))\r\n return { icon: \"\uD83C\uDFDB\uFE0F\", desc: \"Enter your SSNIT number\", requiresBack: false };\r\n\r\n // Kenya National ID\r\n if (u.includes(\"KENYA\") || (u.includes(\"NATIONAL\") && u.includes(\"KENYA\")))\r\n return { icon: \"\uD83C\uDD94\", desc: \"Enter your Kenya National ID number\", requiresBack: false };\r\n\r\n // TIN\r\n if (u.includes(\"TIN\") || u.includes(\"TAX IDENTIFICATION\"))\r\n return { icon: \"\uD83E\uDDFE\", desc: \"Enter your Tax Identification Number (TIN)\", requiresBack: false };\r\n\r\n // CAC / Company registration\r\n if (u.includes(\"CAC\") || u.includes(\"CORPORATE AFFAIRS\") || u.includes(\"COMPANY\"))\r\n return { icon: \"\uD83C\uDFE2\", desc: advanced ? \"Enter RC number, company name & type\" : \"Enter your company registration number\", requiresBack: false };\r\n\r\n // Voter / PVC\r\n if (u.includes(\"VOTER\") || u.includes(\"PVC\")) {\r\n const requiresBack = requiresBackSide(typeName);\r\n return { \r\n icon: \"\uD83D\uDDF3\uFE0F\", \r\n desc: isDocumentFlow \r\n ? `Capture or upload your voter's card${requiresBack ? \" (front & back)\" : \"\"}` \r\n : \"Enter your voter ID number\",\r\n requiresBack: isDocumentFlow ? requiresBack : false\r\n };\r\n }\r\n\r\n // Passport\r\n if (u.includes(\"PASSPORT\"))\r\n return { icon: \"\uD83D\uDCD8\", desc: isDocumentFlow ? \"Capture or upload your passport\" : \"Enter your passport number\", requiresBack: false };\r\n\r\n // Driver's license\r\n if (u.includes(\"DRIVER\") || u.includes(\"LICENSE\") || u.includes(\"LICENCE\")) {\r\n const requiresBack = requiresBackSide(typeName);\r\n return { \r\n icon: \"\uD83D\uDE97\", \r\n desc: isDocumentFlow \r\n ? `Capture or upload your driver's license${requiresBack ? \" (front & back)\" : \"\"}` \r\n : \"Enter your driver's license number\",\r\n requiresBack: isDocumentFlow ? requiresBack : false\r\n };\r\n }\r\n\r\n // National ID card (generic)\r\n if (u.includes(\"NATIONAL ID\") || (u.includes(\"NATIONAL\") && u.includes(\"CARD\"))) {\r\n const requiresBack = requiresBackSide(typeName);\r\n return { \r\n icon: \"\uD83E\uDEAA\", \r\n desc: isDocumentFlow \r\n ? `Capture or upload your ID card${requiresBack ? \" (front & back)\" : \"\"}` \r\n : \"Enter your National ID number\",\r\n requiresBack: isDocumentFlow ? requiresBack : false\r\n };\r\n }\r\n\r\n // Face liveness / comparison\r\n if (u.includes(\"LIVENESS\") || u.includes(\"FACE COMPARISON\") || u.includes(\"FACE MATCH\"))\r\n return { icon: \"\uD83E\uDD33\", desc: \"We'll capture a short selfie video to verify you\", requiresBack: false };\r\n\r\n return {\r\n icon: isDocumentFlow ? \"\uD83D\uDCC4\" : \"\uD83C\uDD94\",\r\n desc: isDocumentFlow ? \"Capture or upload your document\" : \"Enter your ID number\",\r\n requiresBack: false,\r\n };\r\n}\r\n\r\n// \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\r\n// SmartComplyFlow\r\n// \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\r\n\r\n// Add CSS animation keyframes for spin animations\r\nconst style = document.createElement('style');\r\nstyle.textContent = `\r\n @keyframes sc-spin {\r\n 0% { transform: rotate(0deg); }\r\n 100% { transform: rotate(360deg); }\r\n }\r\n`;\r\nif (!document.head.querySelector('style[data-sc-animations]')) {\r\n style.setAttribute('data-sc-animations', 'true');\r\n document.head.appendChild(style);\r\n}\r\n\r\nexport class SmartComplyFlow {\r\n private sdk: SmartComply;\r\n private options: FlowOptions;\r\n private theme: ThemeColors = getTheme(\"default\");\r\n\r\n // DOM\r\n private overlay: HTMLDivElement | null = null;\r\n private modal: HTMLDivElement | null = null;\r\n private contentArea: HTMLDivElement | null = null;\r\n private progressBar: HTMLDivElement | null = null;\r\n private stepLabel: HTMLDivElement | null = null;\r\n private brandLabel: HTMLDivElement | null = null;\r\n\r\n // State\r\n private sdkConfig: SDKInitConfig | null = null;\r\n private currentStep: StepName = \"loading\";\r\n private selectedCountry: string = \"\";\r\n private selectedChannelId: number = 0;\r\n private selectedChannelFields: { type: string; label: string; options?: string[] }[] = [];\r\n private selectedIdType: string = \"\"; // Canonical code (e.g., \"national_id\", \"nin_with_face\")\r\n private selectedIdTypeName: string = \"\"; // Display name (e.g., \"National Identity Number with Face (NIN)\")\r\n private collectedFields: Record<string, string> = {};\r\n private idNumber: string = \"\";\r\n private documentBlob: Blob | null = null;\r\n private documentBackBlob: Blob | null = null;\r\n private identityCheckId: number | null = null;\r\n private verificationResult: VerifyIdentityResponse | null = null;\r\n private livenessEntryId: number | null = null;\r\n private isDestroyed = false;\r\n private headerBackBtn: HTMLButtonElement | null = null;\r\n\r\n // Session expiry\r\n private sessionExpiryTimer: ReturnType<typeof setTimeout> | null = null;\r\n\r\n // Status polling (result screen)\r\n private _pollStatusTimer: ReturnType<typeof setTimeout> | null = null;\r\n\r\n // Components\r\n private docCapture: DocumentCapture | null = null;\r\n\r\n private constructor(options: FlowOptions) {\r\n this.options = options;\r\n this.sdk = new SmartComply({\r\n apiKey: options.apiKey,\r\n clientId: options.clientId,\r\n environment: options.environment || \"sandbox\",\r\n timeout: options.timeout,\r\n });\r\n }\r\n\r\n /**\r\n * Open the SmartComply verification flow.\r\n *\r\n * Usage:\r\n * SmartComplyFlow.open({\r\n * apiKey: \"pk_live_...\",\r\n * clientId: \"uuid-...\",\r\n * environment: \"production\",\r\n * onComplete: (result) => console.log(\"Done!\", result),\r\n * onError: (err) => console.error(err),\r\n * onClose: () => console.log(\"Closed\"),\r\n * });\r\n */\r\n static open(options: FlowOptions): SmartComplyFlow {\r\n const flow = new SmartComplyFlow(options);\r\n flow.mount();\r\n flow.initialize();\r\n return flow;\r\n }\r\n\r\n /**\r\n * Close and destroy the flow widget.\r\n */\r\n close(): void {\r\n this.isDestroyed = true;\r\n this.docCapture?.destroy();\r\n if (this.sessionExpiryTimer) {\r\n clearTimeout(this.sessionExpiryTimer);\r\n this.sessionExpiryTimer = null;\r\n }\r\n if (this._pollStatusTimer) {\r\n clearTimeout(this._pollStatusTimer);\r\n this._pollStatusTimer = null;\r\n }\r\n\r\n if (this.overlay) {\r\n this.overlay.style.opacity = \"0\";\r\n setTimeout(() => {\r\n if (this.overlay?.parentElement) {\r\n this.overlay.parentElement.removeChild(this.overlay);\r\n }\r\n this.overlay = null;\r\n this.modal = null;\r\n this.contentArea = null;\r\n }, 300);\r\n }\r\n\r\n this.options.onClose?.();\r\n }\r\n\r\n // \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\r\n // Initialization\r\n // \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\r\n\r\n private mount(): void {\r\n // Inject keyframes\r\n this.injectStyles();\r\n\r\n // Overlay\r\n this.overlay = document.createElement(\"div\");\r\n this.overlay.id = \"sc-flow-overlay\";\r\n this.overlay.style.cssText = `\r\n position:fixed;inset:0;z-index:99999;\r\n display:flex;align-items:center;justify-content:center;\r\n background:${this.theme.overlay};\r\n backdrop-filter:blur(6px);-webkit-backdrop-filter:blur(6px);\r\n opacity:0;transition:opacity 0.3s ease;\r\n font-family:'Inter','Segoe UI',system-ui,-apple-system,sans-serif;\r\n `;\r\n\r\n // Modal\r\n this.modal = document.createElement(\"div\");\r\n this.modal.id = \"sc-flow-modal\";\r\n this.modal.style.cssText = `\r\n width:100%;max-width:440px;max-height:92vh;\r\n background:${this.theme.bg};\r\n border-radius:20px;overflow:hidden;\r\n box-shadow:${this.theme.shadow};\r\n display:flex;flex-direction:column;\r\n transform:translateY(20px) scale(0.97);\r\n transition:transform 0.35s cubic-bezier(0.16,1,0.3,1);\r\n `;\r\n\r\n // Header\r\n const header = this.createHeader();\r\n this.modal.appendChild(header);\r\n\r\n // Progress bar\r\n const progressWrap = document.createElement(\"div\");\r\n progressWrap.style.cssText = `height:3px;background:${this.theme.shimmer};`;\r\n this.progressBar = document.createElement(\"div\");\r\n this.progressBar.style.cssText = `\r\n height:100%;width:0%;background:linear-gradient(90deg,${this.theme.primary},${this.theme.primaryHover});\r\n border-radius:0 2px 2px 0;transition:width 0.5s ease;\r\n `;\r\n progressWrap.appendChild(this.progressBar);\r\n this.modal.appendChild(progressWrap);\r\n\r\n // Content area (scrollable)\r\n this.contentArea = document.createElement(\"div\");\r\n this.contentArea.id = \"sc-flow-content\";\r\n this.contentArea.style.cssText = `\r\n flex:1;overflow-y:auto;padding:20px 24px;\r\n -webkit-overflow-scrolling:touch;\r\n `;\r\n this.modal.appendChild(this.contentArea);\r\n\r\n // Footer\r\n const footer = this.createFooter();\r\n this.modal.appendChild(footer);\r\n\r\n this.overlay.appendChild(this.modal);\r\n document.body.appendChild(this.overlay);\r\n\r\n // Animate in\r\n requestAnimationFrame(() => {\r\n if (this.overlay) this.overlay.style.opacity = \"1\";\r\n if (this.modal) this.modal.style.transform = \"translateY(0) scale(1)\";\r\n });\r\n }\r\n\r\n private async initialize(): Promise<void> {\r\n this.showStep(\"loading\");\r\n\r\n try {\r\n // Create session\r\n await this.sdk.createSession();\r\n\r\n // C4: Start session expiry timer (warn 2 min before 30-min expiry)\r\n const expiresAt = this.sdk.sessionExpiresAt;\r\n if (expiresAt) {\r\n const expiresMs = new Date(expiresAt).getTime() - Date.now();\r\n const warnMs = Math.max(expiresMs - 120000, 0); // warn 2 min before\r\n this.sessionExpiryTimer = setTimeout(() => {\r\n if (!this.isDestroyed && this.currentStep !== \"result\") {\r\n this.showErrorStep(\"Your session is about to expire. Please complete verification quickly or restart.\");\r\n }\r\n }, warnMs);\r\n }\r\n\r\n // Load config\r\n this.sdkConfig = await this.sdk.initializeConfig();\r\n\r\n // Apply theme from config\r\n if (this.sdkConfig.theme) {\r\n this.theme = getTheme(this.sdkConfig.theme);\r\n this.applyTheme();\r\n }\r\n\r\n // Update brand name\r\n if (this.brandLabel && this.sdkConfig.brand_name) {\r\n this.brandLabel.textContent = this.sdkConfig.brand_name;\r\n }\r\n\r\n if (this.isDestroyed) return;\r\n\r\n this.showStep(\"welcome\");\r\n\r\n } catch (err: any) {\r\n this.showErrorStep(err.message || \"Failed to initialize. Please try again.\");\r\n }\r\n }\r\n\r\n // \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\r\n // Step rendering\r\n // \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\r\n\r\n private showStep(step: StepName): void {\r\n this.currentStep = step;\r\n if (!this.contentArea) return;\r\n\r\n // Update progress\r\n this.updateProgress();\r\n\r\n // Animate out current content\r\n const oldContent = this.contentArea.firstChild as HTMLElement | null;\r\n if (oldContent) {\r\n oldContent.style.cssText += \"opacity:0;transform:translateX(-20px);transition:all 0.2s ease;\";\r\n setTimeout(() => {\r\n if (this.contentArea) this.contentArea.innerHTML = \"\";\r\n this.renderStep(step);\r\n }, 200);\r\n } else {\r\n this.renderStep(step);\r\n }\r\n }\r\n\r\n private renderStep(step: StepName): void {\r\n if (!this.contentArea) return;\r\n\r\n const wrapper = document.createElement(\"div\");\r\n wrapper.style.cssText = \"opacity:0;transform:translateX(20px);transition:all 0.3s ease;\";\r\n\r\n switch (step) {\r\n case \"loading\":\r\n this.renderLoading(wrapper);\r\n break;\r\n case \"welcome\":\r\n this.renderWelcome(wrapper);\r\n break;\r\n case \"country\":\r\n this.renderCountrySelect(wrapper);\r\n break;\r\n case \"id_type\":\r\n this.renderIdTypeSelect(wrapper);\r\n break;\r\n case \"id_input\":\r\n this.renderIdInput(wrapper);\r\n break;\r\n case \"document_capture\":\r\n this.renderDocumentCapture(wrapper);\r\n break;\r\n case \"processing\":\r\n this.renderProcessing(wrapper);\r\n break;\r\n case \"liveness\":\r\n this.renderLiveness(wrapper);\r\n break;\r\n case \"result\":\r\n this.renderResult(wrapper);\r\n break;\r\n case \"error\":\r\n break; // handled separately\r\n }\r\n\r\n this.contentArea.appendChild(wrapper);\r\n\r\n // Animate in\r\n requestAnimationFrame(() => {\r\n wrapper.style.opacity = \"1\";\r\n wrapper.style.transform = \"translateX(0)\";\r\n });\r\n }\r\n\r\n // \u2500\u2500 Loading \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\r\n\r\n private renderLoading(container: HTMLElement): void {\r\n container.style.cssText += \"display:flex;flex-direction:column;align-items:center;justify-content:center;min-height:300px;gap:16px;\";\r\n\r\n const spinnerWrap = document.createElement(\"div\");\r\n spinnerWrap.style.cssText = \"position:relative;width:60px;height:60px;flex-shrink:0;\";\r\n\r\n const ring = document.createElement(\"div\");\r\n ring.style.cssText = `\r\n position:absolute;inset:0;border-radius:50%;\r\n border:3px solid ${this.theme.border};\r\n border-top-color:${this.theme.primary};\r\n animation:sc-spin 0.9s linear infinite;\r\n `;\r\n const centre = document.createElement(\"div\");\r\n centre.style.cssText = `\r\n position:absolute;inset:0;\r\n display:flex;align-items:center;justify-content:center;\r\n font-size:22px;\r\n `;\r\n centre.textContent = \"\\uD83D\\uDEE1\\uFE0F\";\r\n spinnerWrap.appendChild(ring);\r\n spinnerWrap.appendChild(centre);\r\n container.appendChild(spinnerWrap);\r\n\r\n const label = document.createElement(\"div\");\r\n label.style.cssText = `color:${this.theme.text};font-size:15px;font-weight:600;`;\r\n label.textContent = \"Setting up secure session\";\r\n container.appendChild(label);\r\n\r\n const sub = document.createElement(\"div\");\r\n sub.style.cssText = `color:${this.theme.textMuted};font-size:12px;text-align:center;max-width:220px;line-height:1.5;`;\r\n sub.textContent = \"Connecting to the verification service...\";\r\n container.appendChild(sub);\r\n }\r\n\r\n // \u2500\u2500 Welcome \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\r\n\r\n private renderWelcome(container: HTMLElement): void {\r\n container.style.cssText += \"display:flex;flex-direction:column;align-items:center;text-align:center;gap:14px;\";\r\n\r\n const isDocFlow = this.isDocumentFlow();\r\n\r\n // Icon + badge row (side by side to save vertical space)\r\n const topRow = document.createElement(\"div\");\r\n topRow.style.cssText = \"display:flex;flex-direction:column;align-items:center;gap:10px;\";\r\n\r\n const iconWrap = document.createElement(\"div\");\r\n iconWrap.style.cssText = `\r\n width:58px;height:58px;border-radius:16px;\r\n display:flex;align-items:center;justify-content:center;\r\n font-size:26px;\r\n background:linear-gradient(135deg,${this.theme.primary}22,${this.theme.primaryGlow});\r\n border:1.5px solid ${this.theme.primary}33;\r\n `;\r\n iconWrap.textContent = isDocFlow ? \"\uD83E\uDEAA\" : \"\uD83D\uDEE1\uFE0F\";\r\n topRow.appendChild(iconWrap);\r\n\r\n const badge = document.createElement(\"div\");\r\n badge.style.cssText = `\r\n display:inline-flex;align-items:center;gap:5px;\r\n padding:3px 11px;border-radius:999px;\r\n font-size:10.5px;font-weight:600;letter-spacing:0.2px;\r\n background:${this.theme.primary}15;\r\n color:${this.theme.primary};\r\n border:1px solid ${this.theme.primary}30;\r\n `;\r\n badge.textContent = isDocFlow ? \"\uD83D\uDCC4 Document Verification\" : \"\uD83D\uDD0D Data Verification\";\r\n topRow.appendChild(badge);\r\n container.appendChild(topRow);\r\n\r\n // Title + subtitle (compact)\r\n const titleWrap = document.createElement(\"div\");\r\n titleWrap.style.cssText = \"display:flex;flex-direction:column;gap:5px;\";\r\n\r\n const title = document.createElement(\"h2\");\r\n title.style.cssText = `\r\n color:${this.theme.text};font-size:20px;font-weight:700;\r\n margin:0;line-height:1.2;\r\n `;\r\n title.textContent = \"Identity Verification\";\r\n titleWrap.appendChild(title);\r\n\r\n const desc = document.createElement(\"p\");\r\n desc.style.cssText = `\r\n color:${this.theme.textSecondary};font-size:13px;line-height:1.5;\r\n margin:0;max-width:300px;\r\n `;\r\n desc.textContent = isDocFlow\r\n ? \"Scan your ID document and take a quick selfie to confirm your identity.\"\r\n : \"Enter your ID details and take a quick selfie to confirm your identity.\";\r\n titleWrap.appendChild(desc);\r\n container.appendChild(titleWrap);\r\n\r\n // Steps preview \u2014 compact rows\r\n const steps = isDocFlow\r\n ? [\r\n { icon: \"\uD83E\uDEAA\", text: \"Choose your document type\", sub: \"Passport, National ID, Driver License\" },\r\n { icon: \"\uD83D\uDCF7\", text: \"Scan your document\", sub: \"Upload or capture a photo of your ID\" },\r\n { icon: \"\uD83E\uDD33\", text: \"Face check\", sub: \"Quick selfie to confirm it's you\" },\r\n ]\r\n : [\r\n { icon: \"\uD83C\uDD94\", text: \"Choose your ID type\", sub: \"NIN, BVN, Voter's Card and more\" },\r\n { icon: \"\uD83D\uDCDD\", text: \"Enter your ID details\", sub: \"Exactly as shown on your ID\" },\r\n { icon: \"\uD83E\uDD33\", text: \"Face check\", sub: \"Quick selfie to confirm it's you\" },\r\n ];\r\n\r\n const stepsWrap = document.createElement(\"div\");\r\n stepsWrap.style.cssText = `\r\n width:100%;display:flex;flex-direction:column;gap:0;\r\n border-radius:12px;overflow:hidden;\r\n border:1.5px solid ${this.theme.border};\r\n `;\r\n\r\n steps.forEach((step, i) => {\r\n const row = document.createElement(\"div\");\r\n row.style.cssText = `\r\n display:flex;align-items:center;gap:12px;\r\n padding:9px 14px;\r\n background:${this.theme.cardBg};\r\n ${i < steps.length - 1 ? `border-bottom:1px solid ${this.theme.border};` : \"\"}\r\n `;\r\n\r\n const iconEl = document.createElement(\"div\");\r\n iconEl.style.cssText = `\r\n width:28px;height:28px;border-radius:8px;flex-shrink:0;\r\n display:flex;align-items:center;justify-content:center;\r\n font-size:13px;\r\n background:${this.theme.primary}12;\r\n border:1px solid ${this.theme.primary}20;\r\n `;\r\n iconEl.textContent = step.icon;\r\n\r\n const textWrap = document.createElement(\"div\");\r\n textWrap.style.cssText = \"display:flex;flex-direction:column;gap:1px;text-align:left;\";\r\n\r\n const textEl = document.createElement(\"span\");\r\n textEl.style.cssText = `color:${this.theme.text};font-size:12.5px;font-weight:600;`;\r\n textEl.textContent = step.text;\r\n\r\n const subEl = document.createElement(\"span\");\r\n subEl.style.cssText = `color:${this.theme.textMuted};font-size:10.5px;`;\r\n subEl.textContent = step.sub;\r\n\r\n textWrap.appendChild(textEl);\r\n textWrap.appendChild(subEl);\r\n row.appendChild(iconEl);\r\n row.appendChild(textWrap);\r\n stepsWrap.appendChild(row);\r\n });\r\n\r\n container.appendChild(stepsWrap);\r\n\r\n // CTA\r\n const btn = this.createPrimaryButton(\"Get Started \u2192\");\r\n btn.style.cssText += \"margin-top:2px;\";\r\n btn.addEventListener(\"click\", () => this.showStep(\"country\"));\r\n container.appendChild(btn);\r\n\r\n // Trust badge\r\n const trust = document.createElement(\"div\");\r\n trust.style.cssText = `\r\n display:flex;align-items:center;gap:6px;\r\n color:${this.theme.textMuted};font-size:10.5px;\r\n `;\r\n trust.textContent = \"\uD83D\uDD12 End-to-end encrypted \u00B7 Powered by Adhere\";\r\n container.appendChild(trust);\r\n }\r\n\r\n // \u2500\u2500 Country Select \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\r\n\r\n private renderCountrySelect(container: HTMLElement): void {\r\n container.style.cssText += \"display:flex;flex-direction:column;gap:16px;\";\r\n\r\n const channels = this.sdkConfig?.channels || {};\r\n const countries = Object.keys(channels);\r\n\r\n // Auto-skip country selection if only one country available\r\n if (countries.length === 1) {\r\n this.selectedCountry = countries[0];\r\n this.showStep(\"id_type\");\r\n return;\r\n }\r\n\r\n const title = this.createStepTitle(\"Select your country\");\r\n container.appendChild(title);\r\n\r\n const subtitle = document.createElement(\"div\");\r\n subtitle.style.cssText = `color:${this.theme.textSecondary};font-size:13px;margin-top:-8px;`;\r\n subtitle.textContent = \"Choose the country that issued your ID\";\r\n container.appendChild(subtitle);\r\n\r\n for (const country of countries) {\r\n const card = this.createOptionCard(\r\n COUNTRY_LABELS[country] || country,\r\n `${channels[country].length} ID type${channels[country].length > 1 ? \"s\" : \"\"} available`,\r\n () => {\r\n this.selectedCountry = country;\r\n this.showStep(\"id_type\");\r\n }\r\n );\r\n container.appendChild(card);\r\n }\r\n }\r\n\r\n // \u2500\u2500 ID Type Select \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\r\n\r\n private renderIdTypeSelect(container: HTMLElement): void {\r\n container.style.cssText += \"display:flex;flex-direction:column;gap:16px;\";\r\n\r\n const globalDocFlow = this.isDocumentFlow();\r\n\r\n const title = this.createStepTitle(globalDocFlow ? \"Select document type\" : \"Select ID type\");\r\n container.appendChild(title);\r\n\r\n const subtitle = document.createElement(\"div\");\r\n subtitle.style.cssText = `color:${this.theme.textSecondary};font-size:13px;margin-top:-8px;`;\r\n subtitle.textContent = globalDocFlow\r\n ? \"Choose the document you want to scan\"\r\n : \"Choose the ID you want to verify\";\r\n container.appendChild(subtitle);\r\n\r\n const channels = this.sdkConfig?.channels || {};\r\n const idTypes = channels[this.selectedCountry] || [];\r\n\r\n for (const idType of idTypes) {\r\n const typeName = typeof idType === \"string\" ? idType : idType.name;\r\n // Use code (canonical) for API calls, fallback to name for backward compatibility\r\n const typeCode = typeof idType === \"string\" ? idType : (idType.code || idType.name);\r\n // Detect per-channel: does THIS specific channel have upload fields?\r\n const channelFields: any[] = typeof idType !== \"string\" ? (idType.fields || []) : [];\r\n const isThisDocFlow = channelFields.some((f: any) => f.type === \"upload\") || globalDocFlow;\r\n const info = resolveIdTypeInfo(typeName, isThisDocFlow);\r\n\r\n // Add back side indicator to subtitle if needed\r\n let subtitle = info.desc;\r\n if (info.requiresBack && isThisDocFlow) {\r\n subtitle += \" \u26A0\uFE0F Both sides required\";\r\n }\r\n\r\n const card = this.createOptionCard(\r\n `${info.icon} ${typeName}`,\r\n subtitle,\r\n () => {\r\n this.selectedIdType = typeCode; // Store canonical code for API\r\n this.selectedIdTypeName = typeName; // Keep display name for UI\r\n // Always reset first to avoid stale state when user goes back and changes selection\r\n this.selectedChannelId = 0;\r\n this.selectedChannelFields = [];\r\n if (typeof idType !== \"string\") {\r\n this.selectedChannelId = idType.id;\r\n this.selectedChannelFields = idType.fields || []; // guard null/undefined from backend\r\n }\r\n this.collectedFields = {};\r\n // Route: use explicit verification_type when set (more reliable than inspecting all channels)\r\n // Fallback to per-channel upload field check for mixed / unconfigured setups\r\n const hasUpload = (this.selectedChannelFields).some((f: any) => f.type === \"upload\");\r\n const vType = this.sdkConfig?.verification_type;\r\n const vTypes: string[] = vType ? (Array.isArray(vType) ? vType : [vType]) : [];\r\n const isDocChannel = hasUpload || (vTypes.length > 0 && vTypes.includes(\"document_verification\"));\r\n this.showStep(isDocChannel ? \"document_capture\" : \"id_input\");\r\n }\r\n );\r\n container.appendChild(card);\r\n }\r\n\r\n }\r\n\r\n // \u2500\u2500 ID Input (data verification \u2014 dynamic fields) \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\r\n\r\n private renderIdInput(container: HTMLElement): void {\r\n container.style.cssText += \"display:flex;flex-direction:column;gap:16px;\";\r\n\r\n const dataFields = this.selectedChannelFields.filter((f) => f.type !== \"upload\");\r\n const info = resolveIdTypeInfo(this.selectedIdTypeName || this.selectedIdType, false);\r\n\r\n const title = this.createStepTitle(`${info.icon} ${this.selectedIdTypeName || this.selectedIdType}`);\r\n container.appendChild(title);\r\n\r\n const subtitle = document.createElement(\"div\");\r\n subtitle.style.cssText = `color:${this.theme.textSecondary};font-size:13px;margin-top:-8px;`;\r\n subtitle.textContent = dataFields.length > 0\r\n ? `Enter your ${this.selectedIdTypeName || this.selectedIdType} details exactly as they appear on your ID.`\r\n : \"Fill in the fields below to continue.\";\r\n container.appendChild(subtitle);\r\n\r\n // Edge case: no data fields configured \u2014 show fallback and allow submission\r\n if (dataFields.length === 0) {\r\n const empty = document.createElement(\"div\");\r\n empty.style.cssText = `\r\n padding:16px;border-radius:10px;\r\n background:${this.theme.cardBg};border:1px solid ${this.theme.border};\r\n color:${this.theme.textSecondary};font-size:13px;text-align:center;\r\n `;\r\n empty.textContent = \"No additional details required. Click below to continue.\";\r\n container.appendChild(empty);\r\n const autoBtn = this.createPrimaryButton(\"Continue\");\r\n autoBtn.addEventListener(\"click\", () => this.showStep(\"liveness\"));\r\n container.appendChild(autoBtn);\r\n return;\r\n }\r\n\r\n // Track input elements for validation\r\n const inputEls: { field: any; el: HTMLInputElement | HTMLSelectElement }[] = [];\r\n\r\n for (const field of dataFields) {\r\n const fieldKey = field.label.toLowerCase().replace(/[^a-z0-9]+/g, \"_\");\r\n\r\n const fieldWrap = document.createElement(\"div\");\r\n fieldWrap.style.cssText = \"display:flex;flex-direction:column;gap:6px;\";\r\n\r\n const label = document.createElement(\"label\");\r\n label.style.cssText = `color:${this.theme.textMuted};font-size:10px;font-weight:700;letter-spacing:0.6px;text-transform:uppercase;`;\r\n label.textContent = field.label;\r\n fieldWrap.appendChild(label);\r\n\r\n if (field.type === \"dropdown\" || field.type === \"select\") {\r\n // Dropdown field\r\n const select = document.createElement(\"select\");\r\n select.style.cssText = `\r\n width:100%;padding:13px 16px;border-radius:12px;\r\n font-size:15px;\r\n background:${this.theme.inputBg};\r\n color:${this.theme.text};\r\n border:2px solid ${this.theme.border};\r\n outline:none;box-sizing:border-box;\r\n cursor:pointer;transition:border-color 0.2s ease;\r\n `;\r\n const placeholder = document.createElement(\"option\");\r\n placeholder.value = \"\";\r\n placeholder.textContent = `Select ${field.label}`;\r\n placeholder.disabled = true;\r\n placeholder.selected = true;\r\n select.appendChild(placeholder);\r\n\r\n for (const opt of field.options || []) {\r\n const option = document.createElement(\"option\");\r\n option.value = opt;\r\n option.textContent = opt;\r\n select.appendChild(option);\r\n }\r\n\r\n select.addEventListener(\"focus\", () => { select.style.borderColor = this.theme.primary; });\r\n select.addEventListener(\"blur\", () => { select.style.borderColor = this.theme.border; });\r\n select.addEventListener(\"change\", () => {\r\n this.collectedFields[fieldKey] = select.value;\r\n updateSubmitState();\r\n });\r\n fieldWrap.appendChild(select);\r\n inputEls.push({ field, el: select });\r\n } else if (field.type === \"image\" || field.type === \"file\") {\r\n // File upload field \u2014 converts to base64 for API submission\r\n const fileInput = document.createElement(\"input\");\r\n fileInput.type = \"file\";\r\n fileInput.accept = \"image/*\";\r\n fileInput.style.cssText = `\r\n width:100%;padding:12px 16px;border-radius:12px;\r\n font-size:14px;font-weight:500;\r\n background:${this.theme.inputBg};\r\n color:${this.theme.text};\r\n border:2px dashed ${this.theme.border};\r\n outline:none;transition:border-color 0.2s ease;\r\n box-sizing:border-box;cursor:pointer;\r\n `;\r\n fileInput.addEventListener(\"focus\", () => {\r\n fileInput.style.borderColor = this.theme.primary;\r\n });\r\n fileInput.addEventListener(\"blur\", () => {\r\n fileInput.style.borderColor = this.theme.border;\r\n });\r\n fileInput.addEventListener(\"change\", () => {\r\n const file = fileInput.files?.[0];\r\n if (file) {\r\n const reader = new FileReader();\r\n reader.onload = () => {\r\n const base64 = (reader.result as string).split(\",\")[1] || \"\";\r\n this.collectedFields[fieldKey] = base64;\r\n updateSubmitState();\r\n };\r\n reader.readAsDataURL(file);\r\n }\r\n });\r\n fieldWrap.appendChild(fileInput);\r\n inputEls.push({ field, el: fileInput as any });\r\n } else {\r\n // Text input field\r\n const input = document.createElement(\"input\");\r\n input.type = \"text\";\r\n input.placeholder = `Enter ${field.label}`;\r\n input.maxLength = 50;\r\n input.style.cssText = `\r\n width:100%;padding:14px 16px;border-radius:12px;\r\n font-size:16px;font-weight:500;\r\n background:${this.theme.inputBg};\r\n color:${this.theme.text};\r\n border:2px solid ${this.theme.border};\r\n outline:none;transition:border-color 0.2s ease;\r\n box-sizing:border-box;\r\n letter-spacing:0.5px;\r\n `;\r\n input.addEventListener(\"focus\", () => {\r\n input.style.borderColor = this.theme.primary;\r\n });\r\n input.addEventListener(\"blur\", () => {\r\n input.style.borderColor = this.theme.border;\r\n });\r\n input.addEventListener(\"input\", () => {\r\n this.collectedFields[fieldKey] = input.value.trim();\r\n updateSubmitState();\r\n });\r\n fieldWrap.appendChild(input);\r\n inputEls.push({ field, el: input });\r\n }\r\n container.appendChild(fieldWrap);\r\n }\r\n\r\n // Error area\r\n const errorEl = document.createElement(\"div\");\r\n errorEl.id = \"sc-id-error\";\r\n errorEl.style.cssText = `\r\n color:${this.theme.error};font-size:13px;display:none;\r\n padding:8px 12px;border-radius:8px;background:${this.theme.errorBg};\r\n `;\r\n container.appendChild(errorEl);\r\n\r\n // Submit\r\n const submitBtn = this.createPrimaryButton(\"Verify & Continue\");\r\n submitBtn.disabled = true;\r\n submitBtn.style.opacity = \"0.5\";\r\n\r\n const updateSubmitState = () => {\r\n const allFilled = inputEls.every(({ el }) => el.value.trim().length > 0);\r\n submitBtn.disabled = !allFilled;\r\n submitBtn.style.opacity = allFilled ? \"1\" : \"0.5\";\r\n };\r\n\r\n submitBtn.addEventListener(\"click\", async () => {\r\n submitBtn.disabled = true;\r\n submitBtn.innerHTML = `<span style=\"display:inline-flex;align-items:center;justify-content:center;gap:8px;\"><span style=\"width:13px;height:13px;border-radius:50%;border:2px solid rgba(255,255,255,0.3);border-top-color:#fff;animation:sc-spin 0.6s linear infinite;display:inline-block;flex-shrink:0;\"></span>Verifying...</span>`;\r\n errorEl.style.display = \"none\";\r\n\r\n try {\r\n this.verificationResult = await this.sdk.onboarding.verify({\r\n identity_type_id: this.selectedChannelId,\r\n fields: { ...this.collectedFields },\r\n });\r\n\r\n if (this.verificationResult.status === \"verified\" || this.verificationResult.status === \"success\") {\r\n // Save the first collected field value as identifier for liveness\r\n const fieldValues = Object.values(this.collectedFields);\r\n this.idNumber = fieldValues[0] || \"\";\r\n // A4: Save identity_check_id from verify response to pass to liveness\r\n this.identityCheckId = (this.verificationResult as any).data?.identity_check_id || null;\r\n this.showStep(\"liveness\");\r\n } else {\r\n errorEl.textContent = this.verificationResult.message || \"Verification failed. Please check your details.\";\r\n errorEl.style.display = \"block\";\r\n submitBtn.textContent = \"Verify & Continue\";\r\n submitBtn.disabled = false;\r\n submitBtn.style.opacity = \"1\";\r\n }\r\n } catch (err: any) {\r\n // C3: Show field-level errors if available\r\n const fieldErrors = err.data?.errors;\r\n if (Array.isArray(fieldErrors) && fieldErrors.length > 0) {\r\n const messages = fieldErrors.map((e: any) => `${e.field}: ${e.message}`).join(\"\\n\");\r\n errorEl.textContent = messages;\r\n } else {\r\n errorEl.textContent = err.message || \"Verification failed\";\r\n }\r\n errorEl.style.display = \"block\";\r\n submitBtn.textContent = \"Verify & Continue\";\r\n submitBtn.disabled = false;\r\n submitBtn.style.opacity = \"1\";\r\n }\r\n });\r\n container.appendChild(submitBtn);\r\n\r\n\r\n // Focus first input\r\n const firstInput = inputEls[0]?.el;\r\n if (firstInput && firstInput instanceof HTMLInputElement) {\r\n setTimeout(() => firstInput.focus(), 350);\r\n }\r\n }\r\n\r\n // \u2500\u2500 Document Capture \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\r\n\r\n \r\n private renderDocumentCapture(container: HTMLElement): void {\r\n container.style.cssText += \"display:flex;flex-direction:column;gap:16px;\";\r\n\r\n const title = this.createStepTitle(`Capture ${this.selectedIdTypeName || this.selectedIdType || \"your document\"}`);\r\n container.appendChild(title);\r\n\r\n const subtitle = document.createElement(\"div\");\r\n subtitle.style.cssText = `color:${this.theme.textSecondary};font-size:13px;margin-top:-8px;`;\r\n subtitle.textContent = \"Upload or capture your document photo. Ensure it's clear and readable.\";\r\n container.appendChild(subtitle);\r\n\r\n const captureContainer = document.createElement(\"div\");\r\n captureContainer.style.cssText = `\r\n width: 100%;\r\n max-width: 400px;\r\n margin: 0 auto;\r\n position: relative;\r\n overflow: hidden;\r\n border-radius: 12px;\r\n background: ${this.theme.cardBg};\r\n border: 2px solid ${this.theme.border};\r\n `;\r\n container.appendChild(captureContainer);\r\n\r\n // Use the new DocumentCapture component with front/back support\r\n this.docCapture = new DocumentCapture();\r\n this.docCapture\r\n .capture(captureContainer, this.theme, this.selectedIdTypeName || this.selectedIdType)\r\n .then(async (result: DocumentCaptureResult) => {\r\n await this.processDocumentCaptureResult(result, captureContainer, container);\r\n })\r\n .catch((err: any) => {\r\n console.error(\"Document capture failed:\", err);\r\n this.showErrorStep(err.message || \"Document capture failed. Please try again.\");\r\n });\r\n }\r\n\r\n // \u2500\u2500 Processing \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\r\n\r\n private renderProcessing(container: HTMLElement): void {\r\n container.style.cssText += \"display:flex;flex-direction:column;align-items:center;gap:20px;padding:20px 16px;min-height:400px;\";\r\n\r\n // Processing animation\r\n const animationWrap = document.createElement(\"div\");\r\n animationWrap.style.cssText = \"position:relative;width:80px;height:80px;\";\r\n\r\n const spinner = document.createElement(\"div\");\r\n spinner.style.cssText = `\r\n position:absolute;inset:0;border-radius:50%;\r\n border:4px solid ${this.theme.border};\r\n border-top-color:${this.theme.primary};\r\n animation:sc-spin 1s linear infinite;\r\n `;\r\n animationWrap.appendChild(spinner);\r\n\r\n const centerIcon = document.createElement(\"div\");\r\n centerIcon.style.cssText = `\r\n position:absolute;inset:0;display:flex;align-items:center;justify-content:center;\r\n font-size:28px;\r\n `;\r\n centerIcon.textContent = \"\uD83D\uDD0D\";\r\n animationWrap.appendChild(centerIcon);\r\n container.appendChild(animationWrap);\r\n\r\n // Processing text\r\n const title = document.createElement(\"div\");\r\n title.style.cssText = `color:${this.theme.text};font-size:18px;font-weight:600;text-align:center;`;\r\n title.textContent = \"Processing Your Documents\";\r\n container.appendChild(title);\r\n\r\n const subtitle = document.createElement(\"div\");\r\n subtitle.style.cssText = `color:${this.theme.textSecondary};font-size:13px;text-align:center;max-width:280px;line-height:1.5;`;\r\n subtitle.textContent = \"Scanning and verifying your identity documents. This may take a few moments.\";\r\n container.appendChild(subtitle);\r\n\r\n // Processing steps\r\n const stepsContainer = document.createElement(\"div\");\r\n stepsContainer.style.cssText = `\r\n width:100%;max-width:400px;display:flex;flex-direction:column;gap:12px;\r\n margin-top:16px;\r\n `;\r\n\r\n const steps = [\r\n { id: 'uploading', text: 'Uploading documents', icon: '\uD83D\uDCE4' },\r\n { id: 'scanning', text: 'Scanning for information', icon: '\uD83D\uDD0D' },\r\n { id: 'verifying', text: 'Verifying authenticity', icon: '\u2713' },\r\n { id: 'analyzing', text: 'Analyzing document quality', icon: '\uD83D\uDD2C' }\r\n ];\r\n\r\n steps.forEach((step, index) => {\r\n const stepEl = document.createElement(\"div\");\r\n stepEl.style.cssText = `\r\n display:flex;align-items:center;gap:12px;padding:12px;border-radius:10px;\r\n background:${this.theme.cardBg};border:1px solid ${this.theme.border};\r\n transition:all 0.3s ease;\r\n `;\r\n stepEl.id = `processing-step-${step.id}`;\r\n\r\n const iconEl = document.createElement(\"div\");\r\n iconEl.style.cssText = `\r\n width:32px;height:32px;border-radius:8px;display:flex;align-items:center;justify-content:center;\r\n font-size:14px;background:${this.theme.shimmer};border:1px solid ${this.theme.border};\r\n `;\r\n iconEl.textContent = step.icon;\r\n iconEl.id = `step-icon-${step.id}`;\r\n\r\n const textEl = document.createElement(\"div\");\r\n textEl.style.cssText = `flex:1;color:${this.theme.textSecondary};font-size:13px;font-weight:500;`;\r\n textEl.textContent = step.text;\r\n textEl.id = `step-text-${step.id}`;\r\n\r\n const statusEl = document.createElement(\"div\");\r\n statusEl.style.cssText = `\r\n width:20px;height:20px;border-radius:50%;\r\n border:2px solid ${this.theme.border};\r\n position:relative;\r\n `;\r\n statusEl.id = `step-status-${step.id}`;\r\n\r\n stepEl.appendChild(iconEl);\r\n stepEl.appendChild(textEl);\r\n stepEl.appendChild(statusEl);\r\n stepsContainer.appendChild(stepEl);\r\n });\r\n\r\n container.appendChild(stepsContainer);\r\n\r\n // Start processing animation\r\n this.startProcessingAnimation();\r\n }\r\n\r\n private startProcessingAnimation(): void {\r\n const steps = ['uploading', 'scanning', 'verifying', 'analyzing'];\r\n let currentStepIndex = 0;\r\n\r\n const animateStep = (stepId: string) => {\r\n // Update step appearance\r\n const stepEl = document.getElementById(`processing-step-${stepId}`);\r\n const iconEl = document.getElementById(`step-icon-${stepId}`);\r\n const textEl = document.getElementById(`step-text-${stepId}`);\r\n const statusEl = document.getElementById(`step-status-${stepId}`);\r\n\r\n if (stepEl && iconEl && textEl && statusEl) {\r\n // Active state\r\n stepEl.style.borderColor = this.theme.primary;\r\n stepEl.style.background = `${this.theme.primary}10`;\r\n iconEl.style.background = this.theme.primary;\r\n iconEl.style.color = 'white';\r\n textEl.style.color = this.theme.text;\r\n textEl.style.fontWeight = '600';\r\n\r\n // Add spinner to status\r\n statusEl.innerHTML = `\r\n <div style=\"\r\n position:absolute;inset:2px;border-radius:50%;\r\n border:2px solid ${this.theme.border};\r\n border-top-color:${this.theme.primary};\r\n animation:sc-spin 0.8s linear infinite;\r\n \"></div>\r\n `;\r\n }\r\n\r\n // Move to next step after delay\r\n setTimeout(() => {\r\n // Complete current step\r\n if (stepEl && iconEl && textEl && statusEl) {\r\n stepEl.style.borderColor = this.theme.success;\r\n stepEl.style.background = `${this.theme.success}10`;\r\n iconEl.style.background = this.theme.success;\r\n statusEl.innerHTML = `\r\n <div style=\"\r\n position:absolute;inset:3px;border-radius:50%;\r\n background:${this.theme.success};\r\n display:flex;align-items:center;justify-content:center;\r\n color:white;font-size:10px;font-weight:bold;\r\n \">\u2713</div>\r\n `;\r\n }\r\n\r\n currentStepIndex++;\r\n if (currentStepIndex < steps.length) {\r\n animateStep(steps[currentStepIndex]);\r\n }\r\n }, 2000); // 2 seconds per step\r\n };\r\n\r\n // Start animation\r\n setTimeout(() => animateStep(steps[0]), 500);\r\n }\r\n\r\n \r\n /**\r\n * Process document capture result with front/back support\r\n */\r\n private async processDocumentCaptureResult(\r\n result: DocumentCaptureResult,\r\n captureContainer: HTMLElement,\r\n container: HTMLElement\r\n ): Promise<void> {\r\n // Store both front and back blobs\r\n this.documentBlob = result.front;\r\n this.documentBackBlob = result.back || null;\r\n \r\n // Process the front image through the existing flow\r\n await this.processDocumentBlob(result.front, captureContainer, container);\r\n \r\n // Log back image capture\r\n if (result.back) {\r\n console.log(\"Back image captured, size:\", result.back.size);\r\n }\r\n }\r\n\r\n /**\r\n * Process document blob - common method for both CameraView and DocumentCapture\r\n */\r\n private async processDocumentBlob(\r\n blob: Blob,\r\n captureContainer: HTMLElement,\r\n container: HTMLElement\r\n ): Promise<void> {\r\n const maxRetries = 2;\r\n let retryCount = 0;\r\n\r\n const attemptProcessing = async (): Promise<void> => {\r\n try {\r\n // Validate blob\r\n if (!blob || blob.size === 0) {\r\n throw new Error(\"Failed to capture document. Please try again.\");\r\n }\r\n if (blob.size > 2 * 1024 * 1024) {\r\n throw new Error(\"Document image is too large. Please retake in better lighting or use a clearer photo.\");\r\n }\r\n \r\n this.documentBlob = blob;\r\n\r\n // Show scanning state\r\n captureContainer.innerHTML = `\r\n <div style=\"display:flex;flex-direction:column;align-items:center;gap:14px;padding:28px 20px;\">\r\n <div style=\"position:relative;width:52px;height:52px;\">\r\n <div style=\"position:absolute;inset:0;border-radius:50%;border:3px solid ${this.theme.border};border-top-color:${this.theme.primary};animation:sc-spin 0.8s linear infinite;\"></div>\r\n <div style=\"position:absolute;inset:0;display:flex;align-items:center;justify-content:center;font-size:20px;\">\uD83D\uDD0D</div>\r\n </div>\r\n <div style=\"color:${this.theme.text};font-size:14px;font-weight:600;\">Scanning document...</div>\r\n <div style=\"color:${this.theme.textSecondary};font-size:12px;text-align:center;max-width:200px;line-height:1.5;\">Running OCR and verifying your identity</div>\r\n </div>`;\r\n\r\n // Create liveness entry with document\r\n const identifier = `DOC-${Date.now()}`;\r\n const COUNTRY_CODES: Record<string, string> = {\r\n nigeria: \"NG\", ghana: \"GH\", kenya: \"KE\",\r\n south_africa: \"ZA\", united_states: \"US\", united_kingdom: \"GB\", global: \"US\",\r\n };\r\n const country = COUNTRY_CODES[this.selectedCountry] || this.selectedCountry.toUpperCase().slice(0, 2);\r\n\r\n const deviceMeta = collectDeviceMetadata();\r\n let createResult;\r\n try {\r\n createResult = await this.sdk.liveness.create({\r\n identifier,\r\n identifier_type: this.selectedIdType,\r\n country,\r\n challenge_actions: [\"BLINK\", \"TURN_LEFT\", \"OPEN_MOUTH\"],\r\n document: blob,\r\n document_back: this.documentBackBlob || undefined,\r\n device_type: deviceMeta.device_type,\r\n os_name: deviceMeta.os_name,\r\n browser_timezone: deviceMeta.browser_timezone,\r\n fingerprint_id: deviceMeta.fingerprint_id,\r\n });\r\n } catch (apiError: any) {\r\n // Handle specific network and API errors\r\n if (apiError.message?.includes('fetch') || apiError.message?.includes('network') || apiError.code === 'NETWORK_ERROR') {\r\n throw new Error(\"Network connection failed. Please check your internet connection and try again.\");\r\n } else if (apiError.message?.includes('413') || apiError.message?.includes('too large')) {\r\n throw new Error(\"Document image is too large. Please use a smaller image or retake the photo.\");\r\n } else if (apiError.message?.includes('415') || apiError.message?.includes('format')) {\r\n throw new Error(\"Unsupported image format. Please use JPEG or PNG images.\");\r\n } else if (apiError.message?.includes('401') || apiError.message?.includes('unauthorized')) {\r\n throw new Error(\"Session expired. Please refresh the page and try again.\");\r\n } else if (apiError.message?.includes('429') || apiError.message?.includes('rate limit')) {\r\n throw new Error(\"Too many requests. Please wait a moment and try again.\");\r\n } else {\r\n throw new Error(apiError.message || \"Failed to process document. Please try again.\");\r\n }\r\n }\r\n\r\n this.livenessEntryId = createResult.id;\r\n\r\n // Check if document was expired\r\n const docOcr = (createResult as any).document_ocr;\r\n if (docOcr && docOcr.status === \"expired\") {\r\n throw new Error(docOcr.message || \"Document has expired. Please use a valid document.\");\r\n }\r\n\r\n // Check image quality\r\n const imgQuality = docOcr?.image_quality;\r\n const isBlurry = imgQuality?.is_blurry === true;\r\n const lowConfidence = imgQuality?.ocr_confidence !== undefined && imgQuality.ocr_confidence < 0.45;\r\n if (isBlurry || lowConfidence) {\r\n throw new Error(\"Image quality too low. Please ensure the document is well-lit and clearly visible.\");\r\n }\r\n\r\n // Show processing step instead of immediate success\r\n this.showStep(\"processing\");\r\n \r\n // Simulate processing time and then proceed to liveness\r\n setTimeout(() => {\r\n this.showStep(\"liveness\");\r\n }, 8000); // 8 seconds total processing time (4 steps \u00D7 2 seconds each)\r\n\r\n } catch (err: any) {\r\n console.error(\"Document processing failed:\", err);\r\n \r\n if (retryCount < maxRetries) {\r\n retryCount++;\r\n console.log(`Retrying document processing (attempt ${retryCount}/${maxRetries})`);\r\n \r\n // Show retry message\r\n if (captureContainer) {\r\n captureContainer.innerHTML = `\r\n <div style=\"display:flex;flex-direction:column;align-items:center;gap:16px;padding:28px 20px;text-align:center;\">\r\n <div style=\"position:relative;width:52px;height:52px;\">\r\n <div style=\"position:absolute;inset:0;border-radius:50%;border:3px solid ${this.theme.border};border-top-color:${this.theme.primary};animation:sc-spin 0.8s linear infinite;\"></div>\r\n <div style=\"position:absolute;inset:0;display:flex;align-items:center;justify-content:center;font-size:20px;\">\uD83D\uDD04</div>\r\n </div>\r\n <div style=\"color:${this.theme.text};font-size:14px;font-weight:600;\">Retrying...</div>\r\n <div style=\"color:${this.theme.textSecondary};font-size:12px;max-width:240px;line-height:1.5;\">Attempt ${retryCount} of ${maxRetries}</div>\r\n </div>`;\r\n }\r\n \r\n // Wait before retry\r\n await new Promise(resolve => setTimeout(resolve, 2000));\r\n return attemptProcessing();\r\n } else {\r\n // Final retry failed, show detailed error\r\n this.handleDocumentProcessingError(err, captureContainer);\r\n }\r\n }\r\n };\r\n\r\n await attemptProcessing();\r\n }\r\n\r\n private handleDocumentProcessingError(error: any, captureContainer: HTMLElement): void {\r\n let errorMessage = \"Document verification failed. Please try again.\";\r\n let canRetry = true;\r\n\r\n if (error.message) {\r\n if (error.message.includes(\"expired\")) {\r\n errorMessage = \"Document has expired. Please use a valid document.\";\r\n canRetry = false;\r\n } else if (error.message.includes(\"quality too low\")) {\r\n errorMessage = \"Image quality too low. Please ensure the document is well-lit and clearly visible.\";\r\n } else if (error.message.includes(\"Network\") || error.message.includes(\"fetch\")) {\r\n errorMessage = \"Network connection failed. Please check your internet connection and try again.\";\r\n } else if (error.message.includes(\"413\") || error.message.includes(\"too large\")) {\r\n errorMessage = \"Document image is too large. Please use a smaller image or retake the photo.\";\r\n } else if (error.message.includes(\"415\") || error.message.includes(\"format\")) {\r\n errorMessage = \"Unsupported image format. Please use JPEG or PNG images.\";\r\n }\r\n }\r\n\r\n if (captureContainer) {\r\n captureContainer.innerHTML = `\r\n <div style=\"display:flex;flex-direction:column;align-items:center;gap:16px;padding:28px 20px;text-align:center;\">\r\n <div style=\"width:56px;height:56px;border-radius:50%;background:${this.theme.errorBg || '#FEE'};border:3px solid ${this.theme.error || '#DC3545'};display:flex;align-items:center;justify-content:center;font-size:26px;\">\u274C</div>\r\n <div style=\"color:${this.theme.text};font-size:14px;font-weight:700;\">Verification Failed</div>\r\n <div style=\"color:${this.theme.textSecondary};font-size:13px;max-width:240px;line-height:1.6;\">${errorMessage}</div>\r\n ${canRetry ? `\r\n <button id=\"retry-btn\" style=\"\r\n margin-top:8px;padding:12px 24px;border-radius:8px;\r\n background:${this.theme.primary};color:white;\r\n border:none;font-size:14px;font-weight:600;cursor:pointer;\r\n transition:all 0.2s ease;\r\n \">Try Again</button>\r\n ` : ''}\r\n </div>`;\r\n\r\n if (canRetry) {\r\n const retryBtn = captureContainer.querySelector(\"#retry-btn\") as HTMLButtonElement;\r\n if (retryBtn) {\r\n retryBtn.addEventListener(\"click\", () => {\r\n this.showStep(\"document_capture\");\r\n });\r\n }\r\n }\r\n } else {\r\n this.showErrorStep(errorMessage);\r\n }\r\n }\r\n\r\n // \u2500\u2500 Liveness \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\r\n\r\n private renderLiveness(container: HTMLElement): void {\r\n container.style.cssText += \"display:flex;flex-direction:column;gap:16px;\";\r\n\r\n const title = this.createStepTitle(\"Face verification\");\r\n container.appendChild(title);\r\n\r\n const desc = document.createElement(\"div\");\r\n desc.style.cssText = `color:${this.theme.textSecondary};font-size:13px;margin-top:-8px;line-height:1.5;`;\r\n desc.textContent = \"Position your face in the oval and follow the on-screen instructions.\";\r\n container.appendChild(desc);\r\n\r\n // Liveness mount point\r\n const livenessContainer = document.createElement(\"div\");\r\n livenessContainer.style.cssText = \"margin:8px 0;\";\r\n container.appendChild(livenessContainer);\r\n\r\n const identifier = this.idNumber || `DOC-${Date.now()}`;\r\n const COUNTRY_CODES: Record<string, string> = {\r\n nigeria: \"NG\",\r\n ghana: \"GH\",\r\n kenya: \"KE\",\r\n south_africa: \"ZA\",\r\n united_states: \"US\",\r\n united_kingdom: \"GB\",\r\n global: \"US\",\r\n };\r\n const country = COUNTRY_CODES[this.selectedCountry] || this.selectedCountry.toUpperCase().slice(0, 2);\r\n\r\n // Start liveness check (this handles camera, detection, recording, submission)\r\n // If livenessEntryId exists (document flow), reuse it instead of creating a new one\r\n this.sdk.liveness\r\n .startCheck(\r\n livenessContainer,\r\n {\r\n identifier,\r\n identifier_type: this.selectedIdType,\r\n country,\r\n document: this.documentBlob || undefined,\r\n document_back: this.documentBackBlob || undefined,\r\n identity_check: this.identityCheckId || undefined,\r\n },\r\n [\"BLINK\", \"TURN_LEFT\", \"OPEN_MOUTH\"] as ChallengeAction[],\r\n this.livenessEntryId || undefined\r\n )\r\n .then((result) => {\r\n this.showResult(result);\r\n })\r\n .catch((err) => {\r\n this.showErrorStep(err.message || \"Liveness verification failed. Please try again.\");\r\n });\r\n }\r\n\r\n // \u2500\u2500 Result \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\r\n\r\n private showResult(submitResult: LivenessSubmitResponse): void {\r\n this.currentStep = \"result\";\r\n this.updateProgress();\r\n\r\n if (!this.contentArea) return;\r\n this.contentArea.innerHTML = \"\";\r\n\r\n const wrapper = document.createElement(\"div\");\r\n wrapper.style.cssText = `\r\n display:flex;flex-direction:column;align-items:center;\r\n text-align:center;gap:16px;padding:20px 0;\r\n opacity:0;transform:scale(0.95);transition:all 0.4s ease;\r\n `;\r\n\r\n // Icon \u2014 starts as a spinner, updates when status resolves\r\n const iconWrap = document.createElement(\"div\");\r\n iconWrap.style.cssText = `\r\n width:80px;height:80px;border-radius:50%;\r\n display:flex;align-items:center;justify-content:center;\r\n font-size:36px;\r\n background:${this.theme.cardBg};\r\n border:3px solid ${this.theme.border};\r\n `;\r\n iconWrap.innerHTML = `<div style=\"width:32px;height:32px;border-radius:50%;border:3px solid ${this.theme.border};border-top-color:${this.theme.primary};animation:sc-spin 0.9s linear infinite;\"></div>`;\r\n wrapper.appendChild(iconWrap);\r\n\r\n const title = document.createElement(\"h2\");\r\n title.style.cssText = `color:${this.theme.text};font-size:20px;font-weight:700;margin:0;`;\r\n title.textContent = \"Verification Submitted\";\r\n wrapper.appendChild(title);\r\n\r\n const desc = document.createElement(\"p\");\r\n desc.style.cssText = `color:${this.theme.textSecondary};font-size:14px;line-height:1.6;margin:0;max-width:300px;`;\r\n desc.textContent = \"Processing your identity check. This takes around 30 seconds.\";\r\n wrapper.appendChild(desc);\r\n\r\n // Details card\r\n const details = document.createElement(\"div\");\r\n details.style.cssText = `\r\n width:100%;padding:16px;border-radius:12px;\r\n background:${this.theme.cardBg};border:1px solid ${this.theme.border};\r\n text-align:left;\r\n `;\r\n // Status badge \u2014 mutable DOM node so polling can update it\r\n const statusBadge = document.createElement(\"span\");\r\n statusBadge.style.cssText = `font-size:12px;font-weight:600;color:${this.theme.warning};`;\r\n statusBadge.textContent = \"Processing\u2026\";\r\n\r\n const statusRow = document.createElement(\"div\");\r\n statusRow.style.cssText = \"display:flex;justify-content:space-between;margin-bottom:8px;\";\r\n statusRow.innerHTML = `<span style=\"color:${this.theme.textMuted};font-size:12px;\">Status</span>`;\r\n statusRow.appendChild(statusBadge);\r\n\r\n // Build rows via DOM (not innerHTML+=) to keep statusBadge live in the document\r\n const entryRow = document.createElement(\"div\");\r\n entryRow.style.cssText = \"display:flex;justify-content:space-between;margin-bottom:8px;\";\r\n entryRow.innerHTML = `\r\n <span style=\"color:${this.theme.textMuted};font-size:12px;\">Entry ID</span>\r\n <span style=\"color:${this.theme.text};font-size:12px;font-weight:600;\">${submitResult.id}</span>\r\n `;\r\n details.appendChild(entryRow);\r\n details.appendChild(statusRow);\r\n\r\n const submittedRow = document.createElement(\"div\");\r\n submittedRow.style.cssText = \"display:flex;justify-content:space-between;margin-top:8px;\";\r\n submittedRow.innerHTML = `\r\n <span style=\"color:${this.theme.textMuted};font-size:12px;\">Submitted</span>\r\n <span style=\"color:${this.theme.text};font-size:12px;\">${submitResult.submitted_at ? new Date(submitResult.submitted_at).toLocaleString() : \"Just now\"}</span>\r\n `;\r\n details.appendChild(submittedRow);\r\n wrapper.appendChild(details);\r\n\r\n // Failure reason \u2014 hidden until status = failed\r\n const failureMsg = document.createElement(\"div\");\r\n failureMsg.style.cssText = `\r\n display:none;width:100%;padding:12px 14px;border-radius:10px;\r\n background:${this.theme.errorBg};border:1px solid ${this.theme.error};\r\n color:${this.theme.error};font-size:12px;text-align:left;line-height:1.5;\r\n `;\r\n wrapper.appendChild(failureMsg);\r\n\r\n // Done button\r\n const doneBtn = this.createPrimaryButton(\"Done\");\r\n let finalStatus = submitResult.status as string;\r\n doneBtn.addEventListener(\"click\", () => {\r\n if (this._pollStatusTimer) { clearTimeout(this._pollStatusTimer); this._pollStatusTimer = null; }\r\n this.options.onComplete?.({\r\n entryId: submitResult.id,\r\n sessionId: this.sdk.sessionToken,\r\n status: finalStatus,\r\n submittedAt: submitResult.submitted_at,\r\n verificationResult: this.verificationResult || undefined,\r\n });\r\n this.close();\r\n });\r\n wrapper.appendChild(doneBtn);\r\n\r\n this.contentArea.appendChild(wrapper);\r\n\r\n requestAnimationFrame(() => {\r\n wrapper.style.opacity = \"1\";\r\n wrapper.style.transform = \"scale(1)\";\r\n });\r\n\r\n // Start polling for the async result\r\n this._startStatusPolling(\r\n submitResult.id,\r\n iconWrap,\r\n statusBadge,\r\n title,\r\n desc,\r\n failureMsg,\r\n (resolved) => { finalStatus = resolved; }\r\n );\r\n }\r\n\r\n private _startStatusPolling(\r\n entryId: number,\r\n iconWrap: HTMLElement,\r\n statusBadge: HTMLElement,\r\n title: HTMLElement,\r\n desc: HTMLElement,\r\n failureMsg: HTMLElement,\r\n onResolved: (status: string) => void\r\n ): void {\r\n const MAX_POLLS = 25; // 25 \u00D7 3 s = 75 s + 4 s initial = ~79 s max\r\n let polls = 0;\r\n\r\n // Hard 30 s UI timer \u2014 stops spinner even if backend is still processing\r\n let uiTimeoutId: ReturnType<typeof setTimeout> | null = setTimeout(() => {\r\n if (!this.isDestroyed) applyTimeout();\r\n }, 30000);\r\n const clearUiTimeout = () => { if (uiTimeoutId) { clearTimeout(uiTimeoutId); uiTimeoutId = null; } };\r\n\r\n const applyTimeout = () => {\r\n iconWrap.innerHTML = \"\u23F1\";\r\n iconWrap.style.background = this.theme.cardBg;\r\n iconWrap.style.border = `3px solid ${this.theme.warning}`;\r\n iconWrap.style.color = this.theme.warning;\r\n iconWrap.style.fontSize = \"30px\";\r\n statusBadge.style.color = this.theme.textMuted;\r\n statusBadge.textContent = \"Still processing\u2026\";\r\n title.textContent = \"Verification In Progress\";\r\n desc.textContent = \"Your verification is being processed. Your result will be delivered via your dashboard or webhook. You can safely close this.\";\r\n };\r\n\r\n const applyPassed = () => {\r\n clearUiTimeout();\r\n iconWrap.innerHTML = \"\u2713\";\r\n iconWrap.style.background = this.theme.successBg;\r\n iconWrap.style.border = `3px solid ${this.theme.success}`;\r\n iconWrap.style.color = this.theme.success;\r\n iconWrap.style.fontSize = \"36px\";\r\n statusBadge.style.color = this.theme.success;\r\n statusBadge.textContent = \"Verified \u2713\";\r\n title.textContent = \"Identity Verified\";\r\n desc.textContent = \"Your identity check passed successfully.\";\r\n };\r\n\r\n const applyFailed = (reason: string | null) => {\r\n clearUiTimeout();\r\n iconWrap.innerHTML = \"\u2715\";\r\n iconWrap.style.background = this.theme.errorBg;\r\n iconWrap.style.border = `3px solid ${this.theme.error}`;\r\n iconWrap.style.color = this.theme.error;\r\n iconWrap.style.fontSize = \"32px\";\r\n statusBadge.style.color = this.theme.error;\r\n statusBadge.textContent = \"Failed\";\r\n title.textContent = \"Verification Failed\";\r\n desc.textContent = \"Your identity check could not be completed.\";\r\n if (reason) {\r\n failureMsg.textContent = reason;\r\n failureMsg.style.display = \"block\";\r\n }\r\n };\r\n\r\n const poll = async () => {\r\n if (this.isDestroyed) return;\r\n polls++;\r\n try {\r\n const result = await this.sdk.liveness.pollResult(entryId);\r\n if (result.status === \"passed\") {\r\n onResolved(\"passed\");\r\n applyPassed();\r\n return;\r\n }\r\n if (result.status === \"failed\" || result.status === \"expired_document\") {\r\n onResolved(result.status);\r\n applyFailed(result.failure_reason);\r\n return;\r\n }\r\n // Still pending/processing \u2014 schedule next poll if budget remains\r\n if (polls < MAX_POLLS && !this.isDestroyed) {\r\n this._pollStatusTimer = setTimeout(poll, 3000);\r\n } else if (!this.isDestroyed) {\r\n applyTimeout(); // budget exhausted \u2014 stop spinner, show timeout state\r\n }\r\n } catch {\r\n // Network hiccup \u2014 retry with a slightly longer delay\r\n if (polls < MAX_POLLS && !this.isDestroyed) {\r\n this._pollStatusTimer = setTimeout(poll, 5000);\r\n } else if (!this.isDestroyed) {\r\n applyTimeout(); // budget exhausted \u2014 stop spinner\r\n }\r\n }\r\n };\r\n\r\n // First poll after 4 s \u2014 gives Celery task time to complete\r\n this._pollStatusTimer = setTimeout(poll, 4000);\r\n }\r\n\r\n private renderResult(_container: HTMLElement): void {\r\n // Handled by showResult() directly\r\n }\r\n\r\n // \u2500\u2500 Error \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\r\n\r\n private showErrorStep(message: string): void {\r\n this.currentStep = \"error\";\r\n if (!this.contentArea) return;\r\n this.contentArea.innerHTML = \"\";\r\n\r\n const wrapper = document.createElement(\"div\");\r\n wrapper.style.cssText = `\r\n display:flex;flex-direction:column;align-items:center;\r\n text-align:center;gap:16px;padding:20px 0;\r\n `;\r\n\r\n const isCameraErr = /camera|permission|notallowed|notfound/i.test(message);\r\n const isNetworkErr = /network|timeout|connection|fetch/i.test(message);\r\n const isAuthErr = /session|token|expired|authentication/i.test(message);\r\n const errorIcon = isCameraErr ? \"\\uD83D\\uDCF7\" : isNetworkErr ? \"\\uD83D\\uDCE1\" : isAuthErr ? \"\\u23F1\" : \"\\u2717\";\r\n const errorTitle = isCameraErr ? \"Camera Access Required\"\r\n : isNetworkErr ? \"Connection Problem\"\r\n : isAuthErr ? \"Session Expired\"\r\n : \"Verification Failed\";\r\n\r\n const iconWrap = document.createElement(\"div\");\r\n iconWrap.style.cssText = `\r\n width:72px;height:72px;border-radius:50%;\r\n display:flex;align-items:center;justify-content:center;\r\n font-size:${errorIcon === \"\\u2717\" ? \"32px\" : \"28px\"};\r\n background:${this.theme.errorBg};\r\n border:3px solid ${this.theme.error};\r\n `;\r\n iconWrap.textContent = errorIcon;\r\n wrapper.appendChild(iconWrap);\r\n\r\n const title = document.createElement(\"h2\");\r\n title.style.cssText = `color:${this.theme.text};font-size:18px;font-weight:700;margin:0;`;\r\n title.textContent = errorTitle;\r\n wrapper.appendChild(title);\r\n\r\n const desc = document.createElement(\"p\");\r\n desc.style.cssText = `color:${this.theme.textSecondary};font-size:14px;line-height:1.6;margin:0;max-width:300px;`;\r\n desc.textContent = message;\r\n wrapper.appendChild(desc);\r\n\r\n const retryBtn = this.createPrimaryButton(\"Try Again\");\r\n retryBtn.addEventListener(\"click\", () => {\r\n // If session already exists, go back to welcome without re-initializing\r\n // (re-initializing would fail with CLIENT_ID_ALREADY_USED)\r\n if (this.sdk.sessionToken && this.sdkConfig) {\r\n this.showStep(\"welcome\");\r\n } else {\r\n // Only re-initialize if session was never created\r\n this.initialize();\r\n }\r\n });\r\n wrapper.appendChild(retryBtn);\r\n\r\n const closeBtn = this.createSecondaryButton(\"Close\");\r\n closeBtn.addEventListener(\"click\", () => {\r\n this.options.onError?.(new Error(message));\r\n this.close();\r\n });\r\n wrapper.appendChild(closeBtn);\r\n\r\n this.contentArea.appendChild(wrapper);\r\n }\r\n\r\n // \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\r\n // UI Helpers\r\n // \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\r\n\r\n private createHeader(): HTMLElement {\r\n const header = document.createElement(\"div\");\r\n header.style.cssText = `\r\n display:flex;align-items:center;justify-content:space-between;\r\n padding:14px 20px;border-bottom:1px solid ${this.theme.border};\r\n `;\r\n\r\n // Left: back button + brand\r\n const leftArea = document.createElement(\"div\");\r\n leftArea.style.cssText = \"display:flex;align-items:center;gap:8px;min-width:0;\";\r\n\r\n this.headerBackBtn = document.createElement(\"button\");\r\n this.headerBackBtn.innerHTML = \"←\";\r\n this.headerBackBtn.style.cssText = `\r\n width:30px;height:30px;border-radius:8px;flex-shrink:0;\r\n display:none;align-items:center;justify-content:center;\r\n border:1.5px solid ${this.theme.border};cursor:pointer;\r\n font-size:16px;line-height:1;\r\n background:${this.theme.cardBg};color:${this.theme.text};\r\n transition:all 0.2s ease;\r\n `;\r\n this.headerBackBtn.addEventListener(\"mouseenter\", () => {\r\n if (this.headerBackBtn) {\r\n this.headerBackBtn.style.background = this.theme.shimmer;\r\n }\r\n });\r\n this.headerBackBtn.addEventListener(\"mouseleave\", () => {\r\n if (this.headerBackBtn) {\r\n this.headerBackBtn.style.background = this.theme.cardBg;\r\n }\r\n });\r\n leftArea.appendChild(this.headerBackBtn);\r\n\r\n this.brandLabel = document.createElement(\"div\");\r\n this.brandLabel.style.cssText = `\r\n font-size:15px;font-weight:700;color:${this.theme.text};\r\n white-space:nowrap;overflow:hidden;text-overflow:ellipsis;\r\n `;\r\n this.brandLabel.textContent = this.sdkConfig?.brand_name || \"SmartComply\";\r\n leftArea.appendChild(this.brandLabel);\r\n header.appendChild(leftArea);\r\n\r\n // Step indicator\r\n this.stepLabel = document.createElement(\"div\");\r\n this.stepLabel.style.cssText = `\r\n font-size:12px;color:${this.theme.textMuted};\r\n font-variant-numeric:tabular-nums;flex-shrink:0;\r\n `;\r\n header.appendChild(this.stepLabel);\r\n\r\n // Close button\r\n const closeBtn = document.createElement(\"button\");\r\n closeBtn.innerHTML = \"\u2715\";\r\n closeBtn.style.cssText = `\r\n width:32px;height:32px;border-radius:8px;flex-shrink:0;\r\n display:flex;align-items:center;justify-content:center;\r\n border:none;cursor:pointer;font-size:16px;\r\n background:${this.theme.shimmer};color:${this.theme.textMuted};\r\n transition:all 0.2s ease;\r\n `;\r\n closeBtn.addEventListener(\"mouseenter\", () => {\r\n closeBtn.style.background = this.theme.errorBg;\r\n closeBtn.style.color = this.theme.error;\r\n });\r\n closeBtn.addEventListener(\"mouseleave\", () => {\r\n closeBtn.style.background = this.theme.shimmer;\r\n closeBtn.style.color = this.theme.textMuted;\r\n });\r\n closeBtn.addEventListener(\"click\", () => this.close());\r\n header.appendChild(closeBtn);\r\n\r\n return header;\r\n }\r\n\r\n private createFooter(): HTMLElement {\r\n const footer = document.createElement(\"div\");\r\n footer.style.cssText = `\r\n padding:12px 20px;border-top:1px solid ${this.theme.border};\r\n display:flex;align-items:center;justify-content:center;gap:6px;\r\n `;\r\n\r\n const powered = document.createElement(\"span\");\r\n powered.style.cssText = `font-size:11px;color:${this.theme.textMuted};`;\r\n powered.textContent = \"Powered by \";\r\n\r\n const brand = document.createElement(\"span\");\r\n brand.style.cssText = `font-size:11px;font-weight:700;color:${this.theme.primary};`;\r\n brand.textContent = \"Adhere\";\r\n\r\n footer.appendChild(powered);\r\n footer.appendChild(brand);\r\n return footer;\r\n }\r\n\r\n private createStepTitle(text: string): HTMLElement {\r\n const el = document.createElement(\"h3\");\r\n el.style.cssText = `\r\n color:${this.theme.text};font-size:18px;font-weight:700;\r\n margin:0;\r\n `;\r\n el.textContent = text;\r\n return el;\r\n }\r\n\r\n private createOptionCard(\r\n title: string,\r\n subtitle: string,\r\n onClick: () => void\r\n ): HTMLElement {\r\n const card = document.createElement(\"button\");\r\n card.style.cssText = `\r\n width:100%;padding:16px;border-radius:12px;\r\n background:${this.theme.cardBg};\r\n border:2px solid ${this.theme.border};\r\n cursor:pointer;text-align:left;\r\n display:flex;align-items:center;justify-content:space-between;\r\n transition:all 0.2s ease;\r\n `;\r\n card.addEventListener(\"mouseenter\", () => {\r\n card.style.borderColor = this.theme.primary;\r\n card.style.background = this.theme.shimmer;\r\n card.style.transform = \"translateY(-1px)\";\r\n });\r\n card.addEventListener(\"mouseleave\", () => {\r\n card.style.borderColor = this.theme.border;\r\n card.style.background = this.theme.cardBg;\r\n card.style.transform = \"translateY(0)\";\r\n });\r\n card.addEventListener(\"click\", onClick);\r\n\r\n const textWrap = document.createElement(\"div\");\r\n\r\n const titleEl = document.createElement(\"div\");\r\n titleEl.style.cssText = `color:${this.theme.text};font-size:14px;font-weight:600;`;\r\n titleEl.textContent = title;\r\n textWrap.appendChild(titleEl);\r\n\r\n if (subtitle) {\r\n const subEl = document.createElement(\"div\");\r\n subEl.style.cssText = `color:${this.theme.textMuted};font-size:12px;margin-top:2px;`;\r\n subEl.textContent = subtitle;\r\n textWrap.appendChild(subEl);\r\n }\r\n\r\n const arrow = document.createElement(\"span\");\r\n arrow.style.cssText = `color:${this.theme.textMuted};font-size:18px;flex-shrink:0;`;\r\n arrow.textContent = \"\u2192\";\r\n\r\n card.appendChild(textWrap);\r\n card.appendChild(arrow);\r\n return card;\r\n }\r\n\r\n private createPrimaryButton(text: string): HTMLButtonElement {\r\n const btn = document.createElement(\"button\");\r\n btn.textContent = text;\r\n btn.style.cssText = `\r\n width:100%;padding:14px;border-radius:12px;\r\n font-size:15px;font-weight:600;\r\n background:${this.theme.primary};color:#fff;\r\n border:none;cursor:pointer;\r\n transition:all 0.2s ease;\r\n box-shadow:0 2px 8px ${this.theme.primaryGlow};\r\n `;\r\n btn.addEventListener(\"mouseenter\", () => {\r\n btn.style.background = this.theme.primaryHover;\r\n btn.style.transform = \"translateY(-1px)\";\r\n });\r\n btn.addEventListener(\"mouseleave\", () => {\r\n btn.style.background = this.theme.primary;\r\n btn.style.transform = \"translateY(0)\";\r\n });\r\n return btn;\r\n }\r\n\r\n private createSecondaryButton(text: string): HTMLButtonElement {\r\n const btn = document.createElement(\"button\");\r\n btn.textContent = text;\r\n btn.style.cssText = `\r\n width:100%;padding:12px;border-radius:12px;\r\n font-size:14px;font-weight:500;\r\n background:transparent;color:${this.theme.textSecondary};\r\n border:none;cursor:pointer;\r\n transition:all 0.2s ease;\r\n `;\r\n btn.addEventListener(\"mouseenter\", () => {\r\n btn.style.color = this.theme.text;\r\n });\r\n btn.addEventListener(\"mouseleave\", () => {\r\n btn.style.color = this.theme.textSecondary;\r\n });\r\n return btn;\r\n }\r\n\r\n private isDocumentFlow(): boolean {\r\n // 1. Check verification_type \u2014 handle both string and array from backend\r\n const vType = this.sdkConfig?.verification_type;\r\n if (vType) {\r\n const types: string[] = Array.isArray(vType) ? vType : [vType];\r\n if (types.includes(\"document_verification\")) return true;\r\n if (types.includes(\"data_verification\")) return false;\r\n }\r\n // 2. Fallback: inspect channel fields \u2014 any upload field = document flow\r\n const channels = this.sdkConfig?.channels || {};\r\n const allFields = (Object.values(channels) as any[])\r\n .flat()\r\n .flatMap((ch: any) => ch.fields || []);\r\n return allFields.some((f: any) => f.type === \"upload\");\r\n }\r\n\r\n private updateProgress(): void {\r\n const isDocFlow = this.isDocumentFlow();\r\n const countries = Object.keys(this.sdkConfig?.channels || {});\r\n const singleCountry = countries.length <= 1;\r\n\r\n // User-action steps only (what the user actually does \u2014 no loading/welcome/result)\r\n const actionSteps: StepName[] = (\r\n [\"country\", \"id_type\", isDocFlow ? \"document_capture\" : \"id_input\", \"liveness\"] as StepName[]\r\n ).filter((s) => !(s === \"country\" && singleCountry));\r\n\r\n const totalSteps = actionSteps.length;\r\n const actionIndex = actionSteps.indexOf(this.currentStep);\r\n\r\n const pct =\r\n this.currentStep === \"result\" ? 100\r\n : actionIndex >= 0 ? ((actionIndex + 1) / totalSteps) * 100\r\n : 0;\r\n\r\n if (this.progressBar) {\r\n this.progressBar.style.width = `${pct}%`;\r\n }\r\n if (this.stepLabel) {\r\n if (this.currentStep === \"loading\" || this.currentStep === \"welcome\") {\r\n this.stepLabel.textContent = \"\";\r\n } else if (this.currentStep === \"result\") {\r\n this.stepLabel.textContent = \"Complete \u2713\";\r\n } else if (actionIndex >= 0) {\r\n this.stepLabel.textContent = `Step ${actionIndex + 1} of ${totalSteps}`;\r\n } else {\r\n this.stepLabel.textContent = \"\";\r\n }\r\n }\r\n\r\n // Back button \u2014 show in header for navigable steps, hidden elsewhere\r\n if (this.headerBackBtn) {\r\n const countries = Object.keys(this.sdkConfig?.channels || {});\r\n const backTargets: Partial<Record<StepName, () => void>> = {\r\n id_type: () => this.showStep(countries.length > 1 ? \"country\" : \"welcome\"),\r\n country: () => this.showStep(\"welcome\"),\r\n id_input: () => this.showStep(\"id_type\"),\r\n document_capture: () => { this.docCapture?.destroy(); this.showStep(\"id_type\"); },\r\n };\r\n const backAction = backTargets[this.currentStep];\r\n if (backAction) {\r\n this.headerBackBtn.style.display = \"flex\";\r\n const newBtn = this.headerBackBtn.cloneNode(true) as HTMLButtonElement;\r\n newBtn.style.cssText = this.headerBackBtn.style.cssText;\r\n this.headerBackBtn.parentNode?.replaceChild(newBtn, this.headerBackBtn);\r\n this.headerBackBtn = newBtn;\r\n this.headerBackBtn.addEventListener(\"mouseenter\", () => {\r\n if (this.headerBackBtn) this.headerBackBtn.style.background = this.theme.shimmer;\r\n });\r\n this.headerBackBtn.addEventListener(\"mouseleave\", () => {\r\n if (this.headerBackBtn) this.headerBackBtn.style.background = this.theme.cardBg;\r\n });\r\n this.headerBackBtn.addEventListener(\"click\", backAction);\r\n } else {\r\n this.headerBackBtn.style.display = \"none\";\r\n }\r\n }\r\n }\r\n\r\n private applyTheme(): void {\r\n if (this.overlay) {\r\n this.overlay.style.background = this.theme.overlay;\r\n }\r\n if (this.modal) {\r\n this.modal.style.background = this.theme.bg;\r\n this.modal.style.boxShadow = this.theme.shadow;\r\n }\r\n }\r\n\r\n private injectStyles(): void {\r\n if (document.getElementById(\"sc-flow-styles\")) return;\r\n\r\n const style = document.createElement(\"style\");\r\n style.id = \"sc-flow-styles\";\r\n style.textContent = `\r\n @keyframes sc-spin {\r\n to { transform: rotate(360deg); }\r\n }\r\n @keyframes sc-pop {\r\n 0% { transform: scale(0.8); opacity: 0; }\r\n 50% { transform: scale(1.05); }\r\n 100% { transform: scale(1); opacity: 1; }\r\n }\r\n #sc-flow-modal * {\r\n box-sizing: border-box;\r\n }\r\n #sc-flow-modal::-webkit-scrollbar {\r\n width: 4px;\r\n }\r\n #sc-flow-content::-webkit-scrollbar {\r\n width: 4px;\r\n }\r\n #sc-flow-content::-webkit-scrollbar-thumb {\r\n background: rgba(128,128,128,0.3);\r\n border-radius: 4px;\r\n }\r\n `;\r\n document.head.appendChild(style);\r\n }\r\n}\r\n", "/**\r\n * Lightweight SDK logger.\r\n *\r\n * Debug output is suppressed in production. Enable verbose logging by calling\r\n * SDKLogger.setDebug(true) before initialising the SDK, or by setting the\r\n * global flag: window.__SC_DEBUG__ = true\r\n */\r\n\r\nconst PREFIX = \"[SmartComply SDK]\";\r\n\r\nfunction isDebugEnabled(): boolean {\r\n try {\r\n return !!(window as any).__SC_DEBUG__;\r\n } catch {\r\n return false;\r\n }\r\n}\r\n\r\nexport const SDKLogger = {\r\n /** Emit an informational message (debug mode only). */\r\n info(message: string, ...args: unknown[]): void {\r\n if (!isDebugEnabled()) return;\r\n console.info(`${PREFIX} \u2139 ${message}`, ...args);\r\n },\r\n\r\n /** Emit a warning (always visible). */\r\n warn(message: string, ...args: unknown[]): void {\r\n console.warn(`${PREFIX} \u26A0 ${message}`, ...args);\r\n },\r\n\r\n /** Emit an error (always visible). */\r\n error(message: string, ...args: unknown[]): void {\r\n console.error(`${PREFIX} \u2716 ${message}`, ...args);\r\n },\r\n\r\n /** Emit a debug trace (debug mode only \u2014 lowest priority). */\r\n debug(message: string, ...args: unknown[]): void {\r\n if (!isDebugEnabled()) return;\r\n console.debug(`${PREFIX} \u2B21 ${message}`, ...args);\r\n },\r\n\r\n /** Log a timed group of related messages (debug mode only). */\r\n group(label: string, fn: () => void): void {\r\n if (!isDebugEnabled()) { fn(); return; }\r\n console.group(`${PREFIX} ${label}`);\r\n fn();\r\n console.groupEnd();\r\n },\r\n\r\n /**\r\n * Enable or disable verbose debug output at runtime.\r\n *\r\n * Example:\r\n * import { SDKLogger } from \"smartcomply-web-sdk\";\r\n * SDKLogger.setDebug(true);\r\n */\r\n setDebug(enabled: boolean): void {\r\n try {\r\n (window as any).__SC_DEBUG__ = enabled;\r\n } catch {\r\n /* no-op in non-browser environments */\r\n }\r\n },\r\n};\r\n", "/**\r\n * Camera permission utilities.\r\n *\r\n * Provides helpers to check, request and handle camera permissions in a\r\n * browser-consistent way. All functions are purely async and do NOT throw \u2014\r\n * they return a typed result so callers can handle each case explicitly.\r\n */\r\n\r\nexport type PermissionStatus =\r\n | \"granted\" // camera already accessible\r\n | \"prompt\" // permission dialog will appear on request\r\n | \"denied\" // user previously denied; cannot request again\r\n | \"unsupported\" // Permissions API or getUserMedia not available\r\n | \"unknown\"; // couldn't determine status\r\n\r\nexport interface CameraPermissionResult {\r\n status: PermissionStatus;\r\n /** Human-readable reason (populated on denied / unsupported). */\r\n reason?: string;\r\n}\r\n\r\n/**\r\n * Query the current camera permission state without prompting the user.\r\n *\r\n * Uses the Permissions API when available, falls back to \"unknown\" on older\r\n * browsers (e.g. Safari < 16).\r\n */\r\nexport async function queryCameraPermission(): Promise<CameraPermissionResult> {\r\n if (typeof navigator === \"undefined\" || !navigator.mediaDevices) {\r\n return { status: \"unsupported\", reason: \"getUserMedia is not supported in this browser.\" };\r\n }\r\n\r\n if (!navigator.permissions?.query) {\r\n return { status: \"unknown\" };\r\n }\r\n\r\n try {\r\n const result = await navigator.permissions.query({ name: \"camera\" as PermissionName });\r\n return { status: result.state as PermissionStatus };\r\n } catch {\r\n return { status: \"unknown\" };\r\n }\r\n}\r\n\r\n/**\r\n * Request camera access and return the resulting MediaStream.\r\n *\r\n * Maps browser-specific errors onto actionable `CameraPermissionResult`\r\n * values so callers can show the right UI instead of catching raw DOMExceptions.\r\n *\r\n * @param constraints - Optional MediaStreamConstraints override.\r\n */\r\nexport async function requestCameraAccess(\r\n constraints?: MediaStreamConstraints\r\n): Promise<{ stream: MediaStream; permission: CameraPermissionResult }> {\r\n const defaults: MediaStreamConstraints = {\r\n video: { facingMode: \"user\", width: { ideal: 640 }, height: { ideal: 480 } },\r\n audio: false,\r\n };\r\n\r\n try {\r\n const stream = await navigator.mediaDevices.getUserMedia(constraints ?? defaults);\r\n return { stream, permission: { status: \"granted\" } };\r\n } catch (err: any) {\r\n const name: string = err?.name ?? \"\";\r\n\r\n if (name === \"NotAllowedError\" || name === \"PermissionDeniedError\") {\r\n return {\r\n stream: null as any,\r\n permission: {\r\n status: \"denied\",\r\n reason: \"Camera access was denied. Please allow camera permissions in your browser settings and try again.\",\r\n },\r\n };\r\n }\r\n\r\n if (name === \"NotFoundError\" || name === \"DevicesNotFoundError\") {\r\n return {\r\n stream: null as any,\r\n permission: {\r\n status: \"unsupported\",\r\n reason: \"No camera was found. Please connect a camera and try again.\",\r\n },\r\n };\r\n }\r\n\r\n if (name === \"NotReadableError\" || name === \"TrackStartError\") {\r\n return {\r\n stream: null as any,\r\n permission: {\r\n status: \"unknown\",\r\n reason: \"Camera is already in use by another application. Please close it and try again.\",\r\n },\r\n };\r\n }\r\n\r\n return {\r\n stream: null as any,\r\n permission: {\r\n status: \"unknown\",\r\n reason: err?.message ?? \"Unable to access the camera.\",\r\n },\r\n };\r\n }\r\n}\r\n\r\n/**\r\n * Stop all tracks on a MediaStream and release the camera.\r\n * Safe to call with null/undefined.\r\n */\r\nexport function releaseCameraStream(stream: MediaStream | null | undefined): void {\r\n if (!stream) return;\r\n stream.getTracks().forEach((t) => t.stop());\r\n}\r\n\r\n/**\r\n * Returns true if the browser supports the camera APIs needed by the SDK.\r\n */\r\nexport function isCameraSupported(): boolean {\r\n return (\r\n typeof navigator !== \"undefined\" &&\r\n !!navigator.mediaDevices?.getUserMedia &&\r\n typeof MediaRecorder !== \"undefined\"\r\n );\r\n}\r\n", "/**\r\n * SDK-wide constants \u2014 single source of truth for limits, defaults and\r\n * backend-defined magic values.\r\n */\r\n\r\n// \u2500\u2500 API endpoints \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\r\n\r\nexport const ENDPOINTS = {\r\n SESSION_CREATE: \"/v1/session/create/\",\r\n SDK_INITIALIZE: \"/v1/initialize/\",\r\n ONBOARDING_VERIFY: \"/v1/onboarding/verify/\",\r\n LIVENESS_CREATE: \"/v1/liveness/create/\",\r\n LIVENESS_SUBMIT: \"/v1/liveness/submit/\",\r\n AVAILABLE_CHANNELS: \"/v1/available-channels/\",\r\n} as const;\r\n\r\n// \u2500\u2500 Session \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\r\n\r\n/** Backend session TTL in milliseconds (30 minutes). */\r\nexport const SESSION_TTL_MS = 30 * 60 * 1000;\r\n\r\n/** Warn the user this many ms before session expires. */\r\nexport const SESSION_WARN_BEFORE_MS = 2 * 60 * 1000;\r\n\r\n// \u2500\u2500 Network \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\r\n\r\n/** Default request timeout in milliseconds. */\r\nexport const DEFAULT_TIMEOUT_MS = 30_000;\r\n\r\n/** Number of automatic retries on transient network errors. */\r\nexport const MAX_RETRIES = 2;\r\n\r\n/** Delay between retries in milliseconds. */\r\nexport const RETRY_DELAY_MS = 1_000;\r\n\r\n// \u2500\u2500 File uploads \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\r\n\r\n/** Maximum document image size the backend accepts (5 MB). */\r\nexport const MAX_DOCUMENT_BYTES = 5 * 1024 * 1024;\r\n\r\n/** Maximum video size the backend accepts (50 MB). */\r\nexport const MAX_VIDEO_BYTES = 50 * 1024 * 1024;\r\n\r\n/** Maximum snapshot / autoshot size (2 MB). */\r\nexport const MAX_SNAPSHOT_BYTES = 2 * 1024 * 1024;\r\n\r\n/** Accepted MIME types for document images. */\r\nexport const ACCEPTED_IMAGE_TYPES = [\"image/jpeg\", \"image/png\", \"image/webp\"] as const;\r\n\r\n/** JPEG quality used when encoding captured frames (0\u20131). */\r\nexport const CAPTURE_JPEG_QUALITY = 0.92;\r\n\r\n// \u2500\u2500 Liveness challenge \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\r\n\r\n/** Backend-accepted challenge actions (UPPERCASE). */\r\nexport const CHALLENGE_ACTIONS = [\"BLINK\", \"TURN_LEFT\", \"TURN_RIGHT\", \"TURN_HEAD\", \"OPEN_MOUTH\"] as const;\r\n\r\n/** Default set sent when the caller does not specify actions. */\r\nexport const DEFAULT_CHALLENGE_ACTIONS = [\"BLINK\", \"TURN_LEFT\", \"OPEN_MOUTH\"] as const;\r\n\r\n/** Time limit per liveness attempt in seconds. */\r\nexport const LIVENESS_TIME_LIMIT_SECONDS = 45;\r\n\r\n/** Milliseconds to pause after all actions before capturing the final snapshot. */\r\nexport const POST_ACTION_SETTLE_MS = 800;\r\n\r\n// \u2500\u2500 Camera \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\r\n\r\n/** Ideal resolution for the front-facing liveness camera. */\r\nexport const CAMERA_IDEAL_WIDTH = 640;\r\nexport const CAMERA_IDEAL_HEIGHT = 480;\r\n\r\n/** Ideal resolution for rear-facing document capture camera. */\r\nexport const DOC_CAMERA_IDEAL_WIDTH = 1280;\r\nexport const DOC_CAMERA_IDEAL_HEIGHT = 960;\r\n\r\n/** Video bitrate used by MediaRecorder for liveness recordings (~1.4 MB / 45 s). */\r\nexport const RECORDING_BITS_PER_SECOND = 250_000;\r\n\r\n// \u2500\u2500 Face detection \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\r\n\r\n/** Max milliseconds to wait for an initial face detection before proceeding. */\r\nexport const FACE_DETECT_TIMEOUT_MS = 10_000;\r\n\r\n/** Polling interval for the face-present check (ms). */\r\nexport const FACE_DETECT_POLL_MS = 100;\r\n\r\n// \u2500\u2500 UI / UX \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\r\n\r\n/** How long (ms) the success overlay is shown before the flow advances. */\r\nexport const RESULT_OVERLAY_DURATION_MS = 2_800;\r\n\r\n/** localStorage key used to persist the browser fingerprint ID. */\r\nexport const FINGERPRINT_STORAGE_KEY = \"_adhere_fid\";\r\n\r\n/** z-index for the SDK overlay \u2014 high enough to sit above any app content. */\r\nexport const OVERLAY_Z_INDEX = 99_999;\r\n", "/**\r\n * LivenessUploader \u2014 thin wrapper around the HttpClient's uploadWithSession()\r\n * that adds:\r\n * - Progress callbacks (onProgress)\r\n * - Upload cancellation via AbortController\r\n * - Automatic retry on transient network failure (configurable)\r\n *\r\n * Used internally by LivenessModule.create() and LivenessModule.submit() when\r\n * the caller needs progress reporting (e.g. for a progress bar during video\r\n * upload on slow connections).\r\n */\r\n\r\nimport { HttpClient } from \"../../client/HttpClient\";\r\nimport { MAX_RETRIES, RETRY_DELAY_MS } from \"../../utils/constants\";\r\nimport { SDKLogger } from \"../../utils/logger\";\r\n\r\nexport interface UploadOptions {\r\n /** Called with a value 0\u20131 as the upload progresses. */\r\n onProgress?: (fraction: number) => void;\r\n\r\n /** Optional AbortSignal to cancel the upload mid-flight. */\r\n signal?: AbortSignal;\r\n\r\n /** Override the default number of retries on transient errors. */\r\n retries?: number;\r\n}\r\n\r\nexport class LivenessUploader {\r\n constructor(private http: HttpClient) {}\r\n\r\n /**\r\n * Upload a FormData payload to `path` with optional progress and\r\n * cancellation support.\r\n *\r\n * Falls back to the standard `uploadWithSession()` on browsers that do not\r\n * support XMLHttpRequest upload progress (very rare).\r\n */\r\n async upload<T>(\r\n path: string,\r\n formData: FormData,\r\n options: UploadOptions = {}\r\n ): Promise<T> {\r\n const { onProgress, signal, retries = MAX_RETRIES } = options;\r\n\r\n // If no progress callback is needed, delegate straight to HttpClient\r\n // which already has retry logic built in.\r\n if (!onProgress) {\r\n return this.http.uploadWithSession<T>(path, formData);\r\n }\r\n\r\n return this.uploadWithProgress<T>(path, formData, onProgress, signal, retries);\r\n }\r\n\r\n // \u2500\u2500 Private \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\r\n\r\n private async uploadWithProgress<T>(\r\n path: string,\r\n formData: FormData,\r\n onProgress: (fraction: number) => void,\r\n signal: AbortSignal | undefined,\r\n retriesLeft: number\r\n ): Promise<T> {\r\n const sessionToken = (this.http as any).sessionToken as string | null;\r\n if (!sessionToken) {\r\n throw new Error(\"SDK: No session token. Call sdk.createSession() first.\");\r\n }\r\n\r\n const baseUrl: string = (this.http as any).baseUrl as string;\r\n\r\n return new Promise<T>((resolve, reject) => {\r\n const xhr = new XMLHttpRequest();\r\n\r\n // Propagate AbortSignal to XHR\r\n if (signal) {\r\n if (signal.aborted) {\r\n reject(new DOMException(\"Upload cancelled\", \"AbortError\"));\r\n return;\r\n }\r\n signal.addEventListener(\"abort\", () => xhr.abort(), { once: true });\r\n }\r\n\r\n xhr.open(\"POST\", `${baseUrl}${path}`, true);\r\n xhr.setRequestHeader(\"x-access-token\", sessionToken);\r\n\r\n xhr.upload.onprogress = (evt) => {\r\n if (evt.lengthComputable) {\r\n onProgress(evt.loaded / evt.total);\r\n }\r\n };\r\n\r\n xhr.onload = () => {\r\n onProgress(1);\r\n\r\n let envelope: any;\r\n try {\r\n envelope = JSON.parse(xhr.responseText);\r\n } catch {\r\n reject(new Error(`SDK: Non-JSON response from ${path} (${xhr.status})`));\r\n return;\r\n }\r\n\r\n if (xhr.status >= 200 && xhr.status < 300 && envelope.status !== \"error\") {\r\n SDKLogger.info(`Upload to ${path} succeeded`, { status: xhr.status });\r\n resolve(envelope.data as T);\r\n } else {\r\n const err = new Error(envelope.message || `Upload to ${path} failed (${xhr.status})`);\r\n (err as any).statusCode = xhr.status;\r\n (err as any).code = envelope.code;\r\n reject(err);\r\n }\r\n };\r\n\r\n xhr.onerror = async () => {\r\n SDKLogger.warn(`Upload to ${path} failed \u2014 network error`, { retriesLeft });\r\n\r\n if (retriesLeft > 0) {\r\n await new Promise((r) => setTimeout(r, RETRY_DELAY_MS));\r\n try {\r\n const result = await this.uploadWithProgress<T>(\r\n path, formData, onProgress, signal, retriesLeft - 1\r\n );\r\n resolve(result);\r\n } catch (retryErr) {\r\n reject(retryErr);\r\n }\r\n } else {\r\n reject(new Error(`SDK: Upload to ${path} failed after all retries.`));\r\n }\r\n };\r\n\r\n xhr.onabort = () => {\r\n reject(new DOMException(\"Upload cancelled by user\", \"AbortError\"));\r\n };\r\n\r\n xhr.send(formData);\r\n });\r\n }\r\n}\r\n"],
|
|
5
5
|
"mappings": ";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACEO,MAAM,YAAyC;AAAA,IACpD,SAAS;AAAA,IACT,YAAY;AAAA,EACd;;;ACLO,MAAM,WAAN,cAAuB,MAAM;AAAA,IAKlC,YACE,SACA,YACA,WACA,WACA;AACA,YAAM,OAAO;AACb,WAAK,OAAO;AACZ,WAAK,aAAa;AAClB,WAAK,YAAY;AACjB,WAAK,YAAY;AAAA,IACnB;AAAA,EACF;;;ACZO,MAAM,YAAN,cAAwB,SAAS;AAAA,IACtC,YAAY,SAAiB,WAAoB;AAC/C,YAAM,SAAS,KAAK,SAAS;AAC7B,W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U;AAAA,gBAAY;AAAA,gBAAQ,cAAc;AAAA,cACpD;AACA,sBAAQ,MAAM;AAAA,YAChB,SAAS,UAAU;AACjB,qBAAO,QAAQ;AAAA,YACjB;AAAA,UACF,OAAO;AACL,mBAAO,IAAI,MAAM,kBAAkB,IAAI,4BAA4B,CAAC;AAAA,UACtE;AAAA,QACF;AAEA,YAAI,UAAU,MAAM;AAClB,iBAAO,IAAI,aAAa,4BAA4B,YAAY,CAAC;AAAA,QACnE;AAEA,YAAI,KAAK,QAAQ;AAAA,MACnB,CAAC;AAAA,IACH;AAAA,EACF;;;AtBtIA,MAAO,gBAAQ;",
|
|
6
6
|
"names": ["r", "ua", "e", "e", "n", "r", "i", "s", "t", "o", "a", "c", "h", "u", "l", "f", "bs", "bs", "a", "s", "i", "m", "ui", "r", "RETRY_DELAY_MS", "b", "i", "n", "y", "x", "l", "style", "e", "t", "x", "y", "w", "h", "i", "u", "t", "i", "f", "subtitle", "e", "s", "countries", "style", "fn", "t", "r"]
|
|
7
7
|
}
|