@neofaceid/web-sdk 2.0.0 → 2.1.0
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 +5 -3
- package/dist/neoface-id-sdk.es.js +114 -16
- package/dist/neoface-id-sdk.umd.js +1 -1
- package/package.json +5 -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.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 x={};function b(e){return x}function w(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 y(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 N=Symbol("evaluating");function T(e,n,t){let o;Object.defineProperty(e,n,{get(){if(o!==N)return void 0===o&&(o=N,o=t()),o},set(t){Object.defineProperty(e,n,{value:t})},configurable:!0})}function C(e,n,t){Object.defineProperty(e,n,{value:t,writable:!0,enumerable:!0,configurable:!0})}function S(...e){const n={};for(const t of e){const e=Object.getOwnPropertyDescriptors(t);Object.assign(n,e)}return Object.defineProperties({},n)}function j(e){return JSON.stringify(e)}const O="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function R(e){return"object"==typeof e&&null!==e&&!Array.isArray(e)}const I=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 z(e){if(!1===R(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!==R(t)&&!1!==Object.prototype.hasOwnProperty.call(t,"isPrototypeOf")}function A(e){return z(e)?{...e}:Array.isArray(e)?[...e]:e}const F=new Set(["string","number","symbol"]);function P(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function $(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 L(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 D={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 B(e,n){return n.map((n=>{var t;return(t=n).path??(t.path=[]),n.path.unshift(e),n}))}function q(e){return"string"==typeof e?e:null==e?void 0:e.message}function U(e,n,t){var o,r,a,i,s,c;const d={...e,path:e.path??[]};if(!e.message){const l=q(null==(a=null==(r=null==(o=e.inst)?void 0:o._zod.def)?void 0:r.error)?void 0:a.call(r,e))??q(null==(i=null==n?void 0:n.error)?void 0:i.call(n,e))??q(null==(s=t.customError)?void 0:s.call(t,e))??q(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 K(...e){const[n,t,o]=e;return"string"==typeof n?{message:n,code:"custom",input:t,inst:o}:{...n}}const V=(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,y,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},Z=m("$ZodError",V),J=m("$ZodError",V,{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=>U(e,a,b()))));throw O(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=>U(e,a,b()))));throw O(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??Z)(a.issues.map((e=>U(e,r,b()))))}:{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=>U(e,r,b()))))}:{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)$/,xe=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/;const be=/^(?:(?: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])$/,we=/^(([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}|:))$/,ye=/^((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_-]*$/,Ne=/^\+[1-9]\d{6,14}$/,Te="(?:(?:\\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])))",Ce=new RegExp(`^${Te}$`);function Se(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 je=/^-?\d+$/,Oe=/^-?\d+(?:\.\d+)?$/,Re=/^(?:true|false)$/i,Ie=/^[^A-Z]*$/,ze=/^[^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"},Pe=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})}})),$e=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})}})),Le=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})}})),De=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]=D[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=je)})),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})}})),Be=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})}})),qe=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})}})),Ue=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)=>{Ue.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})}})),Ke=m("$ZodCheckLowerCase",((e,n)=>{n.pattern??(n.pattern=Ie),Ue.init(e,n)})),Ve=m("$ZodCheckUpperCase",((e,n)=>{n.pattern??(n.pattern=ze),Ue.init(e,n)})),Ze=m("$ZodCheckIncludes",((e,n)=>{Ae.init(e,n);const t=P(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(`^${P(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(`.*${P(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)}}T(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)=>{Ue.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=xe),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=Se({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(`^${Te}T(?:${o})$`)}(n)),nn.init(e,n)})),mn=m("$ZodISODate",((e,n)=>{n.pattern??(n.pattern=Ce),nn.init(e,n)})),gn=m("$ZodISOTime",((e,n)=>{n.pattern??(n.pattern=new RegExp(`^${Se(n)}$`)),nn.init(e,n)})),vn=m("$ZodISODuration",((e,n)=>{n.pattern??(n.pattern=me),nn.init(e,n)})),xn=m("$ZodIPv4",((e,n)=>{n.pattern??(n.pattern=be),nn.init(e,n),e._zod.bag.format="ipv4"})),bn=m("$ZodIPv6",((e,n)=>{n.pattern??(n.pattern=we),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})}}})),wn=m("$ZodCIDRv4",((e,n)=>{n.pattern??(n.pattern=ye),nn.init(e,n)})),yn=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})}})),Nn=m("$ZodE164",((e,n)=>{n.pattern??(n.pattern=Ne),nn.init(e,n)}));const Tn=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})}})),Cn=m("$ZodNumber",((e,n)=>{Qe.init(e,n),e._zod.pattern=e._zod.bag.pattern??Oe,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}})),Sn=m("$ZodNumberFormat",((e,n)=>{De.init(e,n),Cn.init(e,n)})),jn=m("$ZodBoolean",((e,n)=>{Qe.init(e,n),e._zod.pattern=Re,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}})),On=m("$ZodAny",((e,n)=>{Qe.init(e,n),e._zod.parse=e=>e})),Rn=m("$ZodUnknown",((e,n)=>{Qe.init(e,n),e._zod.parse=e=>e})),In=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 zn(e,n,t){e.issues.length&&n.issues.push(...B(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=>zn(n,t,e)))):zn(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(...B(t,e.issues))}void 0===e.value?t in o&&(n.value[t]=void 0):n.value[t]=e.value}function Pn(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 $n(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 Ln=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((()=>Pn(n)));T(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=R,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?$n(c,s,n,t,o.value,e):c.length?Promise.all(c).then((()=>n)):n}})),Dn=m("$ZodObjectJIT",((e,n)=>{Ln.init(e,n);const t=e._zod.parse,o=k((()=>Pn(n)));let r;const a=R,i=!x.jitless,s=i&&I.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=j(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=j(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?$n([],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=>U(e,o,b())))))}),n)}const Bn=m("$ZodUnion",((e,n)=>{Qe.init(e,n),T(e._zod,"optin",(()=>n.options.some((e=>"optional"===e._zod.optin))?"optional":void 0)),T(e._zod,"optout",(()=>n.options.some((e=>"optional"===e._zod.optout))?"optional":void 0)),T(e._zod,"values",(()=>{if(n.options.every((e=>e._zod.values)))return new Set(n.options.flatMap((e=>Array.from(e._zod.values))))})),T(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)}})),qn=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 Un(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(z(e)&&z(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=Un(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=Un(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=Un(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 Kn=m("$ZodEnum",((e,n)=>{Qe.init(e,n);const t=w(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?P(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}})),Vn=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 Zn(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",T(e._zod,"values",(()=>n.innerType._zod.values?new Set([...n.innerType._zod.values,void 0]):void 0)),T(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=>Zn(n,e.value))):Zn(o,e.value)}return void 0===e.value?e:n.innerType._zod.run(e,t)}})),Gn=m("$ZodExactOptional",((e,n)=>{Jn.init(e,n),T(e._zod,"values",(()=>n.innerType._zod.values)),T(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),T(e._zod,"optin",(()=>n.innerType._zod.optin)),T(e._zod,"optout",(()=>n.innerType._zod.optout)),T(e._zod,"pattern",(()=>{const e=n.innerType._zod.pattern;return e?new RegExp(`^(${_(e.source)}|null)$`):void 0})),T(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",T(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",T(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),T(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),T(e._zod,"optin",(()=>n.innerType._zod.optin)),T(e._zod,"optout",(()=>n.innerType._zod.optout)),T(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=>U(e,t,b())))},input:e.value}),e.issues=[]),e))):(e.value=o.value,o.issues.length&&(e.value=n.catchValue({...e,error:{issues:o.issues.map((e=>U(e,t,b())))},input:e.value}),e.issues=[]),e)}})),ot=m("$ZodPipe",((e,n)=>{Qe.init(e,n),T(e._zod,"values",(()=>n.in._zod.values)),T(e._zod,"optin",(()=>n.in._zod.optin)),T(e._zod,"optout",(()=>n.out._zod.optout)),T(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),T(e._zod,"propValues",(()=>n.innerType._zod.propValues)),T(e._zod,"values",(()=>n.innerType._zod.values)),T(e._zod,"optin",(()=>{var e,t;return null==(t=null==(e=n.innerType)?void 0:e._zod)?void 0:t.optin})),T(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(K(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",...L(n)})}function ft(e,n){return new e({type:"string",format:"email",check:"string_format",abort:!1,...L(n)})}function ht(e,n){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...L(n)})}function mt(e,n){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...L(n)})}function gt(e,n){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...L(n)})}function vt(e,n){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...L(n)})}function xt(e,n){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...L(n)})}function bt(e,n){return new e({type:"string",format:"url",check:"string_format",abort:!1,...L(n)})}function wt(e,n){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...L(n)})}function yt(e,n){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...L(n)})}function kt(e,n){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...L(n)})}function Et(e,n){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...L(n)})}function _t(e,n){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...L(n)})}function Nt(e,n){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...L(n)})}function Tt(e,n){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...L(n)})}function Ct(e,n){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...L(n)})}function St(e,n){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...L(n)})}function jt(e,n){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...L(n)})}function Ot(e,n){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...L(n)})}function Rt(e,n){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...L(n)})}function It(e,n){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...L(n)})}function zt(e,n){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...L(n)})}function At(e,n){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...L(n)})}function Ft(e,n){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...L(n)})}function Pt(e,n){return new e({type:"string",format:"date",check:"string_format",...L(n)})}function $t(e,n){return new e({type:"string",format:"time",check:"string_format",precision:null,...L(n)})}function Lt(e,n){return new e({type:"string",format:"duration",check:"string_format",...L(n)})}function Dt(e,n){return new e({type:"number",checks:[],...L(n)})}function Mt(e,n){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...L(n)})}function Bt(e,n){return new e({type:"boolean",...L(n)})}function qt(e){return new e({type:"any"})}function Ut(e){return new e({type:"unknown"})}function Wt(e,n){return new e({type:"never",...L(n)})}function Kt(e,n){return new Pe({check:"less_than",...L(n),value:e,inclusive:!1})}function Vt(e,n){return new Pe({check:"less_than",...L(n),value:e,inclusive:!0})}function Zt(e,n){return new $e({check:"greater_than",...L(n),value:e,inclusive:!1})}function Jt(e,n){return new $e({check:"greater_than",...L(n),value:e,inclusive:!0})}function Gt(e,n){return new Le({check:"multiple_of",...L(n),value:e})}function Ht(e,n){return new Me({check:"max_length",...L(n),maximum:e})}function Xt(e,n){return new Be({check:"min_length",...L(n),minimum:e})}function Yt(e,n){return new qe({check:"length_equals",...L(n),length:e})}function Qt(e,n){return new We({check:"string_format",format:"regex",...L(n),pattern:e})}function eo(e){return new Ke({check:"string_format",format:"lowercase",...L(e)})}function no(e){return new Ve({check:"string_format",format:"uppercase",...L(e)})}function to(e,n){return new Ze({check:"string_format",format:"includes",...L(n),includes:e})}function oo(e,n){return new Je({check:"string_format",format:"starts_with",...L(n),prefix:e})}function ro(e,n){return new Ge({check:"string_format",format:"ends_with",...L(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,...L(t)})}function fo(e,n,t){return new e({type:"custom",check:"custom",fn:n,...L(t)})}function ho(e){const n=mo((t=>(t.addIssue=e=>{if("string"==typeof e)t.issues.push(K(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(K(o))}},e(t.value,t))));return n}function mo(e,n){const t=new Ae({check:"custom",...L(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&&wo(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 xo(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 bo(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:yo(n,"input",e.processors),output:yo(n,"output",e.processors)}},enumerable:!1,writable:!1}),t}catch(d){throw new Error("Error converting schema to JSON.")}}function wo(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 wo(o.element,t);if("set"===o.type)return wo(o.valueType,t);if("lazy"===o.type)return wo(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 wo(o.innerType,t);if("intersection"===o.type)return wo(o.left,t)||wo(o.right,t);if("record"===o.type||"map"===o.type)return wo(o.keyType,t)||wo(o.valueType,t);if("pipe"===o.type)return wo(o.in,t)||wo(o.out,t);if("object"===o.type){for(const e in o.shape)if(wo(o.shape[e],t))return!0;return!1}if("union"===o.type){for(const e of o.options)if(wo(e,t))return!0;return!1}if("tuple"===o.type){for(const e of o.items)if(wo(e,t))return!0;return!(!o.rest||!wo(o.rest,t))}return!1}const yo=(e,n,t={})=>o=>{const{libraryOptions:r,target:a}=o??{},i=go({...r??{},target:a,io:n,processors:t});return vo(e,i),xo(i,e),bo(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),Ko.init(e,n)}));const No=m("ZodISODate",((e,n)=>{mn.init(e,n),Ko.init(e,n)}));const To=m("ZodISOTime",((e,n)=>{gn.init(e,n),Ko.init(e,n)}));const Co=m("ZodISODuration",((e,n)=>{vn.init(e,n),Ko.init(e,n)}));const So=m("ZodError",((e,n)=>{Z.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,y,2)}},addIssues:{value:n=>{e.issues.push(...n),e.message=JSON.stringify(e.issues,y,2)}},isEmpty:{get:()=>0===e.issues.length}})}),{Parent:Error}),jo=G(So),Oo=H(So),Ro=X(So),Io=Q(So),zo=ne(So),Ao=te(So),Fo=oe(So),Po=re(So),$o=ae(So),Lo=ie(So),Do=se(So),Mo=ce(So),Bo=m("ZodType",((e,n)=>(Qe.init(e,n),Object.assign(e["~standard"],{jsonSchema:{input:yo(e,"input"),output:yo(e,"output")}}),e.toJSONSchema=((e,n={})=>t=>{const o=go({...t,processors:n});return vo(e,o),xo(o,e),bo(o,e)})(e,{}),e.def=n,e.type=n.type,Object.defineProperty(e,"_def",{value:n}),e.check=(...t)=>e.clone(S(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)=>$(e,n,t),e.brand=()=>e,e.register=(n,t)=>(n.add(e,t),e),e.parse=(n,t)=>jo(e,n,t,{callee:e.parse}),e.safeParse=(n,t)=>Ro(e,n,t),e.parseAsync=async(n,t)=>Oo(e,n,t,{callee:e.parseAsync}),e.safeParseAsync=async(n,t)=>Io(e,n,t),e.spa=e.safeParseAsync,e.encode=(n,t)=>zo(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)=>Po(e,n,t),e.safeEncode=(n,t)=>$o(e,n,t),e.safeDecode=(n,t)=>Lo(e,n,t),e.safeEncodeAsync=async(n,t)=>Do(e,n,t),e.safeDecodeAsync=async(n,t)=>Mo(e,n,t),e.refine=(n,t)=>e.check(function(e,n={}){return fo(Mr,e,n)}(n,t)),e.superRefine=n=>e.check(ho(n)),e.overwrite=n=>e.check(ao(n)),e.optional=()=>jr(e),e.exactOptional=()=>new Or({type:"optional",innerType:e}),e.nullable=()=>Ir(e),e.nullish=()=>jr(Ir(e)),e.nonoptional=n=>function(e,n){return new Fr({type:"nonoptional",innerType:e,...L(n)})}(e,n),e.array=()=>{return po(wr,e,n);var n},e.or=n=>{return new Er({type:"union",options:[e,n],...L(t)});var t},e.and=n=>new _r({type:"intersection",left:e,right:n}),e.transform=n=>Lr(e,new Cr({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 Ar({type:"prefault",innerType:e,get defaultValue(){return"function"==typeof t?t():A(t)}});var t},e.catch=n=>{return new Pr({type:"catch",innerType:e,catchValue:"function"==typeof(t=n)?t:()=>t});var t},e.pipe=n=>Lr(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))),qo=m("_ZodString",((e,n)=>{en.init(e,n),Bo.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())})),Uo=m("ZodString",((e,n)=>{en.init(e,n),qo.init(e,n),e.email=n=>e.check(ft(Vo,n)),e.url=n=>e.check(bt(Go,n)),e.jwt=n=>e.check(At(lr,n)),e.emoji=n=>e.check(wt(Ho,n)),e.guid=n=>e.check(ht(Zo,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(xt(Jo,n)),e.nanoid=n=>e.check(yt(Xo,n)),e.guid=n=>e.check(ht(Zo,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(Rt(sr,n)),e.base64url=n=>e.check(It(cr,n)),e.xid=n=>e.check(Nt(nr,n)),e.ksuid=n=>e.check(Tt(tr,n)),e.ipv4=n=>e.check(Ct(or,n)),e.ipv6=n=>e.check(St(rr,n)),e.cidrv4=n=>e.check(jt(ar,n)),e.cidrv6=n=>e.check(Ot(ir,n)),e.e164=n=>e.check(zt(dr,n)),e.datetime=n=>e.check(function(e){return Ft(_o,e)}(n)),e.date=n=>e.check(function(e){return Pt(No,e)}(n)),e.time=n=>e.check(function(e){return $t(To,e)}(n)),e.duration=n=>e.check(function(e){return Lt(Co,e)}(n))}));function Wo(e){return pt(Uo,e)}const Ko=m("ZodStringFormat",((e,n)=>{nn.init(e,n),qo.init(e,n)})),Vo=m("ZodEmail",((e,n)=>{rn.init(e,n),Ko.init(e,n)})),Zo=m("ZodGUID",((e,n)=>{tn.init(e,n),Ko.init(e,n)})),Jo=m("ZodUUID",((e,n)=>{on.init(e,n),Ko.init(e,n)})),Go=m("ZodURL",((e,n)=>{an.init(e,n),Ko.init(e,n)})),Ho=m("ZodEmoji",((e,n)=>{sn.init(e,n),Ko.init(e,n)})),Xo=m("ZodNanoID",((e,n)=>{cn.init(e,n),Ko.init(e,n)})),Yo=m("ZodCUID",((e,n)=>{dn.init(e,n),Ko.init(e,n)})),Qo=m("ZodCUID2",((e,n)=>{ln.init(e,n),Ko.init(e,n)})),er=m("ZodULID",((e,n)=>{un.init(e,n),Ko.init(e,n)})),nr=m("ZodXID",((e,n)=>{pn.init(e,n),Ko.init(e,n)})),tr=m("ZodKSUID",((e,n)=>{fn.init(e,n),Ko.init(e,n)})),or=m("ZodIPv4",((e,n)=>{xn.init(e,n),Ko.init(e,n)})),rr=m("ZodIPv6",((e,n)=>{bn.init(e,n),Ko.init(e,n)})),ar=m("ZodCIDRv4",((e,n)=>{wn.init(e,n),Ko.init(e,n)})),ir=m("ZodCIDRv6",((e,n)=>{yn.init(e,n),Ko.init(e,n)})),sr=m("ZodBase64",((e,n)=>{En.init(e,n),Ko.init(e,n)})),cr=m("ZodBase64URL",((e,n)=>{_n.init(e,n),Ko.init(e,n)})),dr=m("ZodE164",((e,n)=>{Nn.init(e,n),Ko.init(e,n)})),lr=m("ZodJWT",((e,n)=>{Tn.init(e,n),Ko.init(e,n)})),ur=m("ZodNumber",((e,n)=>{Cn.init(e,n),Bo.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(Zt(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(Kt(n,t)),e.lte=(n,t)=>e.check(Vt(n,t)),e.max=(n,t)=>e.check(Vt(n,t)),e.int=n=>e.check(fr(n)),e.safe=n=>e.check(fr(n)),e.positive=n=>e.check(Zt(0,n)),e.nonnegative=n=>e.check(Jt(0,n)),e.negative=n=>e.check(Kt(0,n)),e.nonpositive=n=>e.check(Vt(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)=>{Sn.init(e,n),ur.init(e,n)}));function fr(e){return Mt(pr,e)}const hr=m("ZodBoolean",((e,n)=>{jn.init(e,n),Bo.init(e,n),e._zod.processJSONSchema=(e,n,t)=>((e,n,t)=>{t.type="boolean"})(0,0,n)}));function mr(e){return Bt(hr,e)}const gr=m("ZodAny",((e,n)=>{On.init(e,n),Bo.init(e,n),e._zod.processJSONSchema=(e,n,t)=>{}}));const vr=m("ZodUnknown",((e,n)=>{Rn.init(e,n),Bo.init(e,n),e._zod.processJSONSchema=(e,n,t)=>{}}));function xr(){return Ut(vr)}const br=m("ZodNever",((e,n)=>{In.init(e,n),Bo.init(e,n),e._zod.processJSONSchema=(e,n,t)=>((e,n,t)=>{t.not={}})(0,0,n)}));const wr=m("ZodArray",((e,n)=>{An.init(e,n),Bo.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 yr=m("ZodObject",((e,n)=>{Dn.init(e,n),Bo.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),T(e,"shape",(()=>n.shape)),e.keyof=()=>Tr(Object.keys(e._zod.def.shape)),e.catchall=n=>e.clone({...e._zod.def,catchall:n}),e.passthrough=()=>e.clone({...e._zod.def,catchall:xr()}),e.loose=()=>e.clone({...e._zod.def,catchall:xr()}),e.strict=()=>{return e.clone({...e._zod.def,catchall:Wt(br,n)});var n},e.strip=()=>e.clone({...e._zod.def,catchall:void 0}),e.extend=n=>function(e,n){if(!z(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=S(e._zod.def,{get shape(){const t={...e._zod.def.shape,...n};return C(this,"shape",t),t}});return $(e,o)}(e,n),e.safeExtend=n=>function(e,n){if(!z(n))throw new Error("Invalid input to safeExtend: expected a plain object");const t=S(e._zod.def,{get shape(){const t={...e._zod.def.shape,...n};return C(this,"shape",t),t}});return $(e,t)}(e,n),e.merge=n=>function(e,n){const t=S(e._zod.def,{get shape(){const t={...e._zod.def.shape,...n._zod.def.shape};return C(this,"shape",t),t},get catchall(){return n._zod.def.catchall},checks:[]});return $(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 $(e,S(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 C(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=S(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 C(this,"shape",o),o},checks:[]});return $(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=S(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 C(this,"shape",r),r},checks:[]});return $(n,r)}(Sr,e,n[0]),e.required=(...n)=>function(e,n,t){const o=S(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 C(this,"shape",r),r}});return $(n,o)}(Fr,e,n[0])}));function kr(e,n){const t={type:"object",shape:e??{},...L(n)};return new yr(t)}const Er=m("ZodUnion",((e,n)=>{Bn.init(e,n),Bo.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)=>{qn.init(e,n),Bo.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 Nr=m("ZodEnum",((e,n)=>{Kn.init(e,n),Bo.init(e,n),e._zod.processJSONSchema=(n,t,o)=>((e,n,t)=>{const o=w(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 Nr({...n,checks:[],...L(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 Nr({...n,checks:[],...L(o),entries:r})}}));function Tr(e,n){const t=Array.isArray(e)?Object.fromEntries(e.map((e=>[e,e]))):e;return new Nr({type:"enum",entries:t,...L(n)})}const Cr=m("ZodTransform",((e,n)=>{Vn.init(e,n),Bo.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(K(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(K(n))}};const r=n.transform(t.value,t);return r instanceof Promise?r.then((e=>(t.value=e,t))):(t.value=r,t)}}));const Sr=m("ZodOptional",((e,n)=>{Jn.init(e,n),Bo.init(e,n),e._zod.processJSONSchema=(n,t,o)=>Eo(e,n,0,o),e.unwrap=()=>e._zod.def.innerType}));function jr(e){return new Sr({type:"optional",innerType:e})}const Or=m("ZodExactOptional",((e,n)=>{Gn.init(e,n),Bo.init(e,n),e._zod.processJSONSchema=(n,t,o)=>Eo(e,n,0,o),e.unwrap=()=>e._zod.def.innerType}));const Rr=m("ZodNullable",((e,n)=>{Hn.init(e,n),Bo.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 Ir(e){return new Rr({type:"nullable",innerType:e})}const zr=m("ZodDefault",((e,n)=>{Xn.init(e,n),Bo.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 Ar=m("ZodPrefault",((e,n)=>{Qn.init(e,n),Bo.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 Fr=m("ZodNonOptional",((e,n)=>{et.init(e,n),Bo.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 Pr=m("ZodCatch",((e,n)=>{tt.init(e,n),Bo.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),Bo.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 Lr(e,n){return new $r({type:"pipe",in:e,out:n})}const Dr=m("ZodReadonly",((e,n)=>{at.init(e,n),Bo.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 Mr=m("ZodCustom",((e,n)=>{st.init(e,n),Bo.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)}));const Br=Tr(["face","password"]);var qr;kr({success:mr(),accessToken:Wo().optional(),refreshToken:Wo().optional(),method:Br.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:Dt(ur,qr).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:qt(gr).optional(),onboarding_link:Wo().optional(),task_id:Wo().optional(),status:Wo().optional()});const Ur="#0059C4",Wr="#F1BE00",Kr="#0A1320",Vr={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"}},Zr={ground:"#F7F9FC",surface:"#FFFFFF",surfaceMuted:"#F1F5FA",line:"#E6ECF4",text:Kr,textMuted:"#48586B",textSubtle:"#617489",action:Ur,actionText:"#FFFFFF",accent:Wr,overlay:"rgba(10,19,32,.55)",focusRing:Ur},Jr={ground:Kr,surface:"#111C2B",surfaceMuted:"#1E2B3C",line:"#22334D",text:"#EEF3F9",textMuted:"#AFBDCE",textSubtle:"#8496AD",action:"#0091F6",actionText:"#FFFFFF",accent:Wr,overlay:"rgba(10,19,32,.72)",focusRing:"#00B0F8"};function Gr(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 Hr=[8,16,24];function Xr(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?{...Jr}:{...Zr};let o=16;void 0!==e.radius&&Hr.includes(e.radius)&&(o=e.radius);let r=t.action,a=!1;if(e.accent){(function(e,n){const t=Gr(e),o=Gr(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=Ur)}return{mode:n,tokens:{...t,action:r},radius:o,accent:r,accentFellBack:a}}const Yr="--nfid-ground",Qr="--nfid-surface",ea="--nfid-surface-muted",na="--nfid-line",ta="--nfid-text",oa="--nfid-text-muted",ra="--nfid-text-subtle",aa="--nfid-action",ia="--nfid-action-text",sa="--nfid-accent",ca="--nfid-overlay",da="--nfid-focus-ring",la="--nfid-radius",ua="neofaceid-focus-frame-tokens";function pa(e={}){const n=Xr(e);if("undefined"==typeof document)return n;const t=function(e){const n=e.tokens;return`.neofaceid-root {\n ${Yr}: ${n.ground};\n ${Qr}: ${n.surface};\n ${ea}: ${n.surfaceMuted};\n ${na}: ${n.line};\n ${ta}: ${n.text};\n ${oa}: ${n.textMuted};\n ${ra}: ${n.textSubtle};\n ${aa}: ${n.action};\n ${ia}: ${n.actionText};\n ${sa}: ${n.accent};\n ${ca}: ${n.overlay};\n ${da}: ${n.focusRing};\n ${la}: ${e.radius}px;\n color: var(${ta});\n font-family: inherit;\n}\n.neofaceid-root :focus-visible {\n outline: 2px solid var(${da});\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(ua);if(o)return o.textContent!==t&&(o.textContent=t),n;const r=document.createElement("style");return r.id=ua,r.textContent=t,document.head.appendChild(r),n}function fa(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 ha={},ma={purpose:"authentication",legalBasis:"fraud_prevention",privacyPolicyUrl:"",retentionDays:0},ga={development:"http://localhost:8000",sandbox:"https://sandbox-core.neofaceid.com",production:"https://core.neofaceid.com.br"},va={toPhone:!1,toPassword:!0},xa=[8,16,24];let ba={baseUrl:ga.sandbox,applicationToken:null,environment:"sandbox",initialized:!1,appName:null,accent:null,radius:16,theme:"light",locale:"pt-BR",resolvedTheme:null,consent:{...ma},autoFallback:{...va}},wa=!1;function ya(){return ba.initialized,ba.baseUrl}function ka(){return ba.applicationToken}function Ea(){return ba.appName}function _a(){return{...ba.autoFallback}}function Na(){return ba.locale}function Ta(){return{...ba.consent}}async function Ca(e,n){const t=URL.createObjectURL(e);try{return await n(t)}finally{URL.revokeObjectURL(t)}}const Sa=()=>ya(),ja=()=>{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)},Oa=()=>{const e=new AbortController,n=setTimeout((()=>e.abort()),1e4);return e.signal.addEventListener("abort",(()=>clearTimeout(n))),e},Ra=async e=>Ca(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})))),Ia=async e=>Ca(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})))),za=async e=>{ja();const n=Oa();try{const t=await fetch(`${Sa()}/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);if(t instanceof h)throw t;throw new h(t.message,f.NETWORK)}throw new h("Unknown error",f.NETWORK)}},Aa=async(e,n)=>{ja();const t=Oa();try{const o=await fetch(`${Sa()}/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)}},Fa=async(e,n)=>{ja();const t=Oa();try{const o=await fetch(`${Sa()}/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)}},Pa=async(e,n,t,o)=>{ja();const r=Oa(),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(`${Sa()}/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)}},$a=async(e,n,t,o,r)=>{if(ja(),!o||0===o.length)throw new h("Pelo menos uma imagem da pessoa é obrigatória",f.VALIDATION_ERROR);const a=Oa();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(`${Sa()}/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)}},La=async(e,n)=>{ja();const t=Oa(),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(`${Sa()}/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)}},Da=async(e,n)=>{var t,o,r,a,i;ja();const s=Oa(),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(`${Sa()}/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||"",refreshToken:u.refreshToken||u.refresh_token||void 0,method:"face",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)}},Ma=async(e,n,t=!0,o=.8)=>{ja();const r=Oa(),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(`${Sa()}/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)}},Ba=async(e,n,t,o="LOGIN")=>{ja();const r=Oa();try{const a=await fetch(`${Sa()}/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)}},qa=async(e,n,t,o=.8,r,a)=>{var i;ja();const s=Oa(),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(`${Sa()}/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)}},Ua=async(e,n,t)=>{ja();const o=Oa();try{let r,a;if(null==t?void 0:t.documentFront){const e=await Ia(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 Ia(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(`${Sa()}/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)}},Wa=async e=>{const n=Oa(),t=new URLSearchParams;e.email&&t.append("email",e.email),e.cpf&&t.append("cpf",e.cpf);try{const e=await fetch(`${Sa()}/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)}},Ka=async(e,n,t,o)=>{var r,a,i,s,c,d,l,u;if(ja(),!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=Oa();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,x;if(null==o?void 0:o.documentFront){const e=await Ia(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 Ia(o.documentBack);x=await new Promise(((n,t)=>{const o=new FileReader;o.onload=()=>n(o.result),o.onerror=t,o.readAsDataURL(e)}))}const b={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&&(b.document_images=[{front:v,back:x||void 0,type:(null==o?void 0:o.documentType)||"RG"}]);const w=await fetch(`${Sa()}/api/v1/signup/donor/`,{method:"POST",headers:{"Content-Type":"application/json","X-App-Token":t},body:JSON.stringify(b),signal:p.signal});if(!w.ok){if(401===w.status||403===w.status)throw new h("Invalid or expired application token",f.INVALID_TOKEN);try{const e=await w.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 ${w.status}`;throw new h(n,f.VALIDATION_ERROR)}catch(m){if(m instanceof h)throw m;throw new h(`Server returned status ${w.status}`,f.NETWORK)}}const y=await w.json();return 202===w.status&&(null==(r=y.data)?void 0:r.task_id)?{success:y.success,message:y.message||"Registration is being processed. You will receive an email when completed.",task_id:y.data.task_id,status:y.data.status||"processing",person_id:void 0,user_id:void 0,person_validated:void 0,face_processing:void 0,onboarding_link:void 0}:{success:y.success,message:y.message,person_id:(null==(a=y.data)?void 0:a.person_id)||y.person_id,user_id:(null==(i=y.data)?void 0:i.user_id)||y.user_id,person_validated:(null==(s=y.data)?void 0:s.person_validated)||y.person_validated,face_processing:(null==(c=y.data)?void 0:c.face_processing)||y.face_processing,onboarding_link:(null==(d=y.data)?void 0:d.onboarding_link)||y.onboarding_link,task_id:null==(l=y.data)?void 0:l.task_id,status:null==(u=y.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)}},Va=async(e,n,t)=>{const o=Oa();try{const r=await fetch(`${Sa()}/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,refreshToken:a.refresh_token||a.refresh||void 0,method:"password",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)}},Za=async(e,n)=>{if(!e)throw new h("Inscrição de aparelho exige um usuário autenticado (access token ausente).",f.INVALID_TOKEN);const t=Oa();try{const o=await fetch(`${Sa()}/api/v1/devices/enrollment-token/`,{method:"POST",headers:{"Content-Type":"application/json","X-App-Token":n,Authorization:`Bearer ${e}`},signal:t.signal});if(!o.ok){if(401===o.status)throw new h("Sua sessão expirou. Entre novamente para inscrever o aparelho.",f.INVALID_TOKEN);if(403===o.status)throw new h("Esta conta não pode inscrever aparelhos. Procure o suporte.",f.INVALID_TOKEN);throw new h(`API Error ${o.status}`,f.API_ERROR)}const r=await o.json(),a=r.data??r,i=a.token,s=a.handle;if(!i||!s)throw new h("Resposta de inscrição incompleta (token ou handle ausente)",f.API_ERROR);return{handle:s,jti:a.jti??"",token:i,expiresIn:a.expires_in??300,purpose:a.purpose??"device-enrollment"}}catch(o){if(o instanceof h)throw o;if(o instanceof Error){if("AbortError"===o.name)throw new h("Request timed out",f.NETWORK);throw new h(o.message,f.NETWORK)}throw new h("Unknown error occurred",f.NETWORK)}},Ja=async(e,n)=>{const t=Oa();try{const o=await fetch(`${Sa()}/api/v1/token/refresh/`,{method:"POST",headers:{"Content-Type":"application/json","X-App-Token":n},body:JSON.stringify({refresh:e}),signal:t.signal});if(!o.ok){if(401===o.status||403===o.status)throw new h("Sessão expirada — faça login novamente",f.INVALID_TOKEN);throw new h(`API Error ${o.status}`,f.API_ERROR)}const r=await o.json(),a=r.access??r.access_token;if(!a)throw new h("Resposta de refresh sem access token",f.API_ERROR);return{accessToken:a,refreshToken:r.refresh??r.refresh_token??e}}catch(o){if(o instanceof h)throw o;if(o instanceof Error){if("AbortError"===o.name)throw new h("Request timed out",f.NETWORK);throw new h(o.message,f.NETWORK)}throw new h("Unknown error occurred",f.NETWORK)}},Ga=async(e,n)=>{var t,o,r,a;ja();const i=Oa(),s=await Ia(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(`${Sa()}/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)}},Ha=async(e,n,t)=>{if(ja(),!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=Oa(),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(`${Sa()}/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)}},Xa=async(e,n,t)=>{ja();const o=Oa();try{const a=await fetch(`${Sa()}/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)}},Ya=async(e={})=>{ja();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))}}))},Qa=async(e,n,t={})=>{var o,r,a,i,s,c,d,l,u,p;const{maxAttempts:m=60,intervalMs:g=1e3,onStatusChange:v}=t,x=()=>new Promise((e=>{setTimeout(e,g)}));let b=0,w="";for(;b<m;){b++;try{const t=await fetch(`${Sa()}/api/v1/tasks/status/?task_id=${e}`,{method:"GET",headers:{Accept:"application/json","X-App-Token":n}});if(404===t.status)throw new h("Não foi possível recuperar o andamento deste processo. Ele pode já ter sido concluído há algum tempo, ou nunca ter existido.",f.NOT_FOUND);if(t.status>=500){w=`HTTP ${t.status}`,await x();continue}if(401===t.status||403===t.status)throw new h("Invalid application token",f.INVALID_TOKEN);if(!t.ok)throw new h(`Task status check failed: ${t.status}`,f.API_ERROR);const m=await t.json(),g=(null==(o=m.data)?void 0:o.status)||"unknown";if(v){v(g,null==(a=null==(r=m.data)?void 0:r.progress)?void 0:a.percentage)}if("success"===g)return m.data.result;if("failure"===g){const e=(null==(s=null==(i=m.data)?void 0:i.result)?void 0:s.message)||(null==(c=m.data)?void 0:c.error)||"Task failed";throw new h(e,f.RECOGNITION_FAILED)}if("revoked"===g)throw new h("Task was cancelled",f.RECOGNITION_FAILED);if(!1===m.success){const e=(null==(l=null==(d=m.data)?void 0:d.result)?void 0:l.message)||(null==(u=m.data)?void 0:u.error)||(null==(p=m.data)?void 0:p.message)||m.message||"Task failed";throw new h(e,f.RECOGNITION_FAILED)}await x()}catch(y){if(y instanceof h)throw y;w=y instanceof Error?y.message:"erro desconhecido",await x()}}throw new h(w?`Task status polling timed out (última falha transitória: ${w})`:"Task status polling timed out",f.NETWORK)},ei=async(e,n)=>{var t;ja();const o=Oa();try{const r=await fetch(`${Sa()}/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)}},ni=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)})),ti=async(e,n,t)=>{var o,r;if(ja(),!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 Ia(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=Oa();try{const t=await fetch(`${Sa()}/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);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);throw new h(s.message,f.NETWORK)}throw new h("Unknown error occurred",f.NETWORK)}},oi=async(e,n)=>{const t=Oa();try{const o=await fetch(`${Sa()}/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);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)}},ri=async(e,n,t={})=>{var o,r;const{maxRetries:a=30,interval:i=2e3}=t,s=await Ga(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 oi(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)};async function ai(e,n){const t=ya(),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 ii(e,n){const t=ya(),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 si=Object.freeze(Object.defineProperty({__proto__:null,checkUserExistence:Wa,completeOnboarding:Pa,completeOnboardingWithData:$a,confirmPasswordReset:ii,getOnboardingDetails:Aa,getTaskStatus:oi,identifyPerson:Ga,identifyPersonAsync:ri,loginWithBiometric:Da,loginWithEmail:Va,pollTaskStatus:Qa,recognize:La,recognizeBiometric:Ma,recognizeByPurpose:qa,recordFaceVideo:Ya,refreshSession:Ja,registerApplication:Xa,registerBiometric:Ha,registerDocumentByImage:ti,registerPersonWithBiometric:Ka,registerPersonWithoutFace:Ua,requestDeviceEnrollmentToken:Za,requestPasswordReset:ai,simpleIdentification:Ba,startProofOfLife:ei,validateOnboardingToken:Fa,validateToken:za,videoToBase64:ni},Symbol.toStringTag,{value:"Module"}));function ci(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 di(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=ci(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;ci(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 li({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 ui(e,n){return Math.hypot(e.x-n.x,e.y-n.y)}function pi(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=ui(t,i),c=ui(o,a),d=ui(n,r);return d<1e-6?0:(s+c)/(2*d)}const fi=(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}},hi={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 mi({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,x]=n.useReducer(fi,{status:"requestingPermission"}),[b,w]=n.useState(!1),{startCamera:y,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]);w(n&&t)}catch(n){}u.current=window.setTimeout(e,100)}};e()};n.useEffect((()=>{pa()}),[]),n.useEffect((()=>()=>{var e;null==(e=g.current)||e.abort()}),[]);const _=i&&("ready"===v.status||"capturing"===v.status),{flashOn:N}=di(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 y();l.current=e,s.current&&(s.current.srcObject=e),x({type:"PERMISSION_GRANTED"}),E()}catch(e){x({type:"PERMISSION_DENIED"})}})(),()=>{l.current&&k(l.current)})),[y,k]);const T=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{x({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((pi(e.landmarks.getLeftEye())+pi(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 x({type:"SET_ERROR",message:e.getFriendlyMessage()})}const c=o.getContext("2d");if(!c)return void x({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 La(l,e);r({success:!0,data:{faceId:n.payload.documentId,confidence:1}}),x({type:"UPLOAD_SUCCESS"}),setTimeout(t,1500)}catch(i){x({type:"SET_ERROR",message:"Face recognition failed"})}}catch(i){x({type:"SET_ERROR",message:"Failed to capture image"})}finally{m.current=!1}};return o.jsxs("div",{className:"neofaceid-root",style:hi.overlay,children:[o.jsx(li,{active:N}),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:hi.modal,className:"modal",children:[o.jsx("button",{type:"button",style:hi.closeButton,onClick:t,children:"×"}),o.jsx("video",{ref:s,style:hi.video,autoPlay:!0,playsInline:!0,muted:!0}),o.jsx("canvas",{ref:c,style:hi.canvas}),o.jsx("div",{style:hi.guide}),"ready"===v.status&&!b&&o.jsx("div",{style:hi.message,"aria-live":"assertive",children:"Centralize seu rosto no círculo"}),"capturing"===v.status&&o.jsx("div",{style:hi.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:hi.spinner}),"success"===v.status&&o.jsx("div",{style:hi.message,children:"Autenticado!"}),"error"===v.status&&o.jsx("div",{style:hi.message,children:v.message}),o.jsxs("div",{style:hi.controls,children:["ready"===v.status&&b&&o.jsx("button",{type:"button",style:hi.button,onClick:T,children:"Capturar"}),"capturing"===v.status&&o.jsx("button",{type:"button",style:hi.button,onClick:T,children:"Capturar"}),"error"===v.status&&o.jsx("button",{type:"button",style:hi.button,onClick:()=>{x({type:"RESET"})},children:"Tentar Novamente"})]})]})]})}const gi='<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 3.2-2.7 5.6-4.1 3.9-2.2 6.8-5.6 10.8-12.2l2.7-4.3c1.7-2.6 1.8-7.8 1.8-91.1 0-87.1 0-88.4 2-90.2 1.6-1.5 2-3.1 2-8.7 0-4.2.6-8 1.5-9.8.8-1.6 1.2-3.5.9-4.3-1.2-3.3 6.7-21.9 12.4-29.2 1.2-1.5 2.2-3.3 2.2-4 0-2.1 23.3-24 27.5-25.9a192 192 0 0 0 11.6-5.7c4.2-2.1 8.8-3.9 10.1-3.9a10 10 0 0 0 5.1-2q2.5-2 7-2c2.7 0 4.9-.6 5.7-1.5 1.1-1.3 13.8-1.5 98.4-1.8 107-.4 111.3-.7 118.2-6.8 1.1-1.1 2.7-1.9 3.5-1.9 2.7 0 11.7-10.4 15.8-18.3 4.9-9.4 5.8-18.8 2.1-22.2-1.1-1-2-2.8-2-4.1 0-2-3.5-8.6-5.7-10.6-4-3.7-8.7-7.1-11.7-8.3-2-.9-3.9-2.2-4.2-3-1.1-2.7-237.1-2.1-240.3.5m718.4 0c-1 1.1-2.7 2-3.7 2-2.4 0-12.8 9.7-12.8 12 0 1-.8 2.8-1.8 4.1-8.3 11.1-4.5 32.8 7.8 44.3a27 27 0 0 0 5.9 4.6 26 26 0 0 1 5.9 2.9c7.2 4.2 8.1 4.3 109.3 4.7 79.6.4 91.8.6 92.9 1.9.7.9 2.9 1.5 5.5 1.5q4.2 0 6.5 2c1.3 1.1 3.6 2 5.1 2s3.1.4 3.4 1 1.7 1 3.1 1c1.3 0 3.2.4 4.2 1s2.8 1.5 4.2 2c2.7 1.1 7.2 3.8 14.4 8.6 5.7 3.9 22.6 20.8 22.6 22.7 0 .8.9 2.2 2 3.2a57 57 0 0 1 9 16c.6 1.8 1.8 3.9 2.6 4.5.7.7 1.4 2.7 1.4 4.5s.7 3.8 1.5 4.5q1.5 1.3 1.5 6.7c0 3 .5 6.3 1.1 7.4.7 1.3 1 29.4.9 87.7 0 74.6.1 86 1.4 87.7.9 1.1 1.6 3.7 1.6 5.9 0 2.1 1 5.5 2.2 7.5 5.6 9.4 8.2 13.1 9.3 13.1.7 0 2 .9 3 2 8.7 9.7 33.6 11 42.3 2.4.7-.8 2-1.4 2.7-1.4 2.2 0 11.4-10.1 12.6-14a20 20 0 0 1 2.7-5.3q1.7-1.8 1.4-6.4c-.1-2.5.4-5.5 1-6.6a8 8 0 0 0 .9-4.5q-.1-2 .8-2.2c2 0 1.2-6.4-.9-7.8-1.9-1.1-2-2.3-2-16.7s.1-15.5 2-16.5c2.1-1.1 2.8-4 1-4q-.9-.1-1-1.5.1-1.4 1-1.5c2 0 1.1-7.4-1.1-8.8-2.9-1.8-2.6-38.5.4-40.6 2.1-1.6 2.2-5.5.1-7.1-2.6-1.9-3-9.8-.6-12.1 2.9-2.8 3-12 .2-12.7-2.6-.7-2.6-3.7 0-4.4 2-.5 2.9-3.3 1-3.3q-.9-.1-1-1.5.1-1.4 1-1.5c2.1 0 1.2-13.4-1-15.3-1.9-1.6-2.1-2.8-1.9-17.3.1-12.5-.2-15.9-1.4-17.2-.8-.9-1.7-3.7-2.1-6.2-1-8.8-1.8-11.9-3.2-13.1-.8-.6-1.4-2.6-1.4-4.5s-.4-3.5-.9-3.9-4.3-7.4-8.5-15.9a87 87 0 0 0-9-15.9 3 3 0 0 1-1.6-2.6c0-1-2.7-4.7-6-8.2s-6-6.8-6-7.4a177 177 0 0 0-23.9-23.5c-.7 0-3.5-2.3-6.3-5a31 31 0 0 0-5.8-5c-.5 0-3-1.7-5.7-3.9a32 32 0 0 0-7.1-4.5c-1.2-.4-2.2-1.2-2.2-1.7s-2.9-2.3-6.5-4a28 28 0 0 1-7-4 14 14 0 0 0-5-2c-2.5-.6-5-1.7-5.6-2.5S1110.5 8 1109 8s-3.9-.9-5.3-2q-2.5-2-7.1-2c-3.5 0-4.9-.5-5.8-2-2-3.1-231.4-3.2-234.3 0m-283 111.3c-1.8 1.1-8.2 1.8-31.4 3.3-4.9.3-9.4 1.2-10.5 2-1.2.8-4.5 1.4-7.9 1.4-4.3 0-6.5.5-8.4 2a6 6 0 0 1-5.4 1.3q-2.9-.5-5.4 1.1a10 10 0 0 1-4.5 1.6c-1.1 0-3.2.7-4.5 1.6q-2.6 1.6-5.4 1.1-3-.6-5.4 1.3c-1.4 1.1-3.9 2-5.5 2s-3.5.7-4.2 1.5-2.2 1.5-3.4 1.5-4.5 1.1-7.4 2.5-6.3 2.5-7.4 2.5-3.1.9-4.5 2-3.8 2-5.3 2-3.3.6-3.9 1.4-3.5 2-6.4 2.6a47 47 0 0 0-13.7 5.9c-.8.5-4.6 2.4-8.5 4.1a54 54 0 0 0-10 6 15 15 0 0 1-5.9 3.4c-1.7.4-5.2 2.5-7.9 4.7a25 25 0 0 1-6.1 3.9c-.7 0-2.5 1.4-4.2 3.1a30 30 0 0 1-6.4 4.9c-1.9 1-6.4 4.8-10 8.4a33 33 0 0 1-7.8 6.6 211 211 0 0 0-28.2 27.7c0 .8-2.6 4.2-5.7 7.7-3.2 3.5-7.7 9.5-10.1 13.3a54 54 0 0 1-6.2 8.8q-1.8 1.7-2 2.8a69 69 0 0 1-8.9 17c-1 .6-2.1 2.7-2.4 4.6-.6 2.9-4.2 11-7.5 17.1a27 27 0 0 0-4.2 10.5c0 1.3-.4 2.7-1 3s-1 1.9-1 3.5-.7 3.5-1.5 4.4c-.8.8-1.5 2.8-1.5 4.4s-.6 3.5-1.4 4.1a9 9 0 0 0-2.1 4.4c-.4 1.8-1.8 6.4-3.1 10.4a47 47 0 0 0-2.4 10c0 1.6-.7 3.8-1.5 4.9a17 17 0 0 0-1.5 7.5q0 5.7-1.5 6.9c-.9.7-1.5 2.9-1.5 5.2a18 18 0 0 1-1.6 7 14 14 0 0 0-1.1 8.4c.4 3.9.1 5.8-1.1 7.5s-1.7 4.8-1.7 12.6c-.1 8.2-.4 10.5-1.8 12.1s-1.7 4.1-1.7 16.4c0 12-.3 14.8-1.6 15.8-1.3 1.2-1.5 4.5-1.3 23.8.2 25.1.5 24.2-7.2 24.2q-4.5 0-5.9 1.5c-.7.8-2.4 1.5-3.8 1.5-6.1 0-29.2 19.2-29.2 24.3 0 .9-.9 2.3-2.1 3.1-2 1.4-5.9 11-5.9 14.6 0 .9-.7 2.5-1.5 3.6-1 1.3-1.4 4.5-1.5 10.5 0 7.1-.4 9.1-2 11.2-2.8 3.5-2.8 13.4 0 17 1.8 2.3 2 4 2 20.9 0 13.4.3 18.7 1.3 19.6.6.7 1.5 5.6 2 11 1.5 19.4 1.9 22.1 3.3 23.3.8.7 1.4 3 1.4 5.6q0 4.4 2 7.1 2.1 2.5 1.5 5.1-.5 2.6 1.5 6.4c1.1 2.1 1.8 4.3 1.4 4.9a39 39 0 0 0 4.3 15.3 10 10 0 0 1 1.3 4.6c0 1.5.6 3.2 1.4 3.8.8.7 2.6 4.8 4 9.3 1.5 4.4 3.5 9.2 4.6 10.5s2 3.1 2 3.8c0 2.8 22.8 28.5 25.4 28.5.5 0 1.7.6 2.5 1.3 2.6 2.1 10.9 3.9 13.1 2.7 1-.5 3.7-1 5.9-1s4.3-.5 4.6-1c1.6-2.6 3.3-.8 3.8 4.2.9 9.1 2.3 15.8 3.5 17 .7.7 1.2 3.7 1.2 6.7q0 5.5 1.7 7.3c.9 1 1.6 3.3 1.5 5.1 0 1.7.6 4.8 1.3 6.7s2.3 6.7 3.5 10.7c1.1 4 2.5 7.5 3 7.8s1 2.1 1 3.9c0 1.9.7 3.9 1.5 4.6s1.5 2.5 1.5 4.1.4 3.1 1 3.4 1 1.7 1 3c0 1.9 3.7 10 9 19.5l7.5 15c3.7 7.4 7.2 13.8 7.8 14.2a10 10 0 0 1 2.6 3.5 83 83 0 0 0 8.9 13.5c1.7 2.2 3.2 4.5 3.2 5.2s1.8 3 4 5.1 4 4.6 4 5.5c0 2 54.1 56 56.1 56 .8 0 3.1 1.6 5 3.6a86 86 0 0 0 16.8 12.3 43 43 0 0 1 5.9 4.3 15 15 0 0 0 4.2 2.8c.4 0 2.1 1.1 3.7 2.4 1.5 1.3 3.9 2.7 5.2 3.1a71 71 0 0 1 10.5 6.1c4.4 3 8.6 5.4 9.5 5.4 1.4 0 9 4.6 10.2 6.3.8 1 7.6 4.4 11.5 5.7a11 11 0 0 1 4.4 2.6c.7.7 2.2 1.4 3.3 1.4 1.9 0 9.3 2.9 12.7 5.1l5 2.5 6.2 3c1.4.8 3.7 1.4 5 1.4 1.4 0 3.3.9 4.3 2 1.1 1.2 3.1 2 5.1 2 1.8 0 3.6.4 3.9 1s1.8 1 3.3 1 3.6.7 4.6 1.5c1.1.8 3.9 1.5 6.2 1.5 2.5 0 4.7.6 5.4 1.5q1.3 1.4 6 1.5 4.6 0 6 1.5c1 1.1 3.6 1.5 11.4 1.5q10.2 0 12.6 1.5c3.7 2.1 47.3 2.1 51.4 0q2.8-1.5 11.1-1.5c6.1 0 8.6-.4 9.5-1.5q1.3-1.4 6-1.5 4.6 0 6-1.5c.7-.8 2.9-1.5 4.9-1.5s4.9-.7 6.5-1.5 3.9-1.5 5.2-1.5c1.2 0 2.6-.5 2.9-1s1.9-1 3.4-1 3.8-.9 5.1-2 3.3-2 4.4-2 3.9-.9 6.1-2 5.5-2.3 7.4-2.6a35 35 0 0 0 8.2-3.4c2.5-1.5 5.7-3.1 7-3.5a13 13 0 0 0 3.9-2c.8-.7 4.4-2.5 8-4.1s7.6-3.6 8.9-4.6 3.1-1.8 4.1-1.8 3.7-1.5 6.1-3.4 6.6-4.6 9.3-6a52 52 0 0 0 9.2-6.6c2.4-2.2 5-4 5.7-4s2.2-.9 3.2-2 2.5-2 3.2-2 4.3-2.7 7.7-6 6.8-6 7.5-6 6.8-5.4 13.6-12 13-12 13.9-12 2.6-1.6 3.8-3.6c1.1-1.9 3.2-4 4.4-4.5s2.4-1.7 2.4-2.6 5.4-7.2 12.1-13.8S877 941.9 878 940s3.3-4.9 5-6.5c1.8-1.7 4.7-5.3 6.4-8s4-5.6 4.9-6.4c1-.7 1.7-2.1 1.7-3 0-1 1.1-2.8 2.5-4.1s2.5-2.9 2.5-3.6a13 13 0 0 1 2.8-4.6 97 97 0 0 0 8.9-13.3c.7-1.1 3.5-6.7 6.3-12.5a180 180 0 0 1 6.1-12 84 84 0 0 0 7.9-18.6c0-1.2.5-2.6 1.1-2.9a43 43 0 0 0 5.9-12.6c0-1.6 1.9-7.8 3.2-10.3.5-1 1.1-3.8 1.3-6.3a12 12 0 0 1 1.9-6.2c.9-1 1.6-3.1 1.6-4.8s.7-3.6 1.6-4.4q1.6-1.3 1.1-4.8a20 20 0 0 1 1-7.5c.7-2.1 1.3-5.2 1.3-6.8q.1-8.7 9.6-8.8 12.4 0 28-15.8a56 56 0 0 0 14.3-21.2c.6-1.4 2.4-4.8 4-7.5a22 22 0 0 0 3-7.7c.1-1.5.6-3 1.1-3.3s1-1.9 1-3.4.7-3.6 1.5-4.7c.8-1 1.5-3.1 1.5-4.5 0-1.5.7-3.2 1.5-3.9q1.5-1.2 1.5-7.2c0-4.5.5-6.6 2-8.5s1.9-3.4 1.4-6q-.6-3.4 1.1-8a20 20 0 0 0 1.1-10.5c-.4-4.6-.2-6.5 1.1-8.4s1.6-5 1.6-14.7c-.1-10.3.2-12.7 1.8-15.3 3-4.9 2.9-48.9-.1-52.7-1.7-2.2-2-3.6-1.5-8.4.4-4.3.1-6.4-1-7.9a8 8 0 0 1-1.5-4.2c-.1-11.9-25.4-37-37.5-37.2-1.1 0-2.9-.7-3.9-1.5a9 9 0 0 0-4.7-1.5c-3.9 0-4-1.1-3.8-25 .1-18.7-.1-22-1.5-24.9-1.5-2.7-1.7-5.6-1.5-16q.3-12.7-.9-14.8a44 44 0 0 1-1.2-13c0-8.1-.4-11.4-1.5-12.9a17 17 0 0 1-1.5-7.5q0-5.7-1.5-6.9t-1.5-6.9c0-3.2-.6-6.5-1.4-7.6s-1.6-4.7-1.9-8c-1.1-10.7-2.3-16-4-18.5-.9-1.3-1.7-3.6-1.7-5s-.7-3.4-1.5-4.4a9 9 0 0 1-1.5-4.7c0-1.5-.4-3.1-1-3.4s-1-1.7-1-3-1.4-4.7-3.1-7.6a36 36 0 0 1-3.6-8.3c-.3-1.7-2.3-6.5-4.4-10.7a53 53 0 0 1-3.9-8.4 59 59 0 0 1-5.6-10.5 53 53 0 0 0-4.6-8.9 9 9 0 0 1-1.8-4.2c0-1-.9-2.3-1.9-2.9-1.1-.5-2.3-2-2.7-3.2s-1.8-3.7-3.3-5.4a59 59 0 0 1-4.6-6.5l-3.8-6.4c-1-1.6-5-6.2-8.8-10a36 36 0 0 1-6.9-8.5c0-1.9-14-16-15.9-16-.7 0-5.3-3.8-10-8.5a69 69 0 0 0-9.7-8.5c-.5 0-3.4-2.2-6.5-4.8a81 81 0 0 0-14.8-10.1q-2.5-1.4-3.1-2.2c-.9-1.4-7.7-5.7-10.1-6.4-1.3-.4-3.5-1.8-4.9-3a32 32 0 0 0-7.3-4.5c-2.6-1.2-5-2.6-5.3-3.1q-.6-.8-2.3-.9c-1 0-3-.9-4.4-2s-3.9-2-5.5-2a7 7 0 0 1-4.2-1.4c-.6-.8-3.4-2.2-6.1-3.1s-5.1-2.1-5.4-2.6-1.9-.9-3.4-.9-3.8-.9-5.1-2a9 9 0 0 0-4.7-2c-1.3 0-3.1-.4-4.1-.9a54 54 0 0 0-7.7-2.6c-3.3-.9-7.3-2.3-8.8-3.1s-3.8-1.4-5-1.4-3.5-.9-5.2-2c-1.6-1.1-4.2-2-5.7-2s-3-.5-3.3-1-1.7-1-3.1-1-3.6-.7-4.9-1.6q-2.6-1.6-5.4-1.1-3 .6-5.4-1.3-2.5-2-7.7-2c-2.8 0-6.1-.6-7.3-1.2-2.4-1.4-13.5-2.6-32.4-3.4-8.8-.4-12.5-1-13.4-2-1.6-1.9-67.3-2-70.4-.1m85.7 55.8c.9.5 4.5.9 8 .9 3.9.1 7 .6 8.2 1.5s4.2 1.5 7 1.5c2.9 0 5.9.7 7 1.5s3.8 1.5 6.1 1.5 4.6.5 5.3 1.2c1.1 1.1 7.2 2.4 16.4 3.5 2.6.2 5.2 1.1 5.9 1.9.6.8 2.2 1.4 3.6 1.4s4.1.9 6.1 1.9a59 59 0 0 0 20 7.1c1.1 0 2.3.4 2.6.8.7 1.2 15.1 8.2 16.7 8.2 2 0 10.9 4.3 10.9 5.2 0 .5 2.8 2.3 6.3 3.9 6 2.9 10.8 5.6 15.8 9 6.6 4.4 8.4 5.6 11.4 7.4 9.8 6 15.6 11 31 26.7S872 280.6 872 283c0 .5 1.1 2.2 2.5 3.8s3.4 5.1 4.5 7.7 2.7 5.3 3.5 5.9a67 67 0 0 1 9.5 18.9c0 1.3.8 3.4 1.7 4.7a42 42 0 0 1 6.3 14.5c0 1.2.9 3.4 2 4.8s2 3.9 2 5.5.6 3.5 1.4 4.1c.8.7 1.7 3.3 2 5.9.9 8.6 1.8 12.1 3.2 13.3.8.7 1.4 3 1.4 5.7q0 4.4 1.8 6.5c1.2 1.3 1.7 3.6 1.7 7.7.1 3.5.7 6.5 1.5 7.5 1 1.2 1.3 3.8 1.1 9s.2 8.2 1.4 10.5c1.3 2.5 1.6 5.5 1.4 13.5-.3 8.7-.1 10.7 1.4 12.3 1.6 1.7 1.7 6.4 1.7 61.6 0 69.2-.3 66.6 9.1 71.9 5.5 3.1 7.9 3.3 11.7 1.3 1.5-.8 3.9-1.7 5.4-2s6.4-4.3 11.4-9.1c4.8-4.7 9.4-8.5 10.2-8.5 1.8 0 7.3 4.5 8.9 7.4 2 3.4 1.8 49.5-.2 53.2-1.1 2.1-1.5 6.1-1.5 14 0 8.7-.3 11.4-1.5 12.4s-1.5 3.5-1.5 10.5-.4 9.6-1.5 10.5c-.8.7-1.5 2.8-1.5 4.7s-.7 4.8-1.6 6.5-1.3 4-1 5.1-.2 3.3-1 5c-.9 1.6-1.7 4.8-1.9 7.1-.1 2.5-1.6 6.5-3.7 10.1-2 3.3-3.9 7.1-4.3 8.5-1.7 5.9-7.8 9.7-10.5 6.5a6 6 0 0 0-3.9-1.5c-1.5 0-3.6-.7-4.9-1.5-1.9-1.4-2.4-1.4-5.1 0-1.7.8-4.6 1.5-6.5 1.5-5.7 0-16.5 12.6-16.6 19.3 0 1.2-1.2 4-2.5 6.2a16 16 0 0 0-2.5 8.6q0 4.5-1.5 5.9-1.5 1.2-1.5 7c0 4.1-.5 6.4-1.9 8.1a17 17 0 0 0-2.4 6.9 66 66 0 0 1-4.7 20.7c-.6 2.3-1.5 4.5-2 4.8s-1 1.9-1 3.4c0 1.6-.9 3.9-1.9 5.3a14 14 0 0 0-2.6 5.4 61 61 0 0 1-5.9 14.4c-.7.8-2.5 4.4-4.1 8a52 52 0 0 1-4.1 8.1c-.8.8-1.4 2.2-1.4 3 0 1.4-6.6 12.3-11.9 19.5a56 56 0 0 0-4.6 8c-.9 2.2-3.8 6.1-6.4 8.9a40 40 0 0 0-6.4 8c-.9 1.6-3.6 5-6.1 7.5-2.5 2.4-4.6 5.1-4.6 5.9 0 1.9-41 43.1-42.8 43.1-.8 0-3.9 2.4-7 5.4-3.1 2.9-7 6-8.7 6.9-1.6.8-4.3 2.9-5.9 4.6s-3.4 3.1-3.9 3.1a26 26 0 0 0-5.9 4 28 28 0 0 1-6 4c-.6 0-2.3 1.1-4 2.5-1.6 1.4-3.5 2.5-4.2 2.5s-2.1 1-3.2 2.1c-1 1.2-4.2 3.2-7 4.4a21 21 0 0 0-5.8 3.4 3 3 0 0 1-2.2 1.1c-.9 0-4.2 1.6-7.5 3.5a44 44 0 0 1-8.7 4.1c-1.5.4-3.6 1.4-4.7 2.3q-3.8 3.1-16.5 6.7c-3.6.9-6.9 2.1-7.5 2.6s-2.1.8-3.5.8a9 9 0 0 0-4.9 1.9q-2.2 2-6.7 1.8c-2.8 0-5.1.6-6 1.5-1.2 1.2-3.1 1.4-8.4 1-5-.3-7.6 0-10 1.2-4.7 2.3-40.6 2.4-47.1.1a30 30 0 0 0-10.4-1.3c-3.3.1-7-.4-8.2-1s-3.7-1.2-5.5-1.2-5-.9-7.1-2-4.8-2-6.2-2c-3.3 0-17.6-4.8-19.6-6.6-.8-.8-2.9-1.4-4.6-1.4a7 7 0 0 1-4.7-1.9c-.9-1-3-2.1-4.5-2.4s-5.5-2.2-8.9-4.1c-3.3-2-7.2-3.6-8.6-3.6s-3.4-.8-4.4-1.8-3.6-2.7-5.7-3.9a110 110 0 0 1-16.1-9.2 10 10 0 0 0-3.7-2.1c-.5 0-2.4-1.2-4.2-2.7-3-2.6-6.6-5-12.4-8.2-1.5-.8-2.8-1.7-3.1-2a39 39 0 0 0-8.7-6.1c-.5 0-2.2-1.4-3.9-3.1a24 24 0 0 0-5.9-4.6 156 156 0 0 1-18.2-15.6c-10.8-11-22.4-24-24.1-26.7a51 51 0 0 0-6.6-8c-2.5-2.4-4.6-5.2-4.6-6.1s-.9-2.4-2-3.4-3.9-4.9-6.2-8.7c-2.4-3.9-5.6-8.5-7.1-10.3a29 29 0 0 1-4.3-7.9c-.9-2.4-2.2-5-3-5.7-.8-.6-1.4-1.7-1.4-2.4a19 19 0 0 0-3.5-5.6c-1.9-2.4-3.8-6-4.1-7.9a50 50 0 0 0-3.8-9.5 54 54 0 0 1-4.6-12 54 54 0 0 0-2.7-8.5c-.7-1.4-1.3-3.4-1.3-4.5a12 12 0 0 0-2-5q-1.8-2.9-1.4-5.2c.3-1.2-.1-3.6-1-5.4s-1.6-4.4-1.6-5.9-.7-4.5-1.6-6.5c-1-2.4-1.3-5.1-.9-7.2.4-2.5.1-4-1.4-6q-2.1-2.6-2.1-6.8c0-2.6-.6-4.8-1.5-5.5s-1.5-2.7-1.5-4.6-.4-3.6-1-3.9-1-1.9-1-3.4c0-1.7-1.3-4.3-3.3-6.7a20 20 0 0 1-4.1-6.8c-1.2-4.9-10.4-13.1-16.3-14.5a29 29 0 0 1-7-2.6c-2.6-2-6.7-1.8-11 .5-2.1 1.1-4.8 2-6 2s-2.5.4-2.8 1c-.9 1.5-4.5 1.2-4.5-.4 0-.7-.9-2.5-2-3.9s-2-3.8-2-5.3-.6-3.5-1.4-4.3a75 75 0 0 1-6.3-17.6c-.3-1.7-1.4-4-2.4-5.3a6 6 0 0 1-1.3-5.1c.4-1.7-.1-4.1-1-5.9-.9-1.7-1.6-4.4-1.6-6s-.7-4.6-1.5-6.6c-1-2.3-1.3-5-1-6.9.5-2.4.1-3.9-1.4-5.9-1.6-2-2.1-4.1-2.1-8.6q0-6-1.4-7.2c-2.3-1.8-4.1-57.3-2.1-66 1.9-8.9 10.6-10.9 15.2-3.7.5.7 3.6 3.1 7.1 5.4 11.5 7.8 33.2 5.3 33.2-3.7 0-.9.9-2.5 2-3.5 2-1.8 2-3 2-29.1-.1-17.4.3-28 .9-29.3.7-1.2 1.1-11.7 1.1-28.1 0-21.5.3-26.6 1.5-29.1 1.2-2.2 1.5-5.7 1.4-13.5-.1-8.4.2-10.8 1.5-12.3 1.1-1.3 1.6-3.7 1.6-8.7 0-5.2.5-7.6 2-9.9a8 8 0 0 0 1.4-6.2c-.4-2 0-4.9 1-7.4.9-2.3 1.4-4.9 1.1-5.8s.4-3.4 1.4-5.4c1.3-2.6 1.7-4.9 1.4-7.8-.5-3.1-.1-4.7 1.6-6.9 1.1-1.6 2.1-3.9 2.1-5.2a8 8 0 0 1 1.5-4.2 9 9 0 0 0 1.5-4.7c0-1.5.5-3.1 1-3.4s1-1.7 1-2.9a33 33 0 0 1 3.5-9c1.9-3.7 3.5-7.5 3.5-8.5a244 244 0 0 1 29.7-52.3c2.4-2.7 4.3-5.4 4.3-6 0-1.6 23.2-24.8 24.8-24.8.7 0 4.8-3.3 9.1-7.3 4.2-3.9 9-8 10.6-8.9l9.7-6c1.5-1 3.3-1.8 4.1-1.8s2.2-.9 3.2-2 4.1-3.1 6.9-4.5 5.8-2.9 6.6-3.5l11.5-5.6a139 139 0 0 0 11.5-5.9c.8-.7 2.9-1.5 4.5-1.8a53 53 0 0 0 16.6-5.6c3.4-1.7 7.7-3.1 9.5-3.1a16 16 0 0 0 6.1-1.4 36 36 0 0 1 12-3.6 5 5 0 0 0 3.3-1.5q1.2-1.5 6.9-1.5c3.5 0 6.5-.6 7.7-1.5 1-.8 4.1-1.5 6.7-1.5s5.8-.6 7-1.2c3.7-2.1 18.4-3 63.7-3.6 43.8-.7 48.1-.6 51.2.9"/><path d="M752.5 559.1c-2.7 1.6-6.2 3.5-7.7 4.2a42 42 0 0 0-14.3 14.5c-.3 1.5-1.2 4-2 5.5-2.8 5.5-2.1 30 1 33.3 1.4 1.5 2.5 3.1 2.5 3.7 0 3 6.7 8.6 16 13.4 5.7 2.9 30.7 3.5 33 .8.7-.8 1.9-1.5 2.7-1.5 3 0 12.3-10.4 16.3-18.3 4.5-8.9 5.8-22.7 2.5-28.5-.8-1.5-1.9-4.6-2.5-7-1.2-4.8-8.3-13.8-11.7-14.7-1.2-.4-2.9-1.5-3.9-2.6-.9-1-3-1.9-4.5-1.9-1.6 0-4.3-.9-6.1-2-5.2-3.2-14.9-2.7-21.3 1.1m-296.1 7.1a8 8 0 0 1-4.2 1.8c-1.2 0-2.4.5-2.7 1s-2.4 1.9-4.5 3-4.3 3.1-4.9 4.7c-.6 1.5-2.7 5-4.6 7.8-3.1 4.4-3.5 5.7-3.5 11.1 0 4.8-.4 6.5-2 7.9-1.5 1.3-2 3.1-2 6.6 0 3.8.4 5.1 2 5.9q2 1 2 4.5c0 6 8.1 16.2 17.8 22.3 5.4 3.4 28.3 3 33.1-.6 1.7-1.2 3.7-2.2 4.5-2.2s2.3-1.1 3.3-2.5l5.3-7.3c6.6-8.9 7-10.4 7-24.3 0-10-.3-12.9-1.5-13.9a6 6 0 0 1-1.5-3.9c0-3.6-16.4-20.1-19.9-20.1-1.4 0-3.2-.6-4-1.4-2.6-2.3-16.9-2.6-19.7-.4M597.5 601c-11.1 1-12.2 1.7-17 12l-3.1 6.3a19 19 0 0 0-1.4 7.1q0 4.3-2 6.9-2 2.5-2 6.9c0 2.4-.6 5.3-1.4 6.4-1.6 2.2-2.3 11.4-3.2 38.4-.5 16.2-.4 16.6 2.2 23 3 7.2 9.9 14.6 14.6 15.6 1.5.4 3.3 1.3 3.9 2 2.6 3.2 12.1 6.6 16.7 6.1 2.7-.3 6.2.1 8.5.9 4.8 1.7 12 1.8 14.9.3 1.2-.6 3.9-1.1 6.2-1.1 11.1.2 21.1-15.1 16.1-24.7-3.7-7.3-6-8.1-23.6-8.1-15.9 0-15.9 0-18.9-4.2-3.8-5.2-4.3-14.3-1-18.5 1.6-2.1 2-4.1 2-10.7 0-5.2.5-8.7 1.2-9.4a21 21 0 0 0 2-8c1.3-12.3 2.4-18.2 3.6-19.4.8-.8 1.2-4.6 1.2-10.5 0-9.2 0-9.2-4.5-13-5.7-4.8-6.5-5-15-4.3m138.9 189.1c-.9 1-2.4 1.9-3.3 1.9s-4.1 2.5-7.1 5.5-6 5.5-6.6 5.5c-.7 0-2.6 1.1-4.2 2.5a14 14 0 0 1-3.7 2.5c-.5 0-2.7 1.6-5.1 3.5-2.4 2-5.8 4.1-7.6 4.7s-5.4 2.4-7.9 3.9-5.7 3-7 3.4a13 13 0 0 0-3.9 2c-1.4 1.2-3.4 1.7-11.7 3.2-1.8.3-3.8 1.1-4.4 1.9s-3 1.4-5.6 1.4a11 11 0 0 0-6.8 1.9c-1.9 1.4-3.5 1.7-7.2 1.4q-4.9-.4-8.7 1.1c-5.5 2.3-56.5 2.4-61.9.1-2-.8-6.5-1.5-10-1.5q-6.5 0-7.7-1.5c-.7-.9-2.9-1.5-5.4-1.5-2.3 0-5.1-.7-6.2-1.5-1-.8-3.1-1.5-4.6-1.5s-3-.5-3.3-1-2-1-3.7-1c-1.6 0-4.1-.9-5.5-2a9 9 0 0 0-3.8-2c-.6 0-2-1-3.1-2.1-1-1.2-4.2-3.2-7-4.4a54 54 0 0 1-14.1-11.3 66 66 0 0 0-14.3-11.7q-1.3-1.5-6.5-1.5c-7.1 0-18.5 11.1-18.5 17.9 0 3.8 4 13.3 6 14.6.6.4 1.9 2.3 2.9 4.4 2.3 4.3 15.8 17.9 22.8 22.6 6.6 4.5 30.6 16.5 33 16.5 1.2 0 2.6.6 3.2 1.4 1.2 1.4 4.7 2.3 13.3 3.2 2.6.3 5.2 1.2 5.9 2q1.2 1.4 6.6 1.4c3.4 0 6.8.7 9.3 2 6.1 3.1 76.3 3.1 80.3 0 2-1.6 4-2 9.5-2q7 0 8.1-1.4c.7-.8 3.3-1.6 5.9-1.9 7.5-.9 11.6-1.8 13.2-3.2.8-.7 2.9-1.5 4.5-1.8a130 130 0 0 0 35.5-16.2 32 32 0 0 1 7.1-4c1.4-.3 3.9-1.9 5.4-3.5s3.5-3 4.4-3c2.3 0 22.1-20.8 24.2-25.4 3.9-8.6.4-19.7-8-25.3-3.9-2.5-14.5-2.7-16.7-.2M29 793.5c-1.4.8-3.5 1.4-4.8 1.5-1.2 0-3.2 1.1-4.4 2.5s-2.9 2.5-3.7 2.5c-2.7.1-7.6 5.4-10.7 11.5a22 22 0 0 1-4.1 6.2c-2.5 1-1.8 217 .7 218.3 1.6.8 2 2.1 2 5.9q0 4.8 1.5 6.1c.8.7 1.5 2.7 1.5 4.4 0 1.9 1.1 4.7 2.5 6.6s2.5 4.4 2.5 5.5c0 2.9 7.2 17.1 9.9 19.6 1.2 1.1 2.1 2.6 2.1 3.3 0 1.2 1.9 4 8.2 12 1.3 1.7 2.8 4 3.3 5.3 1.4 3.3 32.4 34.2 36 35.9 3.3 1.6 8.5 5.1 12.9 8.9 1.5 1.4 3.4 2.5 4 2.5a158 158 0 0 1 20.6 10.2c1.4.8 6.6 2.7 11.5 4.3s10.2 3.3 11.7 4.1c1.4.8 4.8 1.4 7.5 1.4q4.8 0 7.8 2c4.7 3.1 225.2 3.1 228 0 1-1.1 2.9-2 4.2-2 4.8 0 13.9-8 20.9-18.5 4.7-6.9 5.1-22.7.7-30.3a47 47 0 0 0-29.3-22.8c-2.5-.4-48.2-.8-101.6-1.1-84.6-.3-97.3-.5-98.4-1.8q-1.2-1.5-7.6-1.5c-4.1 0-7.9-.7-10.6-1.9-2.4-1.1-7.7-2.9-11.8-4.2-4.1-1.2-8.6-3-9.9-4a8 8 0 0 0-4.1-1.9c-.9 0-2.6-1.1-3.8-2.5s-2.9-2.5-3.7-2.5c-1.8 0-23.5-20.8-23.5-22.6 0-.7-1-2.5-2.3-4.1a37 37 0 0 1-3.5-5.3l-3.7-7a37 37 0 0 1-3.1-8.3c-.4-2-1.1-4-1.5-4.3-.5-.3-.9-1.8-.9-3.3s-.5-3.2-1.1-3.8a51 51 0 0 1-1-15c.2-12.6 0-14.2-1.9-16.5-2-2.6-2-3.6-2-85.7 0-83.1 0-83.1-3.5-90.1-4.8-9.6-16-18-24-18-1.2 0-2.8-.7-3.5-1.5-1.6-2-12.6-2-16 0m1154 5c-1.4.8-3.6 1.4-5 1.5-2.8 0-12.5 5.9-15.3 9.3a37 37 0 0 0-6.7 11c0 .8-.9 2.2-2 3.2-1.6 1.4-2 3.1-2 7.9 0 3.8-.6 7-1.5 8.3-1.3 1.8-1.5 13.4-1.4 87.7 0 58.2-.3 86.2-1 87.5-.6 1.1-1.1 4.4-1.1 7.4q0 5.5-1.5 6.7c-.8.7-1.5 1.9-1.5 2.7s-.9 2.6-2 4c-1.2 1.5-1.8 3.4-1.5 4.4q.5 1.8-1.4 3.8a21 21 0 0 0-3.6 5.3l-3.3 6.5a72 72 0 0 1-16.4 16.3c-.7 0-3.1 1.7-5.2 3.7a47 47 0 0 1-9.2 6.4 68 68 0 0 0-6.6 3.6c-.7.6-3 1.6-5 2.2s-4.2 1.9-4.8 2.7c-.8.8-3.1 1.4-6 1.4q-4.8 0-7 2c-1.7 1.5-3.7 2-8 2-3.4 0-6.4.6-7.6 1.5-1.6 1.2-15.2 1.4-98.7 1.5-105.6 0-104.7 0-110.8 5.6-1.4 1.3-3 2.4-3.6 2.4-2.2 0-7.9 6.6-10.6 12.2-1.5 3.1-3.2 6-3.7 6.3-2.5 1.5-1.2 22.4 1.7 27.3 3.7 6.5 14 16.9 18.4 18.6 2 .8 3.9 2.2 4.2 3 1.1 2.8 231.7 2.3 234.2-.4q1.8-2 5.7-2c2.1 0 5.5-.9 7.5-2 2.1-1.1 4.3-2 5-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>',vi=gi;const xi={display:"flex",alignItems:"center",justifyContent:"center",gap:6,color:"var(--nfid-text-subtle)",fontFamily:"inherit",lineHeight:1},bi={display:"inline-flex",alignItems:"center",justifyContent:"center",color:"currentColor"},wi={fontSize:12,fontWeight:600,letterSpacing:.2,color:"var(--nfid-text-muted)"},yi={fontSize:9,fontWeight:400,color:"var(--nfid-text-subtle)",opacity:.75},ki={fontSize:9,fontWeight:500,color:"var(--nfid-text-subtle)",opacity:.75};function Ei({size:e=16,style:n}){return o.jsxs("div",{className:"neofaceid-brand-footer",style:{...xi,...n},children:[o.jsx("span",{"aria-hidden":"true",style:{...bi,width:e,height:e},dangerouslySetInnerHTML:{__html:vi}}),o.jsx("span",{style:wi,children:"NeoFaceID"}),o.jsx("span",{style:yi,children:"by"}),o.jsx("span",{style:ki,children:"Octa"})]})}function _i(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;`}">${vi}</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 Ni{constructor(e){i(this,"applicationToken"),i(this,"modalElement",null),this.applicationToken=e}open(){this.modalElement||(pa(),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 ${_i()}\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 ${_i()}\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 ai(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)||fa(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 Ti=(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 Si();default:return e}},Ci={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..."},Si=()=>{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}},ji=8,Oi=10,Ri=26,Ii=8,zi=-8,Ai=15,Fi=-15,Pi=1500,$i=150,Li=.35,Di=.65,Mi=.18,Bi=.22,qi=2e4;function Ui({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"),x=n.useRef(null),b=n.useRef(null),w=n.useRef(!1),y=n.useRef(null),[k,E]=n.useReducer(Ti,void 0,Si),[_,N]=n.useState(!1),[T,C]=n.useState("ok"),[S,j]=n.useState(!1);n.useEffect((()=>{pa()}),[]);const O=l&&("liveness"===k.status||"camera-loading"===k.status),{flashOn:R}=di(u,{enabled:O});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}))),y.current={stepSequence:k.stepSequence,currentStepIndex:k.currentStepIndex,capturedPhotos:k.capturedPhotos},b.current&&clearTimeout(b.current),"complete"!==k.step&&(b.current=window.setTimeout((()=>{E({type:"ERROR",message:"Tempo limite atingido para o movimento. Por favor, tente novamente em um ambiente bem iluminado.",retryable:!0})}),qi))}}),[k.status,"liveness"===k.status&&k.step,"liveness"===k.status&&k.currentStepIndex]);const I=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/Pi*100,100);E({type:"UPDATE_PROGRESS",progress:n}),n>=100&&(clearInterval(m.current),m.current=null,z())}),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),x.current&&(clearTimeout(x.current),x.current=null),m.current&&(clearInterval(m.current),m.current=null),b.current&&(clearTimeout(b.current),b.current=null)}),[]),n.useEffect((()=>{let e=!0;return(async()=>{if("liveness"===k.status&&!f.current){w.current=!1,x.current&&(clearTimeout(x.current),x.current=null),x.current=window.setTimeout((()=>{e&&!1===w.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&&j(!0)}))}}catch(n){if(!e)return;x.current&&(clearTimeout(x.current),x.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,x.current&&(clearTimeout(x.current),x.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<$i)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(N(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<Li)return"too-far";if(r>Di)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>Mi||c>Bi?"not-centered":"ok"})(n);if("not-detected"!==e&&C(e),"ok"!==e)return I(!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+Ri;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)<ji&&Math.abs(n)<Oi;case"up":return e>Ii;case"down":return e<zi;case"left":return n>Ai;case"right":return n<Fi;default:return!1}})(e.pitch,e.yaw,v.current);I(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&&(w.current=!0,x.current&&(clearTimeout(x.current),x.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 z=async()=>{if(!u.current||!p.current||g.current)return;g.current=!0,h.current=null;const e=y.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((()=>si)),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 Ka(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(li,{active:R}),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"!==T&&o.jsxs("div",{className:"status-badge "+("not-centered"===T?"warning":"error"),children:["too-far"===T&&"Aproxime-se mais","too-close"===T&&"Afaste-se um pouco","not-centered"===T&&"Centralize seu rosto"]}),o.jsx("div",{className:"video-wrapper",children:o.jsx("div",{className:`video-circle ${_&&"ok"===T?"face-detected":""} ${n>0?"capturing":""}`,children:o.jsx("video",{ref:u,className:"video-feed "+(S?"ready":""),autoPlay:!0,muted:!0,playsInline:!0})})}),o.jsxs("div",{className:"instruction-box",children:[o.jsx("p",{className:"instruction-text","aria-live":"assertive",children:Ci[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(Ei,{})})]})})(),"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(Ei,{})})]}),"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(Ei,{})})]}),"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 Ni(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(Ei,{})})]})})()]})}),o.jsx("canvas",{ref:p})]})}const Wi="2.0.0",Ki="neoface_consent_trail_v1";function Vi(){try{if("undefined"==typeof window||!window.localStorage)return[];const e=window.localStorage.getItem(Ki);if(!e)return[];const n=JSON.parse(e);return Array.isArray(n)?n:[]}catch{return[]}}async function Zi(e){try{const n=Ta(),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=Wi,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=Vi();c.push(s);const d=c.slice(-100);return"undefined"!=typeof window&&window.localStorage&&window.localStorage.setItem(Ki,JSON.stringify(d)),s}catch{return null}}const Ji="https://neofaceid.com/privacidade",Gi={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.",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.",primary:"Começar cadastro"}},Hi=e=>1===e?"dia":"dias";const Xi=()=>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"})]}),Yi=()=>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"})]}),Qi=()=>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 es({appName:e,flow:n,privacyPolicyUrl:t=Ji,retentionDays:r=90,onAccept:a,onDecline:i}){const s=Gi[n],c=function(e,n){const t=Number.isFinite(n)&&n>0;return"registration"===e?{title:"Guardamos um vetor matemático do seu rosto",body:t?`Não a foto. A imagem fica guardada por até ${n} ${Hi(n)} e é apagada no fim desse prazo.`:"Não a foto. O prazo de guarda da imagem está na política de privacidade."}:t?{title:`A imagem fica guardada por até ${n} ${Hi(n)}`,body:"Ela é usada para a verificação e apagada no fim desse prazo."}:{title:"A imagem é tratada conforme a política de privacidade",body:"Ela é usada para a verificação; o prazo de guarda está descrito lá."}}(n,r),d=Number.isFinite(r)&&r>0;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(Xi,{})}),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(Yi,{})}),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(Qi,{})}),o.jsxs("div",{children:[o.jsx("p",{className:"neofaceid-consent-bullet-title",children:c.title}),o.jsx("p",{className:"neofaceid-consent-bullet-body",children:c.body})]})]})]}),o.jsx("a",{href:t,target:"_blank",rel:"noopener noreferrer",className:"neofaceid-consent-link",children:d?`Ver política de privacidade (retenção de até ${r} ${Hi(r)})`:"Ver política de privacidade"}),o.jsxs("div",{className:"neofaceid-consent-actions",children:[o.jsx("button",{type:"button",className:"neofaceid-consent-button neofaceid-consent-button-primary",onClick:()=>{Zi().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(Ei,{})})]})})]})}class ns{constructor(){i(this,"container",null),i(this,"root",null)}show(e){this.container||(pa(),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(es,{...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 ts(e={}){const n=Ea(),t=e.appName??n??"sua aplicação";e.appName;const o=e.flow??"verification";return new Promise((n=>{(new ns).show({appName:t,flow:o,privacyPolicyUrl:e.privacyPolicyUrl??Ji,retentionDays:e.retentionDays??90,onAccept:()=>n(!0),onDecline:()=>n(!1)})}))}const os={flow:"verification",privacyPolicyUrl:Ji,retentionDays:90};function rs({open:e,onDismiss:t,dismissOnOverlay:r=!0,ariaLabel:a,ariaLabelledBy:i,children:s,className:c,style:d}){if(n.useEffect((()=>{pa()}),[]),!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(${ca})`,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(${Qr})`,color:`var(${ta})`,borderRadius:`var(${la}, 16px)`,padding:28,maxWidth:440,width:"100%",boxShadow:"0 1px 3px rgba(10,19,32,.08)",boxSizing:"border-box",...d},children:s})})}const as=new Set(["connected","heartbeat","processing"]),is=31e4,ss=5;function cs(e,n){return new Promise((t=>{const o=setTimeout(t,e);null==n||n.addEventListener("abort",(()=>{clearTimeout(o),t()}),{once:!0})}))}async function ds(e){const{requestTicket:n,buildUrl:t,classify:o,timeoutMs:r=is,maxReconnects:a=ss,signal:i,eventSourceFactory:s,onProgress:c}=e,d=s??(e=>{const n=globalThis.EventSource;if(!n)throw new h("EventSource indisponível neste ambiente",f.INITIALIZATION_ERROR);return new n(e)}),l=Date.now();let u=0;for(;;){if(null==i?void 0:i.aborted)throw new h("Fluxo cancelado",f.UNKNOWN);const e=r-(Date.now()-l);if(e<=0)throw new h("Tempo esgotado aguardando resposta",f.NETWORK);const s=await n(),p=await new Promise(((n,r)=>{let a;try{a=d(t(s))}catch(g){return void r(g)}let l,u,p=!1;const m=()=>{void 0!==l&&clearTimeout(l),u&&(null==i||i.removeEventListener("abort",u)),a.close()};l=setTimeout((()=>{p||(p=!0,m(),r(new h("Tempo esgotado aguardando resposta",f.NETWORK)))}),e),u=()=>{p||(p=!0,m(),r(new h("Fluxo cancelado",f.UNKNOWN)))},null==i||i.addEventListener("abort",u,{once:!0}),a.onmessage=e=>{if(p)return;let t;try{t=JSON.parse(e.data)}catch{return}if(t.status&&as.has(t.status))return void(c&&c(t));const r=o(t);"pending"!==r.kind?(p=!0,m(),n({type:"settled",verdict:r})):c&&c(t)},a.onerror=()=>{p||(p=!0,m(),n({type:"transport"}))}}));if("settled"===p.type){const{verdict:e}=p;if("resolve"===e.kind)return e.value;throw e.error}if(u+=1,u>a)throw new h(`Conexão perdida após ${a} tentativas de reconexão`,f.NETWORK);const m=Math.min(500*2**(u-1),8e3);await cs(m,i)}}const ls={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},us=n.forwardRef((({variant:e="primary",style:n,type:t="button",...r},a)=>{const i="primary"===e?{background:`var(${aa})`,color:`var(${ia})`}:"secondary"===e?{background:`var(${ea})`,color:`var(${ta})`}:{background:"transparent",color:`var(${oa})`};return o.jsx("button",{ref:a,type:t,...r,style:{...ls,...i,...n}})}));function ps({tone:e,children:n,icon:t,className:r}){const a=Vr[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]})}us.displayName="Button";const fs="neofaceid-awaiting-push-styles",hs="\n.neofaceid-root .nfid-push {\n display: flex; flex-direction: column; align-items: center; text-align: center; gap: 10px;\n padding: 8px 8px 4px;\n}\n.neofaceid-root .nfid-push 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-push p {\n margin: 0; font-size: 14px; color: var(--nfid-text-muted); line-height: 1.5;\n}\n.neofaceid-root .nfid-push-phone-icon {\n width: 56px; height: 56px; color: var(--nfid-action);\n}\n.neofaceid-root .nfid-push-code {\n display: flex; flex-direction: column; align-items: center; gap: 6px;\n margin-top: 14px; padding: 16px 28px;\n background: var(--nfid-surface-muted); border-radius: 16px; width: 100%;\n}\n.neofaceid-root .nfid-push-code-label {\n font-size: 11px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase;\n color: var(--nfid-text-subtle);\n}\n.neofaceid-root .nfid-push-code-value {\n font-size: 52px; font-weight: 800; line-height: 1; letter-spacing: 0.08em;\n color: var(--nfid-text); font-variant-numeric: tabular-nums;\n}\n.neofaceid-root .nfid-push-countdown {\n font-size: 13px; color: var(--nfid-text-muted); font-variant-numeric: tabular-nums;\n margin-top: 12px;\n}\n.neofaceid-root .nfid-push-actions {\n display: flex; flex-direction: column; gap: 10px; width: 100%; margin-top: 16px;\n}\n.neofaceid-root .nfid-push-footer {\n display: flex; justify-content: center; margin-top: 16px; padding-top: 12px;\n border-top: 1px solid var(--nfid-line);\n width: 100%;\n}\n.neofaceid-root .nfid-push-pulse {\n animation: nfidPushPulse 1.8s ease-in-out infinite;\n}\n@keyframes nfidPushPulse {\n 0%, 100% { opacity: 1; }\n 50% { opacity: 0.45; }\n}\n@media (prefers-reduced-motion: reduce) {\n .neofaceid-root .nfid-push-pulse { animation: none; }\n}\n";function ms(e){const n=Math.max(0,e);return`${Math.floor(n/60)}:${String(n%60).padStart(2,"0")}`}function gs({appName:e,numericCode:t,remainingSeconds:r,onCancel:a}){return n.useEffect((()=>{pa(),fa(fs,hs)}),[]),o.jsxs("div",{className:"nfid-push",role:"status","aria-live":"polite",children:[o.jsx(ps,{tone:"attention",children:"Aguardando confirmação"}),o.jsxs("svg",{className:"nfid-push-phone-icon nfid-push-pulse",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[o.jsx("rect",{x:"6",y:"2",width:"12",height:"20",rx:"3"}),o.jsx("path",{d:"M11 18h2"})]}),o.jsx("h2",{children:"Confirme no seu celular"}),o.jsxs("p",{children:["Enviamos um pedido de confirmação para o seu aparelho. Abra o NeoFaceID Push e confirme com o seu rosto para continuar no ",e,"."]}),t&&o.jsxs("div",{className:"nfid-push-code",children:[o.jsx("span",{className:"nfid-push-code-label",children:"Digite este número no celular"}),o.jsx("span",{className:"nfid-push-code-value","aria-label":`Código de confirmação: ${t.split("").join(" ")}`,children:t})]}),o.jsxs("p",{className:"nfid-push-countdown",children:["Expira em ",ms(r)]}),o.jsx("div",{className:"nfid-push-actions",children:o.jsx(us,{variant:"ghost",onClick:a,children:"Cancelar"})}),o.jsx("div",{className:"nfid-push-footer",children:o.jsx(Ei,{})})]})}function vs({onFallback:e,onCancel:t}){return n.useEffect((()=>{pa(),fa(fs,hs)}),[]),o.jsxs("div",{className:"nfid-push",role:"alert","aria-live":"assertive",children:[o.jsxs("svg",{className:"nfid-push-phone-icon",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",style:{color:"var(--nfid-text-muted)"},children:[o.jsx("circle",{cx:"12",cy:"12",r:"9"}),o.jsx("path",{d:"M12 7v5l3 2"})]}),o.jsx("h2",{children:"O tempo esgotou"}),o.jsx("p",{children:"Não recebemos a confirmação do seu celular a tempo."}),o.jsx("div",{className:"nfid-push-actions",children:e?o.jsxs(o.Fragment,{children:[o.jsx(us,{variant:"primary",onClick:e,children:"Entrar de outro jeito"}),o.jsx(us,{variant:"ghost",onClick:t,children:"Agora não"})]}):o.jsx(us,{variant:"primary",onClick:t,children:"Entendi"})}),o.jsx("div",{className:"nfid-push-footer",children:o.jsx(Ei,{})})]})}function xs({appName:e,onFallback:t,onCancel:r}){return n.useEffect((()=>{pa(),fa(fs,hs)}),[]),o.jsxs("div",{className:"nfid-push",role:"alert","aria-live":"assertive",children:[o.jsxs("svg",{className:"nfid-push-phone-icon",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",style:{color:"var(--nfid-text-muted)"},children:[o.jsx("circle",{cx:"12",cy:"12",r:"9"}),o.jsx("path",{d:"M8 12h8"})]}),o.jsx("h2",{children:"Solicitação cancelada"}),o.jsxs("p",{children:["O pedido de confirmação foi cancelado antes de ser respondido. Você pode tentar de novo pelo"," ",e,"."]}),o.jsx("div",{className:"nfid-push-actions",children:t?o.jsxs(o.Fragment,{children:[o.jsx(us,{variant:"primary",onClick:t,children:"Entrar de outro jeito"}),o.jsx(us,{variant:"ghost",onClick:r,children:"Agora não"})]}):o.jsx(us,{variant:"primary",onClick:r,children:"Entendi"})}),o.jsx("div",{className:"nfid-push-footer",children:o.jsx(Ei,{})})]})}function bs({appName:e,onCancel:t}){return n.useEffect((()=>{pa(),fa(fs,hs)}),[]),o.jsxs("div",{className:"nfid-push",role:"alert","aria-live":"assertive",children:[o.jsxs("svg",{className:"nfid-push-phone-icon",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",style:{color:"#D64545"},children:[o.jsx("circle",{cx:"12",cy:"12",r:"9"}),o.jsx("path",{d:"M15 9l-6 6M9 9l6 6"})]}),o.jsx("h2",{children:"Confirmação recusada"}),o.jsxs("p",{children:["O pedido foi recusado no celular. Se não foi você, procure o suporte do ",e,"."]}),o.jsx("div",{className:"nfid-push-actions",children:o.jsx(us,{variant:"primary",onClick:t,children:"Entendi"})}),o.jsx("div",{className:"nfid-push-footer",children:o.jsx(Ei,{})})]})}function ws(e){var n,t,o;switch(e.status){case"approved":case"success":return{kind:"resolve",value:{status:"approved",data:e.data??{}}};case"denied":return{kind:"resolve",value:{status:"denied",reason:(null==(n=e.data)?void 0:n.reason)??e.message}};case"expired":return{kind:"resolve",value:{status:"expired"}};case"cancelled":return{kind:"resolve",value:{status:"cancelled",source:"server",reason:(null==(t=e.data)?void 0:t.reason)??e.message}};case"failed":case"error":return{kind:"reject",error:new h(e.message??(null==(o=e.data)?void 0:o.message)??"Falha na confirmação",f.API_ERROR)};default:return{kind:"pending"}}}function ys({requestId:e,applicationToken:t,expiresIn:r,numericCode:a,appName:i,onFallback:s,onSettle:c}){const d=i??Ea()??"sua aplicação",[l,u]=n.useState(r),[p,m]=n.useState({kind:"waiting"});return n.useEffect((()=>{if("waiting"!==p.kind)return;const e=setInterval((()=>{u((e=>e>0?e-1:0))}),1e3);return()=>clearInterval(e)}),[p.kind]),n.useEffect((()=>{const n=new AbortController;let o=!1;const a=ya(),i=`${a}/api/v1/authorization/events/${encodeURIComponent(e)}/ticket/`;return ds({signal:n.signal,timeoutMs:1e3*(r+30),requestTicket:async()=>{var e;const n=await fetch(i,{method:"POST",headers:{"Content-Type":"application/json","X-App-Token":t}});if(!n.ok)throw new h(`Falha ao abrir canal de confirmação: ${n.status}`,401===n.status||403===n.status?f.INVALID_TOKEN:f.NETWORK);const o=await n.json(),r=(null==(e=null==o?void 0:o.data)?void 0:e.ticket)??(null==o?void 0:o.ticket);if(!r)throw new h("Canal de confirmação sem ticket",f.API_ERROR);return r},buildUrl:n=>`${a}/api/v1/authorization/events/${encodeURIComponent(e)}/?ticket=${encodeURIComponent(n)}`,classify:ws}).then((e=>{o||(o=!0,"denied"!==e.status?"expired"!==e.status?"cancelled"!==e.status?c(e):m({kind:"cancelled",reason:e.reason}):m({kind:"expired"}):m({kind:"denied"}))})).catch((()=>{o||n.signal.aborted||(o=!0,m({kind:"expired"}))})),()=>{o=!0,n.abort()}}),[e]),"denied"===p.kind?o.jsx(rs,{open:!0,dismissOnOverlay:!1,ariaLabel:"Confirmação recusada",children:o.jsx(bs,{appName:d,onCancel:()=>c({status:"denied"})})}):"cancelled"===p.kind?o.jsx(rs,{open:!0,dismissOnOverlay:!1,ariaLabel:"Solicitação cancelada",children:o.jsx(xs,{appName:d,onFallback:s?()=>{s(),c({status:"cancelled",source:"server",reason:p.reason})}:void 0,onCancel:()=>c({status:"cancelled",source:"server",reason:p.reason})})}):"expired"===p.kind?o.jsx(rs,{open:!0,dismissOnOverlay:!1,ariaLabel:"Tempo esgotado",children:o.jsx(vs,{onFallback:s?()=>{s(),c({status:"expired"})}:void 0,onCancel:()=>c({status:"expired"})})}):o.jsx(rs,{open:!0,dismissOnOverlay:!1,ariaLabel:"Aguardando confirmação no celular",children:o.jsx(gs,{appName:d,numericCode:a,remainingSeconds:l,onCancel:()=>c({status:"cancelled",source:"user"})})})}const ks="neofaceid-device-enrollment-styles",Es="\n.neofaceid-root .nfid-enroll {\n display: flex; flex-direction: column; align-items: center; text-align: center; gap: 10px;\n padding: 8px 8px 4px;\n}\n.neofaceid-root .nfid-enroll 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-enroll p {\n margin: 0; font-size: 14px; color: var(--nfid-text-muted); line-height: 1.5;\n}\n/* O QR é sempre escuro sobre branco, independente do tema: leitor de código\n falha com contraste invertido, e a moldura clara faz a zona de silêncio. */\n.neofaceid-root .nfid-enroll-qr {\n background: #FFFFFF; padding: 14px; border-radius: 16px; margin-top: 12px;\n line-height: 0; box-shadow: 0 0 0 1px var(--nfid-line);\n}\n.neofaceid-root .nfid-enroll-qr svg { display: block; width: 184px; height: 184px; }\n.neofaceid-root .nfid-enroll-handle {\n display: flex; flex-direction: column; align-items: center; gap: 4px;\n margin-top: 14px; padding: 12px 24px;\n background: var(--nfid-surface-muted); border-radius: 12px; width: 100%;\n}\n.neofaceid-root .nfid-enroll-handle-label {\n font-size: 11px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase;\n color: var(--nfid-text-subtle);\n}\n.neofaceid-root .nfid-enroll-handle-value {\n font-size: 26px; font-weight: 800; line-height: 1.1; letter-spacing: 0.12em;\n color: var(--nfid-text); font-variant-numeric: tabular-nums;\n font-family: ui-monospace, SFMono-Regular, Menlo, monospace;\n}\n.neofaceid-root .nfid-enroll-countdown {\n font-size: 13px; color: var(--nfid-text-muted); font-variant-numeric: tabular-nums;\n margin-top: 10px;\n}\n.neofaceid-root .nfid-enroll-actions {\n display: flex; flex-direction: column; gap: 10px; width: 100%; margin-top: 16px;\n}\n.neofaceid-root .nfid-enroll-note {\n font-size: 12px; line-height: 1.45; color: var(--nfid-text-muted);\n background: var(--nfid-surface-muted); border-radius: 10px;\n padding: 10px 14px; margin-top: 12px; text-align: left; width: 100%;\n}\n.neofaceid-root .nfid-enroll-icon { width: 56px; height: 56px; }\n.neofaceid-root .nfid-enroll-footer {\n display: flex; justify-content: center; margin-top: 16px; padding-top: 12px;\n border-top: 1px solid var(--nfid-line); width: 100%;\n}\n";function _s(e){const n=Math.max(0,e);return`${Math.floor(n/60)}:${String(n%60).padStart(2,"0")}`}function Ns({value:e}){const[t,r]=n.useState(null);return n.useEffect((()=>{let n=!1;return Promise.resolve().then((()=>Zc)).then((t=>{if(n)return;const o=(t.default??t)(0,"M");o.addData(e),o.make();const a=o.getModuleCount(),i=[];for(let e=0;e<a;e+=1)for(let n=0;n<a;n+=1)o.isDark(e,n)&&i.push(`M${n} ${e}h1v1h-1z`);r({d:i.join(""),count:a})})).catch((()=>{n||r(null)})),()=>{n=!0}}),[e]),t?o.jsx("svg",{viewBox:`0 0 ${t.count} ${t.count}`,shapeRendering:"crispEdges",role:"img","aria-label":`Código para inscrição do aparelho: ${e.split("").join(" ")}`,children:o.jsx("path",{d:t.d,fill:"#000000"})}):o.jsx("svg",{viewBox:"0 0 21 21","aria-hidden":"true"})}function Ts({appName:e,handle:t,remainingSeconds:r,onCancel:a}){return n.useEffect((()=>{pa(),fa(ks,Es)}),[]),o.jsxs("div",{className:"nfid-enroll",role:"status","aria-live":"polite",children:[o.jsx(ps,{tone:"attention",children:"Aguardando o aparelho"}),o.jsx("h2",{children:"Vincule seu celular"}),o.jsxs("p",{children:["Abra o NeoFaceID Push no celular e aponte para este código para vinculá-lo à sua conta no"," ",e,"."]}),o.jsx("div",{className:"nfid-enroll-qr",children:o.jsx(Ns,{value:t})}),o.jsxs("div",{className:"nfid-enroll-handle",children:[o.jsx("span",{className:"nfid-enroll-handle-label",children:"Ou digite este código"}),o.jsx("span",{className:"nfid-enroll-handle-value",children:t})]}),o.jsxs("p",{className:"nfid-enroll-countdown",children:["O código expira em ",_s(r)]}),o.jsx("div",{className:"nfid-enroll-actions",children:o.jsx(us,{variant:"ghost",onClick:a,children:"Cancelar"})}),o.jsx("div",{className:"nfid-enroll-footer",children:o.jsx(Ei,{})})]})}function Cs({deviceLabel:e,onDone:t}){return n.useEffect((()=>{pa(),fa(ks,Es)}),[]),o.jsxs("div",{className:"nfid-enroll",role:"alert","aria-live":"assertive",children:[o.jsxs("svg",{className:"nfid-enroll-icon",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",style:{color:"#1E9E6A"},children:[o.jsx("circle",{cx:"12",cy:"12",r:"9"}),o.jsx("path",{d:"M8.5 12.5l2.5 2.5 4.5-5"})]}),o.jsx("h2",{children:"Aparelho vinculado"}),e?o.jsxs("p",{children:[o.jsx("strong",{children:e})," agora pode confirmar suas operações."]}):o.jsx("p",{children:"Um aparelho acabou de ser vinculado à sua conta."}),o.jsx("div",{className:"nfid-enroll-note",children:e?o.jsx(o.Fragment,{children:"Se este não é o seu aparelho, procure o suporte agora — alguém pode ter vinculado um celular à sua conta."}):o.jsxs(o.Fragment,{children:[o.jsx("strong",{children:"Não conseguimos identificar qual aparelho foi vinculado."})," Se não foi você quem acabou de fazer isso, procure o suporte agora — alguém pode ter vinculado um celular à sua conta."]})}),o.jsx("div",{className:"nfid-enroll-actions",children:o.jsx(us,{variant:"primary",onClick:t,children:"Entendi"})}),o.jsx("div",{className:"nfid-enroll-footer",children:o.jsx(Ei,{})})]})}function Ss({onRetry:e,onCancel:t}){return n.useEffect((()=>{pa(),fa(ks,Es)}),[]),o.jsxs("div",{className:"nfid-enroll",role:"alert","aria-live":"assertive",children:[o.jsxs("svg",{className:"nfid-enroll-icon",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",style:{color:"var(--nfid-text-muted)"},children:[o.jsx("circle",{cx:"12",cy:"12",r:"9"}),o.jsx("path",{d:"M12 7v5l3 2"})]}),o.jsx("h2",{children:"O código expirou"}),o.jsx("p",{children:"Códigos de vinculação valem poucos minutos, por segurança. Gere um novo para tentar."}),o.jsxs("div",{className:"nfid-enroll-actions",children:[o.jsx(us,{variant:"primary",onClick:e,children:"Gerar novo código"}),o.jsx(us,{variant:"ghost",onClick:t,children:"Agora não"})]}),o.jsx("div",{className:"nfid-enroll-footer",children:o.jsx(Ei,{})})]})}function js(e){var n,t,o;switch(e.status){case"enrolled":return{kind:"resolve",value:{status:"enrolled",deviceLabel:(null==(n=e.data)?void 0:n.device_label)??null,enrolledAt:null==(t=e.data)?void 0:t.enrolled_at}};case"expired":return{kind:"resolve",value:{status:"expired"}};case"error":case"failed":return{kind:"reject",error:new h(e.message??(null==(o=e.data)?void 0:o.message)??"Falha ao inscrever o aparelho",f.API_ERROR)};default:return{kind:"pending"}}}function Os({userAccessToken:e,applicationToken:t,appName:r,attempt:a,onSettle:i,onRetry:s,onFatal:c}){const d=r??Ea()??"sua aplicação",[l,u]=n.useState({kind:"loading"}),[p,m]=n.useState(0);return n.useEffect((()=>{const n=new AbortController;let o=!1;return(async()=>{let r;try{r=await Za(e,t)}catch(i){return void(o||c(i))}if(o)return;u({kind:"waiting",handle:r.handle,jti:r.jti,expiresIn:r.expiresIn}),m(r.expiresIn);const a=`${ya()}/api/v1/devices/enrollment/${encodeURIComponent(r.jti)}/events/`;try{const e=await ds({signal:n.signal,timeoutMs:1e3*(r.expiresIn+30),requestTicket:async()=>{var e;const n=await fetch(`${a}ticket/`,{method:"POST",headers:{"Content-Type":"application/json","X-App-Token":t}});if(!n.ok)throw new h(`Falha ao abrir o canal de inscrição: ${n.status}`,401===n.status||403===n.status?f.INVALID_TOKEN:f.NETWORK);const o=await n.json(),r=(null==(e=null==o?void 0:o.data)?void 0:e.ticket)??(null==o?void 0:o.ticket);if(!r)throw new h("Canal de inscrição sem ticket",f.API_ERROR);return r},buildUrl:e=>`${a}?ticket=${encodeURIComponent(e)}`,classify:js});if(o)return;if("enrolled"===e.status)return void u({kind:"enrolled",deviceLabel:e.deviceLabel,enrolledAt:e.enrolledAt});u({kind:"expired"})}catch{if(o||n.signal.aborted)return;u({kind:"expired"})}})(),()=>{o=!0,n.abort()}}),[a]),n.useEffect((()=>{if("waiting"!==l.kind)return;const e=setInterval((()=>m((e=>e>0?e-1:0))),1e3);return()=>clearInterval(e)}),[l.kind]),"loading"===l.kind?null:"enrolled"===l.kind?o.jsx(rs,{open:!0,dismissOnOverlay:!1,ariaLabel:"Aparelho vinculado",children:o.jsx(Cs,{deviceLabel:l.deviceLabel,onDone:()=>i({status:"enrolled",deviceLabel:l.deviceLabel,enrolledAt:l.enrolledAt})})}):"expired"===l.kind?o.jsx(rs,{open:!0,dismissOnOverlay:!1,ariaLabel:"Código expirado",children:o.jsx(Ss,{onRetry:s,onCancel:()=>i({status:"expired"})})}):o.jsx(rs,{open:!0,dismissOnOverlay:!1,ariaLabel:"Vincular aparelho",children:o.jsx(Ts,{appName:d,handle:l.handle,remainingSeconds:p,onCancel:()=>i({status:"cancelled"})})})}function Rs(e={}){const n=document.createElement("div");n.className="neofaceid-camera-oval-guide-overlay-root",Object.assign(n.style,{position:"fixed",top:"0",left:"0",width:"100vw",height:"100vh",backgroundColor:"rgba(0, 0, 0, 0.85)",backdropFilter:"blur(8px)",zIndex:"99999",display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center"}),document.body.appendChild(n);let r=t.createRoot(n),a=e.stream||null,i=e.faceState||"searching",s=e.instruction||"Centralize o rosto";const c=(n,t,a)=>{r&&r.render(o.jsxs("div",{style:{position:"relative",width:"100%",height:"100%",display:"flex",alignItems:"center",justifyContent:"center"},children:[e.onCancel&&o.jsx("button",{onClick:()=>{var n;d.close(),null==(n=e.onCancel)||n.call(e)},style:{position:"absolute",top:"20px",right:"20px",background:"rgba(255, 255, 255, 0.2)",border:"none",color:"#fff",fontSize:"24px",width:"40px",height:"40px",borderRadius:"50%",cursor:"pointer",zIndex:10,display:"flex",alignItems:"center",justifyContent:"center"},"aria-label":"Cancelar",children:"✕"}),o.jsx(Is,{stream:n,faceState:t,instruction:a})]}))};c(a,i,s);const d={update:(e,n,t)=>{a=e,i=n,s=t,c(e,n,t)},close:()=>{r&&(r.unmount(),r=null),n.parentElement&&n.parentElement.removeChild(n)}};return d}function Is({stream:e,faceState:t,instruction:r,className:a="",style:i={}}){const s=n.useRef(null);n.useEffect((()=>{const n=s.current;if(n)return e?(n.srcObject=e,n.play().catch((()=>{}))):n.srcObject=null,()=>{e&&e.getTracks().forEach((e=>e.stop())),n&&(n.srcObject=null)}}),[e]);const c=function(e){switch(e){case"centered":return{borderColor:"#0E9F6E",boxShadow:"0 0 0 4px rgba(14, 159, 110, 0.8), 0 0 45px rgba(14, 159, 110, 0.45)",svgStroke:"#0E9F6E",badgeBg:"rgba(14, 159, 110, 0.95)",badgeColor:"#FFFFFF"};case"too-far":case"too-close":case"off-center":return{borderColor:"#F59E0B",boxShadow:"0 0 0 4px rgba(245, 158, 11, 0.7), 0 0 35px rgba(245, 158, 11, 0.35)",svgStroke:"#F59E0B",badgeBg:"rgba(245, 158, 11, 0.95)",badgeColor:"#1F2937"};default:return{borderColor:"rgba(156, 163, 175, 0.5)",boxShadow:"0 0 0 4px rgba(156, 163, 175, 0.3), 0 0 20px rgba(156, 163, 175, 0.15)",svgStroke:"#9CA3AF",badgeBg:"rgba(55, 65, 81, 0.9)",badgeColor:"#FFFFFF"}}}(t);return o.jsxs("div",{className:`neofaceid-camera-oval-guide-container ${a}`,style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",position:"relative",width:"100%",maxHeight:"100%",padding:"16px",boxSizing:"border-box",...i},children:[o.jsx("style",{children:"\n .neofaceid-oval-frame {\n width: 320px;\n height: 400px;\n border-radius: 50%;\n overflow: hidden;\n position: relative;\n background: #000000;\n transition: box-shadow 0.3s ease, border-color 0.3s ease;\n }\n\n .neofaceid-oval-video {\n width: 100%;\n height: 100%;\n object-fit: cover;\n transform: scaleX(-1);\n display: block;\n }\n\n .neofaceid-oval-svg-overlay {\n position: absolute;\n inset: 0;\n width: 100%;\n height: 100%;\n pointer-events: none;\n z-index: 2;\n }\n\n .neofaceid-oval-instruction-badge {\n margin-top: 20px;\n padding: 10px 20px;\n border-radius: 20px;\n font-size: 15px;\n font-weight: 600;\n text-align: center;\n max-width: 320px;\n box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);\n backdrop-filter: blur(8px);\n transition: background-color 0.3s ease, color 0.3s ease;\n z-index: 5;\n }\n\n @media (max-width: 640px) {\n .neofaceid-oval-frame {\n width: 280px;\n height: 350px;\n }\n }\n "}),o.jsxs("div",{className:"neofaceid-oval-frame",style:{boxShadow:c.boxShadow,borderColor:c.borderColor},children:[o.jsx("video",{ref:s,className:"neofaceid-oval-video",autoPlay:!0,playsInline:!0,muted:!0,"data-testid":"camera-oval-video"}),o.jsx("svg",{className:"neofaceid-oval-svg-overlay",viewBox:"0 0 320 400",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:o.jsx("ellipse",{cx:"160",cy:"200",rx:"140",ry:"180",stroke:c.svgStroke,strokeWidth:"3",strokeDasharray:"searching"===t?"8 8":"none",style:{transition:"stroke 0.3s ease"}})})]}),r&&o.jsx("div",{className:"neofaceid-oval-instruction-badge","aria-live":"assertive",style:{backgroundColor:c.badgeBg,color:c.badgeColor},"data-testid":"camera-oval-instruction",children:r})]})}function zs({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 Ni(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 As{constructor(){i(this,"container",null),i(this,"root",null)}show(e,n,o,r,a){this.container||(pa(),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(zs,{error:e,onRetry:()=>{this.close(),n()},onCredentials:()=>{this.close(),t()},applicationToken:a??"",onCancel:()=>{this.close(),null==r||r()}}))}}class Fs{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(){pa(),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 ${_i()}\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)||fa(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 Va(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 Ps=!1,$s=null;async function Ls(){if(!Ps)return $s||($s=(async()=>{try{const e="/models";await d.nets.tinyFaceDetector.loadFromUri(e),Ps=!0}catch(e){}})(),$s)}async function Ds(e,n,t,o=5e3,r=100){return new Promise((a=>{let i=0;const s=Math.ceil(o/r);let c=null,l=!1,u=0;const p=e=>{l||(l=!0,c&&clearTimeout(c),a(e))},f=async()=>{if(!l){if(i++,!Ps)return t.update(n,"searching","Carregando modelos de detecção..."),i>=s?void p(!1):void(c=window.setTimeout(f,r));try{const o=await d.detectSingleFace(e,new d.TinyFaceDetectorOptions({inputSize:160,scoreThreshold:.3})),{faceState:a,instruction:l}=function(e,n,t){if(!e||!n||!t)return{faceState:"searching",instruction:"Centralize o rosto"};const o=e.x+e.width/2,r=e.y+e.height/2,a=n/2,i=t/2,s=Math.abs(o-a)/n,c=Math.abs(r-i)/t,d=e.width*e.height/(n*t);return d<.08?{faceState:"too-far",instruction:"Aproxime-se"}:d>.45?{faceState:"too-close",instruction:"Afaste-se"}:s>.18||c>.18?{faceState:"off-center",instruction:"Centralize o rosto"}:{faceState:"centered",instruction:"Perfeito, mantenha"}}(o?o.box:null,e.videoWidth,e.videoHeight);if(t.update(n,a,l),"centered"===a){if(u+=r,u>=1e3)return void p(!0)}else u=0;if(i>=s)return void p(!1);c=window.setTimeout(f,r)}catch(o){if(i>=s)return void p(!1);c=window.setTimeout(f,r)}}};window.setTimeout((()=>{l||p(!1)}),o+500),f()}))}async function Ms(e){const{applicationToken:n,onSuccess:t,onError:o,onFallbackRequest:r,onCancel:a,fastMode:i=!1}=e,s=new As;let c,d=0;Ps||i||Ls().catch((()=>{}));const l=async()=>{try{d++;const e=await async function(e,n=!1,t){const o=Rs({stream:null,faceState:"searching",instruction:"Iniciando câmera...",onCancel:t}),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,o.update(a,"searching","Centralize o rosto"),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()}})),await new Promise((e=>setTimeout(e,100)));let t=!0;if(n||(t=await Ds(r,a,o,5e3,100)),!t)throw o.close(),a&&a.getTracks().forEach((e=>e.stop())),r.parentElement&&r.parentElement.removeChild(r),new h("Nenhum rosto centralizado detectado. Por favor, tente novamente.",f.VALIDATION_ERROR);o.update(a,"centered","Capturando imagem...");const i=document.createElement("canvas");i.width=r.videoWidth,i.height=r.videoHeight;const s=i.getContext("2d");if(!s)throw o.close(),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);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)}));o.update(a,"centered","Verificando com o servidor...");const d=await Da(c,e);if(o.close(),a&&a.getTracks().forEach((e=>e.stop())),r.parentElement&&r.parentElement.removeChild(r),!d.success)throw new h("Login falhou",f.LOGIN_FAILED);return d}catch(i){if(o.close(),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)}}(n,i,a);t(e)}catch(e){c=e instanceof h?e:new h(e instanceof Error?e.message:"Erro desconhecido",f.UNKNOWN),d<2?setTimeout((()=>{l()}),500):setTimeout((()=>{s.show(c,(()=>{d=0,setTimeout((()=>l()),500)}),(()=>{r?r():o(new h("Por favor, use email e senha para fazer login",f.LOGIN_FAILED))}),a,n)}),500)}};l()}const Bs=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(!Ps)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:Ms,preloadFaceDetectionModels:Ls},Symbol.toStringTag,{value:"Module"}));function qs(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))},x=()=>{"undefined"==typeof document||g||(g=document.createElement("canvas"));const n=ci(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((()=>{ci(e(),{scratch:g??void 0})-(h??0)<o&&(f=Date.now(),v(!1)),h=null}),600)))};return{start(){!1!==n.enabled&&(c||(x(),c=setInterval(x,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 Us{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=qs((()=>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 ${_i()}\n </div>\n </div>\n </div>\n `,pa(),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((()=>Gc)),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(),fa(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 ")}}const Ws="Consentimento recusado pelo usuário.";let Ks=null;function Vs(){Ks=null}async function Zs({applicationToken:e,purpose:n}){if(!e)throw new h("applicationToken é obrigatório para abrir sessão de captura",f.INVALID_TOKEN);const t=`${ya()}/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 Ks={session_id:i,expires_at:s},Ks}async function Js({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=`${ya()}/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 Gs({applicationToken:e,purpose:n,collectFramesForGesture:t,retryOnSessionExpired:o=!0}){const r=async()=>{const o=await Zs({applicationToken:e,purpose:n}),r=await Js({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 Vs(),r();throw a}}class Hs{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 ${_i()}\n </div>\n </div>\n `,pa(),fa("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=qs((()=>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 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(${aa})`,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 Qs({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(${aa}, url(#nfid-challenge-arc))`,strokeWidth:4.2,strokeLinecap:"round",strokeDasharray:c,strokeDashoffset:d,fill:"none",style:{transition:"stroke-dashoffset 200ms ease-out"}})]})]})}function ec({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(${aa})`,...a},role:"img","aria-label":nc[e],children:["blink"===e?o.jsx(oc,{stroke:3.4}):o.jsx(tc,{stroke:3.4}),"blink"!==e&&"center"!==e&&o.jsx(rc,{gesture:e,stroke:3.4})]})}const nc={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 tc({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 oc({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 rc({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"})}const ac={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"]},ic={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 sc={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 cc(){n.useEffect((()=>{pa(),fa("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 dc({appName:e,onContinue:n}){return cc(),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(us,{variant:"primary",onClick:n,children:"Continuar"})})]})}function lc({errorCode:e,attempt:n,maxAttempts:t,timestamp:r,onRetry:a,onFallback:i}){cc();const s=function(e){if(!e)return ac;const n=e.toUpperCase();return ic[n]??ac}(e),c=r??new Date;return o.jsxs("div",{className:"nfid-state",role:"alert","aria-live":"assertive",children:[o.jsxs(ps,{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(us,{variant:"primary",onClick:a,children:"Tentar de novo"}),o.jsx(us,{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 uc({browser:e,onFallback:n,onCancel:t}){cc();const r=function(e){return sc[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(us,{variant:"primary",onClick:n,children:"Verificar de outro jeito"}),o.jsx(us,{variant:"ghost",onClick:t,children:"Agora não"})]})]})}const pc={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"},fc={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 hc({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,x]=n.useState(null),[b,w]=n.useState("preparing"),[y,k]=n.useState(1),[E,_]=n.useState(void 0),[N,T]=n.useState(void 0),[C,S]=n.useState(0),j=n.useRef(!1),[O,R]=n.useState(!1),{flashOn:I}=di(p,{enabled:l&&!O&&"challenging"===b}),z=Na(),A=t??Ea()??"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,z):null;n.useEffect((()=>{pa(),fa("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 j.current=!1,w("preparing"),g(0),x(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 w("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((()=>{}))),w("challenging");const o=await Gs({applicationToken:e,purpose:"authorization",collectFramesForGesture:async(e,n,t)=>{if(j.current)throw new h("Cancelado",f.UNKNOWN);x(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,w("success"),s&&s(o)}catch(o){if(j.current)return;const e=o instanceof h?o:new h(o instanceof Error?o.message:"Falha",f.UNKNOWN);_(e.type),T(new Date),w("failure"),c&&c(e)}finally{n&&n.getTracks().forEach((e=>e.stop()))}}(),()=>{j.current=!0,n&&n.getTracks().forEach((e=>e.stop()))}}),[C]);const P=()=>{j.current=!0,d&&d(),u()},$=()=>{y>=3?P():(k((e=>e+1)),_(void 0),T(void 0),S((e=>e+1)))},L=()=>{j.current=!0,c&&c(new h("Fluxo alternativo solicitado pelo usuário",f.CONSENT_DENIED)),u()},D=v?pc[v.gesture_key]??"center":"center",M=v?fc[v.gesture_key]??"Siga a instrução":"Preparando a câmera…";return"success"===b?o.jsx(rs,{open:!0,dismissOnOverlay:!1,ariaLabel:"Identidade confirmada",children:o.jsx(dc,{appName:A,onContinue:u})}):"permission-denied"===b?o.jsx(rs,{open:!0,dismissOnOverlay:!1,ariaLabel:"Câmera bloqueada",children:o.jsx(uc,{onFallback:L,onCancel:P})}):"failure"===b?o.jsx(rs,{open:!0,dismissOnOverlay:!1,ariaLabel:"Não foi possível confirmar",children:o.jsx(lc,{errorCode:E,attempt:y,maxAttempts:3,timestamp:N,onRetry:$,onFallback:L})}):o.jsxs(rs,{open:!0,onDismiss:void 0,dismissOnOverlay:!1,ariaLabel:"Autorização por biometria",children:[o.jsx(li,{active:I,onDismiss:()=>R(!0)}),o.jsxs("div",{style:{position:"relative"},children:[o.jsx("button",{type:"button",className:"nfid-authorize-close",onClick:P,"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(Qs,{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(ec,{gesture:D,size:40}),o.jsx("p",{className:"nfid-authorize-instruction","aria-live":"assertive",style:{margin:0},children:M})]}),"preparing"===b&&o.jsx("p",{className:"nfid-authorize-support",children:"Ligando sua câmera…"}),o.jsx("div",{className:"nfid-authorize-actions",children:o.jsx(us,{variant:"ghost",onClick:P,children:"Não consigo fazer esse movimento"})}),o.jsx("div",{className:"nfid-authorize-footer",children:o.jsx(Ei,{})})]})]})}const mc={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 gc{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 ts({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 ',pa(),fa("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(mc).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?mc[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?mc[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 ${_i()}\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 Ca(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=qs((()=>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?mc[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 vc=async e=>new gc(e).open(),xc=Object.freeze(Object.defineProperty({__proto__:null,DocumentCaptureModal:gc,startDocumentCapture:vc},Symbol.toStringTag,{value:"Module"})),bc="Consentimento recusado pelo usuário.";const wc=function(e,n){let t=e;const o=Nc[n];let r=null,a=0,i=null;const s=[],c={},d=function(e,n){a=4*t+17,r=function(e){const n=new Array(e);for(let t=0;t<e;t+=1){n[t]=new Array(e);for(let o=0;o<e;o+=1)n[t][o]=null}return n}(a),l(0,0),l(a-7,0),l(0,a-7),p(),u(),h(e,n),t>=7&&f(e),null==i&&(i=g(t,o,s)),m(i,n)},l=function(e,n){for(let t=-1;t<=7;t+=1)if(!(e+t<=-1||a<=e+t))for(let o=-1;o<=7;o+=1)n+o<=-1||a<=n+o||(r[e+t][n+o]=0<=t&&t<=6&&(0==o||6==o)||0<=o&&o<=6&&(0==t||6==t)||2<=t&&t<=4&&2<=o&&o<=4)},u=function(){for(let e=8;e<a-8;e+=1)null==r[e][6]&&(r[e][6]=e%2==0);for(let e=8;e<a-8;e+=1)null==r[6][e]&&(r[6][e]=e%2==0)},p=function(){const e=Ac.getPatternPosition(t);for(let n=0;n<e.length;n+=1)for(let t=0;t<e.length;t+=1){const o=e[n],a=e[t];if(null==r[o][a])for(let e=-2;e<=2;e+=1)for(let n=-2;n<=2;n+=1)r[o+e][a+n]=-2==e||2==e||-2==n||2==n||0==e&&0==n}},f=function(e){const n=Ac.getBCHTypeNumber(t);for(let t=0;t<18;t+=1){const o=!e&&1==(n>>t&1);r[Math.floor(t/3)][t%3+a-8-3]=o}for(let t=0;t<18;t+=1){const o=!e&&1==(n>>t&1);r[t%3+a-8-3][Math.floor(t/3)]=o}},h=function(e,n){const t=o<<3|n,i=Ac.getBCHTypeInfo(t);for(let o=0;o<15;o+=1){const n=!e&&1==(i>>o&1);o<6?r[o][8]=n:o<8?r[o+1][8]=n:r[a-15+o][8]=n}for(let o=0;o<15;o+=1){const n=!e&&1==(i>>o&1);o<8?r[8][a-o-1]=n:o<9?r[8][15-o-1+1]=n:r[8][15-o-1]=n}r[a-8][8]=!e},m=function(e,n){let t=-1,o=a-1,i=7,s=0;const c=Ac.getMaskFunction(n);for(let d=a-1;d>0;d-=2)for(6==d&&(d-=1);;){for(let n=0;n<2;n+=1)if(null==r[o][d-n]){let t=!1;s<e.length&&(t=1==(e[s]>>>i&1));c(o,d-n)&&(t=!t),r[o][d-n]=t,i-=1,-1==i&&(s+=1,i=7)}if(o+=t,o<0||a<=o){o-=t,t=-t;break}}},g=function(e,n,t){const o=$c.getRSBlocks(e,n),r=Lc();for(let i=0;i<t.length;i+=1){const n=t[i];r.put(n.getMode(),4),r.put(n.getLength(),Ac.getLengthInBits(n.getMode(),e)),n.write(r)}let a=0;for(let i=0;i<o.length;i+=1)a+=o[i].dataCount;if(r.getLengthInBits()>8*a)throw"code length overflow. ("+r.getLengthInBits()+">"+8*a+")";for(r.getLengthInBits()+4<=8*a&&r.put(0,4);r.getLengthInBits()%8!=0;)r.putBit(!1);for(;!(r.getLengthInBits()>=8*a||(r.put(236,8),r.getLengthInBits()>=8*a));)r.put(17,8);return function(e,n){let t=0,o=0,r=0;const a=new Array(n.length),i=new Array(n.length);for(let l=0;l<n.length;l+=1){const s=n[l].dataCount,c=n[l].totalCount-s;o=Math.max(o,s),r=Math.max(r,c),a[l]=new Array(s);for(let n=0;n<a[l].length;n+=1)a[l][n]=255&e.getBuffer()[n+t];t+=s;const d=Ac.getErrorCorrectPolynomial(c),u=Pc(a[l],d.getLength()-1).mod(d);i[l]=new Array(d.getLength()-1);for(let e=0;e<i[l].length;e+=1){const n=e+u.getLength()-i[l].length;i[l][e]=n>=0?u.getAt(n):0}}let s=0;for(let l=0;l<n.length;l+=1)s+=n[l].totalCount;const c=new Array(s);let d=0;for(let l=0;l<o;l+=1)for(let e=0;e<n.length;e+=1)l<a[e].length&&(c[d]=a[e][l],d+=1);for(let l=0;l<r;l+=1)for(let e=0;e<n.length;e+=1)l<i[e].length&&(c[d]=i[e][l],d+=1);return c}(r,o)};c.addData=function(e,n){let t=null;switch(n=n||"Byte"){case"Numeric":t=Dc(e);break;case"Alphanumeric":t=Mc(e);break;case"Byte":t=Bc(e);break;case"Kanji":t=qc(e);break;default:throw"mode:"+n}s.push(t),i=null},c.isDark=function(e,n){if(e<0||a<=e||n<0||a<=n)throw e+","+n;return r[e][n]},c.getModuleCount=function(){return a},c.make=function(){if(t<1){let e=1;for(;e<40;e++){const n=$c.getRSBlocks(e,o),t=Lc();for(let o=0;o<s.length;o++){const n=s[o];t.put(n.getMode(),4),t.put(n.getLength(),Ac.getLengthInBits(n.getMode(),e)),n.write(t)}let r=0;for(let e=0;e<n.length;e++)r+=n[e].dataCount;if(t.getLengthInBits()<=8*r)break}t=e}d(!1,function(){let e=0,n=0;for(let t=0;t<8;t+=1){d(!0,t);const o=Ac.getLostPoint(c);(0==t||e>o)&&(e=o,n=t)}return n}())},c.createTableTag=function(e,n){e=e||2;let t="";t+='<table style="',t+=" border-width: 0px; border-style: none;",t+=" border-collapse: collapse;",t+=" padding: 0px; margin: "+(n=void 0===n?4*e:n)+"px;",t+='">',t+="<tbody>";for(let o=0;o<c.getModuleCount();o+=1){t+="<tr>";for(let n=0;n<c.getModuleCount();n+=1)t+='<td style="',t+=" border-width: 0px; border-style: none;",t+=" border-collapse: collapse;",t+=" padding: 0px; margin: 0px;",t+=" width: "+e+"px;",t+=" height: "+e+"px;",t+=" background-color: ",t+=c.isDark(o,n)?"#000000":"#ffffff",t+=";",t+='"/>';t+="</tr>"}return t+="</tbody>",t+="</table>",t},c.createSvgTag=function(e,n,t,o){let r={};"object"==typeof arguments[0]&&(r=arguments[0],e=r.cellSize,n=r.margin,t=r.alt,o=r.title),e=e||2,n=void 0===n?4*e:n,(t="string"==typeof t?{text:t}:t||{}).text=t.text||null,t.id=t.text?t.id||"qrcode-description":null,(o="string"==typeof o?{text:o}:o||{}).text=o.text||null,o.id=o.text?o.id||"qrcode-title":null;const a=c.getModuleCount()*e+2*n;let i,s,d,l,u,p="";for(u="l"+e+",0 0,"+e+" -"+e+",0 0,-"+e+"z ",p+='<svg version="1.1" xmlns="http://www.w3.org/2000/svg"',p+=r.scalable?"":' width="'+a+'px" height="'+a+'px"',p+=' viewBox="0 0 '+a+" "+a+'" ',p+=' preserveAspectRatio="xMinYMin meet"',p+=o.text||t.text?' role="img" aria-labelledby="'+v([o.id,t.id].join(" ").trim())+'"':"",p+=">",p+=o.text?'<title id="'+v(o.id)+'">'+v(o.text)+"</title>":"",p+=t.text?'<description id="'+v(t.id)+'">'+v(t.text)+"</description>":"",p+='<rect width="100%" height="100%" fill="white" cx="0" cy="0"/>',p+='<path d="',d=0;d<c.getModuleCount();d+=1)for(l=d*e+n,i=0;i<c.getModuleCount();i+=1)c.isDark(d,i)&&(s=i*e+n,p+="M"+s+","+l+u);return p+='" stroke="transparent" fill="black"/>',p+="</svg>",p},c.createDataURL=function(e,n){e=e||2,n=void 0===n?4*e:n;const t=c.getModuleCount()*e+2*n,o=n,r=t-n;return Kc(t,t,(function(n,t){if(o<=n&&n<r&&o<=t&&t<r){const r=Math.floor((n-o)/e),a=Math.floor((t-o)/e);return c.isDark(a,r)?0:1}return 1}))},c.createImgTag=function(e,n,t){e=e||2,n=void 0===n?4*e:n;const o=c.getModuleCount()*e+2*n;let r="";return r+="<img",r+=' src="',r+=c.createDataURL(e,n),r+='"',r+=' width="',r+=o,r+='"',r+=' height="',r+=o,r+='"',t&&(r+=' alt="',r+=v(t),r+='"'),r+="/>",r};const v=function(e){let n="";for(let t=0;t<e.length;t+=1){const o=e.charAt(t);switch(o){case"<":n+="<";break;case">":n+=">";break;case"&":n+="&";break;case'"':n+=""";break;default:n+=o}}return n};return c.createASCII=function(e,n){if((e=e||1)<2)return function(e){e=void 0===e?2:e;const n=1*c.getModuleCount()+2*e,t=e,o=n-e;let r,a,i,s,d;const l={"██":"█","█ ":"▀"," █":"▄"," ":" "},u={"██":"▀","█ ":"▀"," █":" "," ":" "};let p="";for(r=0;r<n;r+=2){for(i=Math.floor((r-t)/1),s=Math.floor((r+1-t)/1),a=0;a<n;a+=1)d="█",t<=a&&a<o&&t<=r&&r<o&&c.isDark(i,Math.floor((a-t)/1))&&(d=" "),t<=a&&a<o&&t<=r+1&&r+1<o&&c.isDark(s,Math.floor((a-t)/1))?d+=" ":d+="█",p+=e<1&&r+1>=o?u[d]:l[d];p+="\n"}return n%2&&e>0?p.substring(0,p.length-n-1)+Array(n+1).join("▀"):p.substring(0,p.length-1)}(n);e-=1,n=void 0===n?2*e:n;const t=c.getModuleCount()*e+2*n,o=n,r=t-n;let a,i,s,d;const l=Array(e+1).join("██"),u=Array(e+1).join(" ");let p="",f="";for(a=0;a<t;a+=1){for(s=Math.floor((a-o)/e),f="",i=0;i<t;i+=1)d=1,o<=i&&i<r&&o<=a&&a<r&&c.isDark(s,Math.floor((i-o)/e))&&(d=0),f+=d?l:u;for(s=0;s<e;s+=1)p+=f+"\n"}return p.substring(0,p.length-1)},c.renderTo2dContext=function(e,n){n=n||2;const t=c.getModuleCount();for(let o=0;o<t;o++)for(let r=0;r<t;r++)e.fillStyle=c.isDark(o,r)?"black":"white",e.fillRect(r*n,o*n,n,n)},c};wc.stringToBytes=function(e){const n=[];for(let t=0;t<e.length;t+=1){const o=e.charCodeAt(t);n.push(255&o)}return n},wc.createStringToBytes=function(e,n){const t=function(){const t=Wc(e),o=function(){const e=t.read();if(-1==e)throw"eof";return e};let r=0;const a={};for(;;){const e=t.read();if(-1==e)break;const n=o(),i=o()<<8|o();a[String.fromCharCode(e<<8|n)]=i,r+=1}if(r!=n)throw r+" != "+n;return a}(),o="?".charCodeAt(0);return function(e){const n=[];for(let r=0;r<e.length;r+=1){const a=e.charCodeAt(r);if(a<128)n.push(a);else{const a=t[e.charAt(r)];"number"==typeof a?(255&a)==a?n.push(a):(n.push(a>>>8),n.push(255&a)):n.push(o)}}return n}};const yc=1,kc=2,Ec=4,_c=8,Nc={L:1,M:0,Q:3,H:2},Tc=0,Cc=1,Sc=2,jc=3,Oc=4,Rc=5,Ic=6,zc=7,Ac=function(){const e=[[],[6,18],[6,22],[6,26],[6,30],[6,34],[6,22,38],[6,24,42],[6,26,46],[6,28,50],[6,30,54],[6,32,58],[6,34,62],[6,26,46,66],[6,26,48,70],[6,26,50,74],[6,30,54,78],[6,30,56,82],[6,30,58,86],[6,34,62,90],[6,28,50,72,94],[6,26,50,74,98],[6,30,54,78,102],[6,28,54,80,106],[6,32,58,84,110],[6,30,58,86,114],[6,34,62,90,118],[6,26,50,74,98,122],[6,30,54,78,102,126],[6,26,52,78,104,130],[6,30,56,82,108,134],[6,34,60,86,112,138],[6,30,58,86,114,142],[6,34,62,90,118,146],[6,30,54,78,102,126,150],[6,24,50,76,102,128,154],[6,28,54,80,106,132,158],[6,32,58,84,110,136,162],[6,26,54,82,110,138,166],[6,30,58,86,114,142,170]],n=1335,t=7973,o={},r=function(e){let n=0;for(;0!=e;)n+=1,e>>>=1;return n};return o.getBCHTypeInfo=function(e){let t=e<<10;for(;r(t)-r(n)>=0;)t^=n<<r(t)-r(n);return 21522^(e<<10|t)},o.getBCHTypeNumber=function(e){let n=e<<12;for(;r(n)-r(t)>=0;)n^=t<<r(n)-r(t);return e<<12|n},o.getPatternPosition=function(n){return e[n-1]},o.getMaskFunction=function(e){switch(e){case Tc:return function(e,n){return(e+n)%2==0};case Cc:return function(e,n){return e%2==0};case Sc:return function(e,n){return n%3==0};case jc:return function(e,n){return(e+n)%3==0};case Oc:return function(e,n){return(Math.floor(e/2)+Math.floor(n/3))%2==0};case Rc:return function(e,n){return e*n%2+e*n%3==0};case Ic:return function(e,n){return(e*n%2+e*n%3)%2==0};case zc:return function(e,n){return(e*n%3+(e+n)%2)%2==0};default:throw"bad maskPattern:"+e}},o.getErrorCorrectPolynomial=function(e){let n=Pc([1],0);for(let t=0;t<e;t+=1)n=n.multiply(Pc([1,Fc.gexp(t)],0));return n},o.getLengthInBits=function(e,n){if(1<=n&&n<10)switch(e){case yc:return 10;case kc:return 9;case Ec:case _c:return 8;default:throw"mode:"+e}else if(n<27)switch(e){case yc:return 12;case kc:return 11;case Ec:return 16;case _c:return 10;default:throw"mode:"+e}else{if(!(n<41))throw"type:"+n;switch(e){case yc:return 14;case kc:return 13;case Ec:return 16;case _c:return 12;default:throw"mode:"+e}}},o.getLostPoint=function(e){const n=e.getModuleCount();let t=0;for(let r=0;r<n;r+=1)for(let o=0;o<n;o+=1){let a=0;const i=e.isDark(r,o);for(let t=-1;t<=1;t+=1)if(!(r+t<0||n<=r+t))for(let s=-1;s<=1;s+=1)o+s<0||n<=o+s||0==t&&0==s||i==e.isDark(r+t,o+s)&&(a+=1);a>5&&(t+=3+a-5)}for(let r=0;r<n-1;r+=1)for(let o=0;o<n-1;o+=1){let n=0;e.isDark(r,o)&&(n+=1),e.isDark(r+1,o)&&(n+=1),e.isDark(r,o+1)&&(n+=1),e.isDark(r+1,o+1)&&(n+=1),0!=n&&4!=n||(t+=3)}for(let r=0;r<n;r+=1)for(let o=0;o<n-6;o+=1)e.isDark(r,o)&&!e.isDark(r,o+1)&&e.isDark(r,o+2)&&e.isDark(r,o+3)&&e.isDark(r,o+4)&&!e.isDark(r,o+5)&&e.isDark(r,o+6)&&(t+=40);for(let r=0;r<n;r+=1)for(let o=0;o<n-6;o+=1)e.isDark(o,r)&&!e.isDark(o+1,r)&&e.isDark(o+2,r)&&e.isDark(o+3,r)&&e.isDark(o+4,r)&&!e.isDark(o+5,r)&&e.isDark(o+6,r)&&(t+=40);let o=0;for(let r=0;r<n;r+=1)for(let t=0;t<n;t+=1)e.isDark(t,r)&&(o+=1);return t+=10*(Math.abs(100*o/n/n-50)/5),t},o}(),Fc=function(){const e=new Array(256),n=new Array(256);for(let o=0;o<8;o+=1)e[o]=1<<o;for(let o=8;o<256;o+=1)e[o]=e[o-4]^e[o-5]^e[o-6]^e[o-8];for(let o=0;o<255;o+=1)n[e[o]]=o;const t={glog:function(e){if(e<1)throw"glog("+e+")";return n[e]},gexp:function(n){for(;n<0;)n+=255;for(;n>=256;)n-=255;return e[n]}};return t}(),Pc=function(e,n){if(void 0===e.length)throw e.length+"/"+n;const t=function(){let t=0;for(;t<e.length&&0==e[t];)t+=1;const o=new Array(e.length-t+n);for(let n=0;n<e.length-t;n+=1)o[n]=e[n+t];return o}(),o={getAt:function(e){return t[e]},getLength:function(){return t.length},multiply:function(e){const n=new Array(o.getLength()+e.getLength()-1);for(let t=0;t<o.getLength();t+=1)for(let r=0;r<e.getLength();r+=1)n[t+r]^=Fc.gexp(Fc.glog(o.getAt(t))+Fc.glog(e.getAt(r)));return Pc(n,0)},mod:function(e){if(o.getLength()-e.getLength()<0)return o;const n=Fc.glog(o.getAt(0))-Fc.glog(e.getAt(0)),t=new Array(o.getLength());for(let r=0;r<o.getLength();r+=1)t[r]=o.getAt(r);for(let o=0;o<e.getLength();o+=1)t[o]^=Fc.gexp(Fc.glog(e.getAt(o))+n);return Pc(t,0).mod(e)}};return o},$c=function(){const e=[[1,26,19],[1,26,16],[1,26,13],[1,26,9],[1,44,34],[1,44,28],[1,44,22],[1,44,16],[1,70,55],[1,70,44],[2,35,17],[2,35,13],[1,100,80],[2,50,32],[2,50,24],[4,25,9],[1,134,108],[2,67,43],[2,33,15,2,34,16],[2,33,11,2,34,12],[2,86,68],[4,43,27],[4,43,19],[4,43,15],[2,98,78],[4,49,31],[2,32,14,4,33,15],[4,39,13,1,40,14],[2,121,97],[2,60,38,2,61,39],[4,40,18,2,41,19],[4,40,14,2,41,15],[2,146,116],[3,58,36,2,59,37],[4,36,16,4,37,17],[4,36,12,4,37,13],[2,86,68,2,87,69],[4,69,43,1,70,44],[6,43,19,2,44,20],[6,43,15,2,44,16],[4,101,81],[1,80,50,4,81,51],[4,50,22,4,51,23],[3,36,12,8,37,13],[2,116,92,2,117,93],[6,58,36,2,59,37],[4,46,20,6,47,21],[7,42,14,4,43,15],[4,133,107],[8,59,37,1,60,38],[8,44,20,4,45,21],[12,33,11,4,34,12],[3,145,115,1,146,116],[4,64,40,5,65,41],[11,36,16,5,37,17],[11,36,12,5,37,13],[5,109,87,1,110,88],[5,65,41,5,66,42],[5,54,24,7,55,25],[11,36,12,7,37,13],[5,122,98,1,123,99],[7,73,45,3,74,46],[15,43,19,2,44,20],[3,45,15,13,46,16],[1,135,107,5,136,108],[10,74,46,1,75,47],[1,50,22,15,51,23],[2,42,14,17,43,15],[5,150,120,1,151,121],[9,69,43,4,70,44],[17,50,22,1,51,23],[2,42,14,19,43,15],[3,141,113,4,142,114],[3,70,44,11,71,45],[17,47,21,4,48,22],[9,39,13,16,40,14],[3,135,107,5,136,108],[3,67,41,13,68,42],[15,54,24,5,55,25],[15,43,15,10,44,16],[4,144,116,4,145,117],[17,68,42],[17,50,22,6,51,23],[19,46,16,6,47,17],[2,139,111,7,140,112],[17,74,46],[7,54,24,16,55,25],[34,37,13],[4,151,121,5,152,122],[4,75,47,14,76,48],[11,54,24,14,55,25],[16,45,15,14,46,16],[6,147,117,4,148,118],[6,73,45,14,74,46],[11,54,24,16,55,25],[30,46,16,2,47,17],[8,132,106,4,133,107],[8,75,47,13,76,48],[7,54,24,22,55,25],[22,45,15,13,46,16],[10,142,114,2,143,115],[19,74,46,4,75,47],[28,50,22,6,51,23],[33,46,16,4,47,17],[8,152,122,4,153,123],[22,73,45,3,74,46],[8,53,23,26,54,24],[12,45,15,28,46,16],[3,147,117,10,148,118],[3,73,45,23,74,46],[4,54,24,31,55,25],[11,45,15,31,46,16],[7,146,116,7,147,117],[21,73,45,7,74,46],[1,53,23,37,54,24],[19,45,15,26,46,16],[5,145,115,10,146,116],[19,75,47,10,76,48],[15,54,24,25,55,25],[23,45,15,25,46,16],[13,145,115,3,146,116],[2,74,46,29,75,47],[42,54,24,1,55,25],[23,45,15,28,46,16],[17,145,115],[10,74,46,23,75,47],[10,54,24,35,55,25],[19,45,15,35,46,16],[17,145,115,1,146,116],[14,74,46,21,75,47],[29,54,24,19,55,25],[11,45,15,46,46,16],[13,145,115,6,146,116],[14,74,46,23,75,47],[44,54,24,7,55,25],[59,46,16,1,47,17],[12,151,121,7,152,122],[12,75,47,26,76,48],[39,54,24,14,55,25],[22,45,15,41,46,16],[6,151,121,14,152,122],[6,75,47,34,76,48],[46,54,24,10,55,25],[2,45,15,64,46,16],[17,152,122,4,153,123],[29,74,46,14,75,47],[49,54,24,10,55,25],[24,45,15,46,46,16],[4,152,122,18,153,123],[13,74,46,32,75,47],[48,54,24,14,55,25],[42,45,15,32,46,16],[20,147,117,4,148,118],[40,75,47,7,76,48],[43,54,24,22,55,25],[10,45,15,67,46,16],[19,148,118,6,149,119],[18,75,47,31,76,48],[34,54,24,34,55,25],[20,45,15,61,46,16]],n=function(e,n){const t={};return t.totalCount=e,t.dataCount=n,t},t={};return t.getRSBlocks=function(t,o){const r=function(n,t){switch(t){case Nc.L:return e[4*(n-1)+0];case Nc.M:return e[4*(n-1)+1];case Nc.Q:return e[4*(n-1)+2];case Nc.H:return e[4*(n-1)+3];default:return}}(t,o);if(void 0===r)throw"bad rs block @ typeNumber:"+t+"/errorCorrectionLevel:"+o;const a=r.length/3,i=[];for(let e=0;e<a;e+=1){const t=r[3*e+0],o=r[3*e+1],a=r[3*e+2];for(let e=0;e<t;e+=1)i.push(n(o,a))}return i},t}(),Lc=function(){const e=[];let n=0;const t={getBuffer:function(){return e},getAt:function(n){const t=Math.floor(n/8);return 1==(e[t]>>>7-n%8&1)},put:function(e,n){for(let o=0;o<n;o+=1)t.putBit(1==(e>>>n-o-1&1))},getLengthInBits:function(){return n},putBit:function(t){const o=Math.floor(n/8);e.length<=o&&e.push(0),t&&(e[o]|=128>>>n%8),n+=1}};return t},Dc=function(e){const n=yc,t=e,o={getMode:function(){return n},getLength:function(e){return t.length},write:function(e){const n=t;let o=0;for(;o+2<n.length;)e.put(r(n.substring(o,o+3)),10),o+=3;o<n.length&&(n.length-o==1?e.put(r(n.substring(o,o+1)),4):n.length-o==2&&e.put(r(n.substring(o,o+2)),7))}},r=function(e){let n=0;for(let t=0;t<e.length;t+=1)n=10*n+a(e.charAt(t));return n},a=function(e){if("0"<=e&&e<="9")return e.charCodeAt(0)-"0".charCodeAt(0);throw"illegal char :"+e};return o},Mc=function(e){const n=kc,t=e,o={getMode:function(){return n},getLength:function(e){return t.length},write:function(e){const n=t;let o=0;for(;o+1<n.length;)e.put(45*r(n.charAt(o))+r(n.charAt(o+1)),11),o+=2;o<n.length&&e.put(r(n.charAt(o)),6)}},r=function(e){if("0"<=e&&e<="9")return e.charCodeAt(0)-"0".charCodeAt(0);if("A"<=e&&e<="Z")return e.charCodeAt(0)-"A".charCodeAt(0)+10;switch(e){case" ":return 36;case"$":return 37;case"%":return 38;case"*":return 39;case"+":return 40;case"-":return 41;case".":return 42;case"/":return 43;case":":return 44;default:throw"illegal char :"+e}};return o},Bc=function(e){const n=Ec,t=wc.stringToBytes(e),o={getMode:function(){return n},getLength:function(e){return t.length},write:function(e){for(let n=0;n<t.length;n+=1)e.put(t[n],8)}};return o},qc=function(e){const n=_c,t=wc.stringToBytes;!function(){const e=t("友");if(2!=e.length||38726!=(e[0]<<8|e[1]))throw"sjis not supported."}();const o=t(e),r={getMode:function(){return n},getLength:function(e){return~~(o.length/2)},write:function(e){const n=o;let t=0;for(;t+1<n.length;){let o=(255&n[t])<<8|255&n[t+1];if(33088<=o&&o<=40956)o-=33088;else{if(!(57408<=o&&o<=60351))throw"illegal char at "+(t+1)+"/"+o;o-=49472}o=192*(o>>>8&255)+(255&o),e.put(o,13),t+=2}if(t<n.length)throw"illegal char at "+(t+1)}};return r},Uc=function(){const e=[],n={writeByte:function(n){e.push(255&n)},writeShort:function(e){n.writeByte(e),n.writeByte(e>>>8)},writeBytes:function(e,t,o){t=t||0,o=o||e.length;for(let r=0;r<o;r+=1)n.writeByte(e[r+t])},writeString:function(e){for(let t=0;t<e.length;t+=1)n.writeByte(e.charCodeAt(t))},toByteArray:function(){return e},toString:function(){let n="";n+="[";for(let t=0;t<e.length;t+=1)t>0&&(n+=","),n+=e[t];return n+="]",n}};return n},Wc=function(e){const n=e;let t=0,o=0,r=0;const a={read:function(){for(;r<8;){if(t>=n.length){if(0==r)return-1;throw"unexpected end of file./"+r}const e=n.charAt(t);if(t+=1,"="==e)return r=0,-1;e.match(/^\s$/)||(o=o<<6|i(e.charCodeAt(0)),r+=6)}const e=o>>>r-8&255;return r-=8,e}},i=function(e){if(65<=e&&e<=90)return e-65;if(97<=e&&e<=122)return e-97+26;if(48<=e&&e<=57)return e-48+52;if(43==e)return 62;if(47==e)return 63;throw"c:"+e};return a},Kc=function(e,n,t){const o=function(e,n){const t=e,o=n,r=new Array(e*n),a={setPixel:function(e,n,o){r[n*t+e]=o},write:function(e){e.writeString("GIF87a"),e.writeShort(t),e.writeShort(o),e.writeByte(128),e.writeByte(0),e.writeByte(0),e.writeByte(0),e.writeByte(0),e.writeByte(0),e.writeByte(255),e.writeByte(255),e.writeByte(255),e.writeString(","),e.writeShort(0),e.writeShort(0),e.writeShort(t),e.writeShort(o),e.writeByte(0);const n=i(2);e.writeByte(2);let r=0;for(;n.length-r>255;)e.writeByte(255),e.writeBytes(n,r,255),r+=255;e.writeByte(n.length-r),e.writeBytes(n,r,n.length-r),e.writeByte(0),e.writeString(";")}},i=function(e){const n=1<<e,t=1+(1<<e);let o=e+1;const a=s();for(let r=0;r<n;r+=1)a.add(String.fromCharCode(r));a.add(String.fromCharCode(n)),a.add(String.fromCharCode(t));const i=Uc(),c=function(e){const n=e;let t=0,o=0;return{write:function(e,r){if(e>>>r!=0)throw"length over";for(;t+r>=8;)n.writeByte(255&(e<<t|o)),r-=8-t,e>>>=8-t,o=0,t=0;o|=e<<t,t+=r},flush:function(){t>0&&n.writeByte(o)}}}(i);c.write(n,o);let d=0,l=String.fromCharCode(r[d]);for(d+=1;d<r.length;){const e=String.fromCharCode(r[d]);d+=1,a.contains(l+e)?l+=e:(c.write(a.indexOf(l),o),a.size()<4095&&(a.size()==1<<o&&(o+=1),a.add(l+e)),l=e)}return c.write(a.indexOf(l),o),c.write(t,o),c.flush(),i.toByteArray()},s=function(){const e={};let n=0;const t={add:function(o){if(t.contains(o))throw"dup key:"+o;e[o]=n,n+=1},size:function(){return n},indexOf:function(n){return e[n]},contains:function(n){return void 0!==e[n]}};return t};return a}(e,n);for(let s=0;s<n;s+=1)for(let n=0;n<e;n+=1)o.setPixel(n,s,t(n,s));const r=Uc();o.write(r);const a=function(){let e=0,n=0,t=0,o="";const r={},a=function(e){o+=String.fromCharCode(i(63&e))},i=function(e){if(e<0)throw"n:"+e;if(e<26)return 65+e;if(e<52)return e-26+97;if(e<62)return e-52+48;if(62==e)return 43;if(63==e)return 47;throw"n:"+e};return r.writeByte=function(o){for(e=e<<8|255&o,n+=8,t+=1;n>=6;)a(e>>>n-6),n-=6},r.flush=function(){if(n>0&&(a(e<<6-n),e=0,n=0),t%3!=0){const e=3-t%3;for(let n=0;n<e;n+=1)o+="="}},r.toString=function(){return o},r}(),i=r.toByteArray();for(let s=0;s<i.length;s+=1)a.writeByte(i[s]);return a.flush(),"data:image/gif;base64,"+a},Vc=wc.stringToBytes,Zc=Object.freeze(Object.defineProperty({__proto__:null,default:wc,qrcode:wc,stringToBytes:Vc},Symbol.toStringTag,{value:"Module"}));function Jc(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}const Gc=Object.freeze(Object.defineProperty({__proto__:null,detectBiometricType:async function(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 async function(){if("undefined"==typeof window||!window.faceapi)return;const{faceapi:e}=window;if(e.nets.tinyFaceDetector.isLoaded)return;try{await Promise.all([e.nets.tinyFaceDetector.loadFromUri("/models"),e.nets.faceLandmark68Net.loadFromUri("/models")])}catch(n){}}();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){Jc(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}},Symbol.toStringTag,{value:"Module"}));e.BiometricRegistrationModal=Ui,e.BiometricStatusOverlay=class{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;">${gi}</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)}}},e.CameraOvalGuide=Is,e.ConsentModal=ns,e.DEFAULT_CONSENT_INFO=os,e.DocumentCaptureModal=gc,e.ENVIRONMENT_URLS=ga,e.EmailPasswordModal=Fs,e.ErrorType=f,e.FaceCaptureModal=mi,e.FallbackPrompt=As,e.ForgotPasswordModal=Ni,e.NeoFaceError=h,e.RELEASE_DATE="2026-09-19",e.VERSION=Wi,e.authorize=async function(e){if(!(await ts({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(hc,{...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 ts({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=Rs({stream:n,faceState:"centered",instruction:Xs[0]}),c=document.createElement("canvas");c.width=i.videoWidth,c.height=i.videoHeight;const d=c.getContext("2d");if(!d)throw s.close(),n.getTracks().forEach((e=>e.stop())),new h("Failed to get canvas context",f.CAPTURE_ERROR);for(let e=0;e<4;e++){const o=Xs[e];s.update(n,"centered",o),(null==t?void 0:t.onProgress)&&t.onProgress(e+1,4,o),e>0&&await new Promise((e=>setTimeout(e,a))),d.drawImage(i,0,0,c.width,c.height);const l=await new Promise(((e,n)=>{c.toBlob((t=>{t?e(t):n(new Error("Failed to capture photo"))}),"image/jpeg",.9)}));r.push(l),(null==t?void 0:t.onPhotoTaken)&&t.onPhotoTaken(e+1,l)}s.close(),n.getTracks().forEach((e=>e.stop()));const l=r[3],u={cpf:o,email:"",sessionId:`auth_${Date.now()}_${Math.random().toString(36).substring(7)}`},p=await qa(l,e,"AUTHORIZATION",.8,void 0,u);if(!p.success)throw r.length=0,new h("Authorization failed: Person not recognized",f.RECOGNITION_FAILED);return r.length=0,{success:!0,authorizationHash:u.sessionId,name:p.personName,birthDate:void 0,cpf:p.cpf||o,confidenceScore:p.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.awaitPushApproval=function(e){return new Promise((n=>{const r=document.createElement("div");r.id="neofaceid-push-approval-container",document.body.appendChild(r);const a=t.createRoot(r);a.render(o.jsx(ys,{...e,onSettle:e=>{a.unmount(),document.body.contains(r)&&document.body.removeChild(r),n(e)}}))}))},e.captureFaceFrames=async function(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);try{const{captureFaceSilently:e}=await Promise.resolve().then((()=>Bs)),o=[];for(let r=0;r<n;r+=1)o.push(await e()),t&&r<n-1&&await new Promise((e=>{setTimeout(e,300)}));return o}catch(o){if(o instanceof h)throw o;throw new h(`Failed to capture face frames: ${o instanceof Error?o.message:"Unknown error"}`,f.CAPTURE_ERROR)}},e.checkUserExistence=Wa,e.clearConsentTrail=function(){try{"undefined"!=typeof window&&window.localStorage&&window.localStorage.removeItem(Ki)}catch{}},e.completeOnboarding=Pa,e.completeOnboardingWithData=$a,e.confirmPasswordReset=ii,e.consumeSseStream=ds,e.getAccent=function(){return ba.accent},e.getAppName=Ea,e.getApplicationToken=ka,e.getAutoFallback=_a,e.getBaseUrl=ya,e.getCachedCaptureSession=function(){return Ks},e.getConfig=function(){return{...ba}},e.getConsent=Ta,e.getConsentTrail=Vi,e.getEnvironment=function(){return ba.environment},e.getLocale=Na,e.getRadius=function(){return ba.radius},e.getResolvedThemeMode=function(){var e;return(null==(e=ba.resolvedTheme)?void 0:e.mode)??("dark"===ba.theme?"dark":"light")},e.getTheme=function(){return ba.theme},e.identifyPerson=Ga,e.identifyPersonAsync=ri,e.init=function(e={}){const{environment:n,baseUrl:t,applicationToken:o,appName:r,accent:a,radius:i,theme:c,locale:d,consent:l,autoFallback:u}=e;if(u&&(ba.autoFallback={toPhone:u.toPhone??va.toPhone,toPassword:u.toPassword??va.toPassword}),l?ba.consent=l:(ba.consent={...ma},wa||(wa=!0)),t)ba.baseUrl=t,ba.environment="custom";else if(n)ga[n]?(ba.baseUrl=ga[n],ba.environment=n):(ba.baseUrl=ga.sandbox,ba.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==ha?void 0:ha.VITE_API_BASE_URL);e&&(ba.baseUrl=e,ba.environment="custom")}o&&(ba.applicationToken=o),r&&r.trim()&&(ba.appName=r.trim()),void 0!==i&&(xa.includes(i)?ba.radius=i:ba.radius=16),c&&(ba.theme=c),d&&(ba.locale=d),void 0!==a&&(ba.accent=a);const p=Xr({accent:ba.accent??void 0,radius:ba.radius,theme:ba.theme});ba.resolvedTheme=p,pa({accent:ba.accent??void 0,radius:ba.radius,theme:ba.theme}),ba.initialized=!0},e.isInitialized=function(){return ba.initialized},e.loginWithBiometric=Da,e.loginWithEmail=Va,e.openCaptureSession=Zs,e.preloadFaceDetectionModels=Ls,e.proofOfLife=async function(e={}){const{videoDurationMs:n=3e3,maxPollingAttempts:t=60,pollingIntervalMs:o=1e3,onRecordingProgress:r,onTaskStatusChange:a}=e,i=e.applicationToken??ka();if(!i)throw new h("proofOfLife exige applicationToken — passe nas opções ou em init({ applicationToken }).",f.INVALID_TOKEN);try{const e=await Ya({durationMs:n,onProgress:r}),s=await ni(e),c=await ei(s,i);a&&a("processing",0);const d=await Qa(c.taskId,i,{maxAttempts:t,intervalMs:o,onStatusChange:a}),l={isLive:(null==d?void 0:d.is_live)||!1,livenessScore:(null==d?void 0:d.liveness_score)||0,faceRecognitionScore:(null==d?void 0:d.face_recognition_score)||0,combinedConfidence:(null==d?void 0:d.combined_confidence)||0,personId:null==d?void 0:d.person_id,personalData:(null==d?void 0:d.personal_data)||[],processingTime:(null==d?void 0:d.processing_time)||0,historyId:c.historyId,taskId:c.taskId};return d&&d.success?{...l,success:!0,message:"Proof of life verification successful"}:{...l,success:!1,error:(null==d?void 0:d.error)||"Verification failed",message:(null==d?void 0:d.message)||"Proof of life verification failed"}}catch(s){if(s instanceof h)throw s;throw new h(`Proof of life failed: ${s instanceof Error?s.message:"Unknown error"}`,f.RECOGNITION_FAILED)}},e.recognize=La,e.recognizeBiometric=Ma,e.recognizeByPurpose=qa,e.recordConsent=Zi,e.refreshSession=Ja,e.registerApplication=Xa,e.registerBiometric=Ha,e.registerDocumentByImage=async function(e,n,t={}){const{DocumentCaptureModal:o}=await Promise.resolve().then((()=>xc)),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),ti(e,n,i)},e.registerPersonWithBiometric=Ka,e.registerPersonWithoutFace=Ua,e.requestConsent=ts,e.requestDeviceEnrollmentToken=Za,e.requestLivenessChallenge=Js,e.requestLivenessChallengeWithSession=async function({applicationToken:e,purpose:n,sessionId:t}){let o=t??(await Zs({applicationToken:e,purpose:n})).session_id;try{return await Js({sessionId:o,applicationToken:e})}catch(r){if(r instanceof h&&r.message.includes("410"))return Vs(),o=(await Zs({applicationToken:e,purpose:n})).session_id,Js({sessionId:o,applicationToken:e});throw r}},e.requestPasswordReset=ai,e.resetCaptureSession=Vs,e.runLivenessChallenge=Gs,e.simpleIdentification=Ba,e.start=function(e,o,r){ts({appName:null==r?void 0:r.appName,flow:"verification"}).then((a=>{if(!a)return void o.onError(new h(bc,f.CONSENT_DENIED));const i=document.createElement("div");i.id="neoface-modal-container",document.body.appendChild(i);const s=()=>{document.body.contains(i)&&document.body.removeChild(i)};za(e).then((()=>{const a=n.createElement(mi,{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(e instanceof h?e:new h(e.message||"Failed to validate token",f.INVALID_TOKEN))}))}))},e.startAutoLogin=async function(e){if(await ts({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 Da(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 Us(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(Ws,f.CONSENT_DENIED))},e.startBiometricRegistration=function(e,o,r,a){ts({appName:null==a?void 0:a.appName,flow:"registration"}).then((i=>{if(!i)return void r.onError(new h(bc,f.CONSENT_DENIED));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)};za(o).then((()=>{const i=n.createElement(Ui,{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(new h(e,f.UNKNOWN))},onCannotGesture:null==a?void 0:a.onCannotGesture});c=t.createRoot(s),c.render(i)})).catch((e=>{d(),r.onError(e instanceof h?e:new h(e.message||"Failed to validate token",f.INVALID_TOKEN))}))}))},e.startDeviceEnrollment=function(e){return new Promise(((n,r)=>{const a=document.createElement("div");a.id="neofaceid-device-enrollment-container",document.body.appendChild(a);const i=t.createRoot(a);let s=0;const c=()=>{i.unmount(),document.body.contains(a)&&document.body.removeChild(a)},d=()=>{i.render(o.jsx(Os,{...e,attempt:s,onSettle:e=>{c(),n(e)},onRetry:()=>{s+=1,d()},onFatal:e=>{c(),r(e)}}))};d()}))},e.startDocumentCapture=vc,e.startFaceLogin=async function(e){if(await ts({appName:e.appName,flow:"verification"}))try{await Ms({applicationToken:e.applicationToken,onSuccess:e.onSuccess,onError:e.onError,onFallbackRequest:e.onFallbackRequest||(()=>function(e){if(!_a().toPassword)return void e.onError(new h("Biometria não reconhecida e a queda automática para senha está desligada.",f.LOGIN_FAILED));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 Fs(n).open()}(e)),onCancel:e.onCancel})}catch(n){e.onError(new h(`Erro ao inicializar login facial: ${n.message}`,f.INITIALIZATION_ERROR))}else e.onError(new h(Ws,f.CONSENT_DENIED))},e.startHandLogin=async function(e){if(await ts({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 Da(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 Us(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(Ws,f.CONSENT_DENIED))},e.startLivenessCapture=function(e,o,r){ts({appName:null==r?void 0:r.appName,flow:"verification"}).then((a=>{if(!a)return void o.onError(new h(bc,f.CONSENT_DENIED));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()};za(e).then((()=>{const a=n.createElement(Ui,{applicationToken:e,onClose:l,onPhotosCaptured:e=>{s=!0,o.onSuccess(e)},onError:e=>{d(),o.onError(new h(e,f.UNKNOWN))},onCannotGesture:null==r?void 0:r.onCannotGesture});c=t.createRoot(i),c.render(a)})).catch((e=>{d(),o.onError(e instanceof h?e:new h(e.message||"Failed to validate token",f.INVALID_TOKEN))}))}))},e.startOnboarding=async e=>{const{applicationToken:n,onboardingToken:t,countdown:o,title:r,subtitle:a,onSuccess:i,onError:s}=e;try{if(!(await ts({appName:e.appName,flow:"registration"})))return void s(new h("Consentimento recusado pelo usuário.",f.CONSENT_DENIED));const c=await Aa(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 Hs({countdown:o,title:r,subtitle:a}),{face:l,document:u}=await d.open();i({...await Pa(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=`${ya()}/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=Fa,e.validateToken=za,e.withCaptureSession=async function(e,n){const t=Ks??await Zs(e);try{return await n(t.session_id)}catch(o){if(o instanceof h&&o.message.includes("410")){Vs();return n((await Zs(e)).session_id)}throw o}},e.withSessionId=function(e){const n=Ks;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.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.GESTURE_NOT_DETECTED="GestureNotDetectedError",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"GestureNotDetectedError":return"Não detectamos o polegar para cima. Mostre o gesto claramente para a câmera 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 w={};function x(e){return w}function b(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 y(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 N=Symbol("evaluating");function T(e,n,t){let o;Object.defineProperty(e,n,{get(){if(o!==N)return void 0===o&&(o=N,o=t()),o},set(t){Object.defineProperty(e,n,{value:t})},configurable:!0})}function C(e,n,t){Object.defineProperty(e,n,{value:t,writable:!0,enumerable:!0,configurable:!0})}function S(...e){const n={};for(const t of e){const e=Object.getOwnPropertyDescriptors(t);Object.assign(n,e)}return Object.defineProperties({},n)}function j(e){return JSON.stringify(e)}const O="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function R(e){return"object"==typeof e&&null!==e&&!Array.isArray(e)}const I=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 z(e){if(!1===R(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!==R(t)&&!1!==Object.prototype.hasOwnProperty.call(t,"isPrototypeOf")}function A(e){return z(e)?{...e}:Array.isArray(e)?[...e]:e}const F=new Set(["string","number","symbol"]);function P(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function $(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 B(e,n){return n.map((n=>{var t;return(t=n).path??(t.path=[]),n.path.unshift(e),n}))}function q(e){return"string"==typeof e?e:null==e?void 0:e.message}function U(e,n,t){var o,r,a,i,s,c;const d={...e,path:e.path??[]};if(!e.message){const l=q(null==(a=null==(r=null==(o=e.inst)?void 0:o._zod.def)?void 0:r.error)?void 0:a.call(r,e))??q(null==(i=null==n?void 0:n.error)?void 0:i.call(n,e))??q(null==(s=t.customError)?void 0:s.call(t,e))??q(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 K(...e){const[n,t,o]=e;return"string"==typeof n?{message:n,code:"custom",input:t,inst:o}:{...n}}const V=(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,y,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},Z=m("$ZodError",V),J=m("$ZodError",V,{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=>U(e,a,x()))));throw O(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=>U(e,a,x()))));throw O(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??Z)(a.issues.map((e=>U(e,r,x()))))}:{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=>U(e,r,x()))))}:{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)$/,we=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/;const 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])$/,be=/^(([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}|:))$/,ye=/^((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_-]*$/,Ne=/^\+[1-9]\d{6,14}$/,Te="(?:(?:\\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])))",Ce=new RegExp(`^${Te}$`);function Se(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 je=/^-?\d+$/,Oe=/^-?\d+(?:\.\d+)?$/,Re=/^(?:true|false)$/i,Ie=/^[^A-Z]*$/,ze=/^[^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"},Pe=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})}})),$e=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=je)})),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})}})),Be=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})}})),qe=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})}})),Ue=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)=>{Ue.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})}})),Ke=m("$ZodCheckLowerCase",((e,n)=>{n.pattern??(n.pattern=Ie),Ue.init(e,n)})),Ve=m("$ZodCheckUpperCase",((e,n)=>{n.pattern??(n.pattern=ze),Ue.init(e,n)})),Ze=m("$ZodCheckIncludes",((e,n)=>{Ae.init(e,n);const t=P(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(`^${P(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(`.*${P(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)}}T(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)=>{Ue.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=we),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=Se({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(`^${Te}T(?:${o})$`)}(n)),nn.init(e,n)})),mn=m("$ZodISODate",((e,n)=>{n.pattern??(n.pattern=Ce),nn.init(e,n)})),gn=m("$ZodISOTime",((e,n)=>{n.pattern??(n.pattern=new RegExp(`^${Se(n)}$`)),nn.init(e,n)})),vn=m("$ZodISODuration",((e,n)=>{n.pattern??(n.pattern=me),nn.init(e,n)})),wn=m("$ZodIPv4",((e,n)=>{n.pattern??(n.pattern=xe),nn.init(e,n),e._zod.bag.format="ipv4"})),xn=m("$ZodIPv6",((e,n)=>{n.pattern??(n.pattern=be),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})}}})),bn=m("$ZodCIDRv4",((e,n)=>{n.pattern??(n.pattern=ye),nn.init(e,n)})),yn=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})}})),Nn=m("$ZodE164",((e,n)=>{n.pattern??(n.pattern=Ne),nn.init(e,n)}));const Tn=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})}})),Cn=m("$ZodNumber",((e,n)=>{Qe.init(e,n),e._zod.pattern=e._zod.bag.pattern??Oe,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}})),Sn=m("$ZodNumberFormat",((e,n)=>{Le.init(e,n),Cn.init(e,n)})),jn=m("$ZodBoolean",((e,n)=>{Qe.init(e,n),e._zod.pattern=Re,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}})),On=m("$ZodAny",((e,n)=>{Qe.init(e,n),e._zod.parse=e=>e})),Rn=m("$ZodUnknown",((e,n)=>{Qe.init(e,n),e._zod.parse=e=>e})),In=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 zn(e,n,t){e.issues.length&&n.issues.push(...B(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=>zn(n,t,e)))):zn(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(...B(t,e.issues))}void 0===e.value?t in o&&(n.value[t]=void 0):n.value[t]=e.value}function Pn(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 $n(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((()=>Pn(n)));T(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=R,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?$n(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((()=>Pn(n)));let r;const a=R,i=!w.jitless,s=i&&I.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=j(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=j(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?$n([],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=>U(e,o,x())))))}),n)}const Bn=m("$ZodUnion",((e,n)=>{Qe.init(e,n),T(e._zod,"optin",(()=>n.options.some((e=>"optional"===e._zod.optin))?"optional":void 0)),T(e._zod,"optout",(()=>n.options.some((e=>"optional"===e._zod.optout))?"optional":void 0)),T(e._zod,"values",(()=>{if(n.options.every((e=>e._zod.values)))return new Set(n.options.flatMap((e=>Array.from(e._zod.values))))})),T(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)}})),qn=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 Un(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(z(e)&&z(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=Un(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=Un(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=Un(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 Kn=m("$ZodEnum",((e,n)=>{Qe.init(e,n);const t=b(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?P(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}})),Vn=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 Zn(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",T(e._zod,"values",(()=>n.innerType._zod.values?new Set([...n.innerType._zod.values,void 0]):void 0)),T(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=>Zn(n,e.value))):Zn(o,e.value)}return void 0===e.value?e:n.innerType._zod.run(e,t)}})),Gn=m("$ZodExactOptional",((e,n)=>{Jn.init(e,n),T(e._zod,"values",(()=>n.innerType._zod.values)),T(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),T(e._zod,"optin",(()=>n.innerType._zod.optin)),T(e._zod,"optout",(()=>n.innerType._zod.optout)),T(e._zod,"pattern",(()=>{const e=n.innerType._zod.pattern;return e?new RegExp(`^(${_(e.source)}|null)$`):void 0})),T(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",T(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",T(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),T(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),T(e._zod,"optin",(()=>n.innerType._zod.optin)),T(e._zod,"optout",(()=>n.innerType._zod.optout)),T(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=>U(e,t,x())))},input:e.value}),e.issues=[]),e))):(e.value=o.value,o.issues.length&&(e.value=n.catchValue({...e,error:{issues:o.issues.map((e=>U(e,t,x())))},input:e.value}),e.issues=[]),e)}})),ot=m("$ZodPipe",((e,n)=>{Qe.init(e,n),T(e._zod,"values",(()=>n.in._zod.values)),T(e._zod,"optin",(()=>n.in._zod.optin)),T(e._zod,"optout",(()=>n.out._zod.optout)),T(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),T(e._zod,"propValues",(()=>n.innerType._zod.propValues)),T(e._zod,"values",(()=>n.innerType._zod.values)),T(e._zod,"optin",(()=>{var e,t;return null==(t=null==(e=n.innerType)?void 0:e._zod)?void 0:t.optin})),T(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(K(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 wt(e,n){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...D(n)})}function xt(e,n){return new e({type:"string",format:"url",check:"string_format",abort:!1,...D(n)})}function bt(e,n){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...D(n)})}function yt(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 Nt(e,n){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...D(n)})}function Tt(e,n){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...D(n)})}function Ct(e,n){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...D(n)})}function St(e,n){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...D(n)})}function jt(e,n){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...D(n)})}function Ot(e,n){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...D(n)})}function Rt(e,n){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...D(n)})}function It(e,n){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...D(n)})}function zt(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 Pt(e,n){return new e({type:"string",format:"date",check:"string_format",...D(n)})}function $t(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 Bt(e,n){return new e({type:"boolean",...D(n)})}function qt(e){return new e({type:"any"})}function Ut(e){return new e({type:"unknown"})}function Wt(e,n){return new e({type:"never",...D(n)})}function Kt(e,n){return new Pe({check:"less_than",...D(n),value:e,inclusive:!1})}function Vt(e,n){return new Pe({check:"less_than",...D(n),value:e,inclusive:!0})}function Zt(e,n){return new $e({check:"greater_than",...D(n),value:e,inclusive:!1})}function Jt(e,n){return new $e({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 Be({check:"min_length",...D(n),minimum:e})}function Yt(e,n){return new qe({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 Ke({check:"string_format",format:"lowercase",...D(e)})}function no(e){return new Ve({check:"string_format",format:"uppercase",...D(e)})}function to(e,n){return new Ze({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(K(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(K(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&&bo(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 wo(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 xo(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:yo(n,"input",e.processors),output:yo(n,"output",e.processors)}},enumerable:!1,writable:!1}),t}catch(d){throw new Error("Error converting schema to JSON.")}}function bo(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 bo(o.element,t);if("set"===o.type)return bo(o.valueType,t);if("lazy"===o.type)return bo(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 bo(o.innerType,t);if("intersection"===o.type)return bo(o.left,t)||bo(o.right,t);if("record"===o.type||"map"===o.type)return bo(o.keyType,t)||bo(o.valueType,t);if("pipe"===o.type)return bo(o.in,t)||bo(o.out,t);if("object"===o.type){for(const e in o.shape)if(bo(o.shape[e],t))return!0;return!1}if("union"===o.type){for(const e of o.options)if(bo(e,t))return!0;return!1}if("tuple"===o.type){for(const e of o.items)if(bo(e,t))return!0;return!(!o.rest||!bo(o.rest,t))}return!1}const yo=(e,n,t={})=>o=>{const{libraryOptions:r,target:a}=o??{},i=go({...r??{},target:a,io:n,processors:t});return vo(e,i),wo(i,e),xo(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),Ko.init(e,n)}));const No=m("ZodISODate",((e,n)=>{mn.init(e,n),Ko.init(e,n)}));const To=m("ZodISOTime",((e,n)=>{gn.init(e,n),Ko.init(e,n)}));const Co=m("ZodISODuration",((e,n)=>{vn.init(e,n),Ko.init(e,n)}));const So=m("ZodError",((e,n)=>{Z.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,y,2)}},addIssues:{value:n=>{e.issues.push(...n),e.message=JSON.stringify(e.issues,y,2)}},isEmpty:{get:()=>0===e.issues.length}})}),{Parent:Error}),jo=G(So),Oo=H(So),Ro=X(So),Io=Q(So),zo=ne(So),Ao=te(So),Fo=oe(So),Po=re(So),$o=ae(So),Do=ie(So),Lo=se(So),Mo=ce(So),Bo=m("ZodType",((e,n)=>(Qe.init(e,n),Object.assign(e["~standard"],{jsonSchema:{input:yo(e,"input"),output:yo(e,"output")}}),e.toJSONSchema=((e,n={})=>t=>{const o=go({...t,processors:n});return vo(e,o),wo(o,e),xo(o,e)})(e,{}),e.def=n,e.type=n.type,Object.defineProperty(e,"_def",{value:n}),e.check=(...t)=>e.clone(S(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)=>$(e,n,t),e.brand=()=>e,e.register=(n,t)=>(n.add(e,t),e),e.parse=(n,t)=>jo(e,n,t,{callee:e.parse}),e.safeParse=(n,t)=>Ro(e,n,t),e.parseAsync=async(n,t)=>Oo(e,n,t,{callee:e.parseAsync}),e.safeParseAsync=async(n,t)=>Io(e,n,t),e.spa=e.safeParseAsync,e.encode=(n,t)=>zo(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)=>Po(e,n,t),e.safeEncode=(n,t)=>$o(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(Mr,e,n)}(n,t)),e.superRefine=n=>e.check(ho(n)),e.overwrite=n=>e.check(ao(n)),e.optional=()=>jr(e),e.exactOptional=()=>new Or({type:"optional",innerType:e}),e.nullable=()=>Ir(e),e.nullish=()=>jr(Ir(e)),e.nonoptional=n=>function(e,n){return new Fr({type:"nonoptional",innerType:e,...D(n)})}(e,n),e.array=()=>{return po(br,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=>Dr(e,new Cr({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 Ar({type:"prefault",innerType:e,get defaultValue(){return"function"==typeof t?t():A(t)}});var t},e.catch=n=>{return new Pr({type:"catch",innerType:e,catchValue:"function"==typeof(t=n)?t:()=>t});var t},e.pipe=n=>Dr(e,n),e.readonly=()=>new Lr({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))),qo=m("_ZodString",((e,n)=>{en.init(e,n),Bo.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())})),Uo=m("ZodString",((e,n)=>{en.init(e,n),qo.init(e,n),e.email=n=>e.check(ft(Vo,n)),e.url=n=>e.check(xt(Go,n)),e.jwt=n=>e.check(At(lr,n)),e.emoji=n=>e.check(bt(Ho,n)),e.guid=n=>e.check(ht(Zo,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(wt(Jo,n)),e.nanoid=n=>e.check(yt(Xo,n)),e.guid=n=>e.check(ht(Zo,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(Rt(sr,n)),e.base64url=n=>e.check(It(cr,n)),e.xid=n=>e.check(Nt(nr,n)),e.ksuid=n=>e.check(Tt(tr,n)),e.ipv4=n=>e.check(Ct(or,n)),e.ipv6=n=>e.check(St(rr,n)),e.cidrv4=n=>e.check(jt(ar,n)),e.cidrv6=n=>e.check(Ot(ir,n)),e.e164=n=>e.check(zt(dr,n)),e.datetime=n=>e.check(function(e){return Ft(_o,e)}(n)),e.date=n=>e.check(function(e){return Pt(No,e)}(n)),e.time=n=>e.check(function(e){return $t(To,e)}(n)),e.duration=n=>e.check(function(e){return Dt(Co,e)}(n))}));function Wo(e){return pt(Uo,e)}const Ko=m("ZodStringFormat",((e,n)=>{nn.init(e,n),qo.init(e,n)})),Vo=m("ZodEmail",((e,n)=>{rn.init(e,n),Ko.init(e,n)})),Zo=m("ZodGUID",((e,n)=>{tn.init(e,n),Ko.init(e,n)})),Jo=m("ZodUUID",((e,n)=>{on.init(e,n),Ko.init(e,n)})),Go=m("ZodURL",((e,n)=>{an.init(e,n),Ko.init(e,n)})),Ho=m("ZodEmoji",((e,n)=>{sn.init(e,n),Ko.init(e,n)})),Xo=m("ZodNanoID",((e,n)=>{cn.init(e,n),Ko.init(e,n)})),Yo=m("ZodCUID",((e,n)=>{dn.init(e,n),Ko.init(e,n)})),Qo=m("ZodCUID2",((e,n)=>{ln.init(e,n),Ko.init(e,n)})),er=m("ZodULID",((e,n)=>{un.init(e,n),Ko.init(e,n)})),nr=m("ZodXID",((e,n)=>{pn.init(e,n),Ko.init(e,n)})),tr=m("ZodKSUID",((e,n)=>{fn.init(e,n),Ko.init(e,n)})),or=m("ZodIPv4",((e,n)=>{wn.init(e,n),Ko.init(e,n)})),rr=m("ZodIPv6",((e,n)=>{xn.init(e,n),Ko.init(e,n)})),ar=m("ZodCIDRv4",((e,n)=>{bn.init(e,n),Ko.init(e,n)})),ir=m("ZodCIDRv6",((e,n)=>{yn.init(e,n),Ko.init(e,n)})),sr=m("ZodBase64",((e,n)=>{En.init(e,n),Ko.init(e,n)})),cr=m("ZodBase64URL",((e,n)=>{_n.init(e,n),Ko.init(e,n)})),dr=m("ZodE164",((e,n)=>{Nn.init(e,n),Ko.init(e,n)})),lr=m("ZodJWT",((e,n)=>{Tn.init(e,n),Ko.init(e,n)})),ur=m("ZodNumber",((e,n)=>{Cn.init(e,n),Bo.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(Zt(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(Kt(n,t)),e.lte=(n,t)=>e.check(Vt(n,t)),e.max=(n,t)=>e.check(Vt(n,t)),e.int=n=>e.check(fr(n)),e.safe=n=>e.check(fr(n)),e.positive=n=>e.check(Zt(0,n)),e.nonnegative=n=>e.check(Jt(0,n)),e.negative=n=>e.check(Kt(0,n)),e.nonpositive=n=>e.check(Vt(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)=>{Sn.init(e,n),ur.init(e,n)}));function fr(e){return Mt(pr,e)}const hr=m("ZodBoolean",((e,n)=>{jn.init(e,n),Bo.init(e,n),e._zod.processJSONSchema=(e,n,t)=>((e,n,t)=>{t.type="boolean"})(0,0,n)}));function mr(e){return Bt(hr,e)}const gr=m("ZodAny",((e,n)=>{On.init(e,n),Bo.init(e,n),e._zod.processJSONSchema=(e,n,t)=>{}}));const vr=m("ZodUnknown",((e,n)=>{Rn.init(e,n),Bo.init(e,n),e._zod.processJSONSchema=(e,n,t)=>{}}));function wr(){return Ut(vr)}const xr=m("ZodNever",((e,n)=>{In.init(e,n),Bo.init(e,n),e._zod.processJSONSchema=(e,n,t)=>((e,n,t)=>{t.not={}})(0,0,n)}));const br=m("ZodArray",((e,n)=>{An.init(e,n),Bo.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 yr=m("ZodObject",((e,n)=>{Ln.init(e,n),Bo.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),T(e,"shape",(()=>n.shape)),e.keyof=()=>Tr(Object.keys(e._zod.def.shape)),e.catchall=n=>e.clone({...e._zod.def,catchall:n}),e.passthrough=()=>e.clone({...e._zod.def,catchall:wr()}),e.loose=()=>e.clone({...e._zod.def,catchall:wr()}),e.strict=()=>{return e.clone({...e._zod.def,catchall:Wt(xr,n)});var n},e.strip=()=>e.clone({...e._zod.def,catchall:void 0}),e.extend=n=>function(e,n){if(!z(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=S(e._zod.def,{get shape(){const t={...e._zod.def.shape,...n};return C(this,"shape",t),t}});return $(e,o)}(e,n),e.safeExtend=n=>function(e,n){if(!z(n))throw new Error("Invalid input to safeExtend: expected a plain object");const t=S(e._zod.def,{get shape(){const t={...e._zod.def.shape,...n};return C(this,"shape",t),t}});return $(e,t)}(e,n),e.merge=n=>function(e,n){const t=S(e._zod.def,{get shape(){const t={...e._zod.def.shape,...n._zod.def.shape};return C(this,"shape",t),t},get catchall(){return n._zod.def.catchall},checks:[]});return $(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 $(e,S(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 C(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=S(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 C(this,"shape",o),o},checks:[]});return $(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=S(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 C(this,"shape",r),r},checks:[]});return $(n,r)}(Sr,e,n[0]),e.required=(...n)=>function(e,n,t){const o=S(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 C(this,"shape",r),r}});return $(n,o)}(Fr,e,n[0])}));function kr(e,n){const t={type:"object",shape:e??{},...D(n)};return new yr(t)}const Er=m("ZodUnion",((e,n)=>{Bn.init(e,n),Bo.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)=>{qn.init(e,n),Bo.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 Nr=m("ZodEnum",((e,n)=>{Kn.init(e,n),Bo.init(e,n),e._zod.processJSONSchema=(n,t,o)=>((e,n,t)=>{const o=b(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 Nr({...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 Nr({...n,checks:[],...D(o),entries:r})}}));function Tr(e,n){const t=Array.isArray(e)?Object.fromEntries(e.map((e=>[e,e]))):e;return new Nr({type:"enum",entries:t,...D(n)})}const Cr=m("ZodTransform",((e,n)=>{Vn.init(e,n),Bo.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(K(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(K(n))}};const r=n.transform(t.value,t);return r instanceof Promise?r.then((e=>(t.value=e,t))):(t.value=r,t)}}));const Sr=m("ZodOptional",((e,n)=>{Jn.init(e,n),Bo.init(e,n),e._zod.processJSONSchema=(n,t,o)=>Eo(e,n,0,o),e.unwrap=()=>e._zod.def.innerType}));function jr(e){return new Sr({type:"optional",innerType:e})}const Or=m("ZodExactOptional",((e,n)=>{Gn.init(e,n),Bo.init(e,n),e._zod.processJSONSchema=(n,t,o)=>Eo(e,n,0,o),e.unwrap=()=>e._zod.def.innerType}));const Rr=m("ZodNullable",((e,n)=>{Hn.init(e,n),Bo.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 Ir(e){return new Rr({type:"nullable",innerType:e})}const zr=m("ZodDefault",((e,n)=>{Xn.init(e,n),Bo.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 Ar=m("ZodPrefault",((e,n)=>{Qn.init(e,n),Bo.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 Fr=m("ZodNonOptional",((e,n)=>{et.init(e,n),Bo.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 Pr=m("ZodCatch",((e,n)=>{tt.init(e,n),Bo.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),Bo.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 Dr(e,n){return new $r({type:"pipe",in:e,out:n})}const Lr=m("ZodReadonly",((e,n)=>{at.init(e,n),Bo.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 Mr=m("ZodCustom",((e,n)=>{st.init(e,n),Bo.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)}));const Br=Tr(["face","password"]);var qr;kr({success:mr(),accessToken:Wo().optional(),refreshToken:Wo().optional(),method:Br.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,qr).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:qt(gr).optional(),onboarding_link:Wo().optional(),task_id:Wo().optional(),status:Wo().optional()});const Ur="#0059C4",Wr="#F1BE00",Kr="#0A1320",Vr={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"}},Zr={ground:"#F7F9FC",surface:"#FFFFFF",surfaceMuted:"#F1F5FA",line:"#E6ECF4",text:Kr,textMuted:"#48586B",textSubtle:"#617489",action:Ur,actionText:"#FFFFFF",accent:Wr,overlay:"rgba(10,19,32,.55)",focusRing:Ur},Jr={ground:Kr,surface:"#111C2B",surfaceMuted:"#1E2B3C",line:"#22334D",text:"#EEF3F9",textMuted:"#AFBDCE",textSubtle:"#8496AD",action:"#0091F6",actionText:"#FFFFFF",accent:Wr,overlay:"rgba(10,19,32,.72)",focusRing:"#00B0F8"};function Gr(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 Hr=[8,16,24];function Xr(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?{...Jr}:{...Zr};let o=16;void 0!==e.radius&&Hr.includes(e.radius)&&(o=e.radius);let r=t.action,a=!1;if(e.accent){(function(e,n){const t=Gr(e),o=Gr(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=Ur)}return{mode:n,tokens:{...t,action:r},radius:o,accent:r,accentFellBack:a}}const Yr="--nfid-ground",Qr="--nfid-surface",ea="--nfid-surface-muted",na="--nfid-line",ta="--nfid-text",oa="--nfid-text-muted",ra="--nfid-text-subtle",aa="--nfid-action",ia="--nfid-action-text",sa="--nfid-accent",ca="--nfid-overlay",da="--nfid-focus-ring",la="--nfid-radius",ua="neofaceid-focus-frame-tokens";function pa(e={}){const n=Xr(e);if("undefined"==typeof document)return n;const t=function(e){const n=e.tokens;return`.neofaceid-root {\n ${Yr}: ${n.ground};\n ${Qr}: ${n.surface};\n ${ea}: ${n.surfaceMuted};\n ${na}: ${n.line};\n ${ta}: ${n.text};\n ${oa}: ${n.textMuted};\n ${ra}: ${n.textSubtle};\n ${aa}: ${n.action};\n ${ia}: ${n.actionText};\n ${sa}: ${n.accent};\n ${ca}: ${n.overlay};\n ${da}: ${n.focusRing};\n ${la}: ${e.radius}px;\n color: var(${ta});\n font-family: inherit;\n}\n.neofaceid-root :focus-visible {\n outline: 2px solid var(${da});\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(ua);if(o)return o.textContent!==t&&(o.textContent=t),n;const r=document.createElement("style");return r.id=ua,r.textContent=t,document.head.appendChild(r),n}function fa(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 ha={},ma={purpose:"authentication",legalBasis:"fraud_prevention",privacyPolicyUrl:"",retentionDays:0},ga={development:"http://localhost:8000",sandbox:"https://sandbox-core.neofaceid.com",production:"https://core.neofaceid.com.br"},va={toPhone:!1,toPassword:!0},wa=[8,16,24];let xa={baseUrl:ga.sandbox,applicationToken:null,environment:"sandbox",initialized:!1,appName:null,accent:null,radius:16,theme:"light",locale:"pt-BR",resolvedTheme:null,consent:{...ma},autoFallback:{...va}},ba=!1;function ya(){return xa.initialized,xa.baseUrl}function ka(){return xa.applicationToken}function Ea(){return xa.appName}function _a(){return{...xa.autoFallback}}function Na(){return xa.locale}function Ta(){return{...xa.consent}}async function Ca(e,n){const t=URL.createObjectURL(e);try{return await n(t)}finally{URL.revokeObjectURL(t)}}const Sa=()=>ya(),ja=()=>{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)},Oa=()=>{const e=new AbortController,n=setTimeout((()=>e.abort()),1e4);return e.signal.addEventListener("abort",(()=>clearTimeout(n))),e},Ra=async e=>Ca(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})))),Ia=async e=>Ca(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})))),za=async e=>{ja();const n=Oa();try{const t=await fetch(`${Sa()}/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);if(t instanceof h)throw t;throw new h(t.message,f.NETWORK)}throw new h("Unknown error",f.NETWORK)}},Aa=async(e,n)=>{ja();const t=Oa();try{const o=await fetch(`${Sa()}/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)}},Fa=async(e,n)=>{ja();const t=Oa();try{const o=await fetch(`${Sa()}/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)}},Pa=async(e,n,t,o)=>{ja();const r=Oa(),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(`${Sa()}/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)}},$a=async(e,n,t,o,r)=>{if(ja(),!o||0===o.length)throw new h("Pelo menos uma imagem da pessoa é obrigatória",f.VALIDATION_ERROR);const a=Oa();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(`${Sa()}/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)}},Da=async(e,n)=>{ja();const t=Oa(),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(`${Sa()}/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)}},La=async(e,n)=>{var t,o,r,a,i;ja();const s=Oa(),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(`${Sa()}/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||"",refreshToken:u.refreshToken||u.refresh_token||void 0,method:"face",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)}},Ma=async(e,n,t=!0,o=.8)=>{ja();const r=Oa(),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(`${Sa()}/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)}},Ba=async(e,n,t,o="LOGIN")=>{ja();const r=Oa();try{const a=await fetch(`${Sa()}/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)}},qa=async(e,n,t,o=.8,r,a)=>{var i;ja();const s=Oa(),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(`${Sa()}/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)}},Ua=async(e,n,t)=>{ja();const o=Oa();try{let r,a;if(null==t?void 0:t.documentFront){const e=await Ia(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 Ia(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(`${Sa()}/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)}},Wa=async e=>{const n=Oa(),t=new URLSearchParams;e.email&&t.append("email",e.email),e.cpf&&t.append("cpf",e.cpf);try{const e=await fetch(`${Sa()}/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)}},Ka=async(e,n,t,o)=>{var r,a,i,s,c,d,l,u;if(ja(),!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=Oa();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,w;if(null==o?void 0:o.documentFront){const e=await Ia(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 Ia(o.documentBack);w=await new Promise(((n,t)=>{const o=new FileReader;o.onload=()=>n(o.result),o.onerror=t,o.readAsDataURL(e)}))}const x={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&&(x.document_images=[{front:v,back:w||void 0,type:(null==o?void 0:o.documentType)||"RG"}]);const b=await fetch(`${Sa()}/api/v1/signup/donor/`,{method:"POST",headers:{"Content-Type":"application/json","X-App-Token":t},body:JSON.stringify(x),signal:p.signal});if(!b.ok){if(401===b.status||403===b.status)throw new h("Invalid or expired application token",f.INVALID_TOKEN);try{const e=await b.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 ${b.status}`;throw new h(n,f.VALIDATION_ERROR)}catch(m){if(m instanceof h)throw m;throw new h(`Server returned status ${b.status}`,f.NETWORK)}}const y=await b.json();return 202===b.status&&(null==(r=y.data)?void 0:r.task_id)?{success:y.success,message:y.message||"Registration is being processed. You will receive an email when completed.",task_id:y.data.task_id,status:y.data.status||"processing",person_id:void 0,user_id:void 0,person_validated:void 0,face_processing:void 0,onboarding_link:void 0}:{success:y.success,message:y.message,person_id:(null==(a=y.data)?void 0:a.person_id)||y.person_id,user_id:(null==(i=y.data)?void 0:i.user_id)||y.user_id,person_validated:(null==(s=y.data)?void 0:s.person_validated)||y.person_validated,face_processing:(null==(c=y.data)?void 0:c.face_processing)||y.face_processing,onboarding_link:(null==(d=y.data)?void 0:d.onboarding_link)||y.onboarding_link,task_id:null==(l=y.data)?void 0:l.task_id,status:null==(u=y.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)}},Va=async(e,n,t)=>{const o=Oa();try{const r=await fetch(`${Sa()}/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,refreshToken:a.refresh_token||a.refresh||void 0,method:"password",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)}},Za=async(e,n)=>{if(!e)throw new h("Inscrição de aparelho exige um usuário autenticado (access token ausente).",f.INVALID_TOKEN);const t=Oa();try{const o=await fetch(`${Sa()}/api/v1/devices/enrollment-token/`,{method:"POST",headers:{"Content-Type":"application/json","X-App-Token":n,Authorization:`Bearer ${e}`},signal:t.signal});if(!o.ok){if(401===o.status)throw new h("Sua sessão expirou. Entre novamente para inscrever o aparelho.",f.INVALID_TOKEN);if(403===o.status)throw new h("Esta conta não pode inscrever aparelhos. Procure o suporte.",f.INVALID_TOKEN);throw new h(`API Error ${o.status}`,f.API_ERROR)}const r=await o.json(),a=r.data??r,i=a.token,s=a.handle;if(!i||!s)throw new h("Resposta de inscrição incompleta (token ou handle ausente)",f.API_ERROR);return{handle:s,jti:a.jti??"",token:i,expiresIn:a.expires_in??300,purpose:a.purpose??"device-enrollment"}}catch(o){if(o instanceof h)throw o;if(o instanceof Error){if("AbortError"===o.name)throw new h("Request timed out",f.NETWORK);throw new h(o.message,f.NETWORK)}throw new h("Unknown error occurred",f.NETWORK)}},Ja=async(e,n)=>{const t=Oa();try{const o=await fetch(`${Sa()}/api/v1/token/refresh/`,{method:"POST",headers:{"Content-Type":"application/json","X-App-Token":n},body:JSON.stringify({refresh:e}),signal:t.signal});if(!o.ok){if(401===o.status||403===o.status)throw new h("Sessão expirada — faça login novamente",f.INVALID_TOKEN);throw new h(`API Error ${o.status}`,f.API_ERROR)}const r=await o.json(),a=r.access??r.access_token;if(!a)throw new h("Resposta de refresh sem access token",f.API_ERROR);return{accessToken:a,refreshToken:r.refresh??r.refresh_token??e}}catch(o){if(o instanceof h)throw o;if(o instanceof Error){if("AbortError"===o.name)throw new h("Request timed out",f.NETWORK);throw new h(o.message,f.NETWORK)}throw new h("Unknown error occurred",f.NETWORK)}},Ga=async(e,n)=>{var t,o,r,a;ja();const i=Oa(),s=await Ia(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(`${Sa()}/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)}},Ha=async(e,n,t)=>{if(ja(),!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=Oa(),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(`${Sa()}/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)}},Xa=async(e,n,t)=>{ja();const o=Oa();try{const a=await fetch(`${Sa()}/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)}},Ya=async(e={})=>{ja();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))}}))},Qa=async(e,n,t={})=>{var o,r,a,i,s,c,d,l,u,p;const{maxAttempts:m=60,intervalMs:g=1e3,onStatusChange:v}=t,w=(e=g)=>new Promise((n=>{setTimeout(n,e)})),x=e=>{var n,t;const o=null==(t=null==(n=e.headers)?void 0:n.get)?void 0:t.call(n,"Retry-After");if(!o)return g;const r=Number(o);if(Number.isFinite(r)&&r>0)return 1e3*r;const a=Date.parse(o);if(Number.isFinite(a)){const e=a-Date.now();if(e>0)return e}return g};let b=0,y="";for(;b<m;){b++;try{const t=await fetch(`${Sa()}/api/v1/tasks/status/?task_id=${e}`,{method:"GET",headers:{Accept:"application/json","X-App-Token":n}});if(404===t.status)throw new h("Não foi possível recuperar o andamento deste processo. Ele pode já ter sido concluído há algum tempo, ou nunca ter existido.",f.NOT_FOUND);if(t.status>=500){y=`HTTP ${t.status}`,await w();continue}if(429===t.status){y="HTTP 429",await w(x(t));continue}if(401===t.status||403===t.status)throw new h("Invalid application token",f.INVALID_TOKEN);if(!t.ok)throw new h(`Task status check failed: ${t.status}`,f.API_ERROR);const m=await t.json(),g=(null==(o=m.data)?void 0:o.status)||"unknown";if(v){v(g,null==(a=null==(r=m.data)?void 0:r.progress)?void 0:a.percentage)}if("success"===g)return m.data.result;if("failure"===g){const e=(null==(s=null==(i=m.data)?void 0:i.result)?void 0:s.message)||(null==(c=m.data)?void 0:c.error)||"Task failed";throw new h(e,f.RECOGNITION_FAILED)}if("revoked"===g)throw new h("Task was cancelled",f.RECOGNITION_FAILED);if(!1===m.success){const e=(null==(l=null==(d=m.data)?void 0:d.result)?void 0:l.message)||(null==(u=m.data)?void 0:u.error)||(null==(p=m.data)?void 0:p.message)||m.message||"Task failed";throw new h(e,f.RECOGNITION_FAILED)}await w()}catch(k){if(k instanceof h)throw k;y=k instanceof Error?k.message:"erro desconhecido",await w()}}throw new h(y?`Task status polling timed out (última falha transitória: ${y})`:"Task status polling timed out",f.NETWORK)},ei=async(e,n)=>{var t;ja();const o=Oa();try{const r=await fetch(`${Sa()}/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)}},ni=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)})),ti=async(e,n,t)=>{var o,r;if(ja(),!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 Ia(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=Oa();try{const t=await fetch(`${Sa()}/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);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);throw new h(s.message,f.NETWORK)}throw new h("Unknown error occurred",f.NETWORK)}},oi=async(e,n)=>{const t=Oa();try{const o=await fetch(`${Sa()}/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);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)}},ri=async(e,n,t={})=>{var o,r;const{maxRetries:a=30,interval:i=2e3}=t,s=await Ga(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 oi(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)};async function ai(e,n){const t=ya(),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 ii(e,n){const t=ya(),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 si=Object.freeze(Object.defineProperty({__proto__:null,checkUserExistence:Wa,completeOnboarding:Pa,completeOnboardingWithData:$a,confirmPasswordReset:ii,getOnboardingDetails:Aa,getTaskStatus:oi,identifyPerson:Ga,identifyPersonAsync:ri,loginWithBiometric:La,loginWithEmail:Va,pollTaskStatus:Qa,recognize:Da,recognizeBiometric:Ma,recognizeByPurpose:qa,recordFaceVideo:Ya,refreshSession:Ja,registerApplication:Xa,registerBiometric:Ha,registerDocumentByImage:ti,registerPersonWithBiometric:Ka,registerPersonWithoutFace:Ua,requestDeviceEnrollmentToken:Za,requestPasswordReset:ai,simpleIdentification:Ba,startProofOfLife:ei,validateOnboardingToken:Fa,validateToken:za,videoToBase64:ni},Symbol.toStringTag,{value:"Module"}));function ci(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 di(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=ci(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;ci(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 li({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 ui(e,n){return Math.hypot(e.x-n.x,e.y-n.y)}function pi(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=ui(t,i),c=ui(o,a),d=ui(n,r);return d<1e-6?0:(s+c)/(2*d)}const fi=(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}},hi={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 mi({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,w]=n.useReducer(fi,{status:"requestingPermission"}),[x,b]=n.useState(!1),{startCamera:y,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]);b(n&&t)}catch(n){}u.current=window.setTimeout(e,100)}};e()};n.useEffect((()=>{pa()}),[]),n.useEffect((()=>()=>{var e;null==(e=g.current)||e.abort()}),[]);const _=i&&("ready"===v.status||"capturing"===v.status),{flashOn:N}=di(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 y();l.current=e,s.current&&(s.current.srcObject=e),w({type:"PERMISSION_GRANTED"}),E()}catch(e){w({type:"PERMISSION_DENIED"})}})(),()=>{l.current&&k(l.current)})),[y,k]);const T=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{w({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((pi(e.landmarks.getLeftEye())+pi(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 w({type:"SET_ERROR",message:e.getFriendlyMessage()})}const c=o.getContext("2d");if(!c)return void w({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 Da(l,e);r({success:!0,data:{faceId:n.payload.documentId,confidence:1}}),w({type:"UPLOAD_SUCCESS"}),setTimeout(t,1500)}catch(i){w({type:"SET_ERROR",message:"Face recognition failed"})}}catch(i){w({type:"SET_ERROR",message:"Failed to capture image"})}finally{m.current=!1}};return o.jsxs("div",{className:"neofaceid-root",style:hi.overlay,children:[o.jsx(li,{active:N}),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:hi.modal,className:"modal",children:[o.jsx("button",{type:"button",style:hi.closeButton,onClick:t,children:"×"}),o.jsx("video",{ref:s,style:hi.video,autoPlay:!0,playsInline:!0,muted:!0}),o.jsx("canvas",{ref:c,style:hi.canvas}),o.jsx("div",{style:hi.guide}),"ready"===v.status&&!x&&o.jsx("div",{style:hi.message,"aria-live":"assertive",children:"Centralize seu rosto no círculo"}),"capturing"===v.status&&o.jsx("div",{style:hi.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:hi.spinner}),"success"===v.status&&o.jsx("div",{style:hi.message,children:"Autenticado!"}),"error"===v.status&&o.jsx("div",{style:hi.message,children:v.message}),o.jsxs("div",{style:hi.controls,children:["ready"===v.status&&x&&o.jsx("button",{type:"button",style:hi.button,onClick:T,children:"Capturar"}),"capturing"===v.status&&o.jsx("button",{type:"button",style:hi.button,onClick:T,children:"Capturar"}),"error"===v.status&&o.jsx("button",{type:"button",style:hi.button,onClick:()=>{w({type:"RESET"})},children:"Tentar Novamente"})]})]})]})}const gi='<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 3.2-2.7 5.6-4.1 3.9-2.2 6.8-5.6 10.8-12.2l2.7-4.3c1.7-2.6 1.8-7.8 1.8-91.1 0-87.1 0-88.4 2-90.2 1.6-1.5 2-3.1 2-8.7 0-4.2.6-8 1.5-9.8.8-1.6 1.2-3.5.9-4.3-1.2-3.3 6.7-21.9 12.4-29.2 1.2-1.5 2.2-3.3 2.2-4 0-2.1 23.3-24 27.5-25.9a192 192 0 0 0 11.6-5.7c4.2-2.1 8.8-3.9 10.1-3.9a10 10 0 0 0 5.1-2q2.5-2 7-2c2.7 0 4.9-.6 5.7-1.5 1.1-1.3 13.8-1.5 98.4-1.8 107-.4 111.3-.7 118.2-6.8 1.1-1.1 2.7-1.9 3.5-1.9 2.7 0 11.7-10.4 15.8-18.3 4.9-9.4 5.8-18.8 2.1-22.2-1.1-1-2-2.8-2-4.1 0-2-3.5-8.6-5.7-10.6-4-3.7-8.7-7.1-11.7-8.3-2-.9-3.9-2.2-4.2-3-1.1-2.7-237.1-2.1-240.3.5m718.4 0c-1 1.1-2.7 2-3.7 2-2.4 0-12.8 9.7-12.8 12 0 1-.8 2.8-1.8 4.1-8.3 11.1-4.5 32.8 7.8 44.3a27 27 0 0 0 5.9 4.6 26 26 0 0 1 5.9 2.9c7.2 4.2 8.1 4.3 109.3 4.7 79.6.4 91.8.6 92.9 1.9.7.9 2.9 1.5 5.5 1.5q4.2 0 6.5 2c1.3 1.1 3.6 2 5.1 2s3.1.4 3.4 1 1.7 1 3.1 1c1.3 0 3.2.4 4.2 1s2.8 1.5 4.2 2c2.7 1.1 7.2 3.8 14.4 8.6 5.7 3.9 22.6 20.8 22.6 22.7 0 .8.9 2.2 2 3.2a57 57 0 0 1 9 16c.6 1.8 1.8 3.9 2.6 4.5.7.7 1.4 2.7 1.4 4.5s.7 3.8 1.5 4.5q1.5 1.3 1.5 6.7c0 3 .5 6.3 1.1 7.4.7 1.3 1 29.4.9 87.7 0 74.6.1 86 1.4 87.7.9 1.1 1.6 3.7 1.6 5.9 0 2.1 1 5.5 2.2 7.5 5.6 9.4 8.2 13.1 9.3 13.1.7 0 2 .9 3 2 8.7 9.7 33.6 11 42.3 2.4.7-.8 2-1.4 2.7-1.4 2.2 0 11.4-10.1 12.6-14a20 20 0 0 1 2.7-5.3q1.7-1.8 1.4-6.4c-.1-2.5.4-5.5 1-6.6a8 8 0 0 0 .9-4.5q-.1-2 .8-2.2c2 0 1.2-6.4-.9-7.8-1.9-1.1-2-2.3-2-16.7s.1-15.5 2-16.5c2.1-1.1 2.8-4 1-4q-.9-.1-1-1.5.1-1.4 1-1.5c2 0 1.1-7.4-1.1-8.8-2.9-1.8-2.6-38.5.4-40.6 2.1-1.6 2.2-5.5.1-7.1-2.6-1.9-3-9.8-.6-12.1 2.9-2.8 3-12 .2-12.7-2.6-.7-2.6-3.7 0-4.4 2-.5 2.9-3.3 1-3.3q-.9-.1-1-1.5.1-1.4 1-1.5c2.1 0 1.2-13.4-1-15.3-1.9-1.6-2.1-2.8-1.9-17.3.1-12.5-.2-15.9-1.4-17.2-.8-.9-1.7-3.7-2.1-6.2-1-8.8-1.8-11.9-3.2-13.1-.8-.6-1.4-2.6-1.4-4.5s-.4-3.5-.9-3.9-4.3-7.4-8.5-15.9a87 87 0 0 0-9-15.9 3 3 0 0 1-1.6-2.6c0-1-2.7-4.7-6-8.2s-6-6.8-6-7.4a177 177 0 0 0-23.9-23.5c-.7 0-3.5-2.3-6.3-5a31 31 0 0 0-5.8-5c-.5 0-3-1.7-5.7-3.9a32 32 0 0 0-7.1-4.5c-1.2-.4-2.2-1.2-2.2-1.7s-2.9-2.3-6.5-4a28 28 0 0 1-7-4 14 14 0 0 0-5-2c-2.5-.6-5-1.7-5.6-2.5S1110.5 8 1109 8s-3.9-.9-5.3-2q-2.5-2-7.1-2c-3.5 0-4.9-.5-5.8-2-2-3.1-231.4-3.2-234.3 0m-283 111.3c-1.8 1.1-8.2 1.8-31.4 3.3-4.9.3-9.4 1.2-10.5 2-1.2.8-4.5 1.4-7.9 1.4-4.3 0-6.5.5-8.4 2a6 6 0 0 1-5.4 1.3q-2.9-.5-5.4 1.1a10 10 0 0 1-4.5 1.6c-1.1 0-3.2.7-4.5 1.6q-2.6 1.6-5.4 1.1-3-.6-5.4 1.3c-1.4 1.1-3.9 2-5.5 2s-3.5.7-4.2 1.5-2.2 1.5-3.4 1.5-4.5 1.1-7.4 2.5-6.3 2.5-7.4 2.5-3.1.9-4.5 2-3.8 2-5.3 2-3.3.6-3.9 1.4-3.5 2-6.4 2.6a47 47 0 0 0-13.7 5.9c-.8.5-4.6 2.4-8.5 4.1a54 54 0 0 0-10 6 15 15 0 0 1-5.9 3.4c-1.7.4-5.2 2.5-7.9 4.7a25 25 0 0 1-6.1 3.9c-.7 0-2.5 1.4-4.2 3.1a30 30 0 0 1-6.4 4.9c-1.9 1-6.4 4.8-10 8.4a33 33 0 0 1-7.8 6.6 211 211 0 0 0-28.2 27.7c0 .8-2.6 4.2-5.7 7.7-3.2 3.5-7.7 9.5-10.1 13.3a54 54 0 0 1-6.2 8.8q-1.8 1.7-2 2.8a69 69 0 0 1-8.9 17c-1 .6-2.1 2.7-2.4 4.6-.6 2.9-4.2 11-7.5 17.1a27 27 0 0 0-4.2 10.5c0 1.3-.4 2.7-1 3s-1 1.9-1 3.5-.7 3.5-1.5 4.4c-.8.8-1.5 2.8-1.5 4.4s-.6 3.5-1.4 4.1a9 9 0 0 0-2.1 4.4c-.4 1.8-1.8 6.4-3.1 10.4a47 47 0 0 0-2.4 10c0 1.6-.7 3.8-1.5 4.9a17 17 0 0 0-1.5 7.5q0 5.7-1.5 6.9c-.9.7-1.5 2.9-1.5 5.2a18 18 0 0 1-1.6 7 14 14 0 0 0-1.1 8.4c.4 3.9.1 5.8-1.1 7.5s-1.7 4.8-1.7 12.6c-.1 8.2-.4 10.5-1.8 12.1s-1.7 4.1-1.7 16.4c0 12-.3 14.8-1.6 15.8-1.3 1.2-1.5 4.5-1.3 23.8.2 25.1.5 24.2-7.2 24.2q-4.5 0-5.9 1.5c-.7.8-2.4 1.5-3.8 1.5-6.1 0-29.2 19.2-29.2 24.3 0 .9-.9 2.3-2.1 3.1-2 1.4-5.9 11-5.9 14.6 0 .9-.7 2.5-1.5 3.6-1 1.3-1.4 4.5-1.5 10.5 0 7.1-.4 9.1-2 11.2-2.8 3.5-2.8 13.4 0 17 1.8 2.3 2 4 2 20.9 0 13.4.3 18.7 1.3 19.6.6.7 1.5 5.6 2 11 1.5 19.4 1.9 22.1 3.3 23.3.8.7 1.4 3 1.4 5.6q0 4.4 2 7.1 2.1 2.5 1.5 5.1-.5 2.6 1.5 6.4c1.1 2.1 1.8 4.3 1.4 4.9a39 39 0 0 0 4.3 15.3 10 10 0 0 1 1.3 4.6c0 1.5.6 3.2 1.4 3.8.8.7 2.6 4.8 4 9.3 1.5 4.4 3.5 9.2 4.6 10.5s2 3.1 2 3.8c0 2.8 22.8 28.5 25.4 28.5.5 0 1.7.6 2.5 1.3 2.6 2.1 10.9 3.9 13.1 2.7 1-.5 3.7-1 5.9-1s4.3-.5 4.6-1c1.6-2.6 3.3-.8 3.8 4.2.9 9.1 2.3 15.8 3.5 17 .7.7 1.2 3.7 1.2 6.7q0 5.5 1.7 7.3c.9 1 1.6 3.3 1.5 5.1 0 1.7.6 4.8 1.3 6.7s2.3 6.7 3.5 10.7c1.1 4 2.5 7.5 3 7.8s1 2.1 1 3.9c0 1.9.7 3.9 1.5 4.6s1.5 2.5 1.5 4.1.4 3.1 1 3.4 1 1.7 1 3c0 1.9 3.7 10 9 19.5l7.5 15c3.7 7.4 7.2 13.8 7.8 14.2a10 10 0 0 1 2.6 3.5 83 83 0 0 0 8.9 13.5c1.7 2.2 3.2 4.5 3.2 5.2s1.8 3 4 5.1 4 4.6 4 5.5c0 2 54.1 56 56.1 56 .8 0 3.1 1.6 5 3.6a86 86 0 0 0 16.8 12.3 43 43 0 0 1 5.9 4.3 15 15 0 0 0 4.2 2.8c.4 0 2.1 1.1 3.7 2.4 1.5 1.3 3.9 2.7 5.2 3.1a71 71 0 0 1 10.5 6.1c4.4 3 8.6 5.4 9.5 5.4 1.4 0 9 4.6 10.2 6.3.8 1 7.6 4.4 11.5 5.7a11 11 0 0 1 4.4 2.6c.7.7 2.2 1.4 3.3 1.4 1.9 0 9.3 2.9 12.7 5.1l5 2.5 6.2 3c1.4.8 3.7 1.4 5 1.4 1.4 0 3.3.9 4.3 2 1.1 1.2 3.1 2 5.1 2 1.8 0 3.6.4 3.9 1s1.8 1 3.3 1 3.6.7 4.6 1.5c1.1.8 3.9 1.5 6.2 1.5 2.5 0 4.7.6 5.4 1.5q1.3 1.4 6 1.5 4.6 0 6 1.5c1 1.1 3.6 1.5 11.4 1.5q10.2 0 12.6 1.5c3.7 2.1 47.3 2.1 51.4 0q2.8-1.5 11.1-1.5c6.1 0 8.6-.4 9.5-1.5q1.3-1.4 6-1.5 4.6 0 6-1.5c.7-.8 2.9-1.5 4.9-1.5s4.9-.7 6.5-1.5 3.9-1.5 5.2-1.5c1.2 0 2.6-.5 2.9-1s1.9-1 3.4-1 3.8-.9 5.1-2 3.3-2 4.4-2 3.9-.9 6.1-2 5.5-2.3 7.4-2.6a35 35 0 0 0 8.2-3.4c2.5-1.5 5.7-3.1 7-3.5a13 13 0 0 0 3.9-2c.8-.7 4.4-2.5 8-4.1s7.6-3.6 8.9-4.6 3.1-1.8 4.1-1.8 3.7-1.5 6.1-3.4 6.6-4.6 9.3-6a52 52 0 0 0 9.2-6.6c2.4-2.2 5-4 5.7-4s2.2-.9 3.2-2 2.5-2 3.2-2 4.3-2.7 7.7-6 6.8-6 7.5-6 6.8-5.4 13.6-12 13-12 13.9-12 2.6-1.6 3.8-3.6c1.1-1.9 3.2-4 4.4-4.5s2.4-1.7 2.4-2.6 5.4-7.2 12.1-13.8S877 941.9 878 940s3.3-4.9 5-6.5c1.8-1.7 4.7-5.3 6.4-8s4-5.6 4.9-6.4c1-.7 1.7-2.1 1.7-3 0-1 1.1-2.8 2.5-4.1s2.5-2.9 2.5-3.6a13 13 0 0 1 2.8-4.6 97 97 0 0 0 8.9-13.3c.7-1.1 3.5-6.7 6.3-12.5a180 180 0 0 1 6.1-12 84 84 0 0 0 7.9-18.6c0-1.2.5-2.6 1.1-2.9a43 43 0 0 0 5.9-12.6c0-1.6 1.9-7.8 3.2-10.3.5-1 1.1-3.8 1.3-6.3a12 12 0 0 1 1.9-6.2c.9-1 1.6-3.1 1.6-4.8s.7-3.6 1.6-4.4q1.6-1.3 1.1-4.8a20 20 0 0 1 1-7.5c.7-2.1 1.3-5.2 1.3-6.8q.1-8.7 9.6-8.8 12.4 0 28-15.8a56 56 0 0 0 14.3-21.2c.6-1.4 2.4-4.8 4-7.5a22 22 0 0 0 3-7.7c.1-1.5.6-3 1.1-3.3s1-1.9 1-3.4.7-3.6 1.5-4.7c.8-1 1.5-3.1 1.5-4.5 0-1.5.7-3.2 1.5-3.9q1.5-1.2 1.5-7.2c0-4.5.5-6.6 2-8.5s1.9-3.4 1.4-6q-.6-3.4 1.1-8a20 20 0 0 0 1.1-10.5c-.4-4.6-.2-6.5 1.1-8.4s1.6-5 1.6-14.7c-.1-10.3.2-12.7 1.8-15.3 3-4.9 2.9-48.9-.1-52.7-1.7-2.2-2-3.6-1.5-8.4.4-4.3.1-6.4-1-7.9a8 8 0 0 1-1.5-4.2c-.1-11.9-25.4-37-37.5-37.2-1.1 0-2.9-.7-3.9-1.5a9 9 0 0 0-4.7-1.5c-3.9 0-4-1.1-3.8-25 .1-18.7-.1-22-1.5-24.9-1.5-2.7-1.7-5.6-1.5-16q.3-12.7-.9-14.8a44 44 0 0 1-1.2-13c0-8.1-.4-11.4-1.5-12.9a17 17 0 0 1-1.5-7.5q0-5.7-1.5-6.9t-1.5-6.9c0-3.2-.6-6.5-1.4-7.6s-1.6-4.7-1.9-8c-1.1-10.7-2.3-16-4-18.5-.9-1.3-1.7-3.6-1.7-5s-.7-3.4-1.5-4.4a9 9 0 0 1-1.5-4.7c0-1.5-.4-3.1-1-3.4s-1-1.7-1-3-1.4-4.7-3.1-7.6a36 36 0 0 1-3.6-8.3c-.3-1.7-2.3-6.5-4.4-10.7a53 53 0 0 1-3.9-8.4 59 59 0 0 1-5.6-10.5 53 53 0 0 0-4.6-8.9 9 9 0 0 1-1.8-4.2c0-1-.9-2.3-1.9-2.9-1.1-.5-2.3-2-2.7-3.2s-1.8-3.7-3.3-5.4a59 59 0 0 1-4.6-6.5l-3.8-6.4c-1-1.6-5-6.2-8.8-10a36 36 0 0 1-6.9-8.5c0-1.9-14-16-15.9-16-.7 0-5.3-3.8-10-8.5a69 69 0 0 0-9.7-8.5c-.5 0-3.4-2.2-6.5-4.8a81 81 0 0 0-14.8-10.1q-2.5-1.4-3.1-2.2c-.9-1.4-7.7-5.7-10.1-6.4-1.3-.4-3.5-1.8-4.9-3a32 32 0 0 0-7.3-4.5c-2.6-1.2-5-2.6-5.3-3.1q-.6-.8-2.3-.9c-1 0-3-.9-4.4-2s-3.9-2-5.5-2a7 7 0 0 1-4.2-1.4c-.6-.8-3.4-2.2-6.1-3.1s-5.1-2.1-5.4-2.6-1.9-.9-3.4-.9-3.8-.9-5.1-2a9 9 0 0 0-4.7-2c-1.3 0-3.1-.4-4.1-.9a54 54 0 0 0-7.7-2.6c-3.3-.9-7.3-2.3-8.8-3.1s-3.8-1.4-5-1.4-3.5-.9-5.2-2c-1.6-1.1-4.2-2-5.7-2s-3-.5-3.3-1-1.7-1-3.1-1-3.6-.7-4.9-1.6q-2.6-1.6-5.4-1.1-3 .6-5.4-1.3-2.5-2-7.7-2c-2.8 0-6.1-.6-7.3-1.2-2.4-1.4-13.5-2.6-32.4-3.4-8.8-.4-12.5-1-13.4-2-1.6-1.9-67.3-2-70.4-.1m85.7 55.8c.9.5 4.5.9 8 .9 3.9.1 7 .6 8.2 1.5s4.2 1.5 7 1.5c2.9 0 5.9.7 7 1.5s3.8 1.5 6.1 1.5 4.6.5 5.3 1.2c1.1 1.1 7.2 2.4 16.4 3.5 2.6.2 5.2 1.1 5.9 1.9.6.8 2.2 1.4 3.6 1.4s4.1.9 6.1 1.9a59 59 0 0 0 20 7.1c1.1 0 2.3.4 2.6.8.7 1.2 15.1 8.2 16.7 8.2 2 0 10.9 4.3 10.9 5.2 0 .5 2.8 2.3 6.3 3.9 6 2.9 10.8 5.6 15.8 9 6.6 4.4 8.4 5.6 11.4 7.4 9.8 6 15.6 11 31 26.7S872 280.6 872 283c0 .5 1.1 2.2 2.5 3.8s3.4 5.1 4.5 7.7 2.7 5.3 3.5 5.9a67 67 0 0 1 9.5 18.9c0 1.3.8 3.4 1.7 4.7a42 42 0 0 1 6.3 14.5c0 1.2.9 3.4 2 4.8s2 3.9 2 5.5.6 3.5 1.4 4.1c.8.7 1.7 3.3 2 5.9.9 8.6 1.8 12.1 3.2 13.3.8.7 1.4 3 1.4 5.7q0 4.4 1.8 6.5c1.2 1.3 1.7 3.6 1.7 7.7.1 3.5.7 6.5 1.5 7.5 1 1.2 1.3 3.8 1.1 9s.2 8.2 1.4 10.5c1.3 2.5 1.6 5.5 1.4 13.5-.3 8.7-.1 10.7 1.4 12.3 1.6 1.7 1.7 6.4 1.7 61.6 0 69.2-.3 66.6 9.1 71.9 5.5 3.1 7.9 3.3 11.7 1.3 1.5-.8 3.9-1.7 5.4-2s6.4-4.3 11.4-9.1c4.8-4.7 9.4-8.5 10.2-8.5 1.8 0 7.3 4.5 8.9 7.4 2 3.4 1.8 49.5-.2 53.2-1.1 2.1-1.5 6.1-1.5 14 0 8.7-.3 11.4-1.5 12.4s-1.5 3.5-1.5 10.5-.4 9.6-1.5 10.5c-.8.7-1.5 2.8-1.5 4.7s-.7 4.8-1.6 6.5-1.3 4-1 5.1-.2 3.3-1 5c-.9 1.6-1.7 4.8-1.9 7.1-.1 2.5-1.6 6.5-3.7 10.1-2 3.3-3.9 7.1-4.3 8.5-1.7 5.9-7.8 9.7-10.5 6.5a6 6 0 0 0-3.9-1.5c-1.5 0-3.6-.7-4.9-1.5-1.9-1.4-2.4-1.4-5.1 0-1.7.8-4.6 1.5-6.5 1.5-5.7 0-16.5 12.6-16.6 19.3 0 1.2-1.2 4-2.5 6.2a16 16 0 0 0-2.5 8.6q0 4.5-1.5 5.9-1.5 1.2-1.5 7c0 4.1-.5 6.4-1.9 8.1a17 17 0 0 0-2.4 6.9 66 66 0 0 1-4.7 20.7c-.6 2.3-1.5 4.5-2 4.8s-1 1.9-1 3.4c0 1.6-.9 3.9-1.9 5.3a14 14 0 0 0-2.6 5.4 61 61 0 0 1-5.9 14.4c-.7.8-2.5 4.4-4.1 8a52 52 0 0 1-4.1 8.1c-.8.8-1.4 2.2-1.4 3 0 1.4-6.6 12.3-11.9 19.5a56 56 0 0 0-4.6 8c-.9 2.2-3.8 6.1-6.4 8.9a40 40 0 0 0-6.4 8c-.9 1.6-3.6 5-6.1 7.5-2.5 2.4-4.6 5.1-4.6 5.9 0 1.9-41 43.1-42.8 43.1-.8 0-3.9 2.4-7 5.4-3.1 2.9-7 6-8.7 6.9-1.6.8-4.3 2.9-5.9 4.6s-3.4 3.1-3.9 3.1a26 26 0 0 0-5.9 4 28 28 0 0 1-6 4c-.6 0-2.3 1.1-4 2.5-1.6 1.4-3.5 2.5-4.2 2.5s-2.1 1-3.2 2.1c-1 1.2-4.2 3.2-7 4.4a21 21 0 0 0-5.8 3.4 3 3 0 0 1-2.2 1.1c-.9 0-4.2 1.6-7.5 3.5a44 44 0 0 1-8.7 4.1c-1.5.4-3.6 1.4-4.7 2.3q-3.8 3.1-16.5 6.7c-3.6.9-6.9 2.1-7.5 2.6s-2.1.8-3.5.8a9 9 0 0 0-4.9 1.9q-2.2 2-6.7 1.8c-2.8 0-5.1.6-6 1.5-1.2 1.2-3.1 1.4-8.4 1-5-.3-7.6 0-10 1.2-4.7 2.3-40.6 2.4-47.1.1a30 30 0 0 0-10.4-1.3c-3.3.1-7-.4-8.2-1s-3.7-1.2-5.5-1.2-5-.9-7.1-2-4.8-2-6.2-2c-3.3 0-17.6-4.8-19.6-6.6-.8-.8-2.9-1.4-4.6-1.4a7 7 0 0 1-4.7-1.9c-.9-1-3-2.1-4.5-2.4s-5.5-2.2-8.9-4.1c-3.3-2-7.2-3.6-8.6-3.6s-3.4-.8-4.4-1.8-3.6-2.7-5.7-3.9a110 110 0 0 1-16.1-9.2 10 10 0 0 0-3.7-2.1c-.5 0-2.4-1.2-4.2-2.7-3-2.6-6.6-5-12.4-8.2-1.5-.8-2.8-1.7-3.1-2a39 39 0 0 0-8.7-6.1c-.5 0-2.2-1.4-3.9-3.1a24 24 0 0 0-5.9-4.6 156 156 0 0 1-18.2-15.6c-10.8-11-22.4-24-24.1-26.7a51 51 0 0 0-6.6-8c-2.5-2.4-4.6-5.2-4.6-6.1s-.9-2.4-2-3.4-3.9-4.9-6.2-8.7c-2.4-3.9-5.6-8.5-7.1-10.3a29 29 0 0 1-4.3-7.9c-.9-2.4-2.2-5-3-5.7-.8-.6-1.4-1.7-1.4-2.4a19 19 0 0 0-3.5-5.6c-1.9-2.4-3.8-6-4.1-7.9a50 50 0 0 0-3.8-9.5 54 54 0 0 1-4.6-12 54 54 0 0 0-2.7-8.5c-.7-1.4-1.3-3.4-1.3-4.5a12 12 0 0 0-2-5q-1.8-2.9-1.4-5.2c.3-1.2-.1-3.6-1-5.4s-1.6-4.4-1.6-5.9-.7-4.5-1.6-6.5c-1-2.4-1.3-5.1-.9-7.2.4-2.5.1-4-1.4-6q-2.1-2.6-2.1-6.8c0-2.6-.6-4.8-1.5-5.5s-1.5-2.7-1.5-4.6-.4-3.6-1-3.9-1-1.9-1-3.4c0-1.7-1.3-4.3-3.3-6.7a20 20 0 0 1-4.1-6.8c-1.2-4.9-10.4-13.1-16.3-14.5a29 29 0 0 1-7-2.6c-2.6-2-6.7-1.8-11 .5-2.1 1.1-4.8 2-6 2s-2.5.4-2.8 1c-.9 1.5-4.5 1.2-4.5-.4 0-.7-.9-2.5-2-3.9s-2-3.8-2-5.3-.6-3.5-1.4-4.3a75 75 0 0 1-6.3-17.6c-.3-1.7-1.4-4-2.4-5.3a6 6 0 0 1-1.3-5.1c.4-1.7-.1-4.1-1-5.9-.9-1.7-1.6-4.4-1.6-6s-.7-4.6-1.5-6.6c-1-2.3-1.3-5-1-6.9.5-2.4.1-3.9-1.4-5.9-1.6-2-2.1-4.1-2.1-8.6q0-6-1.4-7.2c-2.3-1.8-4.1-57.3-2.1-66 1.9-8.9 10.6-10.9 15.2-3.7.5.7 3.6 3.1 7.1 5.4 11.5 7.8 33.2 5.3 33.2-3.7 0-.9.9-2.5 2-3.5 2-1.8 2-3 2-29.1-.1-17.4.3-28 .9-29.3.7-1.2 1.1-11.7 1.1-28.1 0-21.5.3-26.6 1.5-29.1 1.2-2.2 1.5-5.7 1.4-13.5-.1-8.4.2-10.8 1.5-12.3 1.1-1.3 1.6-3.7 1.6-8.7 0-5.2.5-7.6 2-9.9a8 8 0 0 0 1.4-6.2c-.4-2 0-4.9 1-7.4.9-2.3 1.4-4.9 1.1-5.8s.4-3.4 1.4-5.4c1.3-2.6 1.7-4.9 1.4-7.8-.5-3.1-.1-4.7 1.6-6.9 1.1-1.6 2.1-3.9 2.1-5.2a8 8 0 0 1 1.5-4.2 9 9 0 0 0 1.5-4.7c0-1.5.5-3.1 1-3.4s1-1.7 1-2.9a33 33 0 0 1 3.5-9c1.9-3.7 3.5-7.5 3.5-8.5a244 244 0 0 1 29.7-52.3c2.4-2.7 4.3-5.4 4.3-6 0-1.6 23.2-24.8 24.8-24.8.7 0 4.8-3.3 9.1-7.3 4.2-3.9 9-8 10.6-8.9l9.7-6c1.5-1 3.3-1.8 4.1-1.8s2.2-.9 3.2-2 4.1-3.1 6.9-4.5 5.8-2.9 6.6-3.5l11.5-5.6a139 139 0 0 0 11.5-5.9c.8-.7 2.9-1.5 4.5-1.8a53 53 0 0 0 16.6-5.6c3.4-1.7 7.7-3.1 9.5-3.1a16 16 0 0 0 6.1-1.4 36 36 0 0 1 12-3.6 5 5 0 0 0 3.3-1.5q1.2-1.5 6.9-1.5c3.5 0 6.5-.6 7.7-1.5 1-.8 4.1-1.5 6.7-1.5s5.8-.6 7-1.2c3.7-2.1 18.4-3 63.7-3.6 43.8-.7 48.1-.6 51.2.9"/><path d="M752.5 559.1c-2.7 1.6-6.2 3.5-7.7 4.2a42 42 0 0 0-14.3 14.5c-.3 1.5-1.2 4-2 5.5-2.8 5.5-2.1 30 1 33.3 1.4 1.5 2.5 3.1 2.5 3.7 0 3 6.7 8.6 16 13.4 5.7 2.9 30.7 3.5 33 .8.7-.8 1.9-1.5 2.7-1.5 3 0 12.3-10.4 16.3-18.3 4.5-8.9 5.8-22.7 2.5-28.5-.8-1.5-1.9-4.6-2.5-7-1.2-4.8-8.3-13.8-11.7-14.7-1.2-.4-2.9-1.5-3.9-2.6-.9-1-3-1.9-4.5-1.9-1.6 0-4.3-.9-6.1-2-5.2-3.2-14.9-2.7-21.3 1.1m-296.1 7.1a8 8 0 0 1-4.2 1.8c-1.2 0-2.4.5-2.7 1s-2.4 1.9-4.5 3-4.3 3.1-4.9 4.7c-.6 1.5-2.7 5-4.6 7.8-3.1 4.4-3.5 5.7-3.5 11.1 0 4.8-.4 6.5-2 7.9-1.5 1.3-2 3.1-2 6.6 0 3.8.4 5.1 2 5.9q2 1 2 4.5c0 6 8.1 16.2 17.8 22.3 5.4 3.4 28.3 3 33.1-.6 1.7-1.2 3.7-2.2 4.5-2.2s2.3-1.1 3.3-2.5l5.3-7.3c6.6-8.9 7-10.4 7-24.3 0-10-.3-12.9-1.5-13.9a6 6 0 0 1-1.5-3.9c0-3.6-16.4-20.1-19.9-20.1-1.4 0-3.2-.6-4-1.4-2.6-2.3-16.9-2.6-19.7-.4M597.5 601c-11.1 1-12.2 1.7-17 12l-3.1 6.3a19 19 0 0 0-1.4 7.1q0 4.3-2 6.9-2 2.5-2 6.9c0 2.4-.6 5.3-1.4 6.4-1.6 2.2-2.3 11.4-3.2 38.4-.5 16.2-.4 16.6 2.2 23 3 7.2 9.9 14.6 14.6 15.6 1.5.4 3.3 1.3 3.9 2 2.6 3.2 12.1 6.6 16.7 6.1 2.7-.3 6.2.1 8.5.9 4.8 1.7 12 1.8 14.9.3 1.2-.6 3.9-1.1 6.2-1.1 11.1.2 21.1-15.1 16.1-24.7-3.7-7.3-6-8.1-23.6-8.1-15.9 0-15.9 0-18.9-4.2-3.8-5.2-4.3-14.3-1-18.5 1.6-2.1 2-4.1 2-10.7 0-5.2.5-8.7 1.2-9.4a21 21 0 0 0 2-8c1.3-12.3 2.4-18.2 3.6-19.4.8-.8 1.2-4.6 1.2-10.5 0-9.2 0-9.2-4.5-13-5.7-4.8-6.5-5-15-4.3m138.9 189.1c-.9 1-2.4 1.9-3.3 1.9s-4.1 2.5-7.1 5.5-6 5.5-6.6 5.5c-.7 0-2.6 1.1-4.2 2.5a14 14 0 0 1-3.7 2.5c-.5 0-2.7 1.6-5.1 3.5-2.4 2-5.8 4.1-7.6 4.7s-5.4 2.4-7.9 3.9-5.7 3-7 3.4a13 13 0 0 0-3.9 2c-1.4 1.2-3.4 1.7-11.7 3.2-1.8.3-3.8 1.1-4.4 1.9s-3 1.4-5.6 1.4a11 11 0 0 0-6.8 1.9c-1.9 1.4-3.5 1.7-7.2 1.4q-4.9-.4-8.7 1.1c-5.5 2.3-56.5 2.4-61.9.1-2-.8-6.5-1.5-10-1.5q-6.5 0-7.7-1.5c-.7-.9-2.9-1.5-5.4-1.5-2.3 0-5.1-.7-6.2-1.5-1-.8-3.1-1.5-4.6-1.5s-3-.5-3.3-1-2-1-3.7-1c-1.6 0-4.1-.9-5.5-2a9 9 0 0 0-3.8-2c-.6 0-2-1-3.1-2.1-1-1.2-4.2-3.2-7-4.4a54 54 0 0 1-14.1-11.3 66 66 0 0 0-14.3-11.7q-1.3-1.5-6.5-1.5c-7.1 0-18.5 11.1-18.5 17.9 0 3.8 4 13.3 6 14.6.6.4 1.9 2.3 2.9 4.4 2.3 4.3 15.8 17.9 22.8 22.6 6.6 4.5 30.6 16.5 33 16.5 1.2 0 2.6.6 3.2 1.4 1.2 1.4 4.7 2.3 13.3 3.2 2.6.3 5.2 1.2 5.9 2q1.2 1.4 6.6 1.4c3.4 0 6.8.7 9.3 2 6.1 3.1 76.3 3.1 80.3 0 2-1.6 4-2 9.5-2q7 0 8.1-1.4c.7-.8 3.3-1.6 5.9-1.9 7.5-.9 11.6-1.8 13.2-3.2.8-.7 2.9-1.5 4.5-1.8a130 130 0 0 0 35.5-16.2 32 32 0 0 1 7.1-4c1.4-.3 3.9-1.9 5.4-3.5s3.5-3 4.4-3c2.3 0 22.1-20.8 24.2-25.4 3.9-8.6.4-19.7-8-25.3-3.9-2.5-14.5-2.7-16.7-.2M29 793.5c-1.4.8-3.5 1.4-4.8 1.5-1.2 0-3.2 1.1-4.4 2.5s-2.9 2.5-3.7 2.5c-2.7.1-7.6 5.4-10.7 11.5a22 22 0 0 1-4.1 6.2c-2.5 1-1.8 217 .7 218.3 1.6.8 2 2.1 2 5.9q0 4.8 1.5 6.1c.8.7 1.5 2.7 1.5 4.4 0 1.9 1.1 4.7 2.5 6.6s2.5 4.4 2.5 5.5c0 2.9 7.2 17.1 9.9 19.6 1.2 1.1 2.1 2.6 2.1 3.3 0 1.2 1.9 4 8.2 12 1.3 1.7 2.8 4 3.3 5.3 1.4 3.3 32.4 34.2 36 35.9 3.3 1.6 8.5 5.1 12.9 8.9 1.5 1.4 3.4 2.5 4 2.5a158 158 0 0 1 20.6 10.2c1.4.8 6.6 2.7 11.5 4.3s10.2 3.3 11.7 4.1c1.4.8 4.8 1.4 7.5 1.4q4.8 0 7.8 2c4.7 3.1 225.2 3.1 228 0 1-1.1 2.9-2 4.2-2 4.8 0 13.9-8 20.9-18.5 4.7-6.9 5.1-22.7.7-30.3a47 47 0 0 0-29.3-22.8c-2.5-.4-48.2-.8-101.6-1.1-84.6-.3-97.3-.5-98.4-1.8q-1.2-1.5-7.6-1.5c-4.1 0-7.9-.7-10.6-1.9-2.4-1.1-7.7-2.9-11.8-4.2-4.1-1.2-8.6-3-9.9-4a8 8 0 0 0-4.1-1.9c-.9 0-2.6-1.1-3.8-2.5s-2.9-2.5-3.7-2.5c-1.8 0-23.5-20.8-23.5-22.6 0-.7-1-2.5-2.3-4.1a37 37 0 0 1-3.5-5.3l-3.7-7a37 37 0 0 1-3.1-8.3c-.4-2-1.1-4-1.5-4.3-.5-.3-.9-1.8-.9-3.3s-.5-3.2-1.1-3.8a51 51 0 0 1-1-15c.2-12.6 0-14.2-1.9-16.5-2-2.6-2-3.6-2-85.7 0-83.1 0-83.1-3.5-90.1-4.8-9.6-16-18-24-18-1.2 0-2.8-.7-3.5-1.5-1.6-2-12.6-2-16 0m1154 5c-1.4.8-3.6 1.4-5 1.5-2.8 0-12.5 5.9-15.3 9.3a37 37 0 0 0-6.7 11c0 .8-.9 2.2-2 3.2-1.6 1.4-2 3.1-2 7.9 0 3.8-.6 7-1.5 8.3-1.3 1.8-1.5 13.4-1.4 87.7 0 58.2-.3 86.2-1 87.5-.6 1.1-1.1 4.4-1.1 7.4q0 5.5-1.5 6.7c-.8.7-1.5 1.9-1.5 2.7s-.9 2.6-2 4c-1.2 1.5-1.8 3.4-1.5 4.4q.5 1.8-1.4 3.8a21 21 0 0 0-3.6 5.3l-3.3 6.5a72 72 0 0 1-16.4 16.3c-.7 0-3.1 1.7-5.2 3.7a47 47 0 0 1-9.2 6.4 68 68 0 0 0-6.6 3.6c-.7.6-3 1.6-5 2.2s-4.2 1.9-4.8 2.7c-.8.8-3.1 1.4-6 1.4q-4.8 0-7 2c-1.7 1.5-3.7 2-8 2-3.4 0-6.4.6-7.6 1.5-1.6 1.2-15.2 1.4-98.7 1.5-105.6 0-104.7 0-110.8 5.6-1.4 1.3-3 2.4-3.6 2.4-2.2 0-7.9 6.6-10.6 12.2-1.5 3.1-3.2 6-3.7 6.3-2.5 1.5-1.2 22.4 1.7 27.3 3.7 6.5 14 16.9 18.4 18.6 2 .8 3.9 2.2 4.2 3 1.1 2.8 231.7 2.3 234.2-.4q1.8-2 5.7-2c2.1 0 5.5-.9 7.5-2 2.1-1.1 4.3-2 5-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>',vi=gi;const wi={display:"flex",alignItems:"center",justifyContent:"center",gap:6,color:"var(--nfid-text-subtle)",fontFamily:"inherit",lineHeight:1},xi={display:"inline-flex",alignItems:"center",justifyContent:"center",color:"currentColor"},bi={fontSize:12,fontWeight:600,letterSpacing:.2,color:"var(--nfid-text-muted)"},yi={fontSize:9,fontWeight:400,color:"var(--nfid-text-subtle)",opacity:.75},ki={fontSize:9,fontWeight:500,color:"var(--nfid-text-subtle)",opacity:.75};function Ei({size:e=16,style:n}){return o.jsxs("div",{className:"neofaceid-brand-footer",style:{...wi,...n},children:[o.jsx("span",{"aria-hidden":"true",style:{...xi,width:e,height:e},dangerouslySetInnerHTML:{__html:vi}}),o.jsx("span",{style:bi,children:"NeoFaceID"}),o.jsx("span",{style:yi,children:"by"}),o.jsx("span",{style:ki,children:"Octa"})]})}function _i(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;`}">${vi}</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 Ni{constructor(e){i(this,"applicationToken"),i(this,"modalElement",null),this.applicationToken=e}open(){this.modalElement||(pa(),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 ${_i()}\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 ${_i()}\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 ai(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)||fa(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 Ti=(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 Si();default:return e}},Ci={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..."},Si=()=>{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}},ji=8,Oi=10,Ri=26,Ii=8,zi=-8,Ai=15,Fi=-15,Pi=1500,$i=150,Di=.35,Li=.65,Mi=.18,Bi=.22,qi=2e4;function Ui({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"),w=n.useRef(null),x=n.useRef(null),b=n.useRef(!1),y=n.useRef(null),[k,E]=n.useReducer(Ti,void 0,Si),[_,N]=n.useState(!1),[T,C]=n.useState("ok"),[S,j]=n.useState(!1);n.useEffect((()=>{pa()}),[]);const O=l&&("liveness"===k.status||"camera-loading"===k.status),{flashOn:R}=di(u,{enabled:O});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}))),y.current={stepSequence:k.stepSequence,currentStepIndex:k.currentStepIndex,capturedPhotos:k.capturedPhotos},x.current&&clearTimeout(x.current),"complete"!==k.step&&(x.current=window.setTimeout((()=>{E({type:"ERROR",message:"Tempo limite atingido para o movimento. Por favor, tente novamente em um ambiente bem iluminado.",retryable:!0})}),qi))}}),[k.status,"liveness"===k.status&&k.step,"liveness"===k.status&&k.currentStepIndex]);const I=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/Pi*100,100);E({type:"UPDATE_PROGRESS",progress:n}),n>=100&&(clearInterval(m.current),m.current=null,z())}),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),w.current&&(clearTimeout(w.current),w.current=null),m.current&&(clearInterval(m.current),m.current=null),x.current&&(clearTimeout(x.current),x.current=null)}),[]),n.useEffect((()=>{let e=!0;return(async()=>{if("liveness"===k.status&&!f.current){b.current=!1,w.current&&(clearTimeout(w.current),w.current=null),w.current=window.setTimeout((()=>{e&&!1===b.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&&j(!0)}))}}catch(n){if(!e)return;w.current&&(clearTimeout(w.current),w.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,w.current&&(clearTimeout(w.current),w.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<$i)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(N(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<Di)return"too-far";if(r>Li)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>Mi||c>Bi?"not-centered":"ok"})(n);if("not-detected"!==e&&C(e),"ok"!==e)return I(!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+Ri;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)<ji&&Math.abs(n)<Oi;case"up":return e>Ii;case"down":return e<zi;case"left":return n>Ai;case"right":return n<Fi;default:return!1}})(e.pitch,e.yaw,v.current);I(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&&(b.current=!0,w.current&&(clearTimeout(w.current),w.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 z=async()=>{if(!u.current||!p.current||g.current)return;g.current=!0,h.current=null;const e=y.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((()=>si)),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 Ka(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(li,{active:R}),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"!==T&&o.jsxs("div",{className:"status-badge "+("not-centered"===T?"warning":"error"),children:["too-far"===T&&"Aproxime-se mais","too-close"===T&&"Afaste-se um pouco","not-centered"===T&&"Centralize seu rosto"]}),o.jsx("div",{className:"video-wrapper",children:o.jsx("div",{className:`video-circle ${_&&"ok"===T?"face-detected":""} ${n>0?"capturing":""}`,children:o.jsx("video",{ref:u,className:"video-feed "+(S?"ready":""),autoPlay:!0,muted:!0,playsInline:!0})})}),o.jsxs("div",{className:"instruction-box",children:[o.jsx("p",{className:"instruction-text","aria-live":"assertive",children:Ci[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(Ei,{})})]})})(),"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(Ei,{})})]}),"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(Ei,{})})]}),"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 Ni(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(Ei,{})})]})})()]})}),o.jsx("canvas",{ref:p})]})}const Wi="2.1.0",Ki="neoface_consent_trail_v1";function Vi(){try{if("undefined"==typeof window||!window.localStorage)return[];const e=window.localStorage.getItem(Ki);if(!e)return[];const n=JSON.parse(e);return Array.isArray(n)?n:[]}catch{return[]}}async function Zi(e){try{const n=Ta(),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=Wi,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=Vi();c.push(s);const d=c.slice(-100);return"undefined"!=typeof window&&window.localStorage&&window.localStorage.setItem(Ki,JSON.stringify(d)),s}catch{return null}}const Ji="https://neofaceid.com/privacidade",Gi={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.",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.",primary:"Começar cadastro"}},Hi=e=>1===e?"dia":"dias";const Xi=()=>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"})]}),Yi=()=>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"})]}),Qi=()=>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 es({appName:e,flow:n,privacyPolicyUrl:t=Ji,retentionDays:r=90,onAccept:a,onDecline:i}){const s=Gi[n],c=function(e,n){const t=Number.isFinite(n)&&n>0;return"registration"===e?{title:"Guardamos um vetor matemático do seu rosto",body:t?`Não a foto. A imagem fica guardada por até ${n} ${Hi(n)} e é apagada no fim desse prazo.`:"Não a foto. O prazo de guarda da imagem está na política de privacidade."}:t?{title:`A imagem fica guardada por até ${n} ${Hi(n)}`,body:"Ela é usada para a verificação e apagada no fim desse prazo."}:{title:"A imagem é tratada conforme a política de privacidade",body:"Ela é usada para a verificação; o prazo de guarda está descrito lá."}}(n,r),d=Number.isFinite(r)&&r>0;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(Xi,{})}),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(Yi,{})}),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(Qi,{})}),o.jsxs("div",{children:[o.jsx("p",{className:"neofaceid-consent-bullet-title",children:c.title}),o.jsx("p",{className:"neofaceid-consent-bullet-body",children:c.body})]})]})]}),o.jsx("a",{href:t,target:"_blank",rel:"noopener noreferrer",className:"neofaceid-consent-link",children:d?`Ver política de privacidade (retenção de até ${r} ${Hi(r)})`:"Ver política de privacidade"}),o.jsxs("div",{className:"neofaceid-consent-actions",children:[o.jsx("button",{type:"button",className:"neofaceid-consent-button neofaceid-consent-button-primary",onClick:()=>{Zi().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(Ei,{})})]})})]})}class ns{constructor(){i(this,"container",null),i(this,"root",null)}show(e){this.container||(pa(),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(es,{...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 ts(e={}){const n=Ea(),t=e.appName??n??"sua aplicação";e.appName;const o=e.flow??"verification";return new Promise((n=>{(new ns).show({appName:t,flow:o,privacyPolicyUrl:e.privacyPolicyUrl??Ji,retentionDays:e.retentionDays??90,onAccept:()=>n(!0),onDecline:()=>n(!1)})}))}const os={flow:"verification",privacyPolicyUrl:Ji,retentionDays:90};function rs({open:e,onDismiss:t,dismissOnOverlay:r=!0,ariaLabel:a,ariaLabelledBy:i,children:s,className:c,style:d}){if(n.useEffect((()=>{pa()}),[]),!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(${ca})`,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(${Qr})`,color:`var(${ta})`,borderRadius:`var(${la}, 16px)`,padding:28,maxWidth:440,width:"100%",boxShadow:"0 1px 3px rgba(10,19,32,.08)",boxSizing:"border-box",...d},children:s})})}const as=new Set(["connected","heartbeat","processing"]),is=31e4,ss=5;function cs(e,n){return new Promise((t=>{const o=setTimeout(t,e);null==n||n.addEventListener("abort",(()=>{clearTimeout(o),t()}),{once:!0})}))}async function ds(e){const{requestTicket:n,buildUrl:t,classify:o,timeoutMs:r=is,maxReconnects:a=ss,signal:i,eventSourceFactory:s,onProgress:c}=e,d=s??(e=>{const n=globalThis.EventSource;if(!n)throw new h("EventSource indisponível neste ambiente",f.INITIALIZATION_ERROR);return new n(e)}),l=Date.now();let u=0;for(;;){if(null==i?void 0:i.aborted)throw new h("Fluxo cancelado",f.UNKNOWN);const e=r-(Date.now()-l);if(e<=0)throw new h("Tempo esgotado aguardando resposta",f.NETWORK);const s=await n(),p=await new Promise(((n,r)=>{let a;try{a=d(t(s))}catch(g){return void r(g)}let l,u,p=!1;const m=()=>{void 0!==l&&clearTimeout(l),u&&(null==i||i.removeEventListener("abort",u)),a.close()};l=setTimeout((()=>{p||(p=!0,m(),r(new h("Tempo esgotado aguardando resposta",f.NETWORK)))}),e),u=()=>{p||(p=!0,m(),r(new h("Fluxo cancelado",f.UNKNOWN)))},null==i||i.addEventListener("abort",u,{once:!0}),a.onmessage=e=>{if(p)return;let t;try{t=JSON.parse(e.data)}catch{return}if(t.status&&as.has(t.status))return void(c&&c(t));const r=o(t);"pending"!==r.kind?(p=!0,m(),n({type:"settled",verdict:r})):c&&c(t)},a.onerror=()=>{p||(p=!0,m(),n({type:"transport"}))}}));if("settled"===p.type){const{verdict:e}=p;if("resolve"===e.kind)return e.value;throw e.error}if(u+=1,u>a)throw new h(`Conexão perdida após ${a} tentativas de reconexão`,f.NETWORK);const m=Math.min(500*2**(u-1),8e3);await cs(m,i)}}const ls={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},us=n.forwardRef((({variant:e="primary",style:n,type:t="button",...r},a)=>{const i="primary"===e?{background:`var(${aa})`,color:`var(${ia})`}:"secondary"===e?{background:`var(${ea})`,color:`var(${ta})`}:{background:"transparent",color:`var(${oa})`};return o.jsx("button",{ref:a,type:t,...r,style:{...ls,...i,...n}})}));function ps({tone:e,children:n,icon:t,className:r}){const a=Vr[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]})}us.displayName="Button";const fs="neofaceid-awaiting-push-styles",hs="\n.neofaceid-root .nfid-push {\n display: flex; flex-direction: column; align-items: center; text-align: center; gap: 10px;\n padding: 8px 8px 4px;\n}\n.neofaceid-root .nfid-push 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-push p {\n margin: 0; font-size: 14px; color: var(--nfid-text-muted); line-height: 1.5;\n}\n.neofaceid-root .nfid-push-phone-icon {\n width: 56px; height: 56px; color: var(--nfid-action);\n}\n.neofaceid-root .nfid-push-code {\n display: flex; flex-direction: column; align-items: center; gap: 6px;\n margin-top: 14px; padding: 16px 28px;\n background: var(--nfid-surface-muted); border-radius: 16px; width: 100%;\n}\n.neofaceid-root .nfid-push-code-label {\n font-size: 11px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase;\n color: var(--nfid-text-subtle);\n}\n.neofaceid-root .nfid-push-code-value {\n font-size: 52px; font-weight: 800; line-height: 1; letter-spacing: 0.08em;\n color: var(--nfid-text); font-variant-numeric: tabular-nums;\n}\n.neofaceid-root .nfid-push-countdown {\n font-size: 13px; color: var(--nfid-text-muted); font-variant-numeric: tabular-nums;\n margin-top: 12px;\n}\n.neofaceid-root .nfid-push-actions {\n display: flex; flex-direction: column; gap: 10px; width: 100%; margin-top: 16px;\n}\n.neofaceid-root .nfid-push-footer {\n display: flex; justify-content: center; margin-top: 16px; padding-top: 12px;\n border-top: 1px solid var(--nfid-line);\n width: 100%;\n}\n.neofaceid-root .nfid-push-pulse {\n animation: nfidPushPulse 1.8s ease-in-out infinite;\n}\n@keyframes nfidPushPulse {\n 0%, 100% { opacity: 1; }\n 50% { opacity: 0.45; }\n}\n@media (prefers-reduced-motion: reduce) {\n .neofaceid-root .nfid-push-pulse { animation: none; }\n}\n";function ms(e){const n=Math.max(0,e);return`${Math.floor(n/60)}:${String(n%60).padStart(2,"0")}`}function gs({appName:e,numericCode:t,remainingSeconds:r,onCancel:a}){return n.useEffect((()=>{pa(),fa(fs,hs)}),[]),o.jsxs("div",{className:"nfid-push",role:"status","aria-live":"polite",children:[o.jsx(ps,{tone:"attention",children:"Aguardando confirmação"}),o.jsxs("svg",{className:"nfid-push-phone-icon nfid-push-pulse",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[o.jsx("rect",{x:"6",y:"2",width:"12",height:"20",rx:"3"}),o.jsx("path",{d:"M11 18h2"})]}),o.jsx("h2",{children:"Confirme no seu celular"}),o.jsxs("p",{children:["Enviamos um pedido de confirmação para o seu aparelho. Abra o NeoFaceID Push e confirme com o seu rosto para continuar no ",e,"."]}),t&&o.jsxs("div",{className:"nfid-push-code",children:[o.jsx("span",{className:"nfid-push-code-label",children:"Digite este número no celular"}),o.jsx("span",{className:"nfid-push-code-value","aria-label":`Código de confirmação: ${t.split("").join(" ")}`,children:t})]}),o.jsxs("p",{className:"nfid-push-countdown",children:["Expira em ",ms(r)]}),o.jsx("div",{className:"nfid-push-actions",children:o.jsx(us,{variant:"ghost",onClick:a,children:"Cancelar"})}),o.jsx("div",{className:"nfid-push-footer",children:o.jsx(Ei,{})})]})}function vs({onFallback:e,onCancel:t}){return n.useEffect((()=>{pa(),fa(fs,hs)}),[]),o.jsxs("div",{className:"nfid-push",role:"alert","aria-live":"assertive",children:[o.jsxs("svg",{className:"nfid-push-phone-icon",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",style:{color:"var(--nfid-text-muted)"},children:[o.jsx("circle",{cx:"12",cy:"12",r:"9"}),o.jsx("path",{d:"M12 7v5l3 2"})]}),o.jsx("h2",{children:"O tempo esgotou"}),o.jsx("p",{children:"Não recebemos a confirmação do seu celular a tempo."}),o.jsx("div",{className:"nfid-push-actions",children:e?o.jsxs(o.Fragment,{children:[o.jsx(us,{variant:"primary",onClick:e,children:"Entrar de outro jeito"}),o.jsx(us,{variant:"ghost",onClick:t,children:"Agora não"})]}):o.jsx(us,{variant:"primary",onClick:t,children:"Entendi"})}),o.jsx("div",{className:"nfid-push-footer",children:o.jsx(Ei,{})})]})}function ws({appName:e,onFallback:t,onCancel:r}){return n.useEffect((()=>{pa(),fa(fs,hs)}),[]),o.jsxs("div",{className:"nfid-push",role:"alert","aria-live":"assertive",children:[o.jsxs("svg",{className:"nfid-push-phone-icon",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",style:{color:"var(--nfid-text-muted)"},children:[o.jsx("circle",{cx:"12",cy:"12",r:"9"}),o.jsx("path",{d:"M8 12h8"})]}),o.jsx("h2",{children:"Solicitação cancelada"}),o.jsxs("p",{children:["O pedido de confirmação foi cancelado antes de ser respondido. Você pode tentar de novo pelo"," ",e,"."]}),o.jsx("div",{className:"nfid-push-actions",children:t?o.jsxs(o.Fragment,{children:[o.jsx(us,{variant:"primary",onClick:t,children:"Entrar de outro jeito"}),o.jsx(us,{variant:"ghost",onClick:r,children:"Agora não"})]}):o.jsx(us,{variant:"primary",onClick:r,children:"Entendi"})}),o.jsx("div",{className:"nfid-push-footer",children:o.jsx(Ei,{})})]})}function xs({appName:e,onCancel:t}){return n.useEffect((()=>{pa(),fa(fs,hs)}),[]),o.jsxs("div",{className:"nfid-push",role:"alert","aria-live":"assertive",children:[o.jsxs("svg",{className:"nfid-push-phone-icon",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",style:{color:"#D64545"},children:[o.jsx("circle",{cx:"12",cy:"12",r:"9"}),o.jsx("path",{d:"M15 9l-6 6M9 9l6 6"})]}),o.jsx("h2",{children:"Confirmação recusada"}),o.jsxs("p",{children:["O pedido foi recusado no celular. Se não foi você, procure o suporte do ",e,"."]}),o.jsx("div",{className:"nfid-push-actions",children:o.jsx(us,{variant:"primary",onClick:t,children:"Entendi"})}),o.jsx("div",{className:"nfid-push-footer",children:o.jsx(Ei,{})})]})}function bs(e){var n,t,o;switch(e.status){case"approved":case"success":return{kind:"resolve",value:{status:"approved",data:e.data??{}}};case"denied":return{kind:"resolve",value:{status:"denied",reason:(null==(n=e.data)?void 0:n.reason)??e.message}};case"expired":return{kind:"resolve",value:{status:"expired"}};case"cancelled":return{kind:"resolve",value:{status:"cancelled",source:"server",reason:(null==(t=e.data)?void 0:t.reason)??e.message}};case"failed":case"error":return{kind:"reject",error:new h(e.message??(null==(o=e.data)?void 0:o.message)??"Falha na confirmação",f.API_ERROR)};default:return{kind:"pending"}}}function ys({requestId:e,applicationToken:t,expiresIn:r,numericCode:a,appName:i,onFallback:s,onSettle:c}){const d=i??Ea()??"sua aplicação",[l,u]=n.useState(r),[p,m]=n.useState({kind:"waiting"});return n.useEffect((()=>{if("waiting"!==p.kind)return;const e=setInterval((()=>{u((e=>e>0?e-1:0))}),1e3);return()=>clearInterval(e)}),[p.kind]),n.useEffect((()=>{const n=new AbortController;let o=!1;const a=ya(),i=`${a}/api/v1/authorization/events/${encodeURIComponent(e)}/ticket/`;return ds({signal:n.signal,timeoutMs:1e3*(r+30),requestTicket:async()=>{var e;const n=await fetch(i,{method:"POST",headers:{"Content-Type":"application/json","X-App-Token":t}});if(!n.ok)throw new h(`Falha ao abrir canal de confirmação: ${n.status}`,401===n.status||403===n.status?f.INVALID_TOKEN:f.NETWORK);const o=await n.json(),r=(null==(e=null==o?void 0:o.data)?void 0:e.ticket)??(null==o?void 0:o.ticket);if(!r)throw new h("Canal de confirmação sem ticket",f.API_ERROR);return r},buildUrl:n=>`${a}/api/v1/authorization/events/${encodeURIComponent(e)}/?ticket=${encodeURIComponent(n)}`,classify:bs}).then((e=>{o||(o=!0,"denied"!==e.status?"expired"!==e.status?"cancelled"!==e.status?c(e):m({kind:"cancelled",reason:e.reason}):m({kind:"expired"}):m({kind:"denied"}))})).catch((()=>{o||n.signal.aborted||(o=!0,m({kind:"expired"}))})),()=>{o=!0,n.abort()}}),[e]),"denied"===p.kind?o.jsx(rs,{open:!0,dismissOnOverlay:!1,ariaLabel:"Confirmação recusada",children:o.jsx(xs,{appName:d,onCancel:()=>c({status:"denied"})})}):"cancelled"===p.kind?o.jsx(rs,{open:!0,dismissOnOverlay:!1,ariaLabel:"Solicitação cancelada",children:o.jsx(ws,{appName:d,onFallback:s?()=>{s(),c({status:"cancelled",source:"server",reason:p.reason})}:void 0,onCancel:()=>c({status:"cancelled",source:"server",reason:p.reason})})}):"expired"===p.kind?o.jsx(rs,{open:!0,dismissOnOverlay:!1,ariaLabel:"Tempo esgotado",children:o.jsx(vs,{onFallback:s?()=>{s(),c({status:"expired"})}:void 0,onCancel:()=>c({status:"expired"})})}):o.jsx(rs,{open:!0,dismissOnOverlay:!1,ariaLabel:"Aguardando confirmação no celular",children:o.jsx(gs,{appName:d,numericCode:a,remainingSeconds:l,onCancel:()=>c({status:"cancelled",source:"user"})})})}const ks="neofaceid-device-enrollment-styles",Es="\n.neofaceid-root .nfid-enroll {\n display: flex; flex-direction: column; align-items: center; text-align: center; gap: 10px;\n padding: 8px 8px 4px;\n}\n.neofaceid-root .nfid-enroll 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-enroll p {\n margin: 0; font-size: 14px; color: var(--nfid-text-muted); line-height: 1.5;\n}\n/* O QR é sempre escuro sobre branco, independente do tema: leitor de código\n falha com contraste invertido, e a moldura clara faz a zona de silêncio. */\n.neofaceid-root .nfid-enroll-qr {\n background: #FFFFFF; padding: 14px; border-radius: 16px; margin-top: 12px;\n line-height: 0; box-shadow: 0 0 0 1px var(--nfid-line);\n}\n.neofaceid-root .nfid-enroll-qr svg { display: block; width: 184px; height: 184px; }\n.neofaceid-root .nfid-enroll-handle {\n display: flex; flex-direction: column; align-items: center; gap: 4px;\n margin-top: 14px; padding: 12px 24px;\n background: var(--nfid-surface-muted); border-radius: 12px; width: 100%;\n}\n.neofaceid-root .nfid-enroll-handle-label {\n font-size: 11px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase;\n color: var(--nfid-text-subtle);\n}\n.neofaceid-root .nfid-enroll-handle-value {\n font-size: 26px; font-weight: 800; line-height: 1.1; letter-spacing: 0.12em;\n color: var(--nfid-text); font-variant-numeric: tabular-nums;\n font-family: ui-monospace, SFMono-Regular, Menlo, monospace;\n}\n.neofaceid-root .nfid-enroll-countdown {\n font-size: 13px; color: var(--nfid-text-muted); font-variant-numeric: tabular-nums;\n margin-top: 10px;\n}\n.neofaceid-root .nfid-enroll-actions {\n display: flex; flex-direction: column; gap: 10px; width: 100%; margin-top: 16px;\n}\n.neofaceid-root .nfid-enroll-note {\n font-size: 12px; line-height: 1.45; color: var(--nfid-text-muted);\n background: var(--nfid-surface-muted); border-radius: 10px;\n padding: 10px 14px; margin-top: 12px; text-align: left; width: 100%;\n}\n.neofaceid-root .nfid-enroll-icon { width: 56px; height: 56px; }\n.neofaceid-root .nfid-enroll-footer {\n display: flex; justify-content: center; margin-top: 16px; padding-top: 12px;\n border-top: 1px solid var(--nfid-line); width: 100%;\n}\n";function _s(e){const n=Math.max(0,e);return`${Math.floor(n/60)}:${String(n%60).padStart(2,"0")}`}function Ns({value:e}){const[t,r]=n.useState(null);return n.useEffect((()=>{let n=!1;return Promise.resolve().then((()=>ed)).then((t=>{if(n)return;const o=(t.default??t)(0,"M");o.addData(e),o.make();const a=o.getModuleCount(),i=[];for(let e=0;e<a;e+=1)for(let n=0;n<a;n+=1)o.isDark(e,n)&&i.push(`M${n} ${e}h1v1h-1z`);r({d:i.join(""),count:a})})).catch((()=>{n||r(null)})),()=>{n=!0}}),[e]),t?o.jsx("svg",{viewBox:`0 0 ${t.count} ${t.count}`,shapeRendering:"crispEdges",role:"img","aria-label":`Código para inscrição do aparelho: ${e.split("").join(" ")}`,children:o.jsx("path",{d:t.d,fill:"#000000"})}):o.jsx("svg",{viewBox:"0 0 21 21","aria-hidden":"true"})}function Ts({appName:e,handle:t,remainingSeconds:r,onCancel:a}){return n.useEffect((()=>{pa(),fa(ks,Es)}),[]),o.jsxs("div",{className:"nfid-enroll",role:"status","aria-live":"polite",children:[o.jsx(ps,{tone:"attention",children:"Aguardando o aparelho"}),o.jsx("h2",{children:"Vincule seu celular"}),o.jsxs("p",{children:["Abra o NeoFaceID Push no celular e aponte para este código para vinculá-lo à sua conta no"," ",e,"."]}),o.jsx("div",{className:"nfid-enroll-qr",children:o.jsx(Ns,{value:t})}),o.jsxs("div",{className:"nfid-enroll-handle",children:[o.jsx("span",{className:"nfid-enroll-handle-label",children:"Ou digite este código"}),o.jsx("span",{className:"nfid-enroll-handle-value",children:t})]}),o.jsxs("p",{className:"nfid-enroll-countdown",children:["O código expira em ",_s(r)]}),o.jsx("div",{className:"nfid-enroll-actions",children:o.jsx(us,{variant:"ghost",onClick:a,children:"Cancelar"})}),o.jsx("div",{className:"nfid-enroll-footer",children:o.jsx(Ei,{})})]})}function Cs({deviceLabel:e,onDone:t}){return n.useEffect((()=>{pa(),fa(ks,Es)}),[]),o.jsxs("div",{className:"nfid-enroll",role:"alert","aria-live":"assertive",children:[o.jsxs("svg",{className:"nfid-enroll-icon",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",style:{color:"#1E9E6A"},children:[o.jsx("circle",{cx:"12",cy:"12",r:"9"}),o.jsx("path",{d:"M8.5 12.5l2.5 2.5 4.5-5"})]}),o.jsx("h2",{children:"Aparelho vinculado"}),e?o.jsxs("p",{children:[o.jsx("strong",{children:e})," agora pode confirmar suas operações."]}):o.jsx("p",{children:"Um aparelho acabou de ser vinculado à sua conta."}),o.jsx("div",{className:"nfid-enroll-note",children:e?o.jsx(o.Fragment,{children:"Se este não é o seu aparelho, procure o suporte agora — alguém pode ter vinculado um celular à sua conta."}):o.jsxs(o.Fragment,{children:[o.jsx("strong",{children:"Não conseguimos identificar qual aparelho foi vinculado."})," Se não foi você quem acabou de fazer isso, procure o suporte agora — alguém pode ter vinculado um celular à sua conta."]})}),o.jsx("div",{className:"nfid-enroll-actions",children:o.jsx(us,{variant:"primary",onClick:t,children:"Entendi"})}),o.jsx("div",{className:"nfid-enroll-footer",children:o.jsx(Ei,{})})]})}function Ss({onRetry:e,onCancel:t}){return n.useEffect((()=>{pa(),fa(ks,Es)}),[]),o.jsxs("div",{className:"nfid-enroll",role:"alert","aria-live":"assertive",children:[o.jsxs("svg",{className:"nfid-enroll-icon",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",style:{color:"var(--nfid-text-muted)"},children:[o.jsx("circle",{cx:"12",cy:"12",r:"9"}),o.jsx("path",{d:"M12 7v5l3 2"})]}),o.jsx("h2",{children:"O código expirou"}),o.jsx("p",{children:"Códigos de vinculação valem poucos minutos, por segurança. Gere um novo para tentar."}),o.jsxs("div",{className:"nfid-enroll-actions",children:[o.jsx(us,{variant:"primary",onClick:e,children:"Gerar novo código"}),o.jsx(us,{variant:"ghost",onClick:t,children:"Agora não"})]}),o.jsx("div",{className:"nfid-enroll-footer",children:o.jsx(Ei,{})})]})}function js(e){var n,t,o;switch(e.status){case"enrolled":return{kind:"resolve",value:{status:"enrolled",deviceLabel:(null==(n=e.data)?void 0:n.device_label)??null,enrolledAt:null==(t=e.data)?void 0:t.enrolled_at}};case"expired":return{kind:"resolve",value:{status:"expired"}};case"error":case"failed":return{kind:"reject",error:new h(e.message??(null==(o=e.data)?void 0:o.message)??"Falha ao inscrever o aparelho",f.API_ERROR)};default:return{kind:"pending"}}}function Os({userAccessToken:e,applicationToken:t,appName:r,attempt:a,onSettle:i,onRetry:s,onFatal:c}){const d=r??Ea()??"sua aplicação",[l,u]=n.useState({kind:"loading"}),[p,m]=n.useState(0);return n.useEffect((()=>{const n=new AbortController;let o=!1;return(async()=>{let r;try{r=await Za(e,t)}catch(i){return void(o||c(i))}if(o)return;u({kind:"waiting",handle:r.handle,jti:r.jti,expiresIn:r.expiresIn}),m(r.expiresIn);const a=`${ya()}/api/v1/devices/enrollment/${encodeURIComponent(r.jti)}/events/`;try{const e=await ds({signal:n.signal,timeoutMs:1e3*(r.expiresIn+30),requestTicket:async()=>{var e;const n=await fetch(`${a}ticket/`,{method:"POST",headers:{"Content-Type":"application/json","X-App-Token":t}});if(!n.ok)throw new h(`Falha ao abrir o canal de inscrição: ${n.status}`,401===n.status||403===n.status?f.INVALID_TOKEN:f.NETWORK);const o=await n.json(),r=(null==(e=null==o?void 0:o.data)?void 0:e.ticket)??(null==o?void 0:o.ticket);if(!r)throw new h("Canal de inscrição sem ticket",f.API_ERROR);return r},buildUrl:e=>`${a}?ticket=${encodeURIComponent(e)}`,classify:js});if(o)return;if("enrolled"===e.status)return void u({kind:"enrolled",deviceLabel:e.deviceLabel,enrolledAt:e.enrolledAt});u({kind:"expired"})}catch{if(o||n.signal.aborted)return;u({kind:"expired"})}})(),()=>{o=!0,n.abort()}}),[a]),n.useEffect((()=>{if("waiting"!==l.kind)return;const e=setInterval((()=>m((e=>e>0?e-1:0))),1e3);return()=>clearInterval(e)}),[l.kind]),"loading"===l.kind?null:"enrolled"===l.kind?o.jsx(rs,{open:!0,dismissOnOverlay:!1,ariaLabel:"Aparelho vinculado",children:o.jsx(Cs,{deviceLabel:l.deviceLabel,onDone:()=>i({status:"enrolled",deviceLabel:l.deviceLabel,enrolledAt:l.enrolledAt})})}):"expired"===l.kind?o.jsx(rs,{open:!0,dismissOnOverlay:!1,ariaLabel:"Código expirado",children:o.jsx(Ss,{onRetry:s,onCancel:()=>i({status:"expired"})})}):o.jsx(rs,{open:!0,dismissOnOverlay:!1,ariaLabel:"Vincular aparelho",children:o.jsx(Ts,{appName:d,handle:l.handle,remainingSeconds:p,onCancel:()=>i({status:"cancelled"})})})}function Rs(e={}){const n=document.createElement("div");n.className="neofaceid-camera-oval-guide-overlay-root",Object.assign(n.style,{position:"fixed",top:"0",left:"0",width:"100vw",height:"100vh",backgroundColor:"rgba(0, 0, 0, 0.85)",backdropFilter:"blur(8px)",zIndex:"99999",display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center"}),document.body.appendChild(n);let r=t.createRoot(n),a=e.stream||null,i=e.faceState||"searching",s=e.instruction||"Centralize o rosto";const c=(n,t,a)=>{r&&r.render(o.jsxs("div",{style:{position:"relative",width:"100%",height:"100%",display:"flex",alignItems:"center",justifyContent:"center"},children:[e.onCancel&&o.jsx("button",{onClick:()=>{var n;d.close(),null==(n=e.onCancel)||n.call(e)},style:{position:"absolute",top:"20px",right:"20px",background:"rgba(255, 255, 255, 0.2)",border:"none",color:"#fff",fontSize:"24px",width:"40px",height:"40px",borderRadius:"50%",cursor:"pointer",zIndex:10,display:"flex",alignItems:"center",justifyContent:"center"},"aria-label":"Cancelar",children:"✕"}),o.jsx(Is,{stream:n,faceState:t,instruction:a})]}))};c(a,i,s);const d={update:(e,n,t)=>{a=e,i=n,s=t,c(e,n,t)},close:()=>{r&&(r.unmount(),r=null),n.parentElement&&n.parentElement.removeChild(n)}};return d}function Is({stream:e,faceState:t,instruction:r,className:a="",style:i={}}){const s=n.useRef(null);n.useEffect((()=>{const n=s.current;if(n)return e?(n.srcObject=e,n.play().catch((()=>{}))):n.srcObject=null,()=>{e&&e.getTracks().forEach((e=>e.stop())),n&&(n.srcObject=null)}}),[e]);const c=function(e){switch(e){case"centered":return{borderColor:"#0E9F6E",boxShadow:"0 0 0 4px rgba(14, 159, 110, 0.8), 0 0 45px rgba(14, 159, 110, 0.45)",svgStroke:"#0E9F6E",badgeBg:"rgba(14, 159, 110, 0.95)",badgeColor:"#FFFFFF"};case"too-far":case"too-close":case"off-center":return{borderColor:"#F59E0B",boxShadow:"0 0 0 4px rgba(245, 158, 11, 0.7), 0 0 35px rgba(245, 158, 11, 0.35)",svgStroke:"#F59E0B",badgeBg:"rgba(245, 158, 11, 0.95)",badgeColor:"#1F2937"};default:return{borderColor:"rgba(156, 163, 175, 0.5)",boxShadow:"0 0 0 4px rgba(156, 163, 175, 0.3), 0 0 20px rgba(156, 163, 175, 0.15)",svgStroke:"#9CA3AF",badgeBg:"rgba(55, 65, 81, 0.9)",badgeColor:"#FFFFFF"}}}(t);return o.jsxs("div",{className:`neofaceid-camera-oval-guide-container ${a}`,style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",position:"relative",width:"100%",maxHeight:"100%",padding:"16px",boxSizing:"border-box",...i},children:[o.jsx("style",{children:"\n .neofaceid-oval-frame {\n width: 320px;\n height: 400px;\n border-radius: 50%;\n overflow: hidden;\n position: relative;\n background: #000000;\n transition: box-shadow 0.3s ease, border-color 0.3s ease;\n }\n\n .neofaceid-oval-video {\n width: 100%;\n height: 100%;\n object-fit: cover;\n transform: scaleX(-1);\n display: block;\n }\n\n .neofaceid-oval-svg-overlay {\n position: absolute;\n inset: 0;\n width: 100%;\n height: 100%;\n pointer-events: none;\n z-index: 2;\n }\n\n .neofaceid-oval-instruction-badge {\n margin-top: 20px;\n padding: 10px 20px;\n border-radius: 20px;\n font-size: 15px;\n font-weight: 600;\n text-align: center;\n max-width: 320px;\n box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);\n backdrop-filter: blur(8px);\n transition: background-color 0.3s ease, color 0.3s ease;\n z-index: 5;\n }\n\n @media (max-width: 640px) {\n .neofaceid-oval-frame {\n width: 280px;\n height: 350px;\n }\n }\n "}),o.jsxs("div",{className:"neofaceid-oval-frame",style:{boxShadow:c.boxShadow,borderColor:c.borderColor},children:[o.jsx("video",{ref:s,className:"neofaceid-oval-video",autoPlay:!0,playsInline:!0,muted:!0,"data-testid":"camera-oval-video"}),o.jsx("svg",{className:"neofaceid-oval-svg-overlay",viewBox:"0 0 320 400",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:o.jsx("ellipse",{cx:"160",cy:"200",rx:"140",ry:"180",stroke:c.svgStroke,strokeWidth:"3",strokeDasharray:"searching"===t?"8 8":"none",style:{transition:"stroke 0.3s ease"}})})]}),r&&o.jsx("div",{className:"neofaceid-oval-instruction-badge","aria-live":"assertive",style:{backgroundColor:c.badgeBg,color:c.badgeColor},"data-testid":"camera-oval-instruction",children:r})]})}function zs({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 Ni(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 As{constructor(){i(this,"container",null),i(this,"root",null)}show(e,n,o,r,a){this.container||(pa(),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(zs,{error:e,onRetry:()=>{this.close(),n()},onCredentials:()=>{this.close(),t()},applicationToken:a??"",onCancel:()=>{this.close(),null==r||r()}}))}}class Fs{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(){pa(),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 ${_i()}\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)||fa(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 Va(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 Ps=!1,$s=null;async function Ds(){if(!Ps)return $s||($s=(async()=>{try{const e="/models";await d.nets.tinyFaceDetector.loadFromUri(e),Ps=!0}catch(e){}})(),$s)}async function Ls(e,n,t,o=5e3,r=100){return new Promise((a=>{let i=0;const s=Math.ceil(o/r);let c=null,l=!1,u=0;const p=e=>{l||(l=!0,c&&clearTimeout(c),a(e))},f=async()=>{if(!l){if(i++,!Ps)return t.update(n,"searching","Carregando modelos de detecção..."),i>=s?void p(!1):void(c=window.setTimeout(f,r));try{const o=await d.detectSingleFace(e,new d.TinyFaceDetectorOptions({inputSize:160,scoreThreshold:.3})),{faceState:a,instruction:l}=function(e,n,t){if(!e||!n||!t)return{faceState:"searching",instruction:"Centralize o rosto"};const o=e.x+e.width/2,r=e.y+e.height/2,a=n/2,i=t/2,s=Math.abs(o-a)/n,c=Math.abs(r-i)/t,d=e.width*e.height/(n*t);return d<.08?{faceState:"too-far",instruction:"Aproxime-se"}:d>.45?{faceState:"too-close",instruction:"Afaste-se"}:s>.18||c>.18?{faceState:"off-center",instruction:"Centralize o rosto"}:{faceState:"centered",instruction:"Perfeito, mantenha"}}(o?o.box:null,e.videoWidth,e.videoHeight);if(t.update(n,a,l),"centered"===a){if(u+=r,u>=1e3)return void p(!0)}else u=0;if(i>=s)return void p(!1);c=window.setTimeout(f,r)}catch(o){if(i>=s)return void p(!1);c=window.setTimeout(f,r)}}};window.setTimeout((()=>{l||p(!1)}),o+500),f()}))}async function Ms(e){const{applicationToken:n,onSuccess:t,onError:o,onFallbackRequest:r,onCancel:a,fastMode:i=!1}=e,s=new As;let c,d=0;Ps||i||Ds().catch((()=>{}));const l=async()=>{try{d++;const e=await async function(e,n=!1,t){const o=Rs({stream:null,faceState:"searching",instruction:"Iniciando câmera...",onCancel:t}),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,o.update(a,"searching","Centralize o rosto"),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()}})),await new Promise((e=>setTimeout(e,100)));let t=!0;if(n||(t=await Ls(r,a,o,5e3,100)),!t)throw o.close(),a&&a.getTracks().forEach((e=>e.stop())),r.parentElement&&r.parentElement.removeChild(r),new h("Nenhum rosto centralizado detectado. Por favor, tente novamente.",f.VALIDATION_ERROR);o.update(a,"centered","Capturando imagem...");const i=document.createElement("canvas");i.width=r.videoWidth,i.height=r.videoHeight;const s=i.getContext("2d");if(!s)throw o.close(),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);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)}));o.update(a,"centered","Verificando com o servidor...");const d=await La(c,e);if(o.close(),a&&a.getTracks().forEach((e=>e.stop())),r.parentElement&&r.parentElement.removeChild(r),!d.success)throw new h("Login falhou",f.LOGIN_FAILED);return d}catch(i){if(o.close(),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)}}(n,i,a);t(e)}catch(e){c=e instanceof h?e:new h(e instanceof Error?e.message:"Erro desconhecido",f.UNKNOWN),d<2?setTimeout((()=>{l()}),500):setTimeout((()=>{s.show(c,(()=>{d=0,setTimeout((()=>l()),500)}),(()=>{r?r():o(new h("Por favor, use email e senha para fazer login",f.LOGIN_FAILED))}),a,n)}),500)}};l()}const Bs=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(!Ps)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:Ms,preloadFaceDetectionModels:Ds},Symbol.toStringTag,{value:"Module"}));function qs(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))},w=()=>{"undefined"==typeof document||g||(g=document.createElement("canvas"));const n=ci(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((()=>{ci(e(),{scratch:g??void 0})-(h??0)<o&&(f=Date.now(),v(!1)),h=null}),600)))};return{start(){!1!==n.enabled&&(c||(w(),c=setInterval(w,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 Us{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=qs((()=>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 ${_i()}\n </div>\n </div>\n </div>\n `,pa(),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((()=>td)),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(),fa(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 ")}}const Ws="Consentimento recusado pelo usuário.";let Ks=null;function Vs(){Ks=null}async function Zs({applicationToken:e,purpose:n}){if(!e)throw new h("applicationToken é obrigatório para abrir sessão de captura",f.INVALID_TOKEN);const t=`${ya()}/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 Ks={session_id:i,expires_at:s},Ks}async function Js({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=`${ya()}/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 Gs({applicationToken:e,purpose:n,collectFramesForGesture:t,retryOnSessionExpired:o=!0}){const r=async()=>{const o=await Zs({applicationToken:e,purpose:n}),r=await Js({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 Vs(),r();throw a}}class Hs{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 ${_i()}\n </div>\n </div>\n `,pa(),fa("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=qs((()=>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=[{tip:8,pip:6},{tip:12,pip:10},{tip:16,pip:14},{tip:20,pip:18}],Ys=(e,n)=>Math.hypot(e.x-n.x,e.y-n.y);function Qs(e){if(e.length<21)return!1;const n=e[0],t=e[2],o=e[4];return!!(Ys(o,n)>1.3*Ys(t,n))&&Xs.every((({tip:t,pip:o})=>{const r=e[t],a=e[o];return Ys(r,n)<Ys(a,n)}))}let ec=null;function nc(){return ec||(ec=async function(){const[e,n]=await Promise.all([import("@tensorflow/tfjs-core"),import("@tensorflow-models/hand-pose-detection")]);return await import("@tensorflow/tfjs-backend-webgl"),await e.setBackend("webgl"),await e.ready(),n.createDetector(n.SupportedModels.MediaPipeHands,{runtime:"tfjs",modelType:"lite",maxHands:1})}()),ec}const tc=e=>new Promise((n=>{setTimeout(n,e)}));async function oc(e,n){const t=await nc(),o=Date.now()+n;for(;Date.now()<o;){const n=await t.estimateHands(e,{flipHorizontal:!0});if(n.length>0&&Qs(n[0].keypoints))return!0;await tc(150)}return!1}const rc=["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 ac({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(${aa})`,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 ic({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(ac,{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(${aa}, url(#nfid-challenge-arc))`,strokeWidth:4.2,strokeLinecap:"round",strokeDasharray:c,strokeDashoffset:d,fill:"none",style:{transition:"stroke-dashoffset 200ms ease-out"}})]})]})}function sc({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(${aa})`,...a},role:"img","aria-label":cc[e],children:["blink"===e?o.jsx(lc,{stroke:3.4}):o.jsx(dc,{stroke:3.4}),"blink"!==e&&"center"!==e&&o.jsx(uc,{gesture:e,stroke:3.4})]})}const cc={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 dc({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 lc({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 uc({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"})}const pc={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"]},fc={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 hc={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 mc(){n.useEffect((()=>{pa(),fa("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 gc({appName:e,onContinue:n}){return mc(),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(us,{variant:"primary",onClick:n,children:"Continuar"})})]})}function vc({errorCode:e,attempt:n,maxAttempts:t,timestamp:r,onRetry:a,onFallback:i}){mc();const s=function(e){if(!e)return pc;const n=e.toUpperCase();return fc[n]??pc}(e),c=r??new Date;return o.jsxs("div",{className:"nfid-state",role:"alert","aria-live":"assertive",children:[o.jsxs(ps,{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(us,{variant:"primary",onClick:a,children:"Tentar de novo"}),o.jsx(us,{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 wc({browser:e,onFallback:n,onCancel:t}){mc();const r=function(e){return hc[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(us,{variant:"primary",onClick:n,children:"Verificar de outro jeito"}),o.jsx(us,{variant:"ghost",onClick:t,children:"Agora não"})]})]})}const xc={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"},bc={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 yc({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,w]=n.useState(null),[x,b]=n.useState("preparing"),[y,k]=n.useState(1),[E,_]=n.useState(void 0),[N,T]=n.useState(void 0),[C,S]=n.useState(0),j=n.useRef(!1),[O,R]=n.useState(!1),{flashOn:I}=di(p,{enabled:l&&!O&&"challenging"===x}),z=Na(),A=t??Ea()??"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,z):null;n.useEffect((()=>{pa(),fa("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 j.current=!1,b("preparing"),g(0),w(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 b("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((()=>{}))),b("challenging");const o=await Gs({applicationToken:e,purpose:"authorization",collectFramesForGesture:async(e,n,t)=>{if(j.current)throw new h("Cancelado",f.UNKNOWN);w(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,b("success"),s&&s(o)}catch(o){if(j.current)return;const e=o instanceof h?o:new h(o instanceof Error?o.message:"Falha",f.UNKNOWN);_(e.type),T(new Date),b("failure"),c&&c(e)}finally{n&&n.getTracks().forEach((e=>e.stop()))}}(),()=>{j.current=!0,n&&n.getTracks().forEach((e=>e.stop()))}}),[C]);const P=()=>{j.current=!0,d&&d(),u()},$=()=>{y>=3?P():(k((e=>e+1)),_(void 0),T(void 0),S((e=>e+1)))},D=()=>{j.current=!0,c&&c(new h("Fluxo alternativo solicitado pelo usuário",f.CONSENT_DENIED)),u()},L=v?xc[v.gesture_key]??"center":"center",M=v?bc[v.gesture_key]??"Siga a instrução":"Preparando a câmera…";return"success"===x?o.jsx(rs,{open:!0,dismissOnOverlay:!1,ariaLabel:"Identidade confirmada",children:o.jsx(gc,{appName:A,onContinue:u})}):"permission-denied"===x?o.jsx(rs,{open:!0,dismissOnOverlay:!1,ariaLabel:"Câmera bloqueada",children:o.jsx(wc,{onFallback:D,onCancel:P})}):"failure"===x?o.jsx(rs,{open:!0,dismissOnOverlay:!1,ariaLabel:"Não foi possível confirmar",children:o.jsx(vc,{errorCode:E,attempt:y,maxAttempts:3,timestamp:N,onRetry:$,onFallback:D})}):o.jsxs(rs,{open:!0,onDismiss:void 0,dismissOnOverlay:!1,ariaLabel:"Autorização por biometria",children:[o.jsx(li,{active:I,onDismiss:()=>R(!0)}),o.jsxs("div",{style:{position:"relative"},children:[o.jsx("button",{type:"button",className:"nfid-authorize-close",onClick:P,"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(ic,{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(sc,{gesture:L,size:40}),o.jsx("p",{className:"nfid-authorize-instruction","aria-live":"assertive",style:{margin:0},children:M})]}),"preparing"===x&&o.jsx("p",{className:"nfid-authorize-support",children:"Ligando sua câmera…"}),o.jsx("div",{className:"nfid-authorize-actions",children:o.jsx(us,{variant:"ghost",onClick:P,children:"Não consigo fazer esse movimento"})}),o.jsx("div",{className:"nfid-authorize-footer",children:o.jsx(Ei,{})})]})]})}const kc={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 Ec{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 ts({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 ',pa(),fa("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(kc).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?kc[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?kc[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 ${_i()}\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 Ca(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=qs((()=>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?kc[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 _c=async e=>new Ec(e).open(),Nc=Object.freeze(Object.defineProperty({__proto__:null,DocumentCaptureModal:Ec,startDocumentCapture:_c},Symbol.toStringTag,{value:"Module"})),Tc="Consentimento recusado pelo usuário.";const Cc=function(e,n){let t=e;const o=Ic[n];let r=null,a=0,i=null;const s=[],c={},d=function(e,n){a=4*t+17,r=function(e){const n=new Array(e);for(let t=0;t<e;t+=1){n[t]=new Array(e);for(let o=0;o<e;o+=1)n[t][o]=null}return n}(a),l(0,0),l(a-7,0),l(0,a-7),p(),u(),h(e,n),t>=7&&f(e),null==i&&(i=g(t,o,s)),m(i,n)},l=function(e,n){for(let t=-1;t<=7;t+=1)if(!(e+t<=-1||a<=e+t))for(let o=-1;o<=7;o+=1)n+o<=-1||a<=n+o||(r[e+t][n+o]=0<=t&&t<=6&&(0==o||6==o)||0<=o&&o<=6&&(0==t||6==t)||2<=t&&t<=4&&2<=o&&o<=4)},u=function(){for(let e=8;e<a-8;e+=1)null==r[e][6]&&(r[e][6]=e%2==0);for(let e=8;e<a-8;e+=1)null==r[6][e]&&(r[6][e]=e%2==0)},p=function(){const e=Bc.getPatternPosition(t);for(let n=0;n<e.length;n+=1)for(let t=0;t<e.length;t+=1){const o=e[n],a=e[t];if(null==r[o][a])for(let e=-2;e<=2;e+=1)for(let n=-2;n<=2;n+=1)r[o+e][a+n]=-2==e||2==e||-2==n||2==n||0==e&&0==n}},f=function(e){const n=Bc.getBCHTypeNumber(t);for(let t=0;t<18;t+=1){const o=!e&&1==(n>>t&1);r[Math.floor(t/3)][t%3+a-8-3]=o}for(let t=0;t<18;t+=1){const o=!e&&1==(n>>t&1);r[t%3+a-8-3][Math.floor(t/3)]=o}},h=function(e,n){const t=o<<3|n,i=Bc.getBCHTypeInfo(t);for(let o=0;o<15;o+=1){const n=!e&&1==(i>>o&1);o<6?r[o][8]=n:o<8?r[o+1][8]=n:r[a-15+o][8]=n}for(let o=0;o<15;o+=1){const n=!e&&1==(i>>o&1);o<8?r[8][a-o-1]=n:o<9?r[8][15-o-1+1]=n:r[8][15-o-1]=n}r[a-8][8]=!e},m=function(e,n){let t=-1,o=a-1,i=7,s=0;const c=Bc.getMaskFunction(n);for(let d=a-1;d>0;d-=2)for(6==d&&(d-=1);;){for(let n=0;n<2;n+=1)if(null==r[o][d-n]){let t=!1;s<e.length&&(t=1==(e[s]>>>i&1));c(o,d-n)&&(t=!t),r[o][d-n]=t,i-=1,-1==i&&(s+=1,i=7)}if(o+=t,o<0||a<=o){o-=t,t=-t;break}}},g=function(e,n,t){const o=Wc.getRSBlocks(e,n),r=Kc();for(let i=0;i<t.length;i+=1){const n=t[i];r.put(n.getMode(),4),r.put(n.getLength(),Bc.getLengthInBits(n.getMode(),e)),n.write(r)}let a=0;for(let i=0;i<o.length;i+=1)a+=o[i].dataCount;if(r.getLengthInBits()>8*a)throw"code length overflow. ("+r.getLengthInBits()+">"+8*a+")";for(r.getLengthInBits()+4<=8*a&&r.put(0,4);r.getLengthInBits()%8!=0;)r.putBit(!1);for(;!(r.getLengthInBits()>=8*a||(r.put(236,8),r.getLengthInBits()>=8*a));)r.put(17,8);return function(e,n){let t=0,o=0,r=0;const a=new Array(n.length),i=new Array(n.length);for(let l=0;l<n.length;l+=1){const s=n[l].dataCount,c=n[l].totalCount-s;o=Math.max(o,s),r=Math.max(r,c),a[l]=new Array(s);for(let n=0;n<a[l].length;n+=1)a[l][n]=255&e.getBuffer()[n+t];t+=s;const d=Bc.getErrorCorrectPolynomial(c),u=Uc(a[l],d.getLength()-1).mod(d);i[l]=new Array(d.getLength()-1);for(let e=0;e<i[l].length;e+=1){const n=e+u.getLength()-i[l].length;i[l][e]=n>=0?u.getAt(n):0}}let s=0;for(let l=0;l<n.length;l+=1)s+=n[l].totalCount;const c=new Array(s);let d=0;for(let l=0;l<o;l+=1)for(let e=0;e<n.length;e+=1)l<a[e].length&&(c[d]=a[e][l],d+=1);for(let l=0;l<r;l+=1)for(let e=0;e<n.length;e+=1)l<i[e].length&&(c[d]=i[e][l],d+=1);return c}(r,o)};c.addData=function(e,n){let t=null;switch(n=n||"Byte"){case"Numeric":t=Vc(e);break;case"Alphanumeric":t=Zc(e);break;case"Byte":t=Jc(e);break;case"Kanji":t=Gc(e);break;default:throw"mode:"+n}s.push(t),i=null},c.isDark=function(e,n){if(e<0||a<=e||n<0||a<=n)throw e+","+n;return r[e][n]},c.getModuleCount=function(){return a},c.make=function(){if(t<1){let e=1;for(;e<40;e++){const n=Wc.getRSBlocks(e,o),t=Kc();for(let o=0;o<s.length;o++){const n=s[o];t.put(n.getMode(),4),t.put(n.getLength(),Bc.getLengthInBits(n.getMode(),e)),n.write(t)}let r=0;for(let e=0;e<n.length;e++)r+=n[e].dataCount;if(t.getLengthInBits()<=8*r)break}t=e}d(!1,function(){let e=0,n=0;for(let t=0;t<8;t+=1){d(!0,t);const o=Bc.getLostPoint(c);(0==t||e>o)&&(e=o,n=t)}return n}())},c.createTableTag=function(e,n){e=e||2;let t="";t+='<table style="',t+=" border-width: 0px; border-style: none;",t+=" border-collapse: collapse;",t+=" padding: 0px; margin: "+(n=void 0===n?4*e:n)+"px;",t+='">',t+="<tbody>";for(let o=0;o<c.getModuleCount();o+=1){t+="<tr>";for(let n=0;n<c.getModuleCount();n+=1)t+='<td style="',t+=" border-width: 0px; border-style: none;",t+=" border-collapse: collapse;",t+=" padding: 0px; margin: 0px;",t+=" width: "+e+"px;",t+=" height: "+e+"px;",t+=" background-color: ",t+=c.isDark(o,n)?"#000000":"#ffffff",t+=";",t+='"/>';t+="</tr>"}return t+="</tbody>",t+="</table>",t},c.createSvgTag=function(e,n,t,o){let r={};"object"==typeof arguments[0]&&(r=arguments[0],e=r.cellSize,n=r.margin,t=r.alt,o=r.title),e=e||2,n=void 0===n?4*e:n,(t="string"==typeof t?{text:t}:t||{}).text=t.text||null,t.id=t.text?t.id||"qrcode-description":null,(o="string"==typeof o?{text:o}:o||{}).text=o.text||null,o.id=o.text?o.id||"qrcode-title":null;const a=c.getModuleCount()*e+2*n;let i,s,d,l,u,p="";for(u="l"+e+",0 0,"+e+" -"+e+",0 0,-"+e+"z ",p+='<svg version="1.1" xmlns="http://www.w3.org/2000/svg"',p+=r.scalable?"":' width="'+a+'px" height="'+a+'px"',p+=' viewBox="0 0 '+a+" "+a+'" ',p+=' preserveAspectRatio="xMinYMin meet"',p+=o.text||t.text?' role="img" aria-labelledby="'+v([o.id,t.id].join(" ").trim())+'"':"",p+=">",p+=o.text?'<title id="'+v(o.id)+'">'+v(o.text)+"</title>":"",p+=t.text?'<description id="'+v(t.id)+'">'+v(t.text)+"</description>":"",p+='<rect width="100%" height="100%" fill="white" cx="0" cy="0"/>',p+='<path d="',d=0;d<c.getModuleCount();d+=1)for(l=d*e+n,i=0;i<c.getModuleCount();i+=1)c.isDark(d,i)&&(s=i*e+n,p+="M"+s+","+l+u);return p+='" stroke="transparent" fill="black"/>',p+="</svg>",p},c.createDataURL=function(e,n){e=e||2,n=void 0===n?4*e:n;const t=c.getModuleCount()*e+2*n,o=n,r=t-n;return Yc(t,t,(function(n,t){if(o<=n&&n<r&&o<=t&&t<r){const r=Math.floor((n-o)/e),a=Math.floor((t-o)/e);return c.isDark(a,r)?0:1}return 1}))},c.createImgTag=function(e,n,t){e=e||2,n=void 0===n?4*e:n;const o=c.getModuleCount()*e+2*n;let r="";return r+="<img",r+=' src="',r+=c.createDataURL(e,n),r+='"',r+=' width="',r+=o,r+='"',r+=' height="',r+=o,r+='"',t&&(r+=' alt="',r+=v(t),r+='"'),r+="/>",r};const v=function(e){let n="";for(let t=0;t<e.length;t+=1){const o=e.charAt(t);switch(o){case"<":n+="<";break;case">":n+=">";break;case"&":n+="&";break;case'"':n+=""";break;default:n+=o}}return n};return c.createASCII=function(e,n){if((e=e||1)<2)return function(e){e=void 0===e?2:e;const n=1*c.getModuleCount()+2*e,t=e,o=n-e;let r,a,i,s,d;const l={"██":"█","█ ":"▀"," █":"▄"," ":" "},u={"██":"▀","█ ":"▀"," █":" "," ":" "};let p="";for(r=0;r<n;r+=2){for(i=Math.floor((r-t)/1),s=Math.floor((r+1-t)/1),a=0;a<n;a+=1)d="█",t<=a&&a<o&&t<=r&&r<o&&c.isDark(i,Math.floor((a-t)/1))&&(d=" "),t<=a&&a<o&&t<=r+1&&r+1<o&&c.isDark(s,Math.floor((a-t)/1))?d+=" ":d+="█",p+=e<1&&r+1>=o?u[d]:l[d];p+="\n"}return n%2&&e>0?p.substring(0,p.length-n-1)+Array(n+1).join("▀"):p.substring(0,p.length-1)}(n);e-=1,n=void 0===n?2*e:n;const t=c.getModuleCount()*e+2*n,o=n,r=t-n;let a,i,s,d;const l=Array(e+1).join("██"),u=Array(e+1).join(" ");let p="",f="";for(a=0;a<t;a+=1){for(s=Math.floor((a-o)/e),f="",i=0;i<t;i+=1)d=1,o<=i&&i<r&&o<=a&&a<r&&c.isDark(s,Math.floor((i-o)/e))&&(d=0),f+=d?l:u;for(s=0;s<e;s+=1)p+=f+"\n"}return p.substring(0,p.length-1)},c.renderTo2dContext=function(e,n){n=n||2;const t=c.getModuleCount();for(let o=0;o<t;o++)for(let r=0;r<t;r++)e.fillStyle=c.isDark(o,r)?"black":"white",e.fillRect(r*n,o*n,n,n)},c};Cc.stringToBytes=function(e){const n=[];for(let t=0;t<e.length;t+=1){const o=e.charCodeAt(t);n.push(255&o)}return n},Cc.createStringToBytes=function(e,n){const t=function(){const t=Xc(e),o=function(){const e=t.read();if(-1==e)throw"eof";return e};let r=0;const a={};for(;;){const e=t.read();if(-1==e)break;const n=o(),i=o()<<8|o();a[String.fromCharCode(e<<8|n)]=i,r+=1}if(r!=n)throw r+" != "+n;return a}(),o="?".charCodeAt(0);return function(e){const n=[];for(let r=0;r<e.length;r+=1){const a=e.charCodeAt(r);if(a<128)n.push(a);else{const a=t[e.charAt(r)];"number"==typeof a?(255&a)==a?n.push(a):(n.push(a>>>8),n.push(255&a)):n.push(o)}}return n}};const Sc=1,jc=2,Oc=4,Rc=8,Ic={L:1,M:0,Q:3,H:2},zc=0,Ac=1,Fc=2,Pc=3,$c=4,Dc=5,Lc=6,Mc=7,Bc=function(){const e=[[],[6,18],[6,22],[6,26],[6,30],[6,34],[6,22,38],[6,24,42],[6,26,46],[6,28,50],[6,30,54],[6,32,58],[6,34,62],[6,26,46,66],[6,26,48,70],[6,26,50,74],[6,30,54,78],[6,30,56,82],[6,30,58,86],[6,34,62,90],[6,28,50,72,94],[6,26,50,74,98],[6,30,54,78,102],[6,28,54,80,106],[6,32,58,84,110],[6,30,58,86,114],[6,34,62,90,118],[6,26,50,74,98,122],[6,30,54,78,102,126],[6,26,52,78,104,130],[6,30,56,82,108,134],[6,34,60,86,112,138],[6,30,58,86,114,142],[6,34,62,90,118,146],[6,30,54,78,102,126,150],[6,24,50,76,102,128,154],[6,28,54,80,106,132,158],[6,32,58,84,110,136,162],[6,26,54,82,110,138,166],[6,30,58,86,114,142,170]],n=1335,t=7973,o={},r=function(e){let n=0;for(;0!=e;)n+=1,e>>>=1;return n};return o.getBCHTypeInfo=function(e){let t=e<<10;for(;r(t)-r(n)>=0;)t^=n<<r(t)-r(n);return 21522^(e<<10|t)},o.getBCHTypeNumber=function(e){let n=e<<12;for(;r(n)-r(t)>=0;)n^=t<<r(n)-r(t);return e<<12|n},o.getPatternPosition=function(n){return e[n-1]},o.getMaskFunction=function(e){switch(e){case zc:return function(e,n){return(e+n)%2==0};case Ac:return function(e,n){return e%2==0};case Fc:return function(e,n){return n%3==0};case Pc:return function(e,n){return(e+n)%3==0};case $c:return function(e,n){return(Math.floor(e/2)+Math.floor(n/3))%2==0};case Dc:return function(e,n){return e*n%2+e*n%3==0};case Lc:return function(e,n){return(e*n%2+e*n%3)%2==0};case Mc:return function(e,n){return(e*n%3+(e+n)%2)%2==0};default:throw"bad maskPattern:"+e}},o.getErrorCorrectPolynomial=function(e){let n=Uc([1],0);for(let t=0;t<e;t+=1)n=n.multiply(Uc([1,qc.gexp(t)],0));return n},o.getLengthInBits=function(e,n){if(1<=n&&n<10)switch(e){case Sc:return 10;case jc:return 9;case Oc:case Rc:return 8;default:throw"mode:"+e}else if(n<27)switch(e){case Sc:return 12;case jc:return 11;case Oc:return 16;case Rc:return 10;default:throw"mode:"+e}else{if(!(n<41))throw"type:"+n;switch(e){case Sc:return 14;case jc:return 13;case Oc:return 16;case Rc:return 12;default:throw"mode:"+e}}},o.getLostPoint=function(e){const n=e.getModuleCount();let t=0;for(let r=0;r<n;r+=1)for(let o=0;o<n;o+=1){let a=0;const i=e.isDark(r,o);for(let t=-1;t<=1;t+=1)if(!(r+t<0||n<=r+t))for(let s=-1;s<=1;s+=1)o+s<0||n<=o+s||0==t&&0==s||i==e.isDark(r+t,o+s)&&(a+=1);a>5&&(t+=3+a-5)}for(let r=0;r<n-1;r+=1)for(let o=0;o<n-1;o+=1){let n=0;e.isDark(r,o)&&(n+=1),e.isDark(r+1,o)&&(n+=1),e.isDark(r,o+1)&&(n+=1),e.isDark(r+1,o+1)&&(n+=1),0!=n&&4!=n||(t+=3)}for(let r=0;r<n;r+=1)for(let o=0;o<n-6;o+=1)e.isDark(r,o)&&!e.isDark(r,o+1)&&e.isDark(r,o+2)&&e.isDark(r,o+3)&&e.isDark(r,o+4)&&!e.isDark(r,o+5)&&e.isDark(r,o+6)&&(t+=40);for(let r=0;r<n;r+=1)for(let o=0;o<n-6;o+=1)e.isDark(o,r)&&!e.isDark(o+1,r)&&e.isDark(o+2,r)&&e.isDark(o+3,r)&&e.isDark(o+4,r)&&!e.isDark(o+5,r)&&e.isDark(o+6,r)&&(t+=40);let o=0;for(let r=0;r<n;r+=1)for(let t=0;t<n;t+=1)e.isDark(t,r)&&(o+=1);return t+=10*(Math.abs(100*o/n/n-50)/5),t},o}(),qc=function(){const e=new Array(256),n=new Array(256);for(let o=0;o<8;o+=1)e[o]=1<<o;for(let o=8;o<256;o+=1)e[o]=e[o-4]^e[o-5]^e[o-6]^e[o-8];for(let o=0;o<255;o+=1)n[e[o]]=o;const t={glog:function(e){if(e<1)throw"glog("+e+")";return n[e]},gexp:function(n){for(;n<0;)n+=255;for(;n>=256;)n-=255;return e[n]}};return t}(),Uc=function(e,n){if(void 0===e.length)throw e.length+"/"+n;const t=function(){let t=0;for(;t<e.length&&0==e[t];)t+=1;const o=new Array(e.length-t+n);for(let n=0;n<e.length-t;n+=1)o[n]=e[n+t];return o}(),o={getAt:function(e){return t[e]},getLength:function(){return t.length},multiply:function(e){const n=new Array(o.getLength()+e.getLength()-1);for(let t=0;t<o.getLength();t+=1)for(let r=0;r<e.getLength();r+=1)n[t+r]^=qc.gexp(qc.glog(o.getAt(t))+qc.glog(e.getAt(r)));return Uc(n,0)},mod:function(e){if(o.getLength()-e.getLength()<0)return o;const n=qc.glog(o.getAt(0))-qc.glog(e.getAt(0)),t=new Array(o.getLength());for(let r=0;r<o.getLength();r+=1)t[r]=o.getAt(r);for(let o=0;o<e.getLength();o+=1)t[o]^=qc.gexp(qc.glog(e.getAt(o))+n);return Uc(t,0).mod(e)}};return o},Wc=function(){const e=[[1,26,19],[1,26,16],[1,26,13],[1,26,9],[1,44,34],[1,44,28],[1,44,22],[1,44,16],[1,70,55],[1,70,44],[2,35,17],[2,35,13],[1,100,80],[2,50,32],[2,50,24],[4,25,9],[1,134,108],[2,67,43],[2,33,15,2,34,16],[2,33,11,2,34,12],[2,86,68],[4,43,27],[4,43,19],[4,43,15],[2,98,78],[4,49,31],[2,32,14,4,33,15],[4,39,13,1,40,14],[2,121,97],[2,60,38,2,61,39],[4,40,18,2,41,19],[4,40,14,2,41,15],[2,146,116],[3,58,36,2,59,37],[4,36,16,4,37,17],[4,36,12,4,37,13],[2,86,68,2,87,69],[4,69,43,1,70,44],[6,43,19,2,44,20],[6,43,15,2,44,16],[4,101,81],[1,80,50,4,81,51],[4,50,22,4,51,23],[3,36,12,8,37,13],[2,116,92,2,117,93],[6,58,36,2,59,37],[4,46,20,6,47,21],[7,42,14,4,43,15],[4,133,107],[8,59,37,1,60,38],[8,44,20,4,45,21],[12,33,11,4,34,12],[3,145,115,1,146,116],[4,64,40,5,65,41],[11,36,16,5,37,17],[11,36,12,5,37,13],[5,109,87,1,110,88],[5,65,41,5,66,42],[5,54,24,7,55,25],[11,36,12,7,37,13],[5,122,98,1,123,99],[7,73,45,3,74,46],[15,43,19,2,44,20],[3,45,15,13,46,16],[1,135,107,5,136,108],[10,74,46,1,75,47],[1,50,22,15,51,23],[2,42,14,17,43,15],[5,150,120,1,151,121],[9,69,43,4,70,44],[17,50,22,1,51,23],[2,42,14,19,43,15],[3,141,113,4,142,114],[3,70,44,11,71,45],[17,47,21,4,48,22],[9,39,13,16,40,14],[3,135,107,5,136,108],[3,67,41,13,68,42],[15,54,24,5,55,25],[15,43,15,10,44,16],[4,144,116,4,145,117],[17,68,42],[17,50,22,6,51,23],[19,46,16,6,47,17],[2,139,111,7,140,112],[17,74,46],[7,54,24,16,55,25],[34,37,13],[4,151,121,5,152,122],[4,75,47,14,76,48],[11,54,24,14,55,25],[16,45,15,14,46,16],[6,147,117,4,148,118],[6,73,45,14,74,46],[11,54,24,16,55,25],[30,46,16,2,47,17],[8,132,106,4,133,107],[8,75,47,13,76,48],[7,54,24,22,55,25],[22,45,15,13,46,16],[10,142,114,2,143,115],[19,74,46,4,75,47],[28,50,22,6,51,23],[33,46,16,4,47,17],[8,152,122,4,153,123],[22,73,45,3,74,46],[8,53,23,26,54,24],[12,45,15,28,46,16],[3,147,117,10,148,118],[3,73,45,23,74,46],[4,54,24,31,55,25],[11,45,15,31,46,16],[7,146,116,7,147,117],[21,73,45,7,74,46],[1,53,23,37,54,24],[19,45,15,26,46,16],[5,145,115,10,146,116],[19,75,47,10,76,48],[15,54,24,25,55,25],[23,45,15,25,46,16],[13,145,115,3,146,116],[2,74,46,29,75,47],[42,54,24,1,55,25],[23,45,15,28,46,16],[17,145,115],[10,74,46,23,75,47],[10,54,24,35,55,25],[19,45,15,35,46,16],[17,145,115,1,146,116],[14,74,46,21,75,47],[29,54,24,19,55,25],[11,45,15,46,46,16],[13,145,115,6,146,116],[14,74,46,23,75,47],[44,54,24,7,55,25],[59,46,16,1,47,17],[12,151,121,7,152,122],[12,75,47,26,76,48],[39,54,24,14,55,25],[22,45,15,41,46,16],[6,151,121,14,152,122],[6,75,47,34,76,48],[46,54,24,10,55,25],[2,45,15,64,46,16],[17,152,122,4,153,123],[29,74,46,14,75,47],[49,54,24,10,55,25],[24,45,15,46,46,16],[4,152,122,18,153,123],[13,74,46,32,75,47],[48,54,24,14,55,25],[42,45,15,32,46,16],[20,147,117,4,148,118],[40,75,47,7,76,48],[43,54,24,22,55,25],[10,45,15,67,46,16],[19,148,118,6,149,119],[18,75,47,31,76,48],[34,54,24,34,55,25],[20,45,15,61,46,16]],n=function(e,n){const t={};return t.totalCount=e,t.dataCount=n,t},t={};return t.getRSBlocks=function(t,o){const r=function(n,t){switch(t){case Ic.L:return e[4*(n-1)+0];case Ic.M:return e[4*(n-1)+1];case Ic.Q:return e[4*(n-1)+2];case Ic.H:return e[4*(n-1)+3];default:return}}(t,o);if(void 0===r)throw"bad rs block @ typeNumber:"+t+"/errorCorrectionLevel:"+o;const a=r.length/3,i=[];for(let e=0;e<a;e+=1){const t=r[3*e+0],o=r[3*e+1],a=r[3*e+2];for(let e=0;e<t;e+=1)i.push(n(o,a))}return i},t}(),Kc=function(){const e=[];let n=0;const t={getBuffer:function(){return e},getAt:function(n){const t=Math.floor(n/8);return 1==(e[t]>>>7-n%8&1)},put:function(e,n){for(let o=0;o<n;o+=1)t.putBit(1==(e>>>n-o-1&1))},getLengthInBits:function(){return n},putBit:function(t){const o=Math.floor(n/8);e.length<=o&&e.push(0),t&&(e[o]|=128>>>n%8),n+=1}};return t},Vc=function(e){const n=Sc,t=e,o={getMode:function(){return n},getLength:function(e){return t.length},write:function(e){const n=t;let o=0;for(;o+2<n.length;)e.put(r(n.substring(o,o+3)),10),o+=3;o<n.length&&(n.length-o==1?e.put(r(n.substring(o,o+1)),4):n.length-o==2&&e.put(r(n.substring(o,o+2)),7))}},r=function(e){let n=0;for(let t=0;t<e.length;t+=1)n=10*n+a(e.charAt(t));return n},a=function(e){if("0"<=e&&e<="9")return e.charCodeAt(0)-"0".charCodeAt(0);throw"illegal char :"+e};return o},Zc=function(e){const n=jc,t=e,o={getMode:function(){return n},getLength:function(e){return t.length},write:function(e){const n=t;let o=0;for(;o+1<n.length;)e.put(45*r(n.charAt(o))+r(n.charAt(o+1)),11),o+=2;o<n.length&&e.put(r(n.charAt(o)),6)}},r=function(e){if("0"<=e&&e<="9")return e.charCodeAt(0)-"0".charCodeAt(0);if("A"<=e&&e<="Z")return e.charCodeAt(0)-"A".charCodeAt(0)+10;switch(e){case" ":return 36;case"$":return 37;case"%":return 38;case"*":return 39;case"+":return 40;case"-":return 41;case".":return 42;case"/":return 43;case":":return 44;default:throw"illegal char :"+e}};return o},Jc=function(e){const n=Oc,t=Cc.stringToBytes(e),o={getMode:function(){return n},getLength:function(e){return t.length},write:function(e){for(let n=0;n<t.length;n+=1)e.put(t[n],8)}};return o},Gc=function(e){const n=Rc,t=Cc.stringToBytes;!function(){const e=t("友");if(2!=e.length||38726!=(e[0]<<8|e[1]))throw"sjis not supported."}();const o=t(e),r={getMode:function(){return n},getLength:function(e){return~~(o.length/2)},write:function(e){const n=o;let t=0;for(;t+1<n.length;){let o=(255&n[t])<<8|255&n[t+1];if(33088<=o&&o<=40956)o-=33088;else{if(!(57408<=o&&o<=60351))throw"illegal char at "+(t+1)+"/"+o;o-=49472}o=192*(o>>>8&255)+(255&o),e.put(o,13),t+=2}if(t<n.length)throw"illegal char at "+(t+1)}};return r},Hc=function(){const e=[],n={writeByte:function(n){e.push(255&n)},writeShort:function(e){n.writeByte(e),n.writeByte(e>>>8)},writeBytes:function(e,t,o){t=t||0,o=o||e.length;for(let r=0;r<o;r+=1)n.writeByte(e[r+t])},writeString:function(e){for(let t=0;t<e.length;t+=1)n.writeByte(e.charCodeAt(t))},toByteArray:function(){return e},toString:function(){let n="";n+="[";for(let t=0;t<e.length;t+=1)t>0&&(n+=","),n+=e[t];return n+="]",n}};return n},Xc=function(e){const n=e;let t=0,o=0,r=0;const a={read:function(){for(;r<8;){if(t>=n.length){if(0==r)return-1;throw"unexpected end of file./"+r}const e=n.charAt(t);if(t+=1,"="==e)return r=0,-1;e.match(/^\s$/)||(o=o<<6|i(e.charCodeAt(0)),r+=6)}const e=o>>>r-8&255;return r-=8,e}},i=function(e){if(65<=e&&e<=90)return e-65;if(97<=e&&e<=122)return e-97+26;if(48<=e&&e<=57)return e-48+52;if(43==e)return 62;if(47==e)return 63;throw"c:"+e};return a},Yc=function(e,n,t){const o=function(e,n){const t=e,o=n,r=new Array(e*n),a={setPixel:function(e,n,o){r[n*t+e]=o},write:function(e){e.writeString("GIF87a"),e.writeShort(t),e.writeShort(o),e.writeByte(128),e.writeByte(0),e.writeByte(0),e.writeByte(0),e.writeByte(0),e.writeByte(0),e.writeByte(255),e.writeByte(255),e.writeByte(255),e.writeString(","),e.writeShort(0),e.writeShort(0),e.writeShort(t),e.writeShort(o),e.writeByte(0);const n=i(2);e.writeByte(2);let r=0;for(;n.length-r>255;)e.writeByte(255),e.writeBytes(n,r,255),r+=255;e.writeByte(n.length-r),e.writeBytes(n,r,n.length-r),e.writeByte(0),e.writeString(";")}},i=function(e){const n=1<<e,t=1+(1<<e);let o=e+1;const a=s();for(let r=0;r<n;r+=1)a.add(String.fromCharCode(r));a.add(String.fromCharCode(n)),a.add(String.fromCharCode(t));const i=Hc(),c=function(e){const n=e;let t=0,o=0;return{write:function(e,r){if(e>>>r!=0)throw"length over";for(;t+r>=8;)n.writeByte(255&(e<<t|o)),r-=8-t,e>>>=8-t,o=0,t=0;o|=e<<t,t+=r},flush:function(){t>0&&n.writeByte(o)}}}(i);c.write(n,o);let d=0,l=String.fromCharCode(r[d]);for(d+=1;d<r.length;){const e=String.fromCharCode(r[d]);d+=1,a.contains(l+e)?l+=e:(c.write(a.indexOf(l),o),a.size()<4095&&(a.size()==1<<o&&(o+=1),a.add(l+e)),l=e)}return c.write(a.indexOf(l),o),c.write(t,o),c.flush(),i.toByteArray()},s=function(){const e={};let n=0;const t={add:function(o){if(t.contains(o))throw"dup key:"+o;e[o]=n,n+=1},size:function(){return n},indexOf:function(n){return e[n]},contains:function(n){return void 0!==e[n]}};return t};return a}(e,n);for(let s=0;s<n;s+=1)for(let n=0;n<e;n+=1)o.setPixel(n,s,t(n,s));const r=Hc();o.write(r);const a=function(){let e=0,n=0,t=0,o="";const r={},a=function(e){o+=String.fromCharCode(i(63&e))},i=function(e){if(e<0)throw"n:"+e;if(e<26)return 65+e;if(e<52)return e-26+97;if(e<62)return e-52+48;if(62==e)return 43;if(63==e)return 47;throw"n:"+e};return r.writeByte=function(o){for(e=e<<8|255&o,n+=8,t+=1;n>=6;)a(e>>>n-6),n-=6},r.flush=function(){if(n>0&&(a(e<<6-n),e=0,n=0),t%3!=0){const e=3-t%3;for(let n=0;n<e;n+=1)o+="="}},r.toString=function(){return o},r}(),i=r.toByteArray();for(let s=0;s<i.length;s+=1)a.writeByte(i[s]);return a.flush(),"data:image/gif;base64,"+a},Qc=Cc.stringToBytes,ed=Object.freeze(Object.defineProperty({__proto__:null,default:Cc,qrcode:Cc,stringToBytes:Qc},Symbol.toStringTag,{value:"Module"}));function nd(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}const td=Object.freeze(Object.defineProperty({__proto__:null,detectBiometricType:async function(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 async function(){if("undefined"==typeof window||!window.faceapi)return;const{faceapi:e}=window;if(e.nets.tinyFaceDetector.isLoaded)return;try{await Promise.all([e.nets.tinyFaceDetector.loadFromUri("/models"),e.nets.faceLandmark68Net.loadFromUri("/models")])}catch(n){}}();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){nd(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}},Symbol.toStringTag,{value:"Module"}));e.BiometricRegistrationModal=Ui,e.BiometricStatusOverlay=class{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;">${gi}</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)}}},e.CameraOvalGuide=Is,e.ConsentModal=ns,e.DEFAULT_CONSENT_INFO=os,e.DocumentCaptureModal=Ec,e.ENVIRONMENT_URLS=ga,e.EmailPasswordModal=Fs,e.ErrorType=f,e.FaceCaptureModal=mi,e.FallbackPrompt=As,e.ForgotPasswordModal=Ni,e.NeoFaceError=h,e.RELEASE_DATE="2026-09-23",e.VERSION=Wi,e.authorize=async function(e){if(!(await ts({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(yc,{...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 ts({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=Rs({stream:n,faceState:"centered",instruction:rc[0]}),c=document.createElement("canvas");c.width=i.videoWidth,c.height=i.videoHeight;const d=c.getContext("2d");if(!d)throw s.close(),n.getTracks().forEach((e=>e.stop())),new h("Failed to get canvas context",f.CAPTURE_ERROR);for(let e=0;e<4;e++){const o=rc[e];s.update(n,"centered",o),(null==t?void 0:t.onProgress)&&t.onProgress(e+1,4,o);if(3===e){if(!(await oc(i,5e3)))throw s.close(),n.getTracks().forEach((e=>e.stop())),r.length=0,new h("Polegar para cima não detectado dentro do tempo limite.",f.GESTURE_NOT_DETECTED)}else e>0&&await new Promise((e=>setTimeout(e,a)));d.drawImage(i,0,0,c.width,c.height);const l=await new Promise(((e,n)=>{c.toBlob((t=>{t?e(t):n(new Error("Failed to capture photo"))}),"image/jpeg",.9)}));r.push(l),(null==t?void 0:t.onPhotoTaken)&&t.onPhotoTaken(e+1,l)}s.close(),n.getTracks().forEach((e=>e.stop()));const l=r[3],u={cpf:o,email:"",sessionId:`auth_${Date.now()}_${Math.random().toString(36).substring(7)}`},p=await qa(l,e,"AUTHORIZATION",.8,void 0,u);if(!p.success)throw r.length=0,new h("Authorization failed: Person not recognized",f.RECOGNITION_FAILED);return r.length=0,{success:!0,authorizationHash:u.sessionId,name:p.personName,birthDate:void 0,cpf:p.cpf||o,confidenceScore:p.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.awaitPushApproval=function(e){return new Promise((n=>{const r=document.createElement("div");r.id="neofaceid-push-approval-container",document.body.appendChild(r);const a=t.createRoot(r);a.render(o.jsx(ys,{...e,onSettle:e=>{a.unmount(),document.body.contains(r)&&document.body.removeChild(r),n(e)}}))}))},e.captureFaceFrames=async function(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);try{const{captureFaceSilently:e}=await Promise.resolve().then((()=>Bs)),o=[];for(let r=0;r<n;r+=1)o.push(await e()),t&&r<n-1&&await new Promise((e=>{setTimeout(e,300)}));return o}catch(o){if(o instanceof h)throw o;throw new h(`Failed to capture face frames: ${o instanceof Error?o.message:"Unknown error"}`,f.CAPTURE_ERROR)}},e.checkUserExistence=Wa,e.clearConsentTrail=function(){try{"undefined"!=typeof window&&window.localStorage&&window.localStorage.removeItem(Ki)}catch{}},e.completeOnboarding=Pa,e.completeOnboardingWithData=$a,e.confirmPasswordReset=ii,e.consumeSseStream=ds,e.getAccent=function(){return xa.accent},e.getAppName=Ea,e.getApplicationToken=ka,e.getAutoFallback=_a,e.getBaseUrl=ya,e.getCachedCaptureSession=function(){return Ks},e.getConfig=function(){return{...xa}},e.getConsent=Ta,e.getConsentTrail=Vi,e.getEnvironment=function(){return xa.environment},e.getLocale=Na,e.getRadius=function(){return xa.radius},e.getResolvedThemeMode=function(){var e;return(null==(e=xa.resolvedTheme)?void 0:e.mode)??("dark"===xa.theme?"dark":"light")},e.getTheme=function(){return xa.theme},e.identifyPerson=Ga,e.identifyPersonAsync=ri,e.init=function(e={}){const{environment:n,baseUrl:t,applicationToken:o,appName:r,accent:a,radius:i,theme:c,locale:d,consent:l,autoFallback:u}=e;if(u&&(xa.autoFallback={toPhone:u.toPhone??va.toPhone,toPassword:u.toPassword??va.toPassword}),l?xa.consent=l:(xa.consent={...ma},ba||(ba=!0)),t)xa.baseUrl=t,xa.environment="custom";else if(n)ga[n]?(xa.baseUrl=ga[n],xa.environment=n):(xa.baseUrl=ga.sandbox,xa.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==ha?void 0:ha.VITE_API_BASE_URL);e&&(xa.baseUrl=e,xa.environment="custom")}o&&(xa.applicationToken=o),r&&r.trim()&&(xa.appName=r.trim()),void 0!==i&&(wa.includes(i)?xa.radius=i:xa.radius=16),c&&(xa.theme=c),d&&(xa.locale=d),void 0!==a&&(xa.accent=a);const p=Xr({accent:xa.accent??void 0,radius:xa.radius,theme:xa.theme});xa.resolvedTheme=p,pa({accent:xa.accent??void 0,radius:xa.radius,theme:xa.theme}),xa.initialized=!0},e.isInitialized=function(){return xa.initialized},e.loginWithBiometric=La,e.loginWithEmail=Va,e.openCaptureSession=Zs,e.preloadFaceDetectionModels=Ds,e.proofOfLife=async function(e={}){const{videoDurationMs:n=3e3,maxPollingAttempts:t=60,pollingIntervalMs:o=1e3,onRecordingProgress:r,onTaskStatusChange:a}=e,i=e.applicationToken??ka();if(!i)throw new h("proofOfLife exige applicationToken — passe nas opções ou em init({ applicationToken }).",f.INVALID_TOKEN);try{const e=await Ya({durationMs:n,onProgress:r}),s=await ni(e),c=await ei(s,i);a&&a("processing",0);const d=await Qa(c.taskId,i,{maxAttempts:t,intervalMs:o,onStatusChange:a}),l={isLive:(null==d?void 0:d.is_live)||!1,livenessScore:(null==d?void 0:d.liveness_score)||0,faceRecognitionScore:(null==d?void 0:d.face_recognition_score)||0,combinedConfidence:(null==d?void 0:d.combined_confidence)||0,personId:null==d?void 0:d.person_id,personalData:(null==d?void 0:d.personal_data)||[],processingTime:(null==d?void 0:d.processing_time)||0,historyId:c.historyId,taskId:c.taskId};return d&&d.success?{...l,success:!0,message:"Proof of life verification successful"}:{...l,success:!1,error:(null==d?void 0:d.error)||"Verification failed",message:(null==d?void 0:d.message)||"Proof of life verification failed"}}catch(s){if(s instanceof h)throw s;throw new h(`Proof of life failed: ${s instanceof Error?s.message:"Unknown error"}`,f.RECOGNITION_FAILED)}},e.recognize=Da,e.recognizeBiometric=Ma,e.recognizeByPurpose=qa,e.recordConsent=Zi,e.refreshSession=Ja,e.registerApplication=Xa,e.registerBiometric=Ha,e.registerDocumentByImage=async function(e,n,t={}){const{DocumentCaptureModal:o}=await Promise.resolve().then((()=>Nc)),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),ti(e,n,i)},e.registerPersonWithBiometric=Ka,e.registerPersonWithoutFace=Ua,e.requestConsent=ts,e.requestDeviceEnrollmentToken=Za,e.requestLivenessChallenge=Js,e.requestLivenessChallengeWithSession=async function({applicationToken:e,purpose:n,sessionId:t}){let o=t??(await Zs({applicationToken:e,purpose:n})).session_id;try{return await Js({sessionId:o,applicationToken:e})}catch(r){if(r instanceof h&&r.message.includes("410"))return Vs(),o=(await Zs({applicationToken:e,purpose:n})).session_id,Js({sessionId:o,applicationToken:e});throw r}},e.requestPasswordReset=ai,e.resetCaptureSession=Vs,e.runLivenessChallenge=Gs,e.simpleIdentification=Ba,e.start=function(e,o,r){ts({appName:null==r?void 0:r.appName,flow:"verification"}).then((a=>{if(!a)return void o.onError(new h(Tc,f.CONSENT_DENIED));const i=document.createElement("div");i.id="neoface-modal-container",document.body.appendChild(i);const s=()=>{document.body.contains(i)&&document.body.removeChild(i)};za(e).then((()=>{const a=n.createElement(mi,{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(e instanceof h?e:new h(e.message||"Failed to validate token",f.INVALID_TOKEN))}))}))},e.startAutoLogin=async function(e){if(await ts({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 La(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 Us(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(Ws,f.CONSENT_DENIED))},e.startBiometricRegistration=function(e,o,r,a){ts({appName:null==a?void 0:a.appName,flow:"registration"}).then((i=>{if(!i)return void r.onError(new h(Tc,f.CONSENT_DENIED));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)};za(o).then((()=>{const i=n.createElement(Ui,{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(new h(e,f.UNKNOWN))},onCannotGesture:null==a?void 0:a.onCannotGesture});c=t.createRoot(s),c.render(i)})).catch((e=>{d(),r.onError(e instanceof h?e:new h(e.message||"Failed to validate token",f.INVALID_TOKEN))}))}))},e.startDeviceEnrollment=function(e){return new Promise(((n,r)=>{const a=document.createElement("div");a.id="neofaceid-device-enrollment-container",document.body.appendChild(a);const i=t.createRoot(a);let s=0;const c=()=>{i.unmount(),document.body.contains(a)&&document.body.removeChild(a)},d=()=>{i.render(o.jsx(Os,{...e,attempt:s,onSettle:e=>{c(),n(e)},onRetry:()=>{s+=1,d()},onFatal:e=>{c(),r(e)}}))};d()}))},e.startDocumentCapture=_c,e.startFaceLogin=async function(e){if(await ts({appName:e.appName,flow:"verification"}))try{await Ms({applicationToken:e.applicationToken,onSuccess:e.onSuccess,onError:e.onError,onFallbackRequest:e.onFallbackRequest||(()=>function(e){if(!_a().toPassword)return void e.onError(new h("Biometria não reconhecida e a queda automática para senha está desligada.",f.LOGIN_FAILED));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 Fs(n).open()}(e)),onCancel:e.onCancel})}catch(n){e.onError(new h(`Erro ao inicializar login facial: ${n.message}`,f.INITIALIZATION_ERROR))}else e.onError(new h(Ws,f.CONSENT_DENIED))},e.startHandLogin=async function(e){if(await ts({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 La(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 Us(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(Ws,f.CONSENT_DENIED))},e.startLivenessCapture=function(e,o,r){ts({appName:null==r?void 0:r.appName,flow:"verification"}).then((a=>{if(!a)return void o.onError(new h(Tc,f.CONSENT_DENIED));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()};za(e).then((()=>{const a=n.createElement(Ui,{applicationToken:e,onClose:l,onPhotosCaptured:e=>{s=!0,o.onSuccess(e)},onError:e=>{d(),o.onError(new h(e,f.UNKNOWN))},onCannotGesture:null==r?void 0:r.onCannotGesture});c=t.createRoot(i),c.render(a)})).catch((e=>{d(),o.onError(e instanceof h?e:new h(e.message||"Failed to validate token",f.INVALID_TOKEN))}))}))},e.startOnboarding=async e=>{const{applicationToken:n,onboardingToken:t,countdown:o,title:r,subtitle:a,onSuccess:i,onError:s}=e;try{if(!(await ts({appName:e.appName,flow:"registration"})))return void s(new h("Consentimento recusado pelo usuário.",f.CONSENT_DENIED));const c=await Aa(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 Hs({countdown:o,title:r,subtitle:a}),{face:l,document:u}=await d.open();i({...await Pa(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=`${ya()}/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=Fa,e.validateToken=za,e.withCaptureSession=async function(e,n){const t=Ks??await Zs(e);try{return await n(t.session_id)}catch(o){if(o instanceof h&&o.message.includes("410")){Vs();return n((await Zs(e)).session_id)}throw o}},e.withSessionId=function(e){const n=Ks;return n?{...e,session_id:n.session_id}:e},Object.defineProperty(e,Symbol.toStringTag,{value:"Module"})}));
|