@neofaceid/web-sdk 1.40.0 → 1.40.1
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/index.d.ts +31 -1
- package/dist/neoface-id-sdk.es.js +76 -3
- package/dist/neoface-id-sdk.umd.js +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports,require("react"),require("react-dom/client"),require("react/jsx-runtime"),require("face-api.js")):"function"==typeof define&&define.amd?define(["exports","react","react-dom/client","react/jsx-runtime","face-api.js"],n):n((e="undefined"!=typeof globalThis?globalThis:e||self).NeoFaceIdSdk={},e.React,e.ReactDOM,e.jsxRuntime,e.faceapi)}(this,(function(e,n,t,o,r){"use strict";var a=Object.defineProperty,i=(e,n,t)=>((e,n,t)=>n in e?a(e,n,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[n]=t)(e,"symbol"!=typeof n?n+"":n,t),s="undefined"!=typeof document?document.currentScript:null;function c(e){const n=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e)for(const t in e)if("default"!==t){const o=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(n,t,o.get?o:{enumerable:!0,get:()=>e[t]})}return n.default=e,Object.freeze(n)}const d=c(r);class l extends Error{constructor(e){super(e),this.name="CameraPermissionDenied"}}class u{constructor(e){i(this,"stream"),this.stream=e}getStream(){return this.stream}stop(){this.stream.getTracks().forEach((e=>e.stop()))}}const p=()=>{const e=n.useRef(null),[t,o]=n.useState(!1),r=n.useRef(!1);return{startCamera:n.useCallback((async n=>{const t=e.current;if(t)return t.getStream();if(r.current){await new Promise((e=>setTimeout(e,100)));const n=e.current;if(n)return n.getStream()}r.current=!0;try{const t=n||(()=>{const e=/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent);return{video:{facingMode:"user",width:{ideal:e?640:1280},height:{ideal:e?480:720},aspectRatio:{ideal:1.777777778}},audio:!1}})(),a=await navigator.mediaDevices.getUserMedia(t),i=new u(a);return e.current=i,o(!0),r.current=!1,a}catch(a){if(r.current=!1,a instanceof Error){if("NotAllowedError"===a.name||"PermissionDeniedError"===a.name)throw new l("Permissão para acessar a câmera foi negada pelo usuário");if("NotFoundError"===a.name||"DevicesNotFoundError"===a.name)throw new Error("Nenhuma câmera foi encontrada no dispositivo");if("NotReadableError"===a.name||"TrackStartError"===a.name)throw new Error("A câmera já está sendo usada por outro aplicativo");if("OverconstrainedError"===a.name||"ConstraintNotSatisfiedError"===a.name)throw new Error("As configurações solicitadas não são suportadas pela câmera")}throw new Error(`Erro ao inicializar câmera: ${a instanceof Error?a.message:String(a)}`)}}),[]),stopCamera:n.useCallback((n=>{const t=e.current;t&&t.getStream()===n&&(t.stop(),e.current=null,o(!1),r.current=!1)}),[]),cleanup:n.useCallback((()=>{e.current&&(e.current.stop(),e.current=null,o(!1),r.current=!1)}),[]),isActive:t}};var f=(e=>(e.NETWORK="NetworkError",e.NETWORK_ERROR="NetworkError",e.INVALID_TOKEN="InvalidTokenError",e.RECOGNITION_FAILED="RecognitionFailedError",e.LOGIN_FAILED="LoginFailedError",e.VALIDATION_ERROR="ValidationError",e.API_ERROR="ApiError",e.PERSON_NOT_FOUND="PersonNotFoundError",e.INITIALIZATION_ERROR="InitializationError",e.CAMERA_ERROR="CameraError",e.NO_CAMERA="NoCameraError",e.CAPTURE_ERROR="CaptureError",e.NOT_FOUND="NotFoundError",e.UNKNOWN="UnknownError",e.CONSENT_DENIED="ConsentDeniedError",e.LIVENESS_BLINK_MISSING="LivenessBlinkMissingError",e))(f||{});class h extends Error{constructor(e,n){super(e),i(this,"type"),this.name=n,this.type=n}getFriendlyMessage(){if(/[áéíóúãõç]/i.test(this.message))return this.message;switch(this.type){case"NetworkError":return this.message.includes("timeout")?"A conexão demorou muito. Tente novamente.":"Não foi possível conectar ao servidor. Verifique sua internet.";case"InvalidTokenError":return"Falha na autenticação do aplicativo. Entre em contato com o suporte.";case"CameraError":case"NoCameraError":return"Não conseguimos acessar sua câmera. Verifique as permissões do navegador.";case"LoginFailedError":case"RecognitionFailedError":return"Não foi possível reconhecer seu rosto. Tente se posicionar em um local mais iluminado.";case"ValidationError":return"Dados inválidos ou rosto não detectado corretamente.";case"ConsentDeniedError":return"É necessário aceitar o uso do seu rosto para continuar.";case"LivenessBlinkMissingError":return"Não detectamos uma piscada. Pisque os olhos naturalmente e tente novamente.";case"ApiError":return this.message.includes("400")?"Requisição inválida. Tente novamente.":this.message.includes("500")?"Ocorreu um erro interno no sistema. Tente mais tarde.":"O serviço encontrou um problema inesperado.";default:return"Ocorreu um erro inesperado. Por favor, tente novamente."}}}function m(e,n,t){function o(t,o){if(t._zod||Object.defineProperty(t,"_zod",{value:{def:o,constr:i,traits:new Set},enumerable:!1}),t._zod.traits.has(e))return;t._zod.traits.add(e),n(t,o);const r=i.prototype,a=Object.keys(r);for(let e=0;e<a.length;e++){const n=a[e];n in t||(t[n]=r[n].bind(t))}}const r=(null==t?void 0:t.Parent)??Object;class a extends r{}function i(e){var n;const r=(null==t?void 0:t.Parent)?new a:this;o(r,e),(n=r._zod).deferred??(n.deferred=[]);for(const t of r._zod.deferred)t();return r}return Object.defineProperty(a,"name",{value:e}),Object.defineProperty(i,"init",{value:o}),Object.defineProperty(i,Symbol.hasInstance,{value:n=>{var o,r;return!!((null==t?void 0:t.Parent)&&n instanceof t.Parent)||(null==(r=null==(o=null==n?void 0:n._zod)?void 0:o.traits)?void 0:r.has(e))}}),Object.defineProperty(i,"name",{value:e}),i}class g extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class v extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name="ZodEncodeError"}}const b={};function w(e){return b}function y(e){const n=Object.values(e).filter((e=>"number"==typeof e));return Object.entries(e).filter((([e,t])=>-1===n.indexOf(+e))).map((([e,n])=>n))}function x(e,n){return"bigint"==typeof n?n.toString():n}function k(e){return{get value(){{const n=e();return Object.defineProperty(this,"value",{value:n}),n}}}}function E(e){return null==e}function _(e){const n=e.startsWith("^")?1:0,t=e.endsWith("$")?e.length-1:e.length;return e.slice(n,t)}const R=Symbol("evaluating");function N(e,n,t){let o;Object.defineProperty(e,n,{get(){if(o!==R)return void 0===o&&(o=R,o=t()),o},set(t){Object.defineProperty(e,n,{value:t})},configurable:!0})}function T(e,n,t){Object.defineProperty(e,n,{value:t,writable:!0,enumerable:!0,configurable:!0})}function O(...e){const n={};for(const t of e){const e=Object.getOwnPropertyDescriptors(t);Object.assign(n,e)}return Object.defineProperties({},n)}function S(e){return JSON.stringify(e)}const I="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function C(e){return"object"==typeof e&&null!==e&&!Array.isArray(e)}const z=k((()=>{var e;if("undefined"!=typeof navigator&&(null==(e=null==navigator?void 0:navigator.userAgent)?void 0:e.includes("Cloudflare")))return!1;try{return new Function(""),!0}catch(n){return!1}}));function j(e){if(!1===C(e))return!1;const n=e.constructor;if(void 0===n)return!0;if("function"!=typeof n)return!0;const t=n.prototype;return!1!==C(t)&&!1!==Object.prototype.hasOwnProperty.call(t,"isPrototypeOf")}function A(e){return j(e)?{...e}:Array.isArray(e)?[...e]:e}const F=new Set(["string","number","symbol"]);function $(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function P(e,n,t){const o=new e._zod.constr(n??e._zod.def);return n&&!(null==t?void 0:t.parent)||(o._zod.parent=e),o}function D(e){const n=e;if(!n)return{};if("string"==typeof n)return{error:()=>n};if(void 0!==(null==n?void 0:n.message)){if(void 0!==(null==n?void 0:n.error))throw new Error("Cannot specify both `message` and `error` params");n.error=n.message}return delete n.message,"string"==typeof n.error?{...n,error:()=>n.error}:n}const L={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]};function M(e,n=0){var t;if(!0===e.aborted)return!0;for(let o=n;o<e.issues.length;o++)if(!0!==(null==(t=e.issues[o])?void 0:t.continue))return!0;return!1}function q(e,n){return n.map((n=>{var t;return(t=n).path??(t.path=[]),n.path.unshift(e),n}))}function U(e){return"string"==typeof e?e:null==e?void 0:e.message}function B(e,n,t){var o,r,a,i,s,c;const d={...e,path:e.path??[]};if(!e.message){const l=U(null==(a=null==(r=null==(o=e.inst)?void 0:o._zod.def)?void 0:r.error)?void 0:a.call(r,e))??U(null==(i=null==n?void 0:n.error)?void 0:i.call(n,e))??U(null==(s=t.customError)?void 0:s.call(t,e))??U(null==(c=t.localeError)?void 0:c.call(t,e))??"Invalid input";d.message=l}return delete d.inst,delete d.continue,(null==n?void 0:n.reportInput)||delete d.input,d}function W(e){return Array.isArray(e)?"array":"string"==typeof e?"string":"unknown"}function V(...e){const[n,t,o]=e;return"string"==typeof n?{message:n,code:"custom",input:t,inst:o}:{...n}}const Z=(e,n)=>{e.name="$ZodError",Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:n,enumerable:!1}),e.message=JSON.stringify(n,x,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},K=m("$ZodError",Z),J=m("$ZodError",Z,{Parent:Error});const G=e=>(n,t,o,r)=>{const a=o?Object.assign(o,{async:!1}):{async:!1},i=n._zod.run({value:t,issues:[]},a);if(i instanceof Promise)throw new g;if(i.issues.length){const n=new((null==r?void 0:r.Err)??e)(i.issues.map((e=>B(e,a,w()))));throw I(n,null==r?void 0:r.callee),n}return i.value},H=e=>async(n,t,o,r)=>{const a=o?Object.assign(o,{async:!0}):{async:!0};let i=n._zod.run({value:t,issues:[]},a);if(i instanceof Promise&&(i=await i),i.issues.length){const n=new((null==r?void 0:r.Err)??e)(i.issues.map((e=>B(e,a,w()))));throw I(n,null==r?void 0:r.callee),n}return i.value},X=e=>(n,t,o)=>{const r=o?{...o,async:!1}:{async:!1},a=n._zod.run({value:t,issues:[]},r);if(a instanceof Promise)throw new g;return a.issues.length?{success:!1,error:new(e??K)(a.issues.map((e=>B(e,r,w()))))}:{success:!0,data:a.value}},Y=X(J),Q=e=>async(n,t,o)=>{const r=o?Object.assign(o,{async:!0}):{async:!0};let a=n._zod.run({value:t,issues:[]},r);return a instanceof Promise&&(a=await a),a.issues.length?{success:!1,error:new e(a.issues.map((e=>B(e,r,w()))))}:{success:!0,data:a.value}},ee=Q(J),ne=e=>(n,t,o)=>{const r=o?Object.assign(o,{direction:"backward"}):{direction:"backward"};return G(e)(n,t,r)},te=e=>(n,t,o)=>G(e)(n,t,o),oe=e=>async(n,t,o)=>{const r=o?Object.assign(o,{direction:"backward"}):{direction:"backward"};return H(e)(n,t,r)},re=e=>async(n,t,o)=>H(e)(n,t,o),ae=e=>(n,t,o)=>{const r=o?Object.assign(o,{direction:"backward"}):{direction:"backward"};return X(e)(n,t,r)},ie=e=>(n,t,o)=>X(e)(n,t,o),se=e=>async(n,t,o)=>{const r=o?Object.assign(o,{direction:"backward"}):{direction:"backward"};return Q(e)(n,t,r)},ce=e=>async(n,t,o)=>Q(e)(n,t,o),de=/^[cC][^\s-]{8,}$/,le=/^[0-9a-z]+$/,ue=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,pe=/^[0-9a-vA-V]{20}$/,fe=/^[A-Za-z0-9]{27}$/,he=/^[a-zA-Z0-9_-]{21}$/,me=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,ge=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,ve=e=>e?new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,be=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/;const we=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,ye=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,xe=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,ke=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,Ee=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,_e=/^[A-Za-z0-9_-]*$/,Re=/^\+[1-9]\d{6,14}$/,Ne="(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))",Te=new RegExp(`^${Ne}$`);function Oe(e){const n="(?:[01]\\d|2[0-3]):[0-5]\\d";return"number"==typeof e.precision?-1===e.precision?`${n}`:0===e.precision?`${n}:[0-5]\\d`:`${n}:[0-5]\\d\\.\\d{${e.precision}}`:`${n}(?::[0-5]\\d(?:\\.\\d+)?)?`}const Se=/^-?\d+$/,Ie=/^-?\d+(?:\.\d+)?$/,Ce=/^(?:true|false)$/i,ze=/^[^A-Z]*$/,je=/^[^a-z]*$/,Ae=m("$ZodCheck",((e,n)=>{var t;e._zod??(e._zod={}),e._zod.def=n,(t=e._zod).onattach??(t.onattach=[])})),Fe={number:"number",bigint:"bigint",object:"date"},$e=m("$ZodCheckLessThan",((e,n)=>{Ae.init(e,n);const t=Fe[typeof n.value];e._zod.onattach.push((e=>{const t=e._zod.bag,o=(n.inclusive?t.maximum:t.exclusiveMaximum)??Number.POSITIVE_INFINITY;n.value<o&&(n.inclusive?t.maximum=n.value:t.exclusiveMaximum=n.value)})),e._zod.check=o=>{(n.inclusive?o.value<=n.value:o.value<n.value)||o.issues.push({origin:t,code:"too_big",maximum:"object"==typeof n.value?n.value.getTime():n.value,input:o.value,inclusive:n.inclusive,inst:e,continue:!n.abort})}})),Pe=m("$ZodCheckGreaterThan",((e,n)=>{Ae.init(e,n);const t=Fe[typeof n.value];e._zod.onattach.push((e=>{const t=e._zod.bag,o=(n.inclusive?t.minimum:t.exclusiveMinimum)??Number.NEGATIVE_INFINITY;n.value>o&&(n.inclusive?t.minimum=n.value:t.exclusiveMinimum=n.value)})),e._zod.check=o=>{(n.inclusive?o.value>=n.value:o.value>n.value)||o.issues.push({origin:t,code:"too_small",minimum:"object"==typeof n.value?n.value.getTime():n.value,input:o.value,inclusive:n.inclusive,inst:e,continue:!n.abort})}})),De=m("$ZodCheckMultipleOf",((e,n)=>{Ae.init(e,n),e._zod.onattach.push((e=>{var t;(t=e._zod.bag).multipleOf??(t.multipleOf=n.value)})),e._zod.check=t=>{if(typeof t.value!=typeof n.value)throw new Error("Cannot mix number and bigint in multiple_of check.");("bigint"==typeof t.value?t.value%n.value===BigInt(0):0===function(e,n){const t=(e.toString().split(".")[1]||"").length,o=n.toString();let r=(o.split(".")[1]||"").length;if(0===r&&/\d?e-\d?/.test(o)){const e=o.match(/\d?e-(\d?)/);(null==e?void 0:e[1])&&(r=Number.parseInt(e[1]))}const a=t>r?t:r;return Number.parseInt(e.toFixed(a).replace(".",""))%Number.parseInt(n.toFixed(a).replace(".",""))/10**a}(t.value,n.value))||t.issues.push({origin:typeof t.value,code:"not_multiple_of",divisor:n.value,input:t.value,inst:e,continue:!n.abort})}})),Le=m("$ZodCheckNumberFormat",((e,n)=>{var t;Ae.init(e,n),n.format=n.format||"float64";const o=null==(t=n.format)?void 0:t.includes("int"),r=o?"int":"number",[a,i]=L[n.format];e._zod.onattach.push((e=>{const t=e._zod.bag;t.format=n.format,t.minimum=a,t.maximum=i,o&&(t.pattern=Se)})),e._zod.check=t=>{const s=t.value;if(o){if(!Number.isInteger(s))return void t.issues.push({expected:r,format:n.format,code:"invalid_type",continue:!1,input:s,inst:e});if(!Number.isSafeInteger(s))return void(s>0?t.issues.push({input:s,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:r,inclusive:!0,continue:!n.abort}):t.issues.push({input:s,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:r,inclusive:!0,continue:!n.abort}))}s<a&&t.issues.push({origin:"number",input:s,code:"too_small",minimum:a,inclusive:!0,inst:e,continue:!n.abort}),s>i&&t.issues.push({origin:"number",input:s,code:"too_big",maximum:i,inclusive:!0,inst:e,continue:!n.abort})}})),Me=m("$ZodCheckMaxLength",((e,n)=>{var t;Ae.init(e,n),(t=e._zod.def).when??(t.when=e=>{const n=e.value;return!E(n)&&void 0!==n.length}),e._zod.onattach.push((e=>{const t=e._zod.bag.maximum??Number.POSITIVE_INFINITY;n.maximum<t&&(e._zod.bag.maximum=n.maximum)})),e._zod.check=t=>{const o=t.value;if(o.length<=n.maximum)return;const r=W(o);t.issues.push({origin:r,code:"too_big",maximum:n.maximum,inclusive:!0,input:o,inst:e,continue:!n.abort})}})),qe=m("$ZodCheckMinLength",((e,n)=>{var t;Ae.init(e,n),(t=e._zod.def).when??(t.when=e=>{const n=e.value;return!E(n)&&void 0!==n.length}),e._zod.onattach.push((e=>{const t=e._zod.bag.minimum??Number.NEGATIVE_INFINITY;n.minimum>t&&(e._zod.bag.minimum=n.minimum)})),e._zod.check=t=>{const o=t.value;if(o.length>=n.minimum)return;const r=W(o);t.issues.push({origin:r,code:"too_small",minimum:n.minimum,inclusive:!0,input:o,inst:e,continue:!n.abort})}})),Ue=m("$ZodCheckLengthEquals",((e,n)=>{var t;Ae.init(e,n),(t=e._zod.def).when??(t.when=e=>{const n=e.value;return!E(n)&&void 0!==n.length}),e._zod.onattach.push((e=>{const t=e._zod.bag;t.minimum=n.length,t.maximum=n.length,t.length=n.length})),e._zod.check=t=>{const o=t.value,r=o.length;if(r===n.length)return;const a=W(o),i=r>n.length;t.issues.push({origin:a,...i?{code:"too_big",maximum:n.length}:{code:"too_small",minimum:n.length},inclusive:!0,exact:!0,input:t.value,inst:e,continue:!n.abort})}})),Be=m("$ZodCheckStringFormat",((e,n)=>{var t,o;Ae.init(e,n),e._zod.onattach.push((e=>{const t=e._zod.bag;t.format=n.format,n.pattern&&(t.patterns??(t.patterns=new Set),t.patterns.add(n.pattern))})),n.pattern?(t=e._zod).check??(t.check=t=>{n.pattern.lastIndex=0,n.pattern.test(t.value)||t.issues.push({origin:"string",code:"invalid_format",format:n.format,input:t.value,...n.pattern?{pattern:n.pattern.toString()}:{},inst:e,continue:!n.abort})}):(o=e._zod).check??(o.check=()=>{})})),We=m("$ZodCheckRegex",((e,n)=>{Be.init(e,n),e._zod.check=t=>{n.pattern.lastIndex=0,n.pattern.test(t.value)||t.issues.push({origin:"string",code:"invalid_format",format:"regex",input:t.value,pattern:n.pattern.toString(),inst:e,continue:!n.abort})}})),Ve=m("$ZodCheckLowerCase",((e,n)=>{n.pattern??(n.pattern=ze),Be.init(e,n)})),Ze=m("$ZodCheckUpperCase",((e,n)=>{n.pattern??(n.pattern=je),Be.init(e,n)})),Ke=m("$ZodCheckIncludes",((e,n)=>{Ae.init(e,n);const t=$(n.includes),o=new RegExp("number"==typeof n.position?`^.{${n.position}}${t}`:t);n.pattern=o,e._zod.onattach.push((e=>{const n=e._zod.bag;n.patterns??(n.patterns=new Set),n.patterns.add(o)})),e._zod.check=t=>{t.value.includes(n.includes,n.position)||t.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:n.includes,input:t.value,inst:e,continue:!n.abort})}})),Je=m("$ZodCheckStartsWith",((e,n)=>{Ae.init(e,n);const t=new RegExp(`^${$(n.prefix)}.*`);n.pattern??(n.pattern=t),e._zod.onattach.push((e=>{const n=e._zod.bag;n.patterns??(n.patterns=new Set),n.patterns.add(t)})),e._zod.check=t=>{t.value.startsWith(n.prefix)||t.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:n.prefix,input:t.value,inst:e,continue:!n.abort})}})),Ge=m("$ZodCheckEndsWith",((e,n)=>{Ae.init(e,n);const t=new RegExp(`.*${$(n.suffix)}$`);n.pattern??(n.pattern=t),e._zod.onattach.push((e=>{const n=e._zod.bag;n.patterns??(n.patterns=new Set),n.patterns.add(t)})),e._zod.check=t=>{t.value.endsWith(n.suffix)||t.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:n.suffix,input:t.value,inst:e,continue:!n.abort})}})),He=m("$ZodCheckOverwrite",((e,n)=>{Ae.init(e,n),e._zod.check=e=>{e.value=n.tx(e.value)}}));class Xe{constructor(e=[]){this.content=[],this.indent=0,this&&(this.args=e)}indented(e){this.indent+=1,e(this),this.indent-=1}write(e){if("function"==typeof e)return e(this,{execution:"sync"}),void e(this,{execution:"async"});const n=e.split("\n").filter((e=>e)),t=Math.min(...n.map((e=>e.length-e.trimStart().length))),o=n.map((e=>e.slice(t))).map((e=>" ".repeat(2*this.indent)+e));for(const r of o)this.content.push(r)}compile(){return new Function(...null==this?void 0:this.args,[...((null==this?void 0:this.content)??[""]).map((e=>` ${e}`))].join("\n"))}}const Ye={major:4,minor:3,patch:6},Qe=m("$ZodType",((e,n)=>{var t,o;e??(e={}),e._zod.def=n,e._zod.bag=e._zod.bag||{},e._zod.version=Ye;const r=[...e._zod.def.checks??[]];e._zod.traits.has("$ZodCheck")&&r.unshift(e);for(const a of r)for(const n of a._zod.onattach)n(e);if(0===r.length)(o=e._zod).deferred??(o.deferred=[]),null==(t=e._zod.deferred)||t.push((()=>{e._zod.run=e._zod.parse}));else{const n=(e,n,t)=>{let o,r=M(e);for(const a of n){if(a._zod.def.when){if(!a._zod.def.when(e))continue}else if(r)continue;const n=e.issues.length,i=a._zod.check(e);if(i instanceof Promise&&!1===(null==t?void 0:t.async))throw new g;if(o||i instanceof Promise)o=(o??Promise.resolve()).then((async()=>{await i;e.issues.length!==n&&(r||(r=M(e,n)))}));else{if(e.issues.length===n)continue;r||(r=M(e,n))}}return o?o.then((()=>e)):e},t=(t,o,a)=>{if(M(t))return t.aborted=!0,t;const i=n(o,r,a);if(i instanceof Promise){if(!1===a.async)throw new g;return i.then((n=>e._zod.parse(n,a)))}return e._zod.parse(i,a)};e._zod.run=(o,a)=>{if(a.skipChecks)return e._zod.parse(o,a);if("backward"===a.direction){const n=e._zod.parse({value:o.value,issues:[]},{...a,skipChecks:!0});return n instanceof Promise?n.then((e=>t(e,o,a))):t(n,o,a)}const i=e._zod.parse(o,a);if(i instanceof Promise){if(!1===a.async)throw new g;return i.then((e=>n(e,r,a)))}return n(i,r,a)}}N(e,"~standard",(()=>({validate:n=>{var t;try{const o=Y(e,n);return o.success?{value:o.data}:{issues:null==(t=o.error)?void 0:t.issues}}catch(o){return ee(e,n).then((e=>{var n;return e.success?{value:e.data}:{issues:null==(n=e.error)?void 0:n.issues}}))}},vendor:"zod",version:1})))})),en=m("$ZodString",((e,n)=>{var t;Qe.init(e,n),e._zod.pattern=[...(null==(t=null==e?void 0:e._zod.bag)?void 0:t.patterns)??[]].pop()??(e=>{const n=e?`[\\s\\S]{${(null==e?void 0:e.minimum)??0},${(null==e?void 0:e.maximum)??""}}`:"[\\s\\S]*";return new RegExp(`^${n}$`)})(e._zod.bag),e._zod.parse=(t,o)=>{if(n.coerce)try{t.value=String(t.value)}catch(r){}return"string"==typeof t.value||t.issues.push({expected:"string",code:"invalid_type",input:t.value,inst:e}),t}})),nn=m("$ZodStringFormat",((e,n)=>{Be.init(e,n),en.init(e,n)})),tn=m("$ZodGUID",((e,n)=>{n.pattern??(n.pattern=ge),nn.init(e,n)})),on=m("$ZodUUID",((e,n)=>{if(n.version){const e={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[n.version];if(void 0===e)throw new Error(`Invalid UUID version: "${n.version}"`);n.pattern??(n.pattern=ve(e))}else n.pattern??(n.pattern=ve());nn.init(e,n)})),rn=m("$ZodEmail",((e,n)=>{n.pattern??(n.pattern=be),nn.init(e,n)})),an=m("$ZodURL",((e,n)=>{nn.init(e,n),e._zod.check=t=>{try{const o=t.value.trim(),r=new URL(o);return n.hostname&&(n.hostname.lastIndex=0,n.hostname.test(r.hostname)||t.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:n.hostname.source,input:t.value,inst:e,continue:!n.abort})),n.protocol&&(n.protocol.lastIndex=0,n.protocol.test(r.protocol.endsWith(":")?r.protocol.slice(0,-1):r.protocol)||t.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:n.protocol.source,input:t.value,inst:e,continue:!n.abort})),void(n.normalize?t.value=r.href:t.value=o)}catch(o){t.issues.push({code:"invalid_format",format:"url",input:t.value,inst:e,continue:!n.abort})}}})),sn=m("$ZodEmoji",((e,n)=>{n.pattern??(n.pattern=new RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),nn.init(e,n)})),cn=m("$ZodNanoID",((e,n)=>{n.pattern??(n.pattern=he),nn.init(e,n)})),dn=m("$ZodCUID",((e,n)=>{n.pattern??(n.pattern=de),nn.init(e,n)})),ln=m("$ZodCUID2",((e,n)=>{n.pattern??(n.pattern=le),nn.init(e,n)})),un=m("$ZodULID",((e,n)=>{n.pattern??(n.pattern=ue),nn.init(e,n)})),pn=m("$ZodXID",((e,n)=>{n.pattern??(n.pattern=pe),nn.init(e,n)})),fn=m("$ZodKSUID",((e,n)=>{n.pattern??(n.pattern=fe),nn.init(e,n)})),hn=m("$ZodISODateTime",((e,n)=>{n.pattern??(n.pattern=function(e){const n=Oe({precision:e.precision}),t=["Z"];e.local&&t.push(""),e.offset&&t.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");const o=`${n}(?:${t.join("|")})`;return new RegExp(`^${Ne}T(?:${o})$`)}(n)),nn.init(e,n)})),mn=m("$ZodISODate",((e,n)=>{n.pattern??(n.pattern=Te),nn.init(e,n)})),gn=m("$ZodISOTime",((e,n)=>{n.pattern??(n.pattern=new RegExp(`^${Oe(n)}$`)),nn.init(e,n)})),vn=m("$ZodISODuration",((e,n)=>{n.pattern??(n.pattern=me),nn.init(e,n)})),bn=m("$ZodIPv4",((e,n)=>{n.pattern??(n.pattern=we),nn.init(e,n),e._zod.bag.format="ipv4"})),wn=m("$ZodIPv6",((e,n)=>{n.pattern??(n.pattern=ye),nn.init(e,n),e._zod.bag.format="ipv6",e._zod.check=t=>{try{new URL(`http://[${t.value}]`)}catch{t.issues.push({code:"invalid_format",format:"ipv6",input:t.value,inst:e,continue:!n.abort})}}})),yn=m("$ZodCIDRv4",((e,n)=>{n.pattern??(n.pattern=xe),nn.init(e,n)})),xn=m("$ZodCIDRv6",((e,n)=>{n.pattern??(n.pattern=ke),nn.init(e,n),e._zod.check=t=>{const o=t.value.split("/");try{if(2!==o.length)throw new Error;const[e,n]=o;if(!n)throw new Error;const t=Number(n);if(`${t}`!==n)throw new Error;if(t<0||t>128)throw new Error;new URL(`http://[${e}]`)}catch{t.issues.push({code:"invalid_format",format:"cidrv6",input:t.value,inst:e,continue:!n.abort})}}}));function kn(e){if(""===e)return!0;if(e.length%4!=0)return!1;try{return atob(e),!0}catch{return!1}}const En=m("$ZodBase64",((e,n)=>{n.pattern??(n.pattern=Ee),nn.init(e,n),e._zod.bag.contentEncoding="base64",e._zod.check=t=>{kn(t.value)||t.issues.push({code:"invalid_format",format:"base64",input:t.value,inst:e,continue:!n.abort})}}));const _n=m("$ZodBase64URL",((e,n)=>{n.pattern??(n.pattern=_e),nn.init(e,n),e._zod.bag.contentEncoding="base64url",e._zod.check=t=>{(function(e){if(!_e.test(e))return!1;const n=e.replace(/[-_]/g,(e=>"-"===e?"+":"/"));return kn(n.padEnd(4*Math.ceil(n.length/4),"="))})(t.value)||t.issues.push({code:"invalid_format",format:"base64url",input:t.value,inst:e,continue:!n.abort})}})),Rn=m("$ZodE164",((e,n)=>{n.pattern??(n.pattern=Re),nn.init(e,n)}));const Nn=m("$ZodJWT",((e,n)=>{nn.init(e,n),e._zod.check=t=>{(function(e,n=null){try{const t=e.split(".");if(3!==t.length)return!1;const[o]=t;if(!o)return!1;const r=JSON.parse(atob(o));return!("typ"in r&&"JWT"!==(null==r?void 0:r.typ)||!r.alg||n&&(!("alg"in r)||r.alg!==n))}catch{return!1}})(t.value,n.alg)||t.issues.push({code:"invalid_format",format:"jwt",input:t.value,inst:e,continue:!n.abort})}})),Tn=m("$ZodNumber",((e,n)=>{Qe.init(e,n),e._zod.pattern=e._zod.bag.pattern??Ie,e._zod.parse=(t,o)=>{if(n.coerce)try{t.value=Number(t.value)}catch(i){}const r=t.value;if("number"==typeof r&&!Number.isNaN(r)&&Number.isFinite(r))return t;const a="number"==typeof r?Number.isNaN(r)?"NaN":Number.isFinite(r)?void 0:"Infinity":void 0;return t.issues.push({expected:"number",code:"invalid_type",input:r,inst:e,...a?{received:a}:{}}),t}})),On=m("$ZodNumberFormat",((e,n)=>{Le.init(e,n),Tn.init(e,n)})),Sn=m("$ZodBoolean",((e,n)=>{Qe.init(e,n),e._zod.pattern=Ce,e._zod.parse=(t,o)=>{if(n.coerce)try{t.value=Boolean(t.value)}catch(a){}const r=t.value;return"boolean"==typeof r||t.issues.push({expected:"boolean",code:"invalid_type",input:r,inst:e}),t}})),In=m("$ZodAny",((e,n)=>{Qe.init(e,n),e._zod.parse=e=>e})),Cn=m("$ZodUnknown",((e,n)=>{Qe.init(e,n),e._zod.parse=e=>e})),zn=m("$ZodNever",((e,n)=>{Qe.init(e,n),e._zod.parse=(n,t)=>(n.issues.push({expected:"never",code:"invalid_type",input:n.value,inst:e}),n)}));function jn(e,n,t){e.issues.length&&n.issues.push(...q(t,e.issues)),n.value[t]=e.value}const An=m("$ZodArray",((e,n)=>{Qe.init(e,n),e._zod.parse=(t,o)=>{const r=t.value;if(!Array.isArray(r))return t.issues.push({expected:"array",code:"invalid_type",input:r,inst:e}),t;t.value=Array(r.length);const a=[];for(let e=0;e<r.length;e++){const i=r[e],s=n.element._zod.run({value:i,issues:[]},o);s instanceof Promise?a.push(s.then((n=>jn(n,t,e)))):jn(s,t,e)}return a.length?Promise.all(a).then((()=>t)):t}}));function Fn(e,n,t,o,r){if(e.issues.length){if(r&&!(t in o))return;n.issues.push(...q(t,e.issues))}void 0===e.value?t in o&&(n.value[t]=void 0):n.value[t]=e.value}function $n(e){var n,t,o,r;const a=Object.keys(e.shape);for(const c of a)if(!(null==(r=null==(o=null==(t=null==(n=e.shape)?void 0:n[c])?void 0:t._zod)?void 0:o.traits)?void 0:r.has("$ZodType")))throw new Error(`Invalid element at key "${c}": expected a Zod schema`);const i=(s=e.shape,Object.keys(s).filter((e=>"optional"===s[e]._zod.optin&&"optional"===s[e]._zod.optout)));var s;return{...e,keys:a,keySet:new Set(a),numKeys:a.length,optionalKeys:new Set(i)}}function Pn(e,n,t,o,r,a){const i=[],s=r.keySet,c=r.catchall._zod,d=c.def.type,l="optional"===c.optout;for(const u in n){if(s.has(u))continue;if("never"===d){i.push(u);continue}const r=c.run({value:n[u],issues:[]},o);r instanceof Promise?e.push(r.then((e=>Fn(e,t,u,n,l)))):Fn(r,t,u,n,l)}return i.length&&t.issues.push({code:"unrecognized_keys",keys:i,input:n,inst:a}),e.length?Promise.all(e).then((()=>t)):t}const Dn=m("$ZodObject",((e,n)=>{Qe.init(e,n);const t=Object.getOwnPropertyDescriptor(n,"shape");if(!(null==t?void 0:t.get)){const e=n.shape;Object.defineProperty(n,"shape",{get:()=>{const t={...e};return Object.defineProperty(n,"shape",{value:t}),t}})}const o=k((()=>$n(n)));N(e._zod,"propValues",(()=>{const e=n.shape,t={};for(const n in e){const o=e[n]._zod;if(o.values){t[n]??(t[n]=new Set);for(const e of o.values)t[n].add(e)}}return t}));const r=C,a=n.catchall;let i;e._zod.parse=(n,t)=>{i??(i=o.value);const s=n.value;if(!r(s))return n.issues.push({expected:"object",code:"invalid_type",input:s,inst:e}),n;n.value={};const c=[],d=i.shape;for(const e of i.keys){const o=d[e],r="optional"===o._zod.optout,a=o._zod.run({value:s[e],issues:[]},t);a instanceof Promise?c.push(a.then((t=>Fn(t,n,e,s,r)))):Fn(a,n,e,s,r)}return a?Pn(c,s,n,t,o.value,e):c.length?Promise.all(c).then((()=>n)):n}})),Ln=m("$ZodObjectJIT",((e,n)=>{Dn.init(e,n);const t=e._zod.parse,o=k((()=>$n(n)));let r;const a=C,i=!b.jitless,s=i&&z.value,c=n.catchall;let d;e._zod.parse=(l,u)=>{d??(d=o.value);const p=l.value;return a(p)?i&&s&&!1===(null==u?void 0:u.async)&&!0!==u.jitless?(r||(r=(e=>{var n;const t=new Xe(["shape","payload","ctx"]),r=o.value,a=e=>{const n=S(e);return`shape[${n}]._zod.run({ value: input[${n}], issues: [] }, ctx)`};t.write("const input = payload.value;");const i=Object.create(null);let s=0;for(const o of r.keys)i[o]="key_"+s++;t.write("const newResult = {};");for(const o of r.keys){const r=i[o],s=S(o),c=e[o],d="optional"===(null==(n=null==c?void 0:c._zod)?void 0:n.optout);t.write(`const ${r} = ${a(o)};`),d?t.write(`\n if (${r}.issues.length) {\n if (${s} in input) {\n payload.issues = payload.issues.concat(${r}.issues.map(iss => ({\n ...iss,\n path: iss.path ? [${s}, ...iss.path] : [${s}]\n })));\n }\n }\n \n if (${r}.value === undefined) {\n if (${s} in input) {\n newResult[${s}] = undefined;\n }\n } else {\n newResult[${s}] = ${r}.value;\n }\n \n `):t.write(`\n if (${r}.issues.length) {\n payload.issues = payload.issues.concat(${r}.issues.map(iss => ({\n ...iss,\n path: iss.path ? [${s}, ...iss.path] : [${s}]\n })));\n }\n \n if (${r}.value === undefined) {\n if (${s} in input) {\n newResult[${s}] = undefined;\n }\n } else {\n newResult[${s}] = ${r}.value;\n }\n \n `)}t.write("payload.value = newResult;"),t.write("return payload;");const c=t.compile();return(n,t)=>c(e,n,t)})(n.shape)),l=r(l,u),c?Pn([],p,l,u,d,e):l):t(l,u):(l.issues.push({expected:"object",code:"invalid_type",input:p,inst:e}),l)}}));function Mn(e,n,t,o){for(const a of e)if(0===a.issues.length)return n.value=a.value,n;const r=e.filter((e=>!M(e)));return 1===r.length?(n.value=r[0].value,r[0]):(n.issues.push({code:"invalid_union",input:n.value,inst:t,errors:e.map((e=>e.issues.map((e=>B(e,o,w())))))}),n)}const qn=m("$ZodUnion",((e,n)=>{Qe.init(e,n),N(e._zod,"optin",(()=>n.options.some((e=>"optional"===e._zod.optin))?"optional":void 0)),N(e._zod,"optout",(()=>n.options.some((e=>"optional"===e._zod.optout))?"optional":void 0)),N(e._zod,"values",(()=>{if(n.options.every((e=>e._zod.values)))return new Set(n.options.flatMap((e=>Array.from(e._zod.values))))})),N(e._zod,"pattern",(()=>{if(n.options.every((e=>e._zod.pattern))){const e=n.options.map((e=>e._zod.pattern));return new RegExp(`^(${e.map((e=>_(e.source))).join("|")})$`)}}));const t=1===n.options.length,o=n.options[0]._zod.run;e._zod.parse=(r,a)=>{if(t)return o(r,a);let i=!1;const s=[];for(const e of n.options){const n=e._zod.run({value:r.value,issues:[]},a);if(n instanceof Promise)s.push(n),i=!0;else{if(0===n.issues.length)return n;s.push(n)}}return i?Promise.all(s).then((n=>Mn(n,r,e,a))):Mn(s,r,e,a)}})),Un=m("$ZodIntersection",((e,n)=>{Qe.init(e,n),e._zod.parse=(e,t)=>{const o=e.value,r=n.left._zod.run({value:o,issues:[]},t),a=n.right._zod.run({value:o,issues:[]},t);return r instanceof Promise||a instanceof Promise?Promise.all([r,a]).then((([n,t])=>Wn(e,n,t))):Wn(e,r,a)}}));function Bn(e,n){if(e===n)return{valid:!0,data:e};if(e instanceof Date&&n instanceof Date&&+e==+n)return{valid:!0,data:e};if(j(e)&&j(n)){const t=Object.keys(n),o=Object.keys(e).filter((e=>-1!==t.indexOf(e))),r={...e,...n};for(const a of o){const t=Bn(e[a],n[a]);if(!t.valid)return{valid:!1,mergeErrorPath:[a,...t.mergeErrorPath]};r[a]=t.data}return{valid:!0,data:r}}if(Array.isArray(e)&&Array.isArray(n)){if(e.length!==n.length)return{valid:!1,mergeErrorPath:[]};const t=[];for(let o=0;o<e.length;o++){const r=Bn(e[o],n[o]);if(!r.valid)return{valid:!1,mergeErrorPath:[o,...r.mergeErrorPath]};t.push(r.data)}return{valid:!0,data:t}}return{valid:!1,mergeErrorPath:[]}}function Wn(e,n,t){const o=new Map;let r;for(const s of n.issues)if("unrecognized_keys"===s.code){r??(r=s);for(const e of s.keys)o.has(e)||o.set(e,{}),o.get(e).l=!0}else e.issues.push(s);for(const s of t.issues)if("unrecognized_keys"===s.code)for(const e of s.keys)o.has(e)||o.set(e,{}),o.get(e).r=!0;else e.issues.push(s);const a=[...o].filter((([,e])=>e.l&&e.r)).map((([e])=>e));if(a.length&&r&&e.issues.push({...r,keys:a}),M(e))return e;const i=Bn(n.value,t.value);if(!i.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(i.mergeErrorPath)}`);return e.value=i.data,e}const Vn=m("$ZodEnum",((e,n)=>{Qe.init(e,n);const t=y(n.entries),o=new Set(t);e._zod.values=o,e._zod.pattern=new RegExp(`^(${t.filter((e=>F.has(typeof e))).map((e=>"string"==typeof e?$(e):e.toString())).join("|")})$`),e._zod.parse=(n,r)=>{const a=n.value;return o.has(a)||n.issues.push({code:"invalid_value",values:t,input:a,inst:e}),n}})),Zn=m("$ZodTransform",((e,n)=>{Qe.init(e,n),e._zod.parse=(t,o)=>{if("backward"===o.direction)throw new v(e.constructor.name);const r=n.transform(t.value,t);if(o.async){return(r instanceof Promise?r:Promise.resolve(r)).then((e=>(t.value=e,t)))}if(r instanceof Promise)throw new g;return t.value=r,t}}));function Kn(e,n){return e.issues.length&&void 0===n?{issues:[],value:void 0}:e}const Jn=m("$ZodOptional",((e,n)=>{Qe.init(e,n),e._zod.optin="optional",e._zod.optout="optional",N(e._zod,"values",(()=>n.innerType._zod.values?new Set([...n.innerType._zod.values,void 0]):void 0)),N(e._zod,"pattern",(()=>{const e=n.innerType._zod.pattern;return e?new RegExp(`^(${_(e.source)})?$`):void 0})),e._zod.parse=(e,t)=>{if("optional"===n.innerType._zod.optin){const o=n.innerType._zod.run(e,t);return o instanceof Promise?o.then((n=>Kn(n,e.value))):Kn(o,e.value)}return void 0===e.value?e:n.innerType._zod.run(e,t)}})),Gn=m("$ZodExactOptional",((e,n)=>{Jn.init(e,n),N(e._zod,"values",(()=>n.innerType._zod.values)),N(e._zod,"pattern",(()=>n.innerType._zod.pattern)),e._zod.parse=(e,t)=>n.innerType._zod.run(e,t)})),Hn=m("$ZodNullable",((e,n)=>{Qe.init(e,n),N(e._zod,"optin",(()=>n.innerType._zod.optin)),N(e._zod,"optout",(()=>n.innerType._zod.optout)),N(e._zod,"pattern",(()=>{const e=n.innerType._zod.pattern;return e?new RegExp(`^(${_(e.source)}|null)$`):void 0})),N(e._zod,"values",(()=>n.innerType._zod.values?new Set([...n.innerType._zod.values,null]):void 0)),e._zod.parse=(e,t)=>null===e.value?e:n.innerType._zod.run(e,t)})),Xn=m("$ZodDefault",((e,n)=>{Qe.init(e,n),e._zod.optin="optional",N(e._zod,"values",(()=>n.innerType._zod.values)),e._zod.parse=(e,t)=>{if("backward"===t.direction)return n.innerType._zod.run(e,t);if(void 0===e.value)return e.value=n.defaultValue,e;const o=n.innerType._zod.run(e,t);return o instanceof Promise?o.then((e=>Yn(e,n))):Yn(o,n)}}));function Yn(e,n){return void 0===e.value&&(e.value=n.defaultValue),e}const Qn=m("$ZodPrefault",((e,n)=>{Qe.init(e,n),e._zod.optin="optional",N(e._zod,"values",(()=>n.innerType._zod.values)),e._zod.parse=(e,t)=>("backward"===t.direction||void 0===e.value&&(e.value=n.defaultValue),n.innerType._zod.run(e,t))})),et=m("$ZodNonOptional",((e,n)=>{Qe.init(e,n),N(e._zod,"values",(()=>{const e=n.innerType._zod.values;return e?new Set([...e].filter((e=>void 0!==e))):void 0})),e._zod.parse=(t,o)=>{const r=n.innerType._zod.run(t,o);return r instanceof Promise?r.then((n=>nt(n,e))):nt(r,e)}}));function nt(e,n){return e.issues.length||void 0!==e.value||e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:n}),e}const tt=m("$ZodCatch",((e,n)=>{Qe.init(e,n),N(e._zod,"optin",(()=>n.innerType._zod.optin)),N(e._zod,"optout",(()=>n.innerType._zod.optout)),N(e._zod,"values",(()=>n.innerType._zod.values)),e._zod.parse=(e,t)=>{if("backward"===t.direction)return n.innerType._zod.run(e,t);const o=n.innerType._zod.run(e,t);return o instanceof Promise?o.then((o=>(e.value=o.value,o.issues.length&&(e.value=n.catchValue({...e,error:{issues:o.issues.map((e=>B(e,t,w())))},input:e.value}),e.issues=[]),e))):(e.value=o.value,o.issues.length&&(e.value=n.catchValue({...e,error:{issues:o.issues.map((e=>B(e,t,w())))},input:e.value}),e.issues=[]),e)}})),ot=m("$ZodPipe",((e,n)=>{Qe.init(e,n),N(e._zod,"values",(()=>n.in._zod.values)),N(e._zod,"optin",(()=>n.in._zod.optin)),N(e._zod,"optout",(()=>n.out._zod.optout)),N(e._zod,"propValues",(()=>n.in._zod.propValues)),e._zod.parse=(e,t)=>{if("backward"===t.direction){const o=n.out._zod.run(e,t);return o instanceof Promise?o.then((e=>rt(e,n.in,t))):rt(o,n.in,t)}const o=n.in._zod.run(e,t);return o instanceof Promise?o.then((e=>rt(e,n.out,t))):rt(o,n.out,t)}}));function rt(e,n,t){return e.issues.length?(e.aborted=!0,e):n._zod.run({value:e.value,issues:e.issues},t)}const at=m("$ZodReadonly",((e,n)=>{Qe.init(e,n),N(e._zod,"propValues",(()=>n.innerType._zod.propValues)),N(e._zod,"values",(()=>n.innerType._zod.values)),N(e._zod,"optin",(()=>{var e,t;return null==(t=null==(e=n.innerType)?void 0:e._zod)?void 0:t.optin})),N(e._zod,"optout",(()=>{var e,t;return null==(t=null==(e=n.innerType)?void 0:e._zod)?void 0:t.optout})),e._zod.parse=(e,t)=>{if("backward"===t.direction)return n.innerType._zod.run(e,t);const o=n.innerType._zod.run(e,t);return o instanceof Promise?o.then(it):it(o)}}));function it(e){return e.value=Object.freeze(e.value),e}const st=m("$ZodCustom",((e,n)=>{Ae.init(e,n),Qe.init(e,n),e._zod.parse=(e,n)=>e,e._zod.check=t=>{const o=t.value,r=n.fn(o);if(r instanceof Promise)return r.then((n=>ct(n,t,o,e)));ct(r,t,o,e)}}));function ct(e,n,t,o){if(!e){const e={code:"custom",input:t,inst:o,path:[...o._zod.def.path??[]],continue:!o._zod.def.abort};o._zod.def.params&&(e.params=o._zod.def.params),n.issues.push(V(e))}}var dt;class lt{constructor(){this._map=new WeakMap,this._idmap=new Map}add(e,...n){const t=n[0];return this._map.set(e,t),t&&"object"==typeof t&&"id"in t&&this._idmap.set(t.id,e),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(e){const n=this._map.get(e);return n&&"object"==typeof n&&"id"in n&&this._idmap.delete(n.id),this._map.delete(e),this}get(e){const n=e._zod.parent;if(n){const t={...this.get(n)??{}};delete t.id;const o={...t,...this._map.get(e)};return Object.keys(o).length?o:void 0}return this._map.get(e)}has(e){return this._map.has(e)}}(dt=globalThis).__zod_globalRegistry??(dt.__zod_globalRegistry=new lt);const ut=globalThis.__zod_globalRegistry;function pt(e,n){return new e({type:"string",...D(n)})}function ft(e,n){return new e({type:"string",format:"email",check:"string_format",abort:!1,...D(n)})}function ht(e,n){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...D(n)})}function mt(e,n){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...D(n)})}function gt(e,n){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...D(n)})}function vt(e,n){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...D(n)})}function bt(e,n){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...D(n)})}function wt(e,n){return new e({type:"string",format:"url",check:"string_format",abort:!1,...D(n)})}function yt(e,n){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...D(n)})}function xt(e,n){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...D(n)})}function kt(e,n){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...D(n)})}function Et(e,n){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...D(n)})}function _t(e,n){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...D(n)})}function Rt(e,n){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...D(n)})}function Nt(e,n){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...D(n)})}function Tt(e,n){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...D(n)})}function Ot(e,n){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...D(n)})}function St(e,n){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...D(n)})}function It(e,n){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...D(n)})}function Ct(e,n){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...D(n)})}function zt(e,n){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...D(n)})}function jt(e,n){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...D(n)})}function At(e,n){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...D(n)})}function Ft(e,n){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...D(n)})}function $t(e,n){return new e({type:"string",format:"date",check:"string_format",...D(n)})}function Pt(e,n){return new e({type:"string",format:"time",check:"string_format",precision:null,...D(n)})}function Dt(e,n){return new e({type:"string",format:"duration",check:"string_format",...D(n)})}function Lt(e,n){return new e({type:"number",checks:[],...D(n)})}function Mt(e,n){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...D(n)})}function qt(e,n){return new e({type:"boolean",...D(n)})}function Ut(e){return new e({type:"any"})}function Bt(e){return new e({type:"unknown"})}function Wt(e,n){return new e({type:"never",...D(n)})}function Vt(e,n){return new $e({check:"less_than",...D(n),value:e,inclusive:!1})}function Zt(e,n){return new $e({check:"less_than",...D(n),value:e,inclusive:!0})}function Kt(e,n){return new Pe({check:"greater_than",...D(n),value:e,inclusive:!1})}function Jt(e,n){return new Pe({check:"greater_than",...D(n),value:e,inclusive:!0})}function Gt(e,n){return new De({check:"multiple_of",...D(n),value:e})}function Ht(e,n){return new Me({check:"max_length",...D(n),maximum:e})}function Xt(e,n){return new qe({check:"min_length",...D(n),minimum:e})}function Yt(e,n){return new Ue({check:"length_equals",...D(n),length:e})}function Qt(e,n){return new We({check:"string_format",format:"regex",...D(n),pattern:e})}function eo(e){return new Ve({check:"string_format",format:"lowercase",...D(e)})}function no(e){return new Ze({check:"string_format",format:"uppercase",...D(e)})}function to(e,n){return new Ke({check:"string_format",format:"includes",...D(n),includes:e})}function oo(e,n){return new Je({check:"string_format",format:"starts_with",...D(n),prefix:e})}function ro(e,n){return new Ge({check:"string_format",format:"ends_with",...D(n),suffix:e})}function ao(e){return new He({check:"overwrite",tx:e})}function io(e){return ao((n=>n.normalize(e)))}function so(){return ao((e=>e.trim()))}function co(){return ao((e=>e.toLowerCase()))}function lo(){return ao((e=>e.toUpperCase()))}function uo(){return ao((e=>function(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}(e)))}function po(e,n,t){return new e({type:"array",element:n,...D(t)})}function fo(e,n,t){return new e({type:"custom",check:"custom",fn:n,...D(t)})}function ho(e){const n=mo((t=>(t.addIssue=e=>{if("string"==typeof e)t.issues.push(V(e,t.value,n._zod.def));else{const o=e;o.fatal&&(o.continue=!1),o.code??(o.code="custom"),o.input??(o.input=t.value),o.inst??(o.inst=n),o.continue??(o.continue=!n._zod.def.abort),t.issues.push(V(o))}},e(t.value,t))));return n}function mo(e,n){const t=new Ae({check:"custom",...D(n)});return t._zod.check=e,t}function go(e){let n=(null==e?void 0:e.target)??"draft-2020-12";return"draft-4"===n&&(n="draft-04"),"draft-7"===n&&(n="draft-07"),{processors:e.processors??{},metadataRegistry:(null==e?void 0:e.metadata)??ut,target:n,unrepresentable:(null==e?void 0:e.unrepresentable)??"throw",override:(null==e?void 0:e.override)??(()=>{}),io:(null==e?void 0:e.io)??"output",counter:0,seen:new Map,cycles:(null==e?void 0:e.cycles)??"ref",reused:(null==e?void 0:e.reused)??"inline",external:(null==e?void 0:e.external)??void 0}}function vo(e,n,t={path:[],schemaPath:[]}){var o,r,a;const i=e._zod.def,s=n.seen.get(e);if(s){s.count++;return t.schemaPath.includes(e)&&(s.cycle=t.path),s.schema}const c={schema:{},count:1,cycle:void 0,path:t.path};n.seen.set(e,c);const d=null==(r=(o=e._zod).toJSONSchema)?void 0:r.call(o);if(d)c.schema=d;else{const o={...t,schemaPath:[...t.schemaPath,e],path:t.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(n,c.schema,o);else{const t=c.schema,r=n.processors[i.type];if(!r)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${i.type}`);r(e,n,t,o)}const r=e._zod.parent;r&&(c.ref||(c.ref=r),vo(r,n,o),n.seen.get(r).isParent=!0)}const l=n.metadataRegistry.get(e);l&&Object.assign(c.schema,l),"input"===n.io&&yo(e)&&(delete c.schema.examples,delete c.schema.default),"input"===n.io&&c.schema._prefault&&((a=c.schema).default??(a.default=c.schema._prefault)),delete c.schema._prefault;return n.seen.get(e).schema}function bo(e,n){var t,o,r,a;const i=e.seen.get(n);if(!i)throw new Error("Unprocessed schema. This is a bug in Zod.");const s=new Map;for(const d of e.seen.entries()){const n=null==(t=e.metadataRegistry.get(d[0]))?void 0:t.id;if(n){const e=s.get(n);if(e&&e!==d[0])throw new Error(`Duplicate schema id "${n}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);s.set(n,d[0])}}const c=n=>{if(n[1].schema.$ref)return;const t=n[1],{ref:o,defId:r}=(n=>{var t;const o="draft-2020-12"===e.target?"$defs":"definitions";if(e.external){const r=null==(t=e.external.registry.get(n[0]))?void 0:t.id,a=e.external.uri??(e=>e);if(r)return{ref:a(r)};const i=n[1].defId??n[1].schema.id??"schema"+e.counter++;return n[1].defId=i,{defId:i,ref:`${a("__shared")}#/${o}/${i}`}}if(n[1]===i)return{ref:"#"};const r=`#/${o}/`,a=n[1].schema.id??"__schema"+e.counter++;return{defId:a,ref:r+a}})(n);t.def={...t.schema},r&&(t.defId=r);const a=t.schema;for(const e in a)delete a[e];a.$ref=o};if("throw"===e.cycles)for(const d of e.seen.entries()){const e=d[1];if(e.cycle)throw new Error(`Cycle detected: #/${null==(o=e.cycle)?void 0:o.join("/")}/<root>\n\nSet the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(const d of e.seen.entries()){const t=d[1];if(n===d[0]){c(d);continue}if(e.external){const t=null==(r=e.external.registry.get(d[0]))?void 0:r.id;if(n!==d[0]&&t){c(d);continue}}(null==(a=e.metadataRegistry.get(d[0]))?void 0:a.id)?c(d):(t.cycle||t.count>1&&"ref"===e.reused)&&c(d)}}function wo(e,n){var t,o,r;const a=e.seen.get(n);if(!a)throw new Error("Unprocessed schema. This is a bug in Zod.");const i=n=>{const t=e.seen.get(n);if(null===t.ref)return;const o=t.def??t.schema,r={...o},a=t.ref;if(t.ref=null,a){i(a);const t=e.seen.get(a),s=t.schema;!s.$ref||"draft-07"!==e.target&&"draft-04"!==e.target&&"openapi-3.0"!==e.target?Object.assign(o,s):(o.allOf=o.allOf??[],o.allOf.push(s)),Object.assign(o,r);if(n._zod.parent===a)for(const e in o)"$ref"!==e&&"allOf"!==e&&(e in r||delete o[e]);if(s.$ref&&t.def)for(const e in o)"$ref"!==e&&"allOf"!==e&&e in t.def&&JSON.stringify(o[e])===JSON.stringify(t.def[e])&&delete o[e]}const s=n._zod.parent;if(s&&s!==a){i(s);const n=e.seen.get(s);if((null==n?void 0:n.schema.$ref)&&(o.$ref=n.schema.$ref,n.def))for(const e in o)"$ref"!==e&&"allOf"!==e&&e in n.def&&JSON.stringify(o[e])===JSON.stringify(n.def[e])&&delete o[e]}e.override({zodSchema:n,jsonSchema:o,path:t.path??[]})};for(const l of[...e.seen.entries()].reverse())i(l[0]);const s={};if("draft-2020-12"===e.target?s.$schema="https://json-schema.org/draft/2020-12/schema":"draft-07"===e.target?s.$schema="http://json-schema.org/draft-07/schema#":"draft-04"===e.target?s.$schema="http://json-schema.org/draft-04/schema#":e.target,null==(t=e.external)?void 0:t.uri){const t=null==(o=e.external.registry.get(n))?void 0:o.id;if(!t)throw new Error("Schema is missing an `id` property");s.$id=e.external.uri(t)}Object.assign(s,a.def??a.schema);const c=(null==(r=e.external)?void 0:r.defs)??{};for(const l of e.seen.entries()){const e=l[1];e.def&&e.defId&&(c[e.defId]=e.def)}e.external||Object.keys(c).length>0&&("draft-2020-12"===e.target?s.$defs=c:s.definitions=c);try{const t=JSON.parse(JSON.stringify(s));return Object.defineProperty(t,"~standard",{value:{...n["~standard"],jsonSchema:{input:xo(n,"input",e.processors),output:xo(n,"output",e.processors)}},enumerable:!1,writable:!1}),t}catch(d){throw new Error("Error converting schema to JSON.")}}function yo(e,n){const t=n??{seen:new Set};if(t.seen.has(e))return!1;t.seen.add(e);const o=e._zod.def;if("transform"===o.type)return!0;if("array"===o.type)return yo(o.element,t);if("set"===o.type)return yo(o.valueType,t);if("lazy"===o.type)return yo(o.getter(),t);if("promise"===o.type||"optional"===o.type||"nonoptional"===o.type||"nullable"===o.type||"readonly"===o.type||"default"===o.type||"prefault"===o.type)return yo(o.innerType,t);if("intersection"===o.type)return yo(o.left,t)||yo(o.right,t);if("record"===o.type||"map"===o.type)return yo(o.keyType,t)||yo(o.valueType,t);if("pipe"===o.type)return yo(o.in,t)||yo(o.out,t);if("object"===o.type){for(const e in o.shape)if(yo(o.shape[e],t))return!0;return!1}if("union"===o.type){for(const e of o.options)if(yo(e,t))return!0;return!1}if("tuple"===o.type){for(const e of o.items)if(yo(e,t))return!0;return!(!o.rest||!yo(o.rest,t))}return!1}const xo=(e,n,t={})=>o=>{const{libraryOptions:r,target:a}=o??{},i=go({...r??{},target:a,io:n,processors:t});return vo(e,i),bo(i,e),wo(i,e)},ko={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},Eo=(e,n,t,o)=>{const r=e._zod.def;vo(r.innerType,n,o);n.seen.get(e).ref=r.innerType},_o=m("ZodISODateTime",((e,n)=>{hn.init(e,n),Vo.init(e,n)}));const Ro=m("ZodISODate",((e,n)=>{mn.init(e,n),Vo.init(e,n)}));const No=m("ZodISOTime",((e,n)=>{gn.init(e,n),Vo.init(e,n)}));const To=m("ZodISODuration",((e,n)=>{vn.init(e,n),Vo.init(e,n)}));const Oo=m("ZodError",((e,n)=>{K.init(e,n),e.name="ZodError",Object.defineProperties(e,{format:{value:n=>function(e,n=e=>e.message){const t={_errors:[]},o=e=>{for(const r of e.issues)if("invalid_union"===r.code&&r.errors.length)r.errors.map((e=>o({issues:e})));else if("invalid_key"===r.code)o({issues:r.issues});else if("invalid_element"===r.code)o({issues:r.issues});else if(0===r.path.length)t._errors.push(n(r));else{let e=t,o=0;for(;o<r.path.length;){const t=r.path[o];o===r.path.length-1?(e[t]=e[t]||{_errors:[]},e[t]._errors.push(n(r))):e[t]=e[t]||{_errors:[]},e=e[t],o++}}};return o(e),t}(e,n)},flatten:{value:n=>function(e,n=e=>e.message){const t={},o=[];for(const r of e.issues)r.path.length>0?(t[r.path[0]]=t[r.path[0]]||[],t[r.path[0]].push(n(r))):o.push(n(r));return{formErrors:o,fieldErrors:t}}(e,n)},addIssue:{value:n=>{e.issues.push(n),e.message=JSON.stringify(e.issues,x,2)}},addIssues:{value:n=>{e.issues.push(...n),e.message=JSON.stringify(e.issues,x,2)}},isEmpty:{get:()=>0===e.issues.length}})}),{Parent:Error}),So=G(Oo),Io=H(Oo),Co=X(Oo),zo=Q(Oo),jo=ne(Oo),Ao=te(Oo),Fo=oe(Oo),$o=re(Oo),Po=ae(Oo),Do=ie(Oo),Lo=se(Oo),Mo=ce(Oo),qo=m("ZodType",((e,n)=>(Qe.init(e,n),Object.assign(e["~standard"],{jsonSchema:{input:xo(e,"input"),output:xo(e,"output")}}),e.toJSONSchema=((e,n={})=>t=>{const o=go({...t,processors:n});return vo(e,o),bo(o,e),wo(o,e)})(e,{}),e.def=n,e.type=n.type,Object.defineProperty(e,"_def",{value:n}),e.check=(...t)=>e.clone(O(n,{checks:[...n.checks??[],...t.map((e=>"function"==typeof e?{_zod:{check:e,def:{check:"custom"},onattach:[]}}:e))]}),{parent:!0}),e.with=e.check,e.clone=(n,t)=>P(e,n,t),e.brand=()=>e,e.register=(n,t)=>(n.add(e,t),e),e.parse=(n,t)=>So(e,n,t,{callee:e.parse}),e.safeParse=(n,t)=>Co(e,n,t),e.parseAsync=async(n,t)=>Io(e,n,t,{callee:e.parseAsync}),e.safeParseAsync=async(n,t)=>zo(e,n,t),e.spa=e.safeParseAsync,e.encode=(n,t)=>jo(e,n,t),e.decode=(n,t)=>Ao(e,n,t),e.encodeAsync=async(n,t)=>Fo(e,n,t),e.decodeAsync=async(n,t)=>$o(e,n,t),e.safeEncode=(n,t)=>Po(e,n,t),e.safeDecode=(n,t)=>Do(e,n,t),e.safeEncodeAsync=async(n,t)=>Lo(e,n,t),e.safeDecodeAsync=async(n,t)=>Mo(e,n,t),e.refine=(n,t)=>e.check(function(e,n={}){return fo(Lr,e,n)}(n,t)),e.superRefine=n=>e.check(ho(n)),e.overwrite=n=>e.check(ao(n)),e.optional=()=>Or(e),e.exactOptional=()=>new Sr({type:"optional",innerType:e}),e.nullable=()=>Cr(e),e.nullish=()=>Or(Cr(e)),e.nonoptional=n=>function(e,n){return new Ar({type:"nonoptional",innerType:e,...D(n)})}(e,n),e.array=()=>{return po(yr,e,n);var n},e.or=n=>{return new Er({type:"union",options:[e,n],...D(t)});var t},e.and=n=>new _r({type:"intersection",left:e,right:n}),e.transform=n=>Pr(e,new Nr({type:"transform",transform:n})),e.default=n=>{return t=n,new zr({type:"default",innerType:e,get defaultValue(){return"function"==typeof t?t():A(t)}});var t},e.prefault=n=>{return t=n,new jr({type:"prefault",innerType:e,get defaultValue(){return"function"==typeof t?t():A(t)}});var t},e.catch=n=>{return new Fr({type:"catch",innerType:e,catchValue:"function"==typeof(t=n)?t:()=>t});var t},e.pipe=n=>Pr(e,n),e.readonly=()=>new Dr({type:"readonly",innerType:e}),e.describe=n=>{const t=e.clone();return ut.add(t,{description:n}),t},Object.defineProperty(e,"description",{get(){var n;return null==(n=ut.get(e))?void 0:n.description},configurable:!0}),e.meta=(...n)=>{if(0===n.length)return ut.get(e);const t=e.clone();return ut.add(t,n[0]),t},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e.apply=n=>n(e),e))),Uo=m("_ZodString",((e,n)=>{en.init(e,n),qo.init(e,n),e._zod.processJSONSchema=(n,t,o)=>((e,n,t)=>{const o=t;o.type="string";const{minimum:r,maximum:a,format:i,patterns:s,contentEncoding:c}=e._zod.bag;if("number"==typeof r&&(o.minLength=r),"number"==typeof a&&(o.maxLength=a),i&&(o.format=ko[i]??i,""===o.format&&delete o.format,"time"===i&&delete o.format),c&&(o.contentEncoding=c),s&&s.size>0){const e=[...s];1===e.length?o.pattern=e[0].source:e.length>1&&(o.allOf=[...e.map((e=>({..."draft-07"===n.target||"draft-04"===n.target||"openapi-3.0"===n.target?{type:"string"}:{},pattern:e.source})))])}})(e,n,t);const t=e._zod.bag;e.format=t.format??null,e.minLength=t.minimum??null,e.maxLength=t.maximum??null,e.regex=(...n)=>e.check(Qt(...n)),e.includes=(...n)=>e.check(to(...n)),e.startsWith=(...n)=>e.check(oo(...n)),e.endsWith=(...n)=>e.check(ro(...n)),e.min=(...n)=>e.check(Xt(...n)),e.max=(...n)=>e.check(Ht(...n)),e.length=(...n)=>e.check(Yt(...n)),e.nonempty=(...n)=>e.check(Xt(1,...n)),e.lowercase=n=>e.check(eo(n)),e.uppercase=n=>e.check(no(n)),e.trim=()=>e.check(so()),e.normalize=(...n)=>e.check(io(...n)),e.toLowerCase=()=>e.check(co()),e.toUpperCase=()=>e.check(lo()),e.slugify=()=>e.check(uo())})),Bo=m("ZodString",((e,n)=>{en.init(e,n),Uo.init(e,n),e.email=n=>e.check(ft(Zo,n)),e.url=n=>e.check(wt(Go,n)),e.jwt=n=>e.check(At(lr,n)),e.emoji=n=>e.check(yt(Ho,n)),e.guid=n=>e.check(ht(Ko,n)),e.uuid=n=>e.check(mt(Jo,n)),e.uuidv4=n=>e.check(gt(Jo,n)),e.uuidv6=n=>e.check(vt(Jo,n)),e.uuidv7=n=>e.check(bt(Jo,n)),e.nanoid=n=>e.check(xt(Xo,n)),e.guid=n=>e.check(ht(Ko,n)),e.cuid=n=>e.check(kt(Yo,n)),e.cuid2=n=>e.check(Et(Qo,n)),e.ulid=n=>e.check(_t(er,n)),e.base64=n=>e.check(Ct(sr,n)),e.base64url=n=>e.check(zt(cr,n)),e.xid=n=>e.check(Rt(nr,n)),e.ksuid=n=>e.check(Nt(tr,n)),e.ipv4=n=>e.check(Tt(or,n)),e.ipv6=n=>e.check(Ot(rr,n)),e.cidrv4=n=>e.check(St(ar,n)),e.cidrv6=n=>e.check(It(ir,n)),e.e164=n=>e.check(jt(dr,n)),e.datetime=n=>e.check(function(e){return Ft(_o,e)}(n)),e.date=n=>e.check(function(e){return $t(Ro,e)}(n)),e.time=n=>e.check(function(e){return Pt(No,e)}(n)),e.duration=n=>e.check(function(e){return Dt(To,e)}(n))}));function Wo(e){return pt(Bo,e)}const Vo=m("ZodStringFormat",((e,n)=>{nn.init(e,n),Uo.init(e,n)})),Zo=m("ZodEmail",((e,n)=>{rn.init(e,n),Vo.init(e,n)})),Ko=m("ZodGUID",((e,n)=>{tn.init(e,n),Vo.init(e,n)})),Jo=m("ZodUUID",((e,n)=>{on.init(e,n),Vo.init(e,n)})),Go=m("ZodURL",((e,n)=>{an.init(e,n),Vo.init(e,n)})),Ho=m("ZodEmoji",((e,n)=>{sn.init(e,n),Vo.init(e,n)})),Xo=m("ZodNanoID",((e,n)=>{cn.init(e,n),Vo.init(e,n)})),Yo=m("ZodCUID",((e,n)=>{dn.init(e,n),Vo.init(e,n)})),Qo=m("ZodCUID2",((e,n)=>{ln.init(e,n),Vo.init(e,n)})),er=m("ZodULID",((e,n)=>{un.init(e,n),Vo.init(e,n)})),nr=m("ZodXID",((e,n)=>{pn.init(e,n),Vo.init(e,n)})),tr=m("ZodKSUID",((e,n)=>{fn.init(e,n),Vo.init(e,n)})),or=m("ZodIPv4",((e,n)=>{bn.init(e,n),Vo.init(e,n)})),rr=m("ZodIPv6",((e,n)=>{wn.init(e,n),Vo.init(e,n)})),ar=m("ZodCIDRv4",((e,n)=>{yn.init(e,n),Vo.init(e,n)})),ir=m("ZodCIDRv6",((e,n)=>{xn.init(e,n),Vo.init(e,n)})),sr=m("ZodBase64",((e,n)=>{En.init(e,n),Vo.init(e,n)})),cr=m("ZodBase64URL",((e,n)=>{_n.init(e,n),Vo.init(e,n)})),dr=m("ZodE164",((e,n)=>{Rn.init(e,n),Vo.init(e,n)})),lr=m("ZodJWT",((e,n)=>{Nn.init(e,n),Vo.init(e,n)})),ur=m("ZodNumber",((e,n)=>{Tn.init(e,n),qo.init(e,n),e._zod.processJSONSchema=(n,t,o)=>((e,n,t)=>{const o=t,{minimum:r,maximum:a,format:i,multipleOf:s,exclusiveMaximum:c,exclusiveMinimum:d}=e._zod.bag;"string"==typeof i&&i.includes("int")?o.type="integer":o.type="number","number"==typeof d&&("draft-04"===n.target||"openapi-3.0"===n.target?(o.minimum=d,o.exclusiveMinimum=!0):o.exclusiveMinimum=d),"number"==typeof r&&(o.minimum=r,"number"==typeof d&&"draft-04"!==n.target&&(d>=r?delete o.minimum:delete o.exclusiveMinimum)),"number"==typeof c&&("draft-04"===n.target||"openapi-3.0"===n.target?(o.maximum=c,o.exclusiveMaximum=!0):o.exclusiveMaximum=c),"number"==typeof a&&(o.maximum=a,"number"==typeof c&&"draft-04"!==n.target&&(c<=a?delete o.maximum:delete o.exclusiveMaximum)),"number"==typeof s&&(o.multipleOf=s)})(e,n,t),e.gt=(n,t)=>e.check(Kt(n,t)),e.gte=(n,t)=>e.check(Jt(n,t)),e.min=(n,t)=>e.check(Jt(n,t)),e.lt=(n,t)=>e.check(Vt(n,t)),e.lte=(n,t)=>e.check(Zt(n,t)),e.max=(n,t)=>e.check(Zt(n,t)),e.int=n=>e.check(fr(n)),e.safe=n=>e.check(fr(n)),e.positive=n=>e.check(Kt(0,n)),e.nonnegative=n=>e.check(Jt(0,n)),e.negative=n=>e.check(Vt(0,n)),e.nonpositive=n=>e.check(Zt(0,n)),e.multipleOf=(n,t)=>e.check(Gt(n,t)),e.step=(n,t)=>e.check(Gt(n,t)),e.finite=()=>e;const t=e._zod.bag;e.minValue=Math.max(t.minimum??Number.NEGATIVE_INFINITY,t.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,e.maxValue=Math.min(t.maximum??Number.POSITIVE_INFINITY,t.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,e.isInt=(t.format??"").includes("int")||Number.isSafeInteger(t.multipleOf??.5),e.isFinite=!0,e.format=t.format??null}));const pr=m("ZodNumberFormat",((e,n)=>{On.init(e,n),ur.init(e,n)}));function fr(e){return Mt(pr,e)}const hr=m("ZodBoolean",((e,n)=>{Sn.init(e,n),qo.init(e,n),e._zod.processJSONSchema=(e,n,t)=>((e,n,t)=>{t.type="boolean"})(0,0,n)}));function mr(e){return qt(hr,e)}const gr=m("ZodAny",((e,n)=>{In.init(e,n),qo.init(e,n),e._zod.processJSONSchema=(e,n,t)=>{}}));const vr=m("ZodUnknown",((e,n)=>{Cn.init(e,n),qo.init(e,n),e._zod.processJSONSchema=(e,n,t)=>{}}));function br(){return Bt(vr)}const wr=m("ZodNever",((e,n)=>{zn.init(e,n),qo.init(e,n),e._zod.processJSONSchema=(e,n,t)=>((e,n,t)=>{t.not={}})(0,0,n)}));const yr=m("ZodArray",((e,n)=>{An.init(e,n),qo.init(e,n),e._zod.processJSONSchema=(n,t,o)=>((e,n,t,o)=>{const r=t,a=e._zod.def,{minimum:i,maximum:s}=e._zod.bag;"number"==typeof i&&(r.minItems=i),"number"==typeof s&&(r.maxItems=s),r.type="array",r.items=vo(a.element,n,{...o,path:[...o.path,"items"]})})(e,n,t,o),e.element=n.element,e.min=(n,t)=>e.check(Xt(n,t)),e.nonempty=n=>e.check(Xt(1,n)),e.max=(n,t)=>e.check(Ht(n,t)),e.length=(n,t)=>e.check(Yt(n,t)),e.unwrap=()=>e.element}));const xr=m("ZodObject",((e,n)=>{Ln.init(e,n),qo.init(e,n),e._zod.processJSONSchema=(n,t,o)=>((e,n,t,o)=>{var r;const a=t,i=e._zod.def;a.type="object",a.properties={};const s=i.shape;for(const l in s)a.properties[l]=vo(s[l],n,{...o,path:[...o.path,"properties",l]});const c=new Set(Object.keys(s)),d=new Set([...c].filter((e=>{const t=i.shape[e]._zod;return"input"===n.io?void 0===t.optin:void 0===t.optout})));d.size>0&&(a.required=Array.from(d)),"never"===(null==(r=i.catchall)?void 0:r._zod.def.type)?a.additionalProperties=!1:i.catchall?i.catchall&&(a.additionalProperties=vo(i.catchall,n,{...o,path:[...o.path,"additionalProperties"]})):"output"===n.io&&(a.additionalProperties=!1)})(e,n,t,o),N(e,"shape",(()=>n.shape)),e.keyof=()=>function(e,n){const t=Array.isArray(e)?Object.fromEntries(e.map((e=>[e,e]))):e;return new Rr({type:"enum",entries:t,...D(n)})}(Object.keys(e._zod.def.shape)),e.catchall=n=>e.clone({...e._zod.def,catchall:n}),e.passthrough=()=>e.clone({...e._zod.def,catchall:br()}),e.loose=()=>e.clone({...e._zod.def,catchall:br()}),e.strict=()=>{return e.clone({...e._zod.def,catchall:Wt(wr,n)});var n},e.strip=()=>e.clone({...e._zod.def,catchall:void 0}),e.extend=n=>function(e,n){if(!j(n))throw new Error("Invalid input to extend: expected a plain object");const t=e._zod.def.checks;if(t&&t.length>0){const t=e._zod.def.shape;for(const e in n)if(void 0!==Object.getOwnPropertyDescriptor(t,e))throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}const o=O(e._zod.def,{get shape(){const t={...e._zod.def.shape,...n};return T(this,"shape",t),t}});return P(e,o)}(e,n),e.safeExtend=n=>function(e,n){if(!j(n))throw new Error("Invalid input to safeExtend: expected a plain object");const t=O(e._zod.def,{get shape(){const t={...e._zod.def.shape,...n};return T(this,"shape",t),t}});return P(e,t)}(e,n),e.merge=n=>function(e,n){const t=O(e._zod.def,{get shape(){const t={...e._zod.def.shape,...n._zod.def.shape};return T(this,"shape",t),t},get catchall(){return n._zod.def.catchall},checks:[]});return P(e,t)}(e,n),e.pick=n=>function(e,n){const t=e._zod.def,o=t.checks;if(o&&o.length>0)throw new Error(".pick() cannot be used on object schemas containing refinements");return P(e,O(e._zod.def,{get shape(){const e={};for(const o in n){if(!(o in t.shape))throw new Error(`Unrecognized key: "${o}"`);n[o]&&(e[o]=t.shape[o])}return T(this,"shape",e),e},checks:[]}))}(e,n),e.omit=n=>function(e,n){const t=e._zod.def,o=t.checks;if(o&&o.length>0)throw new Error(".omit() cannot be used on object schemas containing refinements");const r=O(e._zod.def,{get shape(){const o={...e._zod.def.shape};for(const e in n){if(!(e in t.shape))throw new Error(`Unrecognized key: "${e}"`);n[e]&&delete o[e]}return T(this,"shape",o),o},checks:[]});return P(e,r)}(e,n),e.partial=(...n)=>function(e,n,t){const o=n._zod.def.checks;if(o&&o.length>0)throw new Error(".partial() cannot be used on object schemas containing refinements");const r=O(n._zod.def,{get shape(){const o=n._zod.def.shape,r={...o};if(t)for(const n in t){if(!(n in o))throw new Error(`Unrecognized key: "${n}"`);t[n]&&(r[n]=e?new e({type:"optional",innerType:o[n]}):o[n])}else for(const n in o)r[n]=e?new e({type:"optional",innerType:o[n]}):o[n];return T(this,"shape",r),r},checks:[]});return P(n,r)}(Tr,e,n[0]),e.required=(...n)=>function(e,n,t){const o=O(n._zod.def,{get shape(){const o=n._zod.def.shape,r={...o};if(t)for(const n in t){if(!(n in r))throw new Error(`Unrecognized key: "${n}"`);t[n]&&(r[n]=new e({type:"nonoptional",innerType:o[n]}))}else for(const n in o)r[n]=new e({type:"nonoptional",innerType:o[n]});return T(this,"shape",r),r}});return P(n,o)}(Ar,e,n[0])}));function kr(e,n){const t={type:"object",shape:e??{},...D(n)};return new xr(t)}const Er=m("ZodUnion",((e,n)=>{qn.init(e,n),qo.init(e,n),e._zod.processJSONSchema=(n,t,o)=>((e,n,t,o)=>{const r=e._zod.def,a=!1===r.inclusive,i=r.options.map(((e,t)=>vo(e,n,{...o,path:[...o.path,a?"oneOf":"anyOf",t]})));a?t.oneOf=i:t.anyOf=i})(e,n,t,o),e.options=n.options}));const _r=m("ZodIntersection",((e,n)=>{Un.init(e,n),qo.init(e,n),e._zod.processJSONSchema=(n,t,o)=>((e,n,t,o)=>{const r=e._zod.def,a=vo(r.left,n,{...o,path:[...o.path,"allOf",0]}),i=vo(r.right,n,{...o,path:[...o.path,"allOf",1]}),s=e=>"allOf"in e&&1===Object.keys(e).length,c=[...s(a)?a.allOf:[a],...s(i)?i.allOf:[i]];t.allOf=c})(e,n,t,o)}));const Rr=m("ZodEnum",((e,n)=>{Vn.init(e,n),qo.init(e,n),e._zod.processJSONSchema=(n,t,o)=>((e,n,t)=>{const o=y(e._zod.def.entries);o.every((e=>"number"==typeof e))&&(t.type="number"),o.every((e=>"string"==typeof e))&&(t.type="string"),t.enum=o})(e,0,t),e.enum=n.entries,e.options=Object.values(n.entries);const t=new Set(Object.keys(n.entries));e.extract=(e,o)=>{const r={};for(const a of e){if(!t.has(a))throw new Error(`Key ${a} not found in enum`);r[a]=n.entries[a]}return new Rr({...n,checks:[],...D(o),entries:r})},e.exclude=(e,o)=>{const r={...n.entries};for(const n of e){if(!t.has(n))throw new Error(`Key ${n} not found in enum`);delete r[n]}return new Rr({...n,checks:[],...D(o),entries:r})}}));const Nr=m("ZodTransform",((e,n)=>{Zn.init(e,n),qo.init(e,n),e._zod.processJSONSchema=(e,n,t)=>((e,n)=>{if("throw"===n.unrepresentable)throw new Error("Transforms cannot be represented in JSON Schema")})(0,e),e._zod.parse=(t,o)=>{if("backward"===o.direction)throw new v(e.constructor.name);t.addIssue=o=>{if("string"==typeof o)t.issues.push(V(o,t.value,n));else{const n=o;n.fatal&&(n.continue=!1),n.code??(n.code="custom"),n.input??(n.input=t.value),n.inst??(n.inst=e),t.issues.push(V(n))}};const r=n.transform(t.value,t);return r instanceof Promise?r.then((e=>(t.value=e,t))):(t.value=r,t)}}));const Tr=m("ZodOptional",((e,n)=>{Jn.init(e,n),qo.init(e,n),e._zod.processJSONSchema=(n,t,o)=>Eo(e,n,0,o),e.unwrap=()=>e._zod.def.innerType}));function Or(e){return new Tr({type:"optional",innerType:e})}const Sr=m("ZodExactOptional",((e,n)=>{Gn.init(e,n),qo.init(e,n),e._zod.processJSONSchema=(n,t,o)=>Eo(e,n,0,o),e.unwrap=()=>e._zod.def.innerType}));const Ir=m("ZodNullable",((e,n)=>{Hn.init(e,n),qo.init(e,n),e._zod.processJSONSchema=(n,t,o)=>((e,n,t,o)=>{const r=e._zod.def,a=vo(r.innerType,n,o),i=n.seen.get(e);"openapi-3.0"===n.target?(i.ref=r.innerType,t.nullable=!0):t.anyOf=[a,{type:"null"}]})(e,n,t,o),e.unwrap=()=>e._zod.def.innerType}));function Cr(e){return new Ir({type:"nullable",innerType:e})}const zr=m("ZodDefault",((e,n)=>{Xn.init(e,n),qo.init(e,n),e._zod.processJSONSchema=(n,t,o)=>((e,n,t,o)=>{const r=e._zod.def;vo(r.innerType,n,o),n.seen.get(e).ref=r.innerType,t.default=JSON.parse(JSON.stringify(r.defaultValue))})(e,n,t,o),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap}));const jr=m("ZodPrefault",((e,n)=>{Qn.init(e,n),qo.init(e,n),e._zod.processJSONSchema=(n,t,o)=>((e,n,t,o)=>{const r=e._zod.def;vo(r.innerType,n,o),n.seen.get(e).ref=r.innerType,"input"===n.io&&(t._prefault=JSON.parse(JSON.stringify(r.defaultValue)))})(e,n,t,o),e.unwrap=()=>e._zod.def.innerType}));const Ar=m("ZodNonOptional",((e,n)=>{et.init(e,n),qo.init(e,n),e._zod.processJSONSchema=(n,t,o)=>((e,n,t,o)=>{const r=e._zod.def;vo(r.innerType,n,o),n.seen.get(e).ref=r.innerType})(e,n,0,o),e.unwrap=()=>e._zod.def.innerType}));const Fr=m("ZodCatch",((e,n)=>{tt.init(e,n),qo.init(e,n),e._zod.processJSONSchema=(n,t,o)=>((e,n,t,o)=>{const r=e._zod.def;let a;vo(r.innerType,n,o),n.seen.get(e).ref=r.innerType;try{a=r.catchValue(void 0)}catch{throw new Error("Dynamic catch values are not supported in JSON Schema")}t.default=a})(e,n,t,o),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap}));const $r=m("ZodPipe",((e,n)=>{ot.init(e,n),qo.init(e,n),e._zod.processJSONSchema=(n,t,o)=>((e,n,t,o)=>{const r=e._zod.def,a="input"===n.io?"transform"===r.in._zod.def.type?r.out:r.in:r.out;vo(a,n,o),n.seen.get(e).ref=a})(e,n,0,o),e.in=n.in,e.out=n.out}));function Pr(e,n){return new $r({type:"pipe",in:e,out:n})}const Dr=m("ZodReadonly",((e,n)=>{at.init(e,n),qo.init(e,n),e._zod.processJSONSchema=(n,t,o)=>((e,n,t,o)=>{const r=e._zod.def;vo(r.innerType,n,o),n.seen.get(e).ref=r.innerType,t.readOnly=!0})(e,n,t,o),e.unwrap=()=>e._zod.def.innerType}));const Lr=m("ZodCustom",((e,n)=>{st.init(e,n),qo.init(e,n),e._zod.processJSONSchema=(e,n,t)=>((e,n)=>{if("throw"===n.unrepresentable)throw new Error("Custom types cannot be represented in JSON Schema")})(0,e)}));var Mr;kr({success:mr(),accessToken:Wo().optional(),alias:Wo().optional(),user:kr({id:Wo(),email:Wo(),role:Wo(),validated:mr(),active:mr()}).optional(),person:kr({id:Wo(),name:Wo(),birth_date:Wo()}).optional(),confidence_score:Lt(ur,Mr).optional(),recognition_id:Wo().optional(),task_id:Wo().optional(),status:Wo().optional(),message:Wo().optional()}),kr({success:mr(),message:Wo(),person_id:Wo().optional(),user_id:Wo().optional(),person_validated:mr().optional(),face_processing:Ut(gr).optional(),onboarding_link:Wo().optional(),task_id:Wo().optional(),status:Wo().optional()});const qr="#0059C4",Ur="#F1BE00",Br="#0A1320",Wr={success:{fg:"#046C4E",bg:"#E7F7F0",solid:"#0E9F6E"},attention:{fg:"#6E5600",bg:"#FFF6D9",solid:"#F1BE00"},critical:{fg:"#9B1C1C",bg:"#FDEAEA",solid:"#E02424"},info:{fg:"#00449A",bg:"#EBF6FE",solid:"#0073F4"}},Vr={ground:"#F7F9FC",surface:"#FFFFFF",surfaceMuted:"#F1F5FA",line:"#E6ECF4",text:Br,textMuted:"#48586B",textSubtle:"#617489",action:qr,actionText:"#FFFFFF",accent:Ur,overlay:"rgba(10,19,32,.55)",focusRing:qr},Zr={ground:Br,surface:"#111C2B",surfaceMuted:"#1E2B3C",line:"#22334D",text:"#EEF3F9",textMuted:"#AFBDCE",textSubtle:"#8496AD",action:"#0091F6",actionText:"#FFFFFF",accent:Ur,overlay:"rgba(10,19,32,.72)",focusRing:"#00B0F8"};function Kr(e){const[n,t,o]=function(e){let n=e.trim().replace("#","");3===n.length&&(n=n.split("").map((e=>e+e)).join(""));return/^[0-9a-fA-F]{6}$/.test(n)?[parseInt(n.slice(0,2),16),parseInt(n.slice(2,4),16),parseInt(n.slice(4,6),16)]:[0,0,0]}(e).map((e=>{const n=e/255;return n<=.03928?n/12.92:((n+.055)/1.055)**2.4}));return.2126*n+.7152*t+.0722*o}const Jr=[8,16,24];function Gr(e={}){const n=function(e){if("dark"===e)return"dark";if("light"===e)return"light";if("undefined"!=typeof window&&"function"==typeof window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches)return"dark";return"light"}(e.theme),t="dark"===n?{...Zr}:{...Vr};let o=16;void 0!==e.radius&&Jr.includes(e.radius)&&(o=e.radius);let r=t.action,a=!1;if(e.accent){(function(e,n){const t=Kr(e),o=Kr(n),[r,a]=t>o?[t,o]:[o,t];return(r+.05)/(a+.05)})(e.accent,"#FFFFFF")>=4.5?r=e.accent:(a=!0,r=qr)}return{mode:n,tokens:{...t,action:r},radius:o,accent:r,accentFellBack:a}}const Hr="--nfid-ground",Xr="--nfid-surface",Yr="--nfid-surface-muted",Qr="--nfid-line",ea="--nfid-text",na="--nfid-text-muted",ta="--nfid-text-subtle",oa="--nfid-action",ra="--nfid-action-text",aa="--nfid-accent",ia="--nfid-overlay",sa="--nfid-focus-ring",ca="--nfid-radius",da="neofaceid-focus-frame-tokens";function la(e={}){const n=Gr(e);if("undefined"==typeof document)return n;const t=function(e){const n=e.tokens;return`.neofaceid-root {\n ${Hr}: ${n.ground};\n ${Xr}: ${n.surface};\n ${Yr}: ${n.surfaceMuted};\n ${Qr}: ${n.line};\n ${ea}: ${n.text};\n ${na}: ${n.textMuted};\n ${ta}: ${n.textSubtle};\n ${oa}: ${n.action};\n ${ra}: ${n.actionText};\n ${aa}: ${n.accent};\n ${ia}: ${n.overlay};\n ${sa}: ${n.focusRing};\n ${ca}: ${e.radius}px;\n color: var(${ea});\n font-family: inherit;\n}\n.neofaceid-root :focus-visible {\n outline: 2px solid var(${sa});\n outline-offset: 2px;\n}\n@media (prefers-reduced-motion: reduce) {\n .neofaceid-root,\n .neofaceid-root * {\n animation-duration: 0.001ms !important;\n animation-iteration-count: 1 !important;\n transition-duration: 0.001ms !important;\n scroll-behavior: auto !important;\n }\n}`}(n),o=document.getElementById(da);if(o)return o.textContent!==t&&(o.textContent=t),n;const r=document.createElement("style");return r.id=da,r.textContent=t,document.head.appendChild(r),n}function ua(e,n){if("undefined"==typeof document)return;const t=document.getElementById(e);if(t)return void(t.textContent!==n&&(t.textContent=n));const o=document.createElement("style");o.id=e,o.textContent=n,document.head.appendChild(o)}const pa={},fa={purpose:"authentication",legalBasis:"fraud_prevention",privacyPolicyUrl:"",retentionDays:0},ha={development:"http://localhost:8000",sandbox:"https://sandbox-core.neofaceid.com",production:"https://core.neofaceid.com.br"},ma=[8,16,24];let ga={baseUrl:ha.sandbox,applicationToken:null,environment:"sandbox",initialized:!1,appName:null,accent:null,radius:16,theme:"light",locale:"pt-BR",resolvedTheme:null,consent:{...fa}},va=!1;function ba(){return ga.initialized,ga.baseUrl}function wa(){return ga.appName}function ya(){return ga.locale}async function xa(e,n){const t=URL.createObjectURL(e);try{return await n(t)}finally{URL.revokeObjectURL(t)}}const ka=()=>ba(),Ea=()=>{const e="localhost"===window.location.hostname||"127.0.0.1"===window.location.hostname||""===window.location.hostname;if(!window.isSecureContext&&!e)throw new h("Secure context (HTTPS) is required for this operation",f.NETWORK)},_a=()=>{const e=new AbortController,n=setTimeout((()=>e.abort()),1e4);return e.signal.addEventListener("abort",(()=>clearTimeout(n))),e},Ra=async e=>xa(e,(e=>new Promise(((n,t)=>{const o=new Image;o.onload=()=>{const e=document.createElement("canvas");e.width=o.width,e.height=o.height;const r=e.getContext("2d");r?(r.drawImage(o,0,0),e.toBlob((e=>{e?n(e):t(new Error("Failed to compress image"))}),"image/jpeg",.7)):t(new Error("Failed to get canvas context"))},o.onerror=()=>{t(new Error("Failed to load image"))},o.src=e})))),Na=async e=>xa(e,(e=>new Promise(((n,t)=>{const o=new Image;o.onload=()=>{const e=1280;let{width:r}=o,{height:a}=o;r>a&&r>e?(a=a*e/r,r=e):a>e&&(r=r*e/a,a=e);const i=document.createElement("canvas");i.width=r,i.height=a;const s=i.getContext("2d");s?(s.drawImage(o,0,0,r,a),i.toBlob((e=>{e?n(e):t(new Error("Failed to compress document image"))}),"image/jpeg",.75)):t(new Error("Failed to get canvas context"))},o.onerror=()=>{t(new Error("Failed to load document image"))},o.src=e})))),Ta=async e=>{Ea();const n=_a();try{const t=await fetch(`${ka()}/api/v1/auth/application/validate_token/`,{method:"POST",headers:{"Content-Type":"application/json","X-App-Token":e},body:JSON.stringify({}),signal:n.signal});if(!t.ok)throw new h(`API Error ${t.status}`,f.INVALID_TOKEN);return t.ok}catch(t){if(t instanceof Error){if("AbortError"===t.name)throw new h("Request timeout",f.NETWORK_ERROR);throw new h(t.message,f.NETWORK_ERROR)}throw new h("Unknown error",f.NETWORK_ERROR)}},Oa=async(e,n)=>{Ea();const t=_a();try{const o=await fetch(`${ka()}/api/v1/onboardings/${encodeURIComponent(n)}/`,{method:"GET",headers:{"X-App-Token":e},signal:t.signal});if(!o.ok){if(401===o.status||403===o.status)throw new h("Token de aplicação inválido ou expirado",f.INVALID_TOKEN);if(404===o.status)throw new h("Link de onboarding não encontrado",f.NOT_FOUND);throw new h(`Falha ao obter detalhes (${o.status})`,f.NETWORK)}return await o.json()}catch(o){if(o instanceof Error){if("AbortError"===o.name)throw new h("Tempo de requisição excedido",f.NETWORK);if(o instanceof h)throw o;throw new h(o.message,f.NETWORK)}throw new h("Erro desconhecido",f.NETWORK_ERROR)}},Sa=async(e,n)=>{Ea();const t=_a();try{const o=await fetch(`${ka()}/api/v1/onboardings/${encodeURIComponent(n)}/`,{method:"GET",headers:{"X-App-Token":e},signal:t.signal});if(!o.ok){if(401===o.status||403===o.status)throw new h("Token de aplicação inválido ou expirado",f.INVALID_TOKEN);if(404===o.status)return!1;throw new h(`Falha ao validar token (${o.status})`,f.NETWORK)}const r=await o.json();return!0===(null==r?void 0:r.is_valid)}catch(o){if(o instanceof Error){if("AbortError"===o.name)throw new h("Tempo de requisição excedido",f.NETWORK);if(o instanceof h)throw o;throw new h(o.message,f.NETWORK)}throw new h("Erro desconhecido",f.NETWORK_ERROR)}},Ia=async(e,n,t,o)=>{Ea();const r=_a(),a=await Ra(t),i=await Ra(o);try{const t=await new Promise(((e,n)=>{const t=new FileReader;t.onload=()=>e(t.result),t.onerror=n,t.readAsDataURL(a)})),o=await new Promise(((e,n)=>{const t=new FileReader;t.onload=()=>e(t.result),t.onerror=n,t.readAsDataURL(i)})),s=await fetch(`${ka()}/api/v1/onboardings/${encodeURIComponent(n)}/complete/`,{method:"POST",headers:{"Content-Type":"application/json","X-App-Token":e},body:JSON.stringify({face_image:t,document_image:o}),signal:r.signal}),c=await s.json();if(!s.ok){if(401===s.status||403===s.status)throw new h("Token de aplicação inválido ou expirado",f.INVALID_TOKEN);if(404===s.status)throw new h("Link de onboarding não encontrado",f.NOT_FOUND);throw new h((null==c?void 0:c.error)||(null==c?void 0:c.message)||"Falha ao concluir onboarding",f.NETWORK)}return{success:!!c.success,message:c.message||"Onboarding concluído",person_id:c.person_id,identity_data_id:c.identity_data_id,confidence_score:c.confidence_score,processing_time:c.processing_time}}catch(s){if(s instanceof Error){if("AbortError"===s.name)throw new h("Tempo de requisição excedido",f.NETWORK);if(s instanceof h)throw s;throw new h(s.message,f.NETWORK)}throw new h("Erro desconhecido",f.NETWORK_ERROR)}},Ca=async(e,n,t,o,r)=>{if(Ea(),!o||0===o.length)throw new h("Pelo menos uma imagem da pessoa é obrigatória",f.VALIDATION_ERROR);const a=_a();try{const i=await Promise.all(o.map((async e=>{const n=await Ra(e);return new Promise(((e,t)=>{const o=new FileReader;o.onload=()=>e(o.result),o.onerror=t,o.readAsDataURL(n)}))}))),s=await Ra(r),c={person_images:i,document_image:await new Promise(((e,n)=>{const t=new FileReader;t.onload=()=>e(t.result),t.onerror=n,t.readAsDataURL(s)})),name:t.name,birth_date:t.birth_date,cpf:t.cpf,cnpj:t.cnpj,email:t.email},d=await fetch(`${ka()}/api/v1/onboardings/${encodeURIComponent(n)}/complete/`,{method:"POST",headers:{"Content-Type":"application/json","X-App-Token":e},body:JSON.stringify(c),signal:a.signal}),l=await d.json();if(!d.ok){if(401===d.status||403===d.status)throw new h("Token de aplicação inválido ou expirado",f.INVALID_TOKEN);if(404===d.status)throw new h("Link de onboarding não encontrado",f.NOT_FOUND);throw new h((null==l?void 0:l.error)||(null==l?void 0:l.message)||"Falha ao concluir onboarding",f.NETWORK)}return{success:!!l.success,message:l.message||"Onboarding concluído com sucesso",person_id:l.person_id,identity_data_id:l.identity_data_id,confidence_score:l.confidence_score,processing_time:l.processing_time,liveness_passed:l.liveness_passed,document_verified:l.document_verified,person_created:l.person_created}}catch(i){if(i instanceof Error){if("AbortError"===i.name)throw new h("Tempo de requisição excedido",f.NETWORK);if(i instanceof h)throw i;throw new h(i.message,f.NETWORK)}throw new h("Erro desconhecido",f.NETWORK_ERROR)}},za=async(e,n)=>{Ea();const t=_a(),o=await Ra(e);try{const e=await new Promise(((e,n)=>{const t=new FileReader;t.onload=()=>{const n=t.result;e(n.split(",")[1])},t.onerror=n,t.readAsDataURL(o)})),r=await fetch(`${ka()}/api/v1/auth/recognition/face/`,{method:"POST",headers:{"Content-Type":"application/json","X-App-Token":n},body:JSON.stringify({face_frames:e}),signal:t.signal});if(!r.ok){if(401===r.status||403===r.status)throw new h("Invalid or expired application token",f.INVALID_TOKEN);throw new h(`Server returned status ${r.status}`,f.NETWORK)}const a=await r.json();if(!a.success)throw new h(a.message||"Recognition failed",f.RECOGNITION_FAILED);return{accessToken:a.accessToken,payload:a.payload}}catch(r){if(r instanceof Error){if("AbortError"===r.name)throw new h("Request timed out",f.NETWORK);if(r instanceof h)throw r;throw new h(r.message,f.NETWORK)}throw new h("Unknown error occurred",f.NETWORK_ERROR)}},ja=async(e,n)=>{var t,o,r,a,i;Ea();const s=_a(),c=await Ra(e);try{const e=await c.arrayBuffer(),d=btoa(new Uint8Array(e).reduce(((e,n)=>e+String.fromCharCode(n)),"")),l=await fetch(`${ka()}/api/v1/login/donor/face/`,{method:"POST",headers:{"Content-Type":"application/json","X-App-Token":n},body:JSON.stringify({image:d,biometric_type:"FACE"}),signal:s.signal});if(!l.ok){if(401===l.status||403===l.status)throw new h("Invalid application token",f.INVALID_TOKEN);if(l.status>=500)throw new h(`Server Error ${l.status}`,f.API_ERROR);throw new h(`API Error ${l.status}`,f.API_ERROR)}const u=await l.json();if(!u.success)throw new h(u.message||"Login failed",f.LOGIN_FAILED);return{success:!0,accessToken:u.accessToken||u.access_token||"",alias:u.alias,user:{id:(null==(t=u.user)?void 0:t.id)||"",email:(null==(o=u.user)?void 0:o.email)||"",role:(null==(r=u.user)?void 0:r.role)||"",validated:(null==(a=u.user)?void 0:a.validated)||!1,active:(null==(i=u.user)?void 0:i.active)||!1},person:u.person?{id:u.person.id||"",name:u.person.name||"",birth_date:u.person.birth_date||""}:void 0,confidence_score:u.confidence_score,recognition_id:u.recognition_id}}catch(d){if(d instanceof Error){if("AbortError"===d.name)throw new h("Request timed out",f.NETWORK);if(d instanceof h)throw d;throw new h(d.message,f.NETWORK)}throw new h("Unknown error occurred",f.NETWORK_ERROR)}},Aa=async(e,n,t=!0,o=.8)=>{Ea();const r=_a(),a=await Ra(e);try{const e=await new Promise(((e,n)=>{const t=new FileReader;t.onload=()=>{const n=t.result;e(n.split(",")[1])},t.onerror=n,t.readAsDataURL(a)})),i=await fetch(`${ka()}/api/v1/auth/recognition/face/`,{method:"POST",headers:{"Content-Type":"application/json","X-App-Token":n},body:JSON.stringify({face_frames:e,liveness_check:t,confidence_threshold:o}),signal:r.signal});if(!i.ok){if(401===i.status||403===i.status)throw new h("Invalid or expired application token",f.INVALID_TOKEN);throw new h(`Server returned status ${i.status}`,f.NETWORK)}const s=await i.json();return{success:s.success,confidenceScore:s.confidence_score,accessToken:s.access_token,payload:s.payload}}catch(i){if(i instanceof Error){if("AbortError"===i.name)throw new h("Request timed out",f.NETWORK);if(i instanceof h)throw i;throw new h(i.message,f.NETWORK)}throw new h("Unknown error occurred",f.NETWORK_ERROR)}},Fa=async(e,n,t,o="LOGIN")=>{Ea();const r=_a();try{const a=await fetch(`${ka()}/api/v1/auth/recognition/face/`,{method:"POST",headers:{"Content-Type":"application/json","X-App-Token":t},body:JSON.stringify({document_type:e,document_number:n,purpose:o}),signal:r.signal});if(!a.ok){if(401===a.status||403===a.status)throw new h("Invalid or expired application token",f.INVALID_TOKEN);throw new h(`Server returned status ${a.status}`,f.NETWORK)}const i=await a.json();if(!i.success)throw new h(i.message||"Identification failed",f.RECOGNITION_FAILED);return{success:i.success,personId:i.person_id,accessToken:i.access_token,payload:i.payload}}catch(a){if(a instanceof Error){if("AbortError"===a.name)throw new h("Request timed out",f.NETWORK);if(a instanceof h)throw a;throw new h(a.message,f.NETWORK)}throw new h("Unknown error occurred",f.NETWORK_ERROR)}},$a=async(e,n,t,o=.8,r,a)=>{var i;Ea();const s=_a(),c=await Ra(e),d=await new Promise(((e,n)=>{const t=new FileReader;t.onload=()=>{const n=t.result;e(n.split(",")[1])},t.onerror=n,t.readAsDataURL(c)}));try{const e={biometric_data:d,type_of_identification:"FACE",purpose:t,confidence_threshold:o};r&&(e.signature=r);const c=await fetch(`${ka()}/api/v1/auth/recognition/face/`,{method:"POST",headers:{"Content-Type":"application/json","X-App-Token":n},body:JSON.stringify(e),signal:s.signal});if(!c.ok){if(401===c.status||403===c.status)throw new h("Invalid or expired application token",f.INVALID_TOKEN);throw new h(`Server returned status ${c.status}`,f.NETWORK)}const l=await c.json();return{success:l.success,personName:l.person_name||(null==(i=l.person)?void 0:i.name),email:l.email||(null==a?void 0:a.email),cpf:l.cpf||(null==a?void 0:a.cpf),confidenceScore:l.confidence_score,accessToken:l.access_token,payload:l.payload,signature:r,sessionId:null==a?void 0:a.sessionId}}catch(l){if(l instanceof Error){if("AbortError"===l.name)throw new h("Request timed out",f.NETWORK);if(l instanceof h)throw l;throw new h(l.message,f.NETWORK)}throw new h("Unknown error occurred",f.NETWORK_ERROR)}},Pa=async(e,n,t)=>{Ea();const o=_a();try{let r,a;if(null==t?void 0:t.documentFront){const e=await Na(t.documentFront);r=await new Promise(((n,t)=>{const o=new FileReader;o.onload=()=>n(o.result),o.onerror=t,o.readAsDataURL(e)}))}if(null==t?void 0:t.documentBack){const e=await Na(t.documentBack);a=await new Promise(((n,t)=>{const o=new FileReader;o.onload=()=>n(o.result),o.onerror=t,o.readAsDataURL(e)}))}const i={name:e.name,birth_date:e.birth_date,cpf:e.cpf,email:e.email,password:e.password,password_confirm:e.password,is_pep:e.is_pep??!1};r&&(i.document_images=[{front:r,back:a||void 0,type:(null==t?void 0:t.documentType)||"RG"}]);const s=await fetch(`${ka()}/api/v1/signup/donor/`,{method:"POST",headers:{"Content-Type":"application/json","X-App-Token":n},body:JSON.stringify(i),signal:o.signal});if(!s.ok){if(401===s.status||403===s.status)throw new h("Invalid or expired application token",f.INVALID_TOKEN);throw new h(`Server returned status ${s.status}`,f.NETWORK)}return await s.json()}catch(r){if(r instanceof Error){if("AbortError"===r.name)throw new h("Request timed out",f.NETWORK);if(r instanceof h)throw r;throw new h(r.message,f.NETWORK)}throw new h("Unknown error occurred",f.NETWORK)}},Da=async e=>{const n=_a(),t=new URLSearchParams;e.email&&t.append("email",e.email),e.cpf&&t.append("cpf",e.cpf);try{const e=await fetch(`${ka()}/api/v1/verify/user/?${t.toString()}`,{method:"GET",headers:{"Content-Type":"application/json"},signal:n.signal});if(!e.ok){const n=await e.json().catch((()=>({})));throw new h(n.message||`Server returned status ${e.status}`,f.NETWORK)}return await e.json()}catch(o){if(o instanceof Error){if("AbortError"===o.name)throw new h("Request timed out",f.NETWORK);if(o instanceof h)throw o;throw new h(o.message,f.NETWORK)}throw new h("Unknown error occurred",f.NETWORK)}},La=async(e,n,t,o)=>{var r,a,i,s,c,d,l,u;if(Ea(),!n||0===n.length)throw new h("At least one face photo is required for biometric registration",f.VALIDATION_ERROR);if(n.length>5)throw new h("Maximum of 5 face photos allowed",f.VALIDATION_ERROR);const p=_a();try{const g=await Promise.all(n.map((async e=>{const n=await Ra(e);return new Promise(((e,t)=>{const o=new FileReader;o.onload=()=>{const n=o.result;e(n)},o.onerror=t,o.readAsDataURL(n)}))})));let v,b;if(null==o?void 0:o.documentFront){const e=await Na(o.documentFront);v=await new Promise(((n,t)=>{const o=new FileReader;o.onload=()=>n(o.result),o.onerror=t,o.readAsDataURL(e)}))}if(null==o?void 0:o.documentBack){const e=await Na(o.documentBack);b=await new Promise(((n,t)=>{const o=new FileReader;o.onload=()=>n(o.result),o.onerror=t,o.readAsDataURL(e)}))}const w={name:e.name,birth_date:e.birth_date,cpf:e.cpf,email:e.email,password:e.password,password_confirm:e.password,face_photos:g,is_pep:e.is_pep??!1};v&&(w.document_images=[{front:v,back:b||void 0,type:(null==o?void 0:o.documentType)||"RG"}]);const y=await fetch(`${ka()}/api/v1/signup/donor/`,{method:"POST",headers:{"Content-Type":"application/json","X-App-Token":t},body:JSON.stringify(w),signal:p.signal});if(!y.ok){if(401===y.status||403===y.status)throw new h("Invalid or expired application token",f.INVALID_TOKEN);try{const e=await y.json();if(e.errors){const n=Object.entries(e.errors).map((([e,n])=>`${"password"===e?"senha":"password_confirm"===e?"confirmação de senha":e}: ${Array.isArray(n)?n.join(", "):String(n)}`)).join("; ");throw new h(`Erro de validação: ${n}`,f.VALIDATION_ERROR)}if("fraud_detected"===e.error)throw new h("Fraud detected in biometric images. Registration blocked.",f.VALIDATION_ERROR);if("user_exists"===e.error||"ALREADY_EXISTS"===e.error_code)throw new h("User with this email already exists",f.VALIDATION_ERROR);if("person_exists"===e.error)throw new h("Person with this CPF already exists",f.VALIDATION_ERROR);const n=e.message||e.error||`Server returned status ${y.status}`;throw new h(n,f.VALIDATION_ERROR)}catch(m){if(m instanceof h)throw m;throw new h(`Server returned status ${y.status}`,f.NETWORK)}}const x=await y.json();return 202===y.status&&(null==(r=x.data)?void 0:r.task_id)?{success:x.success,message:x.message||"Registration is being processed. You will receive an email when completed.",task_id:x.data.task_id,status:x.data.status||"processing",person_id:void 0,user_id:void 0,person_validated:void 0,face_processing:void 0,onboarding_link:void 0}:{success:x.success,message:x.message,person_id:(null==(a=x.data)?void 0:a.person_id)||x.person_id,user_id:(null==(i=x.data)?void 0:i.user_id)||x.user_id,person_validated:(null==(s=x.data)?void 0:s.person_validated)||x.person_validated,face_processing:(null==(c=x.data)?void 0:c.face_processing)||x.face_processing,onboarding_link:(null==(d=x.data)?void 0:d.onboarding_link)||x.onboarding_link,task_id:null==(l=x.data)?void 0:l.task_id,status:null==(u=x.data)?void 0:u.status}}catch(g){if(g instanceof Error){if("AbortError"===g.name)throw new h("Request timed out",f.NETWORK);if(g instanceof h)throw g;throw new h(g.message,f.NETWORK)}throw new h("Unknown error occurred",f.NETWORK_ERROR)}},Ma=async(e,n,t)=>{const o=_a();try{const r=await fetch(`${ka()}/api/v1/auth/login/`,{method:"POST",headers:{"Content-Type":"application/json","X-App-Token":t},body:JSON.stringify({email:e,password:n}),signal:o.signal});if(!r.ok){if(401===r.status||403===r.status)throw new h("Email ou senha inválidos",f.INVALID_TOKEN);throw new h(`API Error ${r.status}`,f.API_ERROR)}const a=await r.json();return{success:!0,accessToken:a.access_token||a.access,alias:a.user&&a.user.alias||a.alias,user:{id:a.user&&a.user.id||"",email:a.user&&a.user.email||"",role:a.user&&a.user.role||"",validated:a.user&&a.user.validated||!1,active:a.user&&a.user.active||!1}}}catch(r){if(r instanceof Error){if("AbortError"===r.name)throw new h("Request timed out",f.NETWORK);if(r instanceof h)throw r;throw new h(r.message,f.NETWORK)}throw new h("Unknown error occurred",f.NETWORK_ERROR)}},qa=async(e,n)=>{var t,o,r,a;Ea();const i=_a(),s=await Na(e),c=await new Promise(((e,n)=>{const t=new FileReader;t.onload=()=>{const n=t.result;e(n.split(",")[1])},t.onerror=n,t.readAsDataURL(s)}));try{const e=await fetch(`${ka()}/api/v1/auth/recognition/face/`,{method:"POST",headers:{"Content-Type":"application/json","X-App-Token":n},body:JSON.stringify({image:c,purpose:"SIMPLE_IDENTIFICATION_F"}),signal:i.signal});if(!e.ok){if(401===e.status||403===e.status)throw new h("Invalid or expired application token",f.INVALID_TOKEN);throw new h(`Server returned status ${e.status}`,f.NETWORK)}const s=await e.json();if(202===e.status||s.data&&s.data.task_id)return{success:!0,taskId:(null==(t=s.data)?void 0:t.task_id)||s.task_id,status:(null==(o=s.data)?void 0:o.status)||"processing",message:s.message||"Identification scheduled"};if(!s.success)throw new h(s.message||"Person identification failed",f.RECOGNITION_FAILED);return{success:!0,person:{name:(null==(r=s.person)?void 0:r.name)||"",birth_date:(null==(a=s.person)?void 0:a.birth_date)||""}}}catch(d){if(d instanceof Error){if("AbortError"===d.name)throw new h("Request timed out",f.NETWORK);if(d instanceof h)throw d;throw new h(d.message,f.NETWORK)}throw new h("Unknown error occurred",f.NETWORK_ERROR)}},Ua=async(e,n,t)=>{if(Ea(),!e)throw new h("Person ID is required",f.VALIDATION_ERROR);if(!n)throw new h("Face image is required",f.VALIDATION_ERROR);const o=_a(),r=await Ra(n),a=await new Promise(((e,n)=>{const t=new FileReader;t.onload=()=>{const n=t.result;e(n.split(",")[1])},t.onerror=n,t.readAsDataURL(r)}));try{const n=await fetch(`${ka()}/api/v1/identity-data/`,{method:"POST",headers:{"Content-Type":"application/json","X-App-Token":t},body:JSON.stringify({person:e,type_of_identification:"FACE",biometric_data:a}),signal:o.signal});if(!n.ok){if(401===n.status||403===n.status)throw new h("Invalid or expired application token, or insufficient permissions",f.INVALID_TOKEN);if(400===n.status)try{const e=await n.json(),t=e.message||e.error||"Invalid biometric data";throw new h(t,f.VALIDATION_ERROR)}catch(i){if(i instanceof h)throw i;throw new h("Invalid biometric data",f.VALIDATION_ERROR)}throw new h(`Server returned status ${n.status}`,f.NETWORK)}const r=await n.json();return{success:!0,message:"Biometric data registered successfully",identity_data_id:r.id,type_of_identification:r.type_of_identification,have_biometric_data:r.have_biometric_data,created_at:r.created_at}}catch(s){if(s instanceof Error){if("AbortError"===s.name)throw new h("Request timed out",f.NETWORK);if(s instanceof h)throw s;throw new h(s.message,f.NETWORK)}throw new h("Unknown error occurred",f.NETWORK_ERROR)}},Ba=async(e,n,t)=>{Ea();const o=_a();try{const a=await fetch(`${ka()}/api/v1/applications/`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${e}`},body:JSON.stringify({consumer:n,application_name:t.applicationName,domain:t.domain,accept_only_email_with_same_domain:t.acceptOnlyEmailWithSameDomain}),signal:o.signal});if(!a.ok){if(401===a.status)throw new h("Invalid or expired JWT token",f.INVALID_TOKEN);if(403===a.status)throw new h("Insufficient permissions to create application",f.INVALID_TOKEN);if(400===a.status)try{const e=await a.json(),n=e.message||e.error||"Invalid application data";throw new h(n,f.VALIDATION_ERROR)}catch(r){if(r instanceof h)throw r;throw new h("Invalid application data",f.VALIDATION_ERROR)}throw new h(`Server returned status ${a.status}`,f.NETWORK)}const i=await a.json();return{success:!0,application:{id:i.id,application_name:i.application_name,domain:i.domain,accept_only_email_with_same_domain:i.accept_only_email_with_same_domain,app_token:i.app_token,is_active:i.is_active,created_at:i.created_at},message:"Application registered successfully"}}catch(a){if(a instanceof Error){if("AbortError"===a.name)throw new h("Request timed out",f.NETWORK);if(a instanceof h)throw a;throw new h(a.message,f.NETWORK)}throw new h("Unknown error occurred",f.NETWORK_ERROR)}},Wa=async(e={})=>{Ea();const{durationMs:n=3e3,onProgress:t}=e;return new Promise((async(e,o)=>{let r=null;const a=[];try{r=await navigator.mediaDevices.getUserMedia({video:{facingMode:"user",width:{ideal:640},height:{ideal:480}},audio:!1});const i=(()=>{const e=["video/mp4;codecs=avc1","video/mp4","video/webm;codecs=vp9","video/webm;codecs=vp8","video/webm"];for(const n of e)if(MediaRecorder.isTypeSupported(n))return n;return""})();let s;try{s=i?new MediaRecorder(r,{mimeType:i,videoBitsPerSecond:1e6}):new MediaRecorder(r,{videoBitsPerSecond:1e6})}catch{s=new MediaRecorder(r)}const c=s.mimeType||i;if(s.ondataavailable=e=>{e.data.size>0&&a.push(e.data)},s.onstop=()=>{r&&r.getTracks().forEach((e=>e.stop()));const n=new Blob(a,{type:c});e(n)},s.onerror=e=>{r&&r.getTracks().forEach((e=>e.stop())),o(new h(`Recording error: ${e}`,f.CAPTURE_ERROR))},s.start(100),t){const e=100;let o=0;const r=setInterval((()=>{o+=e;const a=Math.min(100,o/n*100);t(a),o>=n&&clearInterval(r)}),e)}setTimeout((()=>{s&&"recording"===s.state&&s.stop()}),n)}catch(i){r&&r.getTracks().forEach((e=>e.stop())),i instanceof Error?"NotAllowedError"===i.name?o(new h("Camera permission denied",f.CAMERA_ERROR)):"NotFoundError"===i.name?o(new h("No camera found",f.NO_CAMERA)):o(new h(i.message,f.CAPTURE_ERROR)):o(new h("Failed to record video",f.CAPTURE_ERROR))}}))},Va=async(e,n,t={})=>{var o,r,a,i,s,c;const{maxAttempts:d=60,intervalMs:l=1e3,onStatusChange:u}=t;let p=0;for(;p<d;){p++;try{const t=await fetch(`${ka()}/api/v1/tasks/status/?task_id=${e}`,{method:"GET",headers:{Accept:"application/json","X-App-Token":n}});if(!t.ok)throw new h(`Task status check failed: ${t.status}`,f.NETWORK);const d=await t.json(),p=(null==(o=d.data)?void 0:o.status)||"unknown";if(u){u(p,null==(a=null==(r=d.data)?void 0:r.progress)?void 0:a.percentage)}if("success"===p)return d.data.result;if("failure"===p){const e=(null==(s=null==(i=d.data)?void 0:i.result)?void 0:s.message)||(null==(c=d.data)?void 0:c.error)||"Task failed";throw new h(e,f.RECOGNITION_FAILED)}if("revoked"===p)throw new h("Task was cancelled",f.RECOGNITION_FAILED);await new Promise((e=>setTimeout(e,l)))}catch(m){if(m instanceof h)throw m;throw new h(`Polling error: ${m instanceof Error?m.message:"Unknown error"}`,f.NETWORK)}}throw new h("Task status polling timed out",f.NETWORK)},Za=async(e,n)=>{var t;Ea();const o=_a();try{const r=await fetch(`${ka()}/api/v1/auth/recognition/face/`,{method:"POST",headers:{"Content-Type":"application/json","X-App-Token":n},body:JSON.stringify({video:e,purpose:"PROOF_OF_LIFE"}),signal:o.signal});if(!r.ok){if(401===r.status||403===r.status)throw new h("Invalid or expired application token",f.INVALID_TOKEN);if(400===r.status){const e=await r.json();throw new h(e.message||"Invalid request data",f.VALIDATION_ERROR)}throw new h(`Server returned status ${r.status}`,f.NETWORK)}const a=await r.json();if(!a.success||!(null==(t=a.data)?void 0:t.task_id))throw new h(a.message||"Failed to start proof of life",f.RECOGNITION_FAILED);return{taskId:a.data.task_id,historyId:a.data.history_id,status:a.data.status,message:a.message||"Recognition started successfully"}}catch(r){if(r instanceof Error){if("AbortError"===r.name)throw new h("Request timed out",f.NETWORK);if(r instanceof h)throw r;throw new h(r.message,f.NETWORK)}throw new h("Unknown error occurred",f.NETWORK_ERROR)}},Ka=async e=>new Promise(((n,t)=>{const o=new FileReader;o.onload=()=>{const e=o.result,t=e.includes(",")?e.split(",")[1]:e;n(t)},o.onerror=()=>t(new h("Failed to convert video to base64",f.CAPTURE_ERROR)),o.readAsDataURL(e)})),Ja=async(e,n,t)=>{var o,r;if(Ea(),!e)throw new h("personId is required",f.VALIDATION_ERROR);if(!n)throw new h("jwtToken is required",f.VALIDATION_ERROR);if(!t||0===t.length)throw new h("At least one document image is required",f.VALIDATION_ERROR);const a=await Promise.all(t.map((async e=>{const n=await Na(e);return t=n,new Promise(((e,n)=>{const o=new FileReader;o.onload=()=>{const n=o.result;e(n.includes(",")?n.split(",")[1]:n)},o.onerror=()=>n(new h("Failed to convert image to base64",f.CAPTURE_ERROR)),o.readAsDataURL(t)}));var t}))),i=_a();try{const t=await fetch(`${ka()}/api/v1/donors/${e}/documents/`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${n}`},body:JSON.stringify({document_images:a}),signal:i.signal}),s=await t.json();if(!t.ok)throw new h((null==s?void 0:s.message)||`API Error ${t.status}`,f.NETWORK_ERROR);return{success:!0,taskId:(null==(o=s.data)?void 0:o.task_id)??"",status:(null==(r=s.data)?void 0:r.status)??"processing",message:s.message??"Documents submitted for processing"}}catch(s){if(s instanceof h)throw s;if(s instanceof Error){if("AbortError"===s.name)throw new h("Request timeout",f.NETWORK_ERROR);throw new h(s.message,f.NETWORK_ERROR)}throw new h("Unknown error occurred",f.NETWORK_ERROR)}},Ga=async(e,n)=>{const t=_a();try{const o=await fetch(`${ka()}/api/v1/tasks/status/?task_id=${e}`,{method:"GET",headers:{"Content-Type":"application/json",...n?{"X-App-Token":n}:{}},signal:t.signal}),r=await o.json();if(!o.ok)throw new h((null==r?void 0:r.message)||`API Error ${o.status}`,f.NETWORK_ERROR);return{success:r.success,status:r.data.status,result:r.data.result,error:r.data.error}}catch(o){if(o instanceof h)throw o;throw new h("Failed to fetch task status",f.NETWORK_ERROR)}},Ha=async(e,n,t={})=>{var o,r;const{maxRetries:a=30,interval:i=2e3}=t,s=await qa(e,n);if(s.person)return{personFound:!0,person:s.person};const{taskId:c}=s;if(!c)return{personFound:!1};for(let d=0;d<a;d++){const e=await Ga(c);if("success"===e.status)return e.result&&e.result.success?{personFound:!0,person:{name:(null==(o=e.result.person)?void 0:o.name)||"Pessoa identificada",birth_date:(null==(r=e.result.person)?void 0:r.birth_date)||""}}:{personFound:!1};if("failure"===e.status)return{personFound:!1};await new Promise((e=>setTimeout(e,i)))}throw new h("Timed out waiting for identification",f.NETWORK_ERROR)};async function Xa(e,n){const t=ba(),o=await fetch(`${t}/api/v1/user/password/reset/request/`,{method:"POST",headers:{"Content-Type":"application/json","X-App-Token":n},body:JSON.stringify({email:e})});if(!o.ok){const e=await o.json();throw new h(e.message||"Erro ao solicitar recuperação de senha",f.API_ERROR)}return o.json()}async function Ya(e,n){const t=ba(),o=await fetch(`${t}/api/v1/user/password/reset/confirm/`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({token:e,new_password:n})});if(!o.ok){const e=await o.json();throw new h(e.error||e.message||"Erro ao redefinir senha",f.API_ERROR)}return o.json()}const Qa=Object.freeze(Object.defineProperty({__proto__:null,checkUserExistence:Da,completeOnboarding:Ia,completeOnboardingWithData:Ca,confirmPasswordReset:Ya,getOnboardingDetails:Oa,getTaskStatus:Ga,identifyPerson:qa,identifyPersonAsync:Ha,loginWithBiometric:ja,loginWithEmail:Ma,pollTaskStatus:Va,recognize:za,recognizeBiometric:Aa,recognizeByPurpose:$a,recordFaceVideo:Wa,registerApplication:Ba,registerBiometric:Ua,registerDocumentByImage:Ja,registerPersonWithBiometric:La,registerPersonWithoutFace:Pa,requestPasswordReset:Xa,simpleIdentification:Fa,startProofOfLife:Za,validateOnboardingToken:Sa,validateToken:Ta,videoToBase64:Ka},Symbol.toStringTag,{value:"Module"}));function ei(e,n={}){if(!e||0===e.videoWidth||0===e.videoHeight)return 0;const t=n.sample??64,o=e.videoWidth,r=e.videoHeight,a=n.roi??function(e,n,t){const o=Math.round(e*t),r=Math.round(n*t);return{x:Math.round((e-o)/2),y:Math.round((n-r)/2),width:o,height:r}}(o,r,.4),i=n.scratch??document.createElement("canvas");i.width=t,i.height=t;const s=i.getContext("2d",{willReadFrequently:!0});if(!s)return 0;try{s.drawImage(e,a.x,a.y,a.width,a.height,0,0,t,t);return function(e){const n=e.length;if(0===n)return 0;let t=0,o=0;for(let r=0;r<n;r+=4){t+=.2126*e[r]+.7152*e[r+1]+.0722*e[r+2],o+=1}return 0===o?0:t/(255*o)}(s.getImageData(0,0,t,t).data)}catch{return 0}}function ni(e,t={}){const o=t.enabled??!0,r=t.darkThreshold??.235,a=t.improvementTarget??.12,i=t.sampleIntervalMs??600,s=t.minToggleMs??3e3,[c,d]=n.useState(!1),[l,u]=n.useState(0),p=n.useRef(0),f=n.useRef(0),h=n.useRef(null),m=n.useRef(!1),g=n.useRef(null);return n.useEffect((()=>{m.current=c}),[c]),n.useEffect((()=>{if(!o)return d(!1),()=>{};"undefined"==typeof document||g.current||(g.current=document.createElement("canvas"));let n=null,t=null,c=!1;const l=()=>{if(c)return;const n=ei(e.current,{scratch:g.current??void 0});u(n);const o=Date.now();m.current||(n>0&&n<r?p.current+=1:p.current=0,p.current>=2&&o-f.current>=s&&(h.current=n,f.current=o,m.current=!0,d(!0),p.current=0,t=setTimeout((()=>{if(c)return;ei(e.current,{scratch:g.current??void 0})-(h.current??0)<a&&(f.current=Date.now(),m.current=!1,d(!1)),h.current=null}),600)))};return n=setInterval(l,i),l(),()=>{c=!0,n&&clearInterval(n),t&&clearTimeout(t)}}),[o,r,a,i,s,e]),{flashOn:c,lastBrightness:l}}function ti({active:e,zIndex:n=10001,onDismiss:t}){if(!e)return null;const r={position:"fixed",inset:0,background:"#FFFFFF",zIndex:n,pointerEvents:"none",animation:"nfid-flash-in 200ms ease-out"},a={position:"fixed",top:12,left:"50%",transform:"translateX(-50%)",zIndex:n+1,background:"rgba(10,19,32,.72)",color:"#FFFFFF",fontSize:12,fontWeight:600,letterSpacing:.2,padding:"6px 12px",borderRadius:999,pointerEvents:t?"auto":"none",display:"flex",alignItems:"center",gap:8};return o.jsxs(o.Fragment,{children:[o.jsx("style",{children:"\n @keyframes nfid-flash-in { from { opacity: 0 } to { opacity: 1 } }\n @media (prefers-reduced-motion: reduce) {\n .nfid-screen-flash { animation: none !important; }\n }\n "}),o.jsx("div",{className:"nfid-screen-flash",style:r,"aria-hidden":"true"}),o.jsxs("div",{className:"nfid-screen-flash-hint",style:a,role:"status",children:["Aumentando a luz da tela",t&&o.jsx("button",{type:"button",onClick:t,"aria-label":"Desligar iluminação assistiva",style:{background:"transparent",border:"none",color:"#FFFFFF",cursor:"pointer",fontSize:14,lineHeight:1,padding:"0 4px"},children:"×"})]})]})}function oi(e,n){return Math.hypot(e.x-n.x,e.y-n.y)}function ri(e){if(6!==e.length)throw new Error(`calculateEAR espera exatamente 6 pontos do olho, recebeu ${e.length}`);const[n,t,o,r,a,i]=e,s=oi(t,i),c=oi(o,a),d=oi(n,r);return d<1e-6?0:(s+c)/(2*d)}const ai=(e,n)=>{switch(n.type){case"PERMISSION_GRANTED":case"RESET":return{status:"ready"};case"PERMISSION_DENIED":return{status:"error",message:"Permissão para acessar a câmera foi negada"};case"START_CAPTURE":return{status:"capturing"};case"UPLOAD_START":return{status:"uploading"};case"UPLOAD_SUCCESS":return{status:"success"};case"UPLOAD_ERROR":case"SET_ERROR":return{status:"error",message:n.message};default:return e}},ii={overlay:{position:"fixed",top:0,left:0,right:0,bottom:0,backgroundColor:"rgba(0, 0, 0, 0.8)",display:"flex",justifyContent:"center",alignItems:"center",zIndex:1e3},modal:{backgroundColor:"#000",borderRadius:"12px",overflow:"hidden",position:"relative",width:"60%",maxWidth:"600px",maxHeight:"80vh"},video:{width:"100%",height:"auto",display:"block"},canvas:{display:"none"},guide:{position:"absolute",top:"50%",left:"50%",transform:"translate(-50%, -50%)",width:"200px",height:"200px",border:"2px solid rgba(255, 255, 255, 0.5)",borderRadius:"50%",pointerEvents:"none"},controls:{position:"absolute",bottom:"20px",left:0,right:0,display:"flex",justifyContent:"center",gap:"10px"},button:{padding:"12px 24px",borderRadius:"24px",border:"none",backgroundColor:"#0059C4",color:"white",fontSize:"16px",fontWeight:"bold",cursor:"pointer"},message:{position:"absolute",top:"20px",left:0,right:0,textAlign:"center",color:"white",fontSize:"18px",fontWeight:"bold"},spinner:{position:"absolute",top:"50%",left:"50%",transform:"translate(-50%, -50%)",width:"40px",height:"40px",border:"4px solid rgba(255, 255, 255, 0.3)",borderRadius:"50%",borderTopColor:"white",animation:"spin 1s linear infinite"},closeButton:{position:"absolute",top:"20px",right:"20px",backgroundColor:"transparent",border:"none",color:"white",fontSize:"24px",cursor:"pointer"}};function si({accessToken:e,onClose:t,onSuccess:r,onCannotGesture:a,autoLighting:i=!0}){const s=n.useRef(null),c=n.useRef(null),l=n.useRef(null),u=n.useRef(null),m=n.useRef(!1),g=n.useRef(null),[v,b]=n.useReducer(ai,{status:"requestingPermission"}),[w,y]=n.useState(!1),{startCamera:x,stopCamera:k}=p(),E=()=>{if(!s.current)return;const e=async()=>{if(s.current&&"ready"===v.status){try{const e=await d.detectAllFaces(s.current,new d.TinyFaceDetectorOptions),n=1===e.length,t=n&&(e=>{if(!s.current)return!1;const{box:n}=e,{videoWidth:t,videoHeight:o}=s.current,r=t/2,a=o/2,i=.4*t,c=.4*o;return n.x+n.width/2>r-i/2&&n.x+n.width/2<r+i/2&&n.y+n.height/2>a-c/2&&n.y+n.height/2<a+c/2})(e[0]);y(n&&t)}catch(n){}u.current=window.setTimeout(e,100)}};e()};n.useEffect((()=>{la()}),[]),n.useEffect((()=>()=>{var e;null==(e=g.current)||e.abort()}),[]);const _=i&&("ready"===v.status||"capturing"===v.status),{flashOn:R}=ni(s,{enabled:_});n.useEffect((()=>((async()=>{try{await Promise.all([d.nets.tinyFaceDetector.loadFromUri("/models"),d.nets.faceLandmark68Net.loadFromUri("/models")])}catch(e){}})(),()=>{u.current&&window.clearTimeout(u.current)})),[]),n.useEffect((()=>((async()=>{try{const e=await x();l.current=e,s.current&&(s.current.srcObject=e),b({type:"PERMISSION_GRANTED"}),E()}catch(e){b({type:"PERMISSION_DENIED"})}})(),()=>{l.current&&k(l.current)})),[x,k]);const N=async()=>{if(!c.current||!s.current)return;if(m.current)return;m.current=!0;const n=s.current,o=c.current,a=new AbortController;g.current=a;try{b({type:"START_CAPTURE"});const s=await function(e,n,t=3e3,o=.2,r){return new Promise((a=>{const i=Date.now()+t;let s=!1,c=!1;const d=e=>{c||(c=!0,a(e))},l=()=>{c||((null==r?void 0:r.aborted)||Date.now()>=i?d(!1):e.detectSingleFace(n,new e.TinyFaceDetectorOptions).withFaceLandmarks().then((e=>{if(e)if((ri(e.landmarks.getLeftEye())+ri(e.landmarks.getRightEye()))/2<o)s=!0;else if(s)return void d(!0);setTimeout(l,50)})).catch((()=>{setTimeout(l,50)})))};l()}))}(d,n,void 0,void 0,a.signal);if(a.signal.aborted)return;if(!s){const e=new h("Blink not detected within window",f.LIVENESS_BLINK_MISSING);return void b({type:"SET_ERROR",message:e.getFriendlyMessage()})}const c=o.getContext("2d");if(!c)return void b({type:"SET_ERROR",message:"Failed to get canvas context"});o.width=n.videoWidth,o.height=n.videoHeight,c.drawImage(n,0,0,o.width,o.height);const l=await new Promise(((e,n)=>{o.toBlob((t=>{t?e(t):n(new Error("Failed to convert canvas to blob"))}),"image/jpeg",.95)}));try{const n=await za(l,e);r({success:!0,data:{faceId:n.payload.documentId,confidence:1}}),b({type:"UPLOAD_SUCCESS"}),setTimeout(t,1500)}catch(i){b({type:"SET_ERROR",message:"Face recognition failed"})}}catch(i){b({type:"SET_ERROR",message:"Failed to capture image"})}finally{m.current=!1}};return o.jsxs("div",{className:"neofaceid-root",style:ii.overlay,children:[o.jsx(ti,{active:R}),o.jsx("style",{children:"\n @keyframes spin {\n 0% { transform: translate(-50%, -50%) rotate(0deg); }\n 100% { transform: translate(-50%, -50%) rotate(360deg); }\n }\n"}),o.jsx("style",{children:"\n @media (max-width: 768px) {\n .modal {\n width: 100%;\n height: 100%;\n max-height: 100vh;\n border-radius: 0;\n }\n .button {\n padding: 16px 32px;\n font-size: 18px;\n }\n }\n"}),o.jsxs("div",{style:ii.modal,className:"modal",children:[o.jsx("button",{type:"button",style:ii.closeButton,onClick:t,children:"×"}),o.jsx("video",{ref:s,style:ii.video,autoPlay:!0,playsInline:!0,muted:!0}),o.jsx("canvas",{ref:c,style:ii.canvas}),o.jsx("div",{style:ii.guide}),"ready"===v.status&&!w&&o.jsx("div",{style:ii.message,"aria-live":"assertive",children:"Centralize seu rosto no círculo"}),"capturing"===v.status&&o.jsx("div",{style:ii.message,"aria-live":"assertive",children:"Por favor, pisque os olhos"}),("ready"===v.status||"capturing"===v.status)&&o.jsx("button",{type:"button",className:"neofaceid-face-cannot-gesture",onClick:()=>{a?a():t()},"aria-label":"Não consigo fazer esse movimento — buscar alternativa",style:{position:"absolute",bottom:100,left:"50%",transform:"translateX(-50%)",minHeight:44,minWidth:44,padding:"10px 20px",background:"transparent",border:"1px solid rgba(255, 255, 255, 0.32)",borderRadius:22,color:"rgba(255, 255, 255, 0.9)",fontSize:14,fontWeight:500,fontFamily:"inherit",cursor:"pointer",zIndex:10},children:"Não consigo fazer esse movimento"}),"uploading"===v.status&&o.jsx("div",{style:ii.spinner}),"success"===v.status&&o.jsx("div",{style:ii.message,children:"Autenticado!"}),"error"===v.status&&o.jsx("div",{style:ii.message,children:v.message}),o.jsxs("div",{style:ii.controls,children:["ready"===v.status&&w&&o.jsx("button",{type:"button",style:ii.button,onClick:N,children:"Capturar"}),"capturing"===v.status&&o.jsx("button",{type:"button",style:ii.button,onClick:N,children:"Capturar"}),"error"===v.status&&o.jsx("button",{type:"button",style:ii.button,onClick:()=>{b({type:"RESET"})},children:"Tentar Novamente"})]})]})]})}const ci='<svg xmlns="http://www.w3.org/2000/svg" aria-label="NeoFaceID" viewBox="-43.1 -71.1 1318.2 1318.2"><g fill="currentColor"><path d="M138.1 2a10 10 0 0 1-5.8 2c-1.9 0-6.1 1.3-9.2 2.8a94 94 0 0 1-11.1 4.7c-3 1-8.1 3.4-11.2 5.2a33 33 0 0 1-6.7 3.3c-.5 0-1.4.6-1.8 1.4s-2.4 2.1-4.3 3a39 39 0 0 0-11.7 7.8 18 18 0 0 1-5.6 3.8c-1.8 0-33.9 32.3-35.3 35.5a27 27 0 0 1-4.5 6.3c-2 2-4.6 5.4-5.8 7.4-1.3 2.1-2.6 3.8-3.1 3.8s-1.2 1-1.5 2.2c-1.1 3.6-9.6 20.7-10.6 21.4-.5.3-.9 1.6-.9 2.8 0 1.3-.6 3.9-1.4 5.7s-1.2 4.6-.9 6q.4 2.5-1.1 3.8-1.6 1.4-1.6 6.2c0 3.8-.4 5.2-2 6.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;const li={display:"flex",alignItems:"center",justifyContent:"center",gap:6,color:"var(--nfid-text-subtle)",fontFamily:"inherit",lineHeight:1},ui={display:"inline-flex",alignItems:"center",justifyContent:"center",color:"currentColor"},pi={fontSize:12,fontWeight:600,letterSpacing:.2,color:"var(--nfid-text-muted)"},fi={fontSize:9,fontWeight:400,color:"var(--nfid-text-subtle)",opacity:.75},hi={fontSize:9,fontWeight:500,color:"var(--nfid-text-subtle)",opacity:.75};function mi({size:e=16,style:n}){return o.jsxs("div",{className:"neofaceid-brand-footer",style:{...li,...n},children:[o.jsx("span",{"aria-hidden":"true",style:{...ui,width:e,height:e},dangerouslySetInnerHTML:{__html:di}}),o.jsx("span",{style:pi,children:"NeoFaceID"}),o.jsx("span",{style:fi,children:"by"}),o.jsx("span",{style:hi,children:"Octa"})]})}function gi(e=16){return`<div class="neofaceid-brand-footer" style="display:flex;align-items:center;justify-content:center;gap:6px;color:var(--nfid-text-subtle);font-family:inherit;line-height:1;"><span aria-hidden="true" style="${`display:inline-flex;align-items:center;justify-content:center;color:currentColor;width:${e}px;height:${e}px;`}">${di}</span><span style="font-size:12px;font-weight:600;letter-spacing:0.2px;color:var(--nfid-text-muted);">NeoFaceID</span><span style="font-size:9px;font-weight:400;color:var(--nfid-text-subtle);opacity:0.75;">by</span><span style="font-size:9px;font-weight:500;color:var(--nfid-text-subtle);opacity:0.75;">Octa</span></div>`}class vi{constructor(e){i(this,"applicationToken"),i(this,"modalElement",null),this.applicationToken=e}open(){this.modalElement||(la(),this.addStyles(),this.modalElement=document.createElement("div"),this.modalElement.className="neofaceid-root neoface-forgot-modal",this.renderEmailForm(),document.body.appendChild(this.modalElement))}close(){this.modalElement&&document.body.contains(this.modalElement)&&(document.body.removeChild(this.modalElement),this.modalElement=null)}renderEmailForm(){if(!this.modalElement)return;this.modalElement.innerHTML=`\n <div class="neoface-forgot-overlay">\n <div class="neoface-forgot-content">\n <div class="neoface-forgot-icon">\n <svg viewBox="0 0 64 64" fill="none" xmlns="http://www.w3.org/2000/svg">\n <circle cx="32" cy="32" r="28" stroke="#0059C4" stroke-width="3" fill="none"/>\n <rect x="22" y="28" width="20" height="16" rx="3" stroke="#0059C4" stroke-width="2.5" fill="none"/>\n <path d="M26 28v-4a6 6 0 0 1 12 0v4" stroke="#0059C4" stroke-width="2.5" stroke-linecap="round"/>\n <circle cx="32" cy="36" r="2" fill="#0059C4"/>\n </svg>\n </div>\n\n <h2 class="neoface-forgot-title">Recuperar senha</h2>\n <p class="neoface-forgot-subtitle">Informe seu email e enviaremos um link para redefinir sua senha.</p>\n\n <div id="neoface-forgot-error" class="neoface-forgot-error" style="display:none"></div>\n\n <form id="neoface-forgot-form">\n <input\n type="email"\n id="neoface-forgot-email"\n class="neoface-forgot-input"\n placeholder="seu@email.com"\n autocomplete="email"\n required\n />\n <button type="submit" class="neoface-forgot-btn-primary">\n Enviar link\n </button>\n </form>\n\n <button class="neoface-forgot-btn-ghost neoface-forgot-back">\n Voltar\n </button>\n\n <div class="neoface-forgot-branding">\n ${gi()}\n </div>\n </div>\n </div>\n `;this.modalElement.querySelector("#neoface-forgot-form").addEventListener("submit",this.handleSubmit.bind(this));this.modalElement.querySelector(".neoface-forgot-back").addEventListener("click",this.close.bind(this))}renderSuccess(){if(!this.modalElement)return;const e=this.modalElement.querySelector(".neoface-forgot-content");e.innerHTML=`\n <div class="neoface-forgot-success-icon">\n <svg viewBox="0 0 64 64" fill="none" xmlns="http://www.w3.org/2000/svg">\n <circle cx="32" cy="32" r="28" stroke="#0E9F6E" stroke-width="3" fill="none"/>\n <path d="M20 32 L28 40 L44 24" stroke="#0E9F6E" stroke-width="3" stroke-linecap="round" stroke-linejoin="round"/>\n </svg>\n </div>\n\n <h2 class="neoface-forgot-title">Email enviado!</h2>\n <p class="neoface-forgot-subtitle">\n Verifique sua caixa de entrada e siga as instruções para redefinir sua senha.\n <br/><br/>\n <span style="color: rgba(255,255,255,0.5); font-size: 13px;">Não recebeu? Verifique também sua pasta de spam.</span>\n </p>\n\n <button class="neoface-forgot-btn-primary neoface-forgot-close-success" style="margin-top: 8px;">\n Fechar\n </button>\n\n <div class="neoface-forgot-branding">\n ${gi()}\n </div>\n `;e.querySelector(".neoface-forgot-close-success").addEventListener("click",this.close.bind(this))}async handleSubmit(e){var n,t,o,r;e.preventDefault();const a=null==(n=this.modalElement)?void 0:n.querySelector("#neoface-forgot-email"),i=null==(t=this.modalElement)?void 0:t.querySelector(".neoface-forgot-btn-primary"),s=null==(o=this.modalElement)?void 0:o.querySelector("#neoface-forgot-error"),c=null==(r=null==a?void 0:a.value)?void 0:r.trim();if(c){i.disabled=!0,i.textContent="Enviando...",s.style.display="none";try{await Xa(c,this.applicationToken),this.renderSuccess()}catch(d){i.disabled=!1,i.textContent="Enviar link",s.style.display="block",s.textContent=d instanceof h?d.message:"Erro ao enviar email. Tente novamente."}}}addStyles(){const e="neoface-forgot-password-modal-styles";document.getElementById(e)||ua(e,"\n .neoface-forgot-modal {\n position: fixed;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n z-index: 10003;\n font-family: inherit;\n }\n\n .neoface-forgot-overlay {\n position: absolute;\n inset: 0;\n background: rgba(0, 0, 0, 0.65);\n backdrop-filter: blur(8px);\n display: flex;\n align-items: center;\n justify-content: center;\n padding: 20px;\n animation: neoface-forgot-fadeIn 0.3s ease-out;\n }\n\n @keyframes neoface-forgot-fadeIn {\n from { opacity: 0; }\n to { opacity: 1; }\n }\n\n @keyframes neoface-forgot-slideUp {\n from { opacity: 0; transform: translateY(20px); }\n to { opacity: 1; transform: translateY(0); }\n }\n\n .neoface-forgot-content {\n background: linear-gradient(135deg, #0A1320 0%, #111C2B 100%);\n border-radius: 20px;\n padding: 32px;\n max-width: 400px;\n width: 100%;\n box-shadow: 0 24px 48px rgba(0, 0, 0, 0.4), 0 0 0 1px rgba(255, 255, 255, 0.1);\n animation: neoface-forgot-slideUp 0.4s ease-out;\n text-align: center;\n }\n\n .neoface-forgot-icon {\n width: 64px;\n height: 64px;\n margin: 0 auto 20px;\n }\n\n .neoface-forgot-success-icon {\n width: 64px;\n height: 64px;\n margin: 0 auto 20px;\n animation: neoface-forgot-scaleIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);\n }\n\n @keyframes neoface-forgot-scaleIn {\n 0% { transform: scale(0); opacity: 0; }\n 50% { transform: scale(1.1); }\n 100% { transform: scale(1); opacity: 1; }\n }\n\n .neoface-forgot-title {\n font-size: 22px;\n font-weight: 700;\n color: white;\n margin: 0 0 10px 0;\n }\n\n .neoface-forgot-subtitle {\n font-size: 15px;\n color: rgba(255, 255, 255, 0.7);\n margin: 0 0 24px 0;\n line-height: 1.5;\n }\n\n .neoface-forgot-error {\n background: rgba(239, 68, 68, 0.15);\n border: 1px solid rgba(239, 68, 68, 0.4);\n color: #fca5a5;\n border-radius: 10px;\n padding: 10px 14px;\n font-size: 14px;\n margin-bottom: 16px;\n text-align: left;\n }\n\n #neoface-forgot-form {\n display: flex;\n flex-direction: column;\n gap: 14px;\n margin-bottom: 12px;\n }\n\n .neoface-forgot-input {\n width: 100%;\n padding: 14px 16px;\n border: 2px solid rgba(255, 255, 255, 0.2);\n border-radius: 12px;\n font-size: 15px;\n background: rgba(255, 255, 255, 0.08);\n color: white;\n font-family: inherit;\n transition: all 0.2s;\n box-sizing: border-box;\n }\n\n .neoface-forgot-input::placeholder {\n color: rgba(255, 255, 255, 0.4);\n }\n\n .neoface-forgot-input:focus {\n outline: none;\n border-color: #0059C4;\n box-shadow: 0 0 0 3px rgba(0, 89, 196, 0.2);\n background: rgba(255, 255, 255, 0.12);\n }\n\n .neoface-forgot-btn-primary {\n width: 100%;\n padding: 14px 24px;\n border-radius: 12px;\n border: none;\n background: linear-gradient(135deg, #0059C4 0%, #00449A 100%);\n color: white;\n font-size: 16px;\n font-weight: 600;\n cursor: pointer;\n transition: all 0.2s;\n box-shadow: 0 4px 16px rgba(0, 89, 196, 0.3);\n font-family: inherit;\n }\n\n .neoface-forgot-btn-primary:hover:not(:disabled) {\n transform: translateY(-2px);\n box-shadow: 0 8px 24px rgba(0, 89, 196, 0.4);\n }\n\n .neoface-forgot-btn-primary:disabled {\n opacity: 0.6;\n cursor: not-allowed;\n }\n\n .neoface-forgot-btn-ghost {\n background: transparent;\n border: none;\n color: rgba(255, 255, 255, 0.5);\n font-size: 14px;\n font-weight: 500;\n cursor: pointer;\n padding: 10px 16px;\n border-radius: 8px;\n transition: all 0.2s;\n font-family: inherit;\n width: 100%;\n }\n\n .neoface-forgot-btn-ghost:hover {\n color: white;\n background: rgba(255, 255, 255, 0.05);\n }\n\n .neoface-forgot-branding {\n display: flex;\n align-items: center;\n justify-content: center;\n gap: 6px;\n margin-top: 20px;\n color: rgba(255, 255, 255, 0.3);\n font-size: 12px;\n }\n\n .neoface-forgot-brand-logo {\n width: 18px;\n height: 18px;\n object-fit: contain;\n opacity: 0.5;\n }\n\n .neoface-forgot-brand-name {\n font-weight: 700;\n letter-spacing: 0.05em;\n }\n\n @media (max-width: 640px) {\n .neoface-forgot-content {\n padding: 24px;\n border-radius: 16px;\n }\n\n .neoface-forgot-title {\n font-size: 20px;\n }\n }\n ")}}const bi=(e,n)=>{switch(n.type){case"START_LIVENESS":return{status:"liveness",step:n.stepSequence[0],capturedPhotos:[],stepSequence:n.stepSequence,currentStepIndex:0,stepProgress:0};case"NEXT_STEP":if("liveness"===e.status){const t=n.photo?[...e.capturedPhotos,n.photo]:e.capturedPhotos;return{status:"liveness",step:n.step,capturedPhotos:t,stepSequence:e.stepSequence,currentStepIndex:e.currentStepIndex+1,stepProgress:0}}return e;case"UPDATE_PROGRESS":return"liveness"===e.status?{...e,stepProgress:n.progress}:e;case"CAMERA_LOADING":return{status:"camera-loading"};case"SUCCESS":return{status:"success"};case"DUPLICATE":return{status:"duplicate",personName:n.personName};case"ERROR":return{status:"error",message:n.message,retryable:n.retryable??!0};case"RESET":return yi();default:return e}},wi={center:"Posicione seu rosto no centro",up:"Incline a cabeça para cima",down:"Incline a cabeça para baixo",left:"Vire o rosto para a esquerda",right:"Vire o rosto para a direita",complete:"Processando..."},yi=()=>{const e=(()=>{const e=["up","down","left","right"];for(let n=e.length-1;n>0;n--){const t=Math.floor(Math.random()*(n+1));[e[n],e[t]]=[e[t],e[n]]}return["center",...e,"complete"]})();return{status:"liveness",step:e[0],capturedPhotos:[],stepSequence:e,currentStepIndex:0,stepProgress:0}},xi=8,ki=10,Ei=26,_i=8,Ri=-8,Ni=15,Ti=-15,Oi=1500,Si=150,Ii=.35,Ci=.65,zi=.18,ji=.22,Ai=2e4;function Fi({personData:e,applicationToken:t,onClose:r,onSuccess:a,onPhotosCaptured:i,onError:s,onCannotGesture:c,autoLighting:l=!0}){const u=n.useRef(null),p=n.useRef(null),f=n.useRef(null),h=n.useRef(null),m=n.useRef(null),g=n.useRef(!1),v=n.useRef("center"),b=n.useRef(null),w=n.useRef(null),y=n.useRef(!1),x=n.useRef(null),[k,E]=n.useReducer(bi,void 0,yi),[_,R]=n.useState(!1),[N,T]=n.useState("ok"),[O,S]=n.useState(!1);n.useEffect((()=>{la()}),[]);const I=l&&("liveness"===k.status||"camera-loading"===k.status),{flashOn:C}=ni(u,{enabled:I});n.useEffect((()=>{if("liveness"===k.status){const e=k.step;v.current!==e&&(v.current=e,g.current||(h.current&&(h.current=null),m.current&&(clearInterval(m.current),m.current=null),E({type:"UPDATE_PROGRESS",progress:0}))),x.current={stepSequence:k.stepSequence,currentStepIndex:k.currentStepIndex,capturedPhotos:k.capturedPhotos},w.current&&clearTimeout(w.current),"complete"!==k.step&&(w.current=window.setTimeout((()=>{E({type:"ERROR",message:"Tempo limite atingido para o movimento. Por favor, tente novamente em um ambiente bem iluminado.",retryable:!0})}),Ai))}}),[k.status,"liveness"===k.status&&k.step,"liveness"===k.status&&k.currentStepIndex]);const z=e=>{if(g.current||"complete"===v.current)return;const n=Date.now();e?h.current||(h.current=n,m.current&&clearInterval(m.current),m.current=window.setInterval((()=>{if(!h.current)return;const e=Date.now()-h.current,n=Math.min(e/Oi*100,100);E({type:"UPDATE_PROGRESS",progress:n}),n>=100&&(clearInterval(m.current),m.current=null,j())}),50)):h.current&&(h.current=null,m.current&&(clearInterval(m.current),m.current=null),E({type:"UPDATE_PROGRESS",progress:0}))};n.useEffect((()=>{(async()=>{try{const e="/models",n=new Promise(((e,n)=>setTimeout((()=>n(new Error("Timeout ao carregar modelos"))),1e4)));await Promise.race([Promise.all([d.nets.tinyFaceDetector.loadFromUri(e),d.nets.faceLandmark68Net.loadFromUri(e)]),n])}catch(e){E({type:"ERROR",message:"Não foi possível carregar os modelos de IA. Verifique sua conexão e tente novamente.",retryable:!0})}})()}),[]),n.useEffect((()=>()=>{f.current&&(f.current.getTracks().forEach((e=>{e.stop()})),f.current=null),u.current&&(u.current.srcObject=null),b.current&&(clearTimeout(b.current),b.current=null),m.current&&(clearInterval(m.current),m.current=null),w.current&&(clearTimeout(w.current),w.current=null)}),[]),n.useEffect((()=>{let e=!0;return(async()=>{if("liveness"===k.status&&!f.current){y.current=!1,b.current&&(clearTimeout(b.current),b.current=null),b.current=window.setTimeout((()=>{e&&!1===y.current&&E({type:"ERROR",message:"A câmera não respondeu a tempo. Verifique se ela está disponível e tente novamente.",retryable:!0})}),2e4);try{const n=await navigator.mediaDevices.getUserMedia({video:{width:{ideal:640},height:{ideal:480},facingMode:"user"}});if(!e)return void n.getTracks().forEach((e=>e.stop()));const t=async()=>{let e=0;for(;!u.current&&e<50;)await new Promise((e=>setTimeout(e,100))),e++;return u.current},o=await t();if(!o)throw new Error("Elemento de vídeo não encontrado");o.srcObject=n,f.current=n,o.onloadedmetadata=()=>{o.play().then((()=>{e&&S(!0)}))}}catch(n){if(!e)return;b.current&&(clearTimeout(b.current),b.current=null);let t=n instanceof Error?n.message:"Erro ao acessar câmera";n instanceof DOMException&&("NotAllowedError"===n.name||"PermissionDeniedError"===n.name?t="Permissão de câmera negada. Permita o acesso à câmera nas configurações do navegador e tente novamente.":"NotFoundError"===n.name||"DevicesNotFoundError"===n.name?t="Nenhuma câmera encontrada. Conecte uma câmera e tente novamente.":"NotReadableError"===n.name&&(t="A câmera está sendo usada por outro programa. Feche-o e tente novamente.")),E({type:"ERROR",message:t,retryable:!0})}}})(),()=>{e=!1,b.current&&(clearTimeout(b.current),b.current=null),f.current&&(f.current.getTracks().forEach((e=>e.stop())),f.current=null),m.current&&(clearInterval(m.current),m.current=null),h.current=null}}),[k.status]),n.useEffect((()=>{if("liveness"!==k.status||!u.current)return;let e=!0,n=0;const t=async()=>{if(!e||"liveness"!==k.status)return;if(g.current||"complete"===v.current)return void requestAnimationFrame(t);const o=Date.now();if(o-n<Si)requestAnimationFrame(t);else{n=o;try{const n=await d.detectSingleFace(u.current,new d.TinyFaceDetectorOptions({inputSize:224,scoreThreshold:.35})).withFaceLandmarks();if(!e)return;const o=!!n;if(R(o),o&&n.detection){const e=(e=>{if(!e||!u.current)return"not-detected";const{box:n}=e.detection,t=u.current.videoWidth||640,o=u.current.videoHeight||480,r=n.width/t;if(r<Ii)return"too-far";if(r>Ci)return"too-close";const a=n.x+n.width/2,i=n.y+n.height/2,s=Math.abs(a-t/2)/t,c=Math.abs(i-o/2)/o;return s>zi||c>ji?"not-centered":"ok"})(n);if("not-detected"!==e&&T(e),"ok"!==e)return z(!1),void requestAnimationFrame(t)}if(o&&n.landmarks){const e=(e=>{try{const n=e.positions||e._positions;if(!Array.isArray(n)||n.length<68)return null;const t=e=>{const t=n[e];return{x:void 0!==t._x?t._x:t.x,y:void 0!==t._y?t._y:t.y}},o=t(30),r=t(8),a=t(36),i=t(45),s=(a.x+i.x)/2,c=(o.x-s)/Math.abs(i.x-a.x)*90,d=(a.y+i.y)/2,l=o.y-d,u=-l/Math.abs(r.y-d)*90+Ei;return{pitch:Math.round(u),yaw:Math.round(c)}}catch(n){return null}})(n.landmarks);if(e){const n=((e,n,t)=>{switch(t){case"center":return Math.abs(e)<xi&&Math.abs(n)<ki;case"up":return e>_i;case"down":return e<Ri;case"left":return n>Ni;case"right":return n<Ti;default:return!1}})(e.pitch,e.yaw,v.current);z(n)}}else h.current&&(h.current=null,m.current&&(clearInterval(m.current),m.current=null),E({type:"UPDATE_PROGRESS",progress:0}))}catch(r){}e&&"liveness"===k.status&&requestAnimationFrame(t)}},o=()=>{e&&u.current&&(y.current=!0,b.current&&(clearTimeout(b.current),b.current=null),t())},r=u.current;if(r&&r.readyState>=2){const n=setTimeout(o,200);return()=>{e=!1,clearTimeout(n),m.current&&(clearInterval(m.current),m.current=null),h.current=null}}const a=()=>{e&&o()};let i=0;const s=window.setInterval((()=>{i++,e?u.current&&u.current.readyState>=2?(clearInterval(s),u.current.removeEventListener("canplay",a),o()):i>=50&&clearInterval(s):clearInterval(s)}),300);return null==r||r.addEventListener("canplay",a,{once:!0}),()=>{e=!1,clearInterval(s),null==r||r.removeEventListener("canplay",a),m.current&&(clearInterval(m.current),m.current=null),h.current=null}}),[k.status]);const j=async()=>{if(!u.current||!p.current||g.current)return;g.current=!0,h.current=null;const e=x.current;if(!e)return void(g.current=!1);const n=p.current,t=u.current,o=n.getContext("2d");o?(n.width=t.videoWidth,n.height=t.videoHeight,o.scale(-1,1),o.drawImage(t,-n.width,0,n.width,n.height),n.toBlob((n=>{if(!n)return void(g.current=!1);const t=e.currentStepIndex+1,o=e.stepSequence[t];if("complete"===o){const t=[...e.capturedPhotos,n];E({type:"START_PROCESSING"}),A(t)}else setTimeout((()=>{g.current=!1,E({type:"NEXT_STEP",step:o,photo:n})}),100)}),"image/jpeg",.85)):g.current=!1},A=async n=>{var o;try{if(E({type:"START_PROCESSING"}),t&&n.length>0)try{const{identifyPersonAsync:e}=await Promise.resolve().then((()=>Qa)),r=new Promise((e=>setTimeout((()=>e(null)),5e3))),a=await Promise.race([e(n[0],t,{maxRetries:3,interval:1e3}),r]);if(a&&a.personFound)return void E({type:"DUPLICATE",personName:(null==(o=a.person)?void 0:o.name)||"Pessoa identificada"})}catch(r){}if(i)return E({type:"SUCCESS"}),i(n),void(n.length=0);if(!e||!t)throw new Error("Dados de registro não fornecidos");const s=await La(e,n,t),c={success:s.success,message:s.message,person_id:s.person_id,user_id:s.user_id,person_validated:s.person_validated,face_processing:s.face_processing,onboarding_link:s.onboarding_link};E({type:"SUCCESS"}),a&&(a(c),n.length=0)}catch(c){const e=c instanceof Error?c.message:"Erro desconhecido";E({type:"ERROR",message:e}),s(e)}};return o.jsxs(o.Fragment,{children:[o.jsx("style",{children:"\n @keyframes fadeIn {\n from { opacity: 0; transform: scale(0.95); }\n to { opacity: 1; transform: scale(1); }\n }\n\n @keyframes slideUp {\n from { opacity: 0; transform: translateY(20px); }\n to { opacity: 1; transform: translateY(0); }\n }\n\n @keyframes slideDown {\n from { opacity: 0; transform: translateY(-10px); }\n to { opacity: 1; transform: translateY(0); }\n }\n\n @keyframes spin {\n from { transform: rotate(0deg); }\n to { transform: rotate(360deg); }\n }\n\n @keyframes pulseRing {\n 0%, 100% { \n box-shadow: 0 0 0 4px rgba(16, 185, 129, 0.8), 0 0 40px rgba(16, 185, 129, 0.4);\n }\n 50% { \n box-shadow: 0 0 0 6px rgba(16, 185, 129, 0.9), 0 0 50px rgba(16, 185, 129, 0.5);\n }\n }\n\n @keyframes checkmark {\n 0% {\n stroke-dashoffset: 100;\n }\n 100% {\n stroke-dashoffset: 0;\n }\n }\n\n @keyframes scaleIn {\n 0% {\n transform: scale(0);\n opacity: 0;\n }\n 50% {\n transform: scale(1.1);\n }\n 100% {\n transform: scale(1);\n opacity: 1;\n }\n }\n\n @keyframes scanRing {\n 0%, 100% { transform: scale(1); opacity: 0.3; }\n 50% { transform: scale(1.1); opacity: 0.6; }\n }\n\n @keyframes cornerBlink {\n 0%, 100% { opacity: 0.3; }\n 50% { opacity: 1; }\n }\n\n .modal-overlay {\n position: fixed;\n inset: 0;\n background: rgba(0, 0, 0, 0.92);\n backdrop-filter: blur(8px);\n display: flex;\n align-items: center;\n justify-content: center;\n z-index: 9999;\n padding: 20px;\n }\n\n .modal-content {\n background: linear-gradient(135deg, #0A1320 0%, #111C2B 100%);\n border-radius: 24px;\n width: 100%;\n max-width: 420px;\n max-height: 90vh;\n overflow: hidden;\n box-shadow: 0 24px 48px rgba(0, 0, 0, 0.4), 0 0 0 1px rgba(255, 255, 255, 0.1);\n animation: fadeIn 0.3s ease-out;\n position: relative;\n }\n\n .close-button {\n position: absolute;\n top: 20px;\n right: 20px;\n width: 32px;\n height: 32px;\n background: transparent;\n border: none;\n color: rgba(255, 255, 255, 0.6);\n font-size: 28px;\n font-weight: 300;\n cursor: pointer;\n display: flex;\n align-items: center;\n justify-content: center;\n transition: all 0.2s;\n z-index: 10;\n line-height: 1;\n }\n\n .close-button:hover {\n color: rgba(255, 255, 255, 0.9);\n transform: rotate(90deg);\n }\n\n /* Instructions Screen */\n .instructions-container {\n padding: 60px 40px 40px;\n color: white;\n text-align: center;\n animation: slideUp 0.4s ease-out;\n }\n\n .instructions-header {\n margin-bottom: 40px;\n }\n\n .icon-wrapper {\n display: inline-block;\n color: #0059C4;\n margin-bottom: 24px;\n }\n\n .icon-wrapper .scan-ring {\n animation: scanRing 2s ease-in-out infinite;\n }\n\n .icon-wrapper .corner {\n animation: cornerBlink 2s ease-in-out infinite;\n }\n\n .icon-wrapper .corner.tl { animation-delay: 0s; }\n .icon-wrapper .corner.tr { animation-delay: 0.5s; }\n .icon-wrapper .corner.bl { animation-delay: 1s; }\n .icon-wrapper .corner.br { animation-delay: 1.5s; }\n\n .instructions-header h2 {\n font-size: 28px;\n font-weight: 700;\n margin: 0 0 12px 0;\n background: linear-gradient(135deg, #0059C4 0%, #a78bfa 100%);\n -webkit-background-clip: text;\n -webkit-text-fill-color: transparent;\n background-clip: text;\n }\n\n .subtitle {\n font-size: 15px;\n color: rgba(255, 255, 255, 0.7);\n margin: 0;\n line-height: 1.5;\n }\n\n .requirements-list {\n text-align: left;\n margin: 0 auto 40px;\n max-width: 360px;\n }\n\n .requirement-item {\n display: flex;\n align-items: center;\n gap: 16px;\n padding: 14px 0;\n font-size: 15px;\n color: rgba(255, 255, 255, 0.9);\n border-bottom: 1px solid rgba(255, 255, 255, 0.05);\n }\n\n .requirement-item:last-child {\n border-bottom: none;\n }\n\n .req-icon {\n width: 32px;\n height: 32px;\n border-radius: 50%;\n display: flex;\n align-items: center;\n justify-content: center;\n flex-shrink: 0;\n }\n\n .req-icon.success {\n background: rgba(16, 185, 129, 0.15);\n color: #0E9F6E;\n border: 1.5px solid rgba(16, 185, 129, 0.3);\n }\n\n .primary-button {\n width: 100%;\n padding: 16px 32px;\n border-radius: 12px;\n border: none;\n background: linear-gradient(135deg, #0059C4 0%, #00449A 100%);\n color: white;\n font-size: 16px;\n font-weight: 600;\n cursor: pointer;\n transition: all 0.3s;\n box-shadow: 0 4px 16px rgba(0, 89, 196, 0.3);\n }\n\n .primary-button:hover {\n transform: translateY(-2px);\n box-shadow: 0 8px 24px rgba(0, 89, 196, 0.4);\n }\n\n .primary-button:active {\n transform: translateY(0);\n }\n\n .branding {\n display: flex;\n align-items: center;\n justify-content: center;\n gap: 8px;\n margin-top: 32px;\n padding-top: 24px;\n border-top: 1px solid rgba(255, 255, 255, 0.1);\n font-size: 13px;\n color: rgba(255, 255, 255, 0.5);\n }\n\n .brand-logo {\n height: 20px;\n width: auto;\n }\n\n .brand-name {\n font-weight: 600;\n font-family: inherit;\n color: #ffffff;\n letter-spacing: 0.3px;\n }\n\n /* Liveness Detection */\n .liveness-container {\n height: 100%;\n min-height: 520px;\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n padding: 70px 20px 80px;\n position: relative;\n animation: fadeIn 0.3s ease-out;\n }\n\n .progress-indicator {\n position: absolute;\n top: 20px;\n left: 50%;\n transform: translateX(-50%);\n background: rgba(255, 255, 255, 0.08);\n backdrop-filter: blur(12px);\n border-radius: 20px;\n padding: 8px 20px;\n border: 1px solid rgba(255, 255, 255, 0.12);\n z-index: 5;\n }\n\n .progress-text {\n font-size: 14px;\n font-weight: 600;\n color: white;\n }\n\n .video-wrapper {\n position: relative;\n margin: 20px 0;\n }\n\n .video-circle {\n width: 320px;\n height: 400px;\n border-radius: 50%;\n overflow: hidden;\n position: relative;\n /* Removida transição 'all' para evitar salto de zoom no início */\n box-shadow: 0 0 0 4px rgba(0, 89, 196, 0.3);\n background: #000;\n }\n\n .video-circle.face-detected {\n box-shadow: 0 0 0 4px rgba(16, 185, 129, 0.5), 0 0 40px rgba(16, 185, 129, 0.3);\n }\n\n .video-circle.capturing {\n box-shadow: 0 0 0 4px rgba(16, 185, 129, 0.9), 0 0 40px rgba(16, 185, 129, 0.5);\n transition: box-shadow 0.3s ease;\n }\n\n .video-feed {\n width: 100%;\n height: 100%;\n object-fit: cover;\n transform: scaleX(-1);\n opacity: 0;\n transition: opacity 0.4s ease;\n }\n\n .video-feed.ready {\n opacity: 1;\n }\n\n .face-badge {\n display: none; /* Removido por ser redundante com o oval verde */\n }\n\n .status-badge {\n position: absolute;\n top: 72px; /* Logo abaixo do progress-indicator */\n left: 50%;\n transform: translateX(-50%);\n backdrop-filter: blur(10px);\n border-radius: 20px;\n padding: 8px 16px;\n display: flex;\n align-items: center;\n gap: 8px;\n color: white;\n font-size: 13px;\n font-weight: 600;\n border: 1px solid rgba(255, 255, 255, 0.3);\n box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);\n animation: slideDown 0.3s ease-out;\n z-index: 10;\n white-space: nowrap;\n }\n\n .status-badge.info {\n background: rgba(255, 255, 255, 0.15);\n color: white;\n border-color: rgba(255, 255, 255, 0.1);\n }\n\n .status-badge.warning {\n background: rgba(251, 191, 36, 0.95);\n color: #78350f;\n border-color: rgba(0, 0, 0, 0.1);\n box-shadow: 0 4px 15px rgba(251, 191, 36, 0.2);\n }\n\n .status-badge.error {\n background: rgba(239, 68, 68, 0.95);\n color: white;\n border-color: rgba(255, 255, 255, 0.2);\n box-shadow: 0 4px 15px rgba(239, 68, 68, 0.2);\n }\n\n .instruction-box {\n background: rgba(255, 255, 255, 0.08);\n backdrop-filter: blur(12px);\n border-radius: 16px;\n padding: 16px 24px;\n margin-top: 20px;\n border: 1px solid rgba(255, 255, 255, 0.12);\n max-width: 320px;\n animation: slideUp 0.3s ease-out;\n }\n\n .instruction-text {\n font-size: 18px;\n font-weight: 600;\n color: white;\n margin: 0 0 12px 0;\n text-align: center;\n }\n\n .progress-bar {\n height: 4px;\n background: rgba(255, 255, 255, 0.2);\n border-radius: 2px;\n overflow: hidden;\n }\n\n .progress-fill {\n height: 100%;\n background: linear-gradient(90deg, #0059C4 0%, #0E9F6E 100%);\n border-radius: 2px;\n transition: width 0.05s linear;\n }\n\n /* NEO-410 · US14.3 — botão \"Não consigo fazer esse movimento\" */\n .cannot-gesture-button {\n margin-top: 16px;\n min-height: 44px;\n min-width: 44px;\n padding: 10px 20px;\n background: transparent;\n border: 1px solid rgba(255, 255, 255, 0.28);\n border-radius: 22px;\n color: rgba(255, 255, 255, 0.85);\n font-size: 14px;\n font-weight: 500;\n font-family: inherit;\n cursor: pointer;\n transition: background 120ms ease-out, border-color 120ms ease-out;\n }\n .cannot-gesture-button:hover {\n background: rgba(255, 255, 255, 0.08);\n border-color: rgba(255, 255, 255, 0.42);\n }\n .cannot-gesture-button:focus-visible {\n outline: 2px solid #0059C4;\n outline-offset: 2px;\n }\n\n .branding-small {\n position: absolute;\n bottom: 24px;\n left: 50%;\n transform: translateX(-50%);\n display: flex;\n align-items: center;\n justify-content: center;\n gap: 5px;\n font-size: 12px;\n color: rgba(255, 255, 255, 0.5);\n }\n\n .brand-logo-small {\n height: 18px;\n width: 18px;\n }\n\n /* Processing */\n .processing-container {\n padding: 80px 40px;\n text-align: center;\n color: white;\n animation: fadeIn 0.3s ease-out;\n }\n\n .spinner-wrapper {\n position: relative;\n width: 80px;\n height: 80px;\n margin: 0 auto 32px;\n }\n\n .spinner {\n position: absolute;\n inset: 0;\n border: 4px solid rgba(0, 89, 196, 0.2);\n border-top-color: #0059C4;\n border-radius: 50%;\n animation: spin 1s linear infinite;\n }\n\n .spinner-ring {\n position: absolute;\n inset: -10px;\n border: 2px solid rgba(0, 89, 196, 0.1);\n border-radius: 50%;\n animation: pulseSpinner 2s ease-in-out infinite;\n }\n\n @keyframes pulseSpinner {\n 0%, 100% { transform: scale(1); opacity: 1; }\n 50% { transform: scale(1.1); opacity: 0.5; }\n }\n\n .processing-container h3 {\n font-size: 24px;\n font-weight: 700;\n margin: 0 0 12px 0;\n }\n\n .processing-container p {\n font-size: 15px;\n color: rgba(255, 255, 255, 0.7);\n margin: 0;\n }\n\n /* Result Screens */\n .result-container {\n padding: 80px 40px 40px;\n text-align: center;\n color: white;\n animation: slideUp 0.4s ease-out;\n }\n\n .result-icon {\n display: inline-flex;\n margin-bottom: 24px;\n }\n\n .success-icon {\n color: #0E9F6E;\n animation: scaleIn 0.6s ease-out;\n }\n\n .success-icon svg circle {\n animation: scaleIn 0.5s ease-out;\n }\n\n .success-icon svg path {\n stroke-dasharray: 100;\n stroke-dashoffset: 100;\n animation: checkmark 0.6s ease-out 0.3s forwards;\n }\n\n .error-icon {\n color: #ef4444;\n animation: fadeIn 0.5s ease-out;\n }\n\n .result-container h3 {\n font-size: 26px;\n font-weight: 700;\n margin: 0 0 12px 0;\n }\n\n .result-container p {\n font-size: 15px;\n color: rgba(255, 255, 255, 0.7);\n margin: 0 0 32px 0;\n line-height: 1.5;\n }\n\n .button-group {\n display: flex;\n gap: 12px;\n margin-top: 32px;\n }\n\n .secondary-button {\n flex: 1;\n padding: 14px 24px;\n border-radius: 12px;\n border: 1px solid rgba(255, 255, 255, 0.2);\n background: rgba(255, 255, 255, 0.1);\n color: white;\n font-size: 15px;\n font-weight: 600;\n cursor: pointer;\n transition: all 0.2s;\n }\n\n .secondary-button:hover {\n background: rgba(255, 255, 255, 0.15);\n border-color: rgba(255, 255, 255, 0.3);\n }\n\n .ghost-button {\n flex: 1;\n padding: 14px 24px;\n border-radius: 12px;\n border: none;\n background: transparent;\n color: rgba(255, 255, 255, 0.7);\n font-size: 15px;\n font-weight: 600;\n cursor: pointer;\n transition: all 0.2s;\n }\n\n .ghost-button:hover {\n color: white;\n background: rgba(255, 255, 255, 0.05);\n }\n\n /* Duplicate Screen Styles */\n .profile-icon-wrapper {\n position: relative;\n display: inline-block;\n margin-bottom: 24px;\n }\n\n .profile-main-icon {\n background: rgba(0, 89, 196, 0.1);\n color: #0059C4;\n padding: 20px;\n border-radius: 50%;\n border: 2px solid rgba(0, 89, 196, 0.2);\n box-shadow: 0 0 30px rgba(0, 89, 196, 0.2);\n }\n\n .profile-main-icon svg {\n width: 48px;\n height: 48px;\n }\n\n .verified-badge {\n position: absolute;\n bottom: -4px;\n right: -4px;\n background: #0E9F6E;\n border-radius: 50%;\n padding: 4px;\n border: 3px solid #111C2B;\n width: 24px;\n height: 24px;\n display: flex;\n align-items: center;\n justify-content: center;\n }\n\n .button-group-vertical {\n display: flex;\n flex-direction: column;\n width: 100%;\n gap: 8px;\n }\n\n .support-section {\n margin-top: 24px;\n padding-top: 16px;\n border-top: 1px solid rgba(255, 255, 255, 0.05);\n }\n\n .support-section p {\n font-size: 13px;\n color: rgba(255, 255, 255, 0.4);\n margin-bottom: 8px;\n }\n\n /* Canvas */\n canvas {\n display: none;\n }\n\n /* Responsive */\n @media (max-width: 640px) {\n .modal-content {\n max-width: 100%;\n border-radius: 0;\n max-height: 100vh;\n }\n\n .instructions-container {\n padding: 50px 24px 24px;\n }\n\n .instructions-header h2 {\n font-size: 24px;\n }\n\n .video-circle {\n width: 280px;\n height: 350px;\n }\n\n .liveness-container {\n min-height: 100vh;\n }\n }\n "}),o.jsx(ti,{active:C}),o.jsx("div",{className:"neofaceid-root modal-overlay",children:o.jsxs("div",{className:"modal-content",children:[o.jsx("button",{type:"button",className:"close-button",onClick:r,children:"×"}),"liveness"===k.status&&(()=>{if("liveness"!==k.status)return null;const e=`${k.currentStepIndex+1}/${k.stepSequence.length-1}`,{stepProgress:n}=k;return o.jsxs("div",{className:"liveness-container",children:[o.jsx("div",{className:"progress-indicator",children:o.jsx("span",{className:"progress-text",children:e})}),_&&"ok"!==N&&o.jsxs("div",{className:"status-badge "+("not-centered"===N?"warning":"error"),children:["too-far"===N&&"Aproxime-se mais","too-close"===N&&"Afaste-se um pouco","not-centered"===N&&"Centralize seu rosto"]}),o.jsx("div",{className:"video-wrapper",children:o.jsx("div",{className:`video-circle ${_&&"ok"===N?"face-detected":""} ${n>0?"capturing":""}`,children:o.jsx("video",{ref:u,className:"video-feed "+(O?"ready":""),autoPlay:!0,muted:!0,playsInline:!0})})}),o.jsxs("div",{className:"instruction-box",children:[o.jsx("p",{className:"instruction-text","aria-live":"assertive",children:wi[k.step]}),n>0&&o.jsx("div",{className:"progress-bar",children:o.jsx("div",{className:"progress-fill",style:{width:`${n}%`}})})]}),o.jsx("button",{type:"button",className:"cannot-gesture-button",onClick:()=>{c?c():r()},"aria-label":"Não consigo fazer esse movimento — buscar alternativa",children:"Não consigo fazer esse movimento"}),o.jsx("div",{className:"branding-small",children:o.jsx(mi,{})})]})})(),"camera-loading"===k.status&&o.jsxs("div",{className:"processing-container",children:[o.jsxs("div",{className:"spinner-wrapper",children:[o.jsx("div",{className:"spinner"}),o.jsx("div",{className:"spinner-ring"})]}),o.jsx("h3",{children:"Inicializando câmera"}),o.jsx("p",{children:"Aguarde enquanto preparamos a câmera..."}),o.jsx("div",{className:"branding",style:{marginTop:"40px",paddingTop:"24px",borderTop:"1px solid rgba(255, 255, 255, 0.1)"},children:o.jsx(mi,{})})]}),"processing"===k.status&&o.jsxs("div",{className:"processing-container",children:[o.jsxs("div",{className:"spinner-wrapper",children:[o.jsx("div",{className:"spinner"}),o.jsx("div",{className:"spinner-ring"})]}),o.jsx("h3",{children:"Processando biometria"}),o.jsx("p",{children:"Analisando suas capturas faciais..."}),o.jsx("div",{className:"branding",style:{marginTop:"40px",paddingTop:"24px",borderTop:"1px solid rgba(255, 255, 255, 0.1)"},children:o.jsx(mi,{})})]}),"error"===k.status&&("error"!==k.status?null:o.jsxs("div",{className:"result-container error",children:[o.jsx("div",{className:"result-icon error-icon",children:o.jsxs("svg",{width:"60",height:"60",viewBox:"0 0 60 60",fill:"none",children:[o.jsx("circle",{cx:"30",cy:"30",r:"28",stroke:"currentColor",strokeWidth:"3"}),o.jsx("path",{d:"M20 20 L40 40 M40 20 L20 40",stroke:"currentColor",strokeWidth:"3",strokeLinecap:"round"})]})}),o.jsx("h3",{children:"Não foi possível processar"}),o.jsx("p",{children:k.message}),o.jsxs("div",{className:"button-group",children:[k.retryable&&o.jsx("button",{type:"button",className:"secondary-button",onClick:()=>E({type:"RESET"}),children:"Tentar Novamente"}),o.jsx("button",{type:"button",className:"ghost-button",onClick:r,children:"Cancelar"})]})]})),"success"===k.status&&o.jsxs("div",{className:"result-container success",children:[o.jsx("div",{className:"result-icon success-icon",children:o.jsxs("svg",{width:"60",height:"60",viewBox:"0 0 60 60",fill:"none",children:[o.jsx("circle",{cx:"30",cy:"30",r:"28",stroke:"currentColor",strokeWidth:"3"}),o.jsx("path",{d:"M15 30 L25 40 L45 20",stroke:"currentColor",strokeWidth:"3",strokeLinecap:"round",strokeLinejoin:"round"})]})}),o.jsx("h3",{children:i?"Captura concluída!":"Verificação concluída!"}),o.jsx("p",{children:i?"Suas capturas faciais foram realizadas":"Sua biometria foi registrada com sucesso"}),o.jsx("button",{type:"button",className:"primary-button",onClick:r,children:"Continuar"})]}),"duplicate"===k.status&&(()=>{if("duplicate"!==k.status)return null;const e=k.personName&&"Pessoa identificada"!==k.personName?`Olá, ${k.personName.split(" ")[0]}!`:"Olá!";return o.jsxs("div",{className:"result-container duplicate scale-in",children:[o.jsx("h3",{style:{marginTop:"0px"},children:e}),o.jsx("p",{style:{marginBottom:"32px",fontSize:"15px"},children:"Identificamos seu cadastro biométrico em nossa rede. Você já faz parte da NeoFaceId!"}),o.jsxs("div",{className:"button-group-vertical",children:[o.jsx("button",{type:"button",className:"primary-button",onClick:()=>{r(),window.location.href="/"},children:"Ir para o Login"}),o.jsx("button",{type:"button",className:"secondary-button",style:{marginTop:"12px"},onClick:()=>{r(),new vi(t??"").open()},children:"Esqueci minha senha"}),o.jsxs("div",{className:"support-section",children:[o.jsx("p",{children:"Não reconhece esta conta?"}),o.jsx("button",{type:"button",className:"ghost-button",onClick:()=>window.open("https://support.neofaceid.com","_blank"),children:"Falar com Suporte"})]})]}),o.jsx("div",{className:"branding",style:{marginTop:"32px",paddingTop:"20px",borderTop:"1px solid rgba(255, 255, 255, 0.08)",width:"100%"},children:o.jsx(mi,{})})]})})()]})}),o.jsx("canvas",{ref:p})]})}const $i="https://neofaceid.com/privacidade",Pi={verification:{title:"Vamos confirmar que é você",duration:"Leva cerca de 20 segundos e usa a câmera do seu dispositivo.",bullet1Title:"Sua câmera liga agora",bullet1Body:"Você vê a imagem o tempo todo e pode encerrar quando quiser.",bullet2Title:"Pediremos dois movimentos simples",bullet2Body:"Virar o rosto ou piscar — é assim que sabemos que há alguém ali.",bullet3Title:"A imagem não fica guardada",bullet3Body:"Ela é usada para a verificação e descartada em seguida.",primary:"Começar verificação"},registration:{title:"Vamos cadastrar seu rosto",duration:"Leva cerca de 20 segundos e usa a câmera do seu dispositivo.",bullet1Title:"Sua câmera liga agora",bullet1Body:"Você vê a imagem o tempo todo e pode encerrar quando quiser.",bullet2Title:"Pediremos dois movimentos simples",bullet2Body:"Virar o rosto ou piscar — é assim que sabemos que há alguém ali.",bullet3Title:"Guardamos um vetor matemático do seu rosto",bullet3Body:"Não a foto. A imagem é descartada.",primary:"Começar cadastro"}},Di=()=>o.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[o.jsx("path",{d:"M14.5 4h-5L7 7H4a2 2 0 0 0-2 2v9a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V9a2 2 0 0 0-2-2h-3l-2.5-3Z"}),o.jsx("circle",{cx:"12",cy:"13",r:"4"})]}),Li=()=>o.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[o.jsx("circle",{cx:"12",cy:"12",r:"9"}),o.jsx("path",{d:"M4 12h16"}),o.jsx("path",{d:"M15 8l4 4-4 4"})]}),Mi=()=>o.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[o.jsx("path",{d:"M12 2 4 5v7c0 5 3.5 8.5 8 10 4.5-1.5 8-5 8-10V5l-8-3Z"}),o.jsx("path",{d:"m9 12 2 2 4-4"})]});function qi({appName:e,flow:n,privacyPolicyUrl:t=$i,retentionDays:r=90,onAccept:a,onDecline:i}){const s=Pi[n];return o.jsxs(o.Fragment,{children:[o.jsx("style",{children:"\n @keyframes neofaceidConsentFadeIn { from { opacity: 0 } to { opacity: 1 } }\n @keyframes neofaceidConsentSlideUp {\n from { opacity: 0; transform: translateY(12px) }\n to { opacity: 1; transform: translateY(0) }\n }\n .neofaceid-consent-overlay {\n position: fixed; inset: 0;\n background: var(--nfid-overlay);\n backdrop-filter: blur(3px);\n -webkit-backdrop-filter: blur(3px);\n display: flex; align-items: center; justify-content: center;\n z-index: 10001; padding: 20px;\n animation: neofaceidConsentFadeIn 200ms ease-out;\n font-family: inherit;\n color: var(--nfid-text);\n }\n .neofaceid-consent-modal {\n background: var(--nfid-surface);\n border-radius: var(--nfid-radius, 16px);\n padding: 28px;\n max-width: 440px;\n width: 100%;\n box-shadow: 0 1px 3px rgba(10, 19, 32, 0.08);\n animation: neofaceidConsentSlideUp 320ms cubic-bezier(.2,0,0,1);\n box-sizing: border-box;\n }\n .neofaceid-consent-header {\n display: flex;\n align-items: baseline;\n gap: 10px;\n margin-bottom: 20px;\n }\n .neofaceid-consent-appname {\n font-size: 17px;\n font-weight: 700;\n color: var(--nfid-text);\n line-height: 1.2;\n }\n .neofaceid-consent-brand-caption {\n font-size: 11px;\n font-weight: 700;\n letter-spacing: 0.09em;\n text-transform: uppercase;\n color: var(--nfid-text-subtle);\n }\n .neofaceid-consent-title {\n font-size: 22px;\n font-weight: 700;\n color: var(--nfid-text);\n margin: 0 0 8px;\n line-height: 1.25;\n letter-spacing: -0.015em;\n }\n .neofaceid-consent-duration {\n font-size: 14px;\n color: var(--nfid-text-muted);\n margin: 0 0 20px;\n line-height: 1.5;\n }\n .neofaceid-consent-bullets {\n display: flex;\n flex-direction: column;\n gap: 14px;\n margin-bottom: 20px;\n }\n .neofaceid-consent-bullet {\n display: flex;\n gap: 12px;\n align-items: flex-start;\n }\n .neofaceid-consent-bullet-icon {\n flex-shrink: 0;\n color: var(--nfid-action);\n margin-top: 2px;\n }\n .neofaceid-consent-bullet-title {\n font-size: 14px;\n font-weight: 600;\n color: var(--nfid-text);\n margin: 0 0 2px;\n line-height: 1.35;\n }\n .neofaceid-consent-bullet-body {\n font-size: 13px;\n color: var(--nfid-text-muted);\n margin: 0;\n line-height: 1.45;\n }\n .neofaceid-consent-link {\n display: inline-block;\n font-size: 13px;\n color: var(--nfid-action);\n text-decoration: underline;\n margin-bottom: 20px;\n }\n .neofaceid-consent-link:hover { opacity: 0.85; }\n .neofaceid-consent-actions {\n display: flex;\n flex-direction: column;\n gap: 10px;\n }\n .neofaceid-consent-button {\n min-height: 44px;\n padding: 12px 20px;\n border-radius: var(--nfid-radius, 16px);\n border: none;\n font-size: 15px;\n font-weight: 600;\n cursor: pointer;\n transition: background 120ms ease-out, transform 120ms ease-out;\n font-family: inherit;\n }\n .neofaceid-consent-button-primary {\n background: var(--nfid-action);\n color: var(--nfid-action-text);\n }\n .neofaceid-consent-button-primary:hover { opacity: 0.92; }\n .neofaceid-consent-button-primary:focus-visible {\n outline: 2px solid var(--nfid-focus-ring);\n outline-offset: 2px;\n }\n .neofaceid-consent-button-ghost {\n background: transparent;\n color: var(--nfid-text-muted);\n }\n .neofaceid-consent-button-ghost:hover { background: var(--nfid-surface-muted); }\n .neofaceid-consent-footer {\n display: flex;\n justify-content: center;\n margin-top: 20px;\n padding-top: 16px;\n border-top: 1px solid var(--nfid-line);\n }\n .neofaceid-consent-seal {\n font-size: 10px;\n font-weight: 500;\n letter-spacing: 0.06em;\n text-transform: uppercase;\n color: var(--nfid-text-subtle);\n }\n @media (max-width: 640px) {\n .neofaceid-consent-modal { padding: 22px; border-radius: 16px; }\n .neofaceid-consent-title { font-size: 20px; }\n }\n @media (prefers-reduced-motion: reduce) {\n .neofaceid-consent-overlay,\n .neofaceid-consent-modal { animation: none; }\n }\n "}),o.jsx("div",{className:"neofaceid-root neofaceid-consent-overlay",role:"dialog","aria-modal":"true","aria-labelledby":"neofaceid-consent-title",children:o.jsxs("div",{className:"neofaceid-consent-modal",children:[o.jsxs("div",{className:"neofaceid-consent-header",children:[o.jsx("span",{className:"neofaceid-consent-appname",children:e}),o.jsx("span",{className:"neofaceid-consent-brand-caption",children:"NeoFaceID"})]}),o.jsx("h1",{id:"neofaceid-consent-title",className:"neofaceid-consent-title",children:s.title}),o.jsx("p",{className:"neofaceid-consent-duration",children:s.duration}),o.jsxs("div",{className:"neofaceid-consent-bullets",children:[o.jsxs("div",{className:"neofaceid-consent-bullet",children:[o.jsx("div",{className:"neofaceid-consent-bullet-icon",children:o.jsx(Di,{})}),o.jsxs("div",{children:[o.jsx("p",{className:"neofaceid-consent-bullet-title",children:s.bullet1Title}),o.jsx("p",{className:"neofaceid-consent-bullet-body",children:s.bullet1Body})]})]}),o.jsxs("div",{className:"neofaceid-consent-bullet",children:[o.jsx("div",{className:"neofaceid-consent-bullet-icon",children:o.jsx(Li,{})}),o.jsxs("div",{children:[o.jsx("p",{className:"neofaceid-consent-bullet-title",children:s.bullet2Title}),o.jsx("p",{className:"neofaceid-consent-bullet-body",children:s.bullet2Body})]})]}),o.jsxs("div",{className:"neofaceid-consent-bullet",children:[o.jsx("div",{className:"neofaceid-consent-bullet-icon",children:o.jsx(Mi,{})}),o.jsxs("div",{children:[o.jsx("p",{className:"neofaceid-consent-bullet-title",children:s.bullet3Title}),o.jsx("p",{className:"neofaceid-consent-bullet-body",children:s.bullet3Body})]})]})]}),o.jsxs("a",{href:t,target:"_blank",rel:"noopener noreferrer",className:"neofaceid-consent-link",children:["Ver política de privacidade (retenção de até ",r," dias)"]}),o.jsxs("div",{className:"neofaceid-consent-actions",children:[o.jsx("button",{type:"button",className:"neofaceid-consent-button neofaceid-consent-button-primary",onClick:a,children:s.primary}),o.jsx("button",{type:"button",className:"neofaceid-consent-button neofaceid-consent-button-ghost",onClick:i,children:"Agora não"})]}),o.jsx("div",{className:"neofaceid-consent-footer",children:o.jsx(mi,{})})]})})]})}class Ui{constructor(){i(this,"container",null),i(this,"root",null)}show(e){this.container||(la(),this.container=document.createElement("div"),this.container.id="neofaceid-consent-modal-container",document.body.appendChild(this.container),this.root=t.createRoot(this.container),this.root.render(o.jsx(qi,{...e,onAccept:()=>{this.close(),e.onAccept()},onDecline:()=>{this.close(),e.onDecline()}})))}close(){this.container&&document.body.contains(this.container)&&(this.root&&this.root.unmount(),document.body.removeChild(this.container),this.container=null,this.root=null)}}function Bi(e={}){const n=wa(),t=e.appName??n??"sua aplicação";e.appName;const o=e.flow??"verification";return new Promise((n=>{(new Ui).show({appName:t,flow:o,privacyPolicyUrl:e.privacyPolicyUrl??$i,retentionDays:e.retentionDays??90,onAccept:()=>n(!0),onDecline:()=>n(!1)})}))}const Wi={flow:"verification",privacyPolicyUrl:$i,retentionDays:90};function Vi(e,n={}){const t=n.darkThreshold??.235,o=n.improvementTarget??.12,r=n.sampleIntervalMs??600,a=n.minToggleMs??3e3,i=n.zIndex??10001,s=`nfid-flash-${Math.random().toString(36).slice(2,9)}`;let c=null,d=null,l=!1,u=0,p=0,f=0,h=null,m=null,g=null;const v=e=>{l!==e&&(l=e,e?m||"undefined"==typeof document||(m=document.createElement("div"),m.id=s,m.setAttribute("aria-hidden","true"),m.style.cssText=`\n position: fixed; inset: 0; background: #FFFFFF;\n z-index: ${i}; pointer-events: none;\n opacity: 0; transition: opacity 200ms ease-out;\n `,document.body.appendChild(m),requestAnimationFrame((()=>{m&&(m.style.opacity="1")}))):(()=>{if(!m)return;const e=m;m=null,e.style.opacity="0",setTimeout((()=>{e.parentNode&&e.parentNode.removeChild(e)}),220)})(),n.onChange&&n.onChange(e,u))},b=()=>{"undefined"==typeof document||g||(g=document.createElement("canvas"));const n=ei(e(),{scratch:g??void 0});u=n;const r=Date.now();l||(n>0&&n<t?p+=1:p=0,p>=2&&r-f>=a&&(h=n,f=r,p=0,v(!0),d=setTimeout((()=>{ei(e(),{scratch:g??void 0})-(h??0)<o&&(f=Date.now(),v(!1)),h=null}),600)))};return{start(){!1!==n.enabled&&(c||(b(),c=setInterval(b,r)))},stop(){c&&(clearInterval(c),c=null),d&&(clearTimeout(d),d=null),v(!1),p=0,h=null},destroy(){this.stop(),g=null},get flashOn(){return l},get lastBrightness(){return u}}}class Zi{constructor(e){i(this,"modal",null),i(this,"video",null),i(this,"canvas",null),i(this,"stream",null),i(this,"options"),i(this,"countdownInterval",null),i(this,"isCapturing",!1),i(this,"flashController",null),this.options=e}async open(){try{await this.createModal(),await this.initializeCamera(),this.enableCaptureButton(),!1!==this.options.autoLighting&&(this.flashController=Vi((()=>this.video)),this.flashController.start())}catch(e){this.options.onError(new h(`Erro ao inicializar câmera: ${e.message}`,f.CAMERA_ERROR))}}close(){this.cleanup(),this.modal&&(document.body.removeChild(this.modal),this.modal=null)}async createModal(){this.modal=document.createElement("div"),this.modal.className="neofaceid-root neofaceid-biometric-modal";const e=this.options.title||this.getDefaultTitle(),n=this.options.subtitle||this.getDefaultSubtitle();this.modal.innerHTML=`\n <div class="neofaceid-modal-overlay">\n <div class="neofaceid-modal-content">\n <div class="neofaceid-modal-header">\n <h2>${e}</h2>\n <button class="neofaceid-close-btn" type="button" aria-label="Fechar">×</button>\n </div>\n <div class="neofaceid-modal-body">\n <p class="neofaceid-subtitle">${n}</p>\n <div class="neofaceid-camera-container">\n <video class="neofaceid-video" autoplay muted playsinline></video>\n <canvas class="neofaceid-canvas" style="display: none;"></canvas>\n <div class="neofaceid-overlay">\n <div class="neofaceid-frame"></div>\n </div>\n </div>\n <div class="neofaceid-status">\n <p class="neofaceid-status-text">Posicione-se na frente da câmera</p>\n </div>\n </div>\n <div class="neofaceid-modal-footer">\n <button class="neofaceid-cancel-btn" type="button">Cancelar</button>\n <button class="neofaceid-capture-btn" type="button" disabled>Capturar</button>\n </div>\n <div class="neofaceid-seal-row">\n ${gi()}\n </div>\n </div>\n </div>\n `,la(),this.addStyles(),this.addEventListeners(),document.body.appendChild(this.modal)}async initializeCamera(){if(!this.modal)throw new Error("Modal não inicializado");if(this.video=this.modal.querySelector(".neofaceid-video"),this.canvas=this.modal.querySelector(".neofaceid-canvas"),!this.video||!this.canvas)throw new Error("Elementos de vídeo ou canvas não encontrados");try{this.stream=await navigator.mediaDevices.getUserMedia({video:{width:{ideal:640},height:{ideal:480},facingMode:"user"},audio:!1}),this.video.srcObject=this.stream,await this.video.play(),this.canvas.width=this.video.videoWidth,this.canvas.height=this.video.videoHeight}catch(e){throw new Error(`Não foi possível acessar a câmera: ${e.message}`)}}enableCaptureButton(){if(!this.modal)return;const e=this.modal.querySelector(".neofaceid-capture-btn"),n=this.modal.querySelector(".neofaceid-status-text");e&&(e.disabled=!1,e.textContent="Capturar"),n&&(n.textContent="Pronto para capturar"),"auto"===this.options.mode&&setTimeout((()=>this.captureImage()),300)}async captureImage(){if(!this.isCapturing&&this.video&&this.canvas){this.isCapturing=!0;try{const e=this.canvas.getContext("2d");if(!e)throw new Error("Não foi possível obter contexto do canvas");e.drawImage(this.video,0,0,this.canvas.width,this.canvas.height);const n=this.canvas.toDataURL("image/jpeg",.8).split(",")[1],t=`data:image/jpeg;base64,${n}`,o="auto"===this.options.mode?await this.detectBiometricType(n):this.options.mode;this.close(),this.options.onSuccess(t,o)}catch(e){this.options.onError(new h(`Erro ao capturar imagem: ${e.message}`,f.CAPTURE_ERROR))}finally{this.isCapturing=!1}}}async detectBiometricType(e){try{const{detectBiometricType:n}=await Promise.resolve().then((()=>ds)),t=await n(e);return"unknown"!==t.type&&t.confidence>.6?t.type:"face"}catch(n){return"face"}}addEventListeners(){if(!this.modal)return;const e=this.modal.querySelector(".neofaceid-close-btn"),n=this.modal.querySelector(".neofaceid-cancel-btn"),t=this.modal.querySelector(".neofaceid-capture-btn");null==e||e.addEventListener("click",(()=>{var e,n;this.close(),null==(n=(e=this.options).onCancel)||n.call(e)})),null==n||n.addEventListener("click",(()=>{var e,n;this.close(),null==(n=(e=this.options).onCancel)||n.call(e)})),null==t||t.addEventListener("click",(()=>{this.captureImage()})),this.modal.addEventListener("click",(e=>{var n,t,o;e.target===(null==(n=this.modal)?void 0:n.querySelector(".neofaceid-modal-overlay"))&&(this.close(),null==(o=(t=this.options).onCancel)||o.call(t))}))}cleanup(){this.flashController&&(this.flashController.destroy(),this.flashController=null),this.stream&&(this.stream.getTracks().forEach((e=>e.stop())),this.stream=null),this.countdownInterval&&(clearInterval(this.countdownInterval),this.countdownInterval=null),this.video=null,this.canvas=null,this.isCapturing=!1}getDefaultTitle(){switch(this.options.mode){case"face":return"Autenticação Facial";case"hand":return"Autenticação por Mão";case"auto":return"Autenticação Biométrica";default:return"Captura Biométrica"}}getDefaultSubtitle(){switch(this.options.mode){case"face":return"Posicione seu rosto dentro do quadro e aguarde a captura automática.";case"hand":return"Posicione sua mão dentro do quadro e aguarde a captura automática.";case"auto":return"Posicione seu rosto ou mão dentro do quadro para autenticação automática.";default:return"Posicione-se dentro do quadro para captura."}}addStyles(){const e="neofaceid-biometric-modal-styles",n=document.getElementById(e);n&&n.remove(),ua(e,"\n .neofaceid-biometric-modal {\n position: fixed;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n z-index: 10000;\n font-family: inherit;\n }\n\n .neofaceid-modal-overlay {\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n background: rgba(0, 0, 0, 0.8);\n display: flex;\n align-items: center;\n justify-content: center;\n padding: 20px;\n box-sizing: border-box;\n }\n\n .neofaceid-modal-content {\n background: white;\n border-radius: 12px;\n max-width: 600px;\n width: 100%;\n max-height: 90vh;\n overflow: hidden;\n box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);\n }\n\n .neofaceid-modal-header {\n padding: 20px;\n border-bottom: 1px solid #e0e0e0;\n display: flex;\n justify-content: space-between;\n align-items: center;\n }\n\n .neofaceid-modal-header h2 {\n margin: 0;\n font-size: 24px;\n font-weight: 600;\n color: #333;\n }\n\n .neofaceid-close-btn {\n background: none;\n border: none;\n font-size: 22px;\n cursor: pointer;\n color: #666;\n padding: 0;\n min-width: 44px;\n min-height: 44px;\n display: flex;\n align-items: center;\n justify-content: center;\n border-radius: 22px;\n transition: background-color 0.2s;\n }\n .neofaceid-close-btn:focus-visible {\n outline: 2px solid var(--nfid-focus-ring);\n outline-offset: 2px;\n }\n\n .neofaceid-close-btn:hover {\n background-color: #f0f0f0;\n }\n\n .neofaceid-modal-body {\n padding: 20px;\n }\n\n .neofaceid-subtitle {\n margin: 0 0 20px 0;\n color: #666;\n font-size: 16px;\n line-height: 1.4;\n }\n\n .neofaceid-camera-container {\n position: relative;\n background: #000;\n border-radius: 8px;\n overflow: hidden;\n aspect-ratio: 4/3;\n margin-bottom: 20px;\n }\n\n .neofaceid-video {\n width: 100%;\n height: 100%;\n object-fit: cover;\n }\n\n .neofaceid-canvas {\n position: absolute;\n top: 0;\n left: 0;\n }\n\n .neofaceid-overlay {\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n display: flex;\n align-items: center;\n justify-content: center;\n }\n\n .neofaceid-frame {\n width: 200px;\n height: 200px;\n border: 3px solid #0E9F6E;\n border-radius: 50%;\n box-shadow: 0 0 0 2px rgba(76, 175, 80, 0.3);\n animation: pulse 2s infinite;\n }\n\n .neofaceid-seal-row {\n display: flex;\n justify-content: center;\n padding: 12px 20px 16px;\n border-top: 1px solid var(--nfid-line, #E6ECF4);\n }\n .neofaceid-seal {\n font-size: 10px;\n font-weight: 500;\n letter-spacing: 0.06em;\n text-transform: uppercase;\n color: var(--nfid-text-subtle, #617489);\n }\n\n .neofaceid-status {\n text-align: center;\n margin-bottom: 20px;\n }\n\n .neofaceid-status-text {\n margin: 0;\n color: #666;\n font-size: 16px;\n }\n\n .neofaceid-modal-footer {\n padding: 20px;\n border-top: 1px solid #e0e0e0;\n display: flex;\n gap: 12px;\n justify-content: flex-end;\n }\n\n .neofaceid-cancel-btn,\n .neofaceid-capture-btn {\n padding: 12px 24px;\n border: none;\n border-radius: 6px;\n font-size: 16px;\n font-weight: 500;\n cursor: pointer;\n transition: all 0.2s;\n }\n\n .neofaceid-cancel-btn {\n background: #f5f5f5;\n color: #666;\n }\n\n .neofaceid-cancel-btn:hover {\n background: #e0e0e0;\n }\n\n .neofaceid-capture-btn {\n background: #0E9F6E;\n color: white;\n }\n\n .neofaceid-capture-btn:hover:not(:disabled) {\n background: #45a049;\n }\n\n .neofaceid-capture-btn:disabled {\n background: #ccc;\n cursor: not-allowed;\n }\n\n @keyframes pulse {\n 0% { box-shadow: 0 0 0 2px rgba(76, 175, 80, 0.3); }\n 50% { box-shadow: 0 0 0 10px rgba(76, 175, 80, 0.1); }\n 100% { box-shadow: 0 0 0 2px rgba(76, 175, 80, 0.3); }\n }\n\n @media (max-width: 640px) {\n .neofaceid-modal-overlay {\n padding: 10px;\n }\n \n .neofaceid-modal-header,\n .neofaceid-modal-body,\n .neofaceid-modal-footer {\n padding: 15px;\n }\n \n .neofaceid-frame {\n width: 150px;\n height: 150px;\n }\n }\n ")}}class Ki{constructor(){i(this,"container",null),i(this,"currentStatus","preparing")}getStyles(){return"\n @keyframes neofaceid-fadeIn {\n from { opacity: 0; transform: scale(0.9); }\n to { opacity: 1; transform: scale(1); }\n }\n\n @keyframes neofaceid-fadeOut {\n from { opacity: 1; transform: scale(1); }\n to { opacity: 0; transform: scale(0.9); }\n }\n\n @keyframes neofaceid-pulse {\n 0%, 100% { \n transform: scale(1);\n opacity: 1;\n }\n 50% { \n transform: scale(1.05);\n opacity: 0.9;\n }\n }\n\n @keyframes neofaceid-scaleIn {\n 0% { transform: scale(0); opacity: 0; }\n 50% { transform: scale(1.1); }\n 100% { transform: scale(1); opacity: 1; }\n }\n\n @keyframes neofaceid-errorShake {\n 0%, 100% { transform: translateX(0); }\n 10%, 30%, 50%, 70%, 90% { transform: translateX(-4px); }\n 20%, 40%, 60%, 80% { transform: translateX(4px); }\n }\n\n .neofaceid-overlay-container {\n position: fixed;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n display: flex;\n align-items: center;\n justify-content: center;\n z-index: 10000;\n pointer-events: none;\n animation: neofaceid-fadeIn 0.3s ease-out;\n font-family: inherit;\n }\n\n .neofaceid-overlay-container.fade-out {\n animation: neofaceid-fadeOut 0.3s ease-out forwards;\n }\n\n .neofaceid-overlay-content {\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n gap: 24px;\n pointer-events: auto;\n }\n\n .neofaceid-visual-wrapper {\n position: relative;\n width: 100px;\n height: 100px;\n display: flex;\n align-items: center;\n justify-content: center;\n }\n\n .neofaceid-logo {\n width: 80px;\n height: 80px;\n object-fit: contain;\n transition: all 0.5s ease;\n filter: drop-shadow(0 4px 12px rgba(0, 89, 196, 0.3));\n }\n\n /* Cores por estado */\n .neofaceid-state-preparing .neofaceid-logo { filter: drop-shadow(0 0 15px rgba(0, 89, 196, 0.4)); }\n .neofaceid-state-detecting .neofaceid-logo { filter: hue-rotate(180deg) drop-shadow(0 0 15px rgba(59, 130, 246, 0.6)); }\n .neofaceid-state-waiting-for-face .neofaceid-logo { filter: hue-rotate(30deg) drop-shadow(0 0 15px rgba(251, 146, 60, 0.6)); }\n .neofaceid-state-capturing .neofaceid-logo { filter: hue-rotate(45deg) drop-shadow(0 0 15px rgba(245, 158, 11, 0.6)); }\n .neofaceid-state-verifying .neofaceid-logo { filter: hue-rotate(90deg) drop-shadow(0 0 15px rgba(34, 197, 94, 0.6)); }\n\n .neofaceid-logo.pulsing {\n animation: neofaceid-pulse 2s ease-in-out infinite;\n }\n\n @keyframes neofaceid-dots {\n 0%, 20% { opacity: 0; transform: translateY(0); }\n 50% { opacity: 1; transform: translateY(-2px); }\n 80%, 100% { opacity: 0; transform: translateY(0); }\n }\n\n .neofaceid-status-text {\n font-size: 15px;\n font-weight: 500;\n color: #ffffff;\n text-align: center;\n padding: 10px 24px;\n background: rgba(15, 23, 42, 0.8);\n backdrop-filter: blur(8px);\n border-radius: 100px;\n box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);\n border: 1px solid rgba(255, 255, 255, 0.1);\n text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);\n animation: neofaceid-fadeIn 0.3s ease-out;\n display: flex;\n align-items: center;\n gap: 2px;\n }\n\n .neofaceid-dots {\n display: inline-flex;\n margin-left: 2px;\n }\n\n .neofaceid-dot {\n animation: neofaceid-dots 1.5s infinite;\n opacity: 0;\n }\n\n .neofaceid-dot:nth-child(2) { animation-delay: 0.2s; }\n .neofaceid-dot:nth-child(3) { animation-delay: 0.4s; }\n\n .neofaceid-status-icon {\n position: absolute;\n inset: 0;\n display: flex;\n align-items: center;\n justify-content: center;\n }\n\n .neofaceid-success-icon {\n width: 80px;\n height: 80px;\n color: #0E9F6E;\n animation: neofaceid-scaleIn 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);\n }\n\n .neofaceid-error-icon {\n width: 80px;\n height: 80px;\n color: #ef4444;\n animation: neofaceid-errorShake 0.5s linear, neofaceid-scaleIn 0.4s ease-out;\n }\n "}getStatusText(){switch(this.currentStatus){case"preparing":return"Iniciando câmera";case"detecting":return"Posicione seu rosto";case"waiting-for-face":return"Aguardando rosto";case"capturing":return"Capturando";case"verifying":return"Verificando identidade";case"success":return"Identificado!";case"error":return"Falha na identificação";default:return""}}renderContent(){const e=["detecting","waiting-for-face","verifying"].includes(this.currentStatus),n=!["success","error"].includes(this.currentStatus),t="success"===this.currentStatus,o="error"===this.currentStatus,r=this.getStatusText(),a=["preparing","detecting","waiting-for-face","capturing","verifying"].includes(this.currentStatus);return`\n <style>${this.getStyles()}</style>\n <div class="neofaceid-overlay-container neofaceid-state-${this.currentStatus}">\n <div class="neofaceid-overlay-content">\n <div class="neofaceid-visual-wrapper">\n ${n?`<span class="neofaceid-logo ${e?"pulsing":""}" style="display:inline-flex;align-items:center;justify-content:center;color:currentColor;">${function(e=18){return`<span class="neoface-brand-mark" style="display:inline-flex;align-items:center;justify-content:center;width:${e}px;height:${e}px;color:currentColor;">${ci}</span>`}(48).replace("width:18px;height:18px","width:100%;height:100%")}</span>`:""}\n \n ${t?'\n <div class="neofaceid-status-icon">\n <svg class="neofaceid-success-icon" viewBox="0 0 60 60" fill="none" xmlns="http://www.w3.org/2000/svg">\n <circle cx="30" cy="30" r="28" stroke="currentColor" stroke-width="3" fill="none"/>\n <path d="M15 30 L25 40 L45 20" stroke="currentColor" stroke-width="3" stroke-linecap="round" stroke-linejoin="round" fill="none"/>\n </svg>\n </div>\n ':""}\n \n ${o?'\n <div class="neofaceid-status-icon">\n <svg class="neofaceid-error-icon" viewBox="0 0 60 60" fill="none" xmlns="http://www.w3.org/2000/svg">\n <circle cx="30" cy="30" r="28" stroke="currentColor" stroke-width="3" fill="none"/>\n <path d="M20 20 L40 40 M40 20 L20 40" stroke="currentColor" stroke-width="3" stroke-linecap="round"/>\n </svg>\n </div>\n ':""}\n </div>\n \n ${r?`\n <div class="neofaceid-status-text">\n ${r}${a?'\n <span class="neofaceid-dots">\n <span class="neofaceid-dot">.</span>\n <span class="neofaceid-dot">.</span>\n <span class="neofaceid-dot">.</span>\n </span>\n ':""}\n </div>\n `:""}\n </div>\n </div>\n `}show(e="preparing"){this.container?this.updateStatus(e):(this.container=document.createElement("div"),this.container.id="neofaceid-status-overlay",this.currentStatus=e,this.container.innerHTML=this.renderContent(),document.body.appendChild(this.container))}updateStatus(e){this.currentStatus=e,this.container&&(this.container.innerHTML=this.renderContent())}close(){if(this.container){const e=this.container.querySelector(".neofaceid-overlay-container");e&&e.classList.add("fade-out"),setTimeout((()=>{this.container&&document.body.contains(this.container)&&document.body.removeChild(this.container),this.container=null}),300)}}}function Ji({error:e,onRetry:n,onCredentials:t,onCancel:r,applicationToken:a}){return o.jsxs(o.Fragment,{children:[o.jsx("style",{children:"\n @keyframes slideUp {\n from {\n opacity: 0;\n transform: translateY(20px);\n }\n to {\n opacity: 1;\n transform: translateY(0);\n }\n }\n\n @keyframes fadeIn {\n from { opacity: 0; }\n to { opacity: 1; }\n }\n\n .neofaceid-fallback-overlay {\n position: fixed;\n inset: 0;\n background: var(--nfid-overlay);\n backdrop-filter: blur(3px);\n -webkit-backdrop-filter: blur(3px);\n display: flex;\n align-items: center;\n justify-content: center;\n z-index: 10001;\n padding: 20px;\n animation: fadeIn 0.3s ease-out;\n font-family: inherit;\n }\n\n .neofaceid-fallback-prompt {\n background: var(--nfid-surface);\n border-radius: var(--nfid-radius, 16px);\n padding: 28px;\n max-width: 400px;\n width: 100%;\n box-shadow: 0 1px 3px rgba(10, 19, 32, 0.08);\n animation: slideUp 0.32s cubic-bezier(.2,0,0,1);\n text-align: center;\n box-sizing: border-box;\n }\n\n /* Falha de captura é atenção (dourado), nunca crítico (vermelho). */\n .neofaceid-fallback-icon {\n width: 56px;\n height: 56px;\n margin: 0 auto 20px;\n color: #F1BE00;\n }\n\n .neofaceid-fallback-title {\n font-size: 20px;\n font-weight: 700;\n color: var(--nfid-text);\n margin: 0 0 8px 0;\n line-height: 1.25;\n }\n\n .neofaceid-fallback-message {\n font-size: 14px;\n color: var(--nfid-text-muted);\n margin: 0 0 24px 0;\n line-height: 1.5;\n }\n\n .neofaceid-fallback-actions {\n display: flex;\n flex-direction: column;\n gap: 10px;\n }\n\n .neofaceid-fallback-button {\n min-height: 44px;\n padding: 12px 20px;\n border-radius: var(--nfid-radius, 16px);\n border: none;\n font-size: 15px;\n font-weight: 600;\n cursor: pointer;\n transition: background 120ms ease-out;\n font-family: inherit;\n }\n\n .neofaceid-fallback-button-primary {\n background: var(--nfid-action);\n color: var(--nfid-action-text);\n }\n .neofaceid-fallback-button-primary:hover { opacity: 0.92; }\n .neofaceid-fallback-button-primary:focus-visible {\n outline: 2px solid var(--nfid-focus-ring);\n outline-offset: 2px;\n }\n\n .neofaceid-fallback-button-secondary {\n background: var(--nfid-surface-muted);\n color: var(--nfid-text);\n border: 1px solid var(--nfid-line);\n }\n .neofaceid-fallback-button-secondary:hover { opacity: 0.9; }\n\n .neofaceid-fallback-button-ghost {\n background: transparent;\n color: var(--nfid-text-muted);\n min-height: 44px;\n padding: 10px;\n }\n .neofaceid-fallback-button-ghost:hover {\n background: var(--nfid-surface-muted);\n }\n\n @media (max-width: 640px) {\n .neofaceid-fallback-prompt {\n padding: 22px;\n }\n .neofaceid-fallback-title {\n font-size: 18px;\n }\n }\n "}),o.jsx("div",{className:"neofaceid-root neofaceid-fallback-overlay",role:"dialog","aria-modal":"true",children:o.jsxs("div",{className:"neofaceid-fallback-prompt",children:[o.jsx("div",{className:"neofaceid-fallback-icon","aria-hidden":"true",children:o.jsxs("svg",{viewBox:"0 0 64 64",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[o.jsx("path",{d:"M32 8 L58 54 H6 Z",stroke:"currentColor",strokeWidth:"3",strokeLinecap:"round",strokeLinejoin:"round",fill:"none"}),o.jsx("path",{d:"M32 26 V38",stroke:"currentColor",strokeWidth:"3",strokeLinecap:"round"}),o.jsx("circle",{cx:"32",cy:"45",r:"2",fill:"currentColor"})]})}),o.jsx("h3",{className:"neofaceid-fallback-title",children:"Vamos tentar de outro jeito"}),o.jsx("p",{className:"neofaceid-fallback-message",children:(null==e?void 0:e.getFriendlyMessage())||"Não conseguimos reconhecer sua face. Tente novamente ou use email e senha."}),o.jsxs("div",{className:"neofaceid-fallback-actions",children:[o.jsx("button",{type:"button",className:"neofaceid-fallback-button neofaceid-fallback-button-primary",onClick:n,children:"Tentar Novamente"}),o.jsx("button",{type:"button",className:"neofaceid-fallback-button neofaceid-fallback-button-secondary",onClick:t,children:"Entrar com Email e Senha"}),a&&o.jsx("button",{type:"button",className:"neofaceid-fallback-button neofaceid-fallback-button-ghost",onClick:()=>{new vi(a).open()},children:"Esqueceu sua senha?"}),r&&o.jsx("button",{type:"button",className:"neofaceid-fallback-button neofaceid-fallback-button-ghost",onClick:r,children:"Cancelar"})]})]})})]})}class Gi{constructor(){i(this,"container",null),i(this,"root",null)}show(e,n,o,r,a){this.container||(la(),this.container=document.createElement("div"),this.container.id="neofaceid-fallback-prompt",document.body.appendChild(this.container),this.root=t.createRoot(this.container),this.render(e,n,o,r,a))}close(){this.container&&document.body.contains(this.container)&&(this.root&&this.root.unmount(),document.body.removeChild(this.container),this.container=null,this.root=null)}render(e,n,t,r,a){this.root&&this.container&&this.root.render(o.jsx(Ji,{error:e,onRetry:()=>{this.close(),n()},onCredentials:()=>{this.close(),t()},applicationToken:a??"",onCancel:()=>{this.close(),null==r||r()}}))}}class Hi{constructor(e){i(this,"options"),i(this,"modalElement",null),this.options=e}async open(){this.createModal(),document.body.appendChild(this.modalElement)}close(){this.modalElement&&(document.body.removeChild(this.modalElement),this.modalElement=null),this.options.onCancel&&this.options.onCancel()}createModal(){la(),this.addStyles(),this.modalElement=document.createElement("div"),this.modalElement.className="neofaceid-root neoface-email-password-modal",this.modalElement.innerHTML=`\n <div class="neoface-email-modal-overlay">\n <div class="neoface-email-modal-content">\n <h2>${this.options.title||"Login com Email e Senha"}</h2>\n <p>${this.options.subtitle||"Informe seus dados para login."}</p>\n <div id="login-error" class="neoface-email-error" style="display:none"></div>\n <form id="email-password-form">\n <input type="email" id="email" placeholder="Email" required />\n <input type="password" id="password" placeholder="Senha" required />\n <button type="submit" class="neoface-email-submit-btn">Entrar</button>\n </form>\n <button class="neoface-email-cancel-btn">Cancelar</button>\n \n \x3c!-- Branding --\x3e\n <div class="neoface-email-branding">\n ${gi()}\n </div>\n </div>\n </div>\n `;this.modalElement.querySelector("#email-password-form").addEventListener("submit",this.handleSubmit.bind(this));this.modalElement.querySelector(".neoface-email-cancel-btn").addEventListener("click",this.close.bind(this))}addStyles(){const e="neoface-email-password-modal-styles";document.getElementById(e)||ua(e,"\n .neoface-email-password-modal {\n position: fixed;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n z-index: 10002;\n font-family: inherit;\n }\n\n .neoface-email-modal-overlay {\n position: absolute;\n inset: 0;\n background: rgba(0, 0, 0, 0.6);\n backdrop-filter: blur(8px);\n display: flex;\n align-items: center;\n justify-content: center;\n padding: 20px;\n animation: fadeIn 0.3s ease-out;\n }\n\n @keyframes fadeIn {\n from { opacity: 0; }\n to { opacity: 1; }\n }\n\n @keyframes slideUp {\n from {\n opacity: 0;\n transform: translateY(20px);\n }\n to {\n opacity: 1;\n transform: translateY(0);\n }\n }\n\n .neoface-email-modal-content {\n background: linear-gradient(135deg, #0A1320 0%, #111C2B 100%);\n border-radius: 20px;\n padding: 32px;\n max-width: 400px;\n width: 100%;\n box-shadow: 0 24px 48px rgba(0, 0, 0, 0.4), 0 0 0 1px rgba(255, 255, 255, 0.1);\n animation: slideUp 0.4s ease-out;\n }\n\n .neoface-email-modal-content h2 {\n font-size: 24px;\n font-weight: 700;\n color: white;\n margin: 0 0 12px 0;\n text-align: center;\n }\n\n .neoface-email-modal-content p {\n font-size: 15px;\n color: rgba(255, 255, 255, 0.7);\n margin: 0 0 24px 0;\n text-align: center;\n line-height: 1.5;\n }\n\n .neoface-email-modal-content form {\n display: flex;\n flex-direction: column;\n gap: 16px;\n margin-bottom: 16px;\n }\n\n .neoface-email-modal-content input {\n width: 100%;\n padding: 14px 16px;\n border: 2px solid rgba(255, 255, 255, 0.2);\n border-radius: 12px;\n font-size: 15px;\n background: rgba(255, 255, 255, 0.1);\n color: white;\n font-family: inherit;\n transition: all 0.2s;\n box-sizing: border-box;\n }\n\n .neoface-email-modal-content input::placeholder {\n color: rgba(255, 255, 255, 0.5);\n }\n\n .neoface-email-modal-content input:focus {\n outline: none;\n border-color: #0059C4;\n box-shadow: 0 0 0 3px rgba(0, 89, 196, 0.2);\n background: rgba(255, 255, 255, 0.15);\n }\n\n .neoface-email-submit-btn {\n width: 100%;\n padding: 14px 24px;\n border-radius: 12px;\n border: none;\n background: linear-gradient(135deg, #0059C4 0%, #00449A 100%);\n color: white;\n font-size: 16px;\n font-weight: 600;\n cursor: pointer;\n transition: all 0.2s;\n box-shadow: 0 4px 16px rgba(0, 89, 196, 0.3);\n font-family: inherit;\n }\n\n .neoface-email-submit-btn:hover {\n transform: translateY(-2px);\n box-shadow: 0 8px 24px rgba(0, 89, 196, 0.4);\n }\n\n .neoface-email-submit-btn:active {\n transform: translateY(0);\n }\n\n .neoface-email-submit-btn:disabled {\n opacity: 0.6;\n cursor: not-allowed;\n transform: none;\n }\n\n .neoface-email-cancel-btn {\n width: 100%;\n padding: 12px 24px;\n border-radius: 12px;\n border: 1px solid rgba(255, 255, 255, 0.2);\n background: transparent;\n color: rgba(255, 255, 255, 0.7);\n font-size: 15px;\n font-weight: 600;\n cursor: pointer;\n transition: all 0.2s;\n font-family: inherit;\n }\n\n .neoface-email-cancel-btn:hover {\n background: rgba(255, 255, 255, 0.1);\n color: white;\n border-color: rgba(255, 255, 255, 0.3);\n }\n\n .neoface-email-branding {\n display: flex;\n align-items: center;\n justify-content: center;\n gap: 8px;\n margin-top: 32px;\n padding-top: 24px;\n border-top: 1px solid rgba(255, 255, 255, 0.1);\n font-size: 13px;\n color: rgba(255, 255, 255, 0.5);\n }\n\n .neoface-email-brand-logo {\n height: 20px;\n width: auto;\n }\n\n .neoface-email-brand-name {\n font-weight: 600;\n font-family: inherit;\n color: #ffffff;\n letter-spacing: 0.3px;\n }\n\n .neoface-email-error {\n background: rgba(239, 68, 68, 0.15);\n border: 1px solid rgba(239, 68, 68, 0.4);\n border-radius: 10px;\n color: #fca5a5;\n font-size: 14px;\n padding: 12px 16px;\n margin-bottom: 16px;\n text-align: center;\n animation: fadeIn 0.2s ease-out;\n }\n\n @media (max-width: 640px) {\n .neoface-email-modal-content {\n padding: 24px;\n border-radius: 16px;\n }\n\n .neoface-email-modal-content h2 {\n font-size: 20px;\n }\n }\n ")}async handleSubmit(e){e.preventDefault();const n=this.modalElement.querySelector("#email"),t=this.modalElement.querySelector("#password"),o=this.modalElement.querySelector(".neoface-email-submit-btn"),r=this.modalElement.querySelector("#login-error"),a=e=>{r.textContent=e,r.style.display="block"};r.style.display="none",r.textContent="";const i=n.value.trim(),s=t.value.trim();if(i&&s){o.disabled=!0,o.textContent="Entrando...";try{const e=await Ma(i,s,this.options.applicationToken);this.options.onSuccess(e),this.close()}catch(c){o.disabled=!1,o.textContent="Entrar";c instanceof h&&(c.type===f.INVALID_TOKEN||c.type===f.API_ERROR&&c.message.includes("400"))?(a("Email ou senha incorretos. Verifique seus dados e tente novamente."),t.value="",t.focus()):(a("Ocorreu um erro inesperado. Tente novamente mais tarde."),this.options.onError(c))}}else a("Preencha o email e a senha para continuar.")}}let Xi=!1,Yi=null;async function Qi(){if(!Xi)return Yi||(Yi=(async()=>{try{const e="/models";await d.nets.tinyFaceDetector.loadFromUri(e),Xi=!0}catch(e){}})(),Yi)}async function es(e,n,t=!1,o=!1){o?n.updateStatus("detecting"):n.updateStatus("preparing");const r=document.createElement("video");r.style.position="fixed",r.style.top="-9999px",r.style.left="-9999px",r.style.width="1px",r.style.height="1px",r.style.opacity="0",r.muted=!0,r.playsInline=!0,r.setAttribute("autoplay",""),r.setAttribute("playsinline",""),document.body.appendChild(r);let a=null;try{try{a=await navigator.mediaDevices.getUserMedia({video:{width:{ideal:640},height:{ideal:480},facingMode:"user"},audio:!1})}catch{a=await navigator.mediaDevices.getUserMedia({video:{facingMode:"user"},audio:!1})}r.srcObject=a,await new Promise((e=>{if(r.readyState>=1)e();else{const n=()=>{r.removeEventListener("loadedmetadata",n),e()};r.addEventListener("loadedmetadata",n),setTimeout(e,2e3)}})),await r.play(),await new Promise((e=>{if(r.videoWidth&&r.videoHeight)e();else{const n=()=>{r.videoWidth&&r.videoHeight?e():setTimeout(n,100)};setTimeout(e,3e3),n()}})),n.updateStatus("detecting"),await new Promise((e=>setTimeout(e,100)));let o=!0;if(t||(o=await async function(e,n=5e3,t=100,o){return new Promise((r=>{let a=0;const i=Math.ceil(n/t);let s=null,c=!1,l=!1;const u=Math.ceil(3e3/t),p=e=>{c||(c=!0,s&&clearTimeout(s),r(e))},f=async()=>{if(!c){if(a++,!Xi)return o&&!l&&a>=u&&(o.updateStatus("waiting-for-face"),l=!0),a>=i?void p(!1):void(s=window.setTimeout(f,t));try{if(await d.detectSingleFace(e,new d.TinyFaceDetectorOptions({inputSize:160,scoreThreshold:.3})))return o&&l&&(o.updateStatus("detecting"),l=!1),void p(!0);if(o&&!l&&a>=u&&(o.updateStatus("waiting-for-face"),l=!0),a>=i)return void p(!1);s=window.setTimeout(f,t)}catch(n){if(o&&!l&&a>=u&&(o.updateStatus("waiting-for-face"),l=!0),a>=i)return void p(!1);s=window.setTimeout(f,t)}}};window.setTimeout((()=>{c||p(!1)}),n+500),f()}))}(r,5e3,100,n)),!o)throw a&&a.getTracks().forEach((e=>e.stop())),r.parentElement&&r.parentElement.removeChild(r),new h("Nenhum rosto detectado. Por favor, posicione seu rosto na frente da câmera e tente novamente.",f.VALIDATION_ERROR);n.updateStatus("capturing");const i=document.createElement("canvas");i.width=r.videoWidth,i.height=r.videoHeight;const s=i.getContext("2d");if(!s)throw a&&a.getTracks().forEach((e=>e.stop())),r.parentElement&&r.parentElement.removeChild(r),new h("Erro ao capturar imagem",f.CAPTURE_ERROR);s.drawImage(r,0,0,i.width,i.height),a&&a.getTracks().forEach((e=>e.stop())),r.parentElement&&r.parentElement.removeChild(r);const c=await new Promise(((e,n)=>{i.toBlob((t=>{i.remove(),t?e(t):n(new Error("Failed to capture image"))}),"image/jpeg",.85)}));n.updateStatus("verifying");const l=await ja(c,e);if(!l.success)throw new h("Login falhou",f.LOGIN_FAILED);return l}catch(i){if(a&&a.getTracks().forEach((e=>e.stop())),r.parentElement&&r.parentElement.removeChild(r),i instanceof h)throw i;throw new h(i instanceof Error?i.message:"Erro desconhecido",f.UNKNOWN)}}async function ns(e){const{applicationToken:n,onSuccess:t,onError:o,onFallbackRequest:r,onCancel:a,fastMode:i=!1}=e,s=new Ki,c=new Gi;let d,l=0;Xi||i||Qi().catch((()=>{})),s.show("preparing");const u=async()=>{try{l++;const e=await es(n,s,i,l>1);s.updateStatus("success"),setTimeout((()=>{s.close(),t(e)}),200)}catch(e){d=e instanceof h?e:new h(e instanceof Error?e.message:"Erro desconhecido",f.UNKNOWN),s.updateStatus("error"),l<2?setTimeout((()=>{u()}),500):setTimeout((()=>{s.close(),c.show(d,(()=>{l=0,s.show("preparing"),setTimeout((()=>u()),500)}),(()=>{r?r():o(new h("Por favor, use email e senha para fazer login",f.LOGIN_FAILED))}),a,n)}),500)}};u()}const ts=Object.freeze(Object.defineProperty({__proto__:null,captureFaceSilently:async function(){return new Promise(((e,n)=>{const t=document.createElement("video");t.style.position="fixed",t.style.top="-9999px",t.style.left="-9999px",t.style.width="1px",t.style.height="1px",t.style.opacity="0",t.muted=!0,t.playsInline=!0,t.setAttribute("autoplay",""),t.setAttribute("playsinline","");const o=document.createElement("canvas");o.style.display="none";let r=null,a=0;const i=()=>{r&&r.getTracks().forEach((e=>e.stop())),t.parentElement&&t.parentElement.removeChild(t),o.parentElement&&o.parentElement.removeChild(o)};document.body.appendChild(t),document.body.appendChild(o);const s=e=>e?navigator.mediaDevices.getUserMedia({video:{width:{ideal:640},height:{ideal:480},facingMode:"user"},audio:!1}):navigator.mediaDevices.getUserMedia({video:{facingMode:"user"},audio:!1});s(!0).catch((()=>s(!1))).then((s=>{r=s,t.srcObject=r;const c=()=>{if(!t.videoWidth||!t.videoHeight)return a<30?(a++,void setTimeout(c,150)):(i(),void n(new h("Câmera não está pronta",f.CAMERA_ERROR)));o.width=t.videoWidth,o.height=t.videoHeight;const r=o.getContext("2d");if(!r)return i(),void n(new Error("Failed to get canvas context"));(async()=>{if(!Xi)return!0;try{return!!(await d.detectSingleFace(t,new d.TinyFaceDetectorOptions({inputSize:160,scoreThreshold:.3})))}catch{return!0}})().then((s=>{if(!s&&a<30)return a++,void setTimeout(c,150);r.drawImage(t,0,0,o.width,o.height),o.toBlob((t=>{i(),t?e(t):n(new Error("Failed to capture image"))}),"image/jpeg",.85)}))},l=t.play();void 0!==l?l.then((()=>{t.videoWidth&&t.videoHeight?setTimeout(c,200):(t.onloadedmetadata=()=>setTimeout(c,200),setTimeout((()=>{t.videoWidth&&t.videoHeight&&c()}),1500))})).catch((e=>{i(),n(new h(`Erro ao reproduzir câmera: ${e.message}`,f.CAMERA_ERROR))})):t.onloadedmetadata=()=>setTimeout(c,200),t.onerror=()=>{i(),n(new h("Erro ao acessar câmera",f.CAMERA_ERROR))}})).catch((e=>{i(),n(new h(`Não foi possível acessar a câmera: ${e.message}`,f.CAMERA_ERROR))}))}))},executeBiometricLoginFlow:ns,preloadFaceDetectionModels:Qi},Symbol.toStringTag,{value:"Module"})),os="Consentimento recusado pelo usuário.";async function rs(e){try{const t=await(n=e,new Promise(((e,t)=>{const o=new Image;o.onload=()=>e(o),o.onerror=()=>t(new Error("Erro ao carregar imagem"));const r=n.startsWith("data:")?n:`data:image/jpeg;base64,${n}`;o.src=r}))),o=await async function(e){try{if("undefined"!=typeof window&&window.faceapi){const{faceapi:n}=window;await is();const t=new n.TinyFaceDetectorOptions({inputSize:320,scoreThreshold:.5}),o=await n.detectAllFaces(e,t).withFaceLandmarks();if(o&&o.length>0){const e=o.reduce(((e,n)=>n.detection.score>e.detection.score?n:e));return{confidence:e.detection.score,details:{faces:o.length,landmarks:e.landmarks,box:e.detection.box}}}}return{confidence:0}}catch(n){return{confidence:0}}}(t);if(o.confidence>.7)return{type:"face",confidence:o.confidence,details:o.details};const r=await async function(e){try{const n=document.createElement("canvas"),t=n.getContext("2d");if(!t)return{confidence:0};n.width=e.width,n.height=e.height,t.drawImage(e,0,0);const o=function(e){const{data:n,width:t,height:o}=e;let r=0,a=0;for(let l=0;l<n.length;l+=4){as(n[l],n[l+1],n[l+2])&&r++,a++}const i=r/a,s=t/o;let c=0;i>.15&&i<.7&&(c+=i/.7*.4);s>.6&&s<1.8&&(c+=.3);const d=t*o;d>1e4&&d<5e5&&(c+=.3);return{confidence:Math.min(c,.8),skinRatio:i,aspectRatio:s,imageSize:d,skinPixels:r,totalPixels:a}}(t.getImageData(0,0,n.width,n.height));return{confidence:o.confidence,details:o}}catch(n){return{confidence:0}}}(t);return r.confidence>.6?{type:"hand",confidence:r.confidence,details:r.details}:{type:"unknown",confidence:Math.max(o.confidence,r.confidence)}}catch(t){return{type:"face",confidence:.5}}var n}function as(e,n,t){const o=.299*e+.587*n+.114*t,r=-.169*e-.331*n+.5*t+128,a=.5*e-.419*n-.081*t+128;return o>80&&o<255&&r>85&&r<135&&a>135&&a<180}async function is(){if("undefined"==typeof window||!window.faceapi)return;const{faceapi:e}=window;if(!e.nets.tinyFaceDetector.isLoaded)try{await Promise.all([e.nets.tinyFaceDetector.loadFromUri("/models"),e.nets.faceLandmark68Net.loadFromUri("/models")])}catch(n){}}async function ss(){try{"undefined"!=typeof window&&await is()}catch(e){}}function cs(){return"undefined"!=typeof window&&window.faceapi&&window.faceapi.nets.tinyFaceDetector.isLoaded}const ds=Object.freeze(Object.defineProperty({__proto__:null,detectBiometricType:rs,initializeBiometricDetection:ss,isAdvancedDetectionAvailable:cs},Symbol.toStringTag,{value:"Module"}));let ls=null;function us(){ls=null}async function ps({applicationToken:e,purpose:n}){if(!e)throw new h("applicationToken é obrigatório para abrir sessão de captura",f.INVALID_TOKEN);const t=`${ba()}/api/v1/auth/capture/session/`;let o;try{o=await fetch(t,{method:"POST",headers:{"Content-Type":"application/json","X-App-Token":e},body:JSON.stringify({purpose:String(n).toUpperCase()})})}catch(c){const e=c instanceof Error?c.message:"Erro de rede";throw new h(`Falha de rede ao abrir sessão: ${e}`,f.NETWORK)}if(401===o.status||403===o.status)throw new h("Token de aplicação inválido ou expirado",f.INVALID_TOKEN);if(!o.ok)throw new h(`Falha ao abrir sessão de captura (${o.status})`,f.API_ERROR);const r=await o.json().catch((()=>null)),a=(null==r?void 0:r.data)??r,i=null==a?void 0:a.session_id;if(!i)throw new h("Resposta inválida ao abrir sessão de captura (session_id ausente)",f.API_ERROR);const s="string"==typeof(null==a?void 0:a.expires_at)&&a.expires_at.length>0?a.expires_at:function(e){const n="number"==typeof e&&Number.isFinite(e)?e:0;return new Date(Date.now()+1e3*n).toISOString()}(null==a?void 0:a.expires_in);return ls={session_id:i,expires_at:s},ls}async function fs({sessionId:e,applicationToken:n}){if(!n)throw new h("applicationToken é obrigatório para solicitar desafio de liveness",f.INVALID_TOKEN);if(!e)throw new h("session_id é obrigatório para solicitar desafio de liveness",f.VALIDATION_ERROR);const t=`${ba()}/api/v1/auth/liveness/challenge/`;let o;try{o=await fetch(t,{method:"POST",headers:{"Content-Type":"application/json","X-App-Token":n},body:JSON.stringify({session_id:e})})}catch(p){const e=p instanceof Error?p.message:"Erro de rede";throw new h(`Falha de rede ao solicitar desafio: ${e}`,f.NETWORK)}if(401===o.status||403===o.status)throw new h("Token de aplicação inválido ou expirado",f.INVALID_TOKEN);if(410===o.status)throw new h("Sessão de captura expirada (410) — reabrir sessão",f.API_ERROR);if(!o.ok)throw new h(`Falha ao solicitar desafio de liveness (${o.status})`,f.API_ERROR);const r=await o.json().catch((()=>null)),a=(null==r?void 0:r.data)??r,i=null==a?void 0:a.steps,s=null==a?void 0:a.gestures,c=Array.isArray(i)?i:Array.isArray(s)?s:void 0;if(!c||0===c.length)throw new h("Resposta inválida ao solicitar desafio (steps/gestures ausentes)",f.API_ERROR);const d=c.map(((e,n)=>{const t=e,o=t.gesture??t.gesture_key;return{index:"number"==typeof t.order?t.order:"number"==typeof t.index?t.index:n+1,gesture_key:o??"",instruction:"string"==typeof t.instruction?t.instruction:void 0,instruction_i18n:t.instruction_i18n&&"object"==typeof t.instruction_i18n?t.instruction_i18n:void 0}})),l="number"==typeof(null==a?void 0:a.expires_in)?a.expires_in:void 0,u="string"==typeof(null==a?void 0:a.expires_at)&&a.expires_at.length>0?a.expires_at:void 0!==l?new Date(Date.now()+1e3*l).toISOString():void 0;return{challenge_id:"string"==typeof(null==a?void 0:a.challenge_id)?a.challenge_id:void 0,gestures:d,expires_at:u,expires_in:l,language:"string"==typeof(null==a?void 0:a.language)?a.language:void 0}}async function hs({applicationToken:e,purpose:n,collectFramesForGesture:t,retryOnSessionExpired:o=!0}){const r=async()=>{const o=await ps({applicationToken:e,purpose:n}),r=await fs({sessionId:o.session_id,applicationToken:e}),a=[];for(let e=0;e<r.gestures.length;e+=1){const n=r.gestures[e],o=await t(n,e,r.gestures.length);a.push({gesture_key:String(n.gesture_key),images:o})}return{sessionId:o.session_id,challenge:r,capturedGestures:a}};try{return await r()}catch(a){if(o&&a instanceof h&&a.message.includes("410"))return us(),r();throw a}}class ms{constructor(e){i(this,"overlay",null),i(this,"video",null),i(this,"canvas",null),i(this,"stream",null),i(this,"step","face"),i(this,"countdownSeconds"),i(this,"title"),i(this,"subtitle"),i(this,"faceBlob",null),i(this,"documentBlob",null),i(this,"autoLighting"),i(this,"flashController",null),this.countdownSeconds=(null==e?void 0:e.countdown)??3,this.title=null==e?void 0:e.title,this.subtitle=null==e?void 0:e.subtitle,this.autoLighting=!1!==(null==e?void 0:e.autoLighting)}async open(){if(await this.createDom(),await this.startCamera(),await this.runFaceCaptureCountdown(),this.faceBlob=await this.captureFrame(),this.step="document",this.updateTexts("Captura do Documento",'Posicione seu documento visível e clique em "Capturar"'),await this.waitForUserCaptureClick(),this.documentBlob=await this.captureFrame(),await this.close(),!this.faceBlob||!this.documentBlob)throw new Error("Falha na captura das imagens de onboarding");return{face:this.faceBlob,document:this.documentBlob}}async createDom(){const e=document.createElement("div");e.className="neofaceid-modal-overlay",e.innerHTML=`\n <div class="neofaceid-modal">\n <div class="neofaceid-modal-header">\n <h2 class="neofaceid-title">${this.title??"Onboarding NeoFaceID"}</h2>\n <button class="neofaceid-close-btn" aria-label="Fechar">×</button>\n </div>\n <div class="neofaceid-modal-body">\n <p class="neofaceid-subtitle">${this.subtitle??"Vamos capturar sua face e documento"}</p>\n <div class="neofaceid-camera-container">\n <video class="neofaceid-video" autoplay muted playsinline></video>\n <canvas class="neofaceid-canvas"></canvas>\n <div class="neofaceid-overlay">\n <div class="neofaceid-frame"></div>\n <div class="neofaceid-countdown" style="display:none"><span class="neofaceid-countdown-number">${this.countdownSeconds}</span></div>\n </div>\n </div>\n <div class="neofaceid-status"><p class="neofaceid-status-text">Posicione seu rosto no quadro</p></div>\n </div>\n <div class="neofaceid-modal-footer">\n <button class="neofaceid-cancel-btn">Cancelar</button>\n <button class="neofaceid-capture-btn" disabled>Capturar</button>\n </div>\n <div class="neofaceid-seal-row">\n ${gi()}\n </div>\n </div>\n `,la(),ua("neofaceid-onboarding-capture-styles","\n .neofaceid-root .neofaceid-modal-overlay { position: fixed; inset: 0; background: var(--nfid-overlay); display:flex; align-items:center; justify-content:center; z-index: 9999; }\n .neofaceid-root .neofaceid-modal { background: var(--nfid-surface); border-radius: var(--nfid-radius, 16px); width: 92%; max-width: 640px; box-shadow: 0 1px 3px rgba(10,19,32,.08); overflow:hidden; }\n .neofaceid-root .neofaceid-modal-header { padding: 16px 20px; border-bottom: 1px solid var(--nfid-line); display:flex; align-items:center; justify-content:space-between; }\n .neofaceid-root .neofaceid-title { margin:0; font-size: 20px; color: var(--nfid-text); }\n .neofaceid-root .neofaceid-close-btn { background:none; border:none; font-size:24px; cursor:pointer; color: var(--nfid-text-muted); min-width: 44px; min-height: 44px; }\n .neofaceid-root .neofaceid-modal-body { padding: 16px 20px; }\n .neofaceid-root .neofaceid-subtitle { margin: 0 0 12px 0; color: var(--nfid-text-muted); }\n .neofaceid-root .neofaceid-camera-container { position: relative; background:#000; border-radius:8px; overflow:hidden; aspect-ratio: 4/3; margin-bottom: 12px; }\n .neofaceid-root .neofaceid-video { width:100%; height:100%; object-fit: cover; }\n .neofaceid-root .neofaceid-canvas { position:absolute; top:0; left:0; }\n .neofaceid-root .neofaceid-overlay { position:absolute; inset:0; display:flex; align-items:center; justify-content:center; }\n .neofaceid-root .neofaceid-frame { width: 200px; height: 200px; border: 3px solid #0E9F6E; border-radius: 50%; box-shadow: 0 0 0 2px rgba(14,159,110,0.3); }\n .neofaceid-root .neofaceid-countdown { position:absolute; top:16px; right:16px; background: rgba(0,0,0,0.7); color:#fff; width: 48px; height:48px; display:flex; align-items:center; justify-content:center; border-radius:50%; }\n .neofaceid-root .neofaceid-modal-footer { padding: 16px 20px; border-top: 1px solid var(--nfid-line); display:flex; gap: 8px; justify-content:flex-end; }\n .neofaceid-root .neofaceid-cancel-btn { background: var(--nfid-surface-muted); color: var(--nfid-text-muted); border:none; border-radius:8px; padding:10px 18px; cursor:pointer; min-height: 44px; }\n .neofaceid-root .neofaceid-capture-btn { background: var(--nfid-action); color: var(--nfid-action-text); border:none; border-radius:8px; padding:10px 18px; cursor:pointer; min-height: 44px; }\n .neofaceid-root .neofaceid-capture-btn:disabled { background: var(--nfid-line); cursor:not-allowed; }\n .neofaceid-root .neofaceid-seal-row { display:flex; justify-content:center; padding:12px 20px 14px; border-top: 1px solid var(--nfid-line); }\n .neofaceid-root .neofaceid-seal { font-size:10px; font-weight:500; letter-spacing:0.06em; text-transform:uppercase; color: var(--nfid-text-subtle); }\n "),e.classList.add("neofaceid-root"),document.body.appendChild(e),this.overlay=e,this.video=this.overlay.querySelector(".neofaceid-video"),this.canvas=this.overlay.querySelector(".neofaceid-canvas");const n=this.overlay.querySelector(".neofaceid-close-btn"),t=this.overlay.querySelector(".neofaceid-cancel-btn");n.onclick=()=>this.close(),t.onclick=()=>this.close();this.overlay.querySelector(".neofaceid-capture-btn").disabled=!0}async startCamera(){if(!this.video)throw new Error("Elemento de vídeo não encontrado");this.video.muted=!0,this.video.playsInline=!0;try{this.stream=await navigator.mediaDevices.getUserMedia({video:{facingMode:"user",width:{ideal:1280},height:{ideal:720}},audio:!1})}catch{this.stream=await navigator.mediaDevices.getUserMedia({video:{facingMode:"user"},audio:!1})}this.video.srcObject=this.stream,await this.video.play(),this.autoLighting&&!this.flashController&&(this.flashController=Vi((()=>this.video)),this.flashController.start())}async runFaceCaptureCountdown(){if(!this.overlay)return;const e=this.overlay.querySelector(".neofaceid-countdown"),n=this.overlay.querySelector(".neofaceid-countdown-number"),t=this.overlay.querySelector(".neofaceid-status-text");e.style.display="flex",t.textContent="Prepare-se! Capturando seu rosto...";let o=this.countdownSeconds;n.textContent=String(o),await new Promise((t=>{const r=setInterval((()=>{o-=1,n.textContent=String(o),o<=0&&(clearInterval(r),e.style.display="none",t())}),1e3)}))}async waitForUserCaptureClick(){if(!this.overlay)return;const e=this.overlay.querySelector(".neofaceid-capture-btn"),n=this.overlay.querySelector(".neofaceid-status-text");e.disabled=!1,n.textContent='Clique em "Capturar" quando o documento estiver visível',await new Promise((n=>{const t=()=>{e.removeEventListener("click",t),n()};e.addEventListener("click",t)})),e.disabled=!0}async captureFrame(){if(!this.video||!this.canvas)throw new Error("Elementos de captura não encontrados");const e=this.canvas.getContext("2d");if(!e)throw new Error("Falha ao obter contexto do canvas");this.canvas.width=this.video.videoWidth,this.canvas.height=this.video.videoHeight,e.drawImage(this.video,0,0,this.canvas.width,this.canvas.height);return await new Promise(((e,n)=>{this.canvas.toBlob((t=>t?e(t):n(new Error("Falha ao gerar imagem"))),"image/jpeg",.92)}))}updateTexts(e,n){if(!this.overlay)return;const t=this.overlay.querySelector(".neofaceid-title"),o=this.overlay.querySelector(".neofaceid-subtitle"),r=this.overlay.querySelector(".neofaceid-frame");t.textContent=e,o.textContent=n,"document"===this.step&&(r.style.borderRadius="8px",r.style.width="280px",r.style.height="180px")}async close(){this.flashController&&(this.flashController.destroy(),this.flashController=null),this.stream&&(this.stream.getTracks().forEach((e=>e.stop())),this.stream=null),this.overlay&&(this.overlay.remove(),this.overlay=null)}}const gs=["Olhe diretamente para a câmera","Vire levemente a cabeça para a esquerda","Vire levemente a cabeça para a direita","Mostre o polegar para cima (👍) e olhe para a câmera"];function vs({open:e,onDismiss:t,dismissOnOverlay:r=!0,ariaLabel:a,ariaLabelledBy:i,children:s,className:c,style:d}){if(n.useEffect((()=>{la()}),[]),!e)return null;return o.jsx("div",{className:"neofaceid-root",role:"presentation",style:{position:"fixed",inset:0,zIndex:10001,display:"flex",alignItems:"center",justifyContent:"center",padding:20,background:`var(${ia})`,backdropFilter:"blur(3px)",WebkitBackdropFilter:"blur(3px)"},onClick:()=>{r&&t&&t()},children:o.jsx("div",{role:"dialog","aria-modal":"true","aria-label":a,"aria-labelledby":i,className:c,onClick:e=>e.stopPropagation(),style:{background:`var(${Xr})`,color:`var(${ea})`,borderRadius:`var(${ca}, 16px)`,padding:28,maxWidth:440,width:"100%",boxShadow:"0 1px 3px rgba(10,19,32,.08)",boxSizing:"border-box",...d},children:s})})}const bs={minHeight:44,minWidth:44,padding:"12px 20px",borderRadius:16,border:"none",fontSize:15,fontWeight:600,fontFamily:"inherit",cursor:"pointer",transition:"background 120ms ease-out",display:"inline-flex",alignItems:"center",justifyContent:"center",gap:8},ws=n.forwardRef((({variant:e="primary",style:n,type:t="button",...r},a)=>{const i="primary"===e?{background:`var(${oa})`,color:`var(${ra})`}:"secondary"===e?{background:`var(${Yr})`,color:`var(${ea})`}:{background:"transparent",color:`var(${na})`};return o.jsx("button",{ref:a,type:t,...r,style:{...bs,...i,...n}})}));function ys({size:e=96,color:n,strokeWidth:t,glow:r=!1,className:a,style:i}){const s=t??function(e){return e<=24?2:e<=48?2.5:3.4}(e),c=.28*e,d=s/2,l=[{x:d,y:d,dx:1,dy:1},{x:e-d,y:d,dx:-1,dy:1},{x:d,y:e-d,dx:1,dy:-1},{x:e-d,y:e-d,dx:-1,dy:-1}];return o.jsx("svg",{width:e,height:e,viewBox:`0 0 ${e} ${e}`,xmlns:"http://www.w3.org/2000/svg",className:a,style:{color:n??`var(${oa})`,filter:r?"drop-shadow(0 0 6px rgba(0,176,248,.5))":void 0,...i},"aria-hidden":"true",children:l.map(((e,n)=>o.jsx("path",{d:`M ${e.x+e.dx*c} ${e.y} L ${e.x} ${e.y} L ${e.x} ${e.y+e.dy*c}`,fill:"none",stroke:"currentColor",strokeWidth:s,strokeLinecap:"round"},n)))})}function xs({progress:e,size:n=268,children:t,className:r,style:a}){const i=Math.max(0,Math.min(1,Number.isFinite(e)?e:0)),s=n/2-4.2,c=2*Math.PI*s,d=c*(1-i),l=n+24;return o.jsxs("div",{className:r,style:{position:"relative",width:l,height:l,display:"inline-flex",alignItems:"center",justifyContent:"center",...a},children:[o.jsx("div",{style:{position:"absolute",inset:0},children:o.jsx(ys,{size:l,glow:!0})}),o.jsx("div",{style:{position:"relative",width:n,height:n,borderRadius:"50%",overflow:"hidden",background:"linear-gradient(160deg, #274B6E, #0F2438, #05080F)"},children:t}),o.jsxs("svg",{width:n,height:n,viewBox:`0 0 ${n} ${n}`,style:{position:"absolute",top:(l-n)/2,left:(l-n)/2,transform:"rotate(-90deg)",pointerEvents:"none"},"aria-hidden":"true",children:[o.jsx("defs",{children:o.jsxs("linearGradient",{id:"nfid-challenge-arc",x1:"0%",y1:"0%",x2:"100%",y2:"100%",children:[o.jsx("stop",{offset:"0%",stopColor:"#00B0F8"}),o.jsx("stop",{offset:"100%",stopColor:"#0073F4"})]})}),o.jsx("circle",{cx:n/2,cy:n/2,r:s,stroke:"rgba(255,255,255,0.18)",strokeWidth:4.2,fill:"none"}),o.jsx("circle",{cx:n/2,cy:n/2,r:s,stroke:`var(${oa}, url(#nfid-challenge-arc))`,strokeWidth:4.2,strokeLinecap:"round",strokeDasharray:c,strokeDashoffset:d,fill:"none",style:{transition:"stroke-dashoffset 200ms ease-out"}})]})]})}function ks({gesture:e,size:n=48,color:t,className:r,style:a}){return o.jsxs("svg",{width:n,height:n,viewBox:"0 0 48 48",xmlns:"http://www.w3.org/2000/svg",className:r,style:{color:t??`var(${oa})`,...a},role:"img","aria-label":Es[e],children:["blink"===e?o.jsx(Rs,{stroke:3.4}):o.jsx(_s,{stroke:3.4}),"blink"!==e&&"center"!==e&&o.jsx(Ns,{gesture:e,stroke:3.4})]})}ws.displayName="Button";const Es={center:"Centralize o rosto",turn_right:"Vire o rosto para a direita",turn_left:"Vire o rosto para a esquerda",look_up:"Olhe para cima",look_down:"Olhe para baixo",blink:"Pisque os olhos",move_closer:"Aproxime-se da câmera"};function _s({stroke:e}){return o.jsxs("g",{fill:"none",stroke:"currentColor",strokeWidth:e,strokeLinecap:"round",strokeLinejoin:"round",children:[o.jsx("path",{d:"M14 20c0-5.5 4.5-10 10-10s10 4.5 10 10v4c0 5.5-4.5 10-10 10s-10-4.5-10-10v-4z"}),o.jsx("circle",{cx:"20",cy:"22",r:"1.2",fill:"currentColor",stroke:"none"}),o.jsx("circle",{cx:"28",cy:"22",r:"1.2",fill:"currentColor",stroke:"none"}),o.jsx("path",{d:"M21 28c1 1 2 1.5 3 1.5s2-.5 3-1.5"})]})}function Rs({stroke:e}){return o.jsxs("g",{fill:"none",stroke:"currentColor",strokeWidth:e,strokeLinecap:"round",strokeLinejoin:"round",children:[o.jsx("path",{d:"M8 24c4-4 8-6 16-6s12 2 16 6"}),o.jsx("path",{d:"M12 26v3"}),o.jsx("path",{d:"M18 27v3.5"}),o.jsx("path",{d:"M24 27.5v4"}),o.jsx("path",{d:"M30 27v3.5"}),o.jsx("path",{d:"M36 26v3"})]})}function Ns({gesture:e,stroke:n}){const[t,r,a]=function(e){switch(e){case"turn_right":return["40 18","44 24","40 30"];case"turn_left":return["8 18","4 24","8 30"];case"look_up":return["18 8","24 4","30 8"];case"look_down":case"move_closer":return["18 40","24 44","30 40"];default:return["24 24","24 24","24 24"]}}(e);return o.jsx("path",{d:`M ${t} L ${r} L ${a}`,fill:"none",stroke:"currentColor",strokeWidth:n,strokeLinecap:"round",strokeLinejoin:"round"})}function Ts({tone:e,children:n,icon:t,className:r}){const a=Wr[e];return o.jsxs("span",{className:r,style:{display:"inline-flex",alignItems:"center",gap:6,padding:"4px 10px",borderRadius:9999,background:a.bg,color:a.fg,fontSize:13,fontWeight:600,fontFamily:"inherit",lineHeight:1.3},children:[t,n]})}const Os={title:"Não deu certo desta vez",hint:"Tente se posicionar em um ambiente mais estável.",actions:["Segure o dispositivo firme","Fique de frente para uma luz suave"]},Ss={LIVENESS_LOW:{title:"Precisamos ver com mais nitidez",hint:"A prova de vida veio abaixo do esperado.",actions:["Faça o movimento com calma até o fim","Aproxime o rosto sem cortar as bordas"]},NO_FACE_DETECTED:{title:"Não vi seu rosto",hint:"A câmera não conseguiu identificar um rosto na moldura.",actions:["Centralize o rosto no oval","Afaste-se um pouco se estiver muito próximo"]},LOW_LIGHT:{title:"A luz está baixa demais",hint:"Falta contraste para o algoritmo distinguir seu rosto.",actions:["Fique de frente para uma janela ou lâmpada","Evite luz vindo por trás — deixa o rosto em sombra"]},LOOK_STRAIGHT:{title:"Olhe direto para a câmera",hint:"O rosto está um pouco de lado para reconhecimento facial.",actions:["Fique de frente para a câmera","Mantenha o queixo paralelo ao chão"]},RECOGNITION_FAILED:{title:"Não consegui confirmar",hint:"A imagem não bate com o cadastro que temos.",actions:["Retire óculos ou máscara temporariamente","Faça em um lugar mais iluminado"]},INVALID_TOKEN:{title:"Sessão expirada",hint:"A conexão com o serviço perdeu validade.",actions:["Volte à tela anterior e tente novamente","Se persistir, entre em contato com o suporte"]},NETWORK:{title:"A conexão está oscilando",hint:"A imagem não chegou até nosso servidor.",actions:["Verifique a rede do dispositivo","Repita a captura em alguns segundos"]}};const Is={chrome:"Clique no cadeado da barra de endereço → Configurações do site → Câmera → Permitir. Recarregue a página.",edge:"Clique no cadeado da barra de endereço → Permissões do site → Câmera → Permitir. Recarregue a página.",firefox:'Clique no ícone da câmera bloqueada na barra de endereço e escolha "Permitir". Recarregue a página.',safari:"Menu Safari → Configurações → Sites → Câmera → Permitir para este site. Recarregue a página.",unknown:'Abra as configurações do navegador, procure por "câmera" e permita o acesso para este site. Depois recarregue a página.'};function Cs(){n.useEffect((()=>{la(),ua("neofaceid-state-views-styles",'\n.neofaceid-root .nfid-state {\n display: flex; flex-direction: column; align-items: center; text-align: center; gap: 10px;\n padding: 8px 8px 4px;\n}\n.neofaceid-root .nfid-state h2 {\n margin: 6px 0 0; font-size: 20px; font-weight: 700; color: var(--nfid-text); line-height: 1.25;\n letter-spacing: -0.015em;\n}\n.neofaceid-root .nfid-state p {\n margin: 0; font-size: 14px; color: var(--nfid-text-muted); line-height: 1.5;\n}\n.neofaceid-root .nfid-state-actions {\n display: flex; flex-direction: column; gap: 10px; width: 100%; margin-top: 12px;\n}\n.neofaceid-root .nfid-state-actions--row {\n flex-direction: row; justify-content: center;\n}\n.neofaceid-root .nfid-state-icon-success {\n width: 64px; height: 64px; color: #0E9F6E;\n animation: nfidCelebrate 500ms cubic-bezier(.2,1.4,.4,1) both;\n}\n@keyframes nfidCelebrate {\n 0% { transform: scale(0.6); opacity: 0; }\n 60% { transform: scale(1.08); opacity: 1; }\n 100% { transform: scale(1); }\n}\n.neofaceid-root .nfid-state-warn-icon { width: 56px; height: 56px; color: #F1BE00; }\n.neofaceid-root .nfid-state-cameraoff-icon { width: 56px; height: 56px; color: var(--nfid-text-muted); }\n.neofaceid-root .nfid-state-hints {\n display: flex; flex-direction: column; gap: 6px; margin-top: 8px; text-align: left; width: 100%;\n}\n.neofaceid-root .nfid-state-hint {\n display: flex; gap: 8px; align-items: flex-start; font-size: 13px; color: var(--nfid-text);\n padding: 8px 12px; background: var(--nfid-surface-muted); border-radius: 12px;\n}\n.neofaceid-root .nfid-state-hint::before { content: "•"; color: var(--nfid-action); font-weight: 700; }\n.neofaceid-root .nfid-state-attempt {\n font-size: 12px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase;\n color: var(--nfid-text-subtle);\n}\n.neofaceid-root .nfid-state-techcode {\n font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;\n font-size: 11px; color: var(--nfid-text-subtle); margin-top: 8px;\n}\n')}),[])}function zs({appName:e,onContinue:n}){return Cs(),o.jsxs("div",{className:"nfid-state",role:"status","aria-live":"polite",children:[o.jsxs("svg",{className:"nfid-state-icon-success",viewBox:"0 0 64 64",fill:"none",stroke:"currentColor",strokeWidth:"4",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[o.jsx("circle",{cx:"32",cy:"32",r:"28"}),o.jsx("path",{d:"M20 33 L28 41 L44 24"})]}),o.jsx("h2",{children:"Identidade confirmada"}),o.jsxs("p",{children:["Você já pode continuar no ",e,"."]}),o.jsx("div",{className:"nfid-state-actions",children:o.jsx(ws,{variant:"primary",onClick:n,children:"Continuar"})})]})}function js({errorCode:e,attempt:n,maxAttempts:t,timestamp:r,onRetry:a,onFallback:i}){Cs();const s=function(e){if(!e)return Os;const n=e.toUpperCase();return Ss[n]??Os}(e),c=r??new Date;return o.jsxs("div",{className:"nfid-state",role:"alert","aria-live":"assertive",children:[o.jsxs(Ts,{tone:"attention",children:["Tentativa ",n," de ",t]}),o.jsxs("svg",{className:"nfid-state-warn-icon",viewBox:"0 0 64 64",fill:"none",stroke:"currentColor",strokeWidth:"3",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[o.jsx("path",{d:"M32 8 L58 54 H6 Z"}),o.jsx("path",{d:"M32 26 V38"}),o.jsx("circle",{cx:"32",cy:"45",r:"2",fill:"currentColor"})]}),o.jsx("h2",{children:s.title}),o.jsx("p",{children:s.hint}),o.jsxs("div",{className:"nfid-state-hints","aria-label":"O que fazer",children:[o.jsx("div",{className:"nfid-state-hint",children:s.actions[0]}),o.jsx("div",{className:"nfid-state-hint",children:s.actions[1]})]}),o.jsxs("div",{className:"nfid-state-actions",children:[o.jsx(ws,{variant:"primary",onClick:a,children:"Tentar de novo"}),o.jsx(ws,{variant:"ghost",onClick:i,children:"Verificar de outro jeito"})]}),o.jsxs("p",{className:"nfid-state-techcode",children:[(e??"UNKNOWN").toUpperCase()," · ",(d=c,`${String(d.getHours()).padStart(2,"0")}:${String(d.getMinutes()).padStart(2,"0")}:${String(d.getSeconds()).padStart(2,"0")}`)]})]});var d}function As({browser:e,onFallback:n,onCancel:t}){Cs();const r=function(e){return Is[e]}(e??function(e=navigator.userAgent){const n=e.toLowerCase();return n.includes("edg/")?"edge":n.includes("firefox")?"firefox":n.includes("chrome")&&!n.includes("edg/")?"chrome":n.includes("safari")&&!n.includes("chrome")?"safari":"unknown"}());return o.jsxs("div",{className:"nfid-state",role:"alert","aria-live":"assertive",children:[o.jsxs("svg",{className:"nfid-state-cameraoff-icon",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[o.jsx("path",{d:"m3 3 18 18"}),o.jsx("path",{d:"M20.66 15.34A2 2 0 0 0 22 13.5V7.5a2 2 0 0 0-3.13-1.65L15 8.5"}),o.jsx("path",{d:"M9 6H4a2 2 0 0 0-2 2v8a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2v-1"})]}),o.jsx("h2",{children:"Câmera bloqueada"}),o.jsx("p",{children:"Precisamos da câmera para confirmar que é você."}),o.jsx("p",{style:{marginTop:8},children:r}),o.jsxs("div",{className:"nfid-state-actions",children:[o.jsx(ws,{variant:"primary",onClick:n,children:"Verificar de outro jeito"}),o.jsx(ws,{variant:"ghost",onClick:t,children:"Agora não"})]})]})}const Fs={center:"center",turn_right:"turn_right",turn_left:"turn_left",look_up:"look_up",look_down:"look_down",blink:"blink",move_closer:"move_closer",smile:"blink",open_mouth:"blink"},$s={center:"Centralize seu rosto no oval",turn_right:"Vire lentamente o rosto para a direita",turn_left:"Vire lentamente o rosto para a esquerda",look_up:"Olhe para cima",look_down:"Olhe para baixo",blink:"Pisque os olhos",move_closer:"Aproxime-se da câmera",smile:"Sorria para a câmera",open_mouth:"Abra a boca"};function Ps({applicationToken:e,appName:t,amount:r,onChallengeStart:a,onChallengeComplete:i,onSuccess:s,onError:c,onCancel:d,autoLighting:l=!0,onClose:u}){const p=n.useRef(null),[m,g]=n.useState(0),[v,b]=n.useState(null),[w,y]=n.useState("preparing"),[x,k]=n.useState(1),[E,_]=n.useState(void 0),[R,N]=n.useState(void 0),[T,O]=n.useState(0),S=n.useRef(!1),[I,C]=n.useState(!1),{flashOn:z}=ni(p,{enabled:l&&!I&&"challenging"===w}),j=ya(),A=t??wa()??"sua aplicação",F="number"==typeof r&&Number.isFinite(r)?function(e,n){try{return new Intl.NumberFormat(n,{style:"currency",currency:"BRL"}).format(e)}catch{return`R$ ${e.toFixed(2)}`}}(r,j):null;n.useEffect((()=>{la(),ua("neofaceid-authorize-styles","\n .neofaceid-root .nfid-authorize-header { display: flex; flex-direction: column; gap: 4px; margin-bottom: 16px; }\n .neofaceid-root .nfid-authorize-appname { font-size: 15px; font-weight: 700; color: var(--nfid-text); line-height: 1.2; }\n .neofaceid-root .nfid-authorize-amount { font-size: 13px; color: var(--nfid-text-muted); }\n .neofaceid-root .nfid-authorize-brand { font-size: 10px; font-weight: 500; letter-spacing: 0.06em; text-transform: uppercase; color: var(--nfid-text-subtle); }\n .neofaceid-root .nfid-authorize-video { width: 100%; height: 100%; object-fit: cover; transform: scaleX(-1); }\n .neofaceid-root .nfid-authorize-instruction { margin: 20px 0 0; font-size: 17px; font-weight: 600; color: var(--nfid-text); text-align: center; line-height: 1.3; }\n .neofaceid-root .nfid-authorize-support { margin: 6px 0 0; font-size: 13px; color: var(--nfid-text-muted); text-align: center; }\n .neofaceid-root .nfid-authorize-actions { display: flex; flex-direction: column; gap: 10px; margin-top: 20px; align-items: center; }\n .neofaceid-root .nfid-authorize-footer { display: flex; justify-content: center; margin-top: 16px; padding-top: 12px; border-top: 1px solid var(--nfid-line); }\n .neofaceid-root .nfid-authorize-seal { font-size: 10px; font-weight: 500; letter-spacing: 0.06em; text-transform: uppercase; color: var(--nfid-text-subtle); }\n .neofaceid-root .nfid-authorize-close {\n position: absolute; top: 8px; right: 8px;\n min-width: 44px; min-height: 44px;\n background: transparent; border: none;\n display: inline-flex; align-items: center; justify-content: center;\n color: var(--nfid-text-muted); cursor: pointer; border-radius: 22px;\n }\n .neofaceid-root .nfid-authorize-close:hover { background: var(--nfid-surface-muted); }\n .neofaceid-root .nfid-authorize-close:focus-visible { outline: 2px solid var(--nfid-focus-ring); outline-offset: 2px; }\n @media (prefers-reduced-motion: reduce) {\n .neofaceid-root svg circle { transition: none !important; }\n }\n ")}),[]),n.useEffect((()=>{let n=null;return S.current=!1,y("preparing"),g(0),b(null),async function(){try{try{n=await navigator.mediaDevices.getUserMedia({video:{facingMode:"user",width:{ideal:1280},height:{ideal:720}}})}catch(t){const e=function(e){if(!e||"object"!=typeof e)return"UNKNOWN";const n=(e.name??"").toString();return"NotAllowedError"===n||"SecurityError"===n?"PERMISSION_DENIED":"NotFoundError"===n||"OverconstrainedError"===n?"NO_CAMERA":"NotReadableError"===n||"TrackStartError"===n?"IN_USE":"UNKNOWN"}(t);if("PERMISSION_DENIED"===e)return void y("permission-denied");throw new h("NO_CAMERA"===e?"Câmera não encontrada":"IN_USE"===e?"Câmera em uso por outro app":"Falha ao acessar a câmera",f.CAMERA_ERROR)}p.current&&(p.current.srcObject=n,p.current.play().catch((()=>{}))),y("challenging");const o=await hs({applicationToken:e,purpose:"authorization",collectFramesForGesture:async(e,n,t)=>{if(S.current)throw new h("Cancelado",f.UNKNOWN);b(e),g(0),a&&a(e,n,t),await async function(e){const n=1500,t=Date.now();return new Promise((o=>{const r=()=>{const a=Date.now()-t,i=Math.min(1,a/n);e(i),a>=n?o():setTimeout(r,50)};r()}))}(g),i&&i(e,n,t);const o=await async function(e){if(!e||0===e.videoWidth)return null;const n=document.createElement("canvas");n.width=e.videoWidth,n.height=e.videoHeight;const t=n.getContext("2d");return t?(t.drawImage(e,0,0),n.toDataURL("image/jpeg",.85)):null}(p.current);return o?[o]:[]}});n&&n.getTracks().forEach((e=>e.stop())),n=null,y("success"),s&&s(o)}catch(o){if(S.current)return;const e=o instanceof h?o:new h(o instanceof Error?o.message:"Falha",f.UNKNOWN);_(e.type),N(new Date),y("failure"),c&&c(e)}finally{n&&n.getTracks().forEach((e=>e.stop()))}}(),()=>{S.current=!0,n&&n.getTracks().forEach((e=>e.stop()))}}),[T]);const $=()=>{S.current=!0,d&&d(),u()},P=()=>{x>=3?$():(k((e=>e+1)),_(void 0),N(void 0),O((e=>e+1)))},D=()=>{S.current=!0,c&&c(new h("Fluxo alternativo solicitado pelo usuário",f.CONSENT_DENIED)),u()},L=v?Fs[v.gesture_key]??"center":"center",M=v?$s[v.gesture_key]??"Siga a instrução":"Preparando a câmera…";return"success"===w?o.jsx(vs,{open:!0,dismissOnOverlay:!1,ariaLabel:"Identidade confirmada",children:o.jsx(zs,{appName:A,onContinue:u})}):"permission-denied"===w?o.jsx(vs,{open:!0,dismissOnOverlay:!1,ariaLabel:"Câmera bloqueada",children:o.jsx(As,{onFallback:D,onCancel:$})}):"failure"===w?o.jsx(vs,{open:!0,dismissOnOverlay:!1,ariaLabel:"Não foi possível confirmar",children:o.jsx(js,{errorCode:E,attempt:x,maxAttempts:3,timestamp:R,onRetry:P,onFallback:D})}):o.jsxs(vs,{open:!0,onDismiss:void 0,dismissOnOverlay:!1,ariaLabel:"Autorização por biometria",children:[o.jsx(ti,{active:z,onDismiss:()=>C(!0)}),o.jsxs("div",{style:{position:"relative"},children:[o.jsx("button",{type:"button",className:"nfid-authorize-close",onClick:$,"aria-label":"Cancelar autorização",children:o.jsx("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2","aria-hidden":"true",children:o.jsx("path",{d:"M18 6L6 18M6 6l12 12"})})}),o.jsxs("div",{className:"nfid-authorize-header",children:[o.jsx("span",{className:"nfid-authorize-appname",children:A}),F&&o.jsxs("span",{className:"nfid-authorize-amount",children:["Autorizando ",F]}),o.jsx("span",{className:"nfid-authorize-brand",children:"NeoFaceID"})]}),o.jsx("div",{style:{display:"flex",justifyContent:"center"},children:o.jsx(xs,{progress:m,size:220,children:o.jsx("video",{ref:p,className:"nfid-authorize-video",autoPlay:!0,muted:!0,playsInline:!0})})}),o.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",gap:12,marginTop:16},children:[o.jsx(ks,{gesture:L,size:40}),o.jsx("p",{className:"nfid-authorize-instruction","aria-live":"assertive",style:{margin:0},children:M})]}),"preparing"===w&&o.jsx("p",{className:"nfid-authorize-support",children:"Ligando sua câmera…"}),o.jsx("div",{className:"nfid-authorize-actions",children:o.jsx(ws,{variant:"ghost",onClick:$,children:"Não consigo fazer esse movimento"})}),o.jsx("div",{className:"nfid-authorize-footer",children:o.jsx(mi,{})})]})]})}const Ds={RG:{name:"Documento de Identidade (RG / CIN / CPF)",icon:'<svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><rect x="3" y="4" width="18" height="16" rx="2"/><circle cx="9" cy="10" r="2"/><path d="M15 8h2M15 12h2M7 16h10"/></svg>',hasBack:!0,frontLabel:"Frente do Documento",backLabel:"Verso do Documento"},CNH:{name:"CNH / Carteira de Motorista",icon:'<svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><rect x="3" y="6" width="18" height="12" rx="2"/><circle cx="8" cy="12" r="2"/><path d="M13 10h5M13 14h3"/></svg>',hasBack:!0,frontLabel:"Frente da CNH",backLabel:"Verso da CNH"},CPF:{name:"Cartão CPF (Apenas Frente)",icon:'<svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"/><path d="M14 2v6h6M16 13H8M16 17H8M10 9H8"/></svg>',hasBack:!1,frontLabel:"Cartão CPF"}};class Ls{constructor(e){i(this,"overlay",null),i(this,"video",null),i(this,"canvas",null),i(this,"stream",null),i(this,"resolvePromise",null),i(this,"options"),i(this,"selectedDocument",null),i(this,"currentStep","select"),i(this,"flashController",null),i(this,"frontBlob",null),i(this,"backBlob",null),i(this,"_previewObjectUrl",null),this.options={title:(null==e?void 0:e.title)??"Validação de Identidade",subtitle:(null==e?void 0:e.subtitle)??"Selecione o tipo de documento",useBackCamera:(null==e?void 0:e.useBackCamera)??!0,onCancel:null==e?void 0:e.onCancel,preSelectedDocument:null==e?void 0:e.preSelectedDocument}}async open(){if(!this.options.skipConsent){if(!(await Bi({appName:this.options.appName,flow:"verification"})))throw new h("Consentimento recusado pelo usuário.",f.CONSENT_DENIED)}return new Promise((e=>{this.resolvePromise=e,this.options.preSelectedDocument&&(this.selectedDocument=this.options.preSelectedDocument,this.currentStep="front"),this.render()}))}render(){var e;this.overlay||this.createOverlay();const n=null==(e=this.overlay)?void 0:e.querySelector(".neoface-doc-content");if(n)switch(this.currentStep){case"select":n.innerHTML=this.renderSelectStep(),this.bindSelectEvents();break;case"front":case"back":n.innerHTML=this.renderCaptureStep(),this.bindCaptureEvents(),this.startCamera();break;case"preview-front":case"preview-back":n.innerHTML=this.renderPreviewStep(),this.bindPreviewEvents()}}createOverlay(){const e=document.createElement("div");e.className="neoface-doc-overlay",e.innerHTML='\n <div class="neoface-doc-modal">\n <div class="neoface-doc-content"></div>\n </div>\n ',la(),ua("neoface-doc-styles-v2",this.getStyles()),e.classList.add("neofaceid-root"),document.body.appendChild(e),this.overlay=e}renderSelectStep(){return`\n <div class="neoface-doc-header">\n <div class="neoface-doc-header-left">\n <h2 class="neoface-doc-title">${this.options.title}</h2>\n <p class="neoface-doc-subtitle">${this.options.subtitle}</p>\n </div>\n <button class="neoface-doc-close-btn" aria-label="Fechar">\n <svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">\n <path d="M18 6L6 18M6 6l12 12"/>\n </svg>\n </button>\n </div>\n \n <div class="neoface-doc-body">\n <div class="neoface-doc-select-grid">\n ${Object.entries(Ds).filter((([e])=>"CPF"!==e)).map((([e,n])=>`\n <button class="neoface-doc-select-option" data-type="${e}">\n <span class="neoface-doc-select-icon">${n.icon}</span>\n <span class="neoface-doc-select-name">${n.name}</span>\n <svg class="neoface-doc-select-arrow" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M9 18l6-6-6-6"/></svg>\n </button>\n `)).join("")}\n </div>\n \n <div class="neoface-doc-tips">\n <div class="neoface-doc-tip">\n <span>Garanta boa iluminação e que todos os dados estejam legíveis</span>\n </div>\n </div>\n </div>\n \n ${this.renderBranding()}\n `}renderCaptureStep(){const e=this.selectedDocument?Ds[this.selectedDocument]:null;if(!e)return"";const n="back"===this.currentStep,t=n?e.backLabel:e.frontLabel;return`\n <div class="neoface-doc-header">\n <div class="neoface-doc-header-left">\n <div class="neoface-doc-step-indicator">\n <span class="neoface-doc-step-badge">${n?2:1}/${e.hasBack?2:1}</span>\n <span class="neoface-doc-step-label">${t}</span>\n </div>\n </div>\n <button class="neoface-doc-close-btn" aria-label="Fechar">\n <svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">\n <path d="M18 6L6 18M6 6l12 12"/>\n </svg>\n </button>\n </div>\n \n <div class="neoface-doc-body">\n <div class="neoface-doc-camera-container">\n <video class="neoface-doc-video" autoplay muted playsinline></video>\n <canvas class="neoface-doc-canvas"></canvas>\n \n <div class="neoface-doc-guide">\n <div class="neoface-doc-frame">\n <div class="neoface-doc-corner neoface-doc-corner-tl"></div>\n <div class="neoface-doc-corner neoface-doc-corner-tr"></div>\n <div class="neoface-doc-corner neoface-doc-corner-bl"></div>\n <div class="neoface-doc-corner neoface-doc-corner-br"></div>\n <div class="neoface-doc-frame-label">${t}</div>\n </div>\n </div>\n \n <div class="neoface-doc-loading" style="display:none">\n <div class="neoface-doc-spinner"></div>\n </div>\n </div>\n \n <div class="neoface-doc-instructions">\n <div class="neoface-doc-instruction">\n <svg class="neoface-doc-instruction-icon" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><rect x="3" y="3" width="18" height="18" rx="2"/><path d="M3 9h18M9 21V9"/></svg>\n <span>Posicione o documento dentro do quadro</span>\n </div>\n <div class="neoface-doc-instruction">\n <svg class="neoface-doc-instruction-icon" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><circle cx="12" cy="12" r="5"/><path d="M12 1v2M12 21v2M4.22 4.22l1.42 1.42M18.36 18.36l1.42 1.42M1 12h2M21 12h2M4.22 19.78l1.42-1.42M18.36 5.64l1.42-1.42"/></svg>\n <span>Sem reflexo do flash sobre o texto</span>\n </div>\n </div>\n </div>\n \n <div class="neoface-doc-footer">\n <button class="neoface-doc-btn neoface-doc-btn-secondary neoface-doc-back-btn">\n ← Voltar\n </button>\n <input type="file" accept="image/*" class="neoface-doc-file-input" style="display:none" />\n <button class="neoface-doc-btn neoface-doc-btn-secondary neoface-doc-upload-btn">\n <svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">\n <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/>\n <polyline points="17,8 12,3 7,8"/>\n <line x1="12" y1="3" x2="12" y2="15"/>\n </svg>\n Anexar\n </button>\n <button class="neoface-doc-btn neoface-doc-btn-primary neoface-doc-capture-btn">\n <svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">\n <circle cx="12" cy="12" r="10"/>\n <circle cx="12" cy="12" r="4"/>\n </svg>\n Capturar\n </button>\n </div>\n \n ${this.renderBranding()}\n `}renderPreviewStep(){const e=this.selectedDocument?Ds[this.selectedDocument]:null;if(!e)return"";const n="preview-front"===this.currentStep,t=n?e.frontLabel:e.backLabel,o=!e.hasBack||"preview-back"===this.currentStep;return`\n <div class="neoface-doc-header">\n <div class="neoface-doc-header-left">\n <div class="neoface-doc-step-indicator">\n <span class="neoface-doc-step-badge">${n?1:2}/${e.hasBack?2:1}</span>\n <span class="neoface-doc-step-label">Confirmar ${t}</span>\n </div>\n </div>\n <button class="neoface-doc-close-btn" aria-label="Fechar">\n <svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">\n <path d="M18 6L6 18M6 6l12 12"/>\n </svg>\n </button>\n </div>\n \n <div class="neoface-doc-body">\n <div class="neoface-doc-preview-single">\n <span class="neoface-doc-preview-label">${t}</span>\n <img class="neoface-doc-preview-img neoface-doc-preview-current" alt="Prévia do documento capturado" />\n </div>\n\n <h3 class="neoface-doc-preview-question" id="neoface-doc-preview-question">Está legível?</h3>\n <div class="neoface-doc-preview-hint">\n <svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><circle cx="12" cy="12" r="10"/><path d="M12 16v-4M12 8h.01"/></svg>\n <span>Confira se dá para ler nome, número e data sem esforço.</span>\n </div>\n </div>\n\n <div class="neoface-doc-footer">\n <button class="neoface-doc-btn neoface-doc-btn-secondary neoface-doc-retake-btn">\n <svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">\n <path d="M1 4v6h6M23 20v-6h-6"/>\n <path d="M20.49 9A9 9 0 0 0 5.64 5.64L1 10m22 4l-4.64 4.36A9 9 0 0 1 3.51 15"/>\n </svg>\n Refazer\n </button>\n <button class="neoface-doc-btn neoface-doc-btn-primary neoface-doc-confirm-btn">\n <svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">\n <path d="M20 6L9 17l-5-5"/>\n </svg>\n ${o?"Sim, enviar":"Sim, próximo"}\n </button>\n </div>\n \n ${this.renderBranding()}\n `}renderBranding(){return`\n <div class="neoface-doc-branding">\n ${gi()}\n </div>\n `}bindSelectEvents(){var e;const n=null==(e=this.overlay)?void 0:e.querySelectorAll(".neoface-doc-select-option");null==n||n.forEach((e=>{e.addEventListener("click",(()=>{const n=e.getAttribute("data-type");this.selectedDocument=n,this.currentStep="front",this.render()}))})),this.bindCloseEvent()}bindCaptureEvents(){var e,n,t,o;const r=null==(e=this.overlay)?void 0:e.querySelector(".neoface-doc-capture-btn"),a=null==(n=this.overlay)?void 0:n.querySelector(".neoface-doc-back-btn"),i=null==(t=this.overlay)?void 0:t.querySelector(".neoface-doc-upload-btn"),s=null==(o=this.overlay)?void 0:o.querySelector(".neoface-doc-file-input");null==r||r.addEventListener("click",(()=>this.handleCapture())),null==a||a.addEventListener("click",(()=>this.handleBack())),null==i||i.addEventListener("click",(()=>null==s?void 0:s.click())),null==s||s.addEventListener("change",(e=>this.handleFileUpload(e))),this.bindCloseEvent()}async handleFileUpload(e){var n,t;const o=null==(n=e.target.files)?void 0:n[0];if(!o)return;const r=null==(t=this.overlay)?void 0:t.querySelector(".neoface-doc-loading");r&&(r.style.display="flex");try{const e=await this.compressUploadedImage(o);"front"===this.currentStep?(this.frontBlob=e,this.currentStep="preview-front"):"back"===this.currentStep&&(this.backBlob=e,this.currentStep="preview-back"),this.stopCamera(),this.render()}catch(a){const e=new Blob([o],{type:o.type});"front"===this.currentStep?(this.frontBlob=e,this.currentStep="preview-front"):"back"===this.currentStep&&(this.backBlob=e,this.currentStep="preview-back"),this.stopCamera(),this.render()}}compressUploadedImage(e){return xa(e,(e=>new Promise(((n,t)=>{const o=new Image;o.onload=()=>{const e=1280;let{width:r}=o,{height:a}=o;r>a&&r>e?(a=a*e/r,r=e):a>e&&(r=r*e/a,a=e);const i=document.createElement("canvas");i.width=r,i.height=a;const s=i.getContext("2d");s?(s.drawImage(o,0,0,r,a),i.toBlob((e=>{e?n(e):t(new Error("Failed to compress image"))}),"image/jpeg",.75)):t(new Error("Failed to get canvas context"))},o.onerror=()=>t(new Error("Failed to load image")),o.src=e}))))}bindPreviewEvents(){var e,n,t;const o=null==(e=this.overlay)?void 0:e.querySelector(".neoface-doc-confirm-btn"),r=null==(n=this.overlay)?void 0:n.querySelector(".neoface-doc-retake-btn");null==o||o.addEventListener("click",(()=>this.handleConfirm())),null==r||r.addEventListener("click",(()=>this.handleRetake()));const a=null==(t=this.overlay)?void 0:t.querySelector(".neoface-doc-preview-current");if(a){const e="preview-front"===this.currentStep?this.frontBlob:this.backBlob;e&&(this._previewObjectUrl&&(URL.revokeObjectURL(this._previewObjectUrl),this._previewObjectUrl=null),this._previewObjectUrl=URL.createObjectURL(e),a.src=this._previewObjectUrl)}this.bindCloseEvent()}bindCloseEvent(){var e;const n=null==(e=this.overlay)?void 0:e.querySelector(".neoface-doc-close-btn");null==n||n.addEventListener("click",(()=>this.handleCancel()))}async startCamera(){var e,n,t;try{const t={video:{facingMode:this.options.useBackCamera?"environment":"user",width:{ideal:1920},height:{ideal:1080}},audio:!1};this.stream=await navigator.mediaDevices.getUserMedia(t),this.video=null==(e=this.overlay)?void 0:e.querySelector(".neoface-doc-video"),this.canvas=null==(n=this.overlay)?void 0:n.querySelector(".neoface-doc-canvas"),this.video&&(this.video.muted=!0,this.video.playsInline=!0,this.video.srcObject=this.stream,await this.video.play(),this.startScreenFlash())}catch(o){if(this.options.useBackCamera)try{this.stream=await navigator.mediaDevices.getUserMedia({video:{facingMode:"user"},audio:!1}),this.video&&(this.video.srcObject=this.stream,await this.video.play(),this.startScreenFlash())}catch(r){null==(t=this.resolvePromise)||t.call(this,{success:!1,frontImage:null,backImage:null,error:"Não foi possível acessar a câmera"}),this.close()}}}stopCamera(){this.flashController&&(this.flashController.destroy(),this.flashController=null),this.stream&&(this.stream.getTracks().forEach((e=>e.stop())),this.stream=null)}startScreenFlash(){!1!==this.options.autoLighting&&(this.flashController||(this.flashController=Vi((()=>this.video)),this.flashController.start()))}async handleCapture(){var e;if(!this.video||!this.canvas)return;const n=null==(e=this.overlay)?void 0:e.querySelector(".neoface-doc-loading");n&&(n.style.display="flex");const t=this.canvas.getContext("2d");if(!t)return;const{videoWidth:o}=this.video,{videoHeight:r}=this.video,a=Math.floor(.75*o),i=Math.floor(.65*r),s=Math.floor((o-a)/2),c=Math.floor((r-i)/2);this.canvas.width=a,this.canvas.height=i,t.drawImage(this.video,s,c,a,i,0,0,a,i);try{const e=await new Promise(((e,n)=>{this.canvas.toBlob((t=>t?e(t):n(new Error("Capture failed"))),"image/jpeg",.92)}));"front"===this.currentStep?(this.frontBlob=e,this.stopCamera(),this.currentStep="preview-front",this.render()):"back"===this.currentStep&&(this.backBlob=e,this.stopCamera(),this.currentStep="preview-back",this.render())}catch(d){}finally{n&&(n.style.display="none")}}handleBack(){this.stopCamera(),"back"===this.currentStep?(this.currentStep="front",this.frontBlob=null):"front"===this.currentStep&&(this.currentStep="select",this.selectedDocument=null),this.render()}handleRetake(){"preview-front"===this.currentStep?(this.frontBlob=null,this.currentStep="front"):"preview-back"===this.currentStep&&(this.backBlob=null,this.currentStep="back"),this.render()}handleConfirm(){var e,n;const t=this.selectedDocument?Ds[this.selectedDocument]:null;"preview-front"===this.currentStep?(null==t?void 0:t.hasBack)?(this.currentStep="back",this.render()):(null==(e=this.resolvePromise)||e.call(this,{success:!0,documentType:this.selectedDocument||void 0,frontImage:this.frontBlob,backImage:null}),this.close()):"preview-back"===this.currentStep&&(null==(n=this.resolvePromise)||n.call(this,{success:!0,documentType:this.selectedDocument||void 0,frontImage:this.frontBlob,backImage:this.backBlob}),this.close())}handleCancel(){var e,n,t;null==(n=(e=this.options).onCancel)||n.call(e),null==(t=this.resolvePromise)||t.call(this,{success:!1,frontImage:null,backImage:null,error:"cancelled"}),this.close()}close(){this.stopCamera(),this._previewObjectUrl&&(URL.revokeObjectURL(this._previewObjectUrl),this._previewObjectUrl=null),this.overlay&&(this.overlay.remove(),this.overlay=null)}getStyles(){return"\n .neoface-doc-overlay {\n position: fixed;\n inset: 0;\n background: rgba(0, 0, 0, 0.85);\n backdrop-filter: blur(8px);\n display: flex;\n align-items: center;\n justify-content: center;\n z-index: 10000;\n font-family: inherit;\n padding: 16px;\n }\n \n .neoface-doc-modal {\n background: linear-gradient(145deg, #0A1320 0%, #111C2B 100%);\n border-radius: 24px;\n width: 100%;\n max-width: 520px;\n box-shadow: 0 25px 80px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(255,255,255,0.1);\n overflow: hidden;\n animation: neoface-doc-slideIn 0.3s ease;\n }\n \n @keyframes neoface-doc-slideIn {\n from { transform: translateY(20px) scale(0.98); opacity: 0; }\n to { transform: translateY(0) scale(1); opacity: 1; }\n }\n \n .neoface-doc-header {\n padding: 20px 24px;\n display: flex;\n align-items: flex-start;\n justify-content: space-between;\n border-bottom: 1px solid rgba(255, 255, 255, 0.08);\n }\n \n .neoface-doc-title {\n margin: 0 0 4px 0;\n font-size: 20px;\n font-weight: 600;\n color: #fff;\n }\n \n .neoface-doc-subtitle {\n margin: 0;\n font-size: 14px;\n color: rgba(255, 255, 255, 0.6);\n }\n \n .neoface-doc-step-indicator {\n display: flex;\n align-items: center;\n gap: 12px;\n }\n \n .neoface-doc-step-badge {\n background: linear-gradient(135deg, #0091F6, #0099cc);\n color: #fff;\n font-size: 12px;\n font-weight: 600;\n padding: 4px 10px;\n border-radius: 20px;\n }\n \n .neoface-doc-step-label {\n font-size: 16px;\n font-weight: 500;\n color: #fff;\n }\n \n .neoface-doc-close-btn {\n background: transparent;\n border: none;\n padding: 4px;\n cursor: pointer;\n color: rgba(255, 255, 255, 0.5);\n transition: all 0.2s;\n }\n \n .neoface-doc-close-btn:hover {\n color: #fff;\n }\n \n .neoface-doc-body {\n padding: 20px 24px;\n }\n \n /* Select Step */\n .neoface-doc-select-grid {\n display: flex;\n flex-direction: column;\n gap: 12px;\n }\n \n .neoface-doc-select-option {\n display: flex;\n align-items: center;\n gap: 16px;\n padding: 16px 20px;\n background: rgba(255, 255, 255, 0.05);\n border: 2px solid rgba(255, 255, 255, 0.1);\n border-radius: 14px;\n cursor: pointer;\n transition: all 0.2s;\n text-align: left;\n }\n \n .neoface-doc-select-option:hover {\n background: rgba(0, 145, 246, 0.1);\n border-color: rgba(0, 145, 246, 0.4);\n transform: translateX(4px);\n }\n \n .neoface-doc-select-icon {\n display: flex;\n align-items: center;\n justify-content: center;\n width: 44px;\n height: 44px;\n background: rgba(0, 145, 246, 0.15);\n border-radius: 12px;\n color: #0091F6;\n }\n \n .neoface-doc-select-icon svg {\n width: 24px;\n height: 24px;\n }\n \n .neoface-doc-select-name {\n flex: 1;\n font-size: 15px;\n font-weight: 500;\n color: #fff;\n }\n \n .neoface-doc-select-arrow {\n color: rgba(255, 255, 255, 0.4);\n transition: transform 0.2s;\n }\n \n .neoface-doc-select-option:hover .neoface-doc-select-arrow {\n color: #0091F6;\n transform: translateX(4px);\n }\n \n .neoface-doc-tips {\n margin-top: 20px;\n }\n \n .neoface-doc-tip {\n display: flex;\n align-items: center;\n justify-content: center;\n padding: 14px 16px;\n background: rgba(0, 145, 246, 0.08);\n border: 1px solid rgba(0, 145, 246, 0.15);\n border-radius: 10px;\n color: rgba(255, 255, 255, 0.8);\n font-size: 13px;\n line-height: 1;\n text-align: center;\n }\n \n .neoface-doc-tip span {\n transform: translateY(-2px);\n }\n \n .neoface-doc-tip-icon {\n color: #0091F6;\n flex-shrink: 0;\n }\n \n /* Camera — ISO/IEC 7810 ID-1 (85.60 × 53.98 mm ≈ 1.586:1) */\n .neoface-doc-camera-container {\n position: relative;\n background: #000;\n border-radius: 16px;\n overflow: hidden;\n aspect-ratio: 1.586 / 1;\n }\n \n .neoface-doc-video {\n width: 100%;\n height: 100%;\n object-fit: cover;\n }\n \n .neoface-doc-canvas {\n display: none;\n }\n \n .neoface-doc-guide {\n position: absolute;\n inset: 0;\n display: flex;\n align-items: center;\n justify-content: center;\n pointer-events: none;\n }\n \n /* Moldura Focus Frame — proporção ID-1 (1.586:1), sem borda contínua. */\n .neoface-doc-frame {\n width: 82%;\n aspect-ratio: 1.586 / 1;\n position: relative;\n border-radius: 12px;\n }\n\n .neoface-doc-corner {\n position: absolute;\n width: 28px;\n height: 28px;\n border-color: var(--nfid-action, #0059C4);\n border-style: solid;\n }\n \n .neoface-doc-corner-tl { top: -2px; left: -2px; border-width: 4px 0 0 4px; border-radius: 10px 0 0 0; }\n .neoface-doc-corner-tr { top: -2px; right: -2px; border-width: 4px 4px 0 0; border-radius: 0 10px 0 0; }\n .neoface-doc-corner-bl { bottom: -2px; left: -2px; border-width: 0 0 4px 4px; border-radius: 0 0 0 10px; }\n .neoface-doc-corner-br { bottom: -2px; right: -2px; border-width: 0 4px 4px 0; border-radius: 0 0 10px 0; }\n \n .neoface-doc-frame-label {\n position: absolute;\n bottom: -30px;\n left: 50%;\n transform: translateX(-50%);\n background: rgba(0, 0, 0, 0.7);\n color: #0091F6;\n font-size: 12px;\n font-weight: 500;\n padding: 6px 14px;\n border-radius: 20px;\n white-space: nowrap;\n }\n \n .neoface-doc-loading {\n position: absolute;\n inset: 0;\n background: rgba(0, 0, 0, 0.7);\n display: none;\n align-items: center;\n justify-content: center;\n }\n \n .neoface-doc-spinner {\n width: 48px;\n height: 48px;\n border: 4px solid rgba(255, 255, 255, 0.2);\n border-top-color: #0091F6;\n border-radius: 50%;\n animation: neoface-doc-spin 0.8s linear infinite;\n }\n \n @keyframes neoface-doc-spin {\n to { transform: rotate(360deg); }\n }\n \n .neoface-doc-instructions {\n display: flex;\n flex-direction: column;\n gap: 8px;\n margin-top: 16px;\n }\n \n .neoface-doc-instruction {\n display: flex;\n align-items: center;\n gap: 10px;\n padding: 10px 14px;\n background: rgba(255, 255, 255, 0.04);\n border-radius: 10px;\n font-size: 13px;\n color: rgba(255, 255, 255, 0.75);\n }\n \n .neoface-doc-instruction-icon {\n color: rgba(255, 255, 255, 0.5);\n flex-shrink: 0;\n }\n \n /* Preview */\n .neoface-doc-preview-single {\n display: flex;\n flex-direction: column;\n align-items: center;\n gap: 12px;\n }\n \n .neoface-doc-preview-label {\n font-size: 12px;\n font-weight: 500;\n color: rgba(255, 255, 255, 0.6);\n text-transform: uppercase;\n letter-spacing: 0.5px;\n text-align: center;\n }\n \n .neoface-doc-preview-img {\n width: 75%;\n height: auto;\n border-radius: 12px;\n border: 2px solid rgba(0, 145, 246, 0.3);\n box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);\n }\n \n .neoface-doc-preview-question {\n margin: 12px 0 4px;\n font-size: 17px;\n font-weight: 700;\n color: var(--nfid-text, #0A1320);\n text-align: center;\n }\n\n .neoface-doc-preview-hint {\n display: flex;\n align-items: center;\n gap: 10px;\n padding: 12px 16px;\n background: rgba(0, 145, 246, 0.08);\n border: 1px solid rgba(0, 145, 246, 0.15);\n border-radius: 10px;\n font-size: 13px;\n color: rgba(255, 255, 255, 0.8);\n margin-top: 8px;\n }\n\n .neoface-doc-preview-hint svg {\n color: #0091F6;\n flex-shrink: 0;\n }\n \n /* Footer */\n .neoface-doc-footer {\n padding: 16px 24px;\n display: flex;\n gap: 12px;\n justify-content: flex-end;\n border-top: 1px solid rgba(255, 255, 255, 0.08);\n }\n \n .neoface-doc-btn {\n display: flex;\n align-items: center;\n gap: 8px;\n padding: 12px 20px;\n border-radius: 12px;\n font-size: 14px;\n font-weight: 500;\n cursor: pointer;\n transition: all 0.2s;\n border: none;\n }\n \n .neoface-doc-btn-primary {\n background: linear-gradient(135deg, #0091F6 0%, #0099cc 100%);\n color: #fff;\n }\n \n .neoface-doc-btn-primary:hover {\n transform: translateY(-2px);\n box-shadow: 0 6px 20px rgba(0, 145, 246, 0.4);\n }\n \n .neoface-doc-btn-success {\n background: linear-gradient(135deg, #0E9F6E 0%, #059669 100%);\n color: #fff;\n }\n \n .neoface-doc-btn-success:hover {\n transform: translateY(-2px);\n box-shadow: 0 6px 20px rgba(16, 185, 129, 0.4);\n }\n \n .neoface-doc-btn-secondary {\n background: rgba(255, 255, 255, 0.08);\n color: rgba(255, 255, 255, 0.8);\n }\n \n .neoface-doc-btn-secondary:hover {\n background: rgba(255, 255, 255, 0.12);\n color: #fff;\n }\n \n /* Branding */\n .neoface-doc-branding {\n display: flex;\n align-items: center;\n justify-content: center;\n gap: 8px;\n padding: 16px 24px;\n border-top: 1px solid rgba(255, 255, 255, 0.06);\n }\n \n .neoface-doc-brand-icon {\n height: 22px;\n width: auto;\n }\n \n .neoface-doc-brand-name-text {\n font-size: 13px;\n font-weight: 600;\n color: rgba(255, 255, 255, 0.9);\n }\n \n .neoface-doc-brand-text {\n font-size: 12px;\n color: rgba(255, 255, 255, 0.5);\n }\n \n .neoface-doc-brand-name {\n font-size: 13px;\n font-weight: 700;\n color: #0091F6;\n letter-spacing: 1px;\n }\n \n /* Mobile */\n @media (max-width: 500px) {\n .neoface-doc-modal {\n border-radius: 20px;\n }\n \n .neoface-doc-header,\n .neoface-doc-body,\n .neoface-doc-footer {\n padding: 16px 18px;\n }\n \n .neoface-doc-preview-grid.has-back {\n grid-template-columns: 1fr;\n }\n }\n "}}const Ms=async e=>new Ls(e).open(),qs=Object.freeze(Object.defineProperty({__proto__:null,DocumentCaptureModal:Ls,startDocumentCapture:Ms},Symbol.toStringTag,{value:"Module"})),Us="Consentimento recusado pelo usuário.";e.BiometricCaptureModal=Zi,e.BiometricRegistrationModal=Fi,e.BiometricStatusOverlay=Ki,e.ConsentModal=Ui,e.DEFAULT_CONSENT_INFO=Wi,e.DocumentCaptureModal=Ls,e.ENVIRONMENT_URLS=ha,e.EmailPasswordModal=Hi,e.ErrorType=f,e.FaceCaptureModal=si,e.FallbackPrompt=Gi,e.ForgotPasswordModal=vi,e.NeoFaceError=h,e.NeoFaceID=class{constructor(e){if(i(this,"appToken"),i(this,"signature"),i(this,"sessionData"),this.appToken=e.appToken,this.signature=e.signature,this.sessionData=e.sessionData,this.signature&&!this.validateSignatureFormat(this.signature))throw new h("Invalid signature format. Expected HMAC-SHA256 hex string (minimum 64 characters)",f.VALIDATION_ERROR);if(this.sessionData&&(!this.sessionData.email||!this.sessionData.cpf||!this.sessionData.sessionId))throw new h("Session data must include email, cpf, and sessionId",f.VALIDATION_ERROR)}validateSignatureFormat(e){return/^[a-f0-9]{64,}$/i.test(e)}async captureFaceFrames(e){const{numFrames:n,livenessCheck:t}=e;if(n<1||n>10)throw new h("Number of frames must be between 1 and 10",f.VALIDATION_ERROR);const o=[];try{const{captureFaceSilently:e}=await Promise.resolve().then((()=>ts));for(let r=0;r<n;r++){const a=await e();o.push(a),t&&r<n-1&&await new Promise((e=>setTimeout(e,300)))}return o}catch(r){if(r instanceof h)throw r;throw new h(`Failed to capture face frames: ${r instanceof Error?r.message:"Unknown error"}`,f.CAPTURE_ERROR)}}async loginRecognition(e){const{biometricData:n,purpose:t,confidenceThreshold:o=.8}=e,r=Array.isArray(n)?n:[n];if(0===r.length)throw new h("At least one biometric data frame is required",f.VALIDATION_ERROR);const a=r[0];try{const e=await $a(a,this.appToken,t,o,this.signature,this.sessionData);if(!e.success)throw new h("Recognition failed",f.RECOGNITION_FAILED);if(!e.personName||!e.email||!e.cpf)throw new h("Incomplete recognition result: missing personName, email, or cpf",f.RECOGNITION_FAILED);return{success:!0,personName:e.personName,email:e.email,cpf:e.cpf,signature:e.signature,sessionId:e.sessionId,confidenceScore:e.confidenceScore,accessToken:e.accessToken}}catch(i){if(i instanceof h)throw i;throw new h(`Login recognition failed: ${i instanceof Error?i.message:"Unknown error"}`,f.RECOGNITION_FAILED)}}async registerApplication(e,n,t){try{return await Ba(e,n,t)}catch(o){if(o instanceof h)throw o;throw new h(`Application registration failed: ${o instanceof Error?o.message:"Unknown error"}`,f.VALIDATION_ERROR)}}async registerDocumentByImage(e,n,t={}){const{DocumentCaptureModal:o}=await Promise.resolve().then((()=>qs)),r=new o({useBackCamera:t.useBackCamera??!0,preSelectedDocument:t.preSelectedDocument}),a=await r.open();if(!a.success||!a.frontImage)throw new h("cancelled"===a.error?"Document capture was cancelled by the user":`Document capture failed: ${a.error??"unknown error"}`,f.CAPTURE_ERROR);const i=[a.frontImage];return a.backImage&&i.push(a.backImage),Ja(e,n,i)}async proofOfLife(e={}){const{videoDurationMs:n=3e3,maxPollingAttempts:t=60,pollingIntervalMs:o=1e3,onRecordingProgress:r,onTaskStatusChange:a}=e;try{const e=await Wa({durationMs:n,onProgress:r}),i=await Ka(e),s=await Za(i,this.appToken);a&&a("processing",0);const c=await Va(s.taskId,this.appToken,{maxAttempts:t,intervalMs:o,onStatusChange:a});return c&&c.success?{success:!0,isLive:c.is_live||!1,livenessScore:c.liveness_score||0,faceRecognitionScore:c.face_recognition_score||0,combinedConfidence:c.combined_confidence||0,personId:c.person_id,personalData:c.personal_data||[],processingTime:c.processing_time||0,historyId:s.historyId,taskId:s.taskId,message:"Proof of life verification successful"}:{success:!1,isLive:(null==c?void 0:c.is_live)||!1,livenessScore:(null==c?void 0:c.liveness_score)||0,faceRecognitionScore:(null==c?void 0:c.face_recognition_score)||0,combinedConfidence:(null==c?void 0:c.combined_confidence)||0,personId:null==c?void 0:c.person_id,personalData:(null==c?void 0:c.personal_data)||[],processingTime:(null==c?void 0:c.processing_time)||0,historyId:s.historyId,taskId:s.taskId,error:(null==c?void 0:c.error)||"Verification failed",message:(null==c?void 0:c.message)||"Proof of life verification failed"}}catch(i){if(i instanceof h)throw i;throw new h(`Proof of life failed: ${i instanceof Error?i.message:"Unknown error"}`,f.RECOGNITION_FAILED)}}},e.RELEASE_DATE="2026-09-09",e.VERSION="1.40.0",e.authorize=async function(e){if(!(await Bi({appName:e.appName,flow:"verification"})))return void(e.onError&&e.onError(new h("Consentimento recusado",f.CONSENT_DENIED)));const n=document.createElement("div");n.id="neofaceid-authorize-container",document.body.appendChild(n);const r=t.createRoot(n);r.render(o.jsx(Ps,{...e,onClose:()=>{r.unmount(),document.body.contains(n)&&document.body.removeChild(n)}}))},e.authorizeOperation=async(e,n,t)=>{if(!e)throw new h("Application token is required",f.VALIDATION_ERROR);if(!n)throw new h("CPF is required",f.VALIDATION_ERROR);const o=n.replace(/\D/g,"");if(11!==o.length)throw new h("Invalid CPF format",f.VALIDATION_ERROR);const r=[],a=(null==t?void 0:t.captureDelay)||2e3;if(!(await Bi({appName:null==t?void 0:t.appName,flow:"verification"})))throw new h("Consentimento recusado pelo usuário.",f.CONSENT_DENIED);try{if(!navigator.mediaDevices||!navigator.mediaDevices.getUserMedia)throw new h("Camera not available",f.NO_CAMERA);const n=await navigator.mediaDevices.getUserMedia({video:{facingMode:"user",width:{ideal:1280},height:{ideal:720}}}),i=document.createElement("video");i.srcObject=n,i.autoplay=!0,i.playsInline=!0,await new Promise((e=>{i.onloadedmetadata=()=>{i.play(),e()}}));const s=document.createElement("canvas");s.width=i.videoWidth,s.height=i.videoHeight;const c=s.getContext("2d");if(!c)throw new h("Failed to get canvas context",f.CAPTURE_ERROR);for(let e=0;e<4;e++){const n=gs[e];(null==t?void 0:t.onProgress)&&t.onProgress(e+1,4,n),e>0&&await new Promise((e=>setTimeout(e,a))),c.drawImage(i,0,0,s.width,s.height);const o=await new Promise(((e,n)=>{s.toBlob((t=>{t?e(t):n(new Error("Failed to capture photo"))}),"image/jpeg",.9)}));r.push(o),(null==t?void 0:t.onPhotoTaken)&&t.onPhotoTaken(e+1,o)}n.getTracks().forEach((e=>e.stop()));const d=r[3],l={cpf:o,email:"",sessionId:`auth_${Date.now()}_${Math.random().toString(36).substring(7)}`},u=await $a(d,e,"AUTHORIZATION",.8,void 0,l);if(!u.success)throw r.length=0,new h("Authorization failed: Person not recognized",f.RECOGNITION_FAILED);return r.length=0,{success:!0,authorizationHash:l.sessionId,name:u.personName,birthDate:void 0,cpf:u.cpf||o,confidenceScore:u.confidenceScore,message:"Authorization successful"}}catch(i){if(i instanceof h)throw i;if(i instanceof Error)throw new h(i.message,f.CAPTURE_ERROR);throw new h("Unknown error during authorization",f.UNKNOWN)}},e.checkUserExistence=Da,e.completeOnboarding=Ia,e.completeOnboardingWithData=Ca,e.confirmPasswordReset=Ya,e.detectBiometricType=rs,e.getAccent=function(){return ga.accent},e.getAppName=wa,e.getApplicationToken=function(){return ga.applicationToken},e.getBaseUrl=ba,e.getCachedCaptureSession=function(){return ls},e.getConfig=function(){return{...ga}},e.getConsent=function(){return{...ga.consent}},e.getEnvironment=function(){return ga.environment},e.getLocale=ya,e.getRadius=function(){return ga.radius},e.getResolvedThemeMode=function(){var e;return(null==(e=ga.resolvedTheme)?void 0:e.mode)??("dark"===ga.theme?"dark":"light")},e.getTheme=function(){return ga.theme},e.identifyPerson=qa,e.identifyPersonAsync=Ha,e.init=function(e={}){const{environment:n,baseUrl:t,applicationToken:o,appName:r,accent:a,radius:i,theme:c,locale:d,consent:l}=e;if(l?ga.consent=l:(ga.consent={...fa},va||(va=!0)),t)ga.baseUrl=t,ga.environment="custom";else if(n)ha[n]?(ga.baseUrl=ha[n],ga.environment=n):(ga.baseUrl=ha.sandbox,ga.environment="sandbox");else{const e=void 0!=={url:"undefined"==typeof document&&"undefined"==typeof location?require("url").pathToFileURL(__filename).href:"undefined"==typeof document?location.href:s&&"SCRIPT"===s.tagName.toUpperCase()&&s.src||new URL("neoface-id-sdk.umd.js",document.baseURI).href}&&(null==pa?void 0:pa.VITE_API_BASE_URL);e&&(ga.baseUrl=e,ga.environment="custom")}o&&(ga.applicationToken=o),r&&r.trim()&&(ga.appName=r.trim()),void 0!==i&&(ma.includes(i)?ga.radius=i:ga.radius=16),c&&(ga.theme=c),d&&(ga.locale=d),void 0!==a&&(ga.accent=a);const u=Gr({accent:ga.accent??void 0,radius:ga.radius,theme:ga.theme});ga.resolvedTheme=u,la({accent:ga.accent??void 0,radius:ga.radius,theme:ga.theme}),ga.initialized=!0},e.initializeBiometricDetection=ss,e.isAdvancedDetectionAvailable=cs,e.isInitialized=function(){return ga.initialized},e.loginWithBiometric=ja,e.loginWithEmail=Ma,e.openCaptureSession=ps,e.preloadFaceDetectionModels=Qi,e.recognize=za,e.recognizeBiometric=Aa,e.recognizeByPurpose=$a,e.registerBiometric=Ua,e.registerPersonWithBiometric=La,e.registerPersonWithoutFace=Pa,e.requestConsent=Bi,e.requestLivenessChallenge=fs,e.requestLivenessChallengeWithSession=async function({applicationToken:e,purpose:n,sessionId:t}){let o=t??(await ps({applicationToken:e,purpose:n})).session_id;try{return await fs({sessionId:o,applicationToken:e})}catch(r){if(r instanceof h&&r.message.includes("410"))return us(),o=(await ps({applicationToken:e,purpose:n})).session_id,fs({sessionId:o,applicationToken:e});throw r}},e.requestPasswordReset=Xa,e.resetCaptureSession=us,e.runLivenessChallenge=hs,e.simpleIdentification=Fa,e.start=function(e,o,r){Bi({appName:null==r?void 0:r.appName,flow:"verification"}).then((a=>{if(!a)return void o.onError("CONSENT_DENIED",Us);const i=document.createElement("div");i.id="neoface-modal-container",document.body.appendChild(i);const s=()=>{document.body.contains(i)&&document.body.removeChild(i)};Ta(e).then((()=>{const a=n.createElement(si,{accessToken:e,onClose:s,onSuccess:e=>{s(),o.onSuccess({name:e.data.faceId,email:e.data.faceId,documentId:e.data.faceId})},onCannotGesture:null==r?void 0:r.onCannotGesture});t.createRoot(i).render(a)})).catch((e=>{s(),o.onError("TOKEN_VALIDATION_ERROR",e.message||"Failed to validate token")}))}))},e.startAutoLogin=async function(e){if(await Bi({appName:e.appName,flow:"verification"}))try{const n={mode:"auto",onSuccess:async(n,t)=>{try{const t=await fetch(n).then((e=>e.blob())),o=await ja(t,e.applicationToken);e.onSuccess(o)}catch(o){e.onError(o)}},onError:e.onError,onCancel:e.onCancel,countdown:e.countdown,title:e.title||"Login Biométrico",subtitle:e.subtitle||"Posicione seu rosto ou mão dentro do quadro para login automático."},t=new Zi(n);await t.open()}catch(n){e.onError(new h(`Erro ao inicializar login automático: ${n.message}`,f.INITIALIZATION_ERROR))}else e.onError(new h(os,f.CONSENT_DENIED))},e.startBiometricRegistration=function(e,o,r,a){Bi({appName:null==a?void 0:a.appName,flow:"registration"}).then((i=>{if(!i)return void r.onError("CONSENT_DENIED",Us);const s=document.createElement("div");s.id="neoface-biometric-registration-container",document.body.appendChild(s);let c=null;const d=()=>{c&&(c.unmount(),c=null),document.body.contains(s)&&document.body.removeChild(s)};Ta(o).then((()=>{const i=n.createElement(Fi,{personData:e,applicationToken:o,useRealApi:(null==a?void 0:a.useRealApi)??!0,onClose:d,onSuccess:e=>{d(),r.onSuccess(e)},onError:e=>{d(),r.onError("BIOMETRIC_REGISTRATION_ERROR",e)},onCannotGesture:null==a?void 0:a.onCannotGesture});c=t.createRoot(s),c.render(i)})).catch((e=>{d(),r.onError("TOKEN_VALIDATION_ERROR",e.message||"Failed to validate token")}))}))},e.startDocumentCapture=Ms,e.startFaceLogin=async function(e){if(await Bi({appName:e.appName,flow:"verification"}))try{await ns({applicationToken:e.applicationToken,onSuccess:e.onSuccess,onError:e.onError,onFallbackRequest:e.onFallbackRequest||(()=>{const n={applicationToken:e.applicationToken,onSuccess:e.onSuccess,onError:e.onError,title:"Login Alternativo",subtitle:"Biometria não reconhecida. Por favor, informe email e senha."};new Hi(n).open()}),onCancel:e.onCancel})}catch(n){e.onError(new h(`Erro ao inicializar login facial: ${n.message}`,f.INITIALIZATION_ERROR))}else e.onError(new h(os,f.CONSENT_DENIED))},e.startHandLogin=async function(e){if(await Bi({appName:e.appName,flow:"verification"}))try{const n={mode:"hand",onSuccess:async(n,t)=>{try{const t=await fetch(n).then((e=>e.blob())),o=await ja(t,e.applicationToken);e.onSuccess(o)}catch(o){e.onError(o)}},onError:e.onError,onCancel:e.onCancel,countdown:e.countdown,title:e.title||"Login por Mão",subtitle:e.subtitle||"Posicione sua mão dentro do quadro para fazer login."},t=new Zi(n);await t.open()}catch(n){e.onError(new h(`Erro ao inicializar login por mão: ${n.message}`,f.INITIALIZATION_ERROR))}else e.onError(new h(os,f.CONSENT_DENIED))},e.startLivenessCapture=function(e,o,r){Bi({appName:null==r?void 0:r.appName,flow:"verification"}).then((a=>{if(!a)return void o.onError("CONSENT_DENIED",Us);const i=document.createElement("div");i.id="neoface-liveness-capture-container",document.body.appendChild(i);let s=!1,c=null;const d=()=>{c&&(c.unmount(),c=null),document.body.contains(i)&&document.body.removeChild(i)},l=()=>{d(),!s&&o.onCancel&&o.onCancel()};Ta(e).then((()=>{const a=n.createElement(Fi,{applicationToken:e,onClose:l,onPhotosCaptured:e=>{s=!0,o.onSuccess(e)},onError:e=>{d(),o.onError("LIVENESS_CAPTURE_ERROR",e)},onCannotGesture:null==r?void 0:r.onCannotGesture});c=t.createRoot(i),c.render(a)})).catch((e=>{d(),o.onError("TOKEN_VALIDATION_ERROR",e.message||"Failed to validate token")}))}))},e.startOnboarding=async e=>{const{applicationToken:n,onboardingToken:t,countdown:o,title:r,subtitle:a,onSuccess:i,onError:s}=e;try{if(!(await Bi({appName:e.appName,flow:"registration"})))return void s(new h("Consentimento recusado pelo usuário.",f.CONSENT_DENIED));const c=await Oa(n,t);if(!(null==c?void 0:c.is_valid))throw new h("Link de onboarding inválido ou expirado",f.VALIDATION_ERROR);const d=new ms({countdown:o,title:r,subtitle:a}),{face:l,document:u}=await d.open();i({...await Ia(n,t,l,u),details:c})}catch(c){if(c instanceof h)return void s(c);const e=(null==c?void 0:c.message)||"Erro desconhecido no onboarding";s(new h(e,f.UNKNOWN))}},e.submitLivenessChallenge=async function({challengeId:e,sessionId:n,applicationToken:t,gestures:o}){if(!t)throw new h("applicationToken é obrigatório para submeter desafio",f.INVALID_TOKEN);if(!n)throw new h("session_id é obrigatório para submeter desafio",f.VALIDATION_ERROR);if(!Array.isArray(o)||0===o.length)throw new h("gestures[] vazio — nada para submeter",f.VALIDATION_ERROR);const r=e?`${encodeURIComponent(e)}/submit/`:"submit/",a=`${ba()}/api/v1/auth/liveness/challenge/${r}`;let i;try{i=await fetch(a,{method:"POST",headers:{"Content-Type":"application/json","X-App-Token":t},body:JSON.stringify({session_id:n,gestures:o})})}catch(d){const e=d instanceof Error?d.message:"Erro de rede";throw new h(`Falha de rede ao submeter desafio: ${e}`,f.NETWORK)}if(401===i.status||403===i.status)throw new h("Token de aplicação inválido ou expirado",f.INVALID_TOKEN);if(410===i.status)throw new h("Sessão ou desafio expirado (410) — reabrir sessão",f.API_ERROR);if(!i.ok)throw new h(`Falha ao submeter desafio de liveness (${i.status})`,f.API_ERROR);const s=await i.json().catch((()=>null)),c=(null==s?void 0:s.data)??s??{};return{success:(null==c?void 0:c.success)??!0,liveness_passed:null==c?void 0:c.liveness_passed,score:null==c?void 0:c.score,raw:s}},e.validateOnboardingToken=Sa,e.validateToken=Ta,e.withCaptureSession=async function(e,n){const t=ls??await ps(e);try{return await n(t.session_id)}catch(o){if(o instanceof h&&o.message.includes("410")){us();return n((await ps(e)).session_id)}throw o}},e.withSessionId=function(e){const n=ls;return n?{...e,session_id:n.session_id}:e},Object.defineProperty(e,Symbol.toStringTag,{value:"Module"})}));
|
|
1
|
+
!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports,require("react"),require("react-dom/client"),require("react/jsx-runtime"),require("face-api.js")):"function"==typeof define&&define.amd?define(["exports","react","react-dom/client","react/jsx-runtime","face-api.js"],n):n((e="undefined"!=typeof globalThis?globalThis:e||self).NeoFaceIdSdk={},e.React,e.ReactDOM,e.jsxRuntime,e.faceapi)}(this,(function(e,n,t,o,r){"use strict";var a=Object.defineProperty,i=(e,n,t)=>((e,n,t)=>n in e?a(e,n,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[n]=t)(e,"symbol"!=typeof n?n+"":n,t),s="undefined"!=typeof document?document.currentScript:null;function c(e){const n=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e)for(const t in e)if("default"!==t){const o=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(n,t,o.get?o:{enumerable:!0,get:()=>e[t]})}return n.default=e,Object.freeze(n)}const d=c(r);class l extends Error{constructor(e){super(e),this.name="CameraPermissionDenied"}}class u{constructor(e){i(this,"stream"),this.stream=e}getStream(){return this.stream}stop(){this.stream.getTracks().forEach((e=>e.stop()))}}const p=()=>{const e=n.useRef(null),[t,o]=n.useState(!1),r=n.useRef(!1);return{startCamera:n.useCallback((async n=>{const t=e.current;if(t)return t.getStream();if(r.current){await new Promise((e=>setTimeout(e,100)));const n=e.current;if(n)return n.getStream()}r.current=!0;try{const t=n||(()=>{const e=/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent);return{video:{facingMode:"user",width:{ideal:e?640:1280},height:{ideal:e?480:720},aspectRatio:{ideal:1.777777778}},audio:!1}})(),a=await navigator.mediaDevices.getUserMedia(t),i=new u(a);return e.current=i,o(!0),r.current=!1,a}catch(a){if(r.current=!1,a instanceof Error){if("NotAllowedError"===a.name||"PermissionDeniedError"===a.name)throw new l("Permissão para acessar a câmera foi negada pelo usuário");if("NotFoundError"===a.name||"DevicesNotFoundError"===a.name)throw new Error("Nenhuma câmera foi encontrada no dispositivo");if("NotReadableError"===a.name||"TrackStartError"===a.name)throw new Error("A câmera já está sendo usada por outro aplicativo");if("OverconstrainedError"===a.name||"ConstraintNotSatisfiedError"===a.name)throw new Error("As configurações solicitadas não são suportadas pela câmera")}throw new Error(`Erro ao inicializar câmera: ${a instanceof Error?a.message:String(a)}`)}}),[]),stopCamera:n.useCallback((n=>{const t=e.current;t&&t.getStream()===n&&(t.stop(),e.current=null,o(!1),r.current=!1)}),[]),cleanup:n.useCallback((()=>{e.current&&(e.current.stop(),e.current=null,o(!1),r.current=!1)}),[]),isActive:t}};var f=(e=>(e.NETWORK="NetworkError",e.NETWORK_ERROR="NetworkError",e.INVALID_TOKEN="InvalidTokenError",e.RECOGNITION_FAILED="RecognitionFailedError",e.LOGIN_FAILED="LoginFailedError",e.VALIDATION_ERROR="ValidationError",e.API_ERROR="ApiError",e.PERSON_NOT_FOUND="PersonNotFoundError",e.INITIALIZATION_ERROR="InitializationError",e.CAMERA_ERROR="CameraError",e.NO_CAMERA="NoCameraError",e.CAPTURE_ERROR="CaptureError",e.NOT_FOUND="NotFoundError",e.UNKNOWN="UnknownError",e.CONSENT_DENIED="ConsentDeniedError",e.LIVENESS_BLINK_MISSING="LivenessBlinkMissingError",e))(f||{});class h extends Error{constructor(e,n){super(e),i(this,"type"),this.name=n,this.type=n}getFriendlyMessage(){if(/[áéíóúãõç]/i.test(this.message))return this.message;switch(this.type){case"NetworkError":return this.message.includes("timeout")?"A conexão demorou muito. Tente novamente.":"Não foi possível conectar ao servidor. Verifique sua internet.";case"InvalidTokenError":return"Falha na autenticação do aplicativo. Entre em contato com o suporte.";case"CameraError":case"NoCameraError":return"Não conseguimos acessar sua câmera. Verifique as permissões do navegador.";case"LoginFailedError":case"RecognitionFailedError":return"Não foi possível reconhecer seu rosto. Tente se posicionar em um local mais iluminado.";case"ValidationError":return"Dados inválidos ou rosto não detectado corretamente.";case"ConsentDeniedError":return"É necessário aceitar o uso do seu rosto para continuar.";case"LivenessBlinkMissingError":return"Não detectamos uma piscada. Pisque os olhos naturalmente e tente novamente.";case"ApiError":return this.message.includes("400")?"Requisição inválida. Tente novamente.":this.message.includes("500")?"Ocorreu um erro interno no sistema. Tente mais tarde.":"O serviço encontrou um problema inesperado.";default:return"Ocorreu um erro inesperado. Por favor, tente novamente."}}}function m(e,n,t){function o(t,o){if(t._zod||Object.defineProperty(t,"_zod",{value:{def:o,constr:i,traits:new Set},enumerable:!1}),t._zod.traits.has(e))return;t._zod.traits.add(e),n(t,o);const r=i.prototype,a=Object.keys(r);for(let e=0;e<a.length;e++){const n=a[e];n in t||(t[n]=r[n].bind(t))}}const r=(null==t?void 0:t.Parent)??Object;class a extends r{}function i(e){var n;const r=(null==t?void 0:t.Parent)?new a:this;o(r,e),(n=r._zod).deferred??(n.deferred=[]);for(const t of r._zod.deferred)t();return r}return Object.defineProperty(a,"name",{value:e}),Object.defineProperty(i,"init",{value:o}),Object.defineProperty(i,Symbol.hasInstance,{value:n=>{var o,r;return!!((null==t?void 0:t.Parent)&&n instanceof t.Parent)||(null==(r=null==(o=null==n?void 0:n._zod)?void 0:o.traits)?void 0:r.has(e))}}),Object.defineProperty(i,"name",{value:e}),i}class g extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class v extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name="ZodEncodeError"}}const b={};function w(e){return b}function y(e){const n=Object.values(e).filter((e=>"number"==typeof e));return Object.entries(e).filter((([e,t])=>-1===n.indexOf(+e))).map((([e,n])=>n))}function x(e,n){return"bigint"==typeof n?n.toString():n}function k(e){return{get value(){{const n=e();return Object.defineProperty(this,"value",{value:n}),n}}}}function E(e){return null==e}function _(e){const n=e.startsWith("^")?1:0,t=e.endsWith("$")?e.length-1:e.length;return e.slice(n,t)}const R=Symbol("evaluating");function N(e,n,t){let o;Object.defineProperty(e,n,{get(){if(o!==R)return void 0===o&&(o=R,o=t()),o},set(t){Object.defineProperty(e,n,{value:t})},configurable:!0})}function T(e,n,t){Object.defineProperty(e,n,{value:t,writable:!0,enumerable:!0,configurable:!0})}function O(...e){const n={};for(const t of e){const e=Object.getOwnPropertyDescriptors(t);Object.assign(n,e)}return Object.defineProperties({},n)}function S(e){return JSON.stringify(e)}const I="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function C(e){return"object"==typeof e&&null!==e&&!Array.isArray(e)}const z=k((()=>{var e;if("undefined"!=typeof navigator&&(null==(e=null==navigator?void 0:navigator.userAgent)?void 0:e.includes("Cloudflare")))return!1;try{return new Function(""),!0}catch(n){return!1}}));function j(e){if(!1===C(e))return!1;const n=e.constructor;if(void 0===n)return!0;if("function"!=typeof n)return!0;const t=n.prototype;return!1!==C(t)&&!1!==Object.prototype.hasOwnProperty.call(t,"isPrototypeOf")}function A(e){return j(e)?{...e}:Array.isArray(e)?[...e]:e}const F=new Set(["string","number","symbol"]);function $(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function P(e,n,t){const o=new e._zod.constr(n??e._zod.def);return n&&!(null==t?void 0:t.parent)||(o._zod.parent=e),o}function D(e){const n=e;if(!n)return{};if("string"==typeof n)return{error:()=>n};if(void 0!==(null==n?void 0:n.message)){if(void 0!==(null==n?void 0:n.error))throw new Error("Cannot specify both `message` and `error` params");n.error=n.message}return delete n.message,"string"==typeof n.error?{...n,error:()=>n.error}:n}const L={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]};function M(e,n=0){var t;if(!0===e.aborted)return!0;for(let o=n;o<e.issues.length;o++)if(!0!==(null==(t=e.issues[o])?void 0:t.continue))return!0;return!1}function q(e,n){return n.map((n=>{var t;return(t=n).path??(t.path=[]),n.path.unshift(e),n}))}function U(e){return"string"==typeof e?e:null==e?void 0:e.message}function B(e,n,t){var o,r,a,i,s,c;const d={...e,path:e.path??[]};if(!e.message){const l=U(null==(a=null==(r=null==(o=e.inst)?void 0:o._zod.def)?void 0:r.error)?void 0:a.call(r,e))??U(null==(i=null==n?void 0:n.error)?void 0:i.call(n,e))??U(null==(s=t.customError)?void 0:s.call(t,e))??U(null==(c=t.localeError)?void 0:c.call(t,e))??"Invalid input";d.message=l}return delete d.inst,delete d.continue,(null==n?void 0:n.reportInput)||delete d.input,d}function W(e){return Array.isArray(e)?"array":"string"==typeof e?"string":"unknown"}function V(...e){const[n,t,o]=e;return"string"==typeof n?{message:n,code:"custom",input:t,inst:o}:{...n}}const Z=(e,n)=>{e.name="$ZodError",Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:n,enumerable:!1}),e.message=JSON.stringify(n,x,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},K=m("$ZodError",Z),J=m("$ZodError",Z,{Parent:Error});const G=e=>(n,t,o,r)=>{const a=o?Object.assign(o,{async:!1}):{async:!1},i=n._zod.run({value:t,issues:[]},a);if(i instanceof Promise)throw new g;if(i.issues.length){const n=new((null==r?void 0:r.Err)??e)(i.issues.map((e=>B(e,a,w()))));throw I(n,null==r?void 0:r.callee),n}return i.value},H=e=>async(n,t,o,r)=>{const a=o?Object.assign(o,{async:!0}):{async:!0};let i=n._zod.run({value:t,issues:[]},a);if(i instanceof Promise&&(i=await i),i.issues.length){const n=new((null==r?void 0:r.Err)??e)(i.issues.map((e=>B(e,a,w()))));throw I(n,null==r?void 0:r.callee),n}return i.value},X=e=>(n,t,o)=>{const r=o?{...o,async:!1}:{async:!1},a=n._zod.run({value:t,issues:[]},r);if(a instanceof Promise)throw new g;return a.issues.length?{success:!1,error:new(e??K)(a.issues.map((e=>B(e,r,w()))))}:{success:!0,data:a.value}},Y=X(J),Q=e=>async(n,t,o)=>{const r=o?Object.assign(o,{async:!0}):{async:!0};let a=n._zod.run({value:t,issues:[]},r);return a instanceof Promise&&(a=await a),a.issues.length?{success:!1,error:new e(a.issues.map((e=>B(e,r,w()))))}:{success:!0,data:a.value}},ee=Q(J),ne=e=>(n,t,o)=>{const r=o?Object.assign(o,{direction:"backward"}):{direction:"backward"};return G(e)(n,t,r)},te=e=>(n,t,o)=>G(e)(n,t,o),oe=e=>async(n,t,o)=>{const r=o?Object.assign(o,{direction:"backward"}):{direction:"backward"};return H(e)(n,t,r)},re=e=>async(n,t,o)=>H(e)(n,t,o),ae=e=>(n,t,o)=>{const r=o?Object.assign(o,{direction:"backward"}):{direction:"backward"};return X(e)(n,t,r)},ie=e=>(n,t,o)=>X(e)(n,t,o),se=e=>async(n,t,o)=>{const r=o?Object.assign(o,{direction:"backward"}):{direction:"backward"};return Q(e)(n,t,r)},ce=e=>async(n,t,o)=>Q(e)(n,t,o),de=/^[cC][^\s-]{8,}$/,le=/^[0-9a-z]+$/,ue=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,pe=/^[0-9a-vA-V]{20}$/,fe=/^[A-Za-z0-9]{27}$/,he=/^[a-zA-Z0-9_-]{21}$/,me=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,ge=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,ve=e=>e?new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,be=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/;const we=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,ye=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,xe=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,ke=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,Ee=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,_e=/^[A-Za-z0-9_-]*$/,Re=/^\+[1-9]\d{6,14}$/,Ne="(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))",Te=new RegExp(`^${Ne}$`);function Oe(e){const n="(?:[01]\\d|2[0-3]):[0-5]\\d";return"number"==typeof e.precision?-1===e.precision?`${n}`:0===e.precision?`${n}:[0-5]\\d`:`${n}:[0-5]\\d\\.\\d{${e.precision}}`:`${n}(?::[0-5]\\d(?:\\.\\d+)?)?`}const Se=/^-?\d+$/,Ie=/^-?\d+(?:\.\d+)?$/,Ce=/^(?:true|false)$/i,ze=/^[^A-Z]*$/,je=/^[^a-z]*$/,Ae=m("$ZodCheck",((e,n)=>{var t;e._zod??(e._zod={}),e._zod.def=n,(t=e._zod).onattach??(t.onattach=[])})),Fe={number:"number",bigint:"bigint",object:"date"},$e=m("$ZodCheckLessThan",((e,n)=>{Ae.init(e,n);const t=Fe[typeof n.value];e._zod.onattach.push((e=>{const t=e._zod.bag,o=(n.inclusive?t.maximum:t.exclusiveMaximum)??Number.POSITIVE_INFINITY;n.value<o&&(n.inclusive?t.maximum=n.value:t.exclusiveMaximum=n.value)})),e._zod.check=o=>{(n.inclusive?o.value<=n.value:o.value<n.value)||o.issues.push({origin:t,code:"too_big",maximum:"object"==typeof n.value?n.value.getTime():n.value,input:o.value,inclusive:n.inclusive,inst:e,continue:!n.abort})}})),Pe=m("$ZodCheckGreaterThan",((e,n)=>{Ae.init(e,n);const t=Fe[typeof n.value];e._zod.onattach.push((e=>{const t=e._zod.bag,o=(n.inclusive?t.minimum:t.exclusiveMinimum)??Number.NEGATIVE_INFINITY;n.value>o&&(n.inclusive?t.minimum=n.value:t.exclusiveMinimum=n.value)})),e._zod.check=o=>{(n.inclusive?o.value>=n.value:o.value>n.value)||o.issues.push({origin:t,code:"too_small",minimum:"object"==typeof n.value?n.value.getTime():n.value,input:o.value,inclusive:n.inclusive,inst:e,continue:!n.abort})}})),De=m("$ZodCheckMultipleOf",((e,n)=>{Ae.init(e,n),e._zod.onattach.push((e=>{var t;(t=e._zod.bag).multipleOf??(t.multipleOf=n.value)})),e._zod.check=t=>{if(typeof t.value!=typeof n.value)throw new Error("Cannot mix number and bigint in multiple_of check.");("bigint"==typeof t.value?t.value%n.value===BigInt(0):0===function(e,n){const t=(e.toString().split(".")[1]||"").length,o=n.toString();let r=(o.split(".")[1]||"").length;if(0===r&&/\d?e-\d?/.test(o)){const e=o.match(/\d?e-(\d?)/);(null==e?void 0:e[1])&&(r=Number.parseInt(e[1]))}const a=t>r?t:r;return Number.parseInt(e.toFixed(a).replace(".",""))%Number.parseInt(n.toFixed(a).replace(".",""))/10**a}(t.value,n.value))||t.issues.push({origin:typeof t.value,code:"not_multiple_of",divisor:n.value,input:t.value,inst:e,continue:!n.abort})}})),Le=m("$ZodCheckNumberFormat",((e,n)=>{var t;Ae.init(e,n),n.format=n.format||"float64";const o=null==(t=n.format)?void 0:t.includes("int"),r=o?"int":"number",[a,i]=L[n.format];e._zod.onattach.push((e=>{const t=e._zod.bag;t.format=n.format,t.minimum=a,t.maximum=i,o&&(t.pattern=Se)})),e._zod.check=t=>{const s=t.value;if(o){if(!Number.isInteger(s))return void t.issues.push({expected:r,format:n.format,code:"invalid_type",continue:!1,input:s,inst:e});if(!Number.isSafeInteger(s))return void(s>0?t.issues.push({input:s,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:r,inclusive:!0,continue:!n.abort}):t.issues.push({input:s,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:r,inclusive:!0,continue:!n.abort}))}s<a&&t.issues.push({origin:"number",input:s,code:"too_small",minimum:a,inclusive:!0,inst:e,continue:!n.abort}),s>i&&t.issues.push({origin:"number",input:s,code:"too_big",maximum:i,inclusive:!0,inst:e,continue:!n.abort})}})),Me=m("$ZodCheckMaxLength",((e,n)=>{var t;Ae.init(e,n),(t=e._zod.def).when??(t.when=e=>{const n=e.value;return!E(n)&&void 0!==n.length}),e._zod.onattach.push((e=>{const t=e._zod.bag.maximum??Number.POSITIVE_INFINITY;n.maximum<t&&(e._zod.bag.maximum=n.maximum)})),e._zod.check=t=>{const o=t.value;if(o.length<=n.maximum)return;const r=W(o);t.issues.push({origin:r,code:"too_big",maximum:n.maximum,inclusive:!0,input:o,inst:e,continue:!n.abort})}})),qe=m("$ZodCheckMinLength",((e,n)=>{var t;Ae.init(e,n),(t=e._zod.def).when??(t.when=e=>{const n=e.value;return!E(n)&&void 0!==n.length}),e._zod.onattach.push((e=>{const t=e._zod.bag.minimum??Number.NEGATIVE_INFINITY;n.minimum>t&&(e._zod.bag.minimum=n.minimum)})),e._zod.check=t=>{const o=t.value;if(o.length>=n.minimum)return;const r=W(o);t.issues.push({origin:r,code:"too_small",minimum:n.minimum,inclusive:!0,input:o,inst:e,continue:!n.abort})}})),Ue=m("$ZodCheckLengthEquals",((e,n)=>{var t;Ae.init(e,n),(t=e._zod.def).when??(t.when=e=>{const n=e.value;return!E(n)&&void 0!==n.length}),e._zod.onattach.push((e=>{const t=e._zod.bag;t.minimum=n.length,t.maximum=n.length,t.length=n.length})),e._zod.check=t=>{const o=t.value,r=o.length;if(r===n.length)return;const a=W(o),i=r>n.length;t.issues.push({origin:a,...i?{code:"too_big",maximum:n.length}:{code:"too_small",minimum:n.length},inclusive:!0,exact:!0,input:t.value,inst:e,continue:!n.abort})}})),Be=m("$ZodCheckStringFormat",((e,n)=>{var t,o;Ae.init(e,n),e._zod.onattach.push((e=>{const t=e._zod.bag;t.format=n.format,n.pattern&&(t.patterns??(t.patterns=new Set),t.patterns.add(n.pattern))})),n.pattern?(t=e._zod).check??(t.check=t=>{n.pattern.lastIndex=0,n.pattern.test(t.value)||t.issues.push({origin:"string",code:"invalid_format",format:n.format,input:t.value,...n.pattern?{pattern:n.pattern.toString()}:{},inst:e,continue:!n.abort})}):(o=e._zod).check??(o.check=()=>{})})),We=m("$ZodCheckRegex",((e,n)=>{Be.init(e,n),e._zod.check=t=>{n.pattern.lastIndex=0,n.pattern.test(t.value)||t.issues.push({origin:"string",code:"invalid_format",format:"regex",input:t.value,pattern:n.pattern.toString(),inst:e,continue:!n.abort})}})),Ve=m("$ZodCheckLowerCase",((e,n)=>{n.pattern??(n.pattern=ze),Be.init(e,n)})),Ze=m("$ZodCheckUpperCase",((e,n)=>{n.pattern??(n.pattern=je),Be.init(e,n)})),Ke=m("$ZodCheckIncludes",((e,n)=>{Ae.init(e,n);const t=$(n.includes),o=new RegExp("number"==typeof n.position?`^.{${n.position}}${t}`:t);n.pattern=o,e._zod.onattach.push((e=>{const n=e._zod.bag;n.patterns??(n.patterns=new Set),n.patterns.add(o)})),e._zod.check=t=>{t.value.includes(n.includes,n.position)||t.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:n.includes,input:t.value,inst:e,continue:!n.abort})}})),Je=m("$ZodCheckStartsWith",((e,n)=>{Ae.init(e,n);const t=new RegExp(`^${$(n.prefix)}.*`);n.pattern??(n.pattern=t),e._zod.onattach.push((e=>{const n=e._zod.bag;n.patterns??(n.patterns=new Set),n.patterns.add(t)})),e._zod.check=t=>{t.value.startsWith(n.prefix)||t.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:n.prefix,input:t.value,inst:e,continue:!n.abort})}})),Ge=m("$ZodCheckEndsWith",((e,n)=>{Ae.init(e,n);const t=new RegExp(`.*${$(n.suffix)}$`);n.pattern??(n.pattern=t),e._zod.onattach.push((e=>{const n=e._zod.bag;n.patterns??(n.patterns=new Set),n.patterns.add(t)})),e._zod.check=t=>{t.value.endsWith(n.suffix)||t.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:n.suffix,input:t.value,inst:e,continue:!n.abort})}})),He=m("$ZodCheckOverwrite",((e,n)=>{Ae.init(e,n),e._zod.check=e=>{e.value=n.tx(e.value)}}));class Xe{constructor(e=[]){this.content=[],this.indent=0,this&&(this.args=e)}indented(e){this.indent+=1,e(this),this.indent-=1}write(e){if("function"==typeof e)return e(this,{execution:"sync"}),void e(this,{execution:"async"});const n=e.split("\n").filter((e=>e)),t=Math.min(...n.map((e=>e.length-e.trimStart().length))),o=n.map((e=>e.slice(t))).map((e=>" ".repeat(2*this.indent)+e));for(const r of o)this.content.push(r)}compile(){return new Function(...null==this?void 0:this.args,[...((null==this?void 0:this.content)??[""]).map((e=>` ${e}`))].join("\n"))}}const Ye={major:4,minor:3,patch:6},Qe=m("$ZodType",((e,n)=>{var t,o;e??(e={}),e._zod.def=n,e._zod.bag=e._zod.bag||{},e._zod.version=Ye;const r=[...e._zod.def.checks??[]];e._zod.traits.has("$ZodCheck")&&r.unshift(e);for(const a of r)for(const n of a._zod.onattach)n(e);if(0===r.length)(o=e._zod).deferred??(o.deferred=[]),null==(t=e._zod.deferred)||t.push((()=>{e._zod.run=e._zod.parse}));else{const n=(e,n,t)=>{let o,r=M(e);for(const a of n){if(a._zod.def.when){if(!a._zod.def.when(e))continue}else if(r)continue;const n=e.issues.length,i=a._zod.check(e);if(i instanceof Promise&&!1===(null==t?void 0:t.async))throw new g;if(o||i instanceof Promise)o=(o??Promise.resolve()).then((async()=>{await i;e.issues.length!==n&&(r||(r=M(e,n)))}));else{if(e.issues.length===n)continue;r||(r=M(e,n))}}return o?o.then((()=>e)):e},t=(t,o,a)=>{if(M(t))return t.aborted=!0,t;const i=n(o,r,a);if(i instanceof Promise){if(!1===a.async)throw new g;return i.then((n=>e._zod.parse(n,a)))}return e._zod.parse(i,a)};e._zod.run=(o,a)=>{if(a.skipChecks)return e._zod.parse(o,a);if("backward"===a.direction){const n=e._zod.parse({value:o.value,issues:[]},{...a,skipChecks:!0});return n instanceof Promise?n.then((e=>t(e,o,a))):t(n,o,a)}const i=e._zod.parse(o,a);if(i instanceof Promise){if(!1===a.async)throw new g;return i.then((e=>n(e,r,a)))}return n(i,r,a)}}N(e,"~standard",(()=>({validate:n=>{var t;try{const o=Y(e,n);return o.success?{value:o.data}:{issues:null==(t=o.error)?void 0:t.issues}}catch(o){return ee(e,n).then((e=>{var n;return e.success?{value:e.data}:{issues:null==(n=e.error)?void 0:n.issues}}))}},vendor:"zod",version:1})))})),en=m("$ZodString",((e,n)=>{var t;Qe.init(e,n),e._zod.pattern=[...(null==(t=null==e?void 0:e._zod.bag)?void 0:t.patterns)??[]].pop()??(e=>{const n=e?`[\\s\\S]{${(null==e?void 0:e.minimum)??0},${(null==e?void 0:e.maximum)??""}}`:"[\\s\\S]*";return new RegExp(`^${n}$`)})(e._zod.bag),e._zod.parse=(t,o)=>{if(n.coerce)try{t.value=String(t.value)}catch(r){}return"string"==typeof t.value||t.issues.push({expected:"string",code:"invalid_type",input:t.value,inst:e}),t}})),nn=m("$ZodStringFormat",((e,n)=>{Be.init(e,n),en.init(e,n)})),tn=m("$ZodGUID",((e,n)=>{n.pattern??(n.pattern=ge),nn.init(e,n)})),on=m("$ZodUUID",((e,n)=>{if(n.version){const e={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[n.version];if(void 0===e)throw new Error(`Invalid UUID version: "${n.version}"`);n.pattern??(n.pattern=ve(e))}else n.pattern??(n.pattern=ve());nn.init(e,n)})),rn=m("$ZodEmail",((e,n)=>{n.pattern??(n.pattern=be),nn.init(e,n)})),an=m("$ZodURL",((e,n)=>{nn.init(e,n),e._zod.check=t=>{try{const o=t.value.trim(),r=new URL(o);return n.hostname&&(n.hostname.lastIndex=0,n.hostname.test(r.hostname)||t.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:n.hostname.source,input:t.value,inst:e,continue:!n.abort})),n.protocol&&(n.protocol.lastIndex=0,n.protocol.test(r.protocol.endsWith(":")?r.protocol.slice(0,-1):r.protocol)||t.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:n.protocol.source,input:t.value,inst:e,continue:!n.abort})),void(n.normalize?t.value=r.href:t.value=o)}catch(o){t.issues.push({code:"invalid_format",format:"url",input:t.value,inst:e,continue:!n.abort})}}})),sn=m("$ZodEmoji",((e,n)=>{n.pattern??(n.pattern=new RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),nn.init(e,n)})),cn=m("$ZodNanoID",((e,n)=>{n.pattern??(n.pattern=he),nn.init(e,n)})),dn=m("$ZodCUID",((e,n)=>{n.pattern??(n.pattern=de),nn.init(e,n)})),ln=m("$ZodCUID2",((e,n)=>{n.pattern??(n.pattern=le),nn.init(e,n)})),un=m("$ZodULID",((e,n)=>{n.pattern??(n.pattern=ue),nn.init(e,n)})),pn=m("$ZodXID",((e,n)=>{n.pattern??(n.pattern=pe),nn.init(e,n)})),fn=m("$ZodKSUID",((e,n)=>{n.pattern??(n.pattern=fe),nn.init(e,n)})),hn=m("$ZodISODateTime",((e,n)=>{n.pattern??(n.pattern=function(e){const n=Oe({precision:e.precision}),t=["Z"];e.local&&t.push(""),e.offset&&t.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");const o=`${n}(?:${t.join("|")})`;return new RegExp(`^${Ne}T(?:${o})$`)}(n)),nn.init(e,n)})),mn=m("$ZodISODate",((e,n)=>{n.pattern??(n.pattern=Te),nn.init(e,n)})),gn=m("$ZodISOTime",((e,n)=>{n.pattern??(n.pattern=new RegExp(`^${Oe(n)}$`)),nn.init(e,n)})),vn=m("$ZodISODuration",((e,n)=>{n.pattern??(n.pattern=me),nn.init(e,n)})),bn=m("$ZodIPv4",((e,n)=>{n.pattern??(n.pattern=we),nn.init(e,n),e._zod.bag.format="ipv4"})),wn=m("$ZodIPv6",((e,n)=>{n.pattern??(n.pattern=ye),nn.init(e,n),e._zod.bag.format="ipv6",e._zod.check=t=>{try{new URL(`http://[${t.value}]`)}catch{t.issues.push({code:"invalid_format",format:"ipv6",input:t.value,inst:e,continue:!n.abort})}}})),yn=m("$ZodCIDRv4",((e,n)=>{n.pattern??(n.pattern=xe),nn.init(e,n)})),xn=m("$ZodCIDRv6",((e,n)=>{n.pattern??(n.pattern=ke),nn.init(e,n),e._zod.check=t=>{const o=t.value.split("/");try{if(2!==o.length)throw new Error;const[e,n]=o;if(!n)throw new Error;const t=Number(n);if(`${t}`!==n)throw new Error;if(t<0||t>128)throw new Error;new URL(`http://[${e}]`)}catch{t.issues.push({code:"invalid_format",format:"cidrv6",input:t.value,inst:e,continue:!n.abort})}}}));function kn(e){if(""===e)return!0;if(e.length%4!=0)return!1;try{return atob(e),!0}catch{return!1}}const En=m("$ZodBase64",((e,n)=>{n.pattern??(n.pattern=Ee),nn.init(e,n),e._zod.bag.contentEncoding="base64",e._zod.check=t=>{kn(t.value)||t.issues.push({code:"invalid_format",format:"base64",input:t.value,inst:e,continue:!n.abort})}}));const _n=m("$ZodBase64URL",((e,n)=>{n.pattern??(n.pattern=_e),nn.init(e,n),e._zod.bag.contentEncoding="base64url",e._zod.check=t=>{(function(e){if(!_e.test(e))return!1;const n=e.replace(/[-_]/g,(e=>"-"===e?"+":"/"));return kn(n.padEnd(4*Math.ceil(n.length/4),"="))})(t.value)||t.issues.push({code:"invalid_format",format:"base64url",input:t.value,inst:e,continue:!n.abort})}})),Rn=m("$ZodE164",((e,n)=>{n.pattern??(n.pattern=Re),nn.init(e,n)}));const Nn=m("$ZodJWT",((e,n)=>{nn.init(e,n),e._zod.check=t=>{(function(e,n=null){try{const t=e.split(".");if(3!==t.length)return!1;const[o]=t;if(!o)return!1;const r=JSON.parse(atob(o));return!("typ"in r&&"JWT"!==(null==r?void 0:r.typ)||!r.alg||n&&(!("alg"in r)||r.alg!==n))}catch{return!1}})(t.value,n.alg)||t.issues.push({code:"invalid_format",format:"jwt",input:t.value,inst:e,continue:!n.abort})}})),Tn=m("$ZodNumber",((e,n)=>{Qe.init(e,n),e._zod.pattern=e._zod.bag.pattern??Ie,e._zod.parse=(t,o)=>{if(n.coerce)try{t.value=Number(t.value)}catch(i){}const r=t.value;if("number"==typeof r&&!Number.isNaN(r)&&Number.isFinite(r))return t;const a="number"==typeof r?Number.isNaN(r)?"NaN":Number.isFinite(r)?void 0:"Infinity":void 0;return t.issues.push({expected:"number",code:"invalid_type",input:r,inst:e,...a?{received:a}:{}}),t}})),On=m("$ZodNumberFormat",((e,n)=>{Le.init(e,n),Tn.init(e,n)})),Sn=m("$ZodBoolean",((e,n)=>{Qe.init(e,n),e._zod.pattern=Ce,e._zod.parse=(t,o)=>{if(n.coerce)try{t.value=Boolean(t.value)}catch(a){}const r=t.value;return"boolean"==typeof r||t.issues.push({expected:"boolean",code:"invalid_type",input:r,inst:e}),t}})),In=m("$ZodAny",((e,n)=>{Qe.init(e,n),e._zod.parse=e=>e})),Cn=m("$ZodUnknown",((e,n)=>{Qe.init(e,n),e._zod.parse=e=>e})),zn=m("$ZodNever",((e,n)=>{Qe.init(e,n),e._zod.parse=(n,t)=>(n.issues.push({expected:"never",code:"invalid_type",input:n.value,inst:e}),n)}));function jn(e,n,t){e.issues.length&&n.issues.push(...q(t,e.issues)),n.value[t]=e.value}const An=m("$ZodArray",((e,n)=>{Qe.init(e,n),e._zod.parse=(t,o)=>{const r=t.value;if(!Array.isArray(r))return t.issues.push({expected:"array",code:"invalid_type",input:r,inst:e}),t;t.value=Array(r.length);const a=[];for(let e=0;e<r.length;e++){const i=r[e],s=n.element._zod.run({value:i,issues:[]},o);s instanceof Promise?a.push(s.then((n=>jn(n,t,e)))):jn(s,t,e)}return a.length?Promise.all(a).then((()=>t)):t}}));function Fn(e,n,t,o,r){if(e.issues.length){if(r&&!(t in o))return;n.issues.push(...q(t,e.issues))}void 0===e.value?t in o&&(n.value[t]=void 0):n.value[t]=e.value}function $n(e){var n,t,o,r;const a=Object.keys(e.shape);for(const c of a)if(!(null==(r=null==(o=null==(t=null==(n=e.shape)?void 0:n[c])?void 0:t._zod)?void 0:o.traits)?void 0:r.has("$ZodType")))throw new Error(`Invalid element at key "${c}": expected a Zod schema`);const i=(s=e.shape,Object.keys(s).filter((e=>"optional"===s[e]._zod.optin&&"optional"===s[e]._zod.optout)));var s;return{...e,keys:a,keySet:new Set(a),numKeys:a.length,optionalKeys:new Set(i)}}function Pn(e,n,t,o,r,a){const i=[],s=r.keySet,c=r.catchall._zod,d=c.def.type,l="optional"===c.optout;for(const u in n){if(s.has(u))continue;if("never"===d){i.push(u);continue}const r=c.run({value:n[u],issues:[]},o);r instanceof Promise?e.push(r.then((e=>Fn(e,t,u,n,l)))):Fn(r,t,u,n,l)}return i.length&&t.issues.push({code:"unrecognized_keys",keys:i,input:n,inst:a}),e.length?Promise.all(e).then((()=>t)):t}const Dn=m("$ZodObject",((e,n)=>{Qe.init(e,n);const t=Object.getOwnPropertyDescriptor(n,"shape");if(!(null==t?void 0:t.get)){const e=n.shape;Object.defineProperty(n,"shape",{get:()=>{const t={...e};return Object.defineProperty(n,"shape",{value:t}),t}})}const o=k((()=>$n(n)));N(e._zod,"propValues",(()=>{const e=n.shape,t={};for(const n in e){const o=e[n]._zod;if(o.values){t[n]??(t[n]=new Set);for(const e of o.values)t[n].add(e)}}return t}));const r=C,a=n.catchall;let i;e._zod.parse=(n,t)=>{i??(i=o.value);const s=n.value;if(!r(s))return n.issues.push({expected:"object",code:"invalid_type",input:s,inst:e}),n;n.value={};const c=[],d=i.shape;for(const e of i.keys){const o=d[e],r="optional"===o._zod.optout,a=o._zod.run({value:s[e],issues:[]},t);a instanceof Promise?c.push(a.then((t=>Fn(t,n,e,s,r)))):Fn(a,n,e,s,r)}return a?Pn(c,s,n,t,o.value,e):c.length?Promise.all(c).then((()=>n)):n}})),Ln=m("$ZodObjectJIT",((e,n)=>{Dn.init(e,n);const t=e._zod.parse,o=k((()=>$n(n)));let r;const a=C,i=!b.jitless,s=i&&z.value,c=n.catchall;let d;e._zod.parse=(l,u)=>{d??(d=o.value);const p=l.value;return a(p)?i&&s&&!1===(null==u?void 0:u.async)&&!0!==u.jitless?(r||(r=(e=>{var n;const t=new Xe(["shape","payload","ctx"]),r=o.value,a=e=>{const n=S(e);return`shape[${n}]._zod.run({ value: input[${n}], issues: [] }, ctx)`};t.write("const input = payload.value;");const i=Object.create(null);let s=0;for(const o of r.keys)i[o]="key_"+s++;t.write("const newResult = {};");for(const o of r.keys){const r=i[o],s=S(o),c=e[o],d="optional"===(null==(n=null==c?void 0:c._zod)?void 0:n.optout);t.write(`const ${r} = ${a(o)};`),d?t.write(`\n if (${r}.issues.length) {\n if (${s} in input) {\n payload.issues = payload.issues.concat(${r}.issues.map(iss => ({\n ...iss,\n path: iss.path ? [${s}, ...iss.path] : [${s}]\n })));\n }\n }\n \n if (${r}.value === undefined) {\n if (${s} in input) {\n newResult[${s}] = undefined;\n }\n } else {\n newResult[${s}] = ${r}.value;\n }\n \n `):t.write(`\n if (${r}.issues.length) {\n payload.issues = payload.issues.concat(${r}.issues.map(iss => ({\n ...iss,\n path: iss.path ? [${s}, ...iss.path] : [${s}]\n })));\n }\n \n if (${r}.value === undefined) {\n if (${s} in input) {\n newResult[${s}] = undefined;\n }\n } else {\n newResult[${s}] = ${r}.value;\n }\n \n `)}t.write("payload.value = newResult;"),t.write("return payload;");const c=t.compile();return(n,t)=>c(e,n,t)})(n.shape)),l=r(l,u),c?Pn([],p,l,u,d,e):l):t(l,u):(l.issues.push({expected:"object",code:"invalid_type",input:p,inst:e}),l)}}));function Mn(e,n,t,o){for(const a of e)if(0===a.issues.length)return n.value=a.value,n;const r=e.filter((e=>!M(e)));return 1===r.length?(n.value=r[0].value,r[0]):(n.issues.push({code:"invalid_union",input:n.value,inst:t,errors:e.map((e=>e.issues.map((e=>B(e,o,w())))))}),n)}const qn=m("$ZodUnion",((e,n)=>{Qe.init(e,n),N(e._zod,"optin",(()=>n.options.some((e=>"optional"===e._zod.optin))?"optional":void 0)),N(e._zod,"optout",(()=>n.options.some((e=>"optional"===e._zod.optout))?"optional":void 0)),N(e._zod,"values",(()=>{if(n.options.every((e=>e._zod.values)))return new Set(n.options.flatMap((e=>Array.from(e._zod.values))))})),N(e._zod,"pattern",(()=>{if(n.options.every((e=>e._zod.pattern))){const e=n.options.map((e=>e._zod.pattern));return new RegExp(`^(${e.map((e=>_(e.source))).join("|")})$`)}}));const t=1===n.options.length,o=n.options[0]._zod.run;e._zod.parse=(r,a)=>{if(t)return o(r,a);let i=!1;const s=[];for(const e of n.options){const n=e._zod.run({value:r.value,issues:[]},a);if(n instanceof Promise)s.push(n),i=!0;else{if(0===n.issues.length)return n;s.push(n)}}return i?Promise.all(s).then((n=>Mn(n,r,e,a))):Mn(s,r,e,a)}})),Un=m("$ZodIntersection",((e,n)=>{Qe.init(e,n),e._zod.parse=(e,t)=>{const o=e.value,r=n.left._zod.run({value:o,issues:[]},t),a=n.right._zod.run({value:o,issues:[]},t);return r instanceof Promise||a instanceof Promise?Promise.all([r,a]).then((([n,t])=>Wn(e,n,t))):Wn(e,r,a)}}));function Bn(e,n){if(e===n)return{valid:!0,data:e};if(e instanceof Date&&n instanceof Date&&+e==+n)return{valid:!0,data:e};if(j(e)&&j(n)){const t=Object.keys(n),o=Object.keys(e).filter((e=>-1!==t.indexOf(e))),r={...e,...n};for(const a of o){const t=Bn(e[a],n[a]);if(!t.valid)return{valid:!1,mergeErrorPath:[a,...t.mergeErrorPath]};r[a]=t.data}return{valid:!0,data:r}}if(Array.isArray(e)&&Array.isArray(n)){if(e.length!==n.length)return{valid:!1,mergeErrorPath:[]};const t=[];for(let o=0;o<e.length;o++){const r=Bn(e[o],n[o]);if(!r.valid)return{valid:!1,mergeErrorPath:[o,...r.mergeErrorPath]};t.push(r.data)}return{valid:!0,data:t}}return{valid:!1,mergeErrorPath:[]}}function Wn(e,n,t){const o=new Map;let r;for(const s of n.issues)if("unrecognized_keys"===s.code){r??(r=s);for(const e of s.keys)o.has(e)||o.set(e,{}),o.get(e).l=!0}else e.issues.push(s);for(const s of t.issues)if("unrecognized_keys"===s.code)for(const e of s.keys)o.has(e)||o.set(e,{}),o.get(e).r=!0;else e.issues.push(s);const a=[...o].filter((([,e])=>e.l&&e.r)).map((([e])=>e));if(a.length&&r&&e.issues.push({...r,keys:a}),M(e))return e;const i=Bn(n.value,t.value);if(!i.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(i.mergeErrorPath)}`);return e.value=i.data,e}const Vn=m("$ZodEnum",((e,n)=>{Qe.init(e,n);const t=y(n.entries),o=new Set(t);e._zod.values=o,e._zod.pattern=new RegExp(`^(${t.filter((e=>F.has(typeof e))).map((e=>"string"==typeof e?$(e):e.toString())).join("|")})$`),e._zod.parse=(n,r)=>{const a=n.value;return o.has(a)||n.issues.push({code:"invalid_value",values:t,input:a,inst:e}),n}})),Zn=m("$ZodTransform",((e,n)=>{Qe.init(e,n),e._zod.parse=(t,o)=>{if("backward"===o.direction)throw new v(e.constructor.name);const r=n.transform(t.value,t);if(o.async){return(r instanceof Promise?r:Promise.resolve(r)).then((e=>(t.value=e,t)))}if(r instanceof Promise)throw new g;return t.value=r,t}}));function Kn(e,n){return e.issues.length&&void 0===n?{issues:[],value:void 0}:e}const Jn=m("$ZodOptional",((e,n)=>{Qe.init(e,n),e._zod.optin="optional",e._zod.optout="optional",N(e._zod,"values",(()=>n.innerType._zod.values?new Set([...n.innerType._zod.values,void 0]):void 0)),N(e._zod,"pattern",(()=>{const e=n.innerType._zod.pattern;return e?new RegExp(`^(${_(e.source)})?$`):void 0})),e._zod.parse=(e,t)=>{if("optional"===n.innerType._zod.optin){const o=n.innerType._zod.run(e,t);return o instanceof Promise?o.then((n=>Kn(n,e.value))):Kn(o,e.value)}return void 0===e.value?e:n.innerType._zod.run(e,t)}})),Gn=m("$ZodExactOptional",((e,n)=>{Jn.init(e,n),N(e._zod,"values",(()=>n.innerType._zod.values)),N(e._zod,"pattern",(()=>n.innerType._zod.pattern)),e._zod.parse=(e,t)=>n.innerType._zod.run(e,t)})),Hn=m("$ZodNullable",((e,n)=>{Qe.init(e,n),N(e._zod,"optin",(()=>n.innerType._zod.optin)),N(e._zod,"optout",(()=>n.innerType._zod.optout)),N(e._zod,"pattern",(()=>{const e=n.innerType._zod.pattern;return e?new RegExp(`^(${_(e.source)}|null)$`):void 0})),N(e._zod,"values",(()=>n.innerType._zod.values?new Set([...n.innerType._zod.values,null]):void 0)),e._zod.parse=(e,t)=>null===e.value?e:n.innerType._zod.run(e,t)})),Xn=m("$ZodDefault",((e,n)=>{Qe.init(e,n),e._zod.optin="optional",N(e._zod,"values",(()=>n.innerType._zod.values)),e._zod.parse=(e,t)=>{if("backward"===t.direction)return n.innerType._zod.run(e,t);if(void 0===e.value)return e.value=n.defaultValue,e;const o=n.innerType._zod.run(e,t);return o instanceof Promise?o.then((e=>Yn(e,n))):Yn(o,n)}}));function Yn(e,n){return void 0===e.value&&(e.value=n.defaultValue),e}const Qn=m("$ZodPrefault",((e,n)=>{Qe.init(e,n),e._zod.optin="optional",N(e._zod,"values",(()=>n.innerType._zod.values)),e._zod.parse=(e,t)=>("backward"===t.direction||void 0===e.value&&(e.value=n.defaultValue),n.innerType._zod.run(e,t))})),et=m("$ZodNonOptional",((e,n)=>{Qe.init(e,n),N(e._zod,"values",(()=>{const e=n.innerType._zod.values;return e?new Set([...e].filter((e=>void 0!==e))):void 0})),e._zod.parse=(t,o)=>{const r=n.innerType._zod.run(t,o);return r instanceof Promise?r.then((n=>nt(n,e))):nt(r,e)}}));function nt(e,n){return e.issues.length||void 0!==e.value||e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:n}),e}const tt=m("$ZodCatch",((e,n)=>{Qe.init(e,n),N(e._zod,"optin",(()=>n.innerType._zod.optin)),N(e._zod,"optout",(()=>n.innerType._zod.optout)),N(e._zod,"values",(()=>n.innerType._zod.values)),e._zod.parse=(e,t)=>{if("backward"===t.direction)return n.innerType._zod.run(e,t);const o=n.innerType._zod.run(e,t);return o instanceof Promise?o.then((o=>(e.value=o.value,o.issues.length&&(e.value=n.catchValue({...e,error:{issues:o.issues.map((e=>B(e,t,w())))},input:e.value}),e.issues=[]),e))):(e.value=o.value,o.issues.length&&(e.value=n.catchValue({...e,error:{issues:o.issues.map((e=>B(e,t,w())))},input:e.value}),e.issues=[]),e)}})),ot=m("$ZodPipe",((e,n)=>{Qe.init(e,n),N(e._zod,"values",(()=>n.in._zod.values)),N(e._zod,"optin",(()=>n.in._zod.optin)),N(e._zod,"optout",(()=>n.out._zod.optout)),N(e._zod,"propValues",(()=>n.in._zod.propValues)),e._zod.parse=(e,t)=>{if("backward"===t.direction){const o=n.out._zod.run(e,t);return o instanceof Promise?o.then((e=>rt(e,n.in,t))):rt(o,n.in,t)}const o=n.in._zod.run(e,t);return o instanceof Promise?o.then((e=>rt(e,n.out,t))):rt(o,n.out,t)}}));function rt(e,n,t){return e.issues.length?(e.aborted=!0,e):n._zod.run({value:e.value,issues:e.issues},t)}const at=m("$ZodReadonly",((e,n)=>{Qe.init(e,n),N(e._zod,"propValues",(()=>n.innerType._zod.propValues)),N(e._zod,"values",(()=>n.innerType._zod.values)),N(e._zod,"optin",(()=>{var e,t;return null==(t=null==(e=n.innerType)?void 0:e._zod)?void 0:t.optin})),N(e._zod,"optout",(()=>{var e,t;return null==(t=null==(e=n.innerType)?void 0:e._zod)?void 0:t.optout})),e._zod.parse=(e,t)=>{if("backward"===t.direction)return n.innerType._zod.run(e,t);const o=n.innerType._zod.run(e,t);return o instanceof Promise?o.then(it):it(o)}}));function it(e){return e.value=Object.freeze(e.value),e}const st=m("$ZodCustom",((e,n)=>{Ae.init(e,n),Qe.init(e,n),e._zod.parse=(e,n)=>e,e._zod.check=t=>{const o=t.value,r=n.fn(o);if(r instanceof Promise)return r.then((n=>ct(n,t,o,e)));ct(r,t,o,e)}}));function ct(e,n,t,o){if(!e){const e={code:"custom",input:t,inst:o,path:[...o._zod.def.path??[]],continue:!o._zod.def.abort};o._zod.def.params&&(e.params=o._zod.def.params),n.issues.push(V(e))}}var dt;class lt{constructor(){this._map=new WeakMap,this._idmap=new Map}add(e,...n){const t=n[0];return this._map.set(e,t),t&&"object"==typeof t&&"id"in t&&this._idmap.set(t.id,e),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(e){const n=this._map.get(e);return n&&"object"==typeof n&&"id"in n&&this._idmap.delete(n.id),this._map.delete(e),this}get(e){const n=e._zod.parent;if(n){const t={...this.get(n)??{}};delete t.id;const o={...t,...this._map.get(e)};return Object.keys(o).length?o:void 0}return this._map.get(e)}has(e){return this._map.has(e)}}(dt=globalThis).__zod_globalRegistry??(dt.__zod_globalRegistry=new lt);const ut=globalThis.__zod_globalRegistry;function pt(e,n){return new e({type:"string",...D(n)})}function ft(e,n){return new e({type:"string",format:"email",check:"string_format",abort:!1,...D(n)})}function ht(e,n){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...D(n)})}function mt(e,n){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...D(n)})}function gt(e,n){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...D(n)})}function vt(e,n){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...D(n)})}function bt(e,n){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...D(n)})}function wt(e,n){return new e({type:"string",format:"url",check:"string_format",abort:!1,...D(n)})}function yt(e,n){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...D(n)})}function xt(e,n){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...D(n)})}function kt(e,n){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...D(n)})}function Et(e,n){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...D(n)})}function _t(e,n){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...D(n)})}function Rt(e,n){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...D(n)})}function Nt(e,n){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...D(n)})}function Tt(e,n){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...D(n)})}function Ot(e,n){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...D(n)})}function St(e,n){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...D(n)})}function It(e,n){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...D(n)})}function Ct(e,n){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...D(n)})}function zt(e,n){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...D(n)})}function jt(e,n){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...D(n)})}function At(e,n){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...D(n)})}function Ft(e,n){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...D(n)})}function $t(e,n){return new e({type:"string",format:"date",check:"string_format",...D(n)})}function Pt(e,n){return new e({type:"string",format:"time",check:"string_format",precision:null,...D(n)})}function Dt(e,n){return new e({type:"string",format:"duration",check:"string_format",...D(n)})}function Lt(e,n){return new e({type:"number",checks:[],...D(n)})}function Mt(e,n){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...D(n)})}function qt(e,n){return new e({type:"boolean",...D(n)})}function Ut(e){return new e({type:"any"})}function Bt(e){return new e({type:"unknown"})}function Wt(e,n){return new e({type:"never",...D(n)})}function Vt(e,n){return new $e({check:"less_than",...D(n),value:e,inclusive:!1})}function Zt(e,n){return new $e({check:"less_than",...D(n),value:e,inclusive:!0})}function Kt(e,n){return new Pe({check:"greater_than",...D(n),value:e,inclusive:!1})}function Jt(e,n){return new Pe({check:"greater_than",...D(n),value:e,inclusive:!0})}function Gt(e,n){return new De({check:"multiple_of",...D(n),value:e})}function Ht(e,n){return new Me({check:"max_length",...D(n),maximum:e})}function Xt(e,n){return new qe({check:"min_length",...D(n),minimum:e})}function Yt(e,n){return new Ue({check:"length_equals",...D(n),length:e})}function Qt(e,n){return new We({check:"string_format",format:"regex",...D(n),pattern:e})}function eo(e){return new Ve({check:"string_format",format:"lowercase",...D(e)})}function no(e){return new Ze({check:"string_format",format:"uppercase",...D(e)})}function to(e,n){return new Ke({check:"string_format",format:"includes",...D(n),includes:e})}function oo(e,n){return new Je({check:"string_format",format:"starts_with",...D(n),prefix:e})}function ro(e,n){return new Ge({check:"string_format",format:"ends_with",...D(n),suffix:e})}function ao(e){return new He({check:"overwrite",tx:e})}function io(e){return ao((n=>n.normalize(e)))}function so(){return ao((e=>e.trim()))}function co(){return ao((e=>e.toLowerCase()))}function lo(){return ao((e=>e.toUpperCase()))}function uo(){return ao((e=>function(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}(e)))}function po(e,n,t){return new e({type:"array",element:n,...D(t)})}function fo(e,n,t){return new e({type:"custom",check:"custom",fn:n,...D(t)})}function ho(e){const n=mo((t=>(t.addIssue=e=>{if("string"==typeof e)t.issues.push(V(e,t.value,n._zod.def));else{const o=e;o.fatal&&(o.continue=!1),o.code??(o.code="custom"),o.input??(o.input=t.value),o.inst??(o.inst=n),o.continue??(o.continue=!n._zod.def.abort),t.issues.push(V(o))}},e(t.value,t))));return n}function mo(e,n){const t=new Ae({check:"custom",...D(n)});return t._zod.check=e,t}function go(e){let n=(null==e?void 0:e.target)??"draft-2020-12";return"draft-4"===n&&(n="draft-04"),"draft-7"===n&&(n="draft-07"),{processors:e.processors??{},metadataRegistry:(null==e?void 0:e.metadata)??ut,target:n,unrepresentable:(null==e?void 0:e.unrepresentable)??"throw",override:(null==e?void 0:e.override)??(()=>{}),io:(null==e?void 0:e.io)??"output",counter:0,seen:new Map,cycles:(null==e?void 0:e.cycles)??"ref",reused:(null==e?void 0:e.reused)??"inline",external:(null==e?void 0:e.external)??void 0}}function vo(e,n,t={path:[],schemaPath:[]}){var o,r,a;const i=e._zod.def,s=n.seen.get(e);if(s){s.count++;return t.schemaPath.includes(e)&&(s.cycle=t.path),s.schema}const c={schema:{},count:1,cycle:void 0,path:t.path};n.seen.set(e,c);const d=null==(r=(o=e._zod).toJSONSchema)?void 0:r.call(o);if(d)c.schema=d;else{const o={...t,schemaPath:[...t.schemaPath,e],path:t.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(n,c.schema,o);else{const t=c.schema,r=n.processors[i.type];if(!r)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${i.type}`);r(e,n,t,o)}const r=e._zod.parent;r&&(c.ref||(c.ref=r),vo(r,n,o),n.seen.get(r).isParent=!0)}const l=n.metadataRegistry.get(e);l&&Object.assign(c.schema,l),"input"===n.io&&yo(e)&&(delete c.schema.examples,delete c.schema.default),"input"===n.io&&c.schema._prefault&&((a=c.schema).default??(a.default=c.schema._prefault)),delete c.schema._prefault;return n.seen.get(e).schema}function bo(e,n){var t,o,r,a;const i=e.seen.get(n);if(!i)throw new Error("Unprocessed schema. This is a bug in Zod.");const s=new Map;for(const d of e.seen.entries()){const n=null==(t=e.metadataRegistry.get(d[0]))?void 0:t.id;if(n){const e=s.get(n);if(e&&e!==d[0])throw new Error(`Duplicate schema id "${n}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);s.set(n,d[0])}}const c=n=>{if(n[1].schema.$ref)return;const t=n[1],{ref:o,defId:r}=(n=>{var t;const o="draft-2020-12"===e.target?"$defs":"definitions";if(e.external){const r=null==(t=e.external.registry.get(n[0]))?void 0:t.id,a=e.external.uri??(e=>e);if(r)return{ref:a(r)};const i=n[1].defId??n[1].schema.id??"schema"+e.counter++;return n[1].defId=i,{defId:i,ref:`${a("__shared")}#/${o}/${i}`}}if(n[1]===i)return{ref:"#"};const r=`#/${o}/`,a=n[1].schema.id??"__schema"+e.counter++;return{defId:a,ref:r+a}})(n);t.def={...t.schema},r&&(t.defId=r);const a=t.schema;for(const e in a)delete a[e];a.$ref=o};if("throw"===e.cycles)for(const d of e.seen.entries()){const e=d[1];if(e.cycle)throw new Error(`Cycle detected: #/${null==(o=e.cycle)?void 0:o.join("/")}/<root>\n\nSet the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(const d of e.seen.entries()){const t=d[1];if(n===d[0]){c(d);continue}if(e.external){const t=null==(r=e.external.registry.get(d[0]))?void 0:r.id;if(n!==d[0]&&t){c(d);continue}}(null==(a=e.metadataRegistry.get(d[0]))?void 0:a.id)?c(d):(t.cycle||t.count>1&&"ref"===e.reused)&&c(d)}}function wo(e,n){var t,o,r;const a=e.seen.get(n);if(!a)throw new Error("Unprocessed schema. This is a bug in Zod.");const i=n=>{const t=e.seen.get(n);if(null===t.ref)return;const o=t.def??t.schema,r={...o},a=t.ref;if(t.ref=null,a){i(a);const t=e.seen.get(a),s=t.schema;!s.$ref||"draft-07"!==e.target&&"draft-04"!==e.target&&"openapi-3.0"!==e.target?Object.assign(o,s):(o.allOf=o.allOf??[],o.allOf.push(s)),Object.assign(o,r);if(n._zod.parent===a)for(const e in o)"$ref"!==e&&"allOf"!==e&&(e in r||delete o[e]);if(s.$ref&&t.def)for(const e in o)"$ref"!==e&&"allOf"!==e&&e in t.def&&JSON.stringify(o[e])===JSON.stringify(t.def[e])&&delete o[e]}const s=n._zod.parent;if(s&&s!==a){i(s);const n=e.seen.get(s);if((null==n?void 0:n.schema.$ref)&&(o.$ref=n.schema.$ref,n.def))for(const e in o)"$ref"!==e&&"allOf"!==e&&e in n.def&&JSON.stringify(o[e])===JSON.stringify(n.def[e])&&delete o[e]}e.override({zodSchema:n,jsonSchema:o,path:t.path??[]})};for(const l of[...e.seen.entries()].reverse())i(l[0]);const s={};if("draft-2020-12"===e.target?s.$schema="https://json-schema.org/draft/2020-12/schema":"draft-07"===e.target?s.$schema="http://json-schema.org/draft-07/schema#":"draft-04"===e.target?s.$schema="http://json-schema.org/draft-04/schema#":e.target,null==(t=e.external)?void 0:t.uri){const t=null==(o=e.external.registry.get(n))?void 0:o.id;if(!t)throw new Error("Schema is missing an `id` property");s.$id=e.external.uri(t)}Object.assign(s,a.def??a.schema);const c=(null==(r=e.external)?void 0:r.defs)??{};for(const l of e.seen.entries()){const e=l[1];e.def&&e.defId&&(c[e.defId]=e.def)}e.external||Object.keys(c).length>0&&("draft-2020-12"===e.target?s.$defs=c:s.definitions=c);try{const t=JSON.parse(JSON.stringify(s));return Object.defineProperty(t,"~standard",{value:{...n["~standard"],jsonSchema:{input:xo(n,"input",e.processors),output:xo(n,"output",e.processors)}},enumerable:!1,writable:!1}),t}catch(d){throw new Error("Error converting schema to JSON.")}}function yo(e,n){const t=n??{seen:new Set};if(t.seen.has(e))return!1;t.seen.add(e);const o=e._zod.def;if("transform"===o.type)return!0;if("array"===o.type)return yo(o.element,t);if("set"===o.type)return yo(o.valueType,t);if("lazy"===o.type)return yo(o.getter(),t);if("promise"===o.type||"optional"===o.type||"nonoptional"===o.type||"nullable"===o.type||"readonly"===o.type||"default"===o.type||"prefault"===o.type)return yo(o.innerType,t);if("intersection"===o.type)return yo(o.left,t)||yo(o.right,t);if("record"===o.type||"map"===o.type)return yo(o.keyType,t)||yo(o.valueType,t);if("pipe"===o.type)return yo(o.in,t)||yo(o.out,t);if("object"===o.type){for(const e in o.shape)if(yo(o.shape[e],t))return!0;return!1}if("union"===o.type){for(const e of o.options)if(yo(e,t))return!0;return!1}if("tuple"===o.type){for(const e of o.items)if(yo(e,t))return!0;return!(!o.rest||!yo(o.rest,t))}return!1}const xo=(e,n,t={})=>o=>{const{libraryOptions:r,target:a}=o??{},i=go({...r??{},target:a,io:n,processors:t});return vo(e,i),bo(i,e),wo(i,e)},ko={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},Eo=(e,n,t,o)=>{const r=e._zod.def;vo(r.innerType,n,o);n.seen.get(e).ref=r.innerType},_o=m("ZodISODateTime",((e,n)=>{hn.init(e,n),Vo.init(e,n)}));const Ro=m("ZodISODate",((e,n)=>{mn.init(e,n),Vo.init(e,n)}));const No=m("ZodISOTime",((e,n)=>{gn.init(e,n),Vo.init(e,n)}));const To=m("ZodISODuration",((e,n)=>{vn.init(e,n),Vo.init(e,n)}));const Oo=m("ZodError",((e,n)=>{K.init(e,n),e.name="ZodError",Object.defineProperties(e,{format:{value:n=>function(e,n=e=>e.message){const t={_errors:[]},o=e=>{for(const r of e.issues)if("invalid_union"===r.code&&r.errors.length)r.errors.map((e=>o({issues:e})));else if("invalid_key"===r.code)o({issues:r.issues});else if("invalid_element"===r.code)o({issues:r.issues});else if(0===r.path.length)t._errors.push(n(r));else{let e=t,o=0;for(;o<r.path.length;){const t=r.path[o];o===r.path.length-1?(e[t]=e[t]||{_errors:[]},e[t]._errors.push(n(r))):e[t]=e[t]||{_errors:[]},e=e[t],o++}}};return o(e),t}(e,n)},flatten:{value:n=>function(e,n=e=>e.message){const t={},o=[];for(const r of e.issues)r.path.length>0?(t[r.path[0]]=t[r.path[0]]||[],t[r.path[0]].push(n(r))):o.push(n(r));return{formErrors:o,fieldErrors:t}}(e,n)},addIssue:{value:n=>{e.issues.push(n),e.message=JSON.stringify(e.issues,x,2)}},addIssues:{value:n=>{e.issues.push(...n),e.message=JSON.stringify(e.issues,x,2)}},isEmpty:{get:()=>0===e.issues.length}})}),{Parent:Error}),So=G(Oo),Io=H(Oo),Co=X(Oo),zo=Q(Oo),jo=ne(Oo),Ao=te(Oo),Fo=oe(Oo),$o=re(Oo),Po=ae(Oo),Do=ie(Oo),Lo=se(Oo),Mo=ce(Oo),qo=m("ZodType",((e,n)=>(Qe.init(e,n),Object.assign(e["~standard"],{jsonSchema:{input:xo(e,"input"),output:xo(e,"output")}}),e.toJSONSchema=((e,n={})=>t=>{const o=go({...t,processors:n});return vo(e,o),bo(o,e),wo(o,e)})(e,{}),e.def=n,e.type=n.type,Object.defineProperty(e,"_def",{value:n}),e.check=(...t)=>e.clone(O(n,{checks:[...n.checks??[],...t.map((e=>"function"==typeof e?{_zod:{check:e,def:{check:"custom"},onattach:[]}}:e))]}),{parent:!0}),e.with=e.check,e.clone=(n,t)=>P(e,n,t),e.brand=()=>e,e.register=(n,t)=>(n.add(e,t),e),e.parse=(n,t)=>So(e,n,t,{callee:e.parse}),e.safeParse=(n,t)=>Co(e,n,t),e.parseAsync=async(n,t)=>Io(e,n,t,{callee:e.parseAsync}),e.safeParseAsync=async(n,t)=>zo(e,n,t),e.spa=e.safeParseAsync,e.encode=(n,t)=>jo(e,n,t),e.decode=(n,t)=>Ao(e,n,t),e.encodeAsync=async(n,t)=>Fo(e,n,t),e.decodeAsync=async(n,t)=>$o(e,n,t),e.safeEncode=(n,t)=>Po(e,n,t),e.safeDecode=(n,t)=>Do(e,n,t),e.safeEncodeAsync=async(n,t)=>Lo(e,n,t),e.safeDecodeAsync=async(n,t)=>Mo(e,n,t),e.refine=(n,t)=>e.check(function(e,n={}){return fo(Lr,e,n)}(n,t)),e.superRefine=n=>e.check(ho(n)),e.overwrite=n=>e.check(ao(n)),e.optional=()=>Or(e),e.exactOptional=()=>new Sr({type:"optional",innerType:e}),e.nullable=()=>Cr(e),e.nullish=()=>Or(Cr(e)),e.nonoptional=n=>function(e,n){return new Ar({type:"nonoptional",innerType:e,...D(n)})}(e,n),e.array=()=>{return po(yr,e,n);var n},e.or=n=>{return new Er({type:"union",options:[e,n],...D(t)});var t},e.and=n=>new _r({type:"intersection",left:e,right:n}),e.transform=n=>Pr(e,new Nr({type:"transform",transform:n})),e.default=n=>{return t=n,new zr({type:"default",innerType:e,get defaultValue(){return"function"==typeof t?t():A(t)}});var t},e.prefault=n=>{return t=n,new jr({type:"prefault",innerType:e,get defaultValue(){return"function"==typeof t?t():A(t)}});var t},e.catch=n=>{return new Fr({type:"catch",innerType:e,catchValue:"function"==typeof(t=n)?t:()=>t});var t},e.pipe=n=>Pr(e,n),e.readonly=()=>new Dr({type:"readonly",innerType:e}),e.describe=n=>{const t=e.clone();return ut.add(t,{description:n}),t},Object.defineProperty(e,"description",{get(){var n;return null==(n=ut.get(e))?void 0:n.description},configurable:!0}),e.meta=(...n)=>{if(0===n.length)return ut.get(e);const t=e.clone();return ut.add(t,n[0]),t},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e.apply=n=>n(e),e))),Uo=m("_ZodString",((e,n)=>{en.init(e,n),qo.init(e,n),e._zod.processJSONSchema=(n,t,o)=>((e,n,t)=>{const o=t;o.type="string";const{minimum:r,maximum:a,format:i,patterns:s,contentEncoding:c}=e._zod.bag;if("number"==typeof r&&(o.minLength=r),"number"==typeof a&&(o.maxLength=a),i&&(o.format=ko[i]??i,""===o.format&&delete o.format,"time"===i&&delete o.format),c&&(o.contentEncoding=c),s&&s.size>0){const e=[...s];1===e.length?o.pattern=e[0].source:e.length>1&&(o.allOf=[...e.map((e=>({..."draft-07"===n.target||"draft-04"===n.target||"openapi-3.0"===n.target?{type:"string"}:{},pattern:e.source})))])}})(e,n,t);const t=e._zod.bag;e.format=t.format??null,e.minLength=t.minimum??null,e.maxLength=t.maximum??null,e.regex=(...n)=>e.check(Qt(...n)),e.includes=(...n)=>e.check(to(...n)),e.startsWith=(...n)=>e.check(oo(...n)),e.endsWith=(...n)=>e.check(ro(...n)),e.min=(...n)=>e.check(Xt(...n)),e.max=(...n)=>e.check(Ht(...n)),e.length=(...n)=>e.check(Yt(...n)),e.nonempty=(...n)=>e.check(Xt(1,...n)),e.lowercase=n=>e.check(eo(n)),e.uppercase=n=>e.check(no(n)),e.trim=()=>e.check(so()),e.normalize=(...n)=>e.check(io(...n)),e.toLowerCase=()=>e.check(co()),e.toUpperCase=()=>e.check(lo()),e.slugify=()=>e.check(uo())})),Bo=m("ZodString",((e,n)=>{en.init(e,n),Uo.init(e,n),e.email=n=>e.check(ft(Zo,n)),e.url=n=>e.check(wt(Go,n)),e.jwt=n=>e.check(At(lr,n)),e.emoji=n=>e.check(yt(Ho,n)),e.guid=n=>e.check(ht(Ko,n)),e.uuid=n=>e.check(mt(Jo,n)),e.uuidv4=n=>e.check(gt(Jo,n)),e.uuidv6=n=>e.check(vt(Jo,n)),e.uuidv7=n=>e.check(bt(Jo,n)),e.nanoid=n=>e.check(xt(Xo,n)),e.guid=n=>e.check(ht(Ko,n)),e.cuid=n=>e.check(kt(Yo,n)),e.cuid2=n=>e.check(Et(Qo,n)),e.ulid=n=>e.check(_t(er,n)),e.base64=n=>e.check(Ct(sr,n)),e.base64url=n=>e.check(zt(cr,n)),e.xid=n=>e.check(Rt(nr,n)),e.ksuid=n=>e.check(Nt(tr,n)),e.ipv4=n=>e.check(Tt(or,n)),e.ipv6=n=>e.check(Ot(rr,n)),e.cidrv4=n=>e.check(St(ar,n)),e.cidrv6=n=>e.check(It(ir,n)),e.e164=n=>e.check(jt(dr,n)),e.datetime=n=>e.check(function(e){return Ft(_o,e)}(n)),e.date=n=>e.check(function(e){return $t(Ro,e)}(n)),e.time=n=>e.check(function(e){return Pt(No,e)}(n)),e.duration=n=>e.check(function(e){return Dt(To,e)}(n))}));function Wo(e){return pt(Bo,e)}const Vo=m("ZodStringFormat",((e,n)=>{nn.init(e,n),Uo.init(e,n)})),Zo=m("ZodEmail",((e,n)=>{rn.init(e,n),Vo.init(e,n)})),Ko=m("ZodGUID",((e,n)=>{tn.init(e,n),Vo.init(e,n)})),Jo=m("ZodUUID",((e,n)=>{on.init(e,n),Vo.init(e,n)})),Go=m("ZodURL",((e,n)=>{an.init(e,n),Vo.init(e,n)})),Ho=m("ZodEmoji",((e,n)=>{sn.init(e,n),Vo.init(e,n)})),Xo=m("ZodNanoID",((e,n)=>{cn.init(e,n),Vo.init(e,n)})),Yo=m("ZodCUID",((e,n)=>{dn.init(e,n),Vo.init(e,n)})),Qo=m("ZodCUID2",((e,n)=>{ln.init(e,n),Vo.init(e,n)})),er=m("ZodULID",((e,n)=>{un.init(e,n),Vo.init(e,n)})),nr=m("ZodXID",((e,n)=>{pn.init(e,n),Vo.init(e,n)})),tr=m("ZodKSUID",((e,n)=>{fn.init(e,n),Vo.init(e,n)})),or=m("ZodIPv4",((e,n)=>{bn.init(e,n),Vo.init(e,n)})),rr=m("ZodIPv6",((e,n)=>{wn.init(e,n),Vo.init(e,n)})),ar=m("ZodCIDRv4",((e,n)=>{yn.init(e,n),Vo.init(e,n)})),ir=m("ZodCIDRv6",((e,n)=>{xn.init(e,n),Vo.init(e,n)})),sr=m("ZodBase64",((e,n)=>{En.init(e,n),Vo.init(e,n)})),cr=m("ZodBase64URL",((e,n)=>{_n.init(e,n),Vo.init(e,n)})),dr=m("ZodE164",((e,n)=>{Rn.init(e,n),Vo.init(e,n)})),lr=m("ZodJWT",((e,n)=>{Nn.init(e,n),Vo.init(e,n)})),ur=m("ZodNumber",((e,n)=>{Tn.init(e,n),qo.init(e,n),e._zod.processJSONSchema=(n,t,o)=>((e,n,t)=>{const o=t,{minimum:r,maximum:a,format:i,multipleOf:s,exclusiveMaximum:c,exclusiveMinimum:d}=e._zod.bag;"string"==typeof i&&i.includes("int")?o.type="integer":o.type="number","number"==typeof d&&("draft-04"===n.target||"openapi-3.0"===n.target?(o.minimum=d,o.exclusiveMinimum=!0):o.exclusiveMinimum=d),"number"==typeof r&&(o.minimum=r,"number"==typeof d&&"draft-04"!==n.target&&(d>=r?delete o.minimum:delete o.exclusiveMinimum)),"number"==typeof c&&("draft-04"===n.target||"openapi-3.0"===n.target?(o.maximum=c,o.exclusiveMaximum=!0):o.exclusiveMaximum=c),"number"==typeof a&&(o.maximum=a,"number"==typeof c&&"draft-04"!==n.target&&(c<=a?delete o.maximum:delete o.exclusiveMaximum)),"number"==typeof s&&(o.multipleOf=s)})(e,n,t),e.gt=(n,t)=>e.check(Kt(n,t)),e.gte=(n,t)=>e.check(Jt(n,t)),e.min=(n,t)=>e.check(Jt(n,t)),e.lt=(n,t)=>e.check(Vt(n,t)),e.lte=(n,t)=>e.check(Zt(n,t)),e.max=(n,t)=>e.check(Zt(n,t)),e.int=n=>e.check(fr(n)),e.safe=n=>e.check(fr(n)),e.positive=n=>e.check(Kt(0,n)),e.nonnegative=n=>e.check(Jt(0,n)),e.negative=n=>e.check(Vt(0,n)),e.nonpositive=n=>e.check(Zt(0,n)),e.multipleOf=(n,t)=>e.check(Gt(n,t)),e.step=(n,t)=>e.check(Gt(n,t)),e.finite=()=>e;const t=e._zod.bag;e.minValue=Math.max(t.minimum??Number.NEGATIVE_INFINITY,t.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,e.maxValue=Math.min(t.maximum??Number.POSITIVE_INFINITY,t.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,e.isInt=(t.format??"").includes("int")||Number.isSafeInteger(t.multipleOf??.5),e.isFinite=!0,e.format=t.format??null}));const pr=m("ZodNumberFormat",((e,n)=>{On.init(e,n),ur.init(e,n)}));function fr(e){return Mt(pr,e)}const hr=m("ZodBoolean",((e,n)=>{Sn.init(e,n),qo.init(e,n),e._zod.processJSONSchema=(e,n,t)=>((e,n,t)=>{t.type="boolean"})(0,0,n)}));function mr(e){return qt(hr,e)}const gr=m("ZodAny",((e,n)=>{In.init(e,n),qo.init(e,n),e._zod.processJSONSchema=(e,n,t)=>{}}));const vr=m("ZodUnknown",((e,n)=>{Cn.init(e,n),qo.init(e,n),e._zod.processJSONSchema=(e,n,t)=>{}}));function br(){return Bt(vr)}const wr=m("ZodNever",((e,n)=>{zn.init(e,n),qo.init(e,n),e._zod.processJSONSchema=(e,n,t)=>((e,n,t)=>{t.not={}})(0,0,n)}));const yr=m("ZodArray",((e,n)=>{An.init(e,n),qo.init(e,n),e._zod.processJSONSchema=(n,t,o)=>((e,n,t,o)=>{const r=t,a=e._zod.def,{minimum:i,maximum:s}=e._zod.bag;"number"==typeof i&&(r.minItems=i),"number"==typeof s&&(r.maxItems=s),r.type="array",r.items=vo(a.element,n,{...o,path:[...o.path,"items"]})})(e,n,t,o),e.element=n.element,e.min=(n,t)=>e.check(Xt(n,t)),e.nonempty=n=>e.check(Xt(1,n)),e.max=(n,t)=>e.check(Ht(n,t)),e.length=(n,t)=>e.check(Yt(n,t)),e.unwrap=()=>e.element}));const xr=m("ZodObject",((e,n)=>{Ln.init(e,n),qo.init(e,n),e._zod.processJSONSchema=(n,t,o)=>((e,n,t,o)=>{var r;const a=t,i=e._zod.def;a.type="object",a.properties={};const s=i.shape;for(const l in s)a.properties[l]=vo(s[l],n,{...o,path:[...o.path,"properties",l]});const c=new Set(Object.keys(s)),d=new Set([...c].filter((e=>{const t=i.shape[e]._zod;return"input"===n.io?void 0===t.optin:void 0===t.optout})));d.size>0&&(a.required=Array.from(d)),"never"===(null==(r=i.catchall)?void 0:r._zod.def.type)?a.additionalProperties=!1:i.catchall?i.catchall&&(a.additionalProperties=vo(i.catchall,n,{...o,path:[...o.path,"additionalProperties"]})):"output"===n.io&&(a.additionalProperties=!1)})(e,n,t,o),N(e,"shape",(()=>n.shape)),e.keyof=()=>function(e,n){const t=Array.isArray(e)?Object.fromEntries(e.map((e=>[e,e]))):e;return new Rr({type:"enum",entries:t,...D(n)})}(Object.keys(e._zod.def.shape)),e.catchall=n=>e.clone({...e._zod.def,catchall:n}),e.passthrough=()=>e.clone({...e._zod.def,catchall:br()}),e.loose=()=>e.clone({...e._zod.def,catchall:br()}),e.strict=()=>{return e.clone({...e._zod.def,catchall:Wt(wr,n)});var n},e.strip=()=>e.clone({...e._zod.def,catchall:void 0}),e.extend=n=>function(e,n){if(!j(n))throw new Error("Invalid input to extend: expected a plain object");const t=e._zod.def.checks;if(t&&t.length>0){const t=e._zod.def.shape;for(const e in n)if(void 0!==Object.getOwnPropertyDescriptor(t,e))throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}const o=O(e._zod.def,{get shape(){const t={...e._zod.def.shape,...n};return T(this,"shape",t),t}});return P(e,o)}(e,n),e.safeExtend=n=>function(e,n){if(!j(n))throw new Error("Invalid input to safeExtend: expected a plain object");const t=O(e._zod.def,{get shape(){const t={...e._zod.def.shape,...n};return T(this,"shape",t),t}});return P(e,t)}(e,n),e.merge=n=>function(e,n){const t=O(e._zod.def,{get shape(){const t={...e._zod.def.shape,...n._zod.def.shape};return T(this,"shape",t),t},get catchall(){return n._zod.def.catchall},checks:[]});return P(e,t)}(e,n),e.pick=n=>function(e,n){const t=e._zod.def,o=t.checks;if(o&&o.length>0)throw new Error(".pick() cannot be used on object schemas containing refinements");return P(e,O(e._zod.def,{get shape(){const e={};for(const o in n){if(!(o in t.shape))throw new Error(`Unrecognized key: "${o}"`);n[o]&&(e[o]=t.shape[o])}return T(this,"shape",e),e},checks:[]}))}(e,n),e.omit=n=>function(e,n){const t=e._zod.def,o=t.checks;if(o&&o.length>0)throw new Error(".omit() cannot be used on object schemas containing refinements");const r=O(e._zod.def,{get shape(){const o={...e._zod.def.shape};for(const e in n){if(!(e in t.shape))throw new Error(`Unrecognized key: "${e}"`);n[e]&&delete o[e]}return T(this,"shape",o),o},checks:[]});return P(e,r)}(e,n),e.partial=(...n)=>function(e,n,t){const o=n._zod.def.checks;if(o&&o.length>0)throw new Error(".partial() cannot be used on object schemas containing refinements");const r=O(n._zod.def,{get shape(){const o=n._zod.def.shape,r={...o};if(t)for(const n in t){if(!(n in o))throw new Error(`Unrecognized key: "${n}"`);t[n]&&(r[n]=e?new e({type:"optional",innerType:o[n]}):o[n])}else for(const n in o)r[n]=e?new e({type:"optional",innerType:o[n]}):o[n];return T(this,"shape",r),r},checks:[]});return P(n,r)}(Tr,e,n[0]),e.required=(...n)=>function(e,n,t){const o=O(n._zod.def,{get shape(){const o=n._zod.def.shape,r={...o};if(t)for(const n in t){if(!(n in r))throw new Error(`Unrecognized key: "${n}"`);t[n]&&(r[n]=new e({type:"nonoptional",innerType:o[n]}))}else for(const n in o)r[n]=new e({type:"nonoptional",innerType:o[n]});return T(this,"shape",r),r}});return P(n,o)}(Ar,e,n[0])}));function kr(e,n){const t={type:"object",shape:e??{},...D(n)};return new xr(t)}const Er=m("ZodUnion",((e,n)=>{qn.init(e,n),qo.init(e,n),e._zod.processJSONSchema=(n,t,o)=>((e,n,t,o)=>{const r=e._zod.def,a=!1===r.inclusive,i=r.options.map(((e,t)=>vo(e,n,{...o,path:[...o.path,a?"oneOf":"anyOf",t]})));a?t.oneOf=i:t.anyOf=i})(e,n,t,o),e.options=n.options}));const _r=m("ZodIntersection",((e,n)=>{Un.init(e,n),qo.init(e,n),e._zod.processJSONSchema=(n,t,o)=>((e,n,t,o)=>{const r=e._zod.def,a=vo(r.left,n,{...o,path:[...o.path,"allOf",0]}),i=vo(r.right,n,{...o,path:[...o.path,"allOf",1]}),s=e=>"allOf"in e&&1===Object.keys(e).length,c=[...s(a)?a.allOf:[a],...s(i)?i.allOf:[i]];t.allOf=c})(e,n,t,o)}));const Rr=m("ZodEnum",((e,n)=>{Vn.init(e,n),qo.init(e,n),e._zod.processJSONSchema=(n,t,o)=>((e,n,t)=>{const o=y(e._zod.def.entries);o.every((e=>"number"==typeof e))&&(t.type="number"),o.every((e=>"string"==typeof e))&&(t.type="string"),t.enum=o})(e,0,t),e.enum=n.entries,e.options=Object.values(n.entries);const t=new Set(Object.keys(n.entries));e.extract=(e,o)=>{const r={};for(const a of e){if(!t.has(a))throw new Error(`Key ${a} not found in enum`);r[a]=n.entries[a]}return new Rr({...n,checks:[],...D(o),entries:r})},e.exclude=(e,o)=>{const r={...n.entries};for(const n of e){if(!t.has(n))throw new Error(`Key ${n} not found in enum`);delete r[n]}return new Rr({...n,checks:[],...D(o),entries:r})}}));const Nr=m("ZodTransform",((e,n)=>{Zn.init(e,n),qo.init(e,n),e._zod.processJSONSchema=(e,n,t)=>((e,n)=>{if("throw"===n.unrepresentable)throw new Error("Transforms cannot be represented in JSON Schema")})(0,e),e._zod.parse=(t,o)=>{if("backward"===o.direction)throw new v(e.constructor.name);t.addIssue=o=>{if("string"==typeof o)t.issues.push(V(o,t.value,n));else{const n=o;n.fatal&&(n.continue=!1),n.code??(n.code="custom"),n.input??(n.input=t.value),n.inst??(n.inst=e),t.issues.push(V(n))}};const r=n.transform(t.value,t);return r instanceof Promise?r.then((e=>(t.value=e,t))):(t.value=r,t)}}));const Tr=m("ZodOptional",((e,n)=>{Jn.init(e,n),qo.init(e,n),e._zod.processJSONSchema=(n,t,o)=>Eo(e,n,0,o),e.unwrap=()=>e._zod.def.innerType}));function Or(e){return new Tr({type:"optional",innerType:e})}const Sr=m("ZodExactOptional",((e,n)=>{Gn.init(e,n),qo.init(e,n),e._zod.processJSONSchema=(n,t,o)=>Eo(e,n,0,o),e.unwrap=()=>e._zod.def.innerType}));const Ir=m("ZodNullable",((e,n)=>{Hn.init(e,n),qo.init(e,n),e._zod.processJSONSchema=(n,t,o)=>((e,n,t,o)=>{const r=e._zod.def,a=vo(r.innerType,n,o),i=n.seen.get(e);"openapi-3.0"===n.target?(i.ref=r.innerType,t.nullable=!0):t.anyOf=[a,{type:"null"}]})(e,n,t,o),e.unwrap=()=>e._zod.def.innerType}));function Cr(e){return new Ir({type:"nullable",innerType:e})}const zr=m("ZodDefault",((e,n)=>{Xn.init(e,n),qo.init(e,n),e._zod.processJSONSchema=(n,t,o)=>((e,n,t,o)=>{const r=e._zod.def;vo(r.innerType,n,o),n.seen.get(e).ref=r.innerType,t.default=JSON.parse(JSON.stringify(r.defaultValue))})(e,n,t,o),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap}));const jr=m("ZodPrefault",((e,n)=>{Qn.init(e,n),qo.init(e,n),e._zod.processJSONSchema=(n,t,o)=>((e,n,t,o)=>{const r=e._zod.def;vo(r.innerType,n,o),n.seen.get(e).ref=r.innerType,"input"===n.io&&(t._prefault=JSON.parse(JSON.stringify(r.defaultValue)))})(e,n,t,o),e.unwrap=()=>e._zod.def.innerType}));const Ar=m("ZodNonOptional",((e,n)=>{et.init(e,n),qo.init(e,n),e._zod.processJSONSchema=(n,t,o)=>((e,n,t,o)=>{const r=e._zod.def;vo(r.innerType,n,o),n.seen.get(e).ref=r.innerType})(e,n,0,o),e.unwrap=()=>e._zod.def.innerType}));const Fr=m("ZodCatch",((e,n)=>{tt.init(e,n),qo.init(e,n),e._zod.processJSONSchema=(n,t,o)=>((e,n,t,o)=>{const r=e._zod.def;let a;vo(r.innerType,n,o),n.seen.get(e).ref=r.innerType;try{a=r.catchValue(void 0)}catch{throw new Error("Dynamic catch values are not supported in JSON Schema")}t.default=a})(e,n,t,o),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap}));const $r=m("ZodPipe",((e,n)=>{ot.init(e,n),qo.init(e,n),e._zod.processJSONSchema=(n,t,o)=>((e,n,t,o)=>{const r=e._zod.def,a="input"===n.io?"transform"===r.in._zod.def.type?r.out:r.in:r.out;vo(a,n,o),n.seen.get(e).ref=a})(e,n,0,o),e.in=n.in,e.out=n.out}));function Pr(e,n){return new $r({type:"pipe",in:e,out:n})}const Dr=m("ZodReadonly",((e,n)=>{at.init(e,n),qo.init(e,n),e._zod.processJSONSchema=(n,t,o)=>((e,n,t,o)=>{const r=e._zod.def;vo(r.innerType,n,o),n.seen.get(e).ref=r.innerType,t.readOnly=!0})(e,n,t,o),e.unwrap=()=>e._zod.def.innerType}));const Lr=m("ZodCustom",((e,n)=>{st.init(e,n),qo.init(e,n),e._zod.processJSONSchema=(e,n,t)=>((e,n)=>{if("throw"===n.unrepresentable)throw new Error("Custom types cannot be represented in JSON Schema")})(0,e)}));var Mr;kr({success:mr(),accessToken:Wo().optional(),alias:Wo().optional(),user:kr({id:Wo(),email:Wo(),role:Wo(),validated:mr(),active:mr()}).optional(),person:kr({id:Wo(),name:Wo(),birth_date:Wo()}).optional(),confidence_score:Lt(ur,Mr).optional(),recognition_id:Wo().optional(),task_id:Wo().optional(),status:Wo().optional(),message:Wo().optional()}),kr({success:mr(),message:Wo(),person_id:Wo().optional(),user_id:Wo().optional(),person_validated:mr().optional(),face_processing:Ut(gr).optional(),onboarding_link:Wo().optional(),task_id:Wo().optional(),status:Wo().optional()});const qr="#0059C4",Ur="#F1BE00",Br="#0A1320",Wr={success:{fg:"#046C4E",bg:"#E7F7F0",solid:"#0E9F6E"},attention:{fg:"#6E5600",bg:"#FFF6D9",solid:"#F1BE00"},critical:{fg:"#9B1C1C",bg:"#FDEAEA",solid:"#E02424"},info:{fg:"#00449A",bg:"#EBF6FE",solid:"#0073F4"}},Vr={ground:"#F7F9FC",surface:"#FFFFFF",surfaceMuted:"#F1F5FA",line:"#E6ECF4",text:Br,textMuted:"#48586B",textSubtle:"#617489",action:qr,actionText:"#FFFFFF",accent:Ur,overlay:"rgba(10,19,32,.55)",focusRing:qr},Zr={ground:Br,surface:"#111C2B",surfaceMuted:"#1E2B3C",line:"#22334D",text:"#EEF3F9",textMuted:"#AFBDCE",textSubtle:"#8496AD",action:"#0091F6",actionText:"#FFFFFF",accent:Ur,overlay:"rgba(10,19,32,.72)",focusRing:"#00B0F8"};function Kr(e){const[n,t,o]=function(e){let n=e.trim().replace("#","");3===n.length&&(n=n.split("").map((e=>e+e)).join(""));return/^[0-9a-fA-F]{6}$/.test(n)?[parseInt(n.slice(0,2),16),parseInt(n.slice(2,4),16),parseInt(n.slice(4,6),16)]:[0,0,0]}(e).map((e=>{const n=e/255;return n<=.03928?n/12.92:((n+.055)/1.055)**2.4}));return.2126*n+.7152*t+.0722*o}const Jr=[8,16,24];function Gr(e={}){const n=function(e){if("dark"===e)return"dark";if("light"===e)return"light";if("undefined"!=typeof window&&"function"==typeof window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches)return"dark";return"light"}(e.theme),t="dark"===n?{...Zr}:{...Vr};let o=16;void 0!==e.radius&&Jr.includes(e.radius)&&(o=e.radius);let r=t.action,a=!1;if(e.accent){(function(e,n){const t=Kr(e),o=Kr(n),[r,a]=t>o?[t,o]:[o,t];return(r+.05)/(a+.05)})(e.accent,"#FFFFFF")>=4.5?r=e.accent:(a=!0,r=qr)}return{mode:n,tokens:{...t,action:r},radius:o,accent:r,accentFellBack:a}}const Hr="--nfid-ground",Xr="--nfid-surface",Yr="--nfid-surface-muted",Qr="--nfid-line",ea="--nfid-text",na="--nfid-text-muted",ta="--nfid-text-subtle",oa="--nfid-action",ra="--nfid-action-text",aa="--nfid-accent",ia="--nfid-overlay",sa="--nfid-focus-ring",ca="--nfid-radius",da="neofaceid-focus-frame-tokens";function la(e={}){const n=Gr(e);if("undefined"==typeof document)return n;const t=function(e){const n=e.tokens;return`.neofaceid-root {\n ${Hr}: ${n.ground};\n ${Xr}: ${n.surface};\n ${Yr}: ${n.surfaceMuted};\n ${Qr}: ${n.line};\n ${ea}: ${n.text};\n ${na}: ${n.textMuted};\n ${ta}: ${n.textSubtle};\n ${oa}: ${n.action};\n ${ra}: ${n.actionText};\n ${aa}: ${n.accent};\n ${ia}: ${n.overlay};\n ${sa}: ${n.focusRing};\n ${ca}: ${e.radius}px;\n color: var(${ea});\n font-family: inherit;\n}\n.neofaceid-root :focus-visible {\n outline: 2px solid var(${sa});\n outline-offset: 2px;\n}\n@media (prefers-reduced-motion: reduce) {\n .neofaceid-root,\n .neofaceid-root * {\n animation-duration: 0.001ms !important;\n animation-iteration-count: 1 !important;\n transition-duration: 0.001ms !important;\n scroll-behavior: auto !important;\n }\n}`}(n),o=document.getElementById(da);if(o)return o.textContent!==t&&(o.textContent=t),n;const r=document.createElement("style");return r.id=da,r.textContent=t,document.head.appendChild(r),n}function ua(e,n){if("undefined"==typeof document)return;const t=document.getElementById(e);if(t)return void(t.textContent!==n&&(t.textContent=n));const o=document.createElement("style");o.id=e,o.textContent=n,document.head.appendChild(o)}const pa={},fa={purpose:"authentication",legalBasis:"fraud_prevention",privacyPolicyUrl:"",retentionDays:0},ha={development:"http://localhost:8000",sandbox:"https://sandbox-core.neofaceid.com",production:"https://core.neofaceid.com.br"},ma=[8,16,24];let ga={baseUrl:ha.sandbox,applicationToken:null,environment:"sandbox",initialized:!1,appName:null,accent:null,radius:16,theme:"light",locale:"pt-BR",resolvedTheme:null,consent:{...fa}},va=!1;function ba(){return ga.initialized,ga.baseUrl}function wa(){return ga.appName}function ya(){return ga.locale}function xa(){return{...ga.consent}}async function ka(e,n){const t=URL.createObjectURL(e);try{return await n(t)}finally{URL.revokeObjectURL(t)}}const Ea=()=>ba(),_a=()=>{const e="localhost"===window.location.hostname||"127.0.0.1"===window.location.hostname||""===window.location.hostname;if(!window.isSecureContext&&!e)throw new h("Secure context (HTTPS) is required for this operation",f.NETWORK)},Ra=()=>{const e=new AbortController,n=setTimeout((()=>e.abort()),1e4);return e.signal.addEventListener("abort",(()=>clearTimeout(n))),e},Na=async e=>ka(e,(e=>new Promise(((n,t)=>{const o=new Image;o.onload=()=>{const e=document.createElement("canvas");e.width=o.width,e.height=o.height;const r=e.getContext("2d");r?(r.drawImage(o,0,0),e.toBlob((e=>{e?n(e):t(new Error("Failed to compress image"))}),"image/jpeg",.7)):t(new Error("Failed to get canvas context"))},o.onerror=()=>{t(new Error("Failed to load image"))},o.src=e})))),Ta=async e=>ka(e,(e=>new Promise(((n,t)=>{const o=new Image;o.onload=()=>{const e=1280;let{width:r}=o,{height:a}=o;r>a&&r>e?(a=a*e/r,r=e):a>e&&(r=r*e/a,a=e);const i=document.createElement("canvas");i.width=r,i.height=a;const s=i.getContext("2d");s?(s.drawImage(o,0,0,r,a),i.toBlob((e=>{e?n(e):t(new Error("Failed to compress document image"))}),"image/jpeg",.75)):t(new Error("Failed to get canvas context"))},o.onerror=()=>{t(new Error("Failed to load document image"))},o.src=e})))),Oa=async e=>{_a();const n=Ra();try{const t=await fetch(`${Ea()}/api/v1/auth/application/validate_token/`,{method:"POST",headers:{"Content-Type":"application/json","X-App-Token":e},body:JSON.stringify({}),signal:n.signal});if(!t.ok)throw new h(`API Error ${t.status}`,f.INVALID_TOKEN);return t.ok}catch(t){if(t instanceof Error){if("AbortError"===t.name)throw new h("Request timeout",f.NETWORK_ERROR);throw new h(t.message,f.NETWORK_ERROR)}throw new h("Unknown error",f.NETWORK_ERROR)}},Sa=async(e,n)=>{_a();const t=Ra();try{const o=await fetch(`${Ea()}/api/v1/onboardings/${encodeURIComponent(n)}/`,{method:"GET",headers:{"X-App-Token":e},signal:t.signal});if(!o.ok){if(401===o.status||403===o.status)throw new h("Token de aplicação inválido ou expirado",f.INVALID_TOKEN);if(404===o.status)throw new h("Link de onboarding não encontrado",f.NOT_FOUND);throw new h(`Falha ao obter detalhes (${o.status})`,f.NETWORK)}return await o.json()}catch(o){if(o instanceof Error){if("AbortError"===o.name)throw new h("Tempo de requisição excedido",f.NETWORK);if(o instanceof h)throw o;throw new h(o.message,f.NETWORK)}throw new h("Erro desconhecido",f.NETWORK_ERROR)}},Ia=async(e,n)=>{_a();const t=Ra();try{const o=await fetch(`${Ea()}/api/v1/onboardings/${encodeURIComponent(n)}/`,{method:"GET",headers:{"X-App-Token":e},signal:t.signal});if(!o.ok){if(401===o.status||403===o.status)throw new h("Token de aplicação inválido ou expirado",f.INVALID_TOKEN);if(404===o.status)return!1;throw new h(`Falha ao validar token (${o.status})`,f.NETWORK)}const r=await o.json();return!0===(null==r?void 0:r.is_valid)}catch(o){if(o instanceof Error){if("AbortError"===o.name)throw new h("Tempo de requisição excedido",f.NETWORK);if(o instanceof h)throw o;throw new h(o.message,f.NETWORK)}throw new h("Erro desconhecido",f.NETWORK_ERROR)}},Ca=async(e,n,t,o)=>{_a();const r=Ra(),a=await Na(t),i=await Na(o);try{const t=await new Promise(((e,n)=>{const t=new FileReader;t.onload=()=>e(t.result),t.onerror=n,t.readAsDataURL(a)})),o=await new Promise(((e,n)=>{const t=new FileReader;t.onload=()=>e(t.result),t.onerror=n,t.readAsDataURL(i)})),s=await fetch(`${Ea()}/api/v1/onboardings/${encodeURIComponent(n)}/complete/`,{method:"POST",headers:{"Content-Type":"application/json","X-App-Token":e},body:JSON.stringify({face_image:t,document_image:o}),signal:r.signal}),c=await s.json();if(!s.ok){if(401===s.status||403===s.status)throw new h("Token de aplicação inválido ou expirado",f.INVALID_TOKEN);if(404===s.status)throw new h("Link de onboarding não encontrado",f.NOT_FOUND);throw new h((null==c?void 0:c.error)||(null==c?void 0:c.message)||"Falha ao concluir onboarding",f.NETWORK)}return{success:!!c.success,message:c.message||"Onboarding concluído",person_id:c.person_id,identity_data_id:c.identity_data_id,confidence_score:c.confidence_score,processing_time:c.processing_time}}catch(s){if(s instanceof Error){if("AbortError"===s.name)throw new h("Tempo de requisição excedido",f.NETWORK);if(s instanceof h)throw s;throw new h(s.message,f.NETWORK)}throw new h("Erro desconhecido",f.NETWORK_ERROR)}},za=async(e,n,t,o,r)=>{if(_a(),!o||0===o.length)throw new h("Pelo menos uma imagem da pessoa é obrigatória",f.VALIDATION_ERROR);const a=Ra();try{const i=await Promise.all(o.map((async e=>{const n=await Na(e);return new Promise(((e,t)=>{const o=new FileReader;o.onload=()=>e(o.result),o.onerror=t,o.readAsDataURL(n)}))}))),s=await Na(r),c={person_images:i,document_image:await new Promise(((e,n)=>{const t=new FileReader;t.onload=()=>e(t.result),t.onerror=n,t.readAsDataURL(s)})),name:t.name,birth_date:t.birth_date,cpf:t.cpf,cnpj:t.cnpj,email:t.email},d=await fetch(`${Ea()}/api/v1/onboardings/${encodeURIComponent(n)}/complete/`,{method:"POST",headers:{"Content-Type":"application/json","X-App-Token":e},body:JSON.stringify(c),signal:a.signal}),l=await d.json();if(!d.ok){if(401===d.status||403===d.status)throw new h("Token de aplicação inválido ou expirado",f.INVALID_TOKEN);if(404===d.status)throw new h("Link de onboarding não encontrado",f.NOT_FOUND);throw new h((null==l?void 0:l.error)||(null==l?void 0:l.message)||"Falha ao concluir onboarding",f.NETWORK)}return{success:!!l.success,message:l.message||"Onboarding concluído com sucesso",person_id:l.person_id,identity_data_id:l.identity_data_id,confidence_score:l.confidence_score,processing_time:l.processing_time,liveness_passed:l.liveness_passed,document_verified:l.document_verified,person_created:l.person_created}}catch(i){if(i instanceof Error){if("AbortError"===i.name)throw new h("Tempo de requisição excedido",f.NETWORK);if(i instanceof h)throw i;throw new h(i.message,f.NETWORK)}throw new h("Erro desconhecido",f.NETWORK_ERROR)}},ja=async(e,n)=>{_a();const t=Ra(),o=await Na(e);try{const e=await new Promise(((e,n)=>{const t=new FileReader;t.onload=()=>{const n=t.result;e(n.split(",")[1])},t.onerror=n,t.readAsDataURL(o)})),r=await fetch(`${Ea()}/api/v1/auth/recognition/face/`,{method:"POST",headers:{"Content-Type":"application/json","X-App-Token":n},body:JSON.stringify({face_frames:e}),signal:t.signal});if(!r.ok){if(401===r.status||403===r.status)throw new h("Invalid or expired application token",f.INVALID_TOKEN);throw new h(`Server returned status ${r.status}`,f.NETWORK)}const a=await r.json();if(!a.success)throw new h(a.message||"Recognition failed",f.RECOGNITION_FAILED);return{accessToken:a.accessToken,payload:a.payload}}catch(r){if(r instanceof Error){if("AbortError"===r.name)throw new h("Request timed out",f.NETWORK);if(r instanceof h)throw r;throw new h(r.message,f.NETWORK)}throw new h("Unknown error occurred",f.NETWORK_ERROR)}},Aa=async(e,n)=>{var t,o,r,a,i;_a();const s=Ra(),c=await Na(e);try{const e=await c.arrayBuffer(),d=btoa(new Uint8Array(e).reduce(((e,n)=>e+String.fromCharCode(n)),"")),l=await fetch(`${Ea()}/api/v1/login/donor/face/`,{method:"POST",headers:{"Content-Type":"application/json","X-App-Token":n},body:JSON.stringify({image:d,biometric_type:"FACE"}),signal:s.signal});if(!l.ok){if(401===l.status||403===l.status)throw new h("Invalid application token",f.INVALID_TOKEN);if(l.status>=500)throw new h(`Server Error ${l.status}`,f.API_ERROR);throw new h(`API Error ${l.status}`,f.API_ERROR)}const u=await l.json();if(!u.success)throw new h(u.message||"Login failed",f.LOGIN_FAILED);return{success:!0,accessToken:u.accessToken||u.access_token||"",alias:u.alias,user:{id:(null==(t=u.user)?void 0:t.id)||"",email:(null==(o=u.user)?void 0:o.email)||"",role:(null==(r=u.user)?void 0:r.role)||"",validated:(null==(a=u.user)?void 0:a.validated)||!1,active:(null==(i=u.user)?void 0:i.active)||!1},person:u.person?{id:u.person.id||"",name:u.person.name||"",birth_date:u.person.birth_date||""}:void 0,confidence_score:u.confidence_score,recognition_id:u.recognition_id}}catch(d){if(d instanceof Error){if("AbortError"===d.name)throw new h("Request timed out",f.NETWORK);if(d instanceof h)throw d;throw new h(d.message,f.NETWORK)}throw new h("Unknown error occurred",f.NETWORK_ERROR)}},Fa=async(e,n,t=!0,o=.8)=>{_a();const r=Ra(),a=await Na(e);try{const e=await new Promise(((e,n)=>{const t=new FileReader;t.onload=()=>{const n=t.result;e(n.split(",")[1])},t.onerror=n,t.readAsDataURL(a)})),i=await fetch(`${Ea()}/api/v1/auth/recognition/face/`,{method:"POST",headers:{"Content-Type":"application/json","X-App-Token":n},body:JSON.stringify({face_frames:e,liveness_check:t,confidence_threshold:o}),signal:r.signal});if(!i.ok){if(401===i.status||403===i.status)throw new h("Invalid or expired application token",f.INVALID_TOKEN);throw new h(`Server returned status ${i.status}`,f.NETWORK)}const s=await i.json();return{success:s.success,confidenceScore:s.confidence_score,accessToken:s.access_token,payload:s.payload}}catch(i){if(i instanceof Error){if("AbortError"===i.name)throw new h("Request timed out",f.NETWORK);if(i instanceof h)throw i;throw new h(i.message,f.NETWORK)}throw new h("Unknown error occurred",f.NETWORK_ERROR)}},$a=async(e,n,t,o="LOGIN")=>{_a();const r=Ra();try{const a=await fetch(`${Ea()}/api/v1/auth/recognition/face/`,{method:"POST",headers:{"Content-Type":"application/json","X-App-Token":t},body:JSON.stringify({document_type:e,document_number:n,purpose:o}),signal:r.signal});if(!a.ok){if(401===a.status||403===a.status)throw new h("Invalid or expired application token",f.INVALID_TOKEN);throw new h(`Server returned status ${a.status}`,f.NETWORK)}const i=await a.json();if(!i.success)throw new h(i.message||"Identification failed",f.RECOGNITION_FAILED);return{success:i.success,personId:i.person_id,accessToken:i.access_token,payload:i.payload}}catch(a){if(a instanceof Error){if("AbortError"===a.name)throw new h("Request timed out",f.NETWORK);if(a instanceof h)throw a;throw new h(a.message,f.NETWORK)}throw new h("Unknown error occurred",f.NETWORK_ERROR)}},Pa=async(e,n,t,o=.8,r,a)=>{var i;_a();const s=Ra(),c=await Na(e),d=await new Promise(((e,n)=>{const t=new FileReader;t.onload=()=>{const n=t.result;e(n.split(",")[1])},t.onerror=n,t.readAsDataURL(c)}));try{const e={biometric_data:d,type_of_identification:"FACE",purpose:t,confidence_threshold:o};r&&(e.signature=r);const c=await fetch(`${Ea()}/api/v1/auth/recognition/face/`,{method:"POST",headers:{"Content-Type":"application/json","X-App-Token":n},body:JSON.stringify(e),signal:s.signal});if(!c.ok){if(401===c.status||403===c.status)throw new h("Invalid or expired application token",f.INVALID_TOKEN);throw new h(`Server returned status ${c.status}`,f.NETWORK)}const l=await c.json();return{success:l.success,personName:l.person_name||(null==(i=l.person)?void 0:i.name),email:l.email||(null==a?void 0:a.email),cpf:l.cpf||(null==a?void 0:a.cpf),confidenceScore:l.confidence_score,accessToken:l.access_token,payload:l.payload,signature:r,sessionId:null==a?void 0:a.sessionId}}catch(l){if(l instanceof Error){if("AbortError"===l.name)throw new h("Request timed out",f.NETWORK);if(l instanceof h)throw l;throw new h(l.message,f.NETWORK)}throw new h("Unknown error occurred",f.NETWORK_ERROR)}},Da=async(e,n,t)=>{_a();const o=Ra();try{let r,a;if(null==t?void 0:t.documentFront){const e=await Ta(t.documentFront);r=await new Promise(((n,t)=>{const o=new FileReader;o.onload=()=>n(o.result),o.onerror=t,o.readAsDataURL(e)}))}if(null==t?void 0:t.documentBack){const e=await Ta(t.documentBack);a=await new Promise(((n,t)=>{const o=new FileReader;o.onload=()=>n(o.result),o.onerror=t,o.readAsDataURL(e)}))}const i={name:e.name,birth_date:e.birth_date,cpf:e.cpf,email:e.email,password:e.password,password_confirm:e.password,is_pep:e.is_pep??!1};r&&(i.document_images=[{front:r,back:a||void 0,type:(null==t?void 0:t.documentType)||"RG"}]);const s=await fetch(`${Ea()}/api/v1/signup/donor/`,{method:"POST",headers:{"Content-Type":"application/json","X-App-Token":n},body:JSON.stringify(i),signal:o.signal});if(!s.ok){if(401===s.status||403===s.status)throw new h("Invalid or expired application token",f.INVALID_TOKEN);throw new h(`Server returned status ${s.status}`,f.NETWORK)}return await s.json()}catch(r){if(r instanceof Error){if("AbortError"===r.name)throw new h("Request timed out",f.NETWORK);if(r instanceof h)throw r;throw new h(r.message,f.NETWORK)}throw new h("Unknown error occurred",f.NETWORK)}},La=async e=>{const n=Ra(),t=new URLSearchParams;e.email&&t.append("email",e.email),e.cpf&&t.append("cpf",e.cpf);try{const e=await fetch(`${Ea()}/api/v1/verify/user/?${t.toString()}`,{method:"GET",headers:{"Content-Type":"application/json"},signal:n.signal});if(!e.ok){const n=await e.json().catch((()=>({})));throw new h(n.message||`Server returned status ${e.status}`,f.NETWORK)}return await e.json()}catch(o){if(o instanceof Error){if("AbortError"===o.name)throw new h("Request timed out",f.NETWORK);if(o instanceof h)throw o;throw new h(o.message,f.NETWORK)}throw new h("Unknown error occurred",f.NETWORK)}},Ma=async(e,n,t,o)=>{var r,a,i,s,c,d,l,u;if(_a(),!n||0===n.length)throw new h("At least one face photo is required for biometric registration",f.VALIDATION_ERROR);if(n.length>5)throw new h("Maximum of 5 face photos allowed",f.VALIDATION_ERROR);const p=Ra();try{const g=await Promise.all(n.map((async e=>{const n=await Na(e);return new Promise(((e,t)=>{const o=new FileReader;o.onload=()=>{const n=o.result;e(n)},o.onerror=t,o.readAsDataURL(n)}))})));let v,b;if(null==o?void 0:o.documentFront){const e=await Ta(o.documentFront);v=await new Promise(((n,t)=>{const o=new FileReader;o.onload=()=>n(o.result),o.onerror=t,o.readAsDataURL(e)}))}if(null==o?void 0:o.documentBack){const e=await Ta(o.documentBack);b=await new Promise(((n,t)=>{const o=new FileReader;o.onload=()=>n(o.result),o.onerror=t,o.readAsDataURL(e)}))}const w={name:e.name,birth_date:e.birth_date,cpf:e.cpf,email:e.email,password:e.password,password_confirm:e.password,face_photos:g,is_pep:e.is_pep??!1};v&&(w.document_images=[{front:v,back:b||void 0,type:(null==o?void 0:o.documentType)||"RG"}]);const y=await fetch(`${Ea()}/api/v1/signup/donor/`,{method:"POST",headers:{"Content-Type":"application/json","X-App-Token":t},body:JSON.stringify(w),signal:p.signal});if(!y.ok){if(401===y.status||403===y.status)throw new h("Invalid or expired application token",f.INVALID_TOKEN);try{const e=await y.json();if(e.errors){const n=Object.entries(e.errors).map((([e,n])=>`${"password"===e?"senha":"password_confirm"===e?"confirmação de senha":e}: ${Array.isArray(n)?n.join(", "):String(n)}`)).join("; ");throw new h(`Erro de validação: ${n}`,f.VALIDATION_ERROR)}if("fraud_detected"===e.error)throw new h("Fraud detected in biometric images. Registration blocked.",f.VALIDATION_ERROR);if("user_exists"===e.error||"ALREADY_EXISTS"===e.error_code)throw new h("User with this email already exists",f.VALIDATION_ERROR);if("person_exists"===e.error)throw new h("Person with this CPF already exists",f.VALIDATION_ERROR);const n=e.message||e.error||`Server returned status ${y.status}`;throw new h(n,f.VALIDATION_ERROR)}catch(m){if(m instanceof h)throw m;throw new h(`Server returned status ${y.status}`,f.NETWORK)}}const x=await y.json();return 202===y.status&&(null==(r=x.data)?void 0:r.task_id)?{success:x.success,message:x.message||"Registration is being processed. You will receive an email when completed.",task_id:x.data.task_id,status:x.data.status||"processing",person_id:void 0,user_id:void 0,person_validated:void 0,face_processing:void 0,onboarding_link:void 0}:{success:x.success,message:x.message,person_id:(null==(a=x.data)?void 0:a.person_id)||x.person_id,user_id:(null==(i=x.data)?void 0:i.user_id)||x.user_id,person_validated:(null==(s=x.data)?void 0:s.person_validated)||x.person_validated,face_processing:(null==(c=x.data)?void 0:c.face_processing)||x.face_processing,onboarding_link:(null==(d=x.data)?void 0:d.onboarding_link)||x.onboarding_link,task_id:null==(l=x.data)?void 0:l.task_id,status:null==(u=x.data)?void 0:u.status}}catch(g){if(g instanceof Error){if("AbortError"===g.name)throw new h("Request timed out",f.NETWORK);if(g instanceof h)throw g;throw new h(g.message,f.NETWORK)}throw new h("Unknown error occurred",f.NETWORK_ERROR)}},qa=async(e,n,t)=>{const o=Ra();try{const r=await fetch(`${Ea()}/api/v1/auth/login/`,{method:"POST",headers:{"Content-Type":"application/json","X-App-Token":t},body:JSON.stringify({email:e,password:n}),signal:o.signal});if(!r.ok){if(401===r.status||403===r.status)throw new h("Email ou senha inválidos",f.INVALID_TOKEN);throw new h(`API Error ${r.status}`,f.API_ERROR)}const a=await r.json();return{success:!0,accessToken:a.access_token||a.access,alias:a.user&&a.user.alias||a.alias,user:{id:a.user&&a.user.id||"",email:a.user&&a.user.email||"",role:a.user&&a.user.role||"",validated:a.user&&a.user.validated||!1,active:a.user&&a.user.active||!1}}}catch(r){if(r instanceof Error){if("AbortError"===r.name)throw new h("Request timed out",f.NETWORK);if(r instanceof h)throw r;throw new h(r.message,f.NETWORK)}throw new h("Unknown error occurred",f.NETWORK_ERROR)}},Ua=async(e,n)=>{var t,o,r,a;_a();const i=Ra(),s=await Ta(e),c=await new Promise(((e,n)=>{const t=new FileReader;t.onload=()=>{const n=t.result;e(n.split(",")[1])},t.onerror=n,t.readAsDataURL(s)}));try{const e=await fetch(`${Ea()}/api/v1/auth/recognition/face/`,{method:"POST",headers:{"Content-Type":"application/json","X-App-Token":n},body:JSON.stringify({image:c,purpose:"SIMPLE_IDENTIFICATION_F"}),signal:i.signal});if(!e.ok){if(401===e.status||403===e.status)throw new h("Invalid or expired application token",f.INVALID_TOKEN);throw new h(`Server returned status ${e.status}`,f.NETWORK)}const s=await e.json();if(202===e.status||s.data&&s.data.task_id)return{success:!0,taskId:(null==(t=s.data)?void 0:t.task_id)||s.task_id,status:(null==(o=s.data)?void 0:o.status)||"processing",message:s.message||"Identification scheduled"};if(!s.success)throw new h(s.message||"Person identification failed",f.RECOGNITION_FAILED);return{success:!0,person:{name:(null==(r=s.person)?void 0:r.name)||"",birth_date:(null==(a=s.person)?void 0:a.birth_date)||""}}}catch(d){if(d instanceof Error){if("AbortError"===d.name)throw new h("Request timed out",f.NETWORK);if(d instanceof h)throw d;throw new h(d.message,f.NETWORK)}throw new h("Unknown error occurred",f.NETWORK_ERROR)}},Ba=async(e,n,t)=>{if(_a(),!e)throw new h("Person ID is required",f.VALIDATION_ERROR);if(!n)throw new h("Face image is required",f.VALIDATION_ERROR);const o=Ra(),r=await Na(n),a=await new Promise(((e,n)=>{const t=new FileReader;t.onload=()=>{const n=t.result;e(n.split(",")[1])},t.onerror=n,t.readAsDataURL(r)}));try{const n=await fetch(`${Ea()}/api/v1/identity-data/`,{method:"POST",headers:{"Content-Type":"application/json","X-App-Token":t},body:JSON.stringify({person:e,type_of_identification:"FACE",biometric_data:a}),signal:o.signal});if(!n.ok){if(401===n.status||403===n.status)throw new h("Invalid or expired application token, or insufficient permissions",f.INVALID_TOKEN);if(400===n.status)try{const e=await n.json(),t=e.message||e.error||"Invalid biometric data";throw new h(t,f.VALIDATION_ERROR)}catch(i){if(i instanceof h)throw i;throw new h("Invalid biometric data",f.VALIDATION_ERROR)}throw new h(`Server returned status ${n.status}`,f.NETWORK)}const r=await n.json();return{success:!0,message:"Biometric data registered successfully",identity_data_id:r.id,type_of_identification:r.type_of_identification,have_biometric_data:r.have_biometric_data,created_at:r.created_at}}catch(s){if(s instanceof Error){if("AbortError"===s.name)throw new h("Request timed out",f.NETWORK);if(s instanceof h)throw s;throw new h(s.message,f.NETWORK)}throw new h("Unknown error occurred",f.NETWORK_ERROR)}},Wa=async(e,n,t)=>{_a();const o=Ra();try{const a=await fetch(`${Ea()}/api/v1/applications/`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${e}`},body:JSON.stringify({consumer:n,application_name:t.applicationName,domain:t.domain,accept_only_email_with_same_domain:t.acceptOnlyEmailWithSameDomain}),signal:o.signal});if(!a.ok){if(401===a.status)throw new h("Invalid or expired JWT token",f.INVALID_TOKEN);if(403===a.status)throw new h("Insufficient permissions to create application",f.INVALID_TOKEN);if(400===a.status)try{const e=await a.json(),n=e.message||e.error||"Invalid application data";throw new h(n,f.VALIDATION_ERROR)}catch(r){if(r instanceof h)throw r;throw new h("Invalid application data",f.VALIDATION_ERROR)}throw new h(`Server returned status ${a.status}`,f.NETWORK)}const i=await a.json();return{success:!0,application:{id:i.id,application_name:i.application_name,domain:i.domain,accept_only_email_with_same_domain:i.accept_only_email_with_same_domain,app_token:i.app_token,is_active:i.is_active,created_at:i.created_at},message:"Application registered successfully"}}catch(a){if(a instanceof Error){if("AbortError"===a.name)throw new h("Request timed out",f.NETWORK);if(a instanceof h)throw a;throw new h(a.message,f.NETWORK)}throw new h("Unknown error occurred",f.NETWORK_ERROR)}},Va=async(e={})=>{_a();const{durationMs:n=3e3,onProgress:t}=e;return new Promise((async(e,o)=>{let r=null;const a=[];try{r=await navigator.mediaDevices.getUserMedia({video:{facingMode:"user",width:{ideal:640},height:{ideal:480}},audio:!1});const i=(()=>{const e=["video/mp4;codecs=avc1","video/mp4","video/webm;codecs=vp9","video/webm;codecs=vp8","video/webm"];for(const n of e)if(MediaRecorder.isTypeSupported(n))return n;return""})();let s;try{s=i?new MediaRecorder(r,{mimeType:i,videoBitsPerSecond:1e6}):new MediaRecorder(r,{videoBitsPerSecond:1e6})}catch{s=new MediaRecorder(r)}const c=s.mimeType||i;if(s.ondataavailable=e=>{e.data.size>0&&a.push(e.data)},s.onstop=()=>{r&&r.getTracks().forEach((e=>e.stop()));const n=new Blob(a,{type:c});e(n)},s.onerror=e=>{r&&r.getTracks().forEach((e=>e.stop())),o(new h(`Recording error: ${e}`,f.CAPTURE_ERROR))},s.start(100),t){const e=100;let o=0;const r=setInterval((()=>{o+=e;const a=Math.min(100,o/n*100);t(a),o>=n&&clearInterval(r)}),e)}setTimeout((()=>{s&&"recording"===s.state&&s.stop()}),n)}catch(i){r&&r.getTracks().forEach((e=>e.stop())),i instanceof Error?"NotAllowedError"===i.name?o(new h("Camera permission denied",f.CAMERA_ERROR)):"NotFoundError"===i.name?o(new h("No camera found",f.NO_CAMERA)):o(new h(i.message,f.CAPTURE_ERROR)):o(new h("Failed to record video",f.CAPTURE_ERROR))}}))},Za=async(e,n,t={})=>{var o,r,a,i,s,c;const{maxAttempts:d=60,intervalMs:l=1e3,onStatusChange:u}=t;let p=0;for(;p<d;){p++;try{const t=await fetch(`${Ea()}/api/v1/tasks/status/?task_id=${e}`,{method:"GET",headers:{Accept:"application/json","X-App-Token":n}});if(!t.ok)throw new h(`Task status check failed: ${t.status}`,f.NETWORK);const d=await t.json(),p=(null==(o=d.data)?void 0:o.status)||"unknown";if(u){u(p,null==(a=null==(r=d.data)?void 0:r.progress)?void 0:a.percentage)}if("success"===p)return d.data.result;if("failure"===p){const e=(null==(s=null==(i=d.data)?void 0:i.result)?void 0:s.message)||(null==(c=d.data)?void 0:c.error)||"Task failed";throw new h(e,f.RECOGNITION_FAILED)}if("revoked"===p)throw new h("Task was cancelled",f.RECOGNITION_FAILED);await new Promise((e=>setTimeout(e,l)))}catch(m){if(m instanceof h)throw m;throw new h(`Polling error: ${m instanceof Error?m.message:"Unknown error"}`,f.NETWORK)}}throw new h("Task status polling timed out",f.NETWORK)},Ka=async(e,n)=>{var t;_a();const o=Ra();try{const r=await fetch(`${Ea()}/api/v1/auth/recognition/face/`,{method:"POST",headers:{"Content-Type":"application/json","X-App-Token":n},body:JSON.stringify({video:e,purpose:"PROOF_OF_LIFE"}),signal:o.signal});if(!r.ok){if(401===r.status||403===r.status)throw new h("Invalid or expired application token",f.INVALID_TOKEN);if(400===r.status){const e=await r.json();throw new h(e.message||"Invalid request data",f.VALIDATION_ERROR)}throw new h(`Server returned status ${r.status}`,f.NETWORK)}const a=await r.json();if(!a.success||!(null==(t=a.data)?void 0:t.task_id))throw new h(a.message||"Failed to start proof of life",f.RECOGNITION_FAILED);return{taskId:a.data.task_id,historyId:a.data.history_id,status:a.data.status,message:a.message||"Recognition started successfully"}}catch(r){if(r instanceof Error){if("AbortError"===r.name)throw new h("Request timed out",f.NETWORK);if(r instanceof h)throw r;throw new h(r.message,f.NETWORK)}throw new h("Unknown error occurred",f.NETWORK_ERROR)}},Ja=async e=>new Promise(((n,t)=>{const o=new FileReader;o.onload=()=>{const e=o.result,t=e.includes(",")?e.split(",")[1]:e;n(t)},o.onerror=()=>t(new h("Failed to convert video to base64",f.CAPTURE_ERROR)),o.readAsDataURL(e)})),Ga=async(e,n,t)=>{var o,r;if(_a(),!e)throw new h("personId is required",f.VALIDATION_ERROR);if(!n)throw new h("jwtToken is required",f.VALIDATION_ERROR);if(!t||0===t.length)throw new h("At least one document image is required",f.VALIDATION_ERROR);const a=await Promise.all(t.map((async e=>{const n=await Ta(e);return t=n,new Promise(((e,n)=>{const o=new FileReader;o.onload=()=>{const n=o.result;e(n.includes(",")?n.split(",")[1]:n)},o.onerror=()=>n(new h("Failed to convert image to base64",f.CAPTURE_ERROR)),o.readAsDataURL(t)}));var t}))),i=Ra();try{const t=await fetch(`${Ea()}/api/v1/donors/${e}/documents/`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${n}`},body:JSON.stringify({document_images:a}),signal:i.signal}),s=await t.json();if(!t.ok)throw new h((null==s?void 0:s.message)||`API Error ${t.status}`,f.NETWORK_ERROR);return{success:!0,taskId:(null==(o=s.data)?void 0:o.task_id)??"",status:(null==(r=s.data)?void 0:r.status)??"processing",message:s.message??"Documents submitted for processing"}}catch(s){if(s instanceof h)throw s;if(s instanceof Error){if("AbortError"===s.name)throw new h("Request timeout",f.NETWORK_ERROR);throw new h(s.message,f.NETWORK_ERROR)}throw new h("Unknown error occurred",f.NETWORK_ERROR)}},Ha=async(e,n)=>{const t=Ra();try{const o=await fetch(`${Ea()}/api/v1/tasks/status/?task_id=${e}`,{method:"GET",headers:{"Content-Type":"application/json",...n?{"X-App-Token":n}:{}},signal:t.signal}),r=await o.json();if(!o.ok)throw new h((null==r?void 0:r.message)||`API Error ${o.status}`,f.NETWORK_ERROR);return{success:r.success,status:r.data.status,result:r.data.result,error:r.data.error}}catch(o){if(o instanceof h)throw o;throw new h("Failed to fetch task status",f.NETWORK_ERROR)}},Xa=async(e,n,t={})=>{var o,r;const{maxRetries:a=30,interval:i=2e3}=t,s=await Ua(e,n);if(s.person)return{personFound:!0,person:s.person};const{taskId:c}=s;if(!c)return{personFound:!1};for(let d=0;d<a;d++){const e=await Ha(c);if("success"===e.status)return e.result&&e.result.success?{personFound:!0,person:{name:(null==(o=e.result.person)?void 0:o.name)||"Pessoa identificada",birth_date:(null==(r=e.result.person)?void 0:r.birth_date)||""}}:{personFound:!1};if("failure"===e.status)return{personFound:!1};await new Promise((e=>setTimeout(e,i)))}throw new h("Timed out waiting for identification",f.NETWORK_ERROR)};async function Ya(e,n){const t=ba(),o=await fetch(`${t}/api/v1/user/password/reset/request/`,{method:"POST",headers:{"Content-Type":"application/json","X-App-Token":n},body:JSON.stringify({email:e})});if(!o.ok){const e=await o.json();throw new h(e.message||"Erro ao solicitar recuperação de senha",f.API_ERROR)}return o.json()}async function Qa(e,n){const t=ba(),o=await fetch(`${t}/api/v1/user/password/reset/confirm/`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({token:e,new_password:n})});if(!o.ok){const e=await o.json();throw new h(e.error||e.message||"Erro ao redefinir senha",f.API_ERROR)}return o.json()}const ei=Object.freeze(Object.defineProperty({__proto__:null,checkUserExistence:La,completeOnboarding:Ca,completeOnboardingWithData:za,confirmPasswordReset:Qa,getOnboardingDetails:Sa,getTaskStatus:Ha,identifyPerson:Ua,identifyPersonAsync:Xa,loginWithBiometric:Aa,loginWithEmail:qa,pollTaskStatus:Za,recognize:ja,recognizeBiometric:Fa,recognizeByPurpose:Pa,recordFaceVideo:Va,registerApplication:Wa,registerBiometric:Ba,registerDocumentByImage:Ga,registerPersonWithBiometric:Ma,registerPersonWithoutFace:Da,requestPasswordReset:Ya,simpleIdentification:$a,startProofOfLife:Ka,validateOnboardingToken:Ia,validateToken:Oa,videoToBase64:Ja},Symbol.toStringTag,{value:"Module"}));function ni(e,n={}){if(!e||0===e.videoWidth||0===e.videoHeight)return 0;const t=n.sample??64,o=e.videoWidth,r=e.videoHeight,a=n.roi??function(e,n,t){const o=Math.round(e*t),r=Math.round(n*t);return{x:Math.round((e-o)/2),y:Math.round((n-r)/2),width:o,height:r}}(o,r,.4),i=n.scratch??document.createElement("canvas");i.width=t,i.height=t;const s=i.getContext("2d",{willReadFrequently:!0});if(!s)return 0;try{s.drawImage(e,a.x,a.y,a.width,a.height,0,0,t,t);return function(e){const n=e.length;if(0===n)return 0;let t=0,o=0;for(let r=0;r<n;r+=4){t+=.2126*e[r]+.7152*e[r+1]+.0722*e[r+2],o+=1}return 0===o?0:t/(255*o)}(s.getImageData(0,0,t,t).data)}catch{return 0}}function ti(e,t={}){const o=t.enabled??!0,r=t.darkThreshold??.235,a=t.improvementTarget??.12,i=t.sampleIntervalMs??600,s=t.minToggleMs??3e3,[c,d]=n.useState(!1),[l,u]=n.useState(0),p=n.useRef(0),f=n.useRef(0),h=n.useRef(null),m=n.useRef(!1),g=n.useRef(null);return n.useEffect((()=>{m.current=c}),[c]),n.useEffect((()=>{if(!o)return d(!1),()=>{};"undefined"==typeof document||g.current||(g.current=document.createElement("canvas"));let n=null,t=null,c=!1;const l=()=>{if(c)return;const n=ni(e.current,{scratch:g.current??void 0});u(n);const o=Date.now();m.current||(n>0&&n<r?p.current+=1:p.current=0,p.current>=2&&o-f.current>=s&&(h.current=n,f.current=o,m.current=!0,d(!0),p.current=0,t=setTimeout((()=>{if(c)return;ni(e.current,{scratch:g.current??void 0})-(h.current??0)<a&&(f.current=Date.now(),m.current=!1,d(!1)),h.current=null}),600)))};return n=setInterval(l,i),l(),()=>{c=!0,n&&clearInterval(n),t&&clearTimeout(t)}}),[o,r,a,i,s,e]),{flashOn:c,lastBrightness:l}}function oi({active:e,zIndex:n=10001,onDismiss:t}){if(!e)return null;const r={position:"fixed",inset:0,background:"#FFFFFF",zIndex:n,pointerEvents:"none",animation:"nfid-flash-in 200ms ease-out"},a={position:"fixed",top:12,left:"50%",transform:"translateX(-50%)",zIndex:n+1,background:"rgba(10,19,32,.72)",color:"#FFFFFF",fontSize:12,fontWeight:600,letterSpacing:.2,padding:"6px 12px",borderRadius:999,pointerEvents:t?"auto":"none",display:"flex",alignItems:"center",gap:8};return o.jsxs(o.Fragment,{children:[o.jsx("style",{children:"\n @keyframes nfid-flash-in { from { opacity: 0 } to { opacity: 1 } }\n @media (prefers-reduced-motion: reduce) {\n .nfid-screen-flash { animation: none !important; }\n }\n "}),o.jsx("div",{className:"nfid-screen-flash",style:r,"aria-hidden":"true"}),o.jsxs("div",{className:"nfid-screen-flash-hint",style:a,role:"status",children:["Aumentando a luz da tela",t&&o.jsx("button",{type:"button",onClick:t,"aria-label":"Desligar iluminação assistiva",style:{background:"transparent",border:"none",color:"#FFFFFF",cursor:"pointer",fontSize:14,lineHeight:1,padding:"0 4px"},children:"×"})]})]})}function ri(e,n){return Math.hypot(e.x-n.x,e.y-n.y)}function ai(e){if(6!==e.length)throw new Error(`calculateEAR espera exatamente 6 pontos do olho, recebeu ${e.length}`);const[n,t,o,r,a,i]=e,s=ri(t,i),c=ri(o,a),d=ri(n,r);return d<1e-6?0:(s+c)/(2*d)}const ii=(e,n)=>{switch(n.type){case"PERMISSION_GRANTED":case"RESET":return{status:"ready"};case"PERMISSION_DENIED":return{status:"error",message:"Permissão para acessar a câmera foi negada"};case"START_CAPTURE":return{status:"capturing"};case"UPLOAD_START":return{status:"uploading"};case"UPLOAD_SUCCESS":return{status:"success"};case"UPLOAD_ERROR":case"SET_ERROR":return{status:"error",message:n.message};default:return e}},si={overlay:{position:"fixed",top:0,left:0,right:0,bottom:0,backgroundColor:"rgba(0, 0, 0, 0.8)",display:"flex",justifyContent:"center",alignItems:"center",zIndex:1e3},modal:{backgroundColor:"#000",borderRadius:"12px",overflow:"hidden",position:"relative",width:"60%",maxWidth:"600px",maxHeight:"80vh"},video:{width:"100%",height:"auto",display:"block"},canvas:{display:"none"},guide:{position:"absolute",top:"50%",left:"50%",transform:"translate(-50%, -50%)",width:"200px",height:"200px",border:"2px solid rgba(255, 255, 255, 0.5)",borderRadius:"50%",pointerEvents:"none"},controls:{position:"absolute",bottom:"20px",left:0,right:0,display:"flex",justifyContent:"center",gap:"10px"},button:{padding:"12px 24px",borderRadius:"24px",border:"none",backgroundColor:"#0059C4",color:"white",fontSize:"16px",fontWeight:"bold",cursor:"pointer"},message:{position:"absolute",top:"20px",left:0,right:0,textAlign:"center",color:"white",fontSize:"18px",fontWeight:"bold"},spinner:{position:"absolute",top:"50%",left:"50%",transform:"translate(-50%, -50%)",width:"40px",height:"40px",border:"4px solid rgba(255, 255, 255, 0.3)",borderRadius:"50%",borderTopColor:"white",animation:"spin 1s linear infinite"},closeButton:{position:"absolute",top:"20px",right:"20px",backgroundColor:"transparent",border:"none",color:"white",fontSize:"24px",cursor:"pointer"}};function ci({accessToken:e,onClose:t,onSuccess:r,onCannotGesture:a,autoLighting:i=!0}){const s=n.useRef(null),c=n.useRef(null),l=n.useRef(null),u=n.useRef(null),m=n.useRef(!1),g=n.useRef(null),[v,b]=n.useReducer(ii,{status:"requestingPermission"}),[w,y]=n.useState(!1),{startCamera:x,stopCamera:k}=p(),E=()=>{if(!s.current)return;const e=async()=>{if(s.current&&"ready"===v.status){try{const e=await d.detectAllFaces(s.current,new d.TinyFaceDetectorOptions),n=1===e.length,t=n&&(e=>{if(!s.current)return!1;const{box:n}=e,{videoWidth:t,videoHeight:o}=s.current,r=t/2,a=o/2,i=.4*t,c=.4*o;return n.x+n.width/2>r-i/2&&n.x+n.width/2<r+i/2&&n.y+n.height/2>a-c/2&&n.y+n.height/2<a+c/2})(e[0]);y(n&&t)}catch(n){}u.current=window.setTimeout(e,100)}};e()};n.useEffect((()=>{la()}),[]),n.useEffect((()=>()=>{var e;null==(e=g.current)||e.abort()}),[]);const _=i&&("ready"===v.status||"capturing"===v.status),{flashOn:R}=ti(s,{enabled:_});n.useEffect((()=>((async()=>{try{await Promise.all([d.nets.tinyFaceDetector.loadFromUri("/models"),d.nets.faceLandmark68Net.loadFromUri("/models")])}catch(e){}})(),()=>{u.current&&window.clearTimeout(u.current)})),[]),n.useEffect((()=>((async()=>{try{const e=await x();l.current=e,s.current&&(s.current.srcObject=e),b({type:"PERMISSION_GRANTED"}),E()}catch(e){b({type:"PERMISSION_DENIED"})}})(),()=>{l.current&&k(l.current)})),[x,k]);const N=async()=>{if(!c.current||!s.current)return;if(m.current)return;m.current=!0;const n=s.current,o=c.current,a=new AbortController;g.current=a;try{b({type:"START_CAPTURE"});const s=await function(e,n,t=3e3,o=.2,r){return new Promise((a=>{const i=Date.now()+t;let s=!1,c=!1;const d=e=>{c||(c=!0,a(e))},l=()=>{c||((null==r?void 0:r.aborted)||Date.now()>=i?d(!1):e.detectSingleFace(n,new e.TinyFaceDetectorOptions).withFaceLandmarks().then((e=>{if(e)if((ai(e.landmarks.getLeftEye())+ai(e.landmarks.getRightEye()))/2<o)s=!0;else if(s)return void d(!0);setTimeout(l,50)})).catch((()=>{setTimeout(l,50)})))};l()}))}(d,n,void 0,void 0,a.signal);if(a.signal.aborted)return;if(!s){const e=new h("Blink not detected within window",f.LIVENESS_BLINK_MISSING);return void b({type:"SET_ERROR",message:e.getFriendlyMessage()})}const c=o.getContext("2d");if(!c)return void b({type:"SET_ERROR",message:"Failed to get canvas context"});o.width=n.videoWidth,o.height=n.videoHeight,c.drawImage(n,0,0,o.width,o.height);const l=await new Promise(((e,n)=>{o.toBlob((t=>{t?e(t):n(new Error("Failed to convert canvas to blob"))}),"image/jpeg",.95)}));try{const n=await ja(l,e);r({success:!0,data:{faceId:n.payload.documentId,confidence:1}}),b({type:"UPLOAD_SUCCESS"}),setTimeout(t,1500)}catch(i){b({type:"SET_ERROR",message:"Face recognition failed"})}}catch(i){b({type:"SET_ERROR",message:"Failed to capture image"})}finally{m.current=!1}};return o.jsxs("div",{className:"neofaceid-root",style:si.overlay,children:[o.jsx(oi,{active:R}),o.jsx("style",{children:"\n @keyframes spin {\n 0% { transform: translate(-50%, -50%) rotate(0deg); }\n 100% { transform: translate(-50%, -50%) rotate(360deg); }\n }\n"}),o.jsx("style",{children:"\n @media (max-width: 768px) {\n .modal {\n width: 100%;\n height: 100%;\n max-height: 100vh;\n border-radius: 0;\n }\n .button {\n padding: 16px 32px;\n font-size: 18px;\n }\n }\n"}),o.jsxs("div",{style:si.modal,className:"modal",children:[o.jsx("button",{type:"button",style:si.closeButton,onClick:t,children:"×"}),o.jsx("video",{ref:s,style:si.video,autoPlay:!0,playsInline:!0,muted:!0}),o.jsx("canvas",{ref:c,style:si.canvas}),o.jsx("div",{style:si.guide}),"ready"===v.status&&!w&&o.jsx("div",{style:si.message,"aria-live":"assertive",children:"Centralize seu rosto no círculo"}),"capturing"===v.status&&o.jsx("div",{style:si.message,"aria-live":"assertive",children:"Por favor, pisque os olhos"}),("ready"===v.status||"capturing"===v.status)&&o.jsx("button",{type:"button",className:"neofaceid-face-cannot-gesture",onClick:()=>{a?a():t()},"aria-label":"Não consigo fazer esse movimento — buscar alternativa",style:{position:"absolute",bottom:100,left:"50%",transform:"translateX(-50%)",minHeight:44,minWidth:44,padding:"10px 20px",background:"transparent",border:"1px solid rgba(255, 255, 255, 0.32)",borderRadius:22,color:"rgba(255, 255, 255, 0.9)",fontSize:14,fontWeight:500,fontFamily:"inherit",cursor:"pointer",zIndex:10},children:"Não consigo fazer esse movimento"}),"uploading"===v.status&&o.jsx("div",{style:si.spinner}),"success"===v.status&&o.jsx("div",{style:si.message,children:"Autenticado!"}),"error"===v.status&&o.jsx("div",{style:si.message,children:v.message}),o.jsxs("div",{style:si.controls,children:["ready"===v.status&&w&&o.jsx("button",{type:"button",style:si.button,onClick:N,children:"Capturar"}),"capturing"===v.status&&o.jsx("button",{type:"button",style:si.button,onClick:N,children:"Capturar"}),"error"===v.status&&o.jsx("button",{type:"button",style:si.button,onClick:()=>{b({type:"RESET"})},children:"Tentar Novamente"})]})]})]})}const di='<svg xmlns="http://www.w3.org/2000/svg" aria-label="NeoFaceID" viewBox="-43.1 -71.1 1318.2 1318.2"><g fill="currentColor"><path d="M138.1 2a10 10 0 0 1-5.8 2c-1.9 0-6.1 1.3-9.2 2.8a94 94 0 0 1-11.1 4.7c-3 1-8.1 3.4-11.2 5.2a33 33 0 0 1-6.7 3.3c-.5 0-1.4.6-1.8 1.4s-2.4 2.1-4.3 3a39 39 0 0 0-11.7 7.8 18 18 0 0 1-5.6 3.8c-1.8 0-33.9 32.3-35.3 35.5a27 27 0 0 1-4.5 6.3c-2 2-4.6 5.4-5.8 7.4-1.3 2.1-2.6 3.8-3.1 3.8s-1.2 1-1.5 2.2c-1.1 3.6-9.6 20.7-10.6 21.4-.5.3-.9 1.6-.9 2.8 0 1.3-.6 3.9-1.4 5.7s-1.2 4.6-.9 6q.4 2.5-1.1 3.8-1.6 1.4-1.6 6.2c0 3.8-.4 5.2-2 6.1-2.6 1.7-3.2 211.1-.6 212.1.8.3 2.6 3.1 4.1 6.3 3 6.3 5.3 8.7 10.2 11 1.8.8 3.3 1.9 3.3 2.4 0 1.4 6 4.2 7.7 3.6.8-.3 2.7.1 4.3.9 3.5 1.8 10.3 2 13.3.3 1.2-.6 3.8-1 5.8-1 2.2.1 4.2-.4 5-1.4.7-.8 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-2 1.8 0 16.6-5 17.9-6.1 2-1.6 18.8-9.9 20.1-9.9.7 0 2.1-.9 3.1-2.1.9-1.1 3.3-2.9 5.2-3.9s5.1-3.4 6.9-5.4 4.1-3.6 4.9-3.6c2.2 0 23.9-21.6 27.8-27.7 1.9-2.8 3.8-5.4 4.4-5.8a42 42 0 0 0 4.6-6.3l5.5-8.4a10 10 0 0 0 1.9-4.3c0-.8 1-2.5 2.3-3.7a31 31 0 0 0 6.7-13.5c0-1.2.5-2.5 1-2.8 2.6-1.6 5.4-11.2 6.7-22.7.2-2.6 1.1-5.2 1.9-5.9 1.1-.9 1.4-4 1.4-13 0-10.8.2-12 2-13.1 2.4-1.5 3.1-18.2.8-19.1q-1.5-.3-.1-2.5c1-1.6.9-2.3-.2-3.2-1.9-1.5-1.9-4.9-.2-5.6s2.2-13 .7-13.9q-.9-.6.2-2.5c.9-1.4.9-2.2-.1-3.4s-1.1-1.9-.2-3q1.4-1.3-.4-2.6c-1.9-1.6-1.9-5.9 0-6.6 2.6-1 2.2-26.5-.5-28.2q-1.8-1.2-2-2.2c0-.6.9-1.8 2-2.7 2.2-1.9 3.1-19.3 1-19.3-.5 0-1-1.1-1-2.4 0-1.4.5-2.8 1-3.1 2-1.2 1.2-12.9-1-14.3-1.9-1.2-2-2.3-2-26.1 0-15.8-.4-25.2-1-25.6s-1.7-2.2-2.5-4.1-1.8-3.4-2.4-3.4-1.4-1.5-2-3.3q-1.1-3.2-5.8-6.1a42 42 0 0 1-6.6-4.8c-1-1-2.8-1.8-4.1-1.8s-3.7-.7-5.2-1.5a22 22 0 0 0-15.4 0"/></g></svg>',li=di;const ui={display:"flex",alignItems:"center",justifyContent:"center",gap:6,color:"var(--nfid-text-subtle)",fontFamily:"inherit",lineHeight:1},pi={display:"inline-flex",alignItems:"center",justifyContent:"center",color:"currentColor"},fi={fontSize:12,fontWeight:600,letterSpacing:.2,color:"var(--nfid-text-muted)"},hi={fontSize:9,fontWeight:400,color:"var(--nfid-text-subtle)",opacity:.75},mi={fontSize:9,fontWeight:500,color:"var(--nfid-text-subtle)",opacity:.75};function gi({size:e=16,style:n}){return o.jsxs("div",{className:"neofaceid-brand-footer",style:{...ui,...n},children:[o.jsx("span",{"aria-hidden":"true",style:{...pi,width:e,height:e},dangerouslySetInnerHTML:{__html:li}}),o.jsx("span",{style:fi,children:"NeoFaceID"}),o.jsx("span",{style:hi,children:"by"}),o.jsx("span",{style:mi,children:"Octa"})]})}function vi(e=16){return`<div class="neofaceid-brand-footer" style="display:flex;align-items:center;justify-content:center;gap:6px;color:var(--nfid-text-subtle);font-family:inherit;line-height:1;"><span aria-hidden="true" style="${`display:inline-flex;align-items:center;justify-content:center;color:currentColor;width:${e}px;height:${e}px;`}">${li}</span><span style="font-size:12px;font-weight:600;letter-spacing:0.2px;color:var(--nfid-text-muted);">NeoFaceID</span><span style="font-size:9px;font-weight:400;color:var(--nfid-text-subtle);opacity:0.75;">by</span><span style="font-size:9px;font-weight:500;color:var(--nfid-text-subtle);opacity:0.75;">Octa</span></div>`}class bi{constructor(e){i(this,"applicationToken"),i(this,"modalElement",null),this.applicationToken=e}open(){this.modalElement||(la(),this.addStyles(),this.modalElement=document.createElement("div"),this.modalElement.className="neofaceid-root neoface-forgot-modal",this.renderEmailForm(),document.body.appendChild(this.modalElement))}close(){this.modalElement&&document.body.contains(this.modalElement)&&(document.body.removeChild(this.modalElement),this.modalElement=null)}renderEmailForm(){if(!this.modalElement)return;this.modalElement.innerHTML=`\n <div class="neoface-forgot-overlay">\n <div class="neoface-forgot-content">\n <div class="neoface-forgot-icon">\n <svg viewBox="0 0 64 64" fill="none" xmlns="http://www.w3.org/2000/svg">\n <circle cx="32" cy="32" r="28" stroke="#0059C4" stroke-width="3" fill="none"/>\n <rect x="22" y="28" width="20" height="16" rx="3" stroke="#0059C4" stroke-width="2.5" fill="none"/>\n <path d="M26 28v-4a6 6 0 0 1 12 0v4" stroke="#0059C4" stroke-width="2.5" stroke-linecap="round"/>\n <circle cx="32" cy="36" r="2" fill="#0059C4"/>\n </svg>\n </div>\n\n <h2 class="neoface-forgot-title">Recuperar senha</h2>\n <p class="neoface-forgot-subtitle">Informe seu email e enviaremos um link para redefinir sua senha.</p>\n\n <div id="neoface-forgot-error" class="neoface-forgot-error" style="display:none"></div>\n\n <form id="neoface-forgot-form">\n <input\n type="email"\n id="neoface-forgot-email"\n class="neoface-forgot-input"\n placeholder="seu@email.com"\n autocomplete="email"\n required\n />\n <button type="submit" class="neoface-forgot-btn-primary">\n Enviar link\n </button>\n </form>\n\n <button class="neoface-forgot-btn-ghost neoface-forgot-back">\n Voltar\n </button>\n\n <div class="neoface-forgot-branding">\n ${vi()}\n </div>\n </div>\n </div>\n `;this.modalElement.querySelector("#neoface-forgot-form").addEventListener("submit",this.handleSubmit.bind(this));this.modalElement.querySelector(".neoface-forgot-back").addEventListener("click",this.close.bind(this))}renderSuccess(){if(!this.modalElement)return;const e=this.modalElement.querySelector(".neoface-forgot-content");e.innerHTML=`\n <div class="neoface-forgot-success-icon">\n <svg viewBox="0 0 64 64" fill="none" xmlns="http://www.w3.org/2000/svg">\n <circle cx="32" cy="32" r="28" stroke="#0E9F6E" stroke-width="3" fill="none"/>\n <path d="M20 32 L28 40 L44 24" stroke="#0E9F6E" stroke-width="3" stroke-linecap="round" stroke-linejoin="round"/>\n </svg>\n </div>\n\n <h2 class="neoface-forgot-title">Email enviado!</h2>\n <p class="neoface-forgot-subtitle">\n Verifique sua caixa de entrada e siga as instruções para redefinir sua senha.\n <br/><br/>\n <span style="color: rgba(255,255,255,0.5); font-size: 13px;">Não recebeu? Verifique também sua pasta de spam.</span>\n </p>\n\n <button class="neoface-forgot-btn-primary neoface-forgot-close-success" style="margin-top: 8px;">\n Fechar\n </button>\n\n <div class="neoface-forgot-branding">\n ${vi()}\n </div>\n `;e.querySelector(".neoface-forgot-close-success").addEventListener("click",this.close.bind(this))}async handleSubmit(e){var n,t,o,r;e.preventDefault();const a=null==(n=this.modalElement)?void 0:n.querySelector("#neoface-forgot-email"),i=null==(t=this.modalElement)?void 0:t.querySelector(".neoface-forgot-btn-primary"),s=null==(o=this.modalElement)?void 0:o.querySelector("#neoface-forgot-error"),c=null==(r=null==a?void 0:a.value)?void 0:r.trim();if(c){i.disabled=!0,i.textContent="Enviando...",s.style.display="none";try{await Ya(c,this.applicationToken),this.renderSuccess()}catch(d){i.disabled=!1,i.textContent="Enviar link",s.style.display="block",s.textContent=d instanceof h?d.message:"Erro ao enviar email. Tente novamente."}}}addStyles(){const e="neoface-forgot-password-modal-styles";document.getElementById(e)||ua(e,"\n .neoface-forgot-modal {\n position: fixed;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n z-index: 10003;\n font-family: inherit;\n }\n\n .neoface-forgot-overlay {\n position: absolute;\n inset: 0;\n background: rgba(0, 0, 0, 0.65);\n backdrop-filter: blur(8px);\n display: flex;\n align-items: center;\n justify-content: center;\n padding: 20px;\n animation: neoface-forgot-fadeIn 0.3s ease-out;\n }\n\n @keyframes neoface-forgot-fadeIn {\n from { opacity: 0; }\n to { opacity: 1; }\n }\n\n @keyframes neoface-forgot-slideUp {\n from { opacity: 0; transform: translateY(20px); }\n to { opacity: 1; transform: translateY(0); }\n }\n\n .neoface-forgot-content {\n background: linear-gradient(135deg, #0A1320 0%, #111C2B 100%);\n border-radius: 20px;\n padding: 32px;\n max-width: 400px;\n width: 100%;\n box-shadow: 0 24px 48px rgba(0, 0, 0, 0.4), 0 0 0 1px rgba(255, 255, 255, 0.1);\n animation: neoface-forgot-slideUp 0.4s ease-out;\n text-align: center;\n }\n\n .neoface-forgot-icon {\n width: 64px;\n height: 64px;\n margin: 0 auto 20px;\n }\n\n .neoface-forgot-success-icon {\n width: 64px;\n height: 64px;\n margin: 0 auto 20px;\n animation: neoface-forgot-scaleIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);\n }\n\n @keyframes neoface-forgot-scaleIn {\n 0% { transform: scale(0); opacity: 0; }\n 50% { transform: scale(1.1); }\n 100% { transform: scale(1); opacity: 1; }\n }\n\n .neoface-forgot-title {\n font-size: 22px;\n font-weight: 700;\n color: white;\n margin: 0 0 10px 0;\n }\n\n .neoface-forgot-subtitle {\n font-size: 15px;\n color: rgba(255, 255, 255, 0.7);\n margin: 0 0 24px 0;\n line-height: 1.5;\n }\n\n .neoface-forgot-error {\n background: rgba(239, 68, 68, 0.15);\n border: 1px solid rgba(239, 68, 68, 0.4);\n color: #fca5a5;\n border-radius: 10px;\n padding: 10px 14px;\n font-size: 14px;\n margin-bottom: 16px;\n text-align: left;\n }\n\n #neoface-forgot-form {\n display: flex;\n flex-direction: column;\n gap: 14px;\n margin-bottom: 12px;\n }\n\n .neoface-forgot-input {\n width: 100%;\n padding: 14px 16px;\n border: 2px solid rgba(255, 255, 255, 0.2);\n border-radius: 12px;\n font-size: 15px;\n background: rgba(255, 255, 255, 0.08);\n color: white;\n font-family: inherit;\n transition: all 0.2s;\n box-sizing: border-box;\n }\n\n .neoface-forgot-input::placeholder {\n color: rgba(255, 255, 255, 0.4);\n }\n\n .neoface-forgot-input:focus {\n outline: none;\n border-color: #0059C4;\n box-shadow: 0 0 0 3px rgba(0, 89, 196, 0.2);\n background: rgba(255, 255, 255, 0.12);\n }\n\n .neoface-forgot-btn-primary {\n width: 100%;\n padding: 14px 24px;\n border-radius: 12px;\n border: none;\n background: linear-gradient(135deg, #0059C4 0%, #00449A 100%);\n color: white;\n font-size: 16px;\n font-weight: 600;\n cursor: pointer;\n transition: all 0.2s;\n box-shadow: 0 4px 16px rgba(0, 89, 196, 0.3);\n font-family: inherit;\n }\n\n .neoface-forgot-btn-primary:hover:not(:disabled) {\n transform: translateY(-2px);\n box-shadow: 0 8px 24px rgba(0, 89, 196, 0.4);\n }\n\n .neoface-forgot-btn-primary:disabled {\n opacity: 0.6;\n cursor: not-allowed;\n }\n\n .neoface-forgot-btn-ghost {\n background: transparent;\n border: none;\n color: rgba(255, 255, 255, 0.5);\n font-size: 14px;\n font-weight: 500;\n cursor: pointer;\n padding: 10px 16px;\n border-radius: 8px;\n transition: all 0.2s;\n font-family: inherit;\n width: 100%;\n }\n\n .neoface-forgot-btn-ghost:hover {\n color: white;\n background: rgba(255, 255, 255, 0.05);\n }\n\n .neoface-forgot-branding {\n display: flex;\n align-items: center;\n justify-content: center;\n gap: 6px;\n margin-top: 20px;\n color: rgba(255, 255, 255, 0.3);\n font-size: 12px;\n }\n\n .neoface-forgot-brand-logo {\n width: 18px;\n height: 18px;\n object-fit: contain;\n opacity: 0.5;\n }\n\n .neoface-forgot-brand-name {\n font-weight: 700;\n letter-spacing: 0.05em;\n }\n\n @media (max-width: 640px) {\n .neoface-forgot-content {\n padding: 24px;\n border-radius: 16px;\n }\n\n .neoface-forgot-title {\n font-size: 20px;\n }\n }\n ")}}const wi=(e,n)=>{switch(n.type){case"START_LIVENESS":return{status:"liveness",step:n.stepSequence[0],capturedPhotos:[],stepSequence:n.stepSequence,currentStepIndex:0,stepProgress:0};case"NEXT_STEP":if("liveness"===e.status){const t=n.photo?[...e.capturedPhotos,n.photo]:e.capturedPhotos;return{status:"liveness",step:n.step,capturedPhotos:t,stepSequence:e.stepSequence,currentStepIndex:e.currentStepIndex+1,stepProgress:0}}return e;case"UPDATE_PROGRESS":return"liveness"===e.status?{...e,stepProgress:n.progress}:e;case"CAMERA_LOADING":return{status:"camera-loading"};case"SUCCESS":return{status:"success"};case"DUPLICATE":return{status:"duplicate",personName:n.personName};case"ERROR":return{status:"error",message:n.message,retryable:n.retryable??!0};case"RESET":return xi();default:return e}},yi={center:"Posicione seu rosto no centro",up:"Incline a cabeça para cima",down:"Incline a cabeça para baixo",left:"Vire o rosto para a esquerda",right:"Vire o rosto para a direita",complete:"Processando..."},xi=()=>{const e=(()=>{const e=["up","down","left","right"];for(let n=e.length-1;n>0;n--){const t=Math.floor(Math.random()*(n+1));[e[n],e[t]]=[e[t],e[n]]}return["center",...e,"complete"]})();return{status:"liveness",step:e[0],capturedPhotos:[],stepSequence:e,currentStepIndex:0,stepProgress:0}},ki=8,Ei=10,_i=26,Ri=8,Ni=-8,Ti=15,Oi=-15,Si=1500,Ii=150,Ci=.35,zi=.65,ji=.18,Ai=.22,Fi=2e4;function $i({personData:e,applicationToken:t,onClose:r,onSuccess:a,onPhotosCaptured:i,onError:s,onCannotGesture:c,autoLighting:l=!0}){const u=n.useRef(null),p=n.useRef(null),f=n.useRef(null),h=n.useRef(null),m=n.useRef(null),g=n.useRef(!1),v=n.useRef("center"),b=n.useRef(null),w=n.useRef(null),y=n.useRef(!1),x=n.useRef(null),[k,E]=n.useReducer(wi,void 0,xi),[_,R]=n.useState(!1),[N,T]=n.useState("ok"),[O,S]=n.useState(!1);n.useEffect((()=>{la()}),[]);const I=l&&("liveness"===k.status||"camera-loading"===k.status),{flashOn:C}=ti(u,{enabled:I});n.useEffect((()=>{if("liveness"===k.status){const e=k.step;v.current!==e&&(v.current=e,g.current||(h.current&&(h.current=null),m.current&&(clearInterval(m.current),m.current=null),E({type:"UPDATE_PROGRESS",progress:0}))),x.current={stepSequence:k.stepSequence,currentStepIndex:k.currentStepIndex,capturedPhotos:k.capturedPhotos},w.current&&clearTimeout(w.current),"complete"!==k.step&&(w.current=window.setTimeout((()=>{E({type:"ERROR",message:"Tempo limite atingido para o movimento. Por favor, tente novamente em um ambiente bem iluminado.",retryable:!0})}),Fi))}}),[k.status,"liveness"===k.status&&k.step,"liveness"===k.status&&k.currentStepIndex]);const z=e=>{if(g.current||"complete"===v.current)return;const n=Date.now();e?h.current||(h.current=n,m.current&&clearInterval(m.current),m.current=window.setInterval((()=>{if(!h.current)return;const e=Date.now()-h.current,n=Math.min(e/Si*100,100);E({type:"UPDATE_PROGRESS",progress:n}),n>=100&&(clearInterval(m.current),m.current=null,j())}),50)):h.current&&(h.current=null,m.current&&(clearInterval(m.current),m.current=null),E({type:"UPDATE_PROGRESS",progress:0}))};n.useEffect((()=>{(async()=>{try{const e="/models",n=new Promise(((e,n)=>setTimeout((()=>n(new Error("Timeout ao carregar modelos"))),1e4)));await Promise.race([Promise.all([d.nets.tinyFaceDetector.loadFromUri(e),d.nets.faceLandmark68Net.loadFromUri(e)]),n])}catch(e){E({type:"ERROR",message:"Não foi possível carregar os modelos de IA. Verifique sua conexão e tente novamente.",retryable:!0})}})()}),[]),n.useEffect((()=>()=>{f.current&&(f.current.getTracks().forEach((e=>{e.stop()})),f.current=null),u.current&&(u.current.srcObject=null),b.current&&(clearTimeout(b.current),b.current=null),m.current&&(clearInterval(m.current),m.current=null),w.current&&(clearTimeout(w.current),w.current=null)}),[]),n.useEffect((()=>{let e=!0;return(async()=>{if("liveness"===k.status&&!f.current){y.current=!1,b.current&&(clearTimeout(b.current),b.current=null),b.current=window.setTimeout((()=>{e&&!1===y.current&&E({type:"ERROR",message:"A câmera não respondeu a tempo. Verifique se ela está disponível e tente novamente.",retryable:!0})}),2e4);try{const n=await navigator.mediaDevices.getUserMedia({video:{width:{ideal:640},height:{ideal:480},facingMode:"user"}});if(!e)return void n.getTracks().forEach((e=>e.stop()));const t=async()=>{let e=0;for(;!u.current&&e<50;)await new Promise((e=>setTimeout(e,100))),e++;return u.current},o=await t();if(!o)throw new Error("Elemento de vídeo não encontrado");o.srcObject=n,f.current=n,o.onloadedmetadata=()=>{o.play().then((()=>{e&&S(!0)}))}}catch(n){if(!e)return;b.current&&(clearTimeout(b.current),b.current=null);let t=n instanceof Error?n.message:"Erro ao acessar câmera";n instanceof DOMException&&("NotAllowedError"===n.name||"PermissionDeniedError"===n.name?t="Permissão de câmera negada. Permita o acesso à câmera nas configurações do navegador e tente novamente.":"NotFoundError"===n.name||"DevicesNotFoundError"===n.name?t="Nenhuma câmera encontrada. Conecte uma câmera e tente novamente.":"NotReadableError"===n.name&&(t="A câmera está sendo usada por outro programa. Feche-o e tente novamente.")),E({type:"ERROR",message:t,retryable:!0})}}})(),()=>{e=!1,b.current&&(clearTimeout(b.current),b.current=null),f.current&&(f.current.getTracks().forEach((e=>e.stop())),f.current=null),m.current&&(clearInterval(m.current),m.current=null),h.current=null}}),[k.status]),n.useEffect((()=>{if("liveness"!==k.status||!u.current)return;let e=!0,n=0;const t=async()=>{if(!e||"liveness"!==k.status)return;if(g.current||"complete"===v.current)return void requestAnimationFrame(t);const o=Date.now();if(o-n<Ii)requestAnimationFrame(t);else{n=o;try{const n=await d.detectSingleFace(u.current,new d.TinyFaceDetectorOptions({inputSize:224,scoreThreshold:.35})).withFaceLandmarks();if(!e)return;const o=!!n;if(R(o),o&&n.detection){const e=(e=>{if(!e||!u.current)return"not-detected";const{box:n}=e.detection,t=u.current.videoWidth||640,o=u.current.videoHeight||480,r=n.width/t;if(r<Ci)return"too-far";if(r>zi)return"too-close";const a=n.x+n.width/2,i=n.y+n.height/2,s=Math.abs(a-t/2)/t,c=Math.abs(i-o/2)/o;return s>ji||c>Ai?"not-centered":"ok"})(n);if("not-detected"!==e&&T(e),"ok"!==e)return z(!1),void requestAnimationFrame(t)}if(o&&n.landmarks){const e=(e=>{try{const n=e.positions||e._positions;if(!Array.isArray(n)||n.length<68)return null;const t=e=>{const t=n[e];return{x:void 0!==t._x?t._x:t.x,y:void 0!==t._y?t._y:t.y}},o=t(30),r=t(8),a=t(36),i=t(45),s=(a.x+i.x)/2,c=(o.x-s)/Math.abs(i.x-a.x)*90,d=(a.y+i.y)/2,l=o.y-d,u=-l/Math.abs(r.y-d)*90+_i;return{pitch:Math.round(u),yaw:Math.round(c)}}catch(n){return null}})(n.landmarks);if(e){const n=((e,n,t)=>{switch(t){case"center":return Math.abs(e)<ki&&Math.abs(n)<Ei;case"up":return e>Ri;case"down":return e<Ni;case"left":return n>Ti;case"right":return n<Oi;default:return!1}})(e.pitch,e.yaw,v.current);z(n)}}else h.current&&(h.current=null,m.current&&(clearInterval(m.current),m.current=null),E({type:"UPDATE_PROGRESS",progress:0}))}catch(r){}e&&"liveness"===k.status&&requestAnimationFrame(t)}},o=()=>{e&&u.current&&(y.current=!0,b.current&&(clearTimeout(b.current),b.current=null),t())},r=u.current;if(r&&r.readyState>=2){const n=setTimeout(o,200);return()=>{e=!1,clearTimeout(n),m.current&&(clearInterval(m.current),m.current=null),h.current=null}}const a=()=>{e&&o()};let i=0;const s=window.setInterval((()=>{i++,e?u.current&&u.current.readyState>=2?(clearInterval(s),u.current.removeEventListener("canplay",a),o()):i>=50&&clearInterval(s):clearInterval(s)}),300);return null==r||r.addEventListener("canplay",a,{once:!0}),()=>{e=!1,clearInterval(s),null==r||r.removeEventListener("canplay",a),m.current&&(clearInterval(m.current),m.current=null),h.current=null}}),[k.status]);const j=async()=>{if(!u.current||!p.current||g.current)return;g.current=!0,h.current=null;const e=x.current;if(!e)return void(g.current=!1);const n=p.current,t=u.current,o=n.getContext("2d");o?(n.width=t.videoWidth,n.height=t.videoHeight,o.scale(-1,1),o.drawImage(t,-n.width,0,n.width,n.height),n.toBlob((n=>{if(!n)return void(g.current=!1);const t=e.currentStepIndex+1,o=e.stepSequence[t];if("complete"===o){const t=[...e.capturedPhotos,n];E({type:"START_PROCESSING"}),A(t)}else setTimeout((()=>{g.current=!1,E({type:"NEXT_STEP",step:o,photo:n})}),100)}),"image/jpeg",.85)):g.current=!1},A=async n=>{var o;try{if(E({type:"START_PROCESSING"}),t&&n.length>0)try{const{identifyPersonAsync:e}=await Promise.resolve().then((()=>ei)),r=new Promise((e=>setTimeout((()=>e(null)),5e3))),a=await Promise.race([e(n[0],t,{maxRetries:3,interval:1e3}),r]);if(a&&a.personFound)return void E({type:"DUPLICATE",personName:(null==(o=a.person)?void 0:o.name)||"Pessoa identificada"})}catch(r){}if(i)return E({type:"SUCCESS"}),i(n),void(n.length=0);if(!e||!t)throw new Error("Dados de registro não fornecidos");const s=await Ma(e,n,t),c={success:s.success,message:s.message,person_id:s.person_id,user_id:s.user_id,person_validated:s.person_validated,face_processing:s.face_processing,onboarding_link:s.onboarding_link};E({type:"SUCCESS"}),a&&(a(c),n.length=0)}catch(c){const e=c instanceof Error?c.message:"Erro desconhecido";E({type:"ERROR",message:e}),s(e)}};return o.jsxs(o.Fragment,{children:[o.jsx("style",{children:"\n @keyframes fadeIn {\n from { opacity: 0; transform: scale(0.95); }\n to { opacity: 1; transform: scale(1); }\n }\n\n @keyframes slideUp {\n from { opacity: 0; transform: translateY(20px); }\n to { opacity: 1; transform: translateY(0); }\n }\n\n @keyframes slideDown {\n from { opacity: 0; transform: translateY(-10px); }\n to { opacity: 1; transform: translateY(0); }\n }\n\n @keyframes spin {\n from { transform: rotate(0deg); }\n to { transform: rotate(360deg); }\n }\n\n @keyframes pulseRing {\n 0%, 100% { \n box-shadow: 0 0 0 4px rgba(16, 185, 129, 0.8), 0 0 40px rgba(16, 185, 129, 0.4);\n }\n 50% { \n box-shadow: 0 0 0 6px rgba(16, 185, 129, 0.9), 0 0 50px rgba(16, 185, 129, 0.5);\n }\n }\n\n @keyframes checkmark {\n 0% {\n stroke-dashoffset: 100;\n }\n 100% {\n stroke-dashoffset: 0;\n }\n }\n\n @keyframes scaleIn {\n 0% {\n transform: scale(0);\n opacity: 0;\n }\n 50% {\n transform: scale(1.1);\n }\n 100% {\n transform: scale(1);\n opacity: 1;\n }\n }\n\n @keyframes scanRing {\n 0%, 100% { transform: scale(1); opacity: 0.3; }\n 50% { transform: scale(1.1); opacity: 0.6; }\n }\n\n @keyframes cornerBlink {\n 0%, 100% { opacity: 0.3; }\n 50% { opacity: 1; }\n }\n\n .modal-overlay {\n position: fixed;\n inset: 0;\n background: rgba(0, 0, 0, 0.92);\n backdrop-filter: blur(8px);\n display: flex;\n align-items: center;\n justify-content: center;\n z-index: 9999;\n padding: 20px;\n }\n\n .modal-content {\n background: linear-gradient(135deg, #0A1320 0%, #111C2B 100%);\n border-radius: 24px;\n width: 100%;\n max-width: 420px;\n max-height: 90vh;\n overflow: hidden;\n box-shadow: 0 24px 48px rgba(0, 0, 0, 0.4), 0 0 0 1px rgba(255, 255, 255, 0.1);\n animation: fadeIn 0.3s ease-out;\n position: relative;\n }\n\n .close-button {\n position: absolute;\n top: 20px;\n right: 20px;\n width: 32px;\n height: 32px;\n background: transparent;\n border: none;\n color: rgba(255, 255, 255, 0.6);\n font-size: 28px;\n font-weight: 300;\n cursor: pointer;\n display: flex;\n align-items: center;\n justify-content: center;\n transition: all 0.2s;\n z-index: 10;\n line-height: 1;\n }\n\n .close-button:hover {\n color: rgba(255, 255, 255, 0.9);\n transform: rotate(90deg);\n }\n\n /* Instructions Screen */\n .instructions-container {\n padding: 60px 40px 40px;\n color: white;\n text-align: center;\n animation: slideUp 0.4s ease-out;\n }\n\n .instructions-header {\n margin-bottom: 40px;\n }\n\n .icon-wrapper {\n display: inline-block;\n color: #0059C4;\n margin-bottom: 24px;\n }\n\n .icon-wrapper .scan-ring {\n animation: scanRing 2s ease-in-out infinite;\n }\n\n .icon-wrapper .corner {\n animation: cornerBlink 2s ease-in-out infinite;\n }\n\n .icon-wrapper .corner.tl { animation-delay: 0s; }\n .icon-wrapper .corner.tr { animation-delay: 0.5s; }\n .icon-wrapper .corner.bl { animation-delay: 1s; }\n .icon-wrapper .corner.br { animation-delay: 1.5s; }\n\n .instructions-header h2 {\n font-size: 28px;\n font-weight: 700;\n margin: 0 0 12px 0;\n background: linear-gradient(135deg, #0059C4 0%, #a78bfa 100%);\n -webkit-background-clip: text;\n -webkit-text-fill-color: transparent;\n background-clip: text;\n }\n\n .subtitle {\n font-size: 15px;\n color: rgba(255, 255, 255, 0.7);\n margin: 0;\n line-height: 1.5;\n }\n\n .requirements-list {\n text-align: left;\n margin: 0 auto 40px;\n max-width: 360px;\n }\n\n .requirement-item {\n display: flex;\n align-items: center;\n gap: 16px;\n padding: 14px 0;\n font-size: 15px;\n color: rgba(255, 255, 255, 0.9);\n border-bottom: 1px solid rgba(255, 255, 255, 0.05);\n }\n\n .requirement-item:last-child {\n border-bottom: none;\n }\n\n .req-icon {\n width: 32px;\n height: 32px;\n border-radius: 50%;\n display: flex;\n align-items: center;\n justify-content: center;\n flex-shrink: 0;\n }\n\n .req-icon.success {\n background: rgba(16, 185, 129, 0.15);\n color: #0E9F6E;\n border: 1.5px solid rgba(16, 185, 129, 0.3);\n }\n\n .primary-button {\n width: 100%;\n padding: 16px 32px;\n border-radius: 12px;\n border: none;\n background: linear-gradient(135deg, #0059C4 0%, #00449A 100%);\n color: white;\n font-size: 16px;\n font-weight: 600;\n cursor: pointer;\n transition: all 0.3s;\n box-shadow: 0 4px 16px rgba(0, 89, 196, 0.3);\n }\n\n .primary-button:hover {\n transform: translateY(-2px);\n box-shadow: 0 8px 24px rgba(0, 89, 196, 0.4);\n }\n\n .primary-button:active {\n transform: translateY(0);\n }\n\n .branding {\n display: flex;\n align-items: center;\n justify-content: center;\n gap: 8px;\n margin-top: 32px;\n padding-top: 24px;\n border-top: 1px solid rgba(255, 255, 255, 0.1);\n font-size: 13px;\n color: rgba(255, 255, 255, 0.5);\n }\n\n .brand-logo {\n height: 20px;\n width: auto;\n }\n\n .brand-name {\n font-weight: 600;\n font-family: inherit;\n color: #ffffff;\n letter-spacing: 0.3px;\n }\n\n /* Liveness Detection */\n .liveness-container {\n height: 100%;\n min-height: 520px;\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n padding: 70px 20px 80px;\n position: relative;\n animation: fadeIn 0.3s ease-out;\n }\n\n .progress-indicator {\n position: absolute;\n top: 20px;\n left: 50%;\n transform: translateX(-50%);\n background: rgba(255, 255, 255, 0.08);\n backdrop-filter: blur(12px);\n border-radius: 20px;\n padding: 8px 20px;\n border: 1px solid rgba(255, 255, 255, 0.12);\n z-index: 5;\n }\n\n .progress-text {\n font-size: 14px;\n font-weight: 600;\n color: white;\n }\n\n .video-wrapper {\n position: relative;\n margin: 20px 0;\n }\n\n .video-circle {\n width: 320px;\n height: 400px;\n border-radius: 50%;\n overflow: hidden;\n position: relative;\n /* Removida transição 'all' para evitar salto de zoom no início */\n box-shadow: 0 0 0 4px rgba(0, 89, 196, 0.3);\n background: #000;\n }\n\n .video-circle.face-detected {\n box-shadow: 0 0 0 4px rgba(16, 185, 129, 0.5), 0 0 40px rgba(16, 185, 129, 0.3);\n }\n\n .video-circle.capturing {\n box-shadow: 0 0 0 4px rgba(16, 185, 129, 0.9), 0 0 40px rgba(16, 185, 129, 0.5);\n transition: box-shadow 0.3s ease;\n }\n\n .video-feed {\n width: 100%;\n height: 100%;\n object-fit: cover;\n transform: scaleX(-1);\n opacity: 0;\n transition: opacity 0.4s ease;\n }\n\n .video-feed.ready {\n opacity: 1;\n }\n\n .face-badge {\n display: none; /* Removido por ser redundante com o oval verde */\n }\n\n .status-badge {\n position: absolute;\n top: 72px; /* Logo abaixo do progress-indicator */\n left: 50%;\n transform: translateX(-50%);\n backdrop-filter: blur(10px);\n border-radius: 20px;\n padding: 8px 16px;\n display: flex;\n align-items: center;\n gap: 8px;\n color: white;\n font-size: 13px;\n font-weight: 600;\n border: 1px solid rgba(255, 255, 255, 0.3);\n box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);\n animation: slideDown 0.3s ease-out;\n z-index: 10;\n white-space: nowrap;\n }\n\n .status-badge.info {\n background: rgba(255, 255, 255, 0.15);\n color: white;\n border-color: rgba(255, 255, 255, 0.1);\n }\n\n .status-badge.warning {\n background: rgba(251, 191, 36, 0.95);\n color: #78350f;\n border-color: rgba(0, 0, 0, 0.1);\n box-shadow: 0 4px 15px rgba(251, 191, 36, 0.2);\n }\n\n .status-badge.error {\n background: rgba(239, 68, 68, 0.95);\n color: white;\n border-color: rgba(255, 255, 255, 0.2);\n box-shadow: 0 4px 15px rgba(239, 68, 68, 0.2);\n }\n\n .instruction-box {\n background: rgba(255, 255, 255, 0.08);\n backdrop-filter: blur(12px);\n border-radius: 16px;\n padding: 16px 24px;\n margin-top: 20px;\n border: 1px solid rgba(255, 255, 255, 0.12);\n max-width: 320px;\n animation: slideUp 0.3s ease-out;\n }\n\n .instruction-text {\n font-size: 18px;\n font-weight: 600;\n color: white;\n margin: 0 0 12px 0;\n text-align: center;\n }\n\n .progress-bar {\n height: 4px;\n background: rgba(255, 255, 255, 0.2);\n border-radius: 2px;\n overflow: hidden;\n }\n\n .progress-fill {\n height: 100%;\n background: linear-gradient(90deg, #0059C4 0%, #0E9F6E 100%);\n border-radius: 2px;\n transition: width 0.05s linear;\n }\n\n /* NEO-410 · US14.3 — botão \"Não consigo fazer esse movimento\" */\n .cannot-gesture-button {\n margin-top: 16px;\n min-height: 44px;\n min-width: 44px;\n padding: 10px 20px;\n background: transparent;\n border: 1px solid rgba(255, 255, 255, 0.28);\n border-radius: 22px;\n color: rgba(255, 255, 255, 0.85);\n font-size: 14px;\n font-weight: 500;\n font-family: inherit;\n cursor: pointer;\n transition: background 120ms ease-out, border-color 120ms ease-out;\n }\n .cannot-gesture-button:hover {\n background: rgba(255, 255, 255, 0.08);\n border-color: rgba(255, 255, 255, 0.42);\n }\n .cannot-gesture-button:focus-visible {\n outline: 2px solid #0059C4;\n outline-offset: 2px;\n }\n\n .branding-small {\n position: absolute;\n bottom: 24px;\n left: 50%;\n transform: translateX(-50%);\n display: flex;\n align-items: center;\n justify-content: center;\n gap: 5px;\n font-size: 12px;\n color: rgba(255, 255, 255, 0.5);\n }\n\n .brand-logo-small {\n height: 18px;\n width: 18px;\n }\n\n /* Processing */\n .processing-container {\n padding: 80px 40px;\n text-align: center;\n color: white;\n animation: fadeIn 0.3s ease-out;\n }\n\n .spinner-wrapper {\n position: relative;\n width: 80px;\n height: 80px;\n margin: 0 auto 32px;\n }\n\n .spinner {\n position: absolute;\n inset: 0;\n border: 4px solid rgba(0, 89, 196, 0.2);\n border-top-color: #0059C4;\n border-radius: 50%;\n animation: spin 1s linear infinite;\n }\n\n .spinner-ring {\n position: absolute;\n inset: -10px;\n border: 2px solid rgba(0, 89, 196, 0.1);\n border-radius: 50%;\n animation: pulseSpinner 2s ease-in-out infinite;\n }\n\n @keyframes pulseSpinner {\n 0%, 100% { transform: scale(1); opacity: 1; }\n 50% { transform: scale(1.1); opacity: 0.5; }\n }\n\n .processing-container h3 {\n font-size: 24px;\n font-weight: 700;\n margin: 0 0 12px 0;\n }\n\n .processing-container p {\n font-size: 15px;\n color: rgba(255, 255, 255, 0.7);\n margin: 0;\n }\n\n /* Result Screens */\n .result-container {\n padding: 80px 40px 40px;\n text-align: center;\n color: white;\n animation: slideUp 0.4s ease-out;\n }\n\n .result-icon {\n display: inline-flex;\n margin-bottom: 24px;\n }\n\n .success-icon {\n color: #0E9F6E;\n animation: scaleIn 0.6s ease-out;\n }\n\n .success-icon svg circle {\n animation: scaleIn 0.5s ease-out;\n }\n\n .success-icon svg path {\n stroke-dasharray: 100;\n stroke-dashoffset: 100;\n animation: checkmark 0.6s ease-out 0.3s forwards;\n }\n\n .error-icon {\n color: #ef4444;\n animation: fadeIn 0.5s ease-out;\n }\n\n .result-container h3 {\n font-size: 26px;\n font-weight: 700;\n margin: 0 0 12px 0;\n }\n\n .result-container p {\n font-size: 15px;\n color: rgba(255, 255, 255, 0.7);\n margin: 0 0 32px 0;\n line-height: 1.5;\n }\n\n .button-group {\n display: flex;\n gap: 12px;\n margin-top: 32px;\n }\n\n .secondary-button {\n flex: 1;\n padding: 14px 24px;\n border-radius: 12px;\n border: 1px solid rgba(255, 255, 255, 0.2);\n background: rgba(255, 255, 255, 0.1);\n color: white;\n font-size: 15px;\n font-weight: 600;\n cursor: pointer;\n transition: all 0.2s;\n }\n\n .secondary-button:hover {\n background: rgba(255, 255, 255, 0.15);\n border-color: rgba(255, 255, 255, 0.3);\n }\n\n .ghost-button {\n flex: 1;\n padding: 14px 24px;\n border-radius: 12px;\n border: none;\n background: transparent;\n color: rgba(255, 255, 255, 0.7);\n font-size: 15px;\n font-weight: 600;\n cursor: pointer;\n transition: all 0.2s;\n }\n\n .ghost-button:hover {\n color: white;\n background: rgba(255, 255, 255, 0.05);\n }\n\n /* Duplicate Screen Styles */\n .profile-icon-wrapper {\n position: relative;\n display: inline-block;\n margin-bottom: 24px;\n }\n\n .profile-main-icon {\n background: rgba(0, 89, 196, 0.1);\n color: #0059C4;\n padding: 20px;\n border-radius: 50%;\n border: 2px solid rgba(0, 89, 196, 0.2);\n box-shadow: 0 0 30px rgba(0, 89, 196, 0.2);\n }\n\n .profile-main-icon svg {\n width: 48px;\n height: 48px;\n }\n\n .verified-badge {\n position: absolute;\n bottom: -4px;\n right: -4px;\n background: #0E9F6E;\n border-radius: 50%;\n padding: 4px;\n border: 3px solid #111C2B;\n width: 24px;\n height: 24px;\n display: flex;\n align-items: center;\n justify-content: center;\n }\n\n .button-group-vertical {\n display: flex;\n flex-direction: column;\n width: 100%;\n gap: 8px;\n }\n\n .support-section {\n margin-top: 24px;\n padding-top: 16px;\n border-top: 1px solid rgba(255, 255, 255, 0.05);\n }\n\n .support-section p {\n font-size: 13px;\n color: rgba(255, 255, 255, 0.4);\n margin-bottom: 8px;\n }\n\n /* Canvas */\n canvas {\n display: none;\n }\n\n /* Responsive */\n @media (max-width: 640px) {\n .modal-content {\n max-width: 100%;\n border-radius: 0;\n max-height: 100vh;\n }\n\n .instructions-container {\n padding: 50px 24px 24px;\n }\n\n .instructions-header h2 {\n font-size: 24px;\n }\n\n .video-circle {\n width: 280px;\n height: 350px;\n }\n\n .liveness-container {\n min-height: 100vh;\n }\n }\n "}),o.jsx(oi,{active:C}),o.jsx("div",{className:"neofaceid-root modal-overlay",children:o.jsxs("div",{className:"modal-content",children:[o.jsx("button",{type:"button",className:"close-button",onClick:r,children:"×"}),"liveness"===k.status&&(()=>{if("liveness"!==k.status)return null;const e=`${k.currentStepIndex+1}/${k.stepSequence.length-1}`,{stepProgress:n}=k;return o.jsxs("div",{className:"liveness-container",children:[o.jsx("div",{className:"progress-indicator",children:o.jsx("span",{className:"progress-text",children:e})}),_&&"ok"!==N&&o.jsxs("div",{className:"status-badge "+("not-centered"===N?"warning":"error"),children:["too-far"===N&&"Aproxime-se mais","too-close"===N&&"Afaste-se um pouco","not-centered"===N&&"Centralize seu rosto"]}),o.jsx("div",{className:"video-wrapper",children:o.jsx("div",{className:`video-circle ${_&&"ok"===N?"face-detected":""} ${n>0?"capturing":""}`,children:o.jsx("video",{ref:u,className:"video-feed "+(O?"ready":""),autoPlay:!0,muted:!0,playsInline:!0})})}),o.jsxs("div",{className:"instruction-box",children:[o.jsx("p",{className:"instruction-text","aria-live":"assertive",children:yi[k.step]}),n>0&&o.jsx("div",{className:"progress-bar",children:o.jsx("div",{className:"progress-fill",style:{width:`${n}%`}})})]}),o.jsx("button",{type:"button",className:"cannot-gesture-button",onClick:()=>{c?c():r()},"aria-label":"Não consigo fazer esse movimento — buscar alternativa",children:"Não consigo fazer esse movimento"}),o.jsx("div",{className:"branding-small",children:o.jsx(gi,{})})]})})(),"camera-loading"===k.status&&o.jsxs("div",{className:"processing-container",children:[o.jsxs("div",{className:"spinner-wrapper",children:[o.jsx("div",{className:"spinner"}),o.jsx("div",{className:"spinner-ring"})]}),o.jsx("h3",{children:"Inicializando câmera"}),o.jsx("p",{children:"Aguarde enquanto preparamos a câmera..."}),o.jsx("div",{className:"branding",style:{marginTop:"40px",paddingTop:"24px",borderTop:"1px solid rgba(255, 255, 255, 0.1)"},children:o.jsx(gi,{})})]}),"processing"===k.status&&o.jsxs("div",{className:"processing-container",children:[o.jsxs("div",{className:"spinner-wrapper",children:[o.jsx("div",{className:"spinner"}),o.jsx("div",{className:"spinner-ring"})]}),o.jsx("h3",{children:"Processando biometria"}),o.jsx("p",{children:"Analisando suas capturas faciais..."}),o.jsx("div",{className:"branding",style:{marginTop:"40px",paddingTop:"24px",borderTop:"1px solid rgba(255, 255, 255, 0.1)"},children:o.jsx(gi,{})})]}),"error"===k.status&&("error"!==k.status?null:o.jsxs("div",{className:"result-container error",children:[o.jsx("div",{className:"result-icon error-icon",children:o.jsxs("svg",{width:"60",height:"60",viewBox:"0 0 60 60",fill:"none",children:[o.jsx("circle",{cx:"30",cy:"30",r:"28",stroke:"currentColor",strokeWidth:"3"}),o.jsx("path",{d:"M20 20 L40 40 M40 20 L20 40",stroke:"currentColor",strokeWidth:"3",strokeLinecap:"round"})]})}),o.jsx("h3",{children:"Não foi possível processar"}),o.jsx("p",{children:k.message}),o.jsxs("div",{className:"button-group",children:[k.retryable&&o.jsx("button",{type:"button",className:"secondary-button",onClick:()=>E({type:"RESET"}),children:"Tentar Novamente"}),o.jsx("button",{type:"button",className:"ghost-button",onClick:r,children:"Cancelar"})]})]})),"success"===k.status&&o.jsxs("div",{className:"result-container success",children:[o.jsx("div",{className:"result-icon success-icon",children:o.jsxs("svg",{width:"60",height:"60",viewBox:"0 0 60 60",fill:"none",children:[o.jsx("circle",{cx:"30",cy:"30",r:"28",stroke:"currentColor",strokeWidth:"3"}),o.jsx("path",{d:"M15 30 L25 40 L45 20",stroke:"currentColor",strokeWidth:"3",strokeLinecap:"round",strokeLinejoin:"round"})]})}),o.jsx("h3",{children:i?"Captura concluída!":"Verificação concluída!"}),o.jsx("p",{children:i?"Suas capturas faciais foram realizadas":"Sua biometria foi registrada com sucesso"}),o.jsx("button",{type:"button",className:"primary-button",onClick:r,children:"Continuar"})]}),"duplicate"===k.status&&(()=>{if("duplicate"!==k.status)return null;const e=k.personName&&"Pessoa identificada"!==k.personName?`Olá, ${k.personName.split(" ")[0]}!`:"Olá!";return o.jsxs("div",{className:"result-container duplicate scale-in",children:[o.jsx("h3",{style:{marginTop:"0px"},children:e}),o.jsx("p",{style:{marginBottom:"32px",fontSize:"15px"},children:"Identificamos seu cadastro biométrico em nossa rede. Você já faz parte da NeoFaceId!"}),o.jsxs("div",{className:"button-group-vertical",children:[o.jsx("button",{type:"button",className:"primary-button",onClick:()=>{r(),window.location.href="/"},children:"Ir para o Login"}),o.jsx("button",{type:"button",className:"secondary-button",style:{marginTop:"12px"},onClick:()=>{r(),new bi(t??"").open()},children:"Esqueci minha senha"}),o.jsxs("div",{className:"support-section",children:[o.jsx("p",{children:"Não reconhece esta conta?"}),o.jsx("button",{type:"button",className:"ghost-button",onClick:()=>window.open("https://support.neofaceid.com","_blank"),children:"Falar com Suporte"})]})]}),o.jsx("div",{className:"branding",style:{marginTop:"32px",paddingTop:"20px",borderTop:"1px solid rgba(255, 255, 255, 0.08)",width:"100%"},children:o.jsx(gi,{})})]})})()]})}),o.jsx("canvas",{ref:p})]})}const Pi="1.40.1",Di="neoface_consent_trail_v1";function Li(){try{if("undefined"==typeof window||!window.localStorage)return[];const e=window.localStorage.getItem(Di);if(!e)return[];const n=JSON.parse(e);return Array.isArray(n)?n:[]}catch{return[]}}async function Mi(e){try{const n=xa(),t=(null==e?void 0:e.purpose)??n.purpose??"authentication",o=(null==e?void 0:e.legalBasis)??n.legalBasis??"fraud_prevention",r=(new Date).toISOString(),a="undefined"!=typeof navigator?navigator.userAgent:"",i=Pi,s={hash:await async function(e){try{if("undefined"!=typeof crypto&&crypto.subtle&&"function"==typeof crypto.subtle.digest){const n=new TextEncoder,t=await crypto.subtle.digest("SHA-256",n.encode(e));return Array.from(new Uint8Array(t)).map((e=>e.toString(16).padStart(2,"0"))).join("")}}catch{}return"sha256-unavailable"}(`${a}${t}${r}`),timestamp:r,purpose:t,legalBasis:o,sdkVersion:i},c=Li();c.push(s);const d=c.slice(-100);return"undefined"!=typeof window&&window.localStorage&&window.localStorage.setItem(Di,JSON.stringify(d)),s}catch{return null}}const qi="https://neofaceid.com/privacidade",Ui={verification:{title:"Vamos confirmar que é você",duration:"Leva cerca de 20 segundos e usa a câmera do seu dispositivo.",bullet1Title:"Sua câmera liga agora",bullet1Body:"Você vê a imagem o tempo todo e pode encerrar quando quiser.",bullet2Title:"Pediremos dois movimentos simples",bullet2Body:"Virar o rosto ou piscar — é assim que sabemos que há alguém ali.",bullet3Title:"A imagem não fica guardada",bullet3Body:"Ela é usada para a verificação e descartada em seguida.",primary:"Começar verificação"},registration:{title:"Vamos cadastrar seu rosto",duration:"Leva cerca de 20 segundos e usa a câmera do seu dispositivo.",bullet1Title:"Sua câmera liga agora",bullet1Body:"Você vê a imagem o tempo todo e pode encerrar quando quiser.",bullet2Title:"Pediremos dois movimentos simples",bullet2Body:"Virar o rosto ou piscar — é assim que sabemos que há alguém ali.",bullet3Title:"Guardamos um vetor matemático do seu rosto",bullet3Body:"Não a foto. A imagem é descartada.",primary:"Começar cadastro"}},Bi=()=>o.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[o.jsx("path",{d:"M14.5 4h-5L7 7H4a2 2 0 0 0-2 2v9a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V9a2 2 0 0 0-2-2h-3l-2.5-3Z"}),o.jsx("circle",{cx:"12",cy:"13",r:"4"})]}),Wi=()=>o.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[o.jsx("circle",{cx:"12",cy:"12",r:"9"}),o.jsx("path",{d:"M4 12h16"}),o.jsx("path",{d:"M15 8l4 4-4 4"})]}),Vi=()=>o.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[o.jsx("path",{d:"M12 2 4 5v7c0 5 3.5 8.5 8 10 4.5-1.5 8-5 8-10V5l-8-3Z"}),o.jsx("path",{d:"m9 12 2 2 4-4"})]});function Zi({appName:e,flow:n,privacyPolicyUrl:t=qi,retentionDays:r=90,onAccept:a,onDecline:i}){const s=Ui[n];return o.jsxs(o.Fragment,{children:[o.jsx("style",{children:"\n @keyframes neofaceidConsentFadeIn { from { opacity: 0 } to { opacity: 1 } }\n @keyframes neofaceidConsentSlideUp {\n from { opacity: 0; transform: translateY(12px) }\n to { opacity: 1; transform: translateY(0) }\n }\n .neofaceid-consent-overlay {\n position: fixed; inset: 0;\n background: var(--nfid-overlay);\n backdrop-filter: blur(3px);\n -webkit-backdrop-filter: blur(3px);\n display: flex; align-items: center; justify-content: center;\n z-index: 10001; padding: 20px;\n animation: neofaceidConsentFadeIn 200ms ease-out;\n font-family: inherit;\n color: var(--nfid-text);\n }\n .neofaceid-consent-modal {\n background: var(--nfid-surface);\n border-radius: var(--nfid-radius, 16px);\n padding: 28px;\n max-width: 440px;\n width: 100%;\n box-shadow: 0 1px 3px rgba(10, 19, 32, 0.08);\n animation: neofaceidConsentSlideUp 320ms cubic-bezier(.2,0,0,1);\n box-sizing: border-box;\n }\n .neofaceid-consent-header {\n display: flex;\n align-items: baseline;\n gap: 10px;\n margin-bottom: 20px;\n }\n .neofaceid-consent-appname {\n font-size: 17px;\n font-weight: 700;\n color: var(--nfid-text);\n line-height: 1.2;\n }\n .neofaceid-consent-brand-caption {\n font-size: 11px;\n font-weight: 700;\n letter-spacing: 0.09em;\n text-transform: uppercase;\n color: var(--nfid-text-subtle);\n }\n .neofaceid-consent-title {\n font-size: 22px;\n font-weight: 700;\n color: var(--nfid-text);\n margin: 0 0 8px;\n line-height: 1.25;\n letter-spacing: -0.015em;\n }\n .neofaceid-consent-duration {\n font-size: 14px;\n color: var(--nfid-text-muted);\n margin: 0 0 20px;\n line-height: 1.5;\n }\n .neofaceid-consent-bullets {\n display: flex;\n flex-direction: column;\n gap: 14px;\n margin-bottom: 20px;\n }\n .neofaceid-consent-bullet {\n display: flex;\n gap: 12px;\n align-items: flex-start;\n }\n .neofaceid-consent-bullet-icon {\n flex-shrink: 0;\n color: var(--nfid-action);\n margin-top: 2px;\n }\n .neofaceid-consent-bullet-title {\n font-size: 14px;\n font-weight: 600;\n color: var(--nfid-text);\n margin: 0 0 2px;\n line-height: 1.35;\n }\n .neofaceid-consent-bullet-body {\n font-size: 13px;\n color: var(--nfid-text-muted);\n margin: 0;\n line-height: 1.45;\n }\n .neofaceid-consent-link {\n display: inline-block;\n font-size: 13px;\n color: var(--nfid-action);\n text-decoration: underline;\n margin-bottom: 20px;\n }\n .neofaceid-consent-link:hover { opacity: 0.85; }\n .neofaceid-consent-actions {\n display: flex;\n flex-direction: column;\n gap: 10px;\n }\n .neofaceid-consent-button {\n min-height: 44px;\n padding: 12px 20px;\n border-radius: var(--nfid-radius, 16px);\n border: none;\n font-size: 15px;\n font-weight: 600;\n cursor: pointer;\n transition: background 120ms ease-out, transform 120ms ease-out;\n font-family: inherit;\n }\n .neofaceid-consent-button-primary {\n background: var(--nfid-action);\n color: var(--nfid-action-text);\n }\n .neofaceid-consent-button-primary:hover { opacity: 0.92; }\n .neofaceid-consent-button-primary:focus-visible {\n outline: 2px solid var(--nfid-focus-ring);\n outline-offset: 2px;\n }\n .neofaceid-consent-button-ghost {\n background: transparent;\n color: var(--nfid-text-muted);\n }\n .neofaceid-consent-button-ghost:hover { background: var(--nfid-surface-muted); }\n .neofaceid-consent-footer {\n display: flex;\n justify-content: center;\n margin-top: 20px;\n padding-top: 16px;\n border-top: 1px solid var(--nfid-line);\n }\n .neofaceid-consent-seal {\n font-size: 10px;\n font-weight: 500;\n letter-spacing: 0.06em;\n text-transform: uppercase;\n color: var(--nfid-text-subtle);\n }\n @media (max-width: 640px) {\n .neofaceid-consent-modal { padding: 22px; border-radius: 16px; }\n .neofaceid-consent-title { font-size: 20px; }\n }\n @media (prefers-reduced-motion: reduce) {\n .neofaceid-consent-overlay,\n .neofaceid-consent-modal { animation: none; }\n }\n "}),o.jsx("div",{className:"neofaceid-root neofaceid-consent-overlay",role:"dialog","aria-modal":"true","aria-labelledby":"neofaceid-consent-title",children:o.jsxs("div",{className:"neofaceid-consent-modal",children:[o.jsxs("div",{className:"neofaceid-consent-header",children:[o.jsx("span",{className:"neofaceid-consent-appname",children:e}),o.jsx("span",{className:"neofaceid-consent-brand-caption",children:"NeoFaceID"})]}),o.jsx("h1",{id:"neofaceid-consent-title",className:"neofaceid-consent-title",children:s.title}),o.jsx("p",{className:"neofaceid-consent-duration",children:s.duration}),o.jsxs("div",{className:"neofaceid-consent-bullets",children:[o.jsxs("div",{className:"neofaceid-consent-bullet",children:[o.jsx("div",{className:"neofaceid-consent-bullet-icon",children:o.jsx(Bi,{})}),o.jsxs("div",{children:[o.jsx("p",{className:"neofaceid-consent-bullet-title",children:s.bullet1Title}),o.jsx("p",{className:"neofaceid-consent-bullet-body",children:s.bullet1Body})]})]}),o.jsxs("div",{className:"neofaceid-consent-bullet",children:[o.jsx("div",{className:"neofaceid-consent-bullet-icon",children:o.jsx(Wi,{})}),o.jsxs("div",{children:[o.jsx("p",{className:"neofaceid-consent-bullet-title",children:s.bullet2Title}),o.jsx("p",{className:"neofaceid-consent-bullet-body",children:s.bullet2Body})]})]}),o.jsxs("div",{className:"neofaceid-consent-bullet",children:[o.jsx("div",{className:"neofaceid-consent-bullet-icon",children:o.jsx(Vi,{})}),o.jsxs("div",{children:[o.jsx("p",{className:"neofaceid-consent-bullet-title",children:s.bullet3Title}),o.jsx("p",{className:"neofaceid-consent-bullet-body",children:s.bullet3Body})]})]})]}),o.jsxs("a",{href:t,target:"_blank",rel:"noopener noreferrer",className:"neofaceid-consent-link",children:["Ver política de privacidade (retenção de até ",r," dias)"]}),o.jsxs("div",{className:"neofaceid-consent-actions",children:[o.jsx("button",{type:"button",className:"neofaceid-consent-button neofaceid-consent-button-primary",onClick:()=>{Mi().catch((()=>{})),a()},children:s.primary}),o.jsx("button",{type:"button",className:"neofaceid-consent-button neofaceid-consent-button-ghost",onClick:i,children:"Agora não"})]}),o.jsx("div",{className:"neofaceid-consent-footer",children:o.jsx(gi,{})})]})})]})}class Ki{constructor(){i(this,"container",null),i(this,"root",null)}show(e){this.container||(la(),this.container=document.createElement("div"),this.container.id="neofaceid-consent-modal-container",document.body.appendChild(this.container),this.root=t.createRoot(this.container),this.root.render(o.jsx(Zi,{...e,onAccept:()=>{this.close(),e.onAccept()},onDecline:()=>{this.close(),e.onDecline()}})))}close(){this.container&&document.body.contains(this.container)&&(this.root&&this.root.unmount(),document.body.removeChild(this.container),this.container=null,this.root=null)}}function Ji(e={}){const n=wa(),t=e.appName??n??"sua aplicação";e.appName;const o=e.flow??"verification";return new Promise((n=>{(new Ki).show({appName:t,flow:o,privacyPolicyUrl:e.privacyPolicyUrl??qi,retentionDays:e.retentionDays??90,onAccept:()=>n(!0),onDecline:()=>n(!1)})}))}const Gi={flow:"verification",privacyPolicyUrl:qi,retentionDays:90};function Hi(e,n={}){const t=n.darkThreshold??.235,o=n.improvementTarget??.12,r=n.sampleIntervalMs??600,a=n.minToggleMs??3e3,i=n.zIndex??10001,s=`nfid-flash-${Math.random().toString(36).slice(2,9)}`;let c=null,d=null,l=!1,u=0,p=0,f=0,h=null,m=null,g=null;const v=e=>{l!==e&&(l=e,e?m||"undefined"==typeof document||(m=document.createElement("div"),m.id=s,m.setAttribute("aria-hidden","true"),m.style.cssText=`\n position: fixed; inset: 0; background: #FFFFFF;\n z-index: ${i}; pointer-events: none;\n opacity: 0; transition: opacity 200ms ease-out;\n `,document.body.appendChild(m),requestAnimationFrame((()=>{m&&(m.style.opacity="1")}))):(()=>{if(!m)return;const e=m;m=null,e.style.opacity="0",setTimeout((()=>{e.parentNode&&e.parentNode.removeChild(e)}),220)})(),n.onChange&&n.onChange(e,u))},b=()=>{"undefined"==typeof document||g||(g=document.createElement("canvas"));const n=ni(e(),{scratch:g??void 0});u=n;const r=Date.now();l||(n>0&&n<t?p+=1:p=0,p>=2&&r-f>=a&&(h=n,f=r,p=0,v(!0),d=setTimeout((()=>{ni(e(),{scratch:g??void 0})-(h??0)<o&&(f=Date.now(),v(!1)),h=null}),600)))};return{start(){!1!==n.enabled&&(c||(b(),c=setInterval(b,r)))},stop(){c&&(clearInterval(c),c=null),d&&(clearTimeout(d),d=null),v(!1),p=0,h=null},destroy(){this.stop(),g=null},get flashOn(){return l},get lastBrightness(){return u}}}class Xi{constructor(e){i(this,"modal",null),i(this,"video",null),i(this,"canvas",null),i(this,"stream",null),i(this,"options"),i(this,"countdownInterval",null),i(this,"isCapturing",!1),i(this,"flashController",null),this.options=e}async open(){try{await this.createModal(),await this.initializeCamera(),this.enableCaptureButton(),!1!==this.options.autoLighting&&(this.flashController=Hi((()=>this.video)),this.flashController.start())}catch(e){this.options.onError(new h(`Erro ao inicializar câmera: ${e.message}`,f.CAMERA_ERROR))}}close(){this.cleanup(),this.modal&&(document.body.removeChild(this.modal),this.modal=null)}async createModal(){this.modal=document.createElement("div"),this.modal.className="neofaceid-root neofaceid-biometric-modal";const e=this.options.title||this.getDefaultTitle(),n=this.options.subtitle||this.getDefaultSubtitle();this.modal.innerHTML=`\n <div class="neofaceid-modal-overlay">\n <div class="neofaceid-modal-content">\n <div class="neofaceid-modal-header">\n <h2>${e}</h2>\n <button class="neofaceid-close-btn" type="button" aria-label="Fechar">×</button>\n </div>\n <div class="neofaceid-modal-body">\n <p class="neofaceid-subtitle">${n}</p>\n <div class="neofaceid-camera-container">\n <video class="neofaceid-video" autoplay muted playsinline></video>\n <canvas class="neofaceid-canvas" style="display: none;"></canvas>\n <div class="neofaceid-overlay">\n <div class="neofaceid-frame"></div>\n </div>\n </div>\n <div class="neofaceid-status">\n <p class="neofaceid-status-text">Posicione-se na frente da câmera</p>\n </div>\n </div>\n <div class="neofaceid-modal-footer">\n <button class="neofaceid-cancel-btn" type="button">Cancelar</button>\n <button class="neofaceid-capture-btn" type="button" disabled>Capturar</button>\n </div>\n <div class="neofaceid-seal-row">\n ${vi()}\n </div>\n </div>\n </div>\n `,la(),this.addStyles(),this.addEventListeners(),document.body.appendChild(this.modal)}async initializeCamera(){if(!this.modal)throw new Error("Modal não inicializado");if(this.video=this.modal.querySelector(".neofaceid-video"),this.canvas=this.modal.querySelector(".neofaceid-canvas"),!this.video||!this.canvas)throw new Error("Elementos de vídeo ou canvas não encontrados");try{this.stream=await navigator.mediaDevices.getUserMedia({video:{width:{ideal:640},height:{ideal:480},facingMode:"user"},audio:!1}),this.video.srcObject=this.stream,await this.video.play(),this.canvas.width=this.video.videoWidth,this.canvas.height=this.video.videoHeight}catch(e){throw new Error(`Não foi possível acessar a câmera: ${e.message}`)}}enableCaptureButton(){if(!this.modal)return;const e=this.modal.querySelector(".neofaceid-capture-btn"),n=this.modal.querySelector(".neofaceid-status-text");e&&(e.disabled=!1,e.textContent="Capturar"),n&&(n.textContent="Pronto para capturar"),"auto"===this.options.mode&&setTimeout((()=>this.captureImage()),300)}async captureImage(){if(!this.isCapturing&&this.video&&this.canvas){this.isCapturing=!0;try{const e=this.canvas.getContext("2d");if(!e)throw new Error("Não foi possível obter contexto do canvas");e.drawImage(this.video,0,0,this.canvas.width,this.canvas.height);const n=this.canvas.toDataURL("image/jpeg",.8).split(",")[1],t=`data:image/jpeg;base64,${n}`,o="auto"===this.options.mode?await this.detectBiometricType(n):this.options.mode;this.close(),this.options.onSuccess(t,o)}catch(e){this.options.onError(new h(`Erro ao capturar imagem: ${e.message}`,f.CAPTURE_ERROR))}finally{this.isCapturing=!1}}}async detectBiometricType(e){try{const{detectBiometricType:n}=await Promise.resolve().then((()=>hs)),t=await n(e);return"unknown"!==t.type&&t.confidence>.6?t.type:"face"}catch(n){return"face"}}addEventListeners(){if(!this.modal)return;const e=this.modal.querySelector(".neofaceid-close-btn"),n=this.modal.querySelector(".neofaceid-cancel-btn"),t=this.modal.querySelector(".neofaceid-capture-btn");null==e||e.addEventListener("click",(()=>{var e,n;this.close(),null==(n=(e=this.options).onCancel)||n.call(e)})),null==n||n.addEventListener("click",(()=>{var e,n;this.close(),null==(n=(e=this.options).onCancel)||n.call(e)})),null==t||t.addEventListener("click",(()=>{this.captureImage()})),this.modal.addEventListener("click",(e=>{var n,t,o;e.target===(null==(n=this.modal)?void 0:n.querySelector(".neofaceid-modal-overlay"))&&(this.close(),null==(o=(t=this.options).onCancel)||o.call(t))}))}cleanup(){this.flashController&&(this.flashController.destroy(),this.flashController=null),this.stream&&(this.stream.getTracks().forEach((e=>e.stop())),this.stream=null),this.countdownInterval&&(clearInterval(this.countdownInterval),this.countdownInterval=null),this.video=null,this.canvas=null,this.isCapturing=!1}getDefaultTitle(){switch(this.options.mode){case"face":return"Autenticação Facial";case"hand":return"Autenticação por Mão";case"auto":return"Autenticação Biométrica";default:return"Captura Biométrica"}}getDefaultSubtitle(){switch(this.options.mode){case"face":return"Posicione seu rosto dentro do quadro e aguarde a captura automática.";case"hand":return"Posicione sua mão dentro do quadro e aguarde a captura automática.";case"auto":return"Posicione seu rosto ou mão dentro do quadro para autenticação automática.";default:return"Posicione-se dentro do quadro para captura."}}addStyles(){const e="neofaceid-biometric-modal-styles",n=document.getElementById(e);n&&n.remove(),ua(e,"\n .neofaceid-biometric-modal {\n position: fixed;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n z-index: 10000;\n font-family: inherit;\n }\n\n .neofaceid-modal-overlay {\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n background: rgba(0, 0, 0, 0.8);\n display: flex;\n align-items: center;\n justify-content: center;\n padding: 20px;\n box-sizing: border-box;\n }\n\n .neofaceid-modal-content {\n background: white;\n border-radius: 12px;\n max-width: 600px;\n width: 100%;\n max-height: 90vh;\n overflow: hidden;\n box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);\n }\n\n .neofaceid-modal-header {\n padding: 20px;\n border-bottom: 1px solid #e0e0e0;\n display: flex;\n justify-content: space-between;\n align-items: center;\n }\n\n .neofaceid-modal-header h2 {\n margin: 0;\n font-size: 24px;\n font-weight: 600;\n color: #333;\n }\n\n .neofaceid-close-btn {\n background: none;\n border: none;\n font-size: 22px;\n cursor: pointer;\n color: #666;\n padding: 0;\n min-width: 44px;\n min-height: 44px;\n display: flex;\n align-items: center;\n justify-content: center;\n border-radius: 22px;\n transition: background-color 0.2s;\n }\n .neofaceid-close-btn:focus-visible {\n outline: 2px solid var(--nfid-focus-ring);\n outline-offset: 2px;\n }\n\n .neofaceid-close-btn:hover {\n background-color: #f0f0f0;\n }\n\n .neofaceid-modal-body {\n padding: 20px;\n }\n\n .neofaceid-subtitle {\n margin: 0 0 20px 0;\n color: #666;\n font-size: 16px;\n line-height: 1.4;\n }\n\n .neofaceid-camera-container {\n position: relative;\n background: #000;\n border-radius: 8px;\n overflow: hidden;\n aspect-ratio: 4/3;\n margin-bottom: 20px;\n }\n\n .neofaceid-video {\n width: 100%;\n height: 100%;\n object-fit: cover;\n }\n\n .neofaceid-canvas {\n position: absolute;\n top: 0;\n left: 0;\n }\n\n .neofaceid-overlay {\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n display: flex;\n align-items: center;\n justify-content: center;\n }\n\n .neofaceid-frame {\n width: 200px;\n height: 200px;\n border: 3px solid #0E9F6E;\n border-radius: 50%;\n box-shadow: 0 0 0 2px rgba(76, 175, 80, 0.3);\n animation: pulse 2s infinite;\n }\n\n .neofaceid-seal-row {\n display: flex;\n justify-content: center;\n padding: 12px 20px 16px;\n border-top: 1px solid var(--nfid-line, #E6ECF4);\n }\n .neofaceid-seal {\n font-size: 10px;\n font-weight: 500;\n letter-spacing: 0.06em;\n text-transform: uppercase;\n color: var(--nfid-text-subtle, #617489);\n }\n\n .neofaceid-status {\n text-align: center;\n margin-bottom: 20px;\n }\n\n .neofaceid-status-text {\n margin: 0;\n color: #666;\n font-size: 16px;\n }\n\n .neofaceid-modal-footer {\n padding: 20px;\n border-top: 1px solid #e0e0e0;\n display: flex;\n gap: 12px;\n justify-content: flex-end;\n }\n\n .neofaceid-cancel-btn,\n .neofaceid-capture-btn {\n padding: 12px 24px;\n border: none;\n border-radius: 6px;\n font-size: 16px;\n font-weight: 500;\n cursor: pointer;\n transition: all 0.2s;\n }\n\n .neofaceid-cancel-btn {\n background: #f5f5f5;\n color: #666;\n }\n\n .neofaceid-cancel-btn:hover {\n background: #e0e0e0;\n }\n\n .neofaceid-capture-btn {\n background: #0E9F6E;\n color: white;\n }\n\n .neofaceid-capture-btn:hover:not(:disabled) {\n background: #45a049;\n }\n\n .neofaceid-capture-btn:disabled {\n background: #ccc;\n cursor: not-allowed;\n }\n\n @keyframes pulse {\n 0% { box-shadow: 0 0 0 2px rgba(76, 175, 80, 0.3); }\n 50% { box-shadow: 0 0 0 10px rgba(76, 175, 80, 0.1); }\n 100% { box-shadow: 0 0 0 2px rgba(76, 175, 80, 0.3); }\n }\n\n @media (max-width: 640px) {\n .neofaceid-modal-overlay {\n padding: 10px;\n }\n \n .neofaceid-modal-header,\n .neofaceid-modal-body,\n .neofaceid-modal-footer {\n padding: 15px;\n }\n \n .neofaceid-frame {\n width: 150px;\n height: 150px;\n }\n }\n ")}}class Yi{constructor(){i(this,"container",null),i(this,"currentStatus","preparing")}getStyles(){return"\n @keyframes neofaceid-fadeIn {\n from { opacity: 0; transform: scale(0.9); }\n to { opacity: 1; transform: scale(1); }\n }\n\n @keyframes neofaceid-fadeOut {\n from { opacity: 1; transform: scale(1); }\n to { opacity: 0; transform: scale(0.9); }\n }\n\n @keyframes neofaceid-pulse {\n 0%, 100% { \n transform: scale(1);\n opacity: 1;\n }\n 50% { \n transform: scale(1.05);\n opacity: 0.9;\n }\n }\n\n @keyframes neofaceid-scaleIn {\n 0% { transform: scale(0); opacity: 0; }\n 50% { transform: scale(1.1); }\n 100% { transform: scale(1); opacity: 1; }\n }\n\n @keyframes neofaceid-errorShake {\n 0%, 100% { transform: translateX(0); }\n 10%, 30%, 50%, 70%, 90% { transform: translateX(-4px); }\n 20%, 40%, 60%, 80% { transform: translateX(4px); }\n }\n\n .neofaceid-overlay-container {\n position: fixed;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n display: flex;\n align-items: center;\n justify-content: center;\n z-index: 10000;\n pointer-events: none;\n animation: neofaceid-fadeIn 0.3s ease-out;\n font-family: inherit;\n }\n\n .neofaceid-overlay-container.fade-out {\n animation: neofaceid-fadeOut 0.3s ease-out forwards;\n }\n\n .neofaceid-overlay-content {\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n gap: 24px;\n pointer-events: auto;\n }\n\n .neofaceid-visual-wrapper {\n position: relative;\n width: 100px;\n height: 100px;\n display: flex;\n align-items: center;\n justify-content: center;\n }\n\n .neofaceid-logo {\n width: 80px;\n height: 80px;\n object-fit: contain;\n transition: all 0.5s ease;\n filter: drop-shadow(0 4px 12px rgba(0, 89, 196, 0.3));\n }\n\n /* Cores por estado */\n .neofaceid-state-preparing .neofaceid-logo { filter: drop-shadow(0 0 15px rgba(0, 89, 196, 0.4)); }\n .neofaceid-state-detecting .neofaceid-logo { filter: hue-rotate(180deg) drop-shadow(0 0 15px rgba(59, 130, 246, 0.6)); }\n .neofaceid-state-waiting-for-face .neofaceid-logo { filter: hue-rotate(30deg) drop-shadow(0 0 15px rgba(251, 146, 60, 0.6)); }\n .neofaceid-state-capturing .neofaceid-logo { filter: hue-rotate(45deg) drop-shadow(0 0 15px rgba(245, 158, 11, 0.6)); }\n .neofaceid-state-verifying .neofaceid-logo { filter: hue-rotate(90deg) drop-shadow(0 0 15px rgba(34, 197, 94, 0.6)); }\n\n .neofaceid-logo.pulsing {\n animation: neofaceid-pulse 2s ease-in-out infinite;\n }\n\n @keyframes neofaceid-dots {\n 0%, 20% { opacity: 0; transform: translateY(0); }\n 50% { opacity: 1; transform: translateY(-2px); }\n 80%, 100% { opacity: 0; transform: translateY(0); }\n }\n\n .neofaceid-status-text {\n font-size: 15px;\n font-weight: 500;\n color: #ffffff;\n text-align: center;\n padding: 10px 24px;\n background: rgba(15, 23, 42, 0.8);\n backdrop-filter: blur(8px);\n border-radius: 100px;\n box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);\n border: 1px solid rgba(255, 255, 255, 0.1);\n text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);\n animation: neofaceid-fadeIn 0.3s ease-out;\n display: flex;\n align-items: center;\n gap: 2px;\n }\n\n .neofaceid-dots {\n display: inline-flex;\n margin-left: 2px;\n }\n\n .neofaceid-dot {\n animation: neofaceid-dots 1.5s infinite;\n opacity: 0;\n }\n\n .neofaceid-dot:nth-child(2) { animation-delay: 0.2s; }\n .neofaceid-dot:nth-child(3) { animation-delay: 0.4s; }\n\n .neofaceid-status-icon {\n position: absolute;\n inset: 0;\n display: flex;\n align-items: center;\n justify-content: center;\n }\n\n .neofaceid-success-icon {\n width: 80px;\n height: 80px;\n color: #0E9F6E;\n animation: neofaceid-scaleIn 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);\n }\n\n .neofaceid-error-icon {\n width: 80px;\n height: 80px;\n color: #ef4444;\n animation: neofaceid-errorShake 0.5s linear, neofaceid-scaleIn 0.4s ease-out;\n }\n "}getStatusText(){switch(this.currentStatus){case"preparing":return"Iniciando câmera";case"detecting":return"Posicione seu rosto";case"waiting-for-face":return"Aguardando rosto";case"capturing":return"Capturando";case"verifying":return"Verificando identidade";case"success":return"Identificado!";case"error":return"Falha na identificação";default:return""}}renderContent(){const e=["detecting","waiting-for-face","verifying"].includes(this.currentStatus),n=!["success","error"].includes(this.currentStatus),t="success"===this.currentStatus,o="error"===this.currentStatus,r=this.getStatusText(),a=["preparing","detecting","waiting-for-face","capturing","verifying"].includes(this.currentStatus);return`\n <style>${this.getStyles()}</style>\n <div class="neofaceid-overlay-container neofaceid-state-${this.currentStatus}">\n <div class="neofaceid-overlay-content">\n <div class="neofaceid-visual-wrapper">\n ${n?`<span class="neofaceid-logo ${e?"pulsing":""}" style="display:inline-flex;align-items:center;justify-content:center;color:currentColor;">${function(e=18){return`<span class="neoface-brand-mark" style="display:inline-flex;align-items:center;justify-content:center;width:${e}px;height:${e}px;color:currentColor;">${di}</span>`}(48).replace("width:18px;height:18px","width:100%;height:100%")}</span>`:""}\n \n ${t?'\n <div class="neofaceid-status-icon">\n <svg class="neofaceid-success-icon" viewBox="0 0 60 60" fill="none" xmlns="http://www.w3.org/2000/svg">\n <circle cx="30" cy="30" r="28" stroke="currentColor" stroke-width="3" fill="none"/>\n <path d="M15 30 L25 40 L45 20" stroke="currentColor" stroke-width="3" stroke-linecap="round" stroke-linejoin="round" fill="none"/>\n </svg>\n </div>\n ':""}\n \n ${o?'\n <div class="neofaceid-status-icon">\n <svg class="neofaceid-error-icon" viewBox="0 0 60 60" fill="none" xmlns="http://www.w3.org/2000/svg">\n <circle cx="30" cy="30" r="28" stroke="currentColor" stroke-width="3" fill="none"/>\n <path d="M20 20 L40 40 M40 20 L20 40" stroke="currentColor" stroke-width="3" stroke-linecap="round"/>\n </svg>\n </div>\n ':""}\n </div>\n \n ${r?`\n <div class="neofaceid-status-text">\n ${r}${a?'\n <span class="neofaceid-dots">\n <span class="neofaceid-dot">.</span>\n <span class="neofaceid-dot">.</span>\n <span class="neofaceid-dot">.</span>\n </span>\n ':""}\n </div>\n `:""}\n </div>\n </div>\n `}show(e="preparing"){this.container?this.updateStatus(e):(this.container=document.createElement("div"),this.container.id="neofaceid-status-overlay",this.currentStatus=e,this.container.innerHTML=this.renderContent(),document.body.appendChild(this.container))}updateStatus(e){this.currentStatus=e,this.container&&(this.container.innerHTML=this.renderContent())}close(){if(this.container){const e=this.container.querySelector(".neofaceid-overlay-container");e&&e.classList.add("fade-out"),setTimeout((()=>{this.container&&document.body.contains(this.container)&&document.body.removeChild(this.container),this.container=null}),300)}}}function Qi({error:e,onRetry:n,onCredentials:t,onCancel:r,applicationToken:a}){return o.jsxs(o.Fragment,{children:[o.jsx("style",{children:"\n @keyframes slideUp {\n from {\n opacity: 0;\n transform: translateY(20px);\n }\n to {\n opacity: 1;\n transform: translateY(0);\n }\n }\n\n @keyframes fadeIn {\n from { opacity: 0; }\n to { opacity: 1; }\n }\n\n .neofaceid-fallback-overlay {\n position: fixed;\n inset: 0;\n background: var(--nfid-overlay);\n backdrop-filter: blur(3px);\n -webkit-backdrop-filter: blur(3px);\n display: flex;\n align-items: center;\n justify-content: center;\n z-index: 10001;\n padding: 20px;\n animation: fadeIn 0.3s ease-out;\n font-family: inherit;\n }\n\n .neofaceid-fallback-prompt {\n background: var(--nfid-surface);\n border-radius: var(--nfid-radius, 16px);\n padding: 28px;\n max-width: 400px;\n width: 100%;\n box-shadow: 0 1px 3px rgba(10, 19, 32, 0.08);\n animation: slideUp 0.32s cubic-bezier(.2,0,0,1);\n text-align: center;\n box-sizing: border-box;\n }\n\n /* Falha de captura é atenção (dourado), nunca crítico (vermelho). */\n .neofaceid-fallback-icon {\n width: 56px;\n height: 56px;\n margin: 0 auto 20px;\n color: #F1BE00;\n }\n\n .neofaceid-fallback-title {\n font-size: 20px;\n font-weight: 700;\n color: var(--nfid-text);\n margin: 0 0 8px 0;\n line-height: 1.25;\n }\n\n .neofaceid-fallback-message {\n font-size: 14px;\n color: var(--nfid-text-muted);\n margin: 0 0 24px 0;\n line-height: 1.5;\n }\n\n .neofaceid-fallback-actions {\n display: flex;\n flex-direction: column;\n gap: 10px;\n }\n\n .neofaceid-fallback-button {\n min-height: 44px;\n padding: 12px 20px;\n border-radius: var(--nfid-radius, 16px);\n border: none;\n font-size: 15px;\n font-weight: 600;\n cursor: pointer;\n transition: background 120ms ease-out;\n font-family: inherit;\n }\n\n .neofaceid-fallback-button-primary {\n background: var(--nfid-action);\n color: var(--nfid-action-text);\n }\n .neofaceid-fallback-button-primary:hover { opacity: 0.92; }\n .neofaceid-fallback-button-primary:focus-visible {\n outline: 2px solid var(--nfid-focus-ring);\n outline-offset: 2px;\n }\n\n .neofaceid-fallback-button-secondary {\n background: var(--nfid-surface-muted);\n color: var(--nfid-text);\n border: 1px solid var(--nfid-line);\n }\n .neofaceid-fallback-button-secondary:hover { opacity: 0.9; }\n\n .neofaceid-fallback-button-ghost {\n background: transparent;\n color: var(--nfid-text-muted);\n min-height: 44px;\n padding: 10px;\n }\n .neofaceid-fallback-button-ghost:hover {\n background: var(--nfid-surface-muted);\n }\n\n @media (max-width: 640px) {\n .neofaceid-fallback-prompt {\n padding: 22px;\n }\n .neofaceid-fallback-title {\n font-size: 18px;\n }\n }\n "}),o.jsx("div",{className:"neofaceid-root neofaceid-fallback-overlay",role:"dialog","aria-modal":"true",children:o.jsxs("div",{className:"neofaceid-fallback-prompt",children:[o.jsx("div",{className:"neofaceid-fallback-icon","aria-hidden":"true",children:o.jsxs("svg",{viewBox:"0 0 64 64",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[o.jsx("path",{d:"M32 8 L58 54 H6 Z",stroke:"currentColor",strokeWidth:"3",strokeLinecap:"round",strokeLinejoin:"round",fill:"none"}),o.jsx("path",{d:"M32 26 V38",stroke:"currentColor",strokeWidth:"3",strokeLinecap:"round"}),o.jsx("circle",{cx:"32",cy:"45",r:"2",fill:"currentColor"})]})}),o.jsx("h3",{className:"neofaceid-fallback-title",children:"Vamos tentar de outro jeito"}),o.jsx("p",{className:"neofaceid-fallback-message",children:(null==e?void 0:e.getFriendlyMessage())||"Não conseguimos reconhecer sua face. Tente novamente ou use email e senha."}),o.jsxs("div",{className:"neofaceid-fallback-actions",children:[o.jsx("button",{type:"button",className:"neofaceid-fallback-button neofaceid-fallback-button-primary",onClick:n,children:"Tentar Novamente"}),o.jsx("button",{type:"button",className:"neofaceid-fallback-button neofaceid-fallback-button-secondary",onClick:t,children:"Entrar com Email e Senha"}),a&&o.jsx("button",{type:"button",className:"neofaceid-fallback-button neofaceid-fallback-button-ghost",onClick:()=>{new bi(a).open()},children:"Esqueceu sua senha?"}),r&&o.jsx("button",{type:"button",className:"neofaceid-fallback-button neofaceid-fallback-button-ghost",onClick:r,children:"Cancelar"})]})]})})]})}class es{constructor(){i(this,"container",null),i(this,"root",null)}show(e,n,o,r,a){this.container||(la(),this.container=document.createElement("div"),this.container.id="neofaceid-fallback-prompt",document.body.appendChild(this.container),this.root=t.createRoot(this.container),this.render(e,n,o,r,a))}close(){this.container&&document.body.contains(this.container)&&(this.root&&this.root.unmount(),document.body.removeChild(this.container),this.container=null,this.root=null)}render(e,n,t,r,a){this.root&&this.container&&this.root.render(o.jsx(Qi,{error:e,onRetry:()=>{this.close(),n()},onCredentials:()=>{this.close(),t()},applicationToken:a??"",onCancel:()=>{this.close(),null==r||r()}}))}}class ns{constructor(e){i(this,"options"),i(this,"modalElement",null),this.options=e}async open(){this.createModal(),document.body.appendChild(this.modalElement)}close(){this.modalElement&&(document.body.removeChild(this.modalElement),this.modalElement=null),this.options.onCancel&&this.options.onCancel()}createModal(){la(),this.addStyles(),this.modalElement=document.createElement("div"),this.modalElement.className="neofaceid-root neoface-email-password-modal",this.modalElement.innerHTML=`\n <div class="neoface-email-modal-overlay">\n <div class="neoface-email-modal-content">\n <h2>${this.options.title||"Login com Email e Senha"}</h2>\n <p>${this.options.subtitle||"Informe seus dados para login."}</p>\n <div id="login-error" class="neoface-email-error" style="display:none"></div>\n <form id="email-password-form">\n <input type="email" id="email" placeholder="Email" required />\n <input type="password" id="password" placeholder="Senha" required />\n <button type="submit" class="neoface-email-submit-btn">Entrar</button>\n </form>\n <button class="neoface-email-cancel-btn">Cancelar</button>\n \n \x3c!-- Branding --\x3e\n <div class="neoface-email-branding">\n ${vi()}\n </div>\n </div>\n </div>\n `;this.modalElement.querySelector("#email-password-form").addEventListener("submit",this.handleSubmit.bind(this));this.modalElement.querySelector(".neoface-email-cancel-btn").addEventListener("click",this.close.bind(this))}addStyles(){const e="neoface-email-password-modal-styles";document.getElementById(e)||ua(e,"\n .neoface-email-password-modal {\n position: fixed;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n z-index: 10002;\n font-family: inherit;\n }\n\n .neoface-email-modal-overlay {\n position: absolute;\n inset: 0;\n background: rgba(0, 0, 0, 0.6);\n backdrop-filter: blur(8px);\n display: flex;\n align-items: center;\n justify-content: center;\n padding: 20px;\n animation: fadeIn 0.3s ease-out;\n }\n\n @keyframes fadeIn {\n from { opacity: 0; }\n to { opacity: 1; }\n }\n\n @keyframes slideUp {\n from {\n opacity: 0;\n transform: translateY(20px);\n }\n to {\n opacity: 1;\n transform: translateY(0);\n }\n }\n\n .neoface-email-modal-content {\n background: linear-gradient(135deg, #0A1320 0%, #111C2B 100%);\n border-radius: 20px;\n padding: 32px;\n max-width: 400px;\n width: 100%;\n box-shadow: 0 24px 48px rgba(0, 0, 0, 0.4), 0 0 0 1px rgba(255, 255, 255, 0.1);\n animation: slideUp 0.4s ease-out;\n }\n\n .neoface-email-modal-content h2 {\n font-size: 24px;\n font-weight: 700;\n color: white;\n margin: 0 0 12px 0;\n text-align: center;\n }\n\n .neoface-email-modal-content p {\n font-size: 15px;\n color: rgba(255, 255, 255, 0.7);\n margin: 0 0 24px 0;\n text-align: center;\n line-height: 1.5;\n }\n\n .neoface-email-modal-content form {\n display: flex;\n flex-direction: column;\n gap: 16px;\n margin-bottom: 16px;\n }\n\n .neoface-email-modal-content input {\n width: 100%;\n padding: 14px 16px;\n border: 2px solid rgba(255, 255, 255, 0.2);\n border-radius: 12px;\n font-size: 15px;\n background: rgba(255, 255, 255, 0.1);\n color: white;\n font-family: inherit;\n transition: all 0.2s;\n box-sizing: border-box;\n }\n\n .neoface-email-modal-content input::placeholder {\n color: rgba(255, 255, 255, 0.5);\n }\n\n .neoface-email-modal-content input:focus {\n outline: none;\n border-color: #0059C4;\n box-shadow: 0 0 0 3px rgba(0, 89, 196, 0.2);\n background: rgba(255, 255, 255, 0.15);\n }\n\n .neoface-email-submit-btn {\n width: 100%;\n padding: 14px 24px;\n border-radius: 12px;\n border: none;\n background: linear-gradient(135deg, #0059C4 0%, #00449A 100%);\n color: white;\n font-size: 16px;\n font-weight: 600;\n cursor: pointer;\n transition: all 0.2s;\n box-shadow: 0 4px 16px rgba(0, 89, 196, 0.3);\n font-family: inherit;\n }\n\n .neoface-email-submit-btn:hover {\n transform: translateY(-2px);\n box-shadow: 0 8px 24px rgba(0, 89, 196, 0.4);\n }\n\n .neoface-email-submit-btn:active {\n transform: translateY(0);\n }\n\n .neoface-email-submit-btn:disabled {\n opacity: 0.6;\n cursor: not-allowed;\n transform: none;\n }\n\n .neoface-email-cancel-btn {\n width: 100%;\n padding: 12px 24px;\n border-radius: 12px;\n border: 1px solid rgba(255, 255, 255, 0.2);\n background: transparent;\n color: rgba(255, 255, 255, 0.7);\n font-size: 15px;\n font-weight: 600;\n cursor: pointer;\n transition: all 0.2s;\n font-family: inherit;\n }\n\n .neoface-email-cancel-btn:hover {\n background: rgba(255, 255, 255, 0.1);\n color: white;\n border-color: rgba(255, 255, 255, 0.3);\n }\n\n .neoface-email-branding {\n display: flex;\n align-items: center;\n justify-content: center;\n gap: 8px;\n margin-top: 32px;\n padding-top: 24px;\n border-top: 1px solid rgba(255, 255, 255, 0.1);\n font-size: 13px;\n color: rgba(255, 255, 255, 0.5);\n }\n\n .neoface-email-brand-logo {\n height: 20px;\n width: auto;\n }\n\n .neoface-email-brand-name {\n font-weight: 600;\n font-family: inherit;\n color: #ffffff;\n letter-spacing: 0.3px;\n }\n\n .neoface-email-error {\n background: rgba(239, 68, 68, 0.15);\n border: 1px solid rgba(239, 68, 68, 0.4);\n border-radius: 10px;\n color: #fca5a5;\n font-size: 14px;\n padding: 12px 16px;\n margin-bottom: 16px;\n text-align: center;\n animation: fadeIn 0.2s ease-out;\n }\n\n @media (max-width: 640px) {\n .neoface-email-modal-content {\n padding: 24px;\n border-radius: 16px;\n }\n\n .neoface-email-modal-content h2 {\n font-size: 20px;\n }\n }\n ")}async handleSubmit(e){e.preventDefault();const n=this.modalElement.querySelector("#email"),t=this.modalElement.querySelector("#password"),o=this.modalElement.querySelector(".neoface-email-submit-btn"),r=this.modalElement.querySelector("#login-error"),a=e=>{r.textContent=e,r.style.display="block"};r.style.display="none",r.textContent="";const i=n.value.trim(),s=t.value.trim();if(i&&s){o.disabled=!0,o.textContent="Entrando...";try{const e=await qa(i,s,this.options.applicationToken);this.options.onSuccess(e),this.close()}catch(c){o.disabled=!1,o.textContent="Entrar";c instanceof h&&(c.type===f.INVALID_TOKEN||c.type===f.API_ERROR&&c.message.includes("400"))?(a("Email ou senha incorretos. Verifique seus dados e tente novamente."),t.value="",t.focus()):(a("Ocorreu um erro inesperado. Tente novamente mais tarde."),this.options.onError(c))}}else a("Preencha o email e a senha para continuar.")}}let ts=!1,os=null;async function rs(){if(!ts)return os||(os=(async()=>{try{const e="/models";await d.nets.tinyFaceDetector.loadFromUri(e),ts=!0}catch(e){}})(),os)}async function as(e,n,t=!1,o=!1){o?n.updateStatus("detecting"):n.updateStatus("preparing");const r=document.createElement("video");r.style.position="fixed",r.style.top="-9999px",r.style.left="-9999px",r.style.width="1px",r.style.height="1px",r.style.opacity="0",r.muted=!0,r.playsInline=!0,r.setAttribute("autoplay",""),r.setAttribute("playsinline",""),document.body.appendChild(r);let a=null;try{try{a=await navigator.mediaDevices.getUserMedia({video:{width:{ideal:640},height:{ideal:480},facingMode:"user"},audio:!1})}catch{a=await navigator.mediaDevices.getUserMedia({video:{facingMode:"user"},audio:!1})}r.srcObject=a,await new Promise((e=>{if(r.readyState>=1)e();else{const n=()=>{r.removeEventListener("loadedmetadata",n),e()};r.addEventListener("loadedmetadata",n),setTimeout(e,2e3)}})),await r.play(),await new Promise((e=>{if(r.videoWidth&&r.videoHeight)e();else{const n=()=>{r.videoWidth&&r.videoHeight?e():setTimeout(n,100)};setTimeout(e,3e3),n()}})),n.updateStatus("detecting"),await new Promise((e=>setTimeout(e,100)));let o=!0;if(t||(o=await async function(e,n=5e3,t=100,o){return new Promise((r=>{let a=0;const i=Math.ceil(n/t);let s=null,c=!1,l=!1;const u=Math.ceil(3e3/t),p=e=>{c||(c=!0,s&&clearTimeout(s),r(e))},f=async()=>{if(!c){if(a++,!ts)return o&&!l&&a>=u&&(o.updateStatus("waiting-for-face"),l=!0),a>=i?void p(!1):void(s=window.setTimeout(f,t));try{if(await d.detectSingleFace(e,new d.TinyFaceDetectorOptions({inputSize:160,scoreThreshold:.3})))return o&&l&&(o.updateStatus("detecting"),l=!1),void p(!0);if(o&&!l&&a>=u&&(o.updateStatus("waiting-for-face"),l=!0),a>=i)return void p(!1);s=window.setTimeout(f,t)}catch(n){if(o&&!l&&a>=u&&(o.updateStatus("waiting-for-face"),l=!0),a>=i)return void p(!1);s=window.setTimeout(f,t)}}};window.setTimeout((()=>{c||p(!1)}),n+500),f()}))}(r,5e3,100,n)),!o)throw a&&a.getTracks().forEach((e=>e.stop())),r.parentElement&&r.parentElement.removeChild(r),new h("Nenhum rosto detectado. Por favor, posicione seu rosto na frente da câmera e tente novamente.",f.VALIDATION_ERROR);n.updateStatus("capturing");const i=document.createElement("canvas");i.width=r.videoWidth,i.height=r.videoHeight;const s=i.getContext("2d");if(!s)throw a&&a.getTracks().forEach((e=>e.stop())),r.parentElement&&r.parentElement.removeChild(r),new h("Erro ao capturar imagem",f.CAPTURE_ERROR);s.drawImage(r,0,0,i.width,i.height),a&&a.getTracks().forEach((e=>e.stop())),r.parentElement&&r.parentElement.removeChild(r);const c=await new Promise(((e,n)=>{i.toBlob((t=>{i.remove(),t?e(t):n(new Error("Failed to capture image"))}),"image/jpeg",.85)}));n.updateStatus("verifying");const l=await Aa(c,e);if(!l.success)throw new h("Login falhou",f.LOGIN_FAILED);return l}catch(i){if(a&&a.getTracks().forEach((e=>e.stop())),r.parentElement&&r.parentElement.removeChild(r),i instanceof h)throw i;throw new h(i instanceof Error?i.message:"Erro desconhecido",f.UNKNOWN)}}async function is(e){const{applicationToken:n,onSuccess:t,onError:o,onFallbackRequest:r,onCancel:a,fastMode:i=!1}=e,s=new Yi,c=new es;let d,l=0;ts||i||rs().catch((()=>{})),s.show("preparing");const u=async()=>{try{l++;const e=await as(n,s,i,l>1);s.updateStatus("success"),setTimeout((()=>{s.close(),t(e)}),200)}catch(e){d=e instanceof h?e:new h(e instanceof Error?e.message:"Erro desconhecido",f.UNKNOWN),s.updateStatus("error"),l<2?setTimeout((()=>{u()}),500):setTimeout((()=>{s.close(),c.show(d,(()=>{l=0,s.show("preparing"),setTimeout((()=>u()),500)}),(()=>{r?r():o(new h("Por favor, use email e senha para fazer login",f.LOGIN_FAILED))}),a,n)}),500)}};u()}const ss=Object.freeze(Object.defineProperty({__proto__:null,captureFaceSilently:async function(){return new Promise(((e,n)=>{const t=document.createElement("video");t.style.position="fixed",t.style.top="-9999px",t.style.left="-9999px",t.style.width="1px",t.style.height="1px",t.style.opacity="0",t.muted=!0,t.playsInline=!0,t.setAttribute("autoplay",""),t.setAttribute("playsinline","");const o=document.createElement("canvas");o.style.display="none";let r=null,a=0;const i=()=>{r&&r.getTracks().forEach((e=>e.stop())),t.parentElement&&t.parentElement.removeChild(t),o.parentElement&&o.parentElement.removeChild(o)};document.body.appendChild(t),document.body.appendChild(o);const s=e=>e?navigator.mediaDevices.getUserMedia({video:{width:{ideal:640},height:{ideal:480},facingMode:"user"},audio:!1}):navigator.mediaDevices.getUserMedia({video:{facingMode:"user"},audio:!1});s(!0).catch((()=>s(!1))).then((s=>{r=s,t.srcObject=r;const c=()=>{if(!t.videoWidth||!t.videoHeight)return a<30?(a++,void setTimeout(c,150)):(i(),void n(new h("Câmera não está pronta",f.CAMERA_ERROR)));o.width=t.videoWidth,o.height=t.videoHeight;const r=o.getContext("2d");if(!r)return i(),void n(new Error("Failed to get canvas context"));(async()=>{if(!ts)return!0;try{return!!(await d.detectSingleFace(t,new d.TinyFaceDetectorOptions({inputSize:160,scoreThreshold:.3})))}catch{return!0}})().then((s=>{if(!s&&a<30)return a++,void setTimeout(c,150);r.drawImage(t,0,0,o.width,o.height),o.toBlob((t=>{i(),t?e(t):n(new Error("Failed to capture image"))}),"image/jpeg",.85)}))},l=t.play();void 0!==l?l.then((()=>{t.videoWidth&&t.videoHeight?setTimeout(c,200):(t.onloadedmetadata=()=>setTimeout(c,200),setTimeout((()=>{t.videoWidth&&t.videoHeight&&c()}),1500))})).catch((e=>{i(),n(new h(`Erro ao reproduzir câmera: ${e.message}`,f.CAMERA_ERROR))})):t.onloadedmetadata=()=>setTimeout(c,200),t.onerror=()=>{i(),n(new h("Erro ao acessar câmera",f.CAMERA_ERROR))}})).catch((e=>{i(),n(new h(`Não foi possível acessar a câmera: ${e.message}`,f.CAMERA_ERROR))}))}))},executeBiometricLoginFlow:is,preloadFaceDetectionModels:rs},Symbol.toStringTag,{value:"Module"})),cs="Consentimento recusado pelo usuário.";async function ds(e){try{const t=await(n=e,new Promise(((e,t)=>{const o=new Image;o.onload=()=>e(o),o.onerror=()=>t(new Error("Erro ao carregar imagem"));const r=n.startsWith("data:")?n:`data:image/jpeg;base64,${n}`;o.src=r}))),o=await async function(e){try{if("undefined"!=typeof window&&window.faceapi){const{faceapi:n}=window;await us();const t=new n.TinyFaceDetectorOptions({inputSize:320,scoreThreshold:.5}),o=await n.detectAllFaces(e,t).withFaceLandmarks();if(o&&o.length>0){const e=o.reduce(((e,n)=>n.detection.score>e.detection.score?n:e));return{confidence:e.detection.score,details:{faces:o.length,landmarks:e.landmarks,box:e.detection.box}}}}return{confidence:0}}catch(n){return{confidence:0}}}(t);if(o.confidence>.7)return{type:"face",confidence:o.confidence,details:o.details};const r=await async function(e){try{const n=document.createElement("canvas"),t=n.getContext("2d");if(!t)return{confidence:0};n.width=e.width,n.height=e.height,t.drawImage(e,0,0);const o=function(e){const{data:n,width:t,height:o}=e;let r=0,a=0;for(let l=0;l<n.length;l+=4){ls(n[l],n[l+1],n[l+2])&&r++,a++}const i=r/a,s=t/o;let c=0;i>.15&&i<.7&&(c+=i/.7*.4);s>.6&&s<1.8&&(c+=.3);const d=t*o;d>1e4&&d<5e5&&(c+=.3);return{confidence:Math.min(c,.8),skinRatio:i,aspectRatio:s,imageSize:d,skinPixels:r,totalPixels:a}}(t.getImageData(0,0,n.width,n.height));return{confidence:o.confidence,details:o}}catch(n){return{confidence:0}}}(t);return r.confidence>.6?{type:"hand",confidence:r.confidence,details:r.details}:{type:"unknown",confidence:Math.max(o.confidence,r.confidence)}}catch(t){return{type:"face",confidence:.5}}var n}function ls(e,n,t){const o=.299*e+.587*n+.114*t,r=-.169*e-.331*n+.5*t+128,a=.5*e-.419*n-.081*t+128;return o>80&&o<255&&r>85&&r<135&&a>135&&a<180}async function us(){if("undefined"==typeof window||!window.faceapi)return;const{faceapi:e}=window;if(!e.nets.tinyFaceDetector.isLoaded)try{await Promise.all([e.nets.tinyFaceDetector.loadFromUri("/models"),e.nets.faceLandmark68Net.loadFromUri("/models")])}catch(n){}}async function ps(){try{"undefined"!=typeof window&&await us()}catch(e){}}function fs(){return"undefined"!=typeof window&&window.faceapi&&window.faceapi.nets.tinyFaceDetector.isLoaded}const hs=Object.freeze(Object.defineProperty({__proto__:null,detectBiometricType:ds,initializeBiometricDetection:ps,isAdvancedDetectionAvailable:fs},Symbol.toStringTag,{value:"Module"}));let ms=null;function gs(){ms=null}async function vs({applicationToken:e,purpose:n}){if(!e)throw new h("applicationToken é obrigatório para abrir sessão de captura",f.INVALID_TOKEN);const t=`${ba()}/api/v1/auth/capture/session/`;let o;try{o=await fetch(t,{method:"POST",headers:{"Content-Type":"application/json","X-App-Token":e},body:JSON.stringify({purpose:String(n).toUpperCase()})})}catch(c){const e=c instanceof Error?c.message:"Erro de rede";throw new h(`Falha de rede ao abrir sessão: ${e}`,f.NETWORK)}if(401===o.status||403===o.status)throw new h("Token de aplicação inválido ou expirado",f.INVALID_TOKEN);if(!o.ok)throw new h(`Falha ao abrir sessão de captura (${o.status})`,f.API_ERROR);const r=await o.json().catch((()=>null)),a=(null==r?void 0:r.data)??r,i=null==a?void 0:a.session_id;if(!i)throw new h("Resposta inválida ao abrir sessão de captura (session_id ausente)",f.API_ERROR);const s="string"==typeof(null==a?void 0:a.expires_at)&&a.expires_at.length>0?a.expires_at:function(e){const n="number"==typeof e&&Number.isFinite(e)?e:0;return new Date(Date.now()+1e3*n).toISOString()}(null==a?void 0:a.expires_in);return ms={session_id:i,expires_at:s},ms}async function bs({sessionId:e,applicationToken:n}){if(!n)throw new h("applicationToken é obrigatório para solicitar desafio de liveness",f.INVALID_TOKEN);if(!e)throw new h("session_id é obrigatório para solicitar desafio de liveness",f.VALIDATION_ERROR);const t=`${ba()}/api/v1/auth/liveness/challenge/`;let o;try{o=await fetch(t,{method:"POST",headers:{"Content-Type":"application/json","X-App-Token":n},body:JSON.stringify({session_id:e})})}catch(p){const e=p instanceof Error?p.message:"Erro de rede";throw new h(`Falha de rede ao solicitar desafio: ${e}`,f.NETWORK)}if(401===o.status||403===o.status)throw new h("Token de aplicação inválido ou expirado",f.INVALID_TOKEN);if(410===o.status)throw new h("Sessão de captura expirada (410) — reabrir sessão",f.API_ERROR);if(!o.ok)throw new h(`Falha ao solicitar desafio de liveness (${o.status})`,f.API_ERROR);const r=await o.json().catch((()=>null)),a=(null==r?void 0:r.data)??r,i=null==a?void 0:a.steps,s=null==a?void 0:a.gestures,c=Array.isArray(i)?i:Array.isArray(s)?s:void 0;if(!c||0===c.length)throw new h("Resposta inválida ao solicitar desafio (steps/gestures ausentes)",f.API_ERROR);const d=c.map(((e,n)=>{const t=e,o=t.gesture??t.gesture_key;return{index:"number"==typeof t.order?t.order:"number"==typeof t.index?t.index:n+1,gesture_key:o??"",instruction:"string"==typeof t.instruction?t.instruction:void 0,instruction_i18n:t.instruction_i18n&&"object"==typeof t.instruction_i18n?t.instruction_i18n:void 0}})),l="number"==typeof(null==a?void 0:a.expires_in)?a.expires_in:void 0,u="string"==typeof(null==a?void 0:a.expires_at)&&a.expires_at.length>0?a.expires_at:void 0!==l?new Date(Date.now()+1e3*l).toISOString():void 0;return{challenge_id:"string"==typeof(null==a?void 0:a.challenge_id)?a.challenge_id:void 0,gestures:d,expires_at:u,expires_in:l,language:"string"==typeof(null==a?void 0:a.language)?a.language:void 0}}async function ws({applicationToken:e,purpose:n,collectFramesForGesture:t,retryOnSessionExpired:o=!0}){const r=async()=>{const o=await vs({applicationToken:e,purpose:n}),r=await bs({sessionId:o.session_id,applicationToken:e}),a=[];for(let e=0;e<r.gestures.length;e+=1){const n=r.gestures[e],o=await t(n,e,r.gestures.length);a.push({gesture_key:String(n.gesture_key),images:o})}return{sessionId:o.session_id,challenge:r,capturedGestures:a}};try{return await r()}catch(a){if(o&&a instanceof h&&a.message.includes("410"))return gs(),r();throw a}}class ys{constructor(e){i(this,"overlay",null),i(this,"video",null),i(this,"canvas",null),i(this,"stream",null),i(this,"step","face"),i(this,"countdownSeconds"),i(this,"title"),i(this,"subtitle"),i(this,"faceBlob",null),i(this,"documentBlob",null),i(this,"autoLighting"),i(this,"flashController",null),this.countdownSeconds=(null==e?void 0:e.countdown)??3,this.title=null==e?void 0:e.title,this.subtitle=null==e?void 0:e.subtitle,this.autoLighting=!1!==(null==e?void 0:e.autoLighting)}async open(){if(await this.createDom(),await this.startCamera(),await this.runFaceCaptureCountdown(),this.faceBlob=await this.captureFrame(),this.step="document",this.updateTexts("Captura do Documento",'Posicione seu documento visível e clique em "Capturar"'),await this.waitForUserCaptureClick(),this.documentBlob=await this.captureFrame(),await this.close(),!this.faceBlob||!this.documentBlob)throw new Error("Falha na captura das imagens de onboarding");return{face:this.faceBlob,document:this.documentBlob}}async createDom(){const e=document.createElement("div");e.className="neofaceid-modal-overlay",e.innerHTML=`\n <div class="neofaceid-modal">\n <div class="neofaceid-modal-header">\n <h2 class="neofaceid-title">${this.title??"Onboarding NeoFaceID"}</h2>\n <button class="neofaceid-close-btn" aria-label="Fechar">×</button>\n </div>\n <div class="neofaceid-modal-body">\n <p class="neofaceid-subtitle">${this.subtitle??"Vamos capturar sua face e documento"}</p>\n <div class="neofaceid-camera-container">\n <video class="neofaceid-video" autoplay muted playsinline></video>\n <canvas class="neofaceid-canvas"></canvas>\n <div class="neofaceid-overlay">\n <div class="neofaceid-frame"></div>\n <div class="neofaceid-countdown" style="display:none"><span class="neofaceid-countdown-number">${this.countdownSeconds}</span></div>\n </div>\n </div>\n <div class="neofaceid-status"><p class="neofaceid-status-text">Posicione seu rosto no quadro</p></div>\n </div>\n <div class="neofaceid-modal-footer">\n <button class="neofaceid-cancel-btn">Cancelar</button>\n <button class="neofaceid-capture-btn" disabled>Capturar</button>\n </div>\n <div class="neofaceid-seal-row">\n ${vi()}\n </div>\n </div>\n `,la(),ua("neofaceid-onboarding-capture-styles","\n .neofaceid-root .neofaceid-modal-overlay { position: fixed; inset: 0; background: var(--nfid-overlay); display:flex; align-items:center; justify-content:center; z-index: 9999; }\n .neofaceid-root .neofaceid-modal { background: var(--nfid-surface); border-radius: var(--nfid-radius, 16px); width: 92%; max-width: 640px; box-shadow: 0 1px 3px rgba(10,19,32,.08); overflow:hidden; }\n .neofaceid-root .neofaceid-modal-header { padding: 16px 20px; border-bottom: 1px solid var(--nfid-line); display:flex; align-items:center; justify-content:space-between; }\n .neofaceid-root .neofaceid-title { margin:0; font-size: 20px; color: var(--nfid-text); }\n .neofaceid-root .neofaceid-close-btn { background:none; border:none; font-size:24px; cursor:pointer; color: var(--nfid-text-muted); min-width: 44px; min-height: 44px; }\n .neofaceid-root .neofaceid-modal-body { padding: 16px 20px; }\n .neofaceid-root .neofaceid-subtitle { margin: 0 0 12px 0; color: var(--nfid-text-muted); }\n .neofaceid-root .neofaceid-camera-container { position: relative; background:#000; border-radius:8px; overflow:hidden; aspect-ratio: 4/3; margin-bottom: 12px; }\n .neofaceid-root .neofaceid-video { width:100%; height:100%; object-fit: cover; }\n .neofaceid-root .neofaceid-canvas { position:absolute; top:0; left:0; }\n .neofaceid-root .neofaceid-overlay { position:absolute; inset:0; display:flex; align-items:center; justify-content:center; }\n .neofaceid-root .neofaceid-frame { width: 200px; height: 200px; border: 3px solid #0E9F6E; border-radius: 50%; box-shadow: 0 0 0 2px rgba(14,159,110,0.3); }\n .neofaceid-root .neofaceid-countdown { position:absolute; top:16px; right:16px; background: rgba(0,0,0,0.7); color:#fff; width: 48px; height:48px; display:flex; align-items:center; justify-content:center; border-radius:50%; }\n .neofaceid-root .neofaceid-modal-footer { padding: 16px 20px; border-top: 1px solid var(--nfid-line); display:flex; gap: 8px; justify-content:flex-end; }\n .neofaceid-root .neofaceid-cancel-btn { background: var(--nfid-surface-muted); color: var(--nfid-text-muted); border:none; border-radius:8px; padding:10px 18px; cursor:pointer; min-height: 44px; }\n .neofaceid-root .neofaceid-capture-btn { background: var(--nfid-action); color: var(--nfid-action-text); border:none; border-radius:8px; padding:10px 18px; cursor:pointer; min-height: 44px; }\n .neofaceid-root .neofaceid-capture-btn:disabled { background: var(--nfid-line); cursor:not-allowed; }\n .neofaceid-root .neofaceid-seal-row { display:flex; justify-content:center; padding:12px 20px 14px; border-top: 1px solid var(--nfid-line); }\n .neofaceid-root .neofaceid-seal { font-size:10px; font-weight:500; letter-spacing:0.06em; text-transform:uppercase; color: var(--nfid-text-subtle); }\n "),e.classList.add("neofaceid-root"),document.body.appendChild(e),this.overlay=e,this.video=this.overlay.querySelector(".neofaceid-video"),this.canvas=this.overlay.querySelector(".neofaceid-canvas");const n=this.overlay.querySelector(".neofaceid-close-btn"),t=this.overlay.querySelector(".neofaceid-cancel-btn");n.onclick=()=>this.close(),t.onclick=()=>this.close();this.overlay.querySelector(".neofaceid-capture-btn").disabled=!0}async startCamera(){if(!this.video)throw new Error("Elemento de vídeo não encontrado");this.video.muted=!0,this.video.playsInline=!0;try{this.stream=await navigator.mediaDevices.getUserMedia({video:{facingMode:"user",width:{ideal:1280},height:{ideal:720}},audio:!1})}catch{this.stream=await navigator.mediaDevices.getUserMedia({video:{facingMode:"user"},audio:!1})}this.video.srcObject=this.stream,await this.video.play(),this.autoLighting&&!this.flashController&&(this.flashController=Hi((()=>this.video)),this.flashController.start())}async runFaceCaptureCountdown(){if(!this.overlay)return;const e=this.overlay.querySelector(".neofaceid-countdown"),n=this.overlay.querySelector(".neofaceid-countdown-number"),t=this.overlay.querySelector(".neofaceid-status-text");e.style.display="flex",t.textContent="Prepare-se! Capturando seu rosto...";let o=this.countdownSeconds;n.textContent=String(o),await new Promise((t=>{const r=setInterval((()=>{o-=1,n.textContent=String(o),o<=0&&(clearInterval(r),e.style.display="none",t())}),1e3)}))}async waitForUserCaptureClick(){if(!this.overlay)return;const e=this.overlay.querySelector(".neofaceid-capture-btn"),n=this.overlay.querySelector(".neofaceid-status-text");e.disabled=!1,n.textContent='Clique em "Capturar" quando o documento estiver visível',await new Promise((n=>{const t=()=>{e.removeEventListener("click",t),n()};e.addEventListener("click",t)})),e.disabled=!0}async captureFrame(){if(!this.video||!this.canvas)throw new Error("Elementos de captura não encontrados");const e=this.canvas.getContext("2d");if(!e)throw new Error("Falha ao obter contexto do canvas");this.canvas.width=this.video.videoWidth,this.canvas.height=this.video.videoHeight,e.drawImage(this.video,0,0,this.canvas.width,this.canvas.height);return await new Promise(((e,n)=>{this.canvas.toBlob((t=>t?e(t):n(new Error("Falha ao gerar imagem"))),"image/jpeg",.92)}))}updateTexts(e,n){if(!this.overlay)return;const t=this.overlay.querySelector(".neofaceid-title"),o=this.overlay.querySelector(".neofaceid-subtitle"),r=this.overlay.querySelector(".neofaceid-frame");t.textContent=e,o.textContent=n,"document"===this.step&&(r.style.borderRadius="8px",r.style.width="280px",r.style.height="180px")}async close(){this.flashController&&(this.flashController.destroy(),this.flashController=null),this.stream&&(this.stream.getTracks().forEach((e=>e.stop())),this.stream=null),this.overlay&&(this.overlay.remove(),this.overlay=null)}}const xs=["Olhe diretamente para a câmera","Vire levemente a cabeça para a esquerda","Vire levemente a cabeça para a direita","Mostre o polegar para cima (👍) e olhe para a câmera"];function ks({open:e,onDismiss:t,dismissOnOverlay:r=!0,ariaLabel:a,ariaLabelledBy:i,children:s,className:c,style:d}){if(n.useEffect((()=>{la()}),[]),!e)return null;return o.jsx("div",{className:"neofaceid-root",role:"presentation",style:{position:"fixed",inset:0,zIndex:10001,display:"flex",alignItems:"center",justifyContent:"center",padding:20,background:`var(${ia})`,backdropFilter:"blur(3px)",WebkitBackdropFilter:"blur(3px)"},onClick:()=>{r&&t&&t()},children:o.jsx("div",{role:"dialog","aria-modal":"true","aria-label":a,"aria-labelledby":i,className:c,onClick:e=>e.stopPropagation(),style:{background:`var(${Xr})`,color:`var(${ea})`,borderRadius:`var(${ca}, 16px)`,padding:28,maxWidth:440,width:"100%",boxShadow:"0 1px 3px rgba(10,19,32,.08)",boxSizing:"border-box",...d},children:s})})}const Es={minHeight:44,minWidth:44,padding:"12px 20px",borderRadius:16,border:"none",fontSize:15,fontWeight:600,fontFamily:"inherit",cursor:"pointer",transition:"background 120ms ease-out",display:"inline-flex",alignItems:"center",justifyContent:"center",gap:8},_s=n.forwardRef((({variant:e="primary",style:n,type:t="button",...r},a)=>{const i="primary"===e?{background:`var(${oa})`,color:`var(${ra})`}:"secondary"===e?{background:`var(${Yr})`,color:`var(${ea})`}:{background:"transparent",color:`var(${na})`};return o.jsx("button",{ref:a,type:t,...r,style:{...Es,...i,...n}})}));function Rs({size:e=96,color:n,strokeWidth:t,glow:r=!1,className:a,style:i}){const s=t??function(e){return e<=24?2:e<=48?2.5:3.4}(e),c=.28*e,d=s/2,l=[{x:d,y:d,dx:1,dy:1},{x:e-d,y:d,dx:-1,dy:1},{x:d,y:e-d,dx:1,dy:-1},{x:e-d,y:e-d,dx:-1,dy:-1}];return o.jsx("svg",{width:e,height:e,viewBox:`0 0 ${e} ${e}`,xmlns:"http://www.w3.org/2000/svg",className:a,style:{color:n??`var(${oa})`,filter:r?"drop-shadow(0 0 6px rgba(0,176,248,.5))":void 0,...i},"aria-hidden":"true",children:l.map(((e,n)=>o.jsx("path",{d:`M ${e.x+e.dx*c} ${e.y} L ${e.x} ${e.y} L ${e.x} ${e.y+e.dy*c}`,fill:"none",stroke:"currentColor",strokeWidth:s,strokeLinecap:"round"},n)))})}function Ns({progress:e,size:n=268,children:t,className:r,style:a}){const i=Math.max(0,Math.min(1,Number.isFinite(e)?e:0)),s=n/2-4.2,c=2*Math.PI*s,d=c*(1-i),l=n+24;return o.jsxs("div",{className:r,style:{position:"relative",width:l,height:l,display:"inline-flex",alignItems:"center",justifyContent:"center",...a},children:[o.jsx("div",{style:{position:"absolute",inset:0},children:o.jsx(Rs,{size:l,glow:!0})}),o.jsx("div",{style:{position:"relative",width:n,height:n,borderRadius:"50%",overflow:"hidden",background:"linear-gradient(160deg, #274B6E, #0F2438, #05080F)"},children:t}),o.jsxs("svg",{width:n,height:n,viewBox:`0 0 ${n} ${n}`,style:{position:"absolute",top:(l-n)/2,left:(l-n)/2,transform:"rotate(-90deg)",pointerEvents:"none"},"aria-hidden":"true",children:[o.jsx("defs",{children:o.jsxs("linearGradient",{id:"nfid-challenge-arc",x1:"0%",y1:"0%",x2:"100%",y2:"100%",children:[o.jsx("stop",{offset:"0%",stopColor:"#00B0F8"}),o.jsx("stop",{offset:"100%",stopColor:"#0073F4"})]})}),o.jsx("circle",{cx:n/2,cy:n/2,r:s,stroke:"rgba(255,255,255,0.18)",strokeWidth:4.2,fill:"none"}),o.jsx("circle",{cx:n/2,cy:n/2,r:s,stroke:`var(${oa}, url(#nfid-challenge-arc))`,strokeWidth:4.2,strokeLinecap:"round",strokeDasharray:c,strokeDashoffset:d,fill:"none",style:{transition:"stroke-dashoffset 200ms ease-out"}})]})]})}function Ts({gesture:e,size:n=48,color:t,className:r,style:a}){return o.jsxs("svg",{width:n,height:n,viewBox:"0 0 48 48",xmlns:"http://www.w3.org/2000/svg",className:r,style:{color:t??`var(${oa})`,...a},role:"img","aria-label":Os[e],children:["blink"===e?o.jsx(Is,{stroke:3.4}):o.jsx(Ss,{stroke:3.4}),"blink"!==e&&"center"!==e&&o.jsx(Cs,{gesture:e,stroke:3.4})]})}_s.displayName="Button";const Os={center:"Centralize o rosto",turn_right:"Vire o rosto para a direita",turn_left:"Vire o rosto para a esquerda",look_up:"Olhe para cima",look_down:"Olhe para baixo",blink:"Pisque os olhos",move_closer:"Aproxime-se da câmera"};function Ss({stroke:e}){return o.jsxs("g",{fill:"none",stroke:"currentColor",strokeWidth:e,strokeLinecap:"round",strokeLinejoin:"round",children:[o.jsx("path",{d:"M14 20c0-5.5 4.5-10 10-10s10 4.5 10 10v4c0 5.5-4.5 10-10 10s-10-4.5-10-10v-4z"}),o.jsx("circle",{cx:"20",cy:"22",r:"1.2",fill:"currentColor",stroke:"none"}),o.jsx("circle",{cx:"28",cy:"22",r:"1.2",fill:"currentColor",stroke:"none"}),o.jsx("path",{d:"M21 28c1 1 2 1.5 3 1.5s2-.5 3-1.5"})]})}function Is({stroke:e}){return o.jsxs("g",{fill:"none",stroke:"currentColor",strokeWidth:e,strokeLinecap:"round",strokeLinejoin:"round",children:[o.jsx("path",{d:"M8 24c4-4 8-6 16-6s12 2 16 6"}),o.jsx("path",{d:"M12 26v3"}),o.jsx("path",{d:"M18 27v3.5"}),o.jsx("path",{d:"M24 27.5v4"}),o.jsx("path",{d:"M30 27v3.5"}),o.jsx("path",{d:"M36 26v3"})]})}function Cs({gesture:e,stroke:n}){const[t,r,a]=function(e){switch(e){case"turn_right":return["40 18","44 24","40 30"];case"turn_left":return["8 18","4 24","8 30"];case"look_up":return["18 8","24 4","30 8"];case"look_down":case"move_closer":return["18 40","24 44","30 40"];default:return["24 24","24 24","24 24"]}}(e);return o.jsx("path",{d:`M ${t} L ${r} L ${a}`,fill:"none",stroke:"currentColor",strokeWidth:n,strokeLinecap:"round",strokeLinejoin:"round"})}function zs({tone:e,children:n,icon:t,className:r}){const a=Wr[e];return o.jsxs("span",{className:r,style:{display:"inline-flex",alignItems:"center",gap:6,padding:"4px 10px",borderRadius:9999,background:a.bg,color:a.fg,fontSize:13,fontWeight:600,fontFamily:"inherit",lineHeight:1.3},children:[t,n]})}const js={title:"Não deu certo desta vez",hint:"Tente se posicionar em um ambiente mais estável.",actions:["Segure o dispositivo firme","Fique de frente para uma luz suave"]},As={LIVENESS_LOW:{title:"Precisamos ver com mais nitidez",hint:"A prova de vida veio abaixo do esperado.",actions:["Faça o movimento com calma até o fim","Aproxime o rosto sem cortar as bordas"]},NO_FACE_DETECTED:{title:"Não vi seu rosto",hint:"A câmera não conseguiu identificar um rosto na moldura.",actions:["Centralize o rosto no oval","Afaste-se um pouco se estiver muito próximo"]},LOW_LIGHT:{title:"A luz está baixa demais",hint:"Falta contraste para o algoritmo distinguir seu rosto.",actions:["Fique de frente para uma janela ou lâmpada","Evite luz vindo por trás — deixa o rosto em sombra"]},LOOK_STRAIGHT:{title:"Olhe direto para a câmera",hint:"O rosto está um pouco de lado para reconhecimento facial.",actions:["Fique de frente para a câmera","Mantenha o queixo paralelo ao chão"]},RECOGNITION_FAILED:{title:"Não consegui confirmar",hint:"A imagem não bate com o cadastro que temos.",actions:["Retire óculos ou máscara temporariamente","Faça em um lugar mais iluminado"]},INVALID_TOKEN:{title:"Sessão expirada",hint:"A conexão com o serviço perdeu validade.",actions:["Volte à tela anterior e tente novamente","Se persistir, entre em contato com o suporte"]},NETWORK:{title:"A conexão está oscilando",hint:"A imagem não chegou até nosso servidor.",actions:["Verifique a rede do dispositivo","Repita a captura em alguns segundos"]}};const Fs={chrome:"Clique no cadeado da barra de endereço → Configurações do site → Câmera → Permitir. Recarregue a página.",edge:"Clique no cadeado da barra de endereço → Permissões do site → Câmera → Permitir. Recarregue a página.",firefox:'Clique no ícone da câmera bloqueada na barra de endereço e escolha "Permitir". Recarregue a página.',safari:"Menu Safari → Configurações → Sites → Câmera → Permitir para este site. Recarregue a página.",unknown:'Abra as configurações do navegador, procure por "câmera" e permita o acesso para este site. Depois recarregue a página.'};function $s(){n.useEffect((()=>{la(),ua("neofaceid-state-views-styles",'\n.neofaceid-root .nfid-state {\n display: flex; flex-direction: column; align-items: center; text-align: center; gap: 10px;\n padding: 8px 8px 4px;\n}\n.neofaceid-root .nfid-state h2 {\n margin: 6px 0 0; font-size: 20px; font-weight: 700; color: var(--nfid-text); line-height: 1.25;\n letter-spacing: -0.015em;\n}\n.neofaceid-root .nfid-state p {\n margin: 0; font-size: 14px; color: var(--nfid-text-muted); line-height: 1.5;\n}\n.neofaceid-root .nfid-state-actions {\n display: flex; flex-direction: column; gap: 10px; width: 100%; margin-top: 12px;\n}\n.neofaceid-root .nfid-state-actions--row {\n flex-direction: row; justify-content: center;\n}\n.neofaceid-root .nfid-state-icon-success {\n width: 64px; height: 64px; color: #0E9F6E;\n animation: nfidCelebrate 500ms cubic-bezier(.2,1.4,.4,1) both;\n}\n@keyframes nfidCelebrate {\n 0% { transform: scale(0.6); opacity: 0; }\n 60% { transform: scale(1.08); opacity: 1; }\n 100% { transform: scale(1); }\n}\n.neofaceid-root .nfid-state-warn-icon { width: 56px; height: 56px; color: #F1BE00; }\n.neofaceid-root .nfid-state-cameraoff-icon { width: 56px; height: 56px; color: var(--nfid-text-muted); }\n.neofaceid-root .nfid-state-hints {\n display: flex; flex-direction: column; gap: 6px; margin-top: 8px; text-align: left; width: 100%;\n}\n.neofaceid-root .nfid-state-hint {\n display: flex; gap: 8px; align-items: flex-start; font-size: 13px; color: var(--nfid-text);\n padding: 8px 12px; background: var(--nfid-surface-muted); border-radius: 12px;\n}\n.neofaceid-root .nfid-state-hint::before { content: "•"; color: var(--nfid-action); font-weight: 700; }\n.neofaceid-root .nfid-state-attempt {\n font-size: 12px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase;\n color: var(--nfid-text-subtle);\n}\n.neofaceid-root .nfid-state-techcode {\n font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;\n font-size: 11px; color: var(--nfid-text-subtle); margin-top: 8px;\n}\n')}),[])}function Ps({appName:e,onContinue:n}){return $s(),o.jsxs("div",{className:"nfid-state",role:"status","aria-live":"polite",children:[o.jsxs("svg",{className:"nfid-state-icon-success",viewBox:"0 0 64 64",fill:"none",stroke:"currentColor",strokeWidth:"4",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[o.jsx("circle",{cx:"32",cy:"32",r:"28"}),o.jsx("path",{d:"M20 33 L28 41 L44 24"})]}),o.jsx("h2",{children:"Identidade confirmada"}),o.jsxs("p",{children:["Você já pode continuar no ",e,"."]}),o.jsx("div",{className:"nfid-state-actions",children:o.jsx(_s,{variant:"primary",onClick:n,children:"Continuar"})})]})}function Ds({errorCode:e,attempt:n,maxAttempts:t,timestamp:r,onRetry:a,onFallback:i}){$s();const s=function(e){if(!e)return js;const n=e.toUpperCase();return As[n]??js}(e),c=r??new Date;return o.jsxs("div",{className:"nfid-state",role:"alert","aria-live":"assertive",children:[o.jsxs(zs,{tone:"attention",children:["Tentativa ",n," de ",t]}),o.jsxs("svg",{className:"nfid-state-warn-icon",viewBox:"0 0 64 64",fill:"none",stroke:"currentColor",strokeWidth:"3",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[o.jsx("path",{d:"M32 8 L58 54 H6 Z"}),o.jsx("path",{d:"M32 26 V38"}),o.jsx("circle",{cx:"32",cy:"45",r:"2",fill:"currentColor"})]}),o.jsx("h2",{children:s.title}),o.jsx("p",{children:s.hint}),o.jsxs("div",{className:"nfid-state-hints","aria-label":"O que fazer",children:[o.jsx("div",{className:"nfid-state-hint",children:s.actions[0]}),o.jsx("div",{className:"nfid-state-hint",children:s.actions[1]})]}),o.jsxs("div",{className:"nfid-state-actions",children:[o.jsx(_s,{variant:"primary",onClick:a,children:"Tentar de novo"}),o.jsx(_s,{variant:"ghost",onClick:i,children:"Verificar de outro jeito"})]}),o.jsxs("p",{className:"nfid-state-techcode",children:[(e??"UNKNOWN").toUpperCase()," · ",(d=c,`${String(d.getHours()).padStart(2,"0")}:${String(d.getMinutes()).padStart(2,"0")}:${String(d.getSeconds()).padStart(2,"0")}`)]})]});var d}function Ls({browser:e,onFallback:n,onCancel:t}){$s();const r=function(e){return Fs[e]}(e??function(e=navigator.userAgent){const n=e.toLowerCase();return n.includes("edg/")?"edge":n.includes("firefox")?"firefox":n.includes("chrome")&&!n.includes("edg/")?"chrome":n.includes("safari")&&!n.includes("chrome")?"safari":"unknown"}());return o.jsxs("div",{className:"nfid-state",role:"alert","aria-live":"assertive",children:[o.jsxs("svg",{className:"nfid-state-cameraoff-icon",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[o.jsx("path",{d:"m3 3 18 18"}),o.jsx("path",{d:"M20.66 15.34A2 2 0 0 0 22 13.5V7.5a2 2 0 0 0-3.13-1.65L15 8.5"}),o.jsx("path",{d:"M9 6H4a2 2 0 0 0-2 2v8a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2v-1"})]}),o.jsx("h2",{children:"Câmera bloqueada"}),o.jsx("p",{children:"Precisamos da câmera para confirmar que é você."}),o.jsx("p",{style:{marginTop:8},children:r}),o.jsxs("div",{className:"nfid-state-actions",children:[o.jsx(_s,{variant:"primary",onClick:n,children:"Verificar de outro jeito"}),o.jsx(_s,{variant:"ghost",onClick:t,children:"Agora não"})]})]})}const Ms={center:"center",turn_right:"turn_right",turn_left:"turn_left",look_up:"look_up",look_down:"look_down",blink:"blink",move_closer:"move_closer",smile:"blink",open_mouth:"blink"},qs={center:"Centralize seu rosto no oval",turn_right:"Vire lentamente o rosto para a direita",turn_left:"Vire lentamente o rosto para a esquerda",look_up:"Olhe para cima",look_down:"Olhe para baixo",blink:"Pisque os olhos",move_closer:"Aproxime-se da câmera",smile:"Sorria para a câmera",open_mouth:"Abra a boca"};function Us({applicationToken:e,appName:t,amount:r,onChallengeStart:a,onChallengeComplete:i,onSuccess:s,onError:c,onCancel:d,autoLighting:l=!0,onClose:u}){const p=n.useRef(null),[m,g]=n.useState(0),[v,b]=n.useState(null),[w,y]=n.useState("preparing"),[x,k]=n.useState(1),[E,_]=n.useState(void 0),[R,N]=n.useState(void 0),[T,O]=n.useState(0),S=n.useRef(!1),[I,C]=n.useState(!1),{flashOn:z}=ti(p,{enabled:l&&!I&&"challenging"===w}),j=ya(),A=t??wa()??"sua aplicação",F="number"==typeof r&&Number.isFinite(r)?function(e,n){try{return new Intl.NumberFormat(n,{style:"currency",currency:"BRL"}).format(e)}catch{return`R$ ${e.toFixed(2)}`}}(r,j):null;n.useEffect((()=>{la(),ua("neofaceid-authorize-styles","\n .neofaceid-root .nfid-authorize-header { display: flex; flex-direction: column; gap: 4px; margin-bottom: 16px; }\n .neofaceid-root .nfid-authorize-appname { font-size: 15px; font-weight: 700; color: var(--nfid-text); line-height: 1.2; }\n .neofaceid-root .nfid-authorize-amount { font-size: 13px; color: var(--nfid-text-muted); }\n .neofaceid-root .nfid-authorize-brand { font-size: 10px; font-weight: 500; letter-spacing: 0.06em; text-transform: uppercase; color: var(--nfid-text-subtle); }\n .neofaceid-root .nfid-authorize-video { width: 100%; height: 100%; object-fit: cover; transform: scaleX(-1); }\n .neofaceid-root .nfid-authorize-instruction { margin: 20px 0 0; font-size: 17px; font-weight: 600; color: var(--nfid-text); text-align: center; line-height: 1.3; }\n .neofaceid-root .nfid-authorize-support { margin: 6px 0 0; font-size: 13px; color: var(--nfid-text-muted); text-align: center; }\n .neofaceid-root .nfid-authorize-actions { display: flex; flex-direction: column; gap: 10px; margin-top: 20px; align-items: center; }\n .neofaceid-root .nfid-authorize-footer { display: flex; justify-content: center; margin-top: 16px; padding-top: 12px; border-top: 1px solid var(--nfid-line); }\n .neofaceid-root .nfid-authorize-seal { font-size: 10px; font-weight: 500; letter-spacing: 0.06em; text-transform: uppercase; color: var(--nfid-text-subtle); }\n .neofaceid-root .nfid-authorize-close {\n position: absolute; top: 8px; right: 8px;\n min-width: 44px; min-height: 44px;\n background: transparent; border: none;\n display: inline-flex; align-items: center; justify-content: center;\n color: var(--nfid-text-muted); cursor: pointer; border-radius: 22px;\n }\n .neofaceid-root .nfid-authorize-close:hover { background: var(--nfid-surface-muted); }\n .neofaceid-root .nfid-authorize-close:focus-visible { outline: 2px solid var(--nfid-focus-ring); outline-offset: 2px; }\n @media (prefers-reduced-motion: reduce) {\n .neofaceid-root svg circle { transition: none !important; }\n }\n ")}),[]),n.useEffect((()=>{let n=null;return S.current=!1,y("preparing"),g(0),b(null),async function(){try{try{n=await navigator.mediaDevices.getUserMedia({video:{facingMode:"user",width:{ideal:1280},height:{ideal:720}}})}catch(t){const e=function(e){if(!e||"object"!=typeof e)return"UNKNOWN";const n=(e.name??"").toString();return"NotAllowedError"===n||"SecurityError"===n?"PERMISSION_DENIED":"NotFoundError"===n||"OverconstrainedError"===n?"NO_CAMERA":"NotReadableError"===n||"TrackStartError"===n?"IN_USE":"UNKNOWN"}(t);if("PERMISSION_DENIED"===e)return void y("permission-denied");throw new h("NO_CAMERA"===e?"Câmera não encontrada":"IN_USE"===e?"Câmera em uso por outro app":"Falha ao acessar a câmera",f.CAMERA_ERROR)}p.current&&(p.current.srcObject=n,p.current.play().catch((()=>{}))),y("challenging");const o=await ws({applicationToken:e,purpose:"authorization",collectFramesForGesture:async(e,n,t)=>{if(S.current)throw new h("Cancelado",f.UNKNOWN);b(e),g(0),a&&a(e,n,t),await async function(e){const n=1500,t=Date.now();return new Promise((o=>{const r=()=>{const a=Date.now()-t,i=Math.min(1,a/n);e(i),a>=n?o():setTimeout(r,50)};r()}))}(g),i&&i(e,n,t);const o=await async function(e){if(!e||0===e.videoWidth)return null;const n=document.createElement("canvas");n.width=e.videoWidth,n.height=e.videoHeight;const t=n.getContext("2d");return t?(t.drawImage(e,0,0),n.toDataURL("image/jpeg",.85)):null}(p.current);return o?[o]:[]}});n&&n.getTracks().forEach((e=>e.stop())),n=null,y("success"),s&&s(o)}catch(o){if(S.current)return;const e=o instanceof h?o:new h(o instanceof Error?o.message:"Falha",f.UNKNOWN);_(e.type),N(new Date),y("failure"),c&&c(e)}finally{n&&n.getTracks().forEach((e=>e.stop()))}}(),()=>{S.current=!0,n&&n.getTracks().forEach((e=>e.stop()))}}),[T]);const $=()=>{S.current=!0,d&&d(),u()},P=()=>{x>=3?$():(k((e=>e+1)),_(void 0),N(void 0),O((e=>e+1)))},D=()=>{S.current=!0,c&&c(new h("Fluxo alternativo solicitado pelo usuário",f.CONSENT_DENIED)),u()},L=v?Ms[v.gesture_key]??"center":"center",M=v?qs[v.gesture_key]??"Siga a instrução":"Preparando a câmera…";return"success"===w?o.jsx(ks,{open:!0,dismissOnOverlay:!1,ariaLabel:"Identidade confirmada",children:o.jsx(Ps,{appName:A,onContinue:u})}):"permission-denied"===w?o.jsx(ks,{open:!0,dismissOnOverlay:!1,ariaLabel:"Câmera bloqueada",children:o.jsx(Ls,{onFallback:D,onCancel:$})}):"failure"===w?o.jsx(ks,{open:!0,dismissOnOverlay:!1,ariaLabel:"Não foi possível confirmar",children:o.jsx(Ds,{errorCode:E,attempt:x,maxAttempts:3,timestamp:R,onRetry:P,onFallback:D})}):o.jsxs(ks,{open:!0,onDismiss:void 0,dismissOnOverlay:!1,ariaLabel:"Autorização por biometria",children:[o.jsx(oi,{active:z,onDismiss:()=>C(!0)}),o.jsxs("div",{style:{position:"relative"},children:[o.jsx("button",{type:"button",className:"nfid-authorize-close",onClick:$,"aria-label":"Cancelar autorização",children:o.jsx("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2","aria-hidden":"true",children:o.jsx("path",{d:"M18 6L6 18M6 6l12 12"})})}),o.jsxs("div",{className:"nfid-authorize-header",children:[o.jsx("span",{className:"nfid-authorize-appname",children:A}),F&&o.jsxs("span",{className:"nfid-authorize-amount",children:["Autorizando ",F]}),o.jsx("span",{className:"nfid-authorize-brand",children:"NeoFaceID"})]}),o.jsx("div",{style:{display:"flex",justifyContent:"center"},children:o.jsx(Ns,{progress:m,size:220,children:o.jsx("video",{ref:p,className:"nfid-authorize-video",autoPlay:!0,muted:!0,playsInline:!0})})}),o.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",gap:12,marginTop:16},children:[o.jsx(Ts,{gesture:L,size:40}),o.jsx("p",{className:"nfid-authorize-instruction","aria-live":"assertive",style:{margin:0},children:M})]}),"preparing"===w&&o.jsx("p",{className:"nfid-authorize-support",children:"Ligando sua câmera…"}),o.jsx("div",{className:"nfid-authorize-actions",children:o.jsx(_s,{variant:"ghost",onClick:$,children:"Não consigo fazer esse movimento"})}),o.jsx("div",{className:"nfid-authorize-footer",children:o.jsx(gi,{})})]})]})}const Bs={RG:{name:"Documento de Identidade (RG / CIN / CPF)",icon:'<svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><rect x="3" y="4" width="18" height="16" rx="2"/><circle cx="9" cy="10" r="2"/><path d="M15 8h2M15 12h2M7 16h10"/></svg>',hasBack:!0,frontLabel:"Frente do Documento",backLabel:"Verso do Documento"},CNH:{name:"CNH / Carteira de Motorista",icon:'<svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><rect x="3" y="6" width="18" height="12" rx="2"/><circle cx="8" cy="12" r="2"/><path d="M13 10h5M13 14h3"/></svg>',hasBack:!0,frontLabel:"Frente da CNH",backLabel:"Verso da CNH"},CPF:{name:"Cartão CPF (Apenas Frente)",icon:'<svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"/><path d="M14 2v6h6M16 13H8M16 17H8M10 9H8"/></svg>',hasBack:!1,frontLabel:"Cartão CPF"}};class Ws{constructor(e){i(this,"overlay",null),i(this,"video",null),i(this,"canvas",null),i(this,"stream",null),i(this,"resolvePromise",null),i(this,"options"),i(this,"selectedDocument",null),i(this,"currentStep","select"),i(this,"flashController",null),i(this,"frontBlob",null),i(this,"backBlob",null),i(this,"_previewObjectUrl",null),this.options={title:(null==e?void 0:e.title)??"Validação de Identidade",subtitle:(null==e?void 0:e.subtitle)??"Selecione o tipo de documento",useBackCamera:(null==e?void 0:e.useBackCamera)??!0,onCancel:null==e?void 0:e.onCancel,preSelectedDocument:null==e?void 0:e.preSelectedDocument}}async open(){if(!this.options.skipConsent){if(!(await Ji({appName:this.options.appName,flow:"verification"})))throw new h("Consentimento recusado pelo usuário.",f.CONSENT_DENIED)}return new Promise((e=>{this.resolvePromise=e,this.options.preSelectedDocument&&(this.selectedDocument=this.options.preSelectedDocument,this.currentStep="front"),this.render()}))}render(){var e;this.overlay||this.createOverlay();const n=null==(e=this.overlay)?void 0:e.querySelector(".neoface-doc-content");if(n)switch(this.currentStep){case"select":n.innerHTML=this.renderSelectStep(),this.bindSelectEvents();break;case"front":case"back":n.innerHTML=this.renderCaptureStep(),this.bindCaptureEvents(),this.startCamera();break;case"preview-front":case"preview-back":n.innerHTML=this.renderPreviewStep(),this.bindPreviewEvents()}}createOverlay(){const e=document.createElement("div");e.className="neoface-doc-overlay",e.innerHTML='\n <div class="neoface-doc-modal">\n <div class="neoface-doc-content"></div>\n </div>\n ',la(),ua("neoface-doc-styles-v2",this.getStyles()),e.classList.add("neofaceid-root"),document.body.appendChild(e),this.overlay=e}renderSelectStep(){return`\n <div class="neoface-doc-header">\n <div class="neoface-doc-header-left">\n <h2 class="neoface-doc-title">${this.options.title}</h2>\n <p class="neoface-doc-subtitle">${this.options.subtitle}</p>\n </div>\n <button class="neoface-doc-close-btn" aria-label="Fechar">\n <svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">\n <path d="M18 6L6 18M6 6l12 12"/>\n </svg>\n </button>\n </div>\n \n <div class="neoface-doc-body">\n <div class="neoface-doc-select-grid">\n ${Object.entries(Bs).filter((([e])=>"CPF"!==e)).map((([e,n])=>`\n <button class="neoface-doc-select-option" data-type="${e}">\n <span class="neoface-doc-select-icon">${n.icon}</span>\n <span class="neoface-doc-select-name">${n.name}</span>\n <svg class="neoface-doc-select-arrow" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M9 18l6-6-6-6"/></svg>\n </button>\n `)).join("")}\n </div>\n \n <div class="neoface-doc-tips">\n <div class="neoface-doc-tip">\n <span>Garanta boa iluminação e que todos os dados estejam legíveis</span>\n </div>\n </div>\n </div>\n \n ${this.renderBranding()}\n `}renderCaptureStep(){const e=this.selectedDocument?Bs[this.selectedDocument]:null;if(!e)return"";const n="back"===this.currentStep,t=n?e.backLabel:e.frontLabel;return`\n <div class="neoface-doc-header">\n <div class="neoface-doc-header-left">\n <div class="neoface-doc-step-indicator">\n <span class="neoface-doc-step-badge">${n?2:1}/${e.hasBack?2:1}</span>\n <span class="neoface-doc-step-label">${t}</span>\n </div>\n </div>\n <button class="neoface-doc-close-btn" aria-label="Fechar">\n <svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">\n <path d="M18 6L6 18M6 6l12 12"/>\n </svg>\n </button>\n </div>\n \n <div class="neoface-doc-body">\n <div class="neoface-doc-camera-container">\n <video class="neoface-doc-video" autoplay muted playsinline></video>\n <canvas class="neoface-doc-canvas"></canvas>\n \n <div class="neoface-doc-guide">\n <div class="neoface-doc-frame">\n <div class="neoface-doc-corner neoface-doc-corner-tl"></div>\n <div class="neoface-doc-corner neoface-doc-corner-tr"></div>\n <div class="neoface-doc-corner neoface-doc-corner-bl"></div>\n <div class="neoface-doc-corner neoface-doc-corner-br"></div>\n <div class="neoface-doc-frame-label">${t}</div>\n </div>\n </div>\n \n <div class="neoface-doc-loading" style="display:none">\n <div class="neoface-doc-spinner"></div>\n </div>\n </div>\n \n <div class="neoface-doc-instructions">\n <div class="neoface-doc-instruction">\n <svg class="neoface-doc-instruction-icon" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><rect x="3" y="3" width="18" height="18" rx="2"/><path d="M3 9h18M9 21V9"/></svg>\n <span>Posicione o documento dentro do quadro</span>\n </div>\n <div class="neoface-doc-instruction">\n <svg class="neoface-doc-instruction-icon" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><circle cx="12" cy="12" r="5"/><path d="M12 1v2M12 21v2M4.22 4.22l1.42 1.42M18.36 18.36l1.42 1.42M1 12h2M21 12h2M4.22 19.78l1.42-1.42M18.36 5.64l1.42-1.42"/></svg>\n <span>Sem reflexo do flash sobre o texto</span>\n </div>\n </div>\n </div>\n \n <div class="neoface-doc-footer">\n <button class="neoface-doc-btn neoface-doc-btn-secondary neoface-doc-back-btn">\n ← Voltar\n </button>\n <input type="file" accept="image/*" class="neoface-doc-file-input" style="display:none" />\n <button class="neoface-doc-btn neoface-doc-btn-secondary neoface-doc-upload-btn">\n <svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">\n <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/>\n <polyline points="17,8 12,3 7,8"/>\n <line x1="12" y1="3" x2="12" y2="15"/>\n </svg>\n Anexar\n </button>\n <button class="neoface-doc-btn neoface-doc-btn-primary neoface-doc-capture-btn">\n <svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">\n <circle cx="12" cy="12" r="10"/>\n <circle cx="12" cy="12" r="4"/>\n </svg>\n Capturar\n </button>\n </div>\n \n ${this.renderBranding()}\n `}renderPreviewStep(){const e=this.selectedDocument?Bs[this.selectedDocument]:null;if(!e)return"";const n="preview-front"===this.currentStep,t=n?e.frontLabel:e.backLabel,o=!e.hasBack||"preview-back"===this.currentStep;return`\n <div class="neoface-doc-header">\n <div class="neoface-doc-header-left">\n <div class="neoface-doc-step-indicator">\n <span class="neoface-doc-step-badge">${n?1:2}/${e.hasBack?2:1}</span>\n <span class="neoface-doc-step-label">Confirmar ${t}</span>\n </div>\n </div>\n <button class="neoface-doc-close-btn" aria-label="Fechar">\n <svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">\n <path d="M18 6L6 18M6 6l12 12"/>\n </svg>\n </button>\n </div>\n \n <div class="neoface-doc-body">\n <div class="neoface-doc-preview-single">\n <span class="neoface-doc-preview-label">${t}</span>\n <img class="neoface-doc-preview-img neoface-doc-preview-current" alt="Prévia do documento capturado" />\n </div>\n\n <h3 class="neoface-doc-preview-question" id="neoface-doc-preview-question">Está legível?</h3>\n <div class="neoface-doc-preview-hint">\n <svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><circle cx="12" cy="12" r="10"/><path d="M12 16v-4M12 8h.01"/></svg>\n <span>Confira se dá para ler nome, número e data sem esforço.</span>\n </div>\n </div>\n\n <div class="neoface-doc-footer">\n <button class="neoface-doc-btn neoface-doc-btn-secondary neoface-doc-retake-btn">\n <svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">\n <path d="M1 4v6h6M23 20v-6h-6"/>\n <path d="M20.49 9A9 9 0 0 0 5.64 5.64L1 10m22 4l-4.64 4.36A9 9 0 0 1 3.51 15"/>\n </svg>\n Refazer\n </button>\n <button class="neoface-doc-btn neoface-doc-btn-primary neoface-doc-confirm-btn">\n <svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">\n <path d="M20 6L9 17l-5-5"/>\n </svg>\n ${o?"Sim, enviar":"Sim, próximo"}\n </button>\n </div>\n \n ${this.renderBranding()}\n `}renderBranding(){return`\n <div class="neoface-doc-branding">\n ${vi()}\n </div>\n `}bindSelectEvents(){var e;const n=null==(e=this.overlay)?void 0:e.querySelectorAll(".neoface-doc-select-option");null==n||n.forEach((e=>{e.addEventListener("click",(()=>{const n=e.getAttribute("data-type");this.selectedDocument=n,this.currentStep="front",this.render()}))})),this.bindCloseEvent()}bindCaptureEvents(){var e,n,t,o;const r=null==(e=this.overlay)?void 0:e.querySelector(".neoface-doc-capture-btn"),a=null==(n=this.overlay)?void 0:n.querySelector(".neoface-doc-back-btn"),i=null==(t=this.overlay)?void 0:t.querySelector(".neoface-doc-upload-btn"),s=null==(o=this.overlay)?void 0:o.querySelector(".neoface-doc-file-input");null==r||r.addEventListener("click",(()=>this.handleCapture())),null==a||a.addEventListener("click",(()=>this.handleBack())),null==i||i.addEventListener("click",(()=>null==s?void 0:s.click())),null==s||s.addEventListener("change",(e=>this.handleFileUpload(e))),this.bindCloseEvent()}async handleFileUpload(e){var n,t;const o=null==(n=e.target.files)?void 0:n[0];if(!o)return;const r=null==(t=this.overlay)?void 0:t.querySelector(".neoface-doc-loading");r&&(r.style.display="flex");try{const e=await this.compressUploadedImage(o);"front"===this.currentStep?(this.frontBlob=e,this.currentStep="preview-front"):"back"===this.currentStep&&(this.backBlob=e,this.currentStep="preview-back"),this.stopCamera(),this.render()}catch(a){const e=new Blob([o],{type:o.type});"front"===this.currentStep?(this.frontBlob=e,this.currentStep="preview-front"):"back"===this.currentStep&&(this.backBlob=e,this.currentStep="preview-back"),this.stopCamera(),this.render()}}compressUploadedImage(e){return ka(e,(e=>new Promise(((n,t)=>{const o=new Image;o.onload=()=>{const e=1280;let{width:r}=o,{height:a}=o;r>a&&r>e?(a=a*e/r,r=e):a>e&&(r=r*e/a,a=e);const i=document.createElement("canvas");i.width=r,i.height=a;const s=i.getContext("2d");s?(s.drawImage(o,0,0,r,a),i.toBlob((e=>{e?n(e):t(new Error("Failed to compress image"))}),"image/jpeg",.75)):t(new Error("Failed to get canvas context"))},o.onerror=()=>t(new Error("Failed to load image")),o.src=e}))))}bindPreviewEvents(){var e,n,t;const o=null==(e=this.overlay)?void 0:e.querySelector(".neoface-doc-confirm-btn"),r=null==(n=this.overlay)?void 0:n.querySelector(".neoface-doc-retake-btn");null==o||o.addEventListener("click",(()=>this.handleConfirm())),null==r||r.addEventListener("click",(()=>this.handleRetake()));const a=null==(t=this.overlay)?void 0:t.querySelector(".neoface-doc-preview-current");if(a){const e="preview-front"===this.currentStep?this.frontBlob:this.backBlob;e&&(this._previewObjectUrl&&(URL.revokeObjectURL(this._previewObjectUrl),this._previewObjectUrl=null),this._previewObjectUrl=URL.createObjectURL(e),a.src=this._previewObjectUrl)}this.bindCloseEvent()}bindCloseEvent(){var e;const n=null==(e=this.overlay)?void 0:e.querySelector(".neoface-doc-close-btn");null==n||n.addEventListener("click",(()=>this.handleCancel()))}async startCamera(){var e,n,t;try{const t={video:{facingMode:this.options.useBackCamera?"environment":"user",width:{ideal:1920},height:{ideal:1080}},audio:!1};this.stream=await navigator.mediaDevices.getUserMedia(t),this.video=null==(e=this.overlay)?void 0:e.querySelector(".neoface-doc-video"),this.canvas=null==(n=this.overlay)?void 0:n.querySelector(".neoface-doc-canvas"),this.video&&(this.video.muted=!0,this.video.playsInline=!0,this.video.srcObject=this.stream,await this.video.play(),this.startScreenFlash())}catch(o){if(this.options.useBackCamera)try{this.stream=await navigator.mediaDevices.getUserMedia({video:{facingMode:"user"},audio:!1}),this.video&&(this.video.srcObject=this.stream,await this.video.play(),this.startScreenFlash())}catch(r){null==(t=this.resolvePromise)||t.call(this,{success:!1,frontImage:null,backImage:null,error:"Não foi possível acessar a câmera"}),this.close()}}}stopCamera(){this.flashController&&(this.flashController.destroy(),this.flashController=null),this.stream&&(this.stream.getTracks().forEach((e=>e.stop())),this.stream=null)}startScreenFlash(){!1!==this.options.autoLighting&&(this.flashController||(this.flashController=Hi((()=>this.video)),this.flashController.start()))}async handleCapture(){var e;if(!this.video||!this.canvas)return;const n=null==(e=this.overlay)?void 0:e.querySelector(".neoface-doc-loading");n&&(n.style.display="flex");const t=this.canvas.getContext("2d");if(!t)return;const{videoWidth:o}=this.video,{videoHeight:r}=this.video,a=Math.floor(.75*o),i=Math.floor(.65*r),s=Math.floor((o-a)/2),c=Math.floor((r-i)/2);this.canvas.width=a,this.canvas.height=i,t.drawImage(this.video,s,c,a,i,0,0,a,i);try{const e=await new Promise(((e,n)=>{this.canvas.toBlob((t=>t?e(t):n(new Error("Capture failed"))),"image/jpeg",.92)}));"front"===this.currentStep?(this.frontBlob=e,this.stopCamera(),this.currentStep="preview-front",this.render()):"back"===this.currentStep&&(this.backBlob=e,this.stopCamera(),this.currentStep="preview-back",this.render())}catch(d){}finally{n&&(n.style.display="none")}}handleBack(){this.stopCamera(),"back"===this.currentStep?(this.currentStep="front",this.frontBlob=null):"front"===this.currentStep&&(this.currentStep="select",this.selectedDocument=null),this.render()}handleRetake(){"preview-front"===this.currentStep?(this.frontBlob=null,this.currentStep="front"):"preview-back"===this.currentStep&&(this.backBlob=null,this.currentStep="back"),this.render()}handleConfirm(){var e,n;const t=this.selectedDocument?Bs[this.selectedDocument]:null;"preview-front"===this.currentStep?(null==t?void 0:t.hasBack)?(this.currentStep="back",this.render()):(null==(e=this.resolvePromise)||e.call(this,{success:!0,documentType:this.selectedDocument||void 0,frontImage:this.frontBlob,backImage:null}),this.close()):"preview-back"===this.currentStep&&(null==(n=this.resolvePromise)||n.call(this,{success:!0,documentType:this.selectedDocument||void 0,frontImage:this.frontBlob,backImage:this.backBlob}),this.close())}handleCancel(){var e,n,t;null==(n=(e=this.options).onCancel)||n.call(e),null==(t=this.resolvePromise)||t.call(this,{success:!1,frontImage:null,backImage:null,error:"cancelled"}),this.close()}close(){this.stopCamera(),this._previewObjectUrl&&(URL.revokeObjectURL(this._previewObjectUrl),this._previewObjectUrl=null),this.overlay&&(this.overlay.remove(),this.overlay=null)}getStyles(){return"\n .neoface-doc-overlay {\n position: fixed;\n inset: 0;\n background: rgba(0, 0, 0, 0.85);\n backdrop-filter: blur(8px);\n display: flex;\n align-items: center;\n justify-content: center;\n z-index: 10000;\n font-family: inherit;\n padding: 16px;\n }\n \n .neoface-doc-modal {\n background: linear-gradient(145deg, #0A1320 0%, #111C2B 100%);\n border-radius: 24px;\n width: 100%;\n max-width: 520px;\n box-shadow: 0 25px 80px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(255,255,255,0.1);\n overflow: hidden;\n animation: neoface-doc-slideIn 0.3s ease;\n }\n \n @keyframes neoface-doc-slideIn {\n from { transform: translateY(20px) scale(0.98); opacity: 0; }\n to { transform: translateY(0) scale(1); opacity: 1; }\n }\n \n .neoface-doc-header {\n padding: 20px 24px;\n display: flex;\n align-items: flex-start;\n justify-content: space-between;\n border-bottom: 1px solid rgba(255, 255, 255, 0.08);\n }\n \n .neoface-doc-title {\n margin: 0 0 4px 0;\n font-size: 20px;\n font-weight: 600;\n color: #fff;\n }\n \n .neoface-doc-subtitle {\n margin: 0;\n font-size: 14px;\n color: rgba(255, 255, 255, 0.6);\n }\n \n .neoface-doc-step-indicator {\n display: flex;\n align-items: center;\n gap: 12px;\n }\n \n .neoface-doc-step-badge {\n background: linear-gradient(135deg, #0091F6, #0099cc);\n color: #fff;\n font-size: 12px;\n font-weight: 600;\n padding: 4px 10px;\n border-radius: 20px;\n }\n \n .neoface-doc-step-label {\n font-size: 16px;\n font-weight: 500;\n color: #fff;\n }\n \n .neoface-doc-close-btn {\n background: transparent;\n border: none;\n padding: 4px;\n cursor: pointer;\n color: rgba(255, 255, 255, 0.5);\n transition: all 0.2s;\n }\n \n .neoface-doc-close-btn:hover {\n color: #fff;\n }\n \n .neoface-doc-body {\n padding: 20px 24px;\n }\n \n /* Select Step */\n .neoface-doc-select-grid {\n display: flex;\n flex-direction: column;\n gap: 12px;\n }\n \n .neoface-doc-select-option {\n display: flex;\n align-items: center;\n gap: 16px;\n padding: 16px 20px;\n background: rgba(255, 255, 255, 0.05);\n border: 2px solid rgba(255, 255, 255, 0.1);\n border-radius: 14px;\n cursor: pointer;\n transition: all 0.2s;\n text-align: left;\n }\n \n .neoface-doc-select-option:hover {\n background: rgba(0, 145, 246, 0.1);\n border-color: rgba(0, 145, 246, 0.4);\n transform: translateX(4px);\n }\n \n .neoface-doc-select-icon {\n display: flex;\n align-items: center;\n justify-content: center;\n width: 44px;\n height: 44px;\n background: rgba(0, 145, 246, 0.15);\n border-radius: 12px;\n color: #0091F6;\n }\n \n .neoface-doc-select-icon svg {\n width: 24px;\n height: 24px;\n }\n \n .neoface-doc-select-name {\n flex: 1;\n font-size: 15px;\n font-weight: 500;\n color: #fff;\n }\n \n .neoface-doc-select-arrow {\n color: rgba(255, 255, 255, 0.4);\n transition: transform 0.2s;\n }\n \n .neoface-doc-select-option:hover .neoface-doc-select-arrow {\n color: #0091F6;\n transform: translateX(4px);\n }\n \n .neoface-doc-tips {\n margin-top: 20px;\n }\n \n .neoface-doc-tip {\n display: flex;\n align-items: center;\n justify-content: center;\n padding: 14px 16px;\n background: rgba(0, 145, 246, 0.08);\n border: 1px solid rgba(0, 145, 246, 0.15);\n border-radius: 10px;\n color: rgba(255, 255, 255, 0.8);\n font-size: 13px;\n line-height: 1;\n text-align: center;\n }\n \n .neoface-doc-tip span {\n transform: translateY(-2px);\n }\n \n .neoface-doc-tip-icon {\n color: #0091F6;\n flex-shrink: 0;\n }\n \n /* Camera — ISO/IEC 7810 ID-1 (85.60 × 53.98 mm ≈ 1.586:1) */\n .neoface-doc-camera-container {\n position: relative;\n background: #000;\n border-radius: 16px;\n overflow: hidden;\n aspect-ratio: 1.586 / 1;\n }\n \n .neoface-doc-video {\n width: 100%;\n height: 100%;\n object-fit: cover;\n }\n \n .neoface-doc-canvas {\n display: none;\n }\n \n .neoface-doc-guide {\n position: absolute;\n inset: 0;\n display: flex;\n align-items: center;\n justify-content: center;\n pointer-events: none;\n }\n \n /* Moldura Focus Frame — proporção ID-1 (1.586:1), sem borda contínua. */\n .neoface-doc-frame {\n width: 82%;\n aspect-ratio: 1.586 / 1;\n position: relative;\n border-radius: 12px;\n }\n\n .neoface-doc-corner {\n position: absolute;\n width: 28px;\n height: 28px;\n border-color: var(--nfid-action, #0059C4);\n border-style: solid;\n }\n \n .neoface-doc-corner-tl { top: -2px; left: -2px; border-width: 4px 0 0 4px; border-radius: 10px 0 0 0; }\n .neoface-doc-corner-tr { top: -2px; right: -2px; border-width: 4px 4px 0 0; border-radius: 0 10px 0 0; }\n .neoface-doc-corner-bl { bottom: -2px; left: -2px; border-width: 0 0 4px 4px; border-radius: 0 0 0 10px; }\n .neoface-doc-corner-br { bottom: -2px; right: -2px; border-width: 0 4px 4px 0; border-radius: 0 0 10px 0; }\n \n .neoface-doc-frame-label {\n position: absolute;\n bottom: -30px;\n left: 50%;\n transform: translateX(-50%);\n background: rgba(0, 0, 0, 0.7);\n color: #0091F6;\n font-size: 12px;\n font-weight: 500;\n padding: 6px 14px;\n border-radius: 20px;\n white-space: nowrap;\n }\n \n .neoface-doc-loading {\n position: absolute;\n inset: 0;\n background: rgba(0, 0, 0, 0.7);\n display: none;\n align-items: center;\n justify-content: center;\n }\n \n .neoface-doc-spinner {\n width: 48px;\n height: 48px;\n border: 4px solid rgba(255, 255, 255, 0.2);\n border-top-color: #0091F6;\n border-radius: 50%;\n animation: neoface-doc-spin 0.8s linear infinite;\n }\n \n @keyframes neoface-doc-spin {\n to { transform: rotate(360deg); }\n }\n \n .neoface-doc-instructions {\n display: flex;\n flex-direction: column;\n gap: 8px;\n margin-top: 16px;\n }\n \n .neoface-doc-instruction {\n display: flex;\n align-items: center;\n gap: 10px;\n padding: 10px 14px;\n background: rgba(255, 255, 255, 0.04);\n border-radius: 10px;\n font-size: 13px;\n color: rgba(255, 255, 255, 0.75);\n }\n \n .neoface-doc-instruction-icon {\n color: rgba(255, 255, 255, 0.5);\n flex-shrink: 0;\n }\n \n /* Preview */\n .neoface-doc-preview-single {\n display: flex;\n flex-direction: column;\n align-items: center;\n gap: 12px;\n }\n \n .neoface-doc-preview-label {\n font-size: 12px;\n font-weight: 500;\n color: rgba(255, 255, 255, 0.6);\n text-transform: uppercase;\n letter-spacing: 0.5px;\n text-align: center;\n }\n \n .neoface-doc-preview-img {\n width: 75%;\n height: auto;\n border-radius: 12px;\n border: 2px solid rgba(0, 145, 246, 0.3);\n box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);\n }\n \n .neoface-doc-preview-question {\n margin: 12px 0 4px;\n font-size: 17px;\n font-weight: 700;\n color: var(--nfid-text, #0A1320);\n text-align: center;\n }\n\n .neoface-doc-preview-hint {\n display: flex;\n align-items: center;\n gap: 10px;\n padding: 12px 16px;\n background: rgba(0, 145, 246, 0.08);\n border: 1px solid rgba(0, 145, 246, 0.15);\n border-radius: 10px;\n font-size: 13px;\n color: rgba(255, 255, 255, 0.8);\n margin-top: 8px;\n }\n\n .neoface-doc-preview-hint svg {\n color: #0091F6;\n flex-shrink: 0;\n }\n \n /* Footer */\n .neoface-doc-footer {\n padding: 16px 24px;\n display: flex;\n gap: 12px;\n justify-content: flex-end;\n border-top: 1px solid rgba(255, 255, 255, 0.08);\n }\n \n .neoface-doc-btn {\n display: flex;\n align-items: center;\n gap: 8px;\n padding: 12px 20px;\n border-radius: 12px;\n font-size: 14px;\n font-weight: 500;\n cursor: pointer;\n transition: all 0.2s;\n border: none;\n }\n \n .neoface-doc-btn-primary {\n background: linear-gradient(135deg, #0091F6 0%, #0099cc 100%);\n color: #fff;\n }\n \n .neoface-doc-btn-primary:hover {\n transform: translateY(-2px);\n box-shadow: 0 6px 20px rgba(0, 145, 246, 0.4);\n }\n \n .neoface-doc-btn-success {\n background: linear-gradient(135deg, #0E9F6E 0%, #059669 100%);\n color: #fff;\n }\n \n .neoface-doc-btn-success:hover {\n transform: translateY(-2px);\n box-shadow: 0 6px 20px rgba(16, 185, 129, 0.4);\n }\n \n .neoface-doc-btn-secondary {\n background: rgba(255, 255, 255, 0.08);\n color: rgba(255, 255, 255, 0.8);\n }\n \n .neoface-doc-btn-secondary:hover {\n background: rgba(255, 255, 255, 0.12);\n color: #fff;\n }\n \n /* Branding */\n .neoface-doc-branding {\n display: flex;\n align-items: center;\n justify-content: center;\n gap: 8px;\n padding: 16px 24px;\n border-top: 1px solid rgba(255, 255, 255, 0.06);\n }\n \n .neoface-doc-brand-icon {\n height: 22px;\n width: auto;\n }\n \n .neoface-doc-brand-name-text {\n font-size: 13px;\n font-weight: 600;\n color: rgba(255, 255, 255, 0.9);\n }\n \n .neoface-doc-brand-text {\n font-size: 12px;\n color: rgba(255, 255, 255, 0.5);\n }\n \n .neoface-doc-brand-name {\n font-size: 13px;\n font-weight: 700;\n color: #0091F6;\n letter-spacing: 1px;\n }\n \n /* Mobile */\n @media (max-width: 500px) {\n .neoface-doc-modal {\n border-radius: 20px;\n }\n \n .neoface-doc-header,\n .neoface-doc-body,\n .neoface-doc-footer {\n padding: 16px 18px;\n }\n \n .neoface-doc-preview-grid.has-back {\n grid-template-columns: 1fr;\n }\n }\n "}}const Vs=async e=>new Ws(e).open(),Zs=Object.freeze(Object.defineProperty({__proto__:null,DocumentCaptureModal:Ws,startDocumentCapture:Vs},Symbol.toStringTag,{value:"Module"})),Ks="Consentimento recusado pelo usuário.";e.BiometricCaptureModal=Xi,e.BiometricRegistrationModal=$i,e.BiometricStatusOverlay=Yi,e.ConsentModal=Ki,e.DEFAULT_CONSENT_INFO=Gi,e.DocumentCaptureModal=Ws,e.ENVIRONMENT_URLS=ha,e.EmailPasswordModal=ns,e.ErrorType=f,e.FaceCaptureModal=ci,e.FallbackPrompt=es,e.ForgotPasswordModal=bi,e.NeoFaceError=h,e.NeoFaceID=class{constructor(e){if(i(this,"appToken"),i(this,"signature"),i(this,"sessionData"),this.appToken=e.appToken,this.signature=e.signature,this.sessionData=e.sessionData,this.signature&&!this.validateSignatureFormat(this.signature))throw new h("Invalid signature format. Expected HMAC-SHA256 hex string (minimum 64 characters)",f.VALIDATION_ERROR);if(this.sessionData&&(!this.sessionData.email||!this.sessionData.cpf||!this.sessionData.sessionId))throw new h("Session data must include email, cpf, and sessionId",f.VALIDATION_ERROR)}validateSignatureFormat(e){return/^[a-f0-9]{64,}$/i.test(e)}async captureFaceFrames(e){const{numFrames:n,livenessCheck:t}=e;if(n<1||n>10)throw new h("Number of frames must be between 1 and 10",f.VALIDATION_ERROR);const o=[];try{const{captureFaceSilently:e}=await Promise.resolve().then((()=>ss));for(let r=0;r<n;r++){const a=await e();o.push(a),t&&r<n-1&&await new Promise((e=>setTimeout(e,300)))}return o}catch(r){if(r instanceof h)throw r;throw new h(`Failed to capture face frames: ${r instanceof Error?r.message:"Unknown error"}`,f.CAPTURE_ERROR)}}async loginRecognition(e){const{biometricData:n,purpose:t,confidenceThreshold:o=.8}=e,r=Array.isArray(n)?n:[n];if(0===r.length)throw new h("At least one biometric data frame is required",f.VALIDATION_ERROR);const a=r[0];try{const e=await Pa(a,this.appToken,t,o,this.signature,this.sessionData);if(!e.success)throw new h("Recognition failed",f.RECOGNITION_FAILED);if(!e.personName||!e.email||!e.cpf)throw new h("Incomplete recognition result: missing personName, email, or cpf",f.RECOGNITION_FAILED);return{success:!0,personName:e.personName,email:e.email,cpf:e.cpf,signature:e.signature,sessionId:e.sessionId,confidenceScore:e.confidenceScore,accessToken:e.accessToken}}catch(i){if(i instanceof h)throw i;throw new h(`Login recognition failed: ${i instanceof Error?i.message:"Unknown error"}`,f.RECOGNITION_FAILED)}}async registerApplication(e,n,t){try{return await Wa(e,n,t)}catch(o){if(o instanceof h)throw o;throw new h(`Application registration failed: ${o instanceof Error?o.message:"Unknown error"}`,f.VALIDATION_ERROR)}}async registerDocumentByImage(e,n,t={}){const{DocumentCaptureModal:o}=await Promise.resolve().then((()=>Zs)),r=new o({useBackCamera:t.useBackCamera??!0,preSelectedDocument:t.preSelectedDocument}),a=await r.open();if(!a.success||!a.frontImage)throw new h("cancelled"===a.error?"Document capture was cancelled by the user":`Document capture failed: ${a.error??"unknown error"}`,f.CAPTURE_ERROR);const i=[a.frontImage];return a.backImage&&i.push(a.backImage),Ga(e,n,i)}async proofOfLife(e={}){const{videoDurationMs:n=3e3,maxPollingAttempts:t=60,pollingIntervalMs:o=1e3,onRecordingProgress:r,onTaskStatusChange:a}=e;try{const e=await Va({durationMs:n,onProgress:r}),i=await Ja(e),s=await Ka(i,this.appToken);a&&a("processing",0);const c=await Za(s.taskId,this.appToken,{maxAttempts:t,intervalMs:o,onStatusChange:a});return c&&c.success?{success:!0,isLive:c.is_live||!1,livenessScore:c.liveness_score||0,faceRecognitionScore:c.face_recognition_score||0,combinedConfidence:c.combined_confidence||0,personId:c.person_id,personalData:c.personal_data||[],processingTime:c.processing_time||0,historyId:s.historyId,taskId:s.taskId,message:"Proof of life verification successful"}:{success:!1,isLive:(null==c?void 0:c.is_live)||!1,livenessScore:(null==c?void 0:c.liveness_score)||0,faceRecognitionScore:(null==c?void 0:c.face_recognition_score)||0,combinedConfidence:(null==c?void 0:c.combined_confidence)||0,personId:null==c?void 0:c.person_id,personalData:(null==c?void 0:c.personal_data)||[],processingTime:(null==c?void 0:c.processing_time)||0,historyId:s.historyId,taskId:s.taskId,error:(null==c?void 0:c.error)||"Verification failed",message:(null==c?void 0:c.message)||"Proof of life verification failed"}}catch(i){if(i instanceof h)throw i;throw new h(`Proof of life failed: ${i instanceof Error?i.message:"Unknown error"}`,f.RECOGNITION_FAILED)}}},e.RELEASE_DATE="2026-09-09",e.VERSION=Pi,e.authorize=async function(e){if(!(await Ji({appName:e.appName,flow:"verification"})))return void(e.onError&&e.onError(new h("Consentimento recusado",f.CONSENT_DENIED)));const n=document.createElement("div");n.id="neofaceid-authorize-container",document.body.appendChild(n);const r=t.createRoot(n);r.render(o.jsx(Us,{...e,onClose:()=>{r.unmount(),document.body.contains(n)&&document.body.removeChild(n)}}))},e.authorizeOperation=async(e,n,t)=>{if(!e)throw new h("Application token is required",f.VALIDATION_ERROR);if(!n)throw new h("CPF is required",f.VALIDATION_ERROR);const o=n.replace(/\D/g,"");if(11!==o.length)throw new h("Invalid CPF format",f.VALIDATION_ERROR);const r=[],a=(null==t?void 0:t.captureDelay)||2e3;if(!(await Ji({appName:null==t?void 0:t.appName,flow:"verification"})))throw new h("Consentimento recusado pelo usuário.",f.CONSENT_DENIED);try{if(!navigator.mediaDevices||!navigator.mediaDevices.getUserMedia)throw new h("Camera not available",f.NO_CAMERA);const n=await navigator.mediaDevices.getUserMedia({video:{facingMode:"user",width:{ideal:1280},height:{ideal:720}}}),i=document.createElement("video");i.srcObject=n,i.autoplay=!0,i.playsInline=!0,await new Promise((e=>{i.onloadedmetadata=()=>{i.play(),e()}}));const s=document.createElement("canvas");s.width=i.videoWidth,s.height=i.videoHeight;const c=s.getContext("2d");if(!c)throw new h("Failed to get canvas context",f.CAPTURE_ERROR);for(let e=0;e<4;e++){const n=xs[e];(null==t?void 0:t.onProgress)&&t.onProgress(e+1,4,n),e>0&&await new Promise((e=>setTimeout(e,a))),c.drawImage(i,0,0,s.width,s.height);const o=await new Promise(((e,n)=>{s.toBlob((t=>{t?e(t):n(new Error("Failed to capture photo"))}),"image/jpeg",.9)}));r.push(o),(null==t?void 0:t.onPhotoTaken)&&t.onPhotoTaken(e+1,o)}n.getTracks().forEach((e=>e.stop()));const d=r[3],l={cpf:o,email:"",sessionId:`auth_${Date.now()}_${Math.random().toString(36).substring(7)}`},u=await Pa(d,e,"AUTHORIZATION",.8,void 0,l);if(!u.success)throw r.length=0,new h("Authorization failed: Person not recognized",f.RECOGNITION_FAILED);return r.length=0,{success:!0,authorizationHash:l.sessionId,name:u.personName,birthDate:void 0,cpf:u.cpf||o,confidenceScore:u.confidenceScore,message:"Authorization successful"}}catch(i){if(i instanceof h)throw i;if(i instanceof Error)throw new h(i.message,f.CAPTURE_ERROR);throw new h("Unknown error during authorization",f.UNKNOWN)}},e.checkUserExistence=La,e.clearConsentTrail=function(){try{"undefined"!=typeof window&&window.localStorage&&window.localStorage.removeItem(Di)}catch{}},e.completeOnboarding=Ca,e.completeOnboardingWithData=za,e.confirmPasswordReset=Qa,e.detectBiometricType=ds,e.getAccent=function(){return ga.accent},e.getAppName=wa,e.getApplicationToken=function(){return ga.applicationToken},e.getBaseUrl=ba,e.getCachedCaptureSession=function(){return ms},e.getConfig=function(){return{...ga}},e.getConsent=xa,e.getConsentTrail=Li,e.getEnvironment=function(){return ga.environment},e.getLocale=ya,e.getRadius=function(){return ga.radius},e.getResolvedThemeMode=function(){var e;return(null==(e=ga.resolvedTheme)?void 0:e.mode)??("dark"===ga.theme?"dark":"light")},e.getTheme=function(){return ga.theme},e.identifyPerson=Ua,e.identifyPersonAsync=Xa,e.init=function(e={}){const{environment:n,baseUrl:t,applicationToken:o,appName:r,accent:a,radius:i,theme:c,locale:d,consent:l}=e;if(l?ga.consent=l:(ga.consent={...fa},va||(va=!0)),t)ga.baseUrl=t,ga.environment="custom";else if(n)ha[n]?(ga.baseUrl=ha[n],ga.environment=n):(ga.baseUrl=ha.sandbox,ga.environment="sandbox");else{const e=void 0!=={url:"undefined"==typeof document&&"undefined"==typeof location?require("url").pathToFileURL(__filename).href:"undefined"==typeof document?location.href:s&&"SCRIPT"===s.tagName.toUpperCase()&&s.src||new URL("neoface-id-sdk.umd.js",document.baseURI).href}&&(null==pa?void 0:pa.VITE_API_BASE_URL);e&&(ga.baseUrl=e,ga.environment="custom")}o&&(ga.applicationToken=o),r&&r.trim()&&(ga.appName=r.trim()),void 0!==i&&(ma.includes(i)?ga.radius=i:ga.radius=16),c&&(ga.theme=c),d&&(ga.locale=d),void 0!==a&&(ga.accent=a);const u=Gr({accent:ga.accent??void 0,radius:ga.radius,theme:ga.theme});ga.resolvedTheme=u,la({accent:ga.accent??void 0,radius:ga.radius,theme:ga.theme}),ga.initialized=!0},e.initializeBiometricDetection=ps,e.isAdvancedDetectionAvailable=fs,e.isInitialized=function(){return ga.initialized},e.loginWithBiometric=Aa,e.loginWithEmail=qa,e.openCaptureSession=vs,e.preloadFaceDetectionModels=rs,e.recognize=ja,e.recognizeBiometric=Fa,e.recognizeByPurpose=Pa,e.recordConsent=Mi,e.registerBiometric=Ba,e.registerPersonWithBiometric=Ma,e.registerPersonWithoutFace=Da,e.requestConsent=Ji,e.requestLivenessChallenge=bs,e.requestLivenessChallengeWithSession=async function({applicationToken:e,purpose:n,sessionId:t}){let o=t??(await vs({applicationToken:e,purpose:n})).session_id;try{return await bs({sessionId:o,applicationToken:e})}catch(r){if(r instanceof h&&r.message.includes("410"))return gs(),o=(await vs({applicationToken:e,purpose:n})).session_id,bs({sessionId:o,applicationToken:e});throw r}},e.requestPasswordReset=Ya,e.resetCaptureSession=gs,e.runLivenessChallenge=ws,e.simpleIdentification=$a,e.start=function(e,o,r){Ji({appName:null==r?void 0:r.appName,flow:"verification"}).then((a=>{if(!a)return void o.onError("CONSENT_DENIED",Ks);const i=document.createElement("div");i.id="neoface-modal-container",document.body.appendChild(i);const s=()=>{document.body.contains(i)&&document.body.removeChild(i)};Oa(e).then((()=>{const a=n.createElement(ci,{accessToken:e,onClose:s,onSuccess:e=>{s(),o.onSuccess({name:e.data.faceId,email:e.data.faceId,documentId:e.data.faceId})},onCannotGesture:null==r?void 0:r.onCannotGesture});t.createRoot(i).render(a)})).catch((e=>{s(),o.onError("TOKEN_VALIDATION_ERROR",e.message||"Failed to validate token")}))}))},e.startAutoLogin=async function(e){if(await Ji({appName:e.appName,flow:"verification"}))try{const n={mode:"auto",onSuccess:async(n,t)=>{try{const t=await fetch(n).then((e=>e.blob())),o=await Aa(t,e.applicationToken);e.onSuccess(o)}catch(o){e.onError(o)}},onError:e.onError,onCancel:e.onCancel,countdown:e.countdown,title:e.title||"Login Biométrico",subtitle:e.subtitle||"Posicione seu rosto ou mão dentro do quadro para login automático."},t=new Xi(n);await t.open()}catch(n){e.onError(new h(`Erro ao inicializar login automático: ${n.message}`,f.INITIALIZATION_ERROR))}else e.onError(new h(cs,f.CONSENT_DENIED))},e.startBiometricRegistration=function(e,o,r,a){Ji({appName:null==a?void 0:a.appName,flow:"registration"}).then((i=>{if(!i)return void r.onError("CONSENT_DENIED",Ks);const s=document.createElement("div");s.id="neoface-biometric-registration-container",document.body.appendChild(s);let c=null;const d=()=>{c&&(c.unmount(),c=null),document.body.contains(s)&&document.body.removeChild(s)};Oa(o).then((()=>{const i=n.createElement($i,{personData:e,applicationToken:o,useRealApi:(null==a?void 0:a.useRealApi)??!0,onClose:d,onSuccess:e=>{d(),r.onSuccess(e)},onError:e=>{d(),r.onError("BIOMETRIC_REGISTRATION_ERROR",e)},onCannotGesture:null==a?void 0:a.onCannotGesture});c=t.createRoot(s),c.render(i)})).catch((e=>{d(),r.onError("TOKEN_VALIDATION_ERROR",e.message||"Failed to validate token")}))}))},e.startDocumentCapture=Vs,e.startFaceLogin=async function(e){if(await Ji({appName:e.appName,flow:"verification"}))try{await is({applicationToken:e.applicationToken,onSuccess:e.onSuccess,onError:e.onError,onFallbackRequest:e.onFallbackRequest||(()=>{const n={applicationToken:e.applicationToken,onSuccess:e.onSuccess,onError:e.onError,title:"Login Alternativo",subtitle:"Biometria não reconhecida. Por favor, informe email e senha."};new ns(n).open()}),onCancel:e.onCancel})}catch(n){e.onError(new h(`Erro ao inicializar login facial: ${n.message}`,f.INITIALIZATION_ERROR))}else e.onError(new h(cs,f.CONSENT_DENIED))},e.startHandLogin=async function(e){if(await Ji({appName:e.appName,flow:"verification"}))try{const n={mode:"hand",onSuccess:async(n,t)=>{try{const t=await fetch(n).then((e=>e.blob())),o=await Aa(t,e.applicationToken);e.onSuccess(o)}catch(o){e.onError(o)}},onError:e.onError,onCancel:e.onCancel,countdown:e.countdown,title:e.title||"Login por Mão",subtitle:e.subtitle||"Posicione sua mão dentro do quadro para fazer login."},t=new Xi(n);await t.open()}catch(n){e.onError(new h(`Erro ao inicializar login por mão: ${n.message}`,f.INITIALIZATION_ERROR))}else e.onError(new h(cs,f.CONSENT_DENIED))},e.startLivenessCapture=function(e,o,r){Ji({appName:null==r?void 0:r.appName,flow:"verification"}).then((a=>{if(!a)return void o.onError("CONSENT_DENIED",Ks);const i=document.createElement("div");i.id="neoface-liveness-capture-container",document.body.appendChild(i);let s=!1,c=null;const d=()=>{c&&(c.unmount(),c=null),document.body.contains(i)&&document.body.removeChild(i)},l=()=>{d(),!s&&o.onCancel&&o.onCancel()};Oa(e).then((()=>{const a=n.createElement($i,{applicationToken:e,onClose:l,onPhotosCaptured:e=>{s=!0,o.onSuccess(e)},onError:e=>{d(),o.onError("LIVENESS_CAPTURE_ERROR",e)},onCannotGesture:null==r?void 0:r.onCannotGesture});c=t.createRoot(i),c.render(a)})).catch((e=>{d(),o.onError("TOKEN_VALIDATION_ERROR",e.message||"Failed to validate token")}))}))},e.startOnboarding=async e=>{const{applicationToken:n,onboardingToken:t,countdown:o,title:r,subtitle:a,onSuccess:i,onError:s}=e;try{if(!(await Ji({appName:e.appName,flow:"registration"})))return void s(new h("Consentimento recusado pelo usuário.",f.CONSENT_DENIED));const c=await Sa(n,t);if(!(null==c?void 0:c.is_valid))throw new h("Link de onboarding inválido ou expirado",f.VALIDATION_ERROR);const d=new ys({countdown:o,title:r,subtitle:a}),{face:l,document:u}=await d.open();i({...await Ca(n,t,l,u),details:c})}catch(c){if(c instanceof h)return void s(c);const e=(null==c?void 0:c.message)||"Erro desconhecido no onboarding";s(new h(e,f.UNKNOWN))}},e.submitLivenessChallenge=async function({challengeId:e,sessionId:n,applicationToken:t,gestures:o}){if(!t)throw new h("applicationToken é obrigatório para submeter desafio",f.INVALID_TOKEN);if(!n)throw new h("session_id é obrigatório para submeter desafio",f.VALIDATION_ERROR);if(!Array.isArray(o)||0===o.length)throw new h("gestures[] vazio — nada para submeter",f.VALIDATION_ERROR);const r=e?`${encodeURIComponent(e)}/submit/`:"submit/",a=`${ba()}/api/v1/auth/liveness/challenge/${r}`;let i;try{i=await fetch(a,{method:"POST",headers:{"Content-Type":"application/json","X-App-Token":t},body:JSON.stringify({session_id:n,gestures:o})})}catch(d){const e=d instanceof Error?d.message:"Erro de rede";throw new h(`Falha de rede ao submeter desafio: ${e}`,f.NETWORK)}if(401===i.status||403===i.status)throw new h("Token de aplicação inválido ou expirado",f.INVALID_TOKEN);if(410===i.status)throw new h("Sessão ou desafio expirado (410) — reabrir sessão",f.API_ERROR);if(!i.ok)throw new h(`Falha ao submeter desafio de liveness (${i.status})`,f.API_ERROR);const s=await i.json().catch((()=>null)),c=(null==s?void 0:s.data)??s??{};return{success:(null==c?void 0:c.success)??!0,liveness_passed:null==c?void 0:c.liveness_passed,score:null==c?void 0:c.score,raw:s}},e.validateOnboardingToken=Ia,e.validateToken=Oa,e.withCaptureSession=async function(e,n){const t=ms??await vs(e);try{return await n(t.session_id)}catch(o){if(o instanceof h&&o.message.includes("410")){gs();return n((await vs(e)).session_id)}throw o}},e.withSessionId=function(e){const n=ms;return n?{...e,session_id:n.session_id}:e},Object.defineProperty(e,Symbol.toStringTag,{value:"Module"})}));
|