@neofaceid/web-sdk 1.37.0 → 1.38.2
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 +2 -2
- package/dist/neoface-id-sdk.es.js +11 -11
- package/dist/neoface-id-sdk.umd.js +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports,require("react"),require("react-dom/client"),require("react/jsx-runtime"),require("face-api.js")):"function"==typeof define&&define.amd?define(["exports","react","react-dom/client","react/jsx-runtime","face-api.js"],n):n((e="undefined"!=typeof globalThis?globalThis:e||self).NeoFaceIdSdk={},e.React,e.ReactDOM,e.jsxRuntime,e.faceapi)}(this,(function(e,n,t,o,a){"use strict";var r=Object.defineProperty,i=(e,n,t)=>((e,n,t)=>n in e?r(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(a);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),a=n.useRef(!1);return{startCamera:n.useCallback((async n=>{const t=e.current;if(t)return t.getStream();if(a.current){await new Promise((e=>setTimeout(e,100)));const n=e.current;if(n)return n.getStream()}a.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}})(),r=await navigator.mediaDevices.getUserMedia(t),i=new u(r);return e.current=i,o(!0),a.current=!1,r}catch(r){if(a.current=!1,r instanceof Error){if("NotAllowedError"===r.name||"PermissionDeniedError"===r.name)throw new l("Permissão para acessar a câmera foi negada pelo usuário");if("NotFoundError"===r.name||"DevicesNotFoundError"===r.name)throw new Error("Nenhuma câmera foi encontrada no dispositivo");if("NotReadableError"===r.name||"TrackStartError"===r.name)throw new Error("A câmera já está sendo usada por outro aplicativo");if("OverconstrainedError"===r.name||"ConstraintNotSatisfiedError"===r.name)throw new Error("As configurações solicitadas não são suportadas pela câmera")}throw new Error(`Erro ao inicializar câmera: ${r instanceof Error?r.message:String(r)}`)}}),[]),stopCamera:n.useCallback((n=>{const t=e.current;t&&t.getStream()===n&&(t.stop(),e.current=null,o(!1),a.current=!1)}),[]),cleanup:n.useCallback((()=>{e.current&&(e.current.stop(),e.current=null,o(!1),a.current=!1)}),[]),isActive:t}};var f=(e=>(e.NETWORK="NetworkError",e.NETWORK_ERROR="NetworkError",e.INVALID_TOKEN="InvalidTokenError",e.RECOGNITION_FAILED="RecognitionFailedError",e.LOGIN_FAILED="LoginFailedError",e.VALIDATION_ERROR="ValidationError",e.API_ERROR="ApiError",e.PERSON_NOT_FOUND="PersonNotFoundError",e.INITIALIZATION_ERROR="InitializationError",e.CAMERA_ERROR="CameraError",e.NO_CAMERA="NoCameraError",e.CAPTURE_ERROR="CaptureError",e.NOT_FOUND="NotFoundError",e.UNKNOWN="UnknownError",e.CONSENT_DENIED="ConsentDeniedError",e))(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"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 a=i.prototype,r=Object.keys(a);for(let e=0;e<r.length;e++){const n=r[e];n in t||(t[n]=a[n].bind(t))}}const a=(null==t?void 0:t.Parent)??Object;class r extends a{}function i(e){var n;const a=(null==t?void 0:t.Parent)?new r:this;o(a,e),(n=a._zod).deferred??(n.deferred=[]);for(const t of a._zod.deferred)t();return a}return Object.defineProperty(r,"name",{value:e}),Object.defineProperty(i,"init",{value:o}),Object.defineProperty(i,Symbol.hasInstance,{value:n=>{var o,a;return!!((null==t?void 0:t.Parent)&&n instanceof t.Parent)||(null==(a=null==(o=null==n?void 0:n._zod)?void 0:o.traits)?void 0:a.has(e))}}),Object.defineProperty(i,"name",{value:e}),i}class g extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class v extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name="ZodEncodeError"}}const b={};function w(e){return b}function y(e){const n=Object.values(e).filter((e=>"number"==typeof e));return Object.entries(e).filter((([e,t])=>-1===n.indexOf(+e))).map((([e,n])=>n))}function x(e,n){return"bigint"==typeof n?n.toString():n}function k(e){return{get value(){{const n=e();return Object.defineProperty(this,"value",{value:n}),n}}}}function E(e){return null==e}function _(e){const n=e.startsWith("^")?1:0,t=e.endsWith("$")?e.length-1:e.length;return e.slice(n,t)}const R=Symbol("evaluating");function N(e,n,t){let o;Object.defineProperty(e,n,{get(){if(o!==R)return void 0===o&&(o=R,o=t()),o},set(t){Object.defineProperty(e,n,{value:t})},configurable:!0})}function T(e,n,t){Object.defineProperty(e,n,{value:t,writable:!0,enumerable:!0,configurable:!0})}function O(...e){const n={};for(const t of e){const e=Object.getOwnPropertyDescriptors(t);Object.assign(n,e)}return Object.defineProperties({},n)}function I(e){return JSON.stringify(e)}const S="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function C(e){return"object"==typeof e&&null!==e&&!Array.isArray(e)}const z=k((()=>{var e;if("undefined"!=typeof navigator&&(null==(e=null==navigator?void 0:navigator.userAgent)?void 0:e.includes("Cloudflare")))return!1;try{return new Function(""),!0}catch(n){return!1}}));function j(e){if(!1===C(e))return!1;const n=e.constructor;if(void 0===n)return!0;if("function"!=typeof n)return!0;const t=n.prototype;return!1!==C(t)&&!1!==Object.prototype.hasOwnProperty.call(t,"isPrototypeOf")}function A(e){return j(e)?{...e}:Array.isArray(e)?[...e]:e}const F=new Set(["string","number","symbol"]);function 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 q(e,n){return n.map((n=>{var t;return(t=n).path??(t.path=[]),n.path.unshift(e),n}))}function U(e){return"string"==typeof e?e:null==e?void 0:e.message}function B(e,n,t){var o,a,r,i,s,c;const d={...e,path:e.path??[]};if(!e.message){const l=U(null==(r=null==(a=null==(o=e.inst)?void 0:o._zod.def)?void 0:a.error)?void 0:r.call(a,e))??U(null==(i=null==n?void 0:n.error)?void 0:i.call(n,e))??U(null==(s=t.customError)?void 0:s.call(t,e))??U(null==(c=t.localeError)?void 0:c.call(t,e))??"Invalid input";d.message=l}return delete d.inst,delete d.continue,(null==n?void 0:n.reportInput)||delete d.input,d}function W(e){return Array.isArray(e)?"array":"string"==typeof e?"string":"unknown"}function V(...e){const[n,t,o]=e;return"string"==typeof n?{message:n,code:"custom",input:t,inst:o}:{...n}}const Z=(e,n)=>{e.name="$ZodError",Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:n,enumerable:!1}),e.message=JSON.stringify(n,x,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},K=m("$ZodError",Z),J=m("$ZodError",Z,{Parent:Error});const G=e=>(n,t,o,a)=>{const r=o?Object.assign(o,{async:!1}):{async:!1},i=n._zod.run({value:t,issues:[]},r);if(i instanceof Promise)throw new g;if(i.issues.length){const n=new((null==a?void 0:a.Err)??e)(i.issues.map((e=>B(e,r,w()))));throw S(n,null==a?void 0:a.callee),n}return i.value},H=e=>async(n,t,o,a)=>{const r=o?Object.assign(o,{async:!0}):{async:!0};let i=n._zod.run({value:t,issues:[]},r);if(i instanceof Promise&&(i=await i),i.issues.length){const n=new((null==a?void 0:a.Err)??e)(i.issues.map((e=>B(e,r,w()))));throw S(n,null==a?void 0:a.callee),n}return i.value},X=e=>(n,t,o)=>{const a=o?{...o,async:!1}:{async:!1},r=n._zod.run({value:t,issues:[]},a);if(r instanceof Promise)throw new g;return r.issues.length?{success:!1,error:new(e??K)(r.issues.map((e=>B(e,a,w()))))}:{success:!0,data:r.value}},Y=X(J),Q=e=>async(n,t,o)=>{const a=o?Object.assign(o,{async:!0}):{async:!0};let r=n._zod.run({value:t,issues:[]},a);return r instanceof Promise&&(r=await r),r.issues.length?{success:!1,error:new e(r.issues.map((e=>B(e,a,w()))))}:{success:!0,data:r.value}},ee=Q(J),ne=e=>(n,t,o)=>{const a=o?Object.assign(o,{direction:"backward"}):{direction:"backward"};return G(e)(n,t,a)},te=e=>(n,t,o)=>G(e)(n,t,o),oe=e=>async(n,t,o)=>{const a=o?Object.assign(o,{direction:"backward"}):{direction:"backward"};return H(e)(n,t,a)},ae=e=>async(n,t,o)=>H(e)(n,t,o),re=e=>(n,t,o)=>{const a=o?Object.assign(o,{direction:"backward"}):{direction:"backward"};return X(e)(n,t,a)},ie=e=>(n,t,o)=>X(e)(n,t,o),se=e=>async(n,t,o)=>{const a=o?Object.assign(o,{direction:"backward"}):{direction:"backward"};return Q(e)(n,t,a)},ce=e=>async(n,t,o)=>Q(e)(n,t,o),de=/^[cC][^\s-]{8,}$/,le=/^[0-9a-z]+$/,ue=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,pe=/^[0-9a-vA-V]{20}$/,fe=/^[A-Za-z0-9]{27}$/,he=/^[a-zA-Z0-9_-]{21}$/,me=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,ge=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,ve=e=>e?new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,be=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/;const we=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,ye=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,xe=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,ke=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,Ee=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,_e=/^[A-Za-z0-9_-]*$/,Re=/^\+[1-9]\d{6,14}$/,Ne="(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))",Te=new RegExp(`^${Ne}$`);function Oe(e){const n="(?:[01]\\d|2[0-3]):[0-5]\\d";return"number"==typeof e.precision?-1===e.precision?`${n}`:0===e.precision?`${n}:[0-5]\\d`:`${n}:[0-5]\\d\\.\\d{${e.precision}}`:`${n}(?::[0-5]\\d(?:\\.\\d+)?)?`}const Ie=/^-?\d+$/,Se=/^-?\d+(?:\.\d+)?$/,Ce=/^(?:true|false)$/i,ze=/^[^A-Z]*$/,je=/^[^a-z]*$/,Ae=m("$ZodCheck",((e,n)=>{var t;e._zod??(e._zod={}),e._zod.def=n,(t=e._zod).onattach??(t.onattach=[])})),Fe={number:"number",bigint:"bigint",object:"date"},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 a=(o.split(".")[1]||"").length;if(0===a&&/\d?e-\d?/.test(o)){const e=o.match(/\d?e-(\d?)/);(null==e?void 0:e[1])&&(a=Number.parseInt(e[1]))}const r=t>a?t:a;return Number.parseInt(e.toFixed(r).replace(".",""))%Number.parseInt(n.toFixed(r).replace(".",""))/10**r}(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"),a=o?"int":"number",[r,i]=L[n.format];e._zod.onattach.push((e=>{const t=e._zod.bag;t.format=n.format,t.minimum=r,t.maximum=i,o&&(t.pattern=Ie)})),e._zod.check=t=>{const s=t.value;if(o){if(!Number.isInteger(s))return void t.issues.push({expected:a,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:a,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:a,inclusive:!0,continue:!n.abort}))}s<r&&t.issues.push({origin:"number",input:s,code:"too_small",minimum:r,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 a=W(o);t.issues.push({origin:a,code:"too_big",maximum:n.maximum,inclusive:!0,input:o,inst:e,continue:!n.abort})}})),qe=m("$ZodCheckMinLength",((e,n)=>{var t;Ae.init(e,n),(t=e._zod.def).when??(t.when=e=>{const n=e.value;return!E(n)&&void 0!==n.length}),e._zod.onattach.push((e=>{const t=e._zod.bag.minimum??Number.NEGATIVE_INFINITY;n.minimum>t&&(e._zod.bag.minimum=n.minimum)})),e._zod.check=t=>{const o=t.value;if(o.length>=n.minimum)return;const a=W(o);t.issues.push({origin:a,code:"too_small",minimum:n.minimum,inclusive:!0,input:o,inst:e,continue:!n.abort})}})),Ue=m("$ZodCheckLengthEquals",((e,n)=>{var t;Ae.init(e,n),(t=e._zod.def).when??(t.when=e=>{const n=e.value;return!E(n)&&void 0!==n.length}),e._zod.onattach.push((e=>{const t=e._zod.bag;t.minimum=n.length,t.maximum=n.length,t.length=n.length})),e._zod.check=t=>{const o=t.value,a=o.length;if(a===n.length)return;const r=W(o),i=a>n.length;t.issues.push({origin:r,...i?{code:"too_big",maximum:n.length}:{code:"too_small",minimum:n.length},inclusive:!0,exact:!0,input:t.value,inst:e,continue:!n.abort})}})),Be=m("$ZodCheckStringFormat",((e,n)=>{var t,o;Ae.init(e,n),e._zod.onattach.push((e=>{const t=e._zod.bag;t.format=n.format,n.pattern&&(t.patterns??(t.patterns=new Set),t.patterns.add(n.pattern))})),n.pattern?(t=e._zod).check??(t.check=t=>{n.pattern.lastIndex=0,n.pattern.test(t.value)||t.issues.push({origin:"string",code:"invalid_format",format:n.format,input:t.value,...n.pattern?{pattern:n.pattern.toString()}:{},inst:e,continue:!n.abort})}):(o=e._zod).check??(o.check=()=>{})})),We=m("$ZodCheckRegex",((e,n)=>{Be.init(e,n),e._zod.check=t=>{n.pattern.lastIndex=0,n.pattern.test(t.value)||t.issues.push({origin:"string",code:"invalid_format",format:"regex",input:t.value,pattern:n.pattern.toString(),inst:e,continue:!n.abort})}})),Ve=m("$ZodCheckLowerCase",((e,n)=>{n.pattern??(n.pattern=ze),Be.init(e,n)})),Ze=m("$ZodCheckUpperCase",((e,n)=>{n.pattern??(n.pattern=je),Be.init(e,n)})),Ke=m("$ZodCheckIncludes",((e,n)=>{Ae.init(e,n);const t=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 a of o)this.content.push(a)}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 a=[...e._zod.def.checks??[]];e._zod.traits.has("$ZodCheck")&&a.unshift(e);for(const r of a)for(const n of r._zod.onattach)n(e);if(0===a.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,a=M(e);for(const r of n){if(r._zod.def.when){if(!r._zod.def.when(e))continue}else if(a)continue;const n=e.issues.length,i=r._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&&(a||(a=M(e,n)))}));else{if(e.issues.length===n)continue;a||(a=M(e,n))}}return o?o.then((()=>e)):e},t=(t,o,r)=>{if(M(t))return t.aborted=!0,t;const i=n(o,a,r);if(i instanceof Promise){if(!1===r.async)throw new g;return i.then((n=>e._zod.parse(n,r)))}return e._zod.parse(i,r)};e._zod.run=(o,r)=>{if(r.skipChecks)return e._zod.parse(o,r);if("backward"===r.direction){const n=e._zod.parse({value:o.value,issues:[]},{...r,skipChecks:!0});return n instanceof Promise?n.then((e=>t(e,o,r))):t(n,o,r)}const i=e._zod.parse(o,r);if(i instanceof Promise){if(!1===r.async)throw new g;return i.then((e=>n(e,a,r)))}return n(i,a,r)}}N(e,"~standard",(()=>({validate:n=>{var t;try{const o=Y(e,n);return o.success?{value:o.data}:{issues:null==(t=o.error)?void 0:t.issues}}catch(o){return ee(e,n).then((e=>{var n;return e.success?{value:e.data}:{issues:null==(n=e.error)?void 0:n.issues}}))}},vendor:"zod",version:1})))})),en=m("$ZodString",((e,n)=>{var t;Qe.init(e,n),e._zod.pattern=[...(null==(t=null==e?void 0:e._zod.bag)?void 0:t.patterns)??[]].pop()??(e=>{const n=e?`[\\s\\S]{${(null==e?void 0:e.minimum)??0},${(null==e?void 0:e.maximum)??""}}`:"[\\s\\S]*";return new RegExp(`^${n}$`)})(e._zod.bag),e._zod.parse=(t,o)=>{if(n.coerce)try{t.value=String(t.value)}catch(a){}return"string"==typeof t.value||t.issues.push({expected:"string",code:"invalid_type",input:t.value,inst:e}),t}})),nn=m("$ZodStringFormat",((e,n)=>{Be.init(e,n),en.init(e,n)})),tn=m("$ZodGUID",((e,n)=>{n.pattern??(n.pattern=ge),nn.init(e,n)})),on=m("$ZodUUID",((e,n)=>{if(n.version){const e={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[n.version];if(void 0===e)throw new Error(`Invalid UUID version: "${n.version}"`);n.pattern??(n.pattern=ve(e))}else n.pattern??(n.pattern=ve());nn.init(e,n)})),an=m("$ZodEmail",((e,n)=>{n.pattern??(n.pattern=be),nn.init(e,n)})),rn=m("$ZodURL",((e,n)=>{nn.init(e,n),e._zod.check=t=>{try{const o=t.value.trim(),a=new URL(o);return n.hostname&&(n.hostname.lastIndex=0,n.hostname.test(a.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(a.protocol.endsWith(":")?a.protocol.slice(0,-1):a.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=a.href:t.value=o)}catch(o){t.issues.push({code:"invalid_format",format:"url",input:t.value,inst:e,continue:!n.abort})}}})),sn=m("$ZodEmoji",((e,n)=>{n.pattern??(n.pattern=new RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),nn.init(e,n)})),cn=m("$ZodNanoID",((e,n)=>{n.pattern??(n.pattern=he),nn.init(e,n)})),dn=m("$ZodCUID",((e,n)=>{n.pattern??(n.pattern=de),nn.init(e,n)})),ln=m("$ZodCUID2",((e,n)=>{n.pattern??(n.pattern=le),nn.init(e,n)})),un=m("$ZodULID",((e,n)=>{n.pattern??(n.pattern=ue),nn.init(e,n)})),pn=m("$ZodXID",((e,n)=>{n.pattern??(n.pattern=pe),nn.init(e,n)})),fn=m("$ZodKSUID",((e,n)=>{n.pattern??(n.pattern=fe),nn.init(e,n)})),hn=m("$ZodISODateTime",((e,n)=>{n.pattern??(n.pattern=function(e){const n=Oe({precision:e.precision}),t=["Z"];e.local&&t.push(""),e.offset&&t.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");const o=`${n}(?:${t.join("|")})`;return new RegExp(`^${Ne}T(?:${o})$`)}(n)),nn.init(e,n)})),mn=m("$ZodISODate",((e,n)=>{n.pattern??(n.pattern=Te),nn.init(e,n)})),gn=m("$ZodISOTime",((e,n)=>{n.pattern??(n.pattern=new RegExp(`^${Oe(n)}$`)),nn.init(e,n)})),vn=m("$ZodISODuration",((e,n)=>{n.pattern??(n.pattern=me),nn.init(e,n)})),bn=m("$ZodIPv4",((e,n)=>{n.pattern??(n.pattern=we),nn.init(e,n),e._zod.bag.format="ipv4"})),wn=m("$ZodIPv6",((e,n)=>{n.pattern??(n.pattern=ye),nn.init(e,n),e._zod.bag.format="ipv6",e._zod.check=t=>{try{new URL(`http://[${t.value}]`)}catch{t.issues.push({code:"invalid_format",format:"ipv6",input:t.value,inst:e,continue:!n.abort})}}})),yn=m("$ZodCIDRv4",((e,n)=>{n.pattern??(n.pattern=xe),nn.init(e,n)})),xn=m("$ZodCIDRv6",((e,n)=>{n.pattern??(n.pattern=ke),nn.init(e,n),e._zod.check=t=>{const o=t.value.split("/");try{if(2!==o.length)throw new Error;const[e,n]=o;if(!n)throw new Error;const t=Number(n);if(`${t}`!==n)throw new Error;if(t<0||t>128)throw new Error;new URL(`http://[${e}]`)}catch{t.issues.push({code:"invalid_format",format:"cidrv6",input:t.value,inst:e,continue:!n.abort})}}}));function kn(e){if(""===e)return!0;if(e.length%4!=0)return!1;try{return atob(e),!0}catch{return!1}}const En=m("$ZodBase64",((e,n)=>{n.pattern??(n.pattern=Ee),nn.init(e,n),e._zod.bag.contentEncoding="base64",e._zod.check=t=>{kn(t.value)||t.issues.push({code:"invalid_format",format:"base64",input:t.value,inst:e,continue:!n.abort})}}));const _n=m("$ZodBase64URL",((e,n)=>{n.pattern??(n.pattern=_e),nn.init(e,n),e._zod.bag.contentEncoding="base64url",e._zod.check=t=>{(function(e){if(!_e.test(e))return!1;const n=e.replace(/[-_]/g,(e=>"-"===e?"+":"/"));return kn(n.padEnd(4*Math.ceil(n.length/4),"="))})(t.value)||t.issues.push({code:"invalid_format",format:"base64url",input:t.value,inst:e,continue:!n.abort})}})),Rn=m("$ZodE164",((e,n)=>{n.pattern??(n.pattern=Re),nn.init(e,n)}));const Nn=m("$ZodJWT",((e,n)=>{nn.init(e,n),e._zod.check=t=>{(function(e,n=null){try{const t=e.split(".");if(3!==t.length)return!1;const[o]=t;if(!o)return!1;const a=JSON.parse(atob(o));return!("typ"in a&&"JWT"!==(null==a?void 0:a.typ)||!a.alg||n&&(!("alg"in a)||a.alg!==n))}catch{return!1}})(t.value,n.alg)||t.issues.push({code:"invalid_format",format:"jwt",input:t.value,inst:e,continue:!n.abort})}})),Tn=m("$ZodNumber",((e,n)=>{Qe.init(e,n),e._zod.pattern=e._zod.bag.pattern??Se,e._zod.parse=(t,o)=>{if(n.coerce)try{t.value=Number(t.value)}catch(i){}const a=t.value;if("number"==typeof a&&!Number.isNaN(a)&&Number.isFinite(a))return t;const r="number"==typeof a?Number.isNaN(a)?"NaN":Number.isFinite(a)?void 0:"Infinity":void 0;return t.issues.push({expected:"number",code:"invalid_type",input:a,inst:e,...r?{received:r}:{}}),t}})),On=m("$ZodNumberFormat",((e,n)=>{Le.init(e,n),Tn.init(e,n)})),In=m("$ZodBoolean",((e,n)=>{Qe.init(e,n),e._zod.pattern=Ce,e._zod.parse=(t,o)=>{if(n.coerce)try{t.value=Boolean(t.value)}catch(r){}const a=t.value;return"boolean"==typeof a||t.issues.push({expected:"boolean",code:"invalid_type",input:a,inst:e}),t}})),Sn=m("$ZodAny",((e,n)=>{Qe.init(e,n),e._zod.parse=e=>e})),Cn=m("$ZodUnknown",((e,n)=>{Qe.init(e,n),e._zod.parse=e=>e})),zn=m("$ZodNever",((e,n)=>{Qe.init(e,n),e._zod.parse=(n,t)=>(n.issues.push({expected:"never",code:"invalid_type",input:n.value,inst:e}),n)}));function jn(e,n,t){e.issues.length&&n.issues.push(...q(t,e.issues)),n.value[t]=e.value}const An=m("$ZodArray",((e,n)=>{Qe.init(e,n),e._zod.parse=(t,o)=>{const a=t.value;if(!Array.isArray(a))return t.issues.push({expected:"array",code:"invalid_type",input:a,inst:e}),t;t.value=Array(a.length);const r=[];for(let e=0;e<a.length;e++){const i=a[e],s=n.element._zod.run({value:i,issues:[]},o);s instanceof Promise?r.push(s.then((n=>jn(n,t,e)))):jn(s,t,e)}return r.length?Promise.all(r).then((()=>t)):t}}));function Fn(e,n,t,o,a){if(e.issues.length){if(a&&!(t in o))return;n.issues.push(...q(t,e.issues))}void 0===e.value?t in o&&(n.value[t]=void 0):n.value[t]=e.value}function Pn(e){var n,t,o,a;const r=Object.keys(e.shape);for(const c of r)if(!(null==(a=null==(o=null==(t=null==(n=e.shape)?void 0:n[c])?void 0:t._zod)?void 0:o.traits)?void 0:a.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:r,keySet:new Set(r),numKeys:r.length,optionalKeys:new Set(i)}}function $n(e,n,t,o,a,r){const i=[],s=a.keySet,c=a.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 a=c.run({value:n[u],issues:[]},o);a instanceof Promise?e.push(a.then((e=>Fn(e,t,u,n,l)))):Fn(a,t,u,n,l)}return i.length&&t.issues.push({code:"unrecognized_keys",keys:i,input:n,inst:r}),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)));N(e._zod,"propValues",(()=>{const e=n.shape,t={};for(const n in e){const o=e[n]._zod;if(o.values){t[n]??(t[n]=new Set);for(const e of o.values)t[n].add(e)}}return t}));const a=C,r=n.catchall;let i;e._zod.parse=(n,t)=>{i??(i=o.value);const s=n.value;if(!a(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],a="optional"===o._zod.optout,r=o._zod.run({value:s[e],issues:[]},t);r instanceof Promise?c.push(r.then((t=>Fn(t,n,e,s,a)))):Fn(r,n,e,s,a)}return r?$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 a;const r=C,i=!b.jitless,s=i&&z.value,c=n.catchall;let d;e._zod.parse=(l,u)=>{d??(d=o.value);const p=l.value;return r(p)?i&&s&&!1===(null==u?void 0:u.async)&&!0!==u.jitless?(a||(a=(e=>{var n;const t=new Xe(["shape","payload","ctx"]),a=o.value,r=e=>{const n=I(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 a.keys)i[o]="key_"+s++;t.write("const newResult = {};");for(const o of a.keys){const a=i[o],s=I(o),c=e[o],d="optional"===(null==(n=null==c?void 0:c._zod)?void 0:n.optout);t.write(`const ${a} = ${r(o)};`),d?t.write(`\n if (${a}.issues.length) {\n if (${s} in input) {\n payload.issues = payload.issues.concat(${a}.issues.map(iss => ({\n ...iss,\n path: iss.path ? [${s}, ...iss.path] : [${s}]\n })));\n }\n }\n \n if (${a}.value === undefined) {\n if (${s} in input) {\n newResult[${s}] = undefined;\n }\n } else {\n newResult[${s}] = ${a}.value;\n }\n \n `):t.write(`\n if (${a}.issues.length) {\n payload.issues = payload.issues.concat(${a}.issues.map(iss => ({\n ...iss,\n path: iss.path ? [${s}, ...iss.path] : [${s}]\n })));\n }\n \n if (${a}.value === undefined) {\n if (${s} in input) {\n newResult[${s}] = undefined;\n }\n } else {\n newResult[${s}] = ${a}.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=a(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 r of e)if(0===r.issues.length)return n.value=r.value,n;const a=e.filter((e=>!M(e)));return 1===a.length?(n.value=a[0].value,a[0]):(n.issues.push({code:"invalid_union",input:n.value,inst:t,errors:e.map((e=>e.issues.map((e=>B(e,o,w())))))}),n)}const qn=m("$ZodUnion",((e,n)=>{Qe.init(e,n),N(e._zod,"optin",(()=>n.options.some((e=>"optional"===e._zod.optin))?"optional":void 0)),N(e._zod,"optout",(()=>n.options.some((e=>"optional"===e._zod.optout))?"optional":void 0)),N(e._zod,"values",(()=>{if(n.options.every((e=>e._zod.values)))return new Set(n.options.flatMap((e=>Array.from(e._zod.values))))})),N(e._zod,"pattern",(()=>{if(n.options.every((e=>e._zod.pattern))){const e=n.options.map((e=>e._zod.pattern));return new RegExp(`^(${e.map((e=>_(e.source))).join("|")})$`)}}));const t=1===n.options.length,o=n.options[0]._zod.run;e._zod.parse=(a,r)=>{if(t)return o(a,r);let i=!1;const s=[];for(const e of n.options){const n=e._zod.run({value:a.value,issues:[]},r);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,a,e,r))):Mn(s,a,e,r)}})),Un=m("$ZodIntersection",((e,n)=>{Qe.init(e,n),e._zod.parse=(e,t)=>{const o=e.value,a=n.left._zod.run({value:o,issues:[]},t),r=n.right._zod.run({value:o,issues:[]},t);return a instanceof Promise||r instanceof Promise?Promise.all([a,r]).then((([n,t])=>Wn(e,n,t))):Wn(e,a,r)}}));function Bn(e,n){if(e===n)return{valid:!0,data:e};if(e instanceof Date&&n instanceof Date&&+e==+n)return{valid:!0,data:e};if(j(e)&&j(n)){const t=Object.keys(n),o=Object.keys(e).filter((e=>-1!==t.indexOf(e))),a={...e,...n};for(const r of o){const t=Bn(e[r],n[r]);if(!t.valid)return{valid:!1,mergeErrorPath:[r,...t.mergeErrorPath]};a[r]=t.data}return{valid:!0,data:a}}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 a=Bn(e[o],n[o]);if(!a.valid)return{valid:!1,mergeErrorPath:[o,...a.mergeErrorPath]};t.push(a.data)}return{valid:!0,data:t}}return{valid:!1,mergeErrorPath:[]}}function Wn(e,n,t){const o=new Map;let a;for(const s of n.issues)if("unrecognized_keys"===s.code){a??(a=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 r=[...o].filter((([,e])=>e.l&&e.r)).map((([e])=>e));if(r.length&&a&&e.issues.push({...a,keys:r}),M(e))return e;const i=Bn(n.value,t.value);if(!i.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(i.mergeErrorPath)}`);return e.value=i.data,e}const Vn=m("$ZodEnum",((e,n)=>{Qe.init(e,n);const t=y(n.entries),o=new Set(t);e._zod.values=o,e._zod.pattern=new RegExp(`^(${t.filter((e=>F.has(typeof e))).map((e=>"string"==typeof e?P(e):e.toString())).join("|")})$`),e._zod.parse=(n,a)=>{const r=n.value;return o.has(r)||n.issues.push({code:"invalid_value",values:t,input:r,inst:e}),n}})),Zn=m("$ZodTransform",((e,n)=>{Qe.init(e,n),e._zod.parse=(t,o)=>{if("backward"===o.direction)throw new v(e.constructor.name);const a=n.transform(t.value,t);if(o.async){return(a instanceof Promise?a:Promise.resolve(a)).then((e=>(t.value=e,t)))}if(a instanceof Promise)throw new g;return t.value=a,t}}));function Kn(e,n){return e.issues.length&&void 0===n?{issues:[],value:void 0}:e}const Jn=m("$ZodOptional",((e,n)=>{Qe.init(e,n),e._zod.optin="optional",e._zod.optout="optional",N(e._zod,"values",(()=>n.innerType._zod.values?new Set([...n.innerType._zod.values,void 0]):void 0)),N(e._zod,"pattern",(()=>{const e=n.innerType._zod.pattern;return e?new RegExp(`^(${_(e.source)})?$`):void 0})),e._zod.parse=(e,t)=>{if("optional"===n.innerType._zod.optin){const o=n.innerType._zod.run(e,t);return o instanceof Promise?o.then((n=>Kn(n,e.value))):Kn(o,e.value)}return void 0===e.value?e:n.innerType._zod.run(e,t)}})),Gn=m("$ZodExactOptional",((e,n)=>{Jn.init(e,n),N(e._zod,"values",(()=>n.innerType._zod.values)),N(e._zod,"pattern",(()=>n.innerType._zod.pattern)),e._zod.parse=(e,t)=>n.innerType._zod.run(e,t)})),Hn=m("$ZodNullable",((e,n)=>{Qe.init(e,n),N(e._zod,"optin",(()=>n.innerType._zod.optin)),N(e._zod,"optout",(()=>n.innerType._zod.optout)),N(e._zod,"pattern",(()=>{const e=n.innerType._zod.pattern;return e?new RegExp(`^(${_(e.source)}|null)$`):void 0})),N(e._zod,"values",(()=>n.innerType._zod.values?new Set([...n.innerType._zod.values,null]):void 0)),e._zod.parse=(e,t)=>null===e.value?e:n.innerType._zod.run(e,t)})),Xn=m("$ZodDefault",((e,n)=>{Qe.init(e,n),e._zod.optin="optional",N(e._zod,"values",(()=>n.innerType._zod.values)),e._zod.parse=(e,t)=>{if("backward"===t.direction)return n.innerType._zod.run(e,t);if(void 0===e.value)return e.value=n.defaultValue,e;const o=n.innerType._zod.run(e,t);return o instanceof Promise?o.then((e=>Yn(e,n))):Yn(o,n)}}));function Yn(e,n){return void 0===e.value&&(e.value=n.defaultValue),e}const Qn=m("$ZodPrefault",((e,n)=>{Qe.init(e,n),e._zod.optin="optional",N(e._zod,"values",(()=>n.innerType._zod.values)),e._zod.parse=(e,t)=>("backward"===t.direction||void 0===e.value&&(e.value=n.defaultValue),n.innerType._zod.run(e,t))})),et=m("$ZodNonOptional",((e,n)=>{Qe.init(e,n),N(e._zod,"values",(()=>{const e=n.innerType._zod.values;return e?new Set([...e].filter((e=>void 0!==e))):void 0})),e._zod.parse=(t,o)=>{const a=n.innerType._zod.run(t,o);return a instanceof Promise?a.then((n=>nt(n,e))):nt(a,e)}}));function nt(e,n){return e.issues.length||void 0!==e.value||e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:n}),e}const tt=m("$ZodCatch",((e,n)=>{Qe.init(e,n),N(e._zod,"optin",(()=>n.innerType._zod.optin)),N(e._zod,"optout",(()=>n.innerType._zod.optout)),N(e._zod,"values",(()=>n.innerType._zod.values)),e._zod.parse=(e,t)=>{if("backward"===t.direction)return n.innerType._zod.run(e,t);const o=n.innerType._zod.run(e,t);return o instanceof Promise?o.then((o=>(e.value=o.value,o.issues.length&&(e.value=n.catchValue({...e,error:{issues:o.issues.map((e=>B(e,t,w())))},input:e.value}),e.issues=[]),e))):(e.value=o.value,o.issues.length&&(e.value=n.catchValue({...e,error:{issues:o.issues.map((e=>B(e,t,w())))},input:e.value}),e.issues=[]),e)}})),ot=m("$ZodPipe",((e,n)=>{Qe.init(e,n),N(e._zod,"values",(()=>n.in._zod.values)),N(e._zod,"optin",(()=>n.in._zod.optin)),N(e._zod,"optout",(()=>n.out._zod.optout)),N(e._zod,"propValues",(()=>n.in._zod.propValues)),e._zod.parse=(e,t)=>{if("backward"===t.direction){const o=n.out._zod.run(e,t);return o instanceof Promise?o.then((e=>at(e,n.in,t))):at(o,n.in,t)}const o=n.in._zod.run(e,t);return o instanceof Promise?o.then((e=>at(e,n.out,t))):at(o,n.out,t)}}));function at(e,n,t){return e.issues.length?(e.aborted=!0,e):n._zod.run({value:e.value,issues:e.issues},t)}const rt=m("$ZodReadonly",((e,n)=>{Qe.init(e,n),N(e._zod,"propValues",(()=>n.innerType._zod.propValues)),N(e._zod,"values",(()=>n.innerType._zod.values)),N(e._zod,"optin",(()=>{var e,t;return null==(t=null==(e=n.innerType)?void 0:e._zod)?void 0:t.optin})),N(e._zod,"optout",(()=>{var e,t;return null==(t=null==(e=n.innerType)?void 0:e._zod)?void 0:t.optout})),e._zod.parse=(e,t)=>{if("backward"===t.direction)return n.innerType._zod.run(e,t);const o=n.innerType._zod.run(e,t);return o instanceof Promise?o.then(it):it(o)}}));function it(e){return e.value=Object.freeze(e.value),e}const st=m("$ZodCustom",((e,n)=>{Ae.init(e,n),Qe.init(e,n),e._zod.parse=(e,n)=>e,e._zod.check=t=>{const o=t.value,a=n.fn(o);if(a instanceof Promise)return a.then((n=>ct(n,t,o,e)));ct(a,t,o,e)}}));function ct(e,n,t,o){if(!e){const e={code:"custom",input:t,inst:o,path:[...o._zod.def.path??[]],continue:!o._zod.def.abort};o._zod.def.params&&(e.params=o._zod.def.params),n.issues.push(V(e))}}var dt;class lt{constructor(){this._map=new WeakMap,this._idmap=new Map}add(e,...n){const t=n[0];return this._map.set(e,t),t&&"object"==typeof t&&"id"in t&&this._idmap.set(t.id,e),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(e){const n=this._map.get(e);return n&&"object"==typeof n&&"id"in n&&this._idmap.delete(n.id),this._map.delete(e),this}get(e){const n=e._zod.parent;if(n){const t={...this.get(n)??{}};delete t.id;const o={...t,...this._map.get(e)};return Object.keys(o).length?o:void 0}return this._map.get(e)}has(e){return this._map.has(e)}}(dt=globalThis).__zod_globalRegistry??(dt.__zod_globalRegistry=new lt);const ut=globalThis.__zod_globalRegistry;function pt(e,n){return new e({type:"string",...D(n)})}function ft(e,n){return new e({type:"string",format:"email",check:"string_format",abort:!1,...D(n)})}function ht(e,n){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...D(n)})}function mt(e,n){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...D(n)})}function gt(e,n){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...D(n)})}function vt(e,n){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...D(n)})}function bt(e,n){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...D(n)})}function wt(e,n){return new e({type:"string",format:"url",check:"string_format",abort:!1,...D(n)})}function yt(e,n){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...D(n)})}function xt(e,n){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...D(n)})}function kt(e,n){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...D(n)})}function Et(e,n){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...D(n)})}function _t(e,n){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...D(n)})}function Rt(e,n){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...D(n)})}function Nt(e,n){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...D(n)})}function Tt(e,n){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...D(n)})}function Ot(e,n){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...D(n)})}function It(e,n){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...D(n)})}function St(e,n){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...D(n)})}function Ct(e,n){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...D(n)})}function zt(e,n){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...D(n)})}function jt(e,n){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...D(n)})}function At(e,n){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...D(n)})}function Ft(e,n){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...D(n)})}function 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 qt(e,n){return new e({type:"boolean",...D(n)})}function Ut(e){return new e({type:"any"})}function Bt(e){return new e({type:"unknown"})}function Wt(e,n){return new e({type:"never",...D(n)})}function Vt(e,n){return new Pe({check:"less_than",...D(n),value:e,inclusive:!1})}function Zt(e,n){return new Pe({check:"less_than",...D(n),value:e,inclusive:!0})}function Kt(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 qe({check:"min_length",...D(n),minimum:e})}function Yt(e,n){return new Ue({check:"length_equals",...D(n),length:e})}function Qt(e,n){return new We({check:"string_format",format:"regex",...D(n),pattern:e})}function eo(e){return new Ve({check:"string_format",format:"lowercase",...D(e)})}function no(e){return new Ze({check:"string_format",format:"uppercase",...D(e)})}function to(e,n){return new Ke({check:"string_format",format:"includes",...D(n),includes:e})}function oo(e,n){return new Je({check:"string_format",format:"starts_with",...D(n),prefix:e})}function ao(e,n){return new Ge({check:"string_format",format:"ends_with",...D(n),suffix:e})}function ro(e){return new He({check:"overwrite",tx:e})}function io(e){return ro((n=>n.normalize(e)))}function so(){return ro((e=>e.trim()))}function co(){return ro((e=>e.toLowerCase()))}function lo(){return ro((e=>e.toUpperCase()))}function uo(){return ro((e=>function(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}(e)))}function po(e,n,t){return new e({type:"array",element:n,...D(t)})}function fo(e,n,t){return new e({type:"custom",check:"custom",fn:n,...D(t)})}function ho(e){const n=mo((t=>(t.addIssue=e=>{if("string"==typeof e)t.issues.push(V(e,t.value,n._zod.def));else{const o=e;o.fatal&&(o.continue=!1),o.code??(o.code="custom"),o.input??(o.input=t.value),o.inst??(o.inst=n),o.continue??(o.continue=!n._zod.def.abort),t.issues.push(V(o))}},e(t.value,t))));return n}function mo(e,n){const t=new Ae({check:"custom",...D(n)});return t._zod.check=e,t}function go(e){let n=(null==e?void 0:e.target)??"draft-2020-12";return"draft-4"===n&&(n="draft-04"),"draft-7"===n&&(n="draft-07"),{processors:e.processors??{},metadataRegistry:(null==e?void 0:e.metadata)??ut,target:n,unrepresentable:(null==e?void 0:e.unrepresentable)??"throw",override:(null==e?void 0:e.override)??(()=>{}),io:(null==e?void 0:e.io)??"output",counter:0,seen:new Map,cycles:(null==e?void 0:e.cycles)??"ref",reused:(null==e?void 0:e.reused)??"inline",external:(null==e?void 0:e.external)??void 0}}function vo(e,n,t={path:[],schemaPath:[]}){var o,a,r;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==(a=(o=e._zod).toJSONSchema)?void 0:a.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,a=n.processors[i.type];if(!a)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${i.type}`);a(e,n,t,o)}const a=e._zod.parent;a&&(c.ref||(c.ref=a),vo(a,n,o),n.seen.get(a).isParent=!0)}const l=n.metadataRegistry.get(e);l&&Object.assign(c.schema,l),"input"===n.io&&yo(e)&&(delete c.schema.examples,delete c.schema.default),"input"===n.io&&c.schema._prefault&&((r=c.schema).default??(r.default=c.schema._prefault)),delete c.schema._prefault;return n.seen.get(e).schema}function bo(e,n){var t,o,a,r;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:a}=(n=>{var t;const o="draft-2020-12"===e.target?"$defs":"definitions";if(e.external){const a=null==(t=e.external.registry.get(n[0]))?void 0:t.id,r=e.external.uri??(e=>e);if(a)return{ref:r(a)};const i=n[1].defId??n[1].schema.id??"schema"+e.counter++;return n[1].defId=i,{defId:i,ref:`${r("__shared")}#/${o}/${i}`}}if(n[1]===i)return{ref:"#"};const a=`#/${o}/`,r=n[1].schema.id??"__schema"+e.counter++;return{defId:r,ref:a+r}})(n);t.def={...t.schema},a&&(t.defId=a);const r=t.schema;for(const e in r)delete r[e];r.$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==(a=e.external.registry.get(d[0]))?void 0:a.id;if(n!==d[0]&&t){c(d);continue}}(null==(r=e.metadataRegistry.get(d[0]))?void 0:r.id)?c(d):(t.cycle||t.count>1&&"ref"===e.reused)&&c(d)}}function wo(e,n){var t,o,a;const r=e.seen.get(n);if(!r)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,a={...o},r=t.ref;if(t.ref=null,r){i(r);const t=e.seen.get(r),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,a);if(n._zod.parent===r)for(const e in o)"$ref"!==e&&"allOf"!==e&&(e in a||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!==r){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,r.def??r.schema);const c=(null==(a=e.external)?void 0:a.defs)??{};for(const l of e.seen.entries()){const e=l[1];e.def&&e.defId&&(c[e.defId]=e.def)}e.external||Object.keys(c).length>0&&("draft-2020-12"===e.target?s.$defs=c:s.definitions=c);try{const t=JSON.parse(JSON.stringify(s));return Object.defineProperty(t,"~standard",{value:{...n["~standard"],jsonSchema:{input:xo(n,"input",e.processors),output:xo(n,"output",e.processors)}},enumerable:!1,writable:!1}),t}catch(d){throw new Error("Error converting schema to JSON.")}}function yo(e,n){const t=n??{seen:new Set};if(t.seen.has(e))return!1;t.seen.add(e);const o=e._zod.def;if("transform"===o.type)return!0;if("array"===o.type)return yo(o.element,t);if("set"===o.type)return yo(o.valueType,t);if("lazy"===o.type)return yo(o.getter(),t);if("promise"===o.type||"optional"===o.type||"nonoptional"===o.type||"nullable"===o.type||"readonly"===o.type||"default"===o.type||"prefault"===o.type)return yo(o.innerType,t);if("intersection"===o.type)return yo(o.left,t)||yo(o.right,t);if("record"===o.type||"map"===o.type)return yo(o.keyType,t)||yo(o.valueType,t);if("pipe"===o.type)return yo(o.in,t)||yo(o.out,t);if("object"===o.type){for(const e in o.shape)if(yo(o.shape[e],t))return!0;return!1}if("union"===o.type){for(const e of o.options)if(yo(e,t))return!0;return!1}if("tuple"===o.type){for(const e of o.items)if(yo(e,t))return!0;return!(!o.rest||!yo(o.rest,t))}return!1}const xo=(e,n,t={})=>o=>{const{libraryOptions:a,target:r}=o??{},i=go({...a??{},target:r,io:n,processors:t});return vo(e,i),bo(i,e),wo(i,e)},ko={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},Eo=(e,n,t,o)=>{const a=e._zod.def;vo(a.innerType,n,o);n.seen.get(e).ref=a.innerType},_o=m("ZodISODateTime",((e,n)=>{hn.init(e,n),Vo.init(e,n)}));const Ro=m("ZodISODate",((e,n)=>{mn.init(e,n),Vo.init(e,n)}));const No=m("ZodISOTime",((e,n)=>{gn.init(e,n),Vo.init(e,n)}));const To=m("ZodISODuration",((e,n)=>{vn.init(e,n),Vo.init(e,n)}));const Oo=m("ZodError",((e,n)=>{K.init(e,n),e.name="ZodError",Object.defineProperties(e,{format:{value:n=>function(e,n=e=>e.message){const t={_errors:[]},o=e=>{for(const a of e.issues)if("invalid_union"===a.code&&a.errors.length)a.errors.map((e=>o({issues:e})));else if("invalid_key"===a.code)o({issues:a.issues});else if("invalid_element"===a.code)o({issues:a.issues});else if(0===a.path.length)t._errors.push(n(a));else{let e=t,o=0;for(;o<a.path.length;){const t=a.path[o];o===a.path.length-1?(e[t]=e[t]||{_errors:[]},e[t]._errors.push(n(a))):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 a of e.issues)a.path.length>0?(t[a.path[0]]=t[a.path[0]]||[],t[a.path[0]].push(n(a))):o.push(n(a));return{formErrors:o,fieldErrors:t}}(e,n)},addIssue:{value:n=>{e.issues.push(n),e.message=JSON.stringify(e.issues,x,2)}},addIssues:{value:n=>{e.issues.push(...n),e.message=JSON.stringify(e.issues,x,2)}},isEmpty:{get:()=>0===e.issues.length}})}),{Parent:Error}),Io=G(Oo),So=H(Oo),Co=X(Oo),zo=Q(Oo),jo=ne(Oo),Ao=te(Oo),Fo=oe(Oo),Po=ae(Oo),$o=re(Oo),Do=ie(Oo),Lo=se(Oo),Mo=ce(Oo),qo=m("ZodType",((e,n)=>(Qe.init(e,n),Object.assign(e["~standard"],{jsonSchema:{input:xo(e,"input"),output:xo(e,"output")}}),e.toJSONSchema=((e,n={})=>t=>{const o=go({...t,processors:n});return vo(e,o),bo(o,e),wo(o,e)})(e,{}),e.def=n,e.type=n.type,Object.defineProperty(e,"_def",{value:n}),e.check=(...t)=>e.clone(O(n,{checks:[...n.checks??[],...t.map((e=>"function"==typeof e?{_zod:{check:e,def:{check:"custom"},onattach:[]}}:e))]}),{parent:!0}),e.with=e.check,e.clone=(n,t)=>$(e,n,t),e.brand=()=>e,e.register=(n,t)=>(n.add(e,t),e),e.parse=(n,t)=>Io(e,n,t,{callee:e.parse}),e.safeParse=(n,t)=>Co(e,n,t),e.parseAsync=async(n,t)=>So(e,n,t,{callee:e.parseAsync}),e.safeParseAsync=async(n,t)=>zo(e,n,t),e.spa=e.safeParseAsync,e.encode=(n,t)=>jo(e,n,t),e.decode=(n,t)=>Ao(e,n,t),e.encodeAsync=async(n,t)=>Fo(e,n,t),e.decodeAsync=async(n,t)=>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(La,e,n)}(n,t)),e.superRefine=n=>e.check(ho(n)),e.overwrite=n=>e.check(ro(n)),e.optional=()=>Oa(e),e.exactOptional=()=>new Ia({type:"optional",innerType:e}),e.nullable=()=>Ca(e),e.nullish=()=>Oa(Ca(e)),e.nonoptional=n=>function(e,n){return new Aa({type:"nonoptional",innerType:e,...D(n)})}(e,n),e.array=()=>{return po(ya,e,n);var n},e.or=n=>{return new Ea({type:"union",options:[e,n],...D(t)});var t},e.and=n=>new _a({type:"intersection",left:e,right:n}),e.transform=n=>$a(e,new Na({type:"transform",transform:n})),e.default=n=>{return t=n,new za({type:"default",innerType:e,get defaultValue(){return"function"==typeof t?t():A(t)}});var t},e.prefault=n=>{return t=n,new ja({type:"prefault",innerType:e,get defaultValue(){return"function"==typeof t?t():A(t)}});var t},e.catch=n=>{return new Fa({type:"catch",innerType:e,catchValue:"function"==typeof(t=n)?t:()=>t});var t},e.pipe=n=>$a(e,n),e.readonly=()=>new Da({type:"readonly",innerType:e}),e.describe=n=>{const t=e.clone();return ut.add(t,{description:n}),t},Object.defineProperty(e,"description",{get(){var n;return null==(n=ut.get(e))?void 0:n.description},configurable:!0}),e.meta=(...n)=>{if(0===n.length)return ut.get(e);const t=e.clone();return ut.add(t,n[0]),t},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e.apply=n=>n(e),e))),Uo=m("_ZodString",((e,n)=>{en.init(e,n),qo.init(e,n),e._zod.processJSONSchema=(n,t,o)=>((e,n,t)=>{const o=t;o.type="string";const{minimum:a,maximum:r,format:i,patterns:s,contentEncoding:c}=e._zod.bag;if("number"==typeof a&&(o.minLength=a),"number"==typeof r&&(o.maxLength=r),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(ao(...n)),e.min=(...n)=>e.check(Xt(...n)),e.max=(...n)=>e.check(Ht(...n)),e.length=(...n)=>e.check(Yt(...n)),e.nonempty=(...n)=>e.check(Xt(1,...n)),e.lowercase=n=>e.check(eo(n)),e.uppercase=n=>e.check(no(n)),e.trim=()=>e.check(so()),e.normalize=(...n)=>e.check(io(...n)),e.toLowerCase=()=>e.check(co()),e.toUpperCase=()=>e.check(lo()),e.slugify=()=>e.check(uo())})),Bo=m("ZodString",((e,n)=>{en.init(e,n),Uo.init(e,n),e.email=n=>e.check(ft(Zo,n)),e.url=n=>e.check(wt(Go,n)),e.jwt=n=>e.check(At(la,n)),e.emoji=n=>e.check(yt(Ho,n)),e.guid=n=>e.check(ht(Ko,n)),e.uuid=n=>e.check(mt(Jo,n)),e.uuidv4=n=>e.check(gt(Jo,n)),e.uuidv6=n=>e.check(vt(Jo,n)),e.uuidv7=n=>e.check(bt(Jo,n)),e.nanoid=n=>e.check(xt(Xo,n)),e.guid=n=>e.check(ht(Ko,n)),e.cuid=n=>e.check(kt(Yo,n)),e.cuid2=n=>e.check(Et(Qo,n)),e.ulid=n=>e.check(_t(ea,n)),e.base64=n=>e.check(Ct(sa,n)),e.base64url=n=>e.check(zt(ca,n)),e.xid=n=>e.check(Rt(na,n)),e.ksuid=n=>e.check(Nt(ta,n)),e.ipv4=n=>e.check(Tt(oa,n)),e.ipv6=n=>e.check(Ot(aa,n)),e.cidrv4=n=>e.check(It(ra,n)),e.cidrv6=n=>e.check(St(ia,n)),e.e164=n=>e.check(jt(da,n)),e.datetime=n=>e.check(function(e){return Ft(_o,e)}(n)),e.date=n=>e.check(function(e){return Pt(Ro,e)}(n)),e.time=n=>e.check(function(e){return $t(No,e)}(n)),e.duration=n=>e.check(function(e){return Dt(To,e)}(n))}));function Wo(e){return pt(Bo,e)}const Vo=m("ZodStringFormat",((e,n)=>{nn.init(e,n),Uo.init(e,n)})),Zo=m("ZodEmail",((e,n)=>{an.init(e,n),Vo.init(e,n)})),Ko=m("ZodGUID",((e,n)=>{tn.init(e,n),Vo.init(e,n)})),Jo=m("ZodUUID",((e,n)=>{on.init(e,n),Vo.init(e,n)})),Go=m("ZodURL",((e,n)=>{rn.init(e,n),Vo.init(e,n)})),Ho=m("ZodEmoji",((e,n)=>{sn.init(e,n),Vo.init(e,n)})),Xo=m("ZodNanoID",((e,n)=>{cn.init(e,n),Vo.init(e,n)})),Yo=m("ZodCUID",((e,n)=>{dn.init(e,n),Vo.init(e,n)})),Qo=m("ZodCUID2",((e,n)=>{ln.init(e,n),Vo.init(e,n)})),ea=m("ZodULID",((e,n)=>{un.init(e,n),Vo.init(e,n)})),na=m("ZodXID",((e,n)=>{pn.init(e,n),Vo.init(e,n)})),ta=m("ZodKSUID",((e,n)=>{fn.init(e,n),Vo.init(e,n)})),oa=m("ZodIPv4",((e,n)=>{bn.init(e,n),Vo.init(e,n)})),aa=m("ZodIPv6",((e,n)=>{wn.init(e,n),Vo.init(e,n)})),ra=m("ZodCIDRv4",((e,n)=>{yn.init(e,n),Vo.init(e,n)})),ia=m("ZodCIDRv6",((e,n)=>{xn.init(e,n),Vo.init(e,n)})),sa=m("ZodBase64",((e,n)=>{En.init(e,n),Vo.init(e,n)})),ca=m("ZodBase64URL",((e,n)=>{_n.init(e,n),Vo.init(e,n)})),da=m("ZodE164",((e,n)=>{Rn.init(e,n),Vo.init(e,n)})),la=m("ZodJWT",((e,n)=>{Nn.init(e,n),Vo.init(e,n)})),ua=m("ZodNumber",((e,n)=>{Tn.init(e,n),qo.init(e,n),e._zod.processJSONSchema=(n,t,o)=>((e,n,t)=>{const o=t,{minimum:a,maximum:r,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 a&&(o.minimum=a,"number"==typeof d&&"draft-04"!==n.target&&(d>=a?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 r&&(o.maximum=r,"number"==typeof c&&"draft-04"!==n.target&&(c<=r?delete o.maximum:delete o.exclusiveMaximum)),"number"==typeof s&&(o.multipleOf=s)})(e,n,t),e.gt=(n,t)=>e.check(Kt(n,t)),e.gte=(n,t)=>e.check(Jt(n,t)),e.min=(n,t)=>e.check(Jt(n,t)),e.lt=(n,t)=>e.check(Vt(n,t)),e.lte=(n,t)=>e.check(Zt(n,t)),e.max=(n,t)=>e.check(Zt(n,t)),e.int=n=>e.check(fa(n)),e.safe=n=>e.check(fa(n)),e.positive=n=>e.check(Kt(0,n)),e.nonnegative=n=>e.check(Jt(0,n)),e.negative=n=>e.check(Vt(0,n)),e.nonpositive=n=>e.check(Zt(0,n)),e.multipleOf=(n,t)=>e.check(Gt(n,t)),e.step=(n,t)=>e.check(Gt(n,t)),e.finite=()=>e;const t=e._zod.bag;e.minValue=Math.max(t.minimum??Number.NEGATIVE_INFINITY,t.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,e.maxValue=Math.min(t.maximum??Number.POSITIVE_INFINITY,t.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,e.isInt=(t.format??"").includes("int")||Number.isSafeInteger(t.multipleOf??.5),e.isFinite=!0,e.format=t.format??null}));const pa=m("ZodNumberFormat",((e,n)=>{On.init(e,n),ua.init(e,n)}));function fa(e){return Mt(pa,e)}const ha=m("ZodBoolean",((e,n)=>{In.init(e,n),qo.init(e,n),e._zod.processJSONSchema=(e,n,t)=>((e,n,t)=>{t.type="boolean"})(0,0,n)}));function ma(e){return qt(ha,e)}const ga=m("ZodAny",((e,n)=>{Sn.init(e,n),qo.init(e,n),e._zod.processJSONSchema=(e,n,t)=>{}}));const va=m("ZodUnknown",((e,n)=>{Cn.init(e,n),qo.init(e,n),e._zod.processJSONSchema=(e,n,t)=>{}}));function ba(){return Bt(va)}const wa=m("ZodNever",((e,n)=>{zn.init(e,n),qo.init(e,n),e._zod.processJSONSchema=(e,n,t)=>((e,n,t)=>{t.not={}})(0,0,n)}));const ya=m("ZodArray",((e,n)=>{An.init(e,n),qo.init(e,n),e._zod.processJSONSchema=(n,t,o)=>((e,n,t,o)=>{const a=t,r=e._zod.def,{minimum:i,maximum:s}=e._zod.bag;"number"==typeof i&&(a.minItems=i),"number"==typeof s&&(a.maxItems=s),a.type="array",a.items=vo(r.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 xa=m("ZodObject",((e,n)=>{Ln.init(e,n),qo.init(e,n),e._zod.processJSONSchema=(n,t,o)=>((e,n,t,o)=>{var a;const r=t,i=e._zod.def;r.type="object",r.properties={};const s=i.shape;for(const l in s)r.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&&(r.required=Array.from(d)),"never"===(null==(a=i.catchall)?void 0:a._zod.def.type)?r.additionalProperties=!1:i.catchall?i.catchall&&(r.additionalProperties=vo(i.catchall,n,{...o,path:[...o.path,"additionalProperties"]})):"output"===n.io&&(r.additionalProperties=!1)})(e,n,t,o),N(e,"shape",(()=>n.shape)),e.keyof=()=>function(e,n){const t=Array.isArray(e)?Object.fromEntries(e.map((e=>[e,e]))):e;return new Ra({type:"enum",entries:t,...D(n)})}(Object.keys(e._zod.def.shape)),e.catchall=n=>e.clone({...e._zod.def,catchall:n}),e.passthrough=()=>e.clone({...e._zod.def,catchall:ba()}),e.loose=()=>e.clone({...e._zod.def,catchall:ba()}),e.strict=()=>{return e.clone({...e._zod.def,catchall:Wt(wa,n)});var n},e.strip=()=>e.clone({...e._zod.def,catchall:void 0}),e.extend=n=>function(e,n){if(!j(n))throw new Error("Invalid input to extend: expected a plain object");const t=e._zod.def.checks;if(t&&t.length>0){const t=e._zod.def.shape;for(const e in n)if(void 0!==Object.getOwnPropertyDescriptor(t,e))throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}const o=O(e._zod.def,{get shape(){const t={...e._zod.def.shape,...n};return T(this,"shape",t),t}});return $(e,o)}(e,n),e.safeExtend=n=>function(e,n){if(!j(n))throw new Error("Invalid input to safeExtend: expected a plain object");const t=O(e._zod.def,{get shape(){const t={...e._zod.def.shape,...n};return T(this,"shape",t),t}});return $(e,t)}(e,n),e.merge=n=>function(e,n){const t=O(e._zod.def,{get shape(){const t={...e._zod.def.shape,...n._zod.def.shape};return T(this,"shape",t),t},get catchall(){return n._zod.def.catchall},checks:[]});return $(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,O(e._zod.def,{get shape(){const e={};for(const o in n){if(!(o in t.shape))throw new Error(`Unrecognized key: "${o}"`);n[o]&&(e[o]=t.shape[o])}return T(this,"shape",e),e},checks:[]}))}(e,n),e.omit=n=>function(e,n){const t=e._zod.def,o=t.checks;if(o&&o.length>0)throw new Error(".omit() cannot be used on object schemas containing refinements");const a=O(e._zod.def,{get shape(){const o={...e._zod.def.shape};for(const e in n){if(!(e in t.shape))throw new Error(`Unrecognized key: "${e}"`);n[e]&&delete o[e]}return T(this,"shape",o),o},checks:[]});return $(e,a)}(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 a=O(n._zod.def,{get shape(){const o=n._zod.def.shape,a={...o};if(t)for(const n in t){if(!(n in o))throw new Error(`Unrecognized key: "${n}"`);t[n]&&(a[n]=e?new e({type:"optional",innerType:o[n]}):o[n])}else for(const n in o)a[n]=e?new e({type:"optional",innerType:o[n]}):o[n];return T(this,"shape",a),a},checks:[]});return $(n,a)}(Ta,e,n[0]),e.required=(...n)=>function(e,n,t){const o=O(n._zod.def,{get shape(){const o=n._zod.def.shape,a={...o};if(t)for(const n in t){if(!(n in a))throw new Error(`Unrecognized key: "${n}"`);t[n]&&(a[n]=new e({type:"nonoptional",innerType:o[n]}))}else for(const n in o)a[n]=new e({type:"nonoptional",innerType:o[n]});return T(this,"shape",a),a}});return $(n,o)}(Aa,e,n[0])}));function ka(e,n){const t={type:"object",shape:e??{},...D(n)};return new xa(t)}const Ea=m("ZodUnion",((e,n)=>{qn.init(e,n),qo.init(e,n),e._zod.processJSONSchema=(n,t,o)=>((e,n,t,o)=>{const a=e._zod.def,r=!1===a.inclusive,i=a.options.map(((e,t)=>vo(e,n,{...o,path:[...o.path,r?"oneOf":"anyOf",t]})));r?t.oneOf=i:t.anyOf=i})(e,n,t,o),e.options=n.options}));const _a=m("ZodIntersection",((e,n)=>{Un.init(e,n),qo.init(e,n),e._zod.processJSONSchema=(n,t,o)=>((e,n,t,o)=>{const a=e._zod.def,r=vo(a.left,n,{...o,path:[...o.path,"allOf",0]}),i=vo(a.right,n,{...o,path:[...o.path,"allOf",1]}),s=e=>"allOf"in e&&1===Object.keys(e).length,c=[...s(r)?r.allOf:[r],...s(i)?i.allOf:[i]];t.allOf=c})(e,n,t,o)}));const Ra=m("ZodEnum",((e,n)=>{Vn.init(e,n),qo.init(e,n),e._zod.processJSONSchema=(n,t,o)=>((e,n,t)=>{const o=y(e._zod.def.entries);o.every((e=>"number"==typeof e))&&(t.type="number"),o.every((e=>"string"==typeof e))&&(t.type="string"),t.enum=o})(e,0,t),e.enum=n.entries,e.options=Object.values(n.entries);const t=new Set(Object.keys(n.entries));e.extract=(e,o)=>{const a={};for(const r of e){if(!t.has(r))throw new Error(`Key ${r} not found in enum`);a[r]=n.entries[r]}return new Ra({...n,checks:[],...D(o),entries:a})},e.exclude=(e,o)=>{const a={...n.entries};for(const n of e){if(!t.has(n))throw new Error(`Key ${n} not found in enum`);delete a[n]}return new Ra({...n,checks:[],...D(o),entries:a})}}));const Na=m("ZodTransform",((e,n)=>{Zn.init(e,n),qo.init(e,n),e._zod.processJSONSchema=(e,n,t)=>((e,n)=>{if("throw"===n.unrepresentable)throw new Error("Transforms cannot be represented in JSON Schema")})(0,e),e._zod.parse=(t,o)=>{if("backward"===o.direction)throw new v(e.constructor.name);t.addIssue=o=>{if("string"==typeof o)t.issues.push(V(o,t.value,n));else{const n=o;n.fatal&&(n.continue=!1),n.code??(n.code="custom"),n.input??(n.input=t.value),n.inst??(n.inst=e),t.issues.push(V(n))}};const a=n.transform(t.value,t);return a instanceof Promise?a.then((e=>(t.value=e,t))):(t.value=a,t)}}));const Ta=m("ZodOptional",((e,n)=>{Jn.init(e,n),qo.init(e,n),e._zod.processJSONSchema=(n,t,o)=>Eo(e,n,0,o),e.unwrap=()=>e._zod.def.innerType}));function Oa(e){return new Ta({type:"optional",innerType:e})}const Ia=m("ZodExactOptional",((e,n)=>{Gn.init(e,n),qo.init(e,n),e._zod.processJSONSchema=(n,t,o)=>Eo(e,n,0,o),e.unwrap=()=>e._zod.def.innerType}));const Sa=m("ZodNullable",((e,n)=>{Hn.init(e,n),qo.init(e,n),e._zod.processJSONSchema=(n,t,o)=>((e,n,t,o)=>{const a=e._zod.def,r=vo(a.innerType,n,o),i=n.seen.get(e);"openapi-3.0"===n.target?(i.ref=a.innerType,t.nullable=!0):t.anyOf=[r,{type:"null"}]})(e,n,t,o),e.unwrap=()=>e._zod.def.innerType}));function Ca(e){return new Sa({type:"nullable",innerType:e})}const za=m("ZodDefault",((e,n)=>{Xn.init(e,n),qo.init(e,n),e._zod.processJSONSchema=(n,t,o)=>((e,n,t,o)=>{const a=e._zod.def;vo(a.innerType,n,o),n.seen.get(e).ref=a.innerType,t.default=JSON.parse(JSON.stringify(a.defaultValue))})(e,n,t,o),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap}));const ja=m("ZodPrefault",((e,n)=>{Qn.init(e,n),qo.init(e,n),e._zod.processJSONSchema=(n,t,o)=>((e,n,t,o)=>{const a=e._zod.def;vo(a.innerType,n,o),n.seen.get(e).ref=a.innerType,"input"===n.io&&(t._prefault=JSON.parse(JSON.stringify(a.defaultValue)))})(e,n,t,o),e.unwrap=()=>e._zod.def.innerType}));const Aa=m("ZodNonOptional",((e,n)=>{et.init(e,n),qo.init(e,n),e._zod.processJSONSchema=(n,t,o)=>((e,n,t,o)=>{const a=e._zod.def;vo(a.innerType,n,o),n.seen.get(e).ref=a.innerType})(e,n,0,o),e.unwrap=()=>e._zod.def.innerType}));const Fa=m("ZodCatch",((e,n)=>{tt.init(e,n),qo.init(e,n),e._zod.processJSONSchema=(n,t,o)=>((e,n,t,o)=>{const a=e._zod.def;let r;vo(a.innerType,n,o),n.seen.get(e).ref=a.innerType;try{r=a.catchValue(void 0)}catch{throw new Error("Dynamic catch values are not supported in JSON Schema")}t.default=r})(e,n,t,o),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap}));const Pa=m("ZodPipe",((e,n)=>{ot.init(e,n),qo.init(e,n),e._zod.processJSONSchema=(n,t,o)=>((e,n,t,o)=>{const a=e._zod.def,r="input"===n.io?"transform"===a.in._zod.def.type?a.out:a.in:a.out;vo(r,n,o),n.seen.get(e).ref=r})(e,n,0,o),e.in=n.in,e.out=n.out}));function $a(e,n){return new Pa({type:"pipe",in:e,out:n})}const Da=m("ZodReadonly",((e,n)=>{rt.init(e,n),qo.init(e,n),e._zod.processJSONSchema=(n,t,o)=>((e,n,t,o)=>{const a=e._zod.def;vo(a.innerType,n,o),n.seen.get(e).ref=a.innerType,t.readOnly=!0})(e,n,t,o),e.unwrap=()=>e._zod.def.innerType}));const La=m("ZodCustom",((e,n)=>{st.init(e,n),qo.init(e,n),e._zod.processJSONSchema=(e,n,t)=>((e,n)=>{if("throw"===n.unrepresentable)throw new Error("Custom types cannot be represented in JSON Schema")})(0,e)}));var Ma;ka({success:ma(),accessToken:Wo().optional(),alias:Wo().optional(),user:ka({id:Wo(),email:Wo(),role:Wo(),validated:ma(),active:ma()}).optional(),person:ka({id:Wo(),name:Wo(),birth_date:Wo()}).optional(),confidence_score:Lt(ua,Ma).optional(),recognition_id:Wo().optional(),task_id:Wo().optional(),status:Wo().optional(),message:Wo().optional()}),ka({success:ma(),message:Wo(),person_id:Wo().optional(),user_id:Wo().optional(),person_validated:ma().optional(),face_processing:Ut(ga).optional(),onboarding_link:Wo().optional(),task_id:Wo().optional(),status:Wo().optional()});const qa="#0059C4",Ua="#F1BE00",Ba="#0A1320",Wa={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"}},Va={ground:"#F7F9FC",surface:"#FFFFFF",surfaceMuted:"#F1F5FA",line:"#E6ECF4",text:Ba,textMuted:"#48586B",textSubtle:"#617489",action:qa,actionText:"#FFFFFF",accent:Ua,overlay:"rgba(10,19,32,.55)",focusRing:qa},Za={ground:Ba,surface:"#111C2B",surfaceMuted:"#1E2B3C",line:"#22334D",text:"#EEF3F9",textMuted:"#AFBDCE",textSubtle:"#8496AD",action:"#0091F6",actionText:"#FFFFFF",accent:Ua,overlay:"rgba(10,19,32,.72)",focusRing:"#00B0F8"};function Ka(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 Ja=[8,16,24];function Ga(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?{...Za}:{...Va};let o=16;void 0!==e.radius&&Ja.includes(e.radius)&&(o=e.radius);let a=t.action,r=!1;if(e.accent){(function(e,n){const t=Ka(e),o=Ka(n),[a,r]=t>o?[t,o]:[o,t];return(a+.05)/(r+.05)})(e.accent,"#FFFFFF")>=4.5?a=e.accent:(r=!0,a=qa)}return{mode:n,tokens:{...t,action:a},radius:o,accent:a,accentFellBack:r}}const Ha="--nfid-ground",Xa="--nfid-surface",Ya="--nfid-surface-muted",Qa="--nfid-line",er="--nfid-text",nr="--nfid-text-muted",tr="--nfid-text-subtle",or="--nfid-action",ar="--nfid-action-text",rr="--nfid-accent",ir="--nfid-overlay",sr="--nfid-focus-ring",cr="--nfid-radius",dr="neofaceid-focus-frame-tokens";function lr(e={}){const n=Ga(e);if("undefined"==typeof document)return n;const t=function(e){const n=e.tokens;return`.neofaceid-root {\n ${Ha}: ${n.ground};\n ${Xa}: ${n.surface};\n ${Ya}: ${n.surfaceMuted};\n ${Qa}: ${n.line};\n ${er}: ${n.text};\n ${nr}: ${n.textMuted};\n ${tr}: ${n.textSubtle};\n ${or}: ${n.action};\n ${ar}: ${n.actionText};\n ${rr}: ${n.accent};\n ${ir}: ${n.overlay};\n ${sr}: ${n.focusRing};\n ${cr}: ${e.radius}px;\n color: var(${er});\n font-family: inherit;\n}\n.neofaceid-root :focus-visible {\n outline: 2px solid var(${sr});\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(dr);if(o)return o.textContent!==t&&(o.textContent=t),n;const a=document.createElement("style");return a.id=dr,a.textContent=t,document.head.appendChild(a),n}function ur(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 pr={},fr={purpose:"authentication",legalBasis:"fraud_prevention",privacyPolicyUrl:"",retentionDays:0},hr={development:"http://localhost:8000",sandbox:"https://sandbox-core.neofaceid.com",production:"https://core.neofaceid.com.br"},mr=[8,16,24];let gr={baseUrl:hr.sandbox,applicationToken:null,environment:"sandbox",initialized:!1,appName:null,accent:null,radius:16,theme:"light",locale:"pt-BR",resolvedTheme:null,consent:{...fr}},vr=!1;function br(){return gr.initialized,gr.baseUrl}function wr(){return gr.appName}function yr(){return gr.locale}const xr=()=>br(),kr=()=>{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)},Er=()=>{const e=new AbortController,n=setTimeout((()=>e.abort()),1e4);return e.signal.addEventListener("abort",(()=>clearTimeout(n))),e},_r=async 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 a=e.getContext("2d");a?(a.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=URL.createObjectURL(e)})),Rr=async e=>new Promise(((n,t)=>{const o=new Image;o.onload=()=>{const e=1280;let{width:a}=o,{height:r}=o;a>r&&a>e?(r=r*e/a,a=e):r>e&&(a=a*e/r,r=e);const i=document.createElement("canvas");i.width=a,i.height=r;const s=i.getContext("2d");s?(s.drawImage(o,0,0,a,r),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=URL.createObjectURL(e)})),Nr=async e=>{kr();const n=Er();try{const t=await fetch(`${xr()}/api/v1/auth/application/validate_token/`,{method:"POST",headers:{"Content-Type":"application/json","X-App-Token":e},body:JSON.stringify({}),signal:n.signal});if(!t.ok)throw new h(`API Error ${t.status}`,f.INVALID_TOKEN);return t.ok}catch(t){if(t instanceof Error){if("AbortError"===t.name)throw new h("Request timeout",f.NETWORK_ERROR);throw new h(t.message,f.NETWORK_ERROR)}throw new h("Unknown error",f.NETWORK_ERROR)}},Tr=async(e,n)=>{kr();const t=Er();try{const o=await fetch(`${xr()}/api/v1/onboardings/${encodeURIComponent(n)}/`,{method:"GET",headers:{"X-App-Token":e},signal:t.signal});if(!o.ok){if(401===o.status||403===o.status)throw new h("Token de aplicação inválido ou expirado",f.INVALID_TOKEN);if(404===o.status)throw new h("Link de onboarding não encontrado",f.NOT_FOUND);throw new h(`Falha ao obter detalhes (${o.status})`,f.NETWORK)}return await o.json()}catch(o){if(o instanceof Error){if("AbortError"===o.name)throw new h("Tempo de requisição excedido",f.NETWORK);if(o instanceof h)throw o;throw new h(o.message,f.NETWORK)}throw new h("Erro desconhecido",f.NETWORK_ERROR)}},Or=async(e,n)=>{kr();const t=Er();try{const o=await fetch(`${xr()}/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 a=await o.json();return!0===(null==a?void 0:a.is_valid)}catch(o){if(o instanceof Error){if("AbortError"===o.name)throw new h("Tempo de requisição excedido",f.NETWORK);if(o instanceof h)throw o;throw new h(o.message,f.NETWORK)}throw new h("Erro desconhecido",f.NETWORK_ERROR)}},Ir=async(e,n,t,o)=>{kr();const a=Er(),r=await _r(t),i=await _r(o);try{const t=await new Promise(((e,n)=>{const t=new FileReader;t.onload=()=>e(t.result),t.onerror=n,t.readAsDataURL(r)})),o=await new Promise(((e,n)=>{const t=new FileReader;t.onload=()=>e(t.result),t.onerror=n,t.readAsDataURL(i)})),s=await fetch(`${xr()}/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:a.signal}),c=await s.json();if(!s.ok){if(401===s.status||403===s.status)throw new h("Token de aplicação inválido ou expirado",f.INVALID_TOKEN);if(404===s.status)throw new h("Link de onboarding não encontrado",f.NOT_FOUND);throw new h((null==c?void 0:c.error)||(null==c?void 0:c.message)||"Falha ao concluir onboarding",f.NETWORK)}return{success:!!c.success,message:c.message||"Onboarding concluído",person_id:c.person_id,identity_data_id:c.identity_data_id,confidence_score:c.confidence_score,processing_time:c.processing_time}}catch(s){if(s instanceof Error){if("AbortError"===s.name)throw new h("Tempo de requisição excedido",f.NETWORK);if(s instanceof h)throw s;throw new h(s.message,f.NETWORK)}throw new h("Erro desconhecido",f.NETWORK_ERROR)}},Sr=async(e,n,t,o,a)=>{if(kr(),!o||0===o.length)throw new h("Pelo menos uma imagem da pessoa é obrigatória",f.VALIDATION_ERROR);const r=Er();try{const i=await Promise.all(o.map((async e=>{const n=await _r(e);return new Promise(((e,t)=>{const o=new FileReader;o.onload=()=>e(o.result),o.onerror=t,o.readAsDataURL(n)}))}))),s=await _r(a),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(`${xr()}/api/v1/onboardings/${encodeURIComponent(n)}/complete/`,{method:"POST",headers:{"Content-Type":"application/json","X-App-Token":e},body:JSON.stringify(c),signal:r.signal}),l=await d.json();if(!d.ok){if(401===d.status||403===d.status)throw new h("Token de aplicação inválido ou expirado",f.INVALID_TOKEN);if(404===d.status)throw new h("Link de onboarding não encontrado",f.NOT_FOUND);throw new h((null==l?void 0:l.error)||(null==l?void 0:l.message)||"Falha ao concluir onboarding",f.NETWORK)}return{success:!!l.success,message:l.message||"Onboarding concluído com sucesso",person_id:l.person_id,identity_data_id:l.identity_data_id,confidence_score:l.confidence_score,processing_time:l.processing_time,liveness_passed:l.liveness_passed,document_verified:l.document_verified,person_created:l.person_created}}catch(i){if(i instanceof Error){if("AbortError"===i.name)throw new h("Tempo de requisição excedido",f.NETWORK);if(i instanceof h)throw i;throw new h(i.message,f.NETWORK)}throw new h("Erro desconhecido",f.NETWORK_ERROR)}},Cr=async(e,n)=>{kr();const t=Er(),o=await _r(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)})),a=await fetch(`${xr()}/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(!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 r=await a.json();if(!r.success)throw new h(r.message||"Recognition failed",f.RECOGNITION_FAILED);return{accessToken:r.accessToken,payload:r.payload}}catch(a){if(a instanceof Error){if("AbortError"===a.name)throw new h("Request timed out",f.NETWORK);if(a instanceof h)throw a;throw new h(a.message,f.NETWORK)}throw new h("Unknown error occurred",f.NETWORK_ERROR)}},zr=async(e,n)=>{var t,o,a,r,i;kr();const s=Er(),c=await _r(e);try{const e=await c.arrayBuffer(),d=btoa(new Uint8Array(e).reduce(((e,n)=>e+String.fromCharCode(n)),"")),l=await fetch(`${xr()}/api/v1/login/donor/face/`,{method:"POST",headers:{"Content-Type":"application/json","X-App-Token":n},body:JSON.stringify({image:d,biometric_type:"FACE"}),signal:s.signal});if(!l.ok){if(401===l.status||403===l.status)throw new h("Invalid application token",f.INVALID_TOKEN);if(l.status>=500)throw new h(`Server Error ${l.status}`,f.API_ERROR);throw new h(`API Error ${l.status}`,f.API_ERROR)}const u=await l.json();if(!u.success)throw new h(u.message||"Login failed",f.LOGIN_FAILED);return{success:!0,accessToken:u.accessToken||u.access_token||"",alias:u.alias,user:{id:(null==(t=u.user)?void 0:t.id)||"",email:(null==(o=u.user)?void 0:o.email)||"",role:(null==(a=u.user)?void 0:a.role)||"",validated:(null==(r=u.user)?void 0:r.validated)||!1,active:(null==(i=u.user)?void 0:i.active)||!1},person:u.person?{id:u.person.id||"",name:u.person.name||"",birth_date:u.person.birth_date||""}:void 0,confidence_score:u.confidence_score,recognition_id:u.recognition_id}}catch(d){if(d instanceof Error){if("AbortError"===d.name)throw new h("Request timed out",f.NETWORK);if(d instanceof h)throw d;throw new h(d.message,f.NETWORK)}throw new h("Unknown error occurred",f.NETWORK_ERROR)}},jr=async(e,n,t=!0,o=.8)=>{kr();const a=Er(),r=await _r(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(r)})),i=await fetch(`${xr()}/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:a.signal});if(!i.ok){if(401===i.status||403===i.status)throw new h("Invalid or expired application token",f.INVALID_TOKEN);throw new h(`Server returned status ${i.status}`,f.NETWORK)}const s=await i.json();return{success:s.success,confidenceScore:s.confidence_score,accessToken:s.access_token,payload:s.payload}}catch(i){if(i instanceof Error){if("AbortError"===i.name)throw new h("Request timed out",f.NETWORK);if(i instanceof h)throw i;throw new h(i.message,f.NETWORK)}throw new h("Unknown error occurred",f.NETWORK_ERROR)}},Ar=async(e,n,t,o="LOGIN")=>{kr();const a=Er();try{const r=await fetch(`${xr()}/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:a.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 i=await r.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(r){if(r instanceof Error){if("AbortError"===r.name)throw new h("Request timed out",f.NETWORK);if(r instanceof h)throw r;throw new h(r.message,f.NETWORK)}throw new h("Unknown error occurred",f.NETWORK_ERROR)}},Fr=async(e,n,t,o=.8,a,r)=>{var i;kr();const s=Er(),c=await _r(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};a&&(e.signature=a);const c=await fetch(`${xr()}/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==r?void 0:r.email),cpf:l.cpf||(null==r?void 0:r.cpf),confidenceScore:l.confidence_score,accessToken:l.access_token,payload:l.payload,signature:a,sessionId:null==r?void 0:r.sessionId}}catch(l){if(l instanceof Error){if("AbortError"===l.name)throw new h("Request timed out",f.NETWORK);if(l instanceof h)throw l;throw new h(l.message,f.NETWORK)}throw new h("Unknown error occurred",f.NETWORK_ERROR)}},Pr=async(e,n,t)=>{kr();const o=Er();try{let a,r;if(null==t?void 0:t.documentFront){const e=await Rr(t.documentFront);a=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 Rr(t.documentBack);r=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};a&&(i.document_images=[{front:a,back:r||void 0,type:(null==t?void 0:t.documentType)||"RG"}]);const s=await fetch(`${xr()}/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(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)}},$r=async e=>{const n=Er(),t=new URLSearchParams;e.email&&t.append("email",e.email),e.cpf&&t.append("cpf",e.cpf);try{const e=await fetch(`${xr()}/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)}},Dr=async(e,n,t,o)=>{var a,r,i,s,c,d,l,u;if(kr(),!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=Er();try{const g=await Promise.all(n.map((async e=>{const n=await _r(e);return new Promise(((e,t)=>{const o=new FileReader;o.onload=()=>{const n=o.result;e(n)},o.onerror=t,o.readAsDataURL(n)}))})));let v,b;if(null==o?void 0:o.documentFront){const e=await Rr(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 Rr(o.documentBack);b=await new Promise(((n,t)=>{const o=new FileReader;o.onload=()=>n(o.result),o.onerror=t,o.readAsDataURL(e)}))}const w={name:e.name,birth_date:e.birth_date,cpf:e.cpf,email:e.email,password:e.password,password_confirm:e.password,face_photos:g,is_pep:e.is_pep??!1};v&&(w.document_images=[{front:v,back:b||void 0,type:(null==o?void 0:o.documentType)||"RG"}]);const y=await fetch(`${xr()}/api/v1/signup/donor/`,{method:"POST",headers:{"Content-Type":"application/json","X-App-Token":t},body:JSON.stringify(w),signal:p.signal});if(!y.ok){if(401===y.status||403===y.status)throw new h("Invalid or expired application token",f.INVALID_TOKEN);try{const e=await y.json();if(e.errors){const n=Object.entries(e.errors).map((([e,n])=>`${"password"===e?"senha":"password_confirm"===e?"confirmação de senha":e}: ${Array.isArray(n)?n.join(", "):String(n)}`)).join("; ");throw new h(`Erro de validação: ${n}`,f.VALIDATION_ERROR)}if("fraud_detected"===e.error)throw new h("Fraud detected in biometric images. Registration blocked.",f.VALIDATION_ERROR);if("user_exists"===e.error||"ALREADY_EXISTS"===e.error_code)throw new h("User with this email already exists",f.VALIDATION_ERROR);if("person_exists"===e.error)throw new h("Person with this CPF already exists",f.VALIDATION_ERROR);const n=e.message||e.error||`Server returned status ${y.status}`;throw new h(n,f.VALIDATION_ERROR)}catch(m){if(m instanceof h)throw m;throw new h(`Server returned status ${y.status}`,f.NETWORK)}}const x=await y.json();return 202===y.status&&(null==(a=x.data)?void 0:a.task_id)?{success:x.success,message:x.message||"Registration is being processed. You will receive an email when completed.",task_id:x.data.task_id,status:x.data.status||"processing",person_id:void 0,user_id:void 0,person_validated:void 0,face_processing:void 0,onboarding_link:void 0}:{success:x.success,message:x.message,person_id:(null==(r=x.data)?void 0:r.person_id)||x.person_id,user_id:(null==(i=x.data)?void 0:i.user_id)||x.user_id,person_validated:(null==(s=x.data)?void 0:s.person_validated)||x.person_validated,face_processing:(null==(c=x.data)?void 0:c.face_processing)||x.face_processing,onboarding_link:(null==(d=x.data)?void 0:d.onboarding_link)||x.onboarding_link,task_id:null==(l=x.data)?void 0:l.task_id,status:null==(u=x.data)?void 0:u.status}}catch(g){if(g instanceof Error){if("AbortError"===g.name)throw new h("Request timed out",f.NETWORK);if(g instanceof h)throw g;throw new h(g.message,f.NETWORK)}throw new h("Unknown error occurred",f.NETWORK_ERROR)}},Lr=async(e,n,t)=>{const o=Er();try{const a=await fetch(`${xr()}/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(!a.ok){if(401===a.status||403===a.status)throw new h("Email ou senha inválidos",f.INVALID_TOKEN);throw new h(`API Error ${a.status}`,f.API_ERROR)}const r=await a.json();return{success:!0,accessToken:r.access_token||r.access,alias:r.user&&r.user.alias||r.alias,user:{id:r.user&&r.user.id||"",email:r.user&&r.user.email||"",role:r.user&&r.user.role||"",validated:r.user&&r.user.validated||!1,active:r.user&&r.user.active||!1}}}catch(a){if(a instanceof Error){if("AbortError"===a.name)throw new h("Request timed out",f.NETWORK);if(a instanceof h)throw a;throw new h(a.message,f.NETWORK)}throw new h("Unknown error occurred",f.NETWORK_ERROR)}},Mr=async(e,n)=>{var t,o,a,r;kr();const i=Er(),s=await Rr(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(`${xr()}/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==(a=s.person)?void 0:a.name)||"",birth_date:(null==(r=s.person)?void 0:r.birth_date)||""}}}catch(d){if(d instanceof Error){if("AbortError"===d.name)throw new h("Request timed out",f.NETWORK);if(d instanceof h)throw d;throw new h(d.message,f.NETWORK)}throw new h("Unknown error occurred",f.NETWORK_ERROR)}},qr=async(e,n,t)=>{if(kr(),!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=Er(),a=await _r(n),r=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)}));try{const n=await fetch(`${xr()}/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:r}),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 a=await n.json();return{success:!0,message:"Biometric data registered successfully",identity_data_id:a.id,type_of_identification:a.type_of_identification,have_biometric_data:a.have_biometric_data,created_at:a.created_at}}catch(s){if(s instanceof Error){if("AbortError"===s.name)throw new h("Request timed out",f.NETWORK);if(s instanceof h)throw s;throw new h(s.message,f.NETWORK)}throw new h("Unknown error occurred",f.NETWORK_ERROR)}},Ur=async(e,n,t)=>{kr();const o=Er();try{const r=await fetch(`${xr()}/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(!r.ok){if(401===r.status)throw new h("Invalid or expired JWT token",f.INVALID_TOKEN);if(403===r.status)throw new h("Insufficient permissions to create application",f.INVALID_TOKEN);if(400===r.status)try{const e=await r.json(),n=e.message||e.error||"Invalid application data";throw new h(n,f.VALIDATION_ERROR)}catch(a){if(a instanceof h)throw a;throw new h("Invalid application data",f.VALIDATION_ERROR)}throw new h(`Server returned status ${r.status}`,f.NETWORK)}const i=await r.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(r){if(r instanceof Error){if("AbortError"===r.name)throw new h("Request timed out",f.NETWORK);if(r instanceof h)throw r;throw new h(r.message,f.NETWORK)}throw new h("Unknown error occurred",f.NETWORK_ERROR)}},Br=async(e={})=>{kr();const{durationMs:n=3e3,onProgress:t}=e;return new Promise((async(e,o)=>{let a=null;const r=[];try{a=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(a,{mimeType:i,videoBitsPerSecond:1e6}):new MediaRecorder(a,{videoBitsPerSecond:1e6})}catch{s=new MediaRecorder(a)}const c=s.mimeType||i;if(s.ondataavailable=e=>{e.data.size>0&&r.push(e.data)},s.onstop=()=>{a&&a.getTracks().forEach((e=>e.stop()));const n=new Blob(r,{type:c});e(n)},s.onerror=e=>{a&&a.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 a=setInterval((()=>{o+=e;const r=Math.min(100,o/n*100);t(r),o>=n&&clearInterval(a)}),e)}setTimeout((()=>{s&&"recording"===s.state&&s.stop()}),n)}catch(i){a&&a.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))}}))},Wr=async(e,n,t={})=>{var o,a,r,i,s,c;const{maxAttempts:d=60,intervalMs:l=1e3,onStatusChange:u}=t;let p=0;for(;p<d;){p++;try{const t=await fetch(`${xr()}/api/v1/tasks/status/?task_id=${e}`,{method:"GET",headers:{Accept:"application/json","X-App-Token":n}});if(!t.ok)throw new h(`Task status check failed: ${t.status}`,f.NETWORK);const d=await t.json(),p=(null==(o=d.data)?void 0:o.status)||"unknown";if(u){u(p,null==(r=null==(a=d.data)?void 0:a.progress)?void 0:r.percentage)}if("success"===p)return d.data.result;if("failure"===p){const e=(null==(s=null==(i=d.data)?void 0:i.result)?void 0:s.message)||(null==(c=d.data)?void 0:c.error)||"Task failed";throw new h(e,f.RECOGNITION_FAILED)}if("revoked"===p)throw new h("Task was cancelled",f.RECOGNITION_FAILED);await new Promise((e=>setTimeout(e,l)))}catch(m){if(m instanceof h)throw m;throw new h(`Polling error: ${m instanceof Error?m.message:"Unknown error"}`,f.NETWORK)}}throw new h("Task status polling timed out",f.NETWORK)},Vr=async(e,n)=>{var t;kr();const o=Er();try{const a=await fetch(`${xr()}/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(!a.ok){if(401===a.status||403===a.status)throw new h("Invalid or expired application token",f.INVALID_TOKEN);if(400===a.status){const e=await a.json();throw new h(e.message||"Invalid request data",f.VALIDATION_ERROR)}throw new h(`Server returned status ${a.status}`,f.NETWORK)}const r=await a.json();if(!r.success||!(null==(t=r.data)?void 0:t.task_id))throw new h(r.message||"Failed to start proof of life",f.RECOGNITION_FAILED);return{taskId:r.data.task_id,historyId:r.data.history_id,status:r.data.status,message:r.message||"Recognition started successfully"}}catch(a){if(a instanceof Error){if("AbortError"===a.name)throw new h("Request timed out",f.NETWORK);if(a instanceof h)throw a;throw new h(a.message,f.NETWORK)}throw new h("Unknown error occurred",f.NETWORK_ERROR)}},Zr=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)})),Kr=async(e,n,t)=>{var o,a;if(kr(),!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 r=await Promise.all(t.map((async e=>{const n=await Rr(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=Er();try{const t=await fetch(`${xr()}/api/v1/donors/${e}/documents/`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${n}`},body:JSON.stringify({document_images:r}),signal:i.signal}),s=await t.json();if(!t.ok)throw new h((null==s?void 0:s.message)||`API Error ${t.status}`,f.NETWORK_ERROR);return{success:!0,taskId:(null==(o=s.data)?void 0:o.task_id)??"",status:(null==(a=s.data)?void 0:a.status)??"processing",message:s.message??"Documents submitted for processing"}}catch(s){if(s instanceof h)throw s;if(s instanceof Error){if("AbortError"===s.name)throw new h("Request timeout",f.NETWORK_ERROR);throw new h(s.message,f.NETWORK_ERROR)}throw new h("Unknown error occurred",f.NETWORK_ERROR)}},Jr=async(e,n)=>{const t=Er();try{const o=await fetch(`${xr()}/api/v1/tasks/status/?task_id=${e}`,{method:"GET",headers:{"Content-Type":"application/json",...n?{"X-App-Token":n}:{}},signal:t.signal}),a=await o.json();if(!o.ok)throw new h((null==a?void 0:a.message)||`API Error ${o.status}`,f.NETWORK_ERROR);return{success:a.success,status:a.data.status,result:a.data.result,error:a.data.error}}catch(o){if(o instanceof h)throw o;throw new h("Failed to fetch task status",f.NETWORK_ERROR)}},Gr=async(e,n,t={})=>{var o,a;const{maxRetries:r=30,interval:i=2e3}=t,s=await Mr(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<r;d++){const e=await Jr(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==(a=e.result.person)?void 0:a.birth_date)||""}}:{personFound:!1};if("failure"===e.status)return{personFound:!1};await new Promise((e=>setTimeout(e,i)))}throw new h("Timed out waiting for identification",f.NETWORK_ERROR)};async function Hr(e,n){const t=br(),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 Xr(e,n){const t=br(),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 Yr=Object.freeze(Object.defineProperty({__proto__:null,checkUserExistence:$r,completeOnboarding:Ir,completeOnboardingWithData:Sr,confirmPasswordReset:Xr,getOnboardingDetails:Tr,getTaskStatus:Jr,identifyPerson:Mr,identifyPersonAsync:Gr,loginWithBiometric:zr,loginWithEmail:Lr,pollTaskStatus:Wr,recognize:Cr,recognizeBiometric:jr,recognizeByPurpose:Fr,recordFaceVideo:Br,registerApplication:Ur,registerBiometric:qr,registerDocumentByImage:Kr,registerPersonWithBiometric:Dr,registerPersonWithoutFace:Pr,requestPasswordReset:Hr,simpleIdentification:Ar,startProofOfLife:Vr,validateOnboardingToken:Or,validateToken:Nr,videoToBase64:Zr},Symbol.toStringTag,{value:"Module"}));function Qr(e,n={}){if(!e||0===e.videoWidth||0===e.videoHeight)return 0;const t=n.sample??64,o=e.videoWidth,a=e.videoHeight,r=n.roi??function(e,n,t){const o=Math.round(e*t),a=Math.round(n*t);return{x:Math.round((e-o)/2),y:Math.round((n-a)/2),width:o,height:a}}(o,a,.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,r.x,r.y,r.width,r.height,0,0,t,t);return function(e){const n=e.length;if(0===n)return 0;let t=0,o=0;for(let a=0;a<n;a+=4){t+=.2126*e[a]+.7152*e[a+1]+.0722*e[a+2],o+=1}return 0===o?0:t/(255*o)}(s.getImageData(0,0,t,t).data)}catch{return 0}}function ei(e,t={}){const o=t.enabled??!0,a=t.darkThreshold??.235,r=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=Qr(e.current,{scratch:g.current??void 0});u(n);const o=Date.now();m.current||(n>0&&n<a?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;Qr(e.current,{scratch:g.current??void 0})-(h.current??0)<r&&(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,a,r,i,s,e]),{flashOn:c,lastBrightness:l}}function ni({active:e,zIndex:n=10001,onDismiss:t}){if(!e)return null;const a={position:"fixed",inset:0,background:"#FFFFFF",zIndex:n,pointerEvents:"none",animation:"nfid-flash-in 200ms ease-out"},r={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:a,"aria-hidden":"true"}),o.jsxs("div",{className:"nfid-screen-flash-hint",style:r,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:"×"})]})]})}const ti=(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}},oi={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 ai({accessToken:e,onClose:t,onSuccess:a,onCannotGesture:r,autoLighting:i=!0}){const s=n.useRef(null),c=n.useRef(null),l=n.useRef(null),u=n.useRef(null),[f,h]=n.useReducer(ti,{status:"requestingPermission"}),[m,g]=n.useState(!1),{startCamera:v,stopCamera:b}=p(),w=()=>{if(!s.current)return;const e=async()=>{if(s.current&&"ready"===f.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,a=t/2,r=o/2,i=.4*t,c=.4*o;return n.x+n.width/2>a-i/2&&n.x+n.width/2<a+i/2&&n.y+n.height/2>r-c/2&&n.y+n.height/2<r+c/2})(e[0]);g(n&&t)}catch(n){}u.current=window.setTimeout(e,100)}};e()};n.useEffect((()=>{lr()}),[]);const y=i&&("ready"===f.status||"capturing"===f.status),{flashOn:x}=ei(s,{enabled:y});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 v();l.current=e,s.current&&(s.current.srcObject=e),h({type:"PERMISSION_GRANTED"}),w()}catch(e){h({type:"PERMISSION_DENIED"})}})(),()=>{l.current&&b(l.current)})),[v,b]);const k=async()=>{if(c.current&&s.current)try{h({type:"START_CAPTURE"});const o=c.current.getContext("2d");if(!o)return void h({type:"SET_ERROR",message:"Failed to get canvas context"});c.current.width=s.current.videoWidth,c.current.height=s.current.videoHeight,o.drawImage(s.current,0,0,c.current.width,c.current.height);const r=await new Promise(((e,n)=>{var t;null==(t=c.current)||t.toBlob((t=>{t?e(t):n(new Error("Failed to convert canvas to blob"))}),"image/jpeg",.95)}));try{const n=await Cr(r,e);a({success:!0,data:{faceId:n.payload.documentId,confidence:1}}),h({type:"UPLOAD_SUCCESS"}),setTimeout(t,1500)}catch(n){h({type:"SET_ERROR",message:"Face recognition failed"})}}catch(n){h({type:"SET_ERROR",message:"Failed to capture image"})}};return o.jsxs("div",{className:"neofaceid-root",style:oi.overlay,children:[o.jsx(ni,{active:x}),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:oi.modal,className:"modal",children:[o.jsx("button",{type:"button",style:oi.closeButton,onClick:t,children:"×"}),o.jsx("video",{ref:s,style:oi.video,autoPlay:!0,playsInline:!0,muted:!0}),o.jsx("canvas",{ref:c,style:oi.canvas}),o.jsx("div",{style:oi.guide}),"ready"===f.status&&!m&&o.jsx("div",{style:oi.message,"aria-live":"assertive",children:"Centralize seu rosto no círculo"}),"capturing"===f.status&&o.jsx("div",{style:oi.message,"aria-live":"assertive",children:"Por favor, pisque os olhos"}),("ready"===f.status||"capturing"===f.status)&&o.jsx("button",{type:"button",className:"neofaceid-face-cannot-gesture",onClick:()=>{r?r():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"===f.status&&o.jsx("div",{style:oi.spinner}),"success"===f.status&&o.jsx("div",{style:oi.message,children:"Autenticado!"}),"error"===f.status&&o.jsx("div",{style:oi.message,children:f.message}),o.jsxs("div",{style:oi.controls,children:["ready"===f.status&&m&&o.jsx("button",{type:"button",style:oi.button,onClick:k,children:"Capturar"}),"capturing"===f.status&&o.jsx("button",{type:"button",style:oi.button,onClick:k,children:"Capturar"}),"error"===f.status&&o.jsx("button",{type:"button",style:oi.button,onClick:()=>{h({type:"RESET"})},children:"Tentar Novamente"})]})]})]})}const ri='<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 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-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>',ii=ri;function si(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;">${ri}</span>`}class ci{constructor(e){i(this,"applicationToken"),i(this,"modalElement",null),this.applicationToken=e}open(){this.modalElement||(lr(),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 ${si(18)}\n <span>NeoFaceId by</span>\n <span class="neoface-forgot-brand-name">OCTA</span>\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 ${si(18)}\n <span>NeoFaceId by</span>\n <span class="neoface-forgot-brand-name">OCTA</span>\n </div>\n `;e.querySelector(".neoface-forgot-close-success").addEventListener("click",this.close.bind(this))}async handleSubmit(e){var n,t,o,a;e.preventDefault();const r=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==(a=null==r?void 0:r.value)?void 0:a.trim();if(c){i.disabled=!0,i.textContent="Enviando...",s.style.display="none";try{await Hr(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)||ur(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 di=(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 ui();default:return e}},li={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..."},ui=()=>{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}},pi=8,fi=10,hi=26,mi=8,gi=-8,vi=15,bi=-15,wi=1500,yi=150,xi=.35,ki=.65,Ei=.18,_i=.22,Ri=2e4;function Ni({personData:e,applicationToken:t,onClose:a,onSuccess:r,onPhotosCaptured:i,onError:s,onCannotGesture:c,autoLighting:l=!0}){const u=n.useRef(null),p=n.useRef(null),f=n.useRef(null),h=n.useRef(null),m=n.useRef(null),g=n.useRef(!1),v=n.useRef("center"),b=n.useRef(null),w=n.useRef(null),y=n.useRef(!1),x=n.useRef(null),[k,E]=n.useReducer(di,void 0,ui),[_,R]=n.useState(!1),[N,T]=n.useState("ok"),[O,I]=n.useState(!1);n.useEffect((()=>{lr()}),[]);const S=l&&("liveness"===k.status||"camera-loading"===k.status),{flashOn:C}=ei(u,{enabled:S});n.useEffect((()=>{if("liveness"===k.status){const e=k.step;v.current!==e&&(v.current=e,g.current||(h.current&&(h.current=null),m.current&&(clearInterval(m.current),m.current=null),E({type:"UPDATE_PROGRESS",progress:0}))),x.current={stepSequence:k.stepSequence,currentStepIndex:k.currentStepIndex,capturedPhotos:k.capturedPhotos},w.current&&clearTimeout(w.current),"complete"!==k.step&&(w.current=window.setTimeout((()=>{E({type:"ERROR",message:"Tempo limite atingido para o movimento. Por favor, tente novamente em um ambiente bem iluminado.",retryable:!0})}),Ri))}}),[k.status,"liveness"===k.status&&k.step,"liveness"===k.status&&k.currentStepIndex]);const z=e=>{if(g.current||"complete"===v.current)return;const n=Date.now();e?h.current||(h.current=n,m.current&&clearInterval(m.current),m.current=window.setInterval((()=>{if(!h.current)return;const e=Date.now()-h.current,n=Math.min(e/wi*100,100);E({type:"UPDATE_PROGRESS",progress:n}),n>=100&&(clearInterval(m.current),m.current=null,j())}),50)):h.current&&(h.current=null,m.current&&(clearInterval(m.current),m.current=null),E({type:"UPDATE_PROGRESS",progress:0}))};n.useEffect((()=>{(async()=>{try{const e="/models",n=new Promise(((e,n)=>setTimeout((()=>n(new Error("Timeout ao carregar modelos"))),1e4)));await Promise.race([Promise.all([d.nets.tinyFaceDetector.loadFromUri(e),d.nets.faceLandmark68Net.loadFromUri(e)]),n])}catch(e){E({type:"ERROR",message:"Não foi possível carregar os modelos de IA. Verifique sua conexão e tente novamente.",retryable:!0})}})()}),[]),n.useEffect((()=>()=>{f.current&&(f.current.getTracks().forEach((e=>{e.stop()})),f.current=null),u.current&&(u.current.srcObject=null),b.current&&(clearTimeout(b.current),b.current=null),m.current&&(clearInterval(m.current),m.current=null),w.current&&(clearTimeout(w.current),w.current=null)}),[]),n.useEffect((()=>{let e=!0;return(async()=>{if("liveness"===k.status&&!f.current){y.current=!1,b.current&&(clearTimeout(b.current),b.current=null),b.current=window.setTimeout((()=>{e&&!1===y.current&&E({type:"ERROR",message:"A câmera não respondeu a tempo. Verifique se ela está disponível e tente novamente.",retryable:!0})}),2e4);try{const n=await navigator.mediaDevices.getUserMedia({video:{width:{ideal:640},height:{ideal:480},facingMode:"user"}});if(!e)return void n.getTracks().forEach((e=>e.stop()));const t=async()=>{let e=0;for(;!u.current&&e<50;)await new Promise((e=>setTimeout(e,100))),e++;return u.current},o=await t();if(!o)throw new Error("Elemento de vídeo não encontrado");o.srcObject=n,f.current=n,o.onloadedmetadata=()=>{o.play().then((()=>{e&&I(!0)}))}}catch(n){if(!e)return;b.current&&(clearTimeout(b.current),b.current=null);let t=n instanceof Error?n.message:"Erro ao acessar câmera";n instanceof DOMException&&("NotAllowedError"===n.name||"PermissionDeniedError"===n.name?t="Permissão de câmera negada. Permita o acesso à câmera nas configurações do navegador e tente novamente.":"NotFoundError"===n.name||"DevicesNotFoundError"===n.name?t="Nenhuma câmera encontrada. Conecte uma câmera e tente novamente.":"NotReadableError"===n.name&&(t="A câmera está sendo usada por outro programa. Feche-o e tente novamente.")),E({type:"ERROR",message:t,retryable:!0})}}})(),()=>{e=!1,b.current&&(clearTimeout(b.current),b.current=null),f.current&&(f.current.getTracks().forEach((e=>e.stop())),f.current=null),m.current&&(clearInterval(m.current),m.current=null),h.current=null}}),[k.status]),n.useEffect((()=>{if("liveness"!==k.status||!u.current)return;let e=!0,n=0;const t=async()=>{if(!e||"liveness"!==k.status)return;if(g.current||"complete"===v.current)return void requestAnimationFrame(t);const o=Date.now();if(o-n<yi)requestAnimationFrame(t);else{n=o;try{const n=await d.detectSingleFace(u.current,new d.TinyFaceDetectorOptions({inputSize:224,scoreThreshold:.35})).withFaceLandmarks();if(!e)return;const o=!!n;if(R(o),o&&n.detection){const e=(e=>{if(!e||!u.current)return"not-detected";const{box:n}=e.detection,t=u.current.videoWidth||640,o=u.current.videoHeight||480,a=n.width/t;if(a<xi)return"too-far";if(a>ki)return"too-close";const r=n.x+n.width/2,i=n.y+n.height/2,s=Math.abs(r-t/2)/t,c=Math.abs(i-o/2)/o;return s>Ei||c>_i?"not-centered":"ok"})(n);if("not-detected"!==e&&T(e),"ok"!==e)return z(!1),void requestAnimationFrame(t)}if(o&&n.landmarks){const e=(e=>{try{const n=e.positions||e._positions;if(!Array.isArray(n)||n.length<68)return null;const t=e=>{const t=n[e];return{x:void 0!==t._x?t._x:t.x,y:void 0!==t._y?t._y:t.y}},o=t(30),a=t(8),r=t(36),i=t(45),s=(r.x+i.x)/2,c=(o.x-s)/Math.abs(i.x-r.x)*90,d=(r.y+i.y)/2,l=o.y-d,u=-l/Math.abs(a.y-d)*90+hi;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)<pi&&Math.abs(n)<fi;case"up":return e>mi;case"down":return e<gi;case"left":return n>vi;case"right":return n<bi;default:return!1}})(e.pitch,e.yaw,v.current);z(n)}}else h.current&&(h.current=null,m.current&&(clearInterval(m.current),m.current=null),E({type:"UPDATE_PROGRESS",progress:0}))}catch(a){}e&&"liveness"===k.status&&requestAnimationFrame(t)}},o=()=>{e&&u.current&&(y.current=!0,b.current&&(clearTimeout(b.current),b.current=null),t())},a=u.current;if(a&&a.readyState>=2){const n=setTimeout(o,200);return()=>{e=!1,clearTimeout(n),m.current&&(clearInterval(m.current),m.current=null),h.current=null}}const r=()=>{e&&o()};let i=0;const s=window.setInterval((()=>{i++,e?u.current&&u.current.readyState>=2?(clearInterval(s),u.current.removeEventListener("canplay",r),o()):i>=50&&clearInterval(s):clearInterval(s)}),300);return null==a||a.addEventListener("canplay",r,{once:!0}),()=>{e=!1,clearInterval(s),null==a||a.removeEventListener("canplay",r),m.current&&(clearInterval(m.current),m.current=null),h.current=null}}),[k.status]);const j=async()=>{if(!u.current||!p.current||g.current)return;g.current=!0,h.current=null;const e=x.current;if(!e)return void(g.current=!1);const n=p.current,t=u.current,o=n.getContext("2d");o?(n.width=t.videoWidth,n.height=t.videoHeight,o.scale(-1,1),o.drawImage(t,-n.width,0,n.width,n.height),n.toBlob((n=>{if(!n)return void(g.current=!1);const t=e.currentStepIndex+1,o=e.stepSequence[t];if("complete"===o){const t=[...e.capturedPhotos,n];E({type:"START_PROCESSING"}),A(t)}else setTimeout((()=>{g.current=!1,E({type:"NEXT_STEP",step:o,photo:n})}),100)}),"image/jpeg",.85)):g.current=!1},A=async n=>{var o;try{if(E({type:"START_PROCESSING"}),t&&n.length>0)try{const{identifyPersonAsync:e}=await Promise.resolve().then((()=>Yr)),a=new Promise((e=>setTimeout((()=>e(null)),5e3))),r=await Promise.race([e(n[0],t,{maxRetries:3,interval:1e3}),a]);if(r&&r.personFound)return void E({type:"DUPLICATE",personName:(null==(o=r.person)?void 0:o.name)||"Pessoa identificada"})}catch(a){}if(i)return E({type:"SUCCESS"}),void i(n);if(!e||!t)throw new Error("Dados de registro não fornecidos");const s=await Dr(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"}),r&&r(c)}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(ni,{active:C}),o.jsx("div",{className:"neofaceid-root modal-overlay",children:o.jsxs("div",{className:"modal-content",children:[o.jsx("button",{type:"button",className:"close-button",onClick:a,children:"×"}),"liveness"===k.status&&(()=>{if("liveness"!==k.status)return null;const e=`${k.currentStepIndex+1}/${k.stepSequence.length-1}`,{stepProgress:n}=k;return o.jsxs("div",{className:"liveness-container",children:[o.jsx("div",{className:"progress-indicator",children:o.jsx("span",{className:"progress-text",children:e})}),_&&"ok"!==N&&o.jsxs("div",{className:"status-badge "+("not-centered"===N?"warning":"error"),children:["too-far"===N&&"Aproxime-se mais","too-close"===N&&"Afaste-se um pouco","not-centered"===N&&"Centralize seu rosto"]}),o.jsx("div",{className:"video-wrapper",children:o.jsx("div",{className:`video-circle ${_&&"ok"===N?"face-detected":""} ${n>0?"capturing":""}`,children:o.jsx("video",{ref:u,className:"video-feed "+(O?"ready":""),autoPlay:!0,muted:!0,playsInline:!0})})}),o.jsxs("div",{className:"instruction-box",children:[o.jsx("p",{className:"instruction-text","aria-live":"assertive",children:li[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():a()},"aria-label":"Não consigo fazer esse movimento — buscar alternativa",children:"Não consigo fazer esse movimento"}),o.jsxs("div",{className:"branding-small",children:[o.jsx("span",{className:"brand-logo-small",style:{display:"inline-flex",width:18,height:18,color:"currentColor"},dangerouslySetInnerHTML:{__html:ii}}),o.jsx("span",{children:"NeoFaceId by"}),o.jsx("span",{className:"brand-name",children:"OCTA"})]})]})})(),"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.jsxs("div",{className:"branding",style:{marginTop:"40px",paddingTop:"24px",borderTop:"1px solid rgba(255, 255, 255, 0.1)"},children:[o.jsx("span",{children:"NeoFaceId by"}),o.jsx("span",{className:"brand-name",children:"OCTA"})]})]}),"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.jsxs("div",{className:"branding",style:{marginTop:"40px",paddingTop:"24px",borderTop:"1px solid rgba(255, 255, 255, 0.1)"},children:[o.jsx("span",{children:"NeoFaceId by"}),o.jsx("span",{className:"brand-name",children:"OCTA"})]})]}),"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:a,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:a,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:()=>{a(),window.location.href="/"},children:"Ir para o Login"}),o.jsx("button",{type:"button",className:"secondary-button",style:{marginTop:"12px"},onClick:()=>{a(),new ci(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.jsxs("div",{className:"branding",style:{marginTop:"32px",paddingTop:"20px",borderTop:"1px solid rgba(255, 255, 255, 0.08)",width:"100%"},children:[o.jsx("span",{className:"brand-logo",style:{display:"inline-flex",width:18,height:18,color:"currentColor"},dangerouslySetInnerHTML:{__html:ii}}),o.jsx("span",{children:"NeoFaceId by"}),o.jsx("span",{className:"brand-name",children:"OCTA"})]})]})})()]})}),o.jsx("canvas",{ref:p})]})}const Ti="https://neofaceid.com/privacidade",Oi={verification:{title:"Vamos confirmar que é você",duration:"Leva cerca de 20 segundos e usa a câmera do seu dispositivo.",bullet1Title:"Sua câmera liga agora",bullet1Body:"Você vê a imagem o tempo todo e pode encerrar quando quiser.",bullet2Title:"Pediremos dois movimentos simples",bullet2Body:"Virar o rosto ou piscar — é assim que sabemos que há alguém ali.",bullet3Title:"A imagem não fica guardada",bullet3Body:"Ela é usada para a verificação e descartada em seguida.",primary:"Começar verificação"},registration:{title:"Vamos cadastrar seu rosto",duration:"Leva cerca de 20 segundos e usa a câmera do seu dispositivo.",bullet1Title:"Sua câmera liga agora",bullet1Body:"Você vê a imagem o tempo todo e pode encerrar quando quiser.",bullet2Title:"Pediremos dois movimentos simples",bullet2Body:"Virar o rosto ou piscar — é assim que sabemos que há alguém ali.",bullet3Title:"Guardamos um vetor matemático do seu rosto",bullet3Body:"Não a foto. A imagem é descartada.",primary:"Começar cadastro"}},Ii=()=>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"})]}),Si=()=>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"})]}),Ci=()=>o.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[o.jsx("path",{d:"M12 2 4 5v7c0 5 3.5 8.5 8 10 4.5-1.5 8-5 8-10V5l-8-3Z"}),o.jsx("path",{d:"m9 12 2 2 4-4"})]});function zi({appName:e,flow:n,privacyPolicyUrl:t=Ti,retentionDays:a=90,onAccept:r,onDecline:i}){const s=Oi[n];return o.jsxs(o.Fragment,{children:[o.jsx("style",{children:"\n @keyframes neofaceidConsentFadeIn { from { opacity: 0 } to { opacity: 1 } }\n @keyframes neofaceidConsentSlideUp {\n from { opacity: 0; transform: translateY(12px) }\n to { opacity: 1; transform: translateY(0) }\n }\n .neofaceid-consent-overlay {\n position: fixed; inset: 0;\n background: var(--nfid-overlay);\n backdrop-filter: blur(3px);\n -webkit-backdrop-filter: blur(3px);\n display: flex; align-items: center; justify-content: center;\n z-index: 10001; padding: 20px;\n animation: neofaceidConsentFadeIn 200ms ease-out;\n font-family: inherit;\n color: var(--nfid-text);\n }\n .neofaceid-consent-modal {\n background: var(--nfid-surface);\n border-radius: var(--nfid-radius, 16px);\n padding: 28px;\n max-width: 440px;\n width: 100%;\n box-shadow: 0 1px 3px rgba(10, 19, 32, 0.08);\n animation: neofaceidConsentSlideUp 320ms cubic-bezier(.2,0,0,1);\n box-sizing: border-box;\n }\n .neofaceid-consent-header {\n display: flex;\n align-items: baseline;\n gap: 10px;\n margin-bottom: 20px;\n }\n .neofaceid-consent-appname {\n font-size: 17px;\n font-weight: 700;\n color: var(--nfid-text);\n line-height: 1.2;\n }\n .neofaceid-consent-brand-caption {\n font-size: 11px;\n font-weight: 700;\n letter-spacing: 0.09em;\n text-transform: uppercase;\n color: var(--nfid-text-subtle);\n }\n .neofaceid-consent-title {\n font-size: 22px;\n font-weight: 700;\n color: var(--nfid-text);\n margin: 0 0 8px;\n line-height: 1.25;\n letter-spacing: -0.015em;\n }\n .neofaceid-consent-duration {\n font-size: 14px;\n color: var(--nfid-text-muted);\n margin: 0 0 20px;\n line-height: 1.5;\n }\n .neofaceid-consent-bullets {\n display: flex;\n flex-direction: column;\n gap: 14px;\n margin-bottom: 20px;\n }\n .neofaceid-consent-bullet {\n display: flex;\n gap: 12px;\n align-items: flex-start;\n }\n .neofaceid-consent-bullet-icon {\n flex-shrink: 0;\n color: var(--nfid-action);\n margin-top: 2px;\n }\n .neofaceid-consent-bullet-title {\n font-size: 14px;\n font-weight: 600;\n color: var(--nfid-text);\n margin: 0 0 2px;\n line-height: 1.35;\n }\n .neofaceid-consent-bullet-body {\n font-size: 13px;\n color: var(--nfid-text-muted);\n margin: 0;\n line-height: 1.45;\n }\n .neofaceid-consent-link {\n display: inline-block;\n font-size: 13px;\n color: var(--nfid-action);\n text-decoration: underline;\n margin-bottom: 20px;\n }\n .neofaceid-consent-link:hover { opacity: 0.85; }\n .neofaceid-consent-actions {\n display: flex;\n flex-direction: column;\n gap: 10px;\n }\n .neofaceid-consent-button {\n min-height: 44px;\n padding: 12px 20px;\n border-radius: var(--nfid-radius, 16px);\n border: none;\n font-size: 15px;\n font-weight: 600;\n cursor: pointer;\n transition: background 120ms ease-out, transform 120ms ease-out;\n font-family: inherit;\n }\n .neofaceid-consent-button-primary {\n background: var(--nfid-action);\n color: var(--nfid-action-text);\n }\n .neofaceid-consent-button-primary:hover { opacity: 0.92; }\n .neofaceid-consent-button-primary:focus-visible {\n outline: 2px solid var(--nfid-focus-ring);\n outline-offset: 2px;\n }\n .neofaceid-consent-button-ghost {\n background: transparent;\n color: var(--nfid-text-muted);\n }\n .neofaceid-consent-button-ghost:hover { background: var(--nfid-surface-muted); }\n .neofaceid-consent-footer {\n display: flex;\n justify-content: center;\n margin-top: 20px;\n padding-top: 16px;\n border-top: 1px solid var(--nfid-line);\n }\n .neofaceid-consent-seal {\n font-size: 11px;\n font-weight: 700;\n letter-spacing: 0.09em;\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(Ii,{})}),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(Si,{})}),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(Ci,{})}),o.jsxs("div",{children:[o.jsx("p",{className:"neofaceid-consent-bullet-title",children:s.bullet3Title}),o.jsx("p",{className:"neofaceid-consent-bullet-body",children:s.bullet3Body})]})]})]}),o.jsxs("a",{href:t,target:"_blank",rel:"noopener noreferrer",className:"neofaceid-consent-link",children:["Ver política de privacidade (retenção de até ",a," dias)"]}),o.jsxs("div",{className:"neofaceid-consent-actions",children:[o.jsx("button",{type:"button",className:"neofaceid-consent-button neofaceid-consent-button-primary",onClick:r,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("span",{className:"neofaceid-consent-seal",children:"Protegido por NeoFaceID"})})]})})]})}class ji{constructor(){i(this,"container",null),i(this,"root",null)}show(e){this.container||(lr(),this.container=document.createElement("div"),this.container.id="neofaceid-consent-modal-container",document.body.appendChild(this.container),this.root=t.createRoot(this.container),this.root.render(o.jsx(zi,{...e,onAccept:()=>{this.close(),e.onAccept()},onDecline:()=>{this.close(),e.onDecline()}})))}close(){this.container&&document.body.contains(this.container)&&(this.root&&this.root.unmount(),document.body.removeChild(this.container),this.container=null,this.root=null)}}function Ai(e={}){const n=wr(),t=e.appName??n??"sua aplicação";e.appName;const o=e.flow??"verification";return new Promise((n=>{(new ji).show({appName:t,flow:o,privacyPolicyUrl:e.privacyPolicyUrl??Ti,retentionDays:e.retentionDays??90,onAccept:()=>n(!0),onDecline:()=>n(!1)})}))}const Fi={flow:"verification",privacyPolicyUrl:Ti,retentionDays:90};function Pi(e,n={}){const t=n.darkThreshold??.235,o=n.improvementTarget??.12,a=n.sampleIntervalMs??600,r=n.minToggleMs??3e3,i=n.zIndex??10001,s=`nfid-flash-${Math.random().toString(36).slice(2,9)}`;let c=null,d=null,l=!1,u=0,p=0,f=0,h=null,m=null,g=null;const v=e=>{l!==e&&(l=e,e?m||"undefined"==typeof document||(m=document.createElement("div"),m.id=s,m.setAttribute("aria-hidden","true"),m.style.cssText=`\n position: fixed; inset: 0; background: #FFFFFF;\n z-index: ${i}; pointer-events: none;\n opacity: 0; transition: opacity 200ms ease-out;\n `,document.body.appendChild(m),requestAnimationFrame((()=>{m&&(m.style.opacity="1")}))):(()=>{if(!m)return;const e=m;m=null,e.style.opacity="0",setTimeout((()=>{e.parentNode&&e.parentNode.removeChild(e)}),220)})(),n.onChange&&n.onChange(e,u))},b=()=>{"undefined"==typeof document||g||(g=document.createElement("canvas"));const n=Qr(e(),{scratch:g??void 0});u=n;const a=Date.now();l||(n>0&&n<t?p+=1:p=0,p>=2&&a-f>=r&&(h=n,f=a,p=0,v(!0),d=setTimeout((()=>{Qr(e(),{scratch:g??void 0})-(h??0)<o&&(f=Date.now(),v(!1)),h=null}),600)))};return{start(){!1!==n.enabled&&(c||(b(),c=setInterval(b,a)))},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 $i{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=Pi((()=>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 <span class="neofaceid-seal">Protegido por NeoFaceID</span>\n </div>\n </div>\n </div>\n `,lr(),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((()=>os)),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(),ur(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: 11px;\n font-weight: 700;\n letter-spacing: 0.09em;\n text-transform: uppercase;\n color: var(--nfid-text-subtle, #617489);\n }\n\n .neofaceid-status {\n text-align: center;\n margin-bottom: 20px;\n }\n\n .neofaceid-status-text {\n margin: 0;\n color: #666;\n font-size: 16px;\n }\n\n .neofaceid-modal-footer {\n padding: 20px;\n border-top: 1px solid #e0e0e0;\n display: flex;\n gap: 12px;\n justify-content: flex-end;\n }\n\n .neofaceid-cancel-btn,\n .neofaceid-capture-btn {\n padding: 12px 24px;\n border: none;\n border-radius: 6px;\n font-size: 16px;\n font-weight: 500;\n cursor: pointer;\n transition: all 0.2s;\n }\n\n .neofaceid-cancel-btn {\n background: #f5f5f5;\n color: #666;\n }\n\n .neofaceid-cancel-btn:hover {\n background: #e0e0e0;\n }\n\n .neofaceid-capture-btn {\n background: #0E9F6E;\n color: white;\n }\n\n .neofaceid-capture-btn:hover:not(:disabled) {\n background: #45a049;\n }\n\n .neofaceid-capture-btn:disabled {\n background: #ccc;\n cursor: not-allowed;\n }\n\n @keyframes pulse {\n 0% { box-shadow: 0 0 0 2px rgba(76, 175, 80, 0.3); }\n 50% { box-shadow: 0 0 0 10px rgba(76, 175, 80, 0.1); }\n 100% { box-shadow: 0 0 0 2px rgba(76, 175, 80, 0.3); }\n }\n\n @media (max-width: 640px) {\n .neofaceid-modal-overlay {\n padding: 10px;\n }\n \n .neofaceid-modal-header,\n .neofaceid-modal-body,\n .neofaceid-modal-footer {\n padding: 15px;\n }\n \n .neofaceid-frame {\n width: 150px;\n height: 150px;\n }\n }\n ")}}class Di{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,a=this.getStatusText(),r=["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;">${si(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 ${a?`\n <div class="neofaceid-status-text">\n ${a}${r?'\n <span class="neofaceid-dots">\n <span class="neofaceid-dot">.</span>\n <span class="neofaceid-dot">.</span>\n <span class="neofaceid-dot">.</span>\n </span>\n ':""}\n </div>\n `:""}\n </div>\n </div>\n `}show(e="preparing"){this.container?this.updateStatus(e):(this.container=document.createElement("div"),this.container.id="neofaceid-status-overlay",this.currentStatus=e,this.container.innerHTML=this.renderContent(),document.body.appendChild(this.container))}updateStatus(e){this.currentStatus=e,this.container&&(this.container.innerHTML=this.renderContent())}close(){if(this.container){const e=this.container.querySelector(".neofaceid-overlay-container");e&&e.classList.add("fade-out"),setTimeout((()=>{this.container&&document.body.contains(this.container)&&document.body.removeChild(this.container),this.container=null}),300)}}}function Li({error:e,onRetry:n,onCredentials:t,onCancel:a,applicationToken:r}){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"}),r&&o.jsx("button",{type:"button",className:"neofaceid-fallback-button neofaceid-fallback-button-ghost",onClick:()=>{new ci(r).open()},children:"Esqueceu sua senha?"}),a&&o.jsx("button",{type:"button",className:"neofaceid-fallback-button neofaceid-fallback-button-ghost",onClick:a,children:"Cancelar"})]})]})})]})}class Mi{constructor(){i(this,"container",null),i(this,"root",null)}show(e,n,o,a,r){this.container||(lr(),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,a,r))}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,a,r){this.root&&this.container&&this.root.render(o.jsx(Li,{error:e,onRetry:()=>{this.close(),n()},onCredentials:()=>{this.close(),t()},applicationToken:r??"",onCancel:()=>{this.close(),null==a||a()}}))}}class qi{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(){lr(),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 ${si(18)}\n <span>NeoFaceId by</span>\n <span class="neoface-email-brand-name">OCTA</span>\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)||ur(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"),a=this.modalElement.querySelector("#login-error"),r=e=>{a.textContent=e,a.style.display="block"};a.style.display="none",a.textContent="";const i=n.value.trim(),s=t.value.trim();if(i&&s){o.disabled=!0,o.textContent="Entrando...";try{const e=await Lr(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"))?(r("Email ou senha incorretos. Verifique seus dados e tente novamente."),t.value="",t.focus()):(r("Ocorreu um erro inesperado. Tente novamente mais tarde."),this.options.onError(c))}}else r("Preencha o email e a senha para continuar.")}}let Ui=!1,Bi=null;async function Wi(){if(!Ui)return Bi||(Bi=(async()=>{try{const e="/models";await d.nets.tinyFaceDetector.loadFromUri(e),Ui=!0}catch(e){}})(),Bi)}async function Vi(e,n,t=!1,o=!1){o?n.updateStatus("detecting"):n.updateStatus("preparing");const a=document.createElement("video");a.style.position="fixed",a.style.top="-9999px",a.style.left="-9999px",a.style.width="1px",a.style.height="1px",a.style.opacity="0",a.muted=!0,a.playsInline=!0,a.setAttribute("autoplay",""),a.setAttribute("playsinline",""),document.body.appendChild(a);let r=null;try{try{r=await navigator.mediaDevices.getUserMedia({video:{width:{ideal:640},height:{ideal:480},facingMode:"user"},audio:!1})}catch{r=await navigator.mediaDevices.getUserMedia({video:{facingMode:"user"},audio:!1})}a.srcObject=r,await new Promise((e=>{if(a.readyState>=1)e();else{const n=()=>{a.removeEventListener("loadedmetadata",n),e()};a.addEventListener("loadedmetadata",n),setTimeout(e,2e3)}})),await a.play(),await new Promise((e=>{if(a.videoWidth&&a.videoHeight)e();else{const n=()=>{a.videoWidth&&a.videoHeight?e():setTimeout(n,100)};setTimeout(e,3e3),n()}})),n.updateStatus("detecting"),await new Promise((e=>setTimeout(e,100)));let o=!0;if(t||(o=await async function(e,n=5e3,t=100,o){return new Promise((a=>{let r=0;const i=Math.ceil(n/t);let s=null,c=!1,l=!1;const u=Math.ceil(3e3/t),p=e=>{c||(c=!0,s&&clearTimeout(s),a(e))},f=async()=>{if(!c){if(r++,!Ui)return o&&!l&&r>=u&&(o.updateStatus("waiting-for-face"),l=!0),r>=i?void p(!1):void(s=window.setTimeout(f,t));try{if(await d.detectSingleFace(e,new d.TinyFaceDetectorOptions({inputSize:160,scoreThreshold:.3})))return o&&l&&(o.updateStatus("detecting"),l=!1),void p(!0);if(o&&!l&&r>=u&&(o.updateStatus("waiting-for-face"),l=!0),r>=i)return void p(!1);s=window.setTimeout(f,t)}catch(n){if(o&&!l&&r>=u&&(o.updateStatus("waiting-for-face"),l=!0),r>=i)return void p(!1);s=window.setTimeout(f,t)}}};window.setTimeout((()=>{c||p(!1)}),n+500),f()}))}(a,5e3,100,n)),!o)throw r&&r.getTracks().forEach((e=>e.stop())),a.parentElement&&a.parentElement.removeChild(a),new h("Nenhum rosto detectado. Por favor, posicione seu rosto na frente da câmera e tente novamente.",f.VALIDATION_ERROR);n.updateStatus("capturing");const i=document.createElement("canvas");i.width=a.videoWidth,i.height=a.videoHeight;const s=i.getContext("2d");if(!s)throw r&&r.getTracks().forEach((e=>e.stop())),a.parentElement&&a.parentElement.removeChild(a),new h("Erro ao capturar imagem",f.CAPTURE_ERROR);s.drawImage(a,0,0,i.width,i.height),r&&r.getTracks().forEach((e=>e.stop())),a.parentElement&&a.parentElement.removeChild(a);const c=await new Promise(((e,n)=>{i.toBlob((t=>{i.remove(),t?e(t):n(new Error("Failed to capture image"))}),"image/jpeg",.85)}));n.updateStatus("verifying");const l=await zr(c,e);if(!l.success)throw new h("Login falhou",f.LOGIN_FAILED);return l}catch(i){if(r&&r.getTracks().forEach((e=>e.stop())),a.parentElement&&a.parentElement.removeChild(a),i instanceof h)throw i;throw new h(i instanceof Error?i.message:"Erro desconhecido",f.UNKNOWN)}}async function Zi(e){const{applicationToken:n,onSuccess:t,onError:o,onFallbackRequest:a,onCancel:r,fastMode:i=!1}=e,s=new Di,c=new Mi;let d,l=0;Ui||i||Wi().catch((()=>{})),s.show("preparing");const u=async()=>{try{l++;const e=await Vi(n,s,i,l>1);s.updateStatus("success"),setTimeout((()=>{s.close(),t(e)}),200)}catch(e){d=e instanceof h?e:new h(e instanceof Error?e.message:"Erro desconhecido",f.UNKNOWN),s.updateStatus("error"),l<2?setTimeout((()=>{u()}),500):setTimeout((()=>{s.close(),c.show(d,(()=>{l=0,s.show("preparing"),setTimeout((()=>u()),500)}),(()=>{a?a():o(new h("Por favor, use email e senha para fazer login",f.LOGIN_FAILED))}),r,n)}),500)}};u()}const Ki=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 a=null,r=0;const i=()=>{a&&a.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=>{a=s,t.srcObject=a;const c=()=>{if(!t.videoWidth||!t.videoHeight)return r<30?(r++,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 a=o.getContext("2d");if(!a)return i(),void n(new Error("Failed to get canvas context"));(async()=>{if(!Ui)return!0;try{return!!(await d.detectSingleFace(t,new d.TinyFaceDetectorOptions({inputSize:160,scoreThreshold:.3})))}catch{return!0}})().then((s=>{if(!s&&r<30)return r++,void setTimeout(c,150);a.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:Zi,preloadFaceDetectionModels:Wi},Symbol.toStringTag,{value:"Module"})),Ji="Consentimento recusado pelo usuário.";async function Gi(e){if(await Ai({appName:e.appName,flow:"verification"}))try{await Zi({applicationToken:e.applicationToken,onSuccess:e.onSuccess,onError:e.onError,onFallbackRequest:e.onFallbackRequest||(()=>{const n={applicationToken:e.applicationToken,onSuccess:e.onSuccess,onError:e.onError,title:"Login Alternativo",subtitle:"Biometria não reconhecida. Por favor, informe email e senha."};new qi(n).open()}),onCancel:e.onCancel})}catch(n){e.onError(new h(`Erro ao inicializar login facial: ${n.message}`,f.INITIALIZATION_ERROR))}else e.onError(new h(Ji,f.CONSENT_DENIED))}async function Hi(e){if(await Ai({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 zr(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 $i(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(Ji,f.CONSENT_DENIED))}async function Xi(e){if(await Ai({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 zr(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 $i(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(Ji,f.CONSENT_DENIED))}async function Yi(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 a=n.startsWith("data:")?n:`data:image/jpeg;base64,${n}`;o.src=a}))),o=await async function(e){try{if("undefined"!=typeof window&&window.faceapi){const{faceapi:n}=window;await es();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 a=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 a=0,r=0;for(let l=0;l<n.length;l+=4){Qi(n[l],n[l+1],n[l+2])&&a++,r++}const i=a/r,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:a,totalPixels:r}}(t.getImageData(0,0,n.width,n.height));return{confidence:o.confidence,details:o}}catch(n){return{confidence:0}}}(t);return a.confidence>.6?{type:"hand",confidence:a.confidence,details:a.details}:{type:"unknown",confidence:Math.max(o.confidence,a.confidence)}}catch(t){return{type:"face",confidence:.5}}var n}function Qi(e,n,t){const o=.299*e+.587*n+.114*t,a=-.169*e-.331*n+.5*t+128,r=.5*e-.419*n-.081*t+128;return o>80&&o<255&&a>85&&a<135&&r>135&&r<180}async function es(){if("undefined"==typeof window||!window.faceapi)return;const{faceapi:e}=window;if(!e.nets.tinyFaceDetector.isLoaded)try{await Promise.all([e.nets.tinyFaceDetector.loadFromUri("/models"),e.nets.faceLandmark68Net.loadFromUri("/models")])}catch(n){}}async function ns(){try{"undefined"!=typeof window&&await es()}catch(e){}}function ts(){return"undefined"!=typeof window&&window.faceapi&&window.faceapi.nets.tinyFaceDetector.isLoaded}const os=Object.freeze(Object.defineProperty({__proto__:null,detectBiometricType:Yi,initializeBiometricDetection:ns,isAdvancedDetectionAvailable:ts},Symbol.toStringTag,{value:"Module"}));let as=null;function rs(){as=null}async function is({applicationToken:e,purpose:n}){if(!e)throw new h("applicationToken é obrigatório para abrir sessão de captura",f.INVALID_TOKEN);const t=`${br()}/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 a=await o.json().catch((()=>null)),r=(null==a?void 0:a.data)??a,i=null==r?void 0:r.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==r?void 0:r.expires_at)&&r.expires_at.length>0?r.expires_at:function(e){const n="number"==typeof e&&Number.isFinite(e)?e:0;return new Date(Date.now()+1e3*n).toISOString()}(null==r?void 0:r.expires_in);return as={session_id:i,expires_at:s},as}async function ss({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=`${br()}/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 a=await o.json().catch((()=>null)),r=(null==a?void 0:a.data)??a,i=null==r?void 0:r.steps,s=null==r?void 0:r.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==r?void 0:r.expires_in)?r.expires_in:void 0,u="string"==typeof(null==r?void 0:r.expires_at)&&r.expires_at.length>0?r.expires_at:void 0!==l?new Date(Date.now()+1e3*l).toISOString():void 0;return{challenge_id:"string"==typeof(null==r?void 0:r.challenge_id)?r.challenge_id:void 0,gestures:d,expires_at:u,expires_in:l,language:"string"==typeof(null==r?void 0:r.language)?r.language:void 0}}async function cs({applicationToken:e,purpose:n,collectFramesForGesture:t,retryOnSessionExpired:o=!0}){const a=async()=>{const o=await is({applicationToken:e,purpose:n}),a=await ss({sessionId:o.session_id,applicationToken:e}),r=[];for(let e=0;e<a.gestures.length;e+=1){const n=a.gestures[e],o=await t(n,e,a.gestures.length);r.push({gesture_key:String(n.gesture_key),images:o})}return{sessionId:o.session_id,challenge:a,capturedGestures:r}};try{return await a()}catch(r){if(o&&r instanceof h&&r.message.includes("410"))return rs(),a();throw r}}class ds{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 <span class="neofaceid-seal">Protegido por NeoFaceID</span>\n </div>\n </div>\n `,lr(),ur("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:11px; font-weight:700; letter-spacing:0.09em; 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=Pi((()=>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 a=setInterval((()=>{o-=1,n.textContent=String(o),o<=0&&(clearInterval(a),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"),a=this.overlay.querySelector(".neofaceid-frame");t.textContent=e,o.textContent=n,"document"===this.step&&(a.style.borderRadius="8px",a.style.width="280px",a.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 ls=["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 us({open:e,onDismiss:t,dismissOnOverlay:a=!0,ariaLabel:r,ariaLabelledBy:i,children:s,className:c,style:d}){if(n.useEffect((()=>{lr()}),[]),!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(${ir})`,backdropFilter:"blur(3px)",WebkitBackdropFilter:"blur(3px)"},onClick:()=>{a&&t&&t()},children:o.jsx("div",{role:"dialog","aria-modal":"true","aria-label":r,"aria-labelledby":i,className:c,onClick:e=>e.stopPropagation(),style:{background:`var(${Xa})`,color:`var(${er})`,borderRadius:`var(${cr}, 16px)`,padding:28,maxWidth:440,width:"100%",boxShadow:"0 1px 3px rgba(10,19,32,.08)",boxSizing:"border-box",...d},children:s})})}const ps={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},fs=n.forwardRef((({variant:e="primary",style:n,type:t="button",...a},r)=>{const i="primary"===e?{background:`var(${or})`,color:`var(${ar})`}:"secondary"===e?{background:`var(${Ya})`,color:`var(${er})`}:{background:"transparent",color:`var(${nr})`};return o.jsx("button",{ref:r,type:t,...a,style:{...ps,...i,...n}})}));function hs({size:e=96,color:n,strokeWidth:t,glow:a=!1,className:r,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:r,style:{color:n??`var(${or})`,filter:a?"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 ms({progress:e,size:n=268,children:t,className:a,style:r}){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:a,style:{position:"relative",width:l,height:l,display:"inline-flex",alignItems:"center",justifyContent:"center",...r},children:[o.jsx("div",{style:{position:"absolute",inset:0},children:o.jsx(hs,{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(${or}, url(#nfid-challenge-arc))`,strokeWidth:4.2,strokeLinecap:"round",strokeDasharray:c,strokeDashoffset:d,fill:"none",style:{transition:"stroke-dashoffset 200ms ease-out"}})]})]})}function gs({gesture:e,size:n=48,color:t,className:a,style:r}){return o.jsxs("svg",{width:n,height:n,viewBox:"0 0 48 48",xmlns:"http://www.w3.org/2000/svg",className:a,style:{color:t??`var(${or})`,...r},role:"img","aria-label":vs[e],children:["blink"===e?o.jsx(ws,{stroke:3.4}):o.jsx(bs,{stroke:3.4}),"blink"!==e&&"center"!==e&&o.jsx(ys,{gesture:e,stroke:3.4})]})}fs.displayName="Button";const vs={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 bs({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 ws({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 ys({gesture:e,stroke:n}){const[t,a,r]=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 ${a} L ${r}`,fill:"none",stroke:"currentColor",strokeWidth:n,strokeLinecap:"round",strokeLinejoin:"round"})}function xs({tone:e,children:n,icon:t,className:a}){const r=Wa[e];return o.jsxs("span",{className:a,style:{display:"inline-flex",alignItems:"center",gap:6,padding:"4px 10px",borderRadius:9999,background:r.bg,color:r.fg,fontSize:13,fontWeight:600,fontFamily:"inherit",lineHeight:1.3},children:[t,n]})}const ks={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"]},Es={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 _s={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 Rs(){n.useEffect((()=>{lr(),ur("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 Ns({appName:e,onContinue:n}){return Rs(),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(fs,{variant:"primary",onClick:n,children:"Continuar"})})]})}function Ts({errorCode:e,attempt:n,maxAttempts:t,timestamp:a,onRetry:r,onFallback:i}){Rs();const s=function(e){if(!e)return ks;const n=e.toUpperCase();return Es[n]??ks}(e),c=a??new Date;return o.jsxs("div",{className:"nfid-state",role:"alert","aria-live":"assertive",children:[o.jsxs(xs,{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(fs,{variant:"primary",onClick:r,children:"Tentar de novo"}),o.jsx(fs,{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 Os({browser:e,onFallback:n,onCancel:t}){Rs();const a=function(e){return _s[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:a}),o.jsxs("div",{className:"nfid-state-actions",children:[o.jsx(fs,{variant:"primary",onClick:n,children:"Verificar de outro jeito"}),o.jsx(fs,{variant:"ghost",onClick:t,children:"Agora não"})]})]})}const Is={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"},Ss={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 Cs({applicationToken:e,appName:t,amount:a,onChallengeStart:r,onChallengeComplete:i,onSuccess:s,onError:c,onCancel:d,autoLighting:l=!0,onClose:u}){const p=n.useRef(null),[m,g]=n.useState(0),[v,b]=n.useState(null),[w,y]=n.useState("preparing"),[x,k]=n.useState(1),[E,_]=n.useState(void 0),[R,N]=n.useState(void 0),[T,O]=n.useState(0),I=n.useRef(!1),[S,C]=n.useState(!1),{flashOn:z}=ei(p,{enabled:l&&!S&&"challenging"===w}),j=yr(),A=t??wr()??"sua aplicação",F="number"==typeof a&&Number.isFinite(a)?function(e,n){try{return new Intl.NumberFormat(n,{style:"currency",currency:"BRL"}).format(e)}catch{return`R$ ${e.toFixed(2)}`}}(a,j):null;n.useEffect((()=>{lr(),ur("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: 11px; font-weight: 700; letter-spacing: 0.09em; 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: 11px; font-weight: 700; letter-spacing: 0.09em; 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 I.current=!1,y("preparing"),g(0),b(null),async function(){try{try{n=await navigator.mediaDevices.getUserMedia({video:{facingMode:"user",width:{ideal:1280},height:{ideal:720}}})}catch(t){const e=function(e){if(!e||"object"!=typeof e)return"UNKNOWN";const n=(e.name??"").toString();return"NotAllowedError"===n||"SecurityError"===n?"PERMISSION_DENIED":"NotFoundError"===n||"OverconstrainedError"===n?"NO_CAMERA":"NotReadableError"===n||"TrackStartError"===n?"IN_USE":"UNKNOWN"}(t);if("PERMISSION_DENIED"===e)return void y("permission-denied");throw new h("NO_CAMERA"===e?"Câmera não encontrada":"IN_USE"===e?"Câmera em uso por outro app":"Falha ao acessar a câmera",f.CAMERA_ERROR)}p.current&&(p.current.srcObject=n,p.current.play().catch((()=>{}))),y("challenging");const o=await cs({applicationToken:e,purpose:"authorization",collectFramesForGesture:async(e,n,t)=>{if(I.current)throw new h("Cancelado",f.UNKNOWN);b(e),g(0),r&&r(e,n,t),await async function(e){const n=1500,t=Date.now();return new Promise((o=>{const a=()=>{const r=Date.now()-t,i=Math.min(1,r/n);e(i),r>=n?o():setTimeout(a,50)};a()}))}(g),i&&i(e,n,t);const o=await async function(e){if(!e||0===e.videoWidth)return null;const n=document.createElement("canvas");n.width=e.videoWidth,n.height=e.videoHeight;const t=n.getContext("2d");return t?(t.drawImage(e,0,0),n.toDataURL("image/jpeg",.85)):null}(p.current);return o?[o]:[]}});n&&n.getTracks().forEach((e=>e.stop())),n=null,y("success"),s&&s(o)}catch(o){if(I.current)return;const e=o instanceof h?o:new h(o instanceof Error?o.message:"Falha",f.UNKNOWN);_(e.type),N(new Date),y("failure"),c&&c(e)}finally{n&&n.getTracks().forEach((e=>e.stop()))}}(),()=>{I.current=!0,n&&n.getTracks().forEach((e=>e.stop()))}}),[T]);const P=()=>{I.current=!0,d&&d(),u()},$=()=>{x>=3?P():(k((e=>e+1)),_(void 0),N(void 0),O((e=>e+1)))},D=()=>{I.current=!0,c&&c(new h("Fluxo alternativo solicitado pelo usuário",f.CONSENT_DENIED)),u()},L=v?Is[v.gesture_key]??"center":"center",M=v?Ss[v.gesture_key]??"Siga a instrução":"Preparando a câmera…";return"success"===w?o.jsx(us,{open:!0,dismissOnOverlay:!1,ariaLabel:"Identidade confirmada",children:o.jsx(Ns,{appName:A,onContinue:u})}):"permission-denied"===w?o.jsx(us,{open:!0,dismissOnOverlay:!1,ariaLabel:"Câmera bloqueada",children:o.jsx(Os,{onFallback:D,onCancel:P})}):"failure"===w?o.jsx(us,{open:!0,dismissOnOverlay:!1,ariaLabel:"Não foi possível confirmar",children:o.jsx(Ts,{errorCode:E,attempt:x,maxAttempts:3,timestamp:R,onRetry:$,onFallback:D})}):o.jsxs(us,{open:!0,onDismiss:void 0,dismissOnOverlay:!1,ariaLabel:"Autorização por biometria",children:[o.jsx(ni,{active:z,onDismiss:()=>C(!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(ms,{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(gs,{gesture:L,size:40}),o.jsx("p",{className:"nfid-authorize-instruction","aria-live":"assertive",style:{margin:0},children:M})]}),"preparing"===w&&o.jsx("p",{className:"nfid-authorize-support",children:"Ligando sua câmera…"}),o.jsx("div",{className:"nfid-authorize-actions",children:o.jsx(fs,{variant:"ghost",onClick:P,children:"Não consigo fazer esse movimento"})}),o.jsx("div",{className:"nfid-authorize-footer",children:o.jsx("span",{className:"nfid-authorize-seal",children:"Protegido por NeoFaceID"})})]})]})}const zs={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 js{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),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 Ai({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 ',lr(),ur("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(zs).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?zs[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?zs[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 ${si(18)}\n <span class="neoface-doc-brand-name-text">NeoFaceId</span>\n <span class="neoface-doc-brand-text">by</span>\n <span class="neoface-doc-brand-name">OCTA</span>\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 a=null==(e=this.overlay)?void 0:e.querySelector(".neoface-doc-capture-btn"),r=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==a||a.addEventListener("click",(()=>this.handleCapture())),null==r||r.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 a=null==(t=this.overlay)?void 0:t.querySelector(".neoface-doc-loading");a&&(a.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(r){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 new Promise(((n,t)=>{const o=new Image;o.onload=()=>{const e=1280;let{width:a}=o,{height:r}=o;a>r&&a>e?(r=r*e/a,a=e):r>e&&(a=a*e/r,r=e);const i=document.createElement("canvas");i.width=a,i.height=r;const s=i.getContext("2d");s?(s.drawImage(o,0,0,a,r),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=URL.createObjectURL(e)}))}bindPreviewEvents(){var e,n,t;const o=null==(e=this.overlay)?void 0:e.querySelector(".neoface-doc-confirm-btn"),a=null==(n=this.overlay)?void 0:n.querySelector(".neoface-doc-retake-btn");null==o||o.addEventListener("click",(()=>this.handleConfirm())),null==a||a.addEventListener("click",(()=>this.handleRetake()));const r=null==(t=this.overlay)?void 0:t.querySelector(".neoface-doc-preview-current");if(r){const e="preview-front"===this.currentStep?this.frontBlob:this.backBlob;e&&(r.src=URL.createObjectURL(e))}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(a){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=Pi((()=>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:a}=this.video,r=Math.floor(.75*o),i=Math.floor(.65*a),s=Math.floor((o-r)/2),c=Math.floor((a-i)/2);this.canvas.width=r,this.canvas.height=i,t.drawImage(this.video,s,c,r,i,0,0,r,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?zs[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.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 As=async e=>new js(e).open(),Fs=Object.freeze(Object.defineProperty({__proto__:null,DocumentCaptureModal:js,startDocumentCapture:As},Symbol.toStringTag,{value:"Module"})),Ps="Consentimento recusado pelo usuário.";e.BiometricCaptureModal=$i,e.BiometricRegistrationModal=Ni,e.BiometricStatusOverlay=Di,e.ConsentModal=ji,e.DEFAULT_CONSENT_INFO=Fi,e.DocumentCaptureModal=js,e.ENVIRONMENT_URLS=hr,e.EmailPasswordModal=qi,e.ErrorType=f,e.FaceCaptureModal=ai,e.FallbackPrompt=Mi,e.ForgotPasswordModal=ci,e.NeoFaceError=h,e.NeoFaceID=class{constructor(e){if(i(this,"appToken"),i(this,"signature"),i(this,"sessionData"),this.appToken=e.appToken,this.signature=e.signature,this.sessionData=e.sessionData,this.signature&&!this.validateSignatureFormat(this.signature))throw new h("Invalid signature format. Expected HMAC-SHA256 hex string (minimum 64 characters)",f.VALIDATION_ERROR);if(this.sessionData&&(!this.sessionData.email||!this.sessionData.cpf||!this.sessionData.sessionId))throw new h("Session data must include email, cpf, and sessionId",f.VALIDATION_ERROR)}validateSignatureFormat(e){return/^[a-f0-9]{64,}$/i.test(e)}async captureFaceFrames(e){const{numFrames:n,livenessCheck:t}=e;if(n<1||n>10)throw new h("Number of frames must be between 1 and 10",f.VALIDATION_ERROR);const o=[];try{const{captureFaceSilently:e}=await Promise.resolve().then((()=>Ki));for(let a=0;a<n;a++){const r=await e();o.push(r),t&&a<n-1&&await new Promise((e=>setTimeout(e,300)))}return o}catch(a){if(a instanceof h)throw a;throw new h(`Failed to capture face frames: ${a instanceof Error?a.message:"Unknown error"}`,f.CAPTURE_ERROR)}}async loginRecognition(e){const{biometricData:n,purpose:t,confidenceThreshold:o=.8}=e,a=Array.isArray(n)?n:[n];if(0===a.length)throw new h("At least one biometric data frame is required",f.VALIDATION_ERROR);const r=a[0];try{const e=await Fr(r,this.appToken,t,o,this.signature,this.sessionData);if(!e.success)throw new h("Recognition failed",f.RECOGNITION_FAILED);if(!e.personName||!e.email||!e.cpf)throw new h("Incomplete recognition result: missing personName, email, or cpf",f.RECOGNITION_FAILED);return{success:!0,personName:e.personName,email:e.email,cpf:e.cpf,signature:e.signature,sessionId:e.sessionId,confidenceScore:e.confidenceScore,accessToken:e.accessToken}}catch(i){if(i instanceof h)throw i;throw new h(`Login recognition failed: ${i instanceof Error?i.message:"Unknown error"}`,f.RECOGNITION_FAILED)}}async registerApplication(e,n,t){try{return await Ur(e,n,t)}catch(o){if(o instanceof h)throw o;throw new h(`Application registration failed: ${o instanceof Error?o.message:"Unknown error"}`,f.VALIDATION_ERROR)}}async registerDocumentByImage(e,n,t={}){const{DocumentCaptureModal:o}=await Promise.resolve().then((()=>Fs)),a=new o({useBackCamera:t.useBackCamera??!0,preSelectedDocument:t.preSelectedDocument}),r=await a.open();if(!r.success||!r.frontImage)throw new h("cancelled"===r.error?"Document capture was cancelled by the user":`Document capture failed: ${r.error??"unknown error"}`,f.CAPTURE_ERROR);const i=[r.frontImage];return r.backImage&&i.push(r.backImage),Kr(e,n,i)}async proofOfLife(e={}){const{videoDurationMs:n=3e3,maxPollingAttempts:t=60,pollingIntervalMs:o=1e3,onRecordingProgress:a,onTaskStatusChange:r}=e;try{const e=await Br({durationMs:n,onProgress:a}),i=await Zr(e),s=await Vr(i,this.appToken);r&&r("processing",0);const c=await Wr(s.taskId,this.appToken,{maxAttempts:t,intervalMs:o,onStatusChange:r});return c&&c.success?{success:!0,isLive:c.is_live||!1,livenessScore:c.liveness_score||0,faceRecognitionScore:c.face_recognition_score||0,combinedConfidence:c.combined_confidence||0,personId:c.person_id,personalData:c.personal_data||[],processingTime:c.processing_time||0,historyId:s.historyId,taskId:s.taskId,message:"Proof of life verification successful"}:{success:!1,isLive:(null==c?void 0:c.is_live)||!1,livenessScore:(null==c?void 0:c.liveness_score)||0,faceRecognitionScore:(null==c?void 0:c.face_recognition_score)||0,combinedConfidence:(null==c?void 0:c.combined_confidence)||0,personId:null==c?void 0:c.person_id,personalData:(null==c?void 0:c.personal_data)||[],processingTime:(null==c?void 0:c.processing_time)||0,historyId:s.historyId,taskId:s.taskId,error:(null==c?void 0:c.error)||"Verification failed",message:(null==c?void 0:c.message)||"Proof of life verification failed"}}catch(i){if(i instanceof h)throw i;throw new h(`Proof of life failed: ${i instanceof Error?i.message:"Unknown error"}`,f.RECOGNITION_FAILED)}}},e.RELEASE_DATE="2026-09-05",e.VERSION="1.37.0",e.authorize=async function(e){if(!(await Ai({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 a=t.createRoot(n);a.render(o.jsx(Cs,{...e,onClose:()=>{a.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 a=[],r=(null==t?void 0:t.captureDelay)||2e3;if(!(await Ai({appName:null==t?void 0:t.appName,flow:"verification"})))throw new h("Consentimento recusado pelo usuário.",f.CONSENT_DENIED);try{if(!navigator.mediaDevices||!navigator.mediaDevices.getUserMedia)throw new h("Camera not available",f.NO_CAMERA);const n=await navigator.mediaDevices.getUserMedia({video:{facingMode:"user",width:{ideal:1280},height:{ideal:720}}}),i=document.createElement("video");i.srcObject=n,i.autoplay=!0,i.playsInline=!0,await new Promise((e=>{i.onloadedmetadata=()=>{i.play(),e()}}));const s=document.createElement("canvas");s.width=i.videoWidth,s.height=i.videoHeight;const c=s.getContext("2d");if(!c)throw new h("Failed to get canvas context",f.CAPTURE_ERROR);for(let e=0;e<4;e++){const n=ls[e];(null==t?void 0:t.onProgress)&&t.onProgress(e+1,4,n),e>0&&await new Promise((e=>setTimeout(e,r))),c.drawImage(i,0,0,s.width,s.height);const o=await new Promise(((e,n)=>{s.toBlob((t=>{t?e(t):n(new Error("Failed to capture photo"))}),"image/jpeg",.9)}));a.push(o),(null==t?void 0:t.onPhotoTaken)&&t.onPhotoTaken(e+1,o)}n.getTracks().forEach((e=>e.stop()));const d=a[3],l={cpf:o,email:"",sessionId:`auth_${Date.now()}_${Math.random().toString(36).substring(7)}`},u=await Fr(d,e,"AUTHORIZATION",.8,void 0,l);if(!u.success)throw new h("Authorization failed: Person not recognized",f.RECOGNITION_FAILED);return{success:!0,authorizationHash:l.sessionId,name:u.personName,birthDate:void 0,cpf:u.cpf||o,confidenceScore:u.confidenceScore,message:"Authorization successful"}}catch(i){if(i instanceof h)throw i;if(i instanceof Error)throw new h(i.message,f.CAPTURE_ERROR);throw new h("Unknown error during authorization",f.UNKNOWN)}},e.biometricLogin=function(e,n="auto"){return new Promise(((t,o)=>{const a={applicationToken:e,onSuccess:t,onError:o};switch(n){case"face":Gi(a);break;case"hand":Hi(a);break;case"auto":Xi(a);break;default:o(new h("Modo de login inválido",f.VALIDATION_ERROR))}}))},e.biometricLoginWithFallback=function(e,n="auto"){return new Promise(((t,o)=>{const a={applicationToken:e,onSuccess:t,onError:n=>{if(n.type===f.LOGIN_FAILED){new qi({applicationToken:e,onSuccess:t,onError:o,title:"Login Alternativo",subtitle:"Biometria não reconhecida. Por favor, informe email e senha."}).open()}else o(n)}};switch(n){case"face":Gi(a);break;case"hand":Hi(a);break;case"auto":Xi(a);break;default:o(new h("Modo de login inválido",f.VALIDATION_ERROR))}}))},e.checkUserExistence=$r,e.completeOnboarding=Ir,e.completeOnboardingWithData=Sr,e.confirmPasswordReset=Xr,e.detectBiometricType=Yi,e.getAccent=function(){return gr.accent},e.getAppName=wr,e.getApplicationToken=function(){return gr.applicationToken},e.getBaseUrl=br,e.getCachedCaptureSession=function(){return as},e.getConfig=function(){return{...gr}},e.getConsent=function(){return{...gr.consent}},e.getEnvironment=function(){return gr.environment},e.getLocale=yr,e.getRadius=function(){return gr.radius},e.getResolvedThemeMode=function(){var e;return(null==(e=gr.resolvedTheme)?void 0:e.mode)??("dark"===gr.theme?"dark":"light")},e.getTheme=function(){return gr.theme},e.identifyPerson=Mr,e.identifyPersonAsync=Gr,e.init=function(e={}){const{environment:n,baseUrl:t,applicationToken:o,appName:a,accent:r,radius:i,theme:c,locale:d,consent:l}=e;if(l?gr.consent=l:(gr.consent={...fr},vr||(vr=!0)),t)gr.baseUrl=t,gr.environment="custom";else if(n)hr[n]?(gr.baseUrl=hr[n],gr.environment=n):(gr.baseUrl=hr.sandbox,gr.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==pr?void 0:pr.VITE_API_BASE_URL);e&&(gr.baseUrl=e,gr.environment="custom")}o&&(gr.applicationToken=o),a&&a.trim()&&(gr.appName=a.trim()),void 0!==i&&(mr.includes(i)?gr.radius=i:gr.radius=16),c&&(gr.theme=c),d&&(gr.locale=d),void 0!==r&&(gr.accent=r);const u=Ga({accent:gr.accent??void 0,radius:gr.radius,theme:gr.theme});gr.resolvedTheme=u,lr({accent:gr.accent??void 0,radius:gr.radius,theme:gr.theme}),gr.initialized=!0},e.initializeBiometricDetection=ns,e.isAdvancedDetectionAvailable=ts,e.isInitialized=function(){return gr.initialized},e.loginWithBiometric=zr,e.loginWithEmail=Lr,e.openCaptureSession=is,e.preloadFaceDetectionModels=Wi,e.recognize=Cr,e.recognizeBiometric=jr,e.recognizeByPurpose=Fr,e.registerBiometric=qr,e.registerPersonWithBiometric=Dr,e.registerPersonWithoutFace=Pr,e.requestConsent=Ai,e.requestLivenessChallenge=ss,e.requestLivenessChallengeWithSession=async function({applicationToken:e,purpose:n,sessionId:t}){let o=t??(await is({applicationToken:e,purpose:n})).session_id;try{return await ss({sessionId:o,applicationToken:e})}catch(a){if(a instanceof h&&a.message.includes("410"))return rs(),o=(await is({applicationToken:e,purpose:n})).session_id,ss({sessionId:o,applicationToken:e});throw a}},e.requestPasswordReset=Hr,e.resetCaptureSession=rs,e.runLivenessChallenge=cs,e.simpleIdentification=Ar,e.start=function(e,o,a){Ai({appName:null==a?void 0:a.appName,flow:"verification"}).then((r=>{if(!r)return void o.onError("CONSENT_DENIED",Ps);const i=document.createElement("div");i.id="neoface-modal-container",document.body.appendChild(i);const s=()=>{document.body.contains(i)&&document.body.removeChild(i)};Nr(e).then((()=>{const r=n.createElement(ai,{accessToken:e,onClose:s,onSuccess:e=>{s(),o.onSuccess({name:e.data.faceId,email:e.data.faceId,documentId:e.data.faceId})},onCannotGesture:null==a?void 0:a.onCannotGesture});t.createRoot(i).render(r)})).catch((e=>{s(),o.onError("TOKEN_VALIDATION_ERROR",e.message||"Failed to validate token")}))}))},e.startAutoLogin=Xi,e.startBiometricRegistration=function(e,o,a,r){Ai({appName:null==r?void 0:r.appName,flow:"registration"}).then((i=>{if(!i)return void a.onError("CONSENT_DENIED",Ps);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)};Nr(o).then((()=>{const i=n.createElement(Ni,{personData:e,applicationToken:o,useRealApi:(null==r?void 0:r.useRealApi)??!0,onClose:d,onSuccess:e=>{d(),a.onSuccess(e)},onError:e=>{d(),a.onError("BIOMETRIC_REGISTRATION_ERROR",e)},onCannotGesture:null==r?void 0:r.onCannotGesture});c=t.createRoot(s),c.render(i)})).catch((e=>{d(),a.onError("TOKEN_VALIDATION_ERROR",e.message||"Failed to validate token")}))}))},e.startDocumentCapture=As,e.startFaceLogin=Gi,e.startHandLogin=Hi,e.startLivenessCapture=function(e,o,a){Ai({appName:null==a?void 0:a.appName,flow:"verification"}).then((r=>{if(!r)return void o.onError("CONSENT_DENIED",Ps);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()};Nr(e).then((()=>{const r=n.createElement(Ni,{applicationToken:e,onClose:l,onPhotosCaptured:e=>{s=!0,o.onSuccess(e)},onError:e=>{d(),o.onError("LIVENESS_CAPTURE_ERROR",e)},onCannotGesture:null==a?void 0:a.onCannotGesture});c=t.createRoot(i),c.render(r)})).catch((e=>{d(),o.onError("TOKEN_VALIDATION_ERROR",e.message||"Failed to validate token")}))}))},e.startOnboarding=async e=>{const{applicationToken:n,onboardingToken:t,countdown:o,title:a,subtitle:r,onSuccess:i,onError:s}=e;try{if(!(await Ai({appName:e.appName,flow:"registration"})))return void s(new h("Consentimento recusado pelo usuário.",f.CONSENT_DENIED));const c=await Tr(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 ds({countdown:o,title:a,subtitle:r}),{face:l,document:u}=await d.open();i({...await Ir(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 a=e?`${encodeURIComponent(e)}/submit/`:"submit/",r=`${br()}/api/v1/auth/liveness/challenge/${a}`;let i;try{i=await fetch(r,{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=Or,e.validateToken=Nr,e.withCaptureSession=async function(e,n){const t=as??await is(e);try{return await n(t.session_id)}catch(o){if(o instanceof h&&o.message.includes("410")){rs();return n((await is(e)).session_id)}throw o}},e.withSessionId=function(e){const n=as;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,a){"use strict";var r=Object.defineProperty,i=(e,n,t)=>((e,n,t)=>n in e?r(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(a);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),a=n.useRef(!1);return{startCamera:n.useCallback((async n=>{const t=e.current;if(t)return t.getStream();if(a.current){await new Promise((e=>setTimeout(e,100)));const n=e.current;if(n)return n.getStream()}a.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}})(),r=await navigator.mediaDevices.getUserMedia(t),i=new u(r);return e.current=i,o(!0),a.current=!1,r}catch(r){if(a.current=!1,r instanceof Error){if("NotAllowedError"===r.name||"PermissionDeniedError"===r.name)throw new l("Permissão para acessar a câmera foi negada pelo usuário");if("NotFoundError"===r.name||"DevicesNotFoundError"===r.name)throw new Error("Nenhuma câmera foi encontrada no dispositivo");if("NotReadableError"===r.name||"TrackStartError"===r.name)throw new Error("A câmera já está sendo usada por outro aplicativo");if("OverconstrainedError"===r.name||"ConstraintNotSatisfiedError"===r.name)throw new Error("As configurações solicitadas não são suportadas pela câmera")}throw new Error(`Erro ao inicializar câmera: ${r instanceof Error?r.message:String(r)}`)}}),[]),stopCamera:n.useCallback((n=>{const t=e.current;t&&t.getStream()===n&&(t.stop(),e.current=null,o(!1),a.current=!1)}),[]),cleanup:n.useCallback((()=>{e.current&&(e.current.stop(),e.current=null,o(!1),a.current=!1)}),[]),isActive:t}};var f=(e=>(e.NETWORK="NetworkError",e.NETWORK_ERROR="NetworkError",e.INVALID_TOKEN="InvalidTokenError",e.RECOGNITION_FAILED="RecognitionFailedError",e.LOGIN_FAILED="LoginFailedError",e.VALIDATION_ERROR="ValidationError",e.API_ERROR="ApiError",e.PERSON_NOT_FOUND="PersonNotFoundError",e.INITIALIZATION_ERROR="InitializationError",e.CAMERA_ERROR="CameraError",e.NO_CAMERA="NoCameraError",e.CAPTURE_ERROR="CaptureError",e.NOT_FOUND="NotFoundError",e.UNKNOWN="UnknownError",e.CONSENT_DENIED="ConsentDeniedError",e))(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"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 a=i.prototype,r=Object.keys(a);for(let e=0;e<r.length;e++){const n=r[e];n in t||(t[n]=a[n].bind(t))}}const a=(null==t?void 0:t.Parent)??Object;class r extends a{}function i(e){var n;const a=(null==t?void 0:t.Parent)?new r:this;o(a,e),(n=a._zod).deferred??(n.deferred=[]);for(const t of a._zod.deferred)t();return a}return Object.defineProperty(r,"name",{value:e}),Object.defineProperty(i,"init",{value:o}),Object.defineProperty(i,Symbol.hasInstance,{value:n=>{var o,a;return!!((null==t?void 0:t.Parent)&&n instanceof t.Parent)||(null==(a=null==(o=null==n?void 0:n._zod)?void 0:o.traits)?void 0:a.has(e))}}),Object.defineProperty(i,"name",{value:e}),i}class g extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class v extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name="ZodEncodeError"}}const b={};function w(e){return b}function y(e){const n=Object.values(e).filter((e=>"number"==typeof e));return Object.entries(e).filter((([e,t])=>-1===n.indexOf(+e))).map((([e,n])=>n))}function x(e,n){return"bigint"==typeof n?n.toString():n}function k(e){return{get value(){{const n=e();return Object.defineProperty(this,"value",{value:n}),n}}}}function E(e){return null==e}function _(e){const n=e.startsWith("^")?1:0,t=e.endsWith("$")?e.length-1:e.length;return e.slice(n,t)}const R=Symbol("evaluating");function N(e,n,t){let o;Object.defineProperty(e,n,{get(){if(o!==R)return void 0===o&&(o=R,o=t()),o},set(t){Object.defineProperty(e,n,{value:t})},configurable:!0})}function T(e,n,t){Object.defineProperty(e,n,{value:t,writable:!0,enumerable:!0,configurable:!0})}function O(...e){const n={};for(const t of e){const e=Object.getOwnPropertyDescriptors(t);Object.assign(n,e)}return Object.defineProperties({},n)}function I(e){return JSON.stringify(e)}const S="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function C(e){return"object"==typeof e&&null!==e&&!Array.isArray(e)}const z=k((()=>{var e;if("undefined"!=typeof navigator&&(null==(e=null==navigator?void 0:navigator.userAgent)?void 0:e.includes("Cloudflare")))return!1;try{return new Function(""),!0}catch(n){return!1}}));function j(e){if(!1===C(e))return!1;const n=e.constructor;if(void 0===n)return!0;if("function"!=typeof n)return!0;const t=n.prototype;return!1!==C(t)&&!1!==Object.prototype.hasOwnProperty.call(t,"isPrototypeOf")}function A(e){return j(e)?{...e}:Array.isArray(e)?[...e]:e}const F=new Set(["string","number","symbol"]);function 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 q(e,n){return n.map((n=>{var t;return(t=n).path??(t.path=[]),n.path.unshift(e),n}))}function U(e){return"string"==typeof e?e:null==e?void 0:e.message}function B(e,n,t){var o,a,r,i,s,c;const d={...e,path:e.path??[]};if(!e.message){const l=U(null==(r=null==(a=null==(o=e.inst)?void 0:o._zod.def)?void 0:a.error)?void 0:r.call(a,e))??U(null==(i=null==n?void 0:n.error)?void 0:i.call(n,e))??U(null==(s=t.customError)?void 0:s.call(t,e))??U(null==(c=t.localeError)?void 0:c.call(t,e))??"Invalid input";d.message=l}return delete d.inst,delete d.continue,(null==n?void 0:n.reportInput)||delete d.input,d}function W(e){return Array.isArray(e)?"array":"string"==typeof e?"string":"unknown"}function V(...e){const[n,t,o]=e;return"string"==typeof n?{message:n,code:"custom",input:t,inst:o}:{...n}}const Z=(e,n)=>{e.name="$ZodError",Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:n,enumerable:!1}),e.message=JSON.stringify(n,x,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},K=m("$ZodError",Z),J=m("$ZodError",Z,{Parent:Error});const G=e=>(n,t,o,a)=>{const r=o?Object.assign(o,{async:!1}):{async:!1},i=n._zod.run({value:t,issues:[]},r);if(i instanceof Promise)throw new g;if(i.issues.length){const n=new((null==a?void 0:a.Err)??e)(i.issues.map((e=>B(e,r,w()))));throw S(n,null==a?void 0:a.callee),n}return i.value},H=e=>async(n,t,o,a)=>{const r=o?Object.assign(o,{async:!0}):{async:!0};let i=n._zod.run({value:t,issues:[]},r);if(i instanceof Promise&&(i=await i),i.issues.length){const n=new((null==a?void 0:a.Err)??e)(i.issues.map((e=>B(e,r,w()))));throw S(n,null==a?void 0:a.callee),n}return i.value},X=e=>(n,t,o)=>{const a=o?{...o,async:!1}:{async:!1},r=n._zod.run({value:t,issues:[]},a);if(r instanceof Promise)throw new g;return r.issues.length?{success:!1,error:new(e??K)(r.issues.map((e=>B(e,a,w()))))}:{success:!0,data:r.value}},Y=X(J),Q=e=>async(n,t,o)=>{const a=o?Object.assign(o,{async:!0}):{async:!0};let r=n._zod.run({value:t,issues:[]},a);return r instanceof Promise&&(r=await r),r.issues.length?{success:!1,error:new e(r.issues.map((e=>B(e,a,w()))))}:{success:!0,data:r.value}},ee=Q(J),ne=e=>(n,t,o)=>{const a=o?Object.assign(o,{direction:"backward"}):{direction:"backward"};return G(e)(n,t,a)},te=e=>(n,t,o)=>G(e)(n,t,o),oe=e=>async(n,t,o)=>{const a=o?Object.assign(o,{direction:"backward"}):{direction:"backward"};return H(e)(n,t,a)},ae=e=>async(n,t,o)=>H(e)(n,t,o),re=e=>(n,t,o)=>{const a=o?Object.assign(o,{direction:"backward"}):{direction:"backward"};return X(e)(n,t,a)},ie=e=>(n,t,o)=>X(e)(n,t,o),se=e=>async(n,t,o)=>{const a=o?Object.assign(o,{direction:"backward"}):{direction:"backward"};return Q(e)(n,t,a)},ce=e=>async(n,t,o)=>Q(e)(n,t,o),de=/^[cC][^\s-]{8,}$/,le=/^[0-9a-z]+$/,ue=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,pe=/^[0-9a-vA-V]{20}$/,fe=/^[A-Za-z0-9]{27}$/,he=/^[a-zA-Z0-9_-]{21}$/,me=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,ge=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,ve=e=>e?new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,be=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/;const we=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,ye=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,xe=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,ke=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,Ee=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,_e=/^[A-Za-z0-9_-]*$/,Re=/^\+[1-9]\d{6,14}$/,Ne="(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))",Te=new RegExp(`^${Ne}$`);function Oe(e){const n="(?:[01]\\d|2[0-3]):[0-5]\\d";return"number"==typeof e.precision?-1===e.precision?`${n}`:0===e.precision?`${n}:[0-5]\\d`:`${n}:[0-5]\\d\\.\\d{${e.precision}}`:`${n}(?::[0-5]\\d(?:\\.\\d+)?)?`}const Ie=/^-?\d+$/,Se=/^-?\d+(?:\.\d+)?$/,Ce=/^(?:true|false)$/i,ze=/^[^A-Z]*$/,je=/^[^a-z]*$/,Ae=m("$ZodCheck",((e,n)=>{var t;e._zod??(e._zod={}),e._zod.def=n,(t=e._zod).onattach??(t.onattach=[])})),Fe={number:"number",bigint:"bigint",object:"date"},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 a=(o.split(".")[1]||"").length;if(0===a&&/\d?e-\d?/.test(o)){const e=o.match(/\d?e-(\d?)/);(null==e?void 0:e[1])&&(a=Number.parseInt(e[1]))}const r=t>a?t:a;return Number.parseInt(e.toFixed(r).replace(".",""))%Number.parseInt(n.toFixed(r).replace(".",""))/10**r}(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"),a=o?"int":"number",[r,i]=L[n.format];e._zod.onattach.push((e=>{const t=e._zod.bag;t.format=n.format,t.minimum=r,t.maximum=i,o&&(t.pattern=Ie)})),e._zod.check=t=>{const s=t.value;if(o){if(!Number.isInteger(s))return void t.issues.push({expected:a,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:a,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:a,inclusive:!0,continue:!n.abort}))}s<r&&t.issues.push({origin:"number",input:s,code:"too_small",minimum:r,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 a=W(o);t.issues.push({origin:a,code:"too_big",maximum:n.maximum,inclusive:!0,input:o,inst:e,continue:!n.abort})}})),qe=m("$ZodCheckMinLength",((e,n)=>{var t;Ae.init(e,n),(t=e._zod.def).when??(t.when=e=>{const n=e.value;return!E(n)&&void 0!==n.length}),e._zod.onattach.push((e=>{const t=e._zod.bag.minimum??Number.NEGATIVE_INFINITY;n.minimum>t&&(e._zod.bag.minimum=n.minimum)})),e._zod.check=t=>{const o=t.value;if(o.length>=n.minimum)return;const a=W(o);t.issues.push({origin:a,code:"too_small",minimum:n.minimum,inclusive:!0,input:o,inst:e,continue:!n.abort})}})),Ue=m("$ZodCheckLengthEquals",((e,n)=>{var t;Ae.init(e,n),(t=e._zod.def).when??(t.when=e=>{const n=e.value;return!E(n)&&void 0!==n.length}),e._zod.onattach.push((e=>{const t=e._zod.bag;t.minimum=n.length,t.maximum=n.length,t.length=n.length})),e._zod.check=t=>{const o=t.value,a=o.length;if(a===n.length)return;const r=W(o),i=a>n.length;t.issues.push({origin:r,...i?{code:"too_big",maximum:n.length}:{code:"too_small",minimum:n.length},inclusive:!0,exact:!0,input:t.value,inst:e,continue:!n.abort})}})),Be=m("$ZodCheckStringFormat",((e,n)=>{var t,o;Ae.init(e,n),e._zod.onattach.push((e=>{const t=e._zod.bag;t.format=n.format,n.pattern&&(t.patterns??(t.patterns=new Set),t.patterns.add(n.pattern))})),n.pattern?(t=e._zod).check??(t.check=t=>{n.pattern.lastIndex=0,n.pattern.test(t.value)||t.issues.push({origin:"string",code:"invalid_format",format:n.format,input:t.value,...n.pattern?{pattern:n.pattern.toString()}:{},inst:e,continue:!n.abort})}):(o=e._zod).check??(o.check=()=>{})})),We=m("$ZodCheckRegex",((e,n)=>{Be.init(e,n),e._zod.check=t=>{n.pattern.lastIndex=0,n.pattern.test(t.value)||t.issues.push({origin:"string",code:"invalid_format",format:"regex",input:t.value,pattern:n.pattern.toString(),inst:e,continue:!n.abort})}})),Ve=m("$ZodCheckLowerCase",((e,n)=>{n.pattern??(n.pattern=ze),Be.init(e,n)})),Ze=m("$ZodCheckUpperCase",((e,n)=>{n.pattern??(n.pattern=je),Be.init(e,n)})),Ke=m("$ZodCheckIncludes",((e,n)=>{Ae.init(e,n);const t=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 a of o)this.content.push(a)}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 a=[...e._zod.def.checks??[]];e._zod.traits.has("$ZodCheck")&&a.unshift(e);for(const r of a)for(const n of r._zod.onattach)n(e);if(0===a.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,a=M(e);for(const r of n){if(r._zod.def.when){if(!r._zod.def.when(e))continue}else if(a)continue;const n=e.issues.length,i=r._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&&(a||(a=M(e,n)))}));else{if(e.issues.length===n)continue;a||(a=M(e,n))}}return o?o.then((()=>e)):e},t=(t,o,r)=>{if(M(t))return t.aborted=!0,t;const i=n(o,a,r);if(i instanceof Promise){if(!1===r.async)throw new g;return i.then((n=>e._zod.parse(n,r)))}return e._zod.parse(i,r)};e._zod.run=(o,r)=>{if(r.skipChecks)return e._zod.parse(o,r);if("backward"===r.direction){const n=e._zod.parse({value:o.value,issues:[]},{...r,skipChecks:!0});return n instanceof Promise?n.then((e=>t(e,o,r))):t(n,o,r)}const i=e._zod.parse(o,r);if(i instanceof Promise){if(!1===r.async)throw new g;return i.then((e=>n(e,a,r)))}return n(i,a,r)}}N(e,"~standard",(()=>({validate:n=>{var t;try{const o=Y(e,n);return o.success?{value:o.data}:{issues:null==(t=o.error)?void 0:t.issues}}catch(o){return ee(e,n).then((e=>{var n;return e.success?{value:e.data}:{issues:null==(n=e.error)?void 0:n.issues}}))}},vendor:"zod",version:1})))})),en=m("$ZodString",((e,n)=>{var t;Qe.init(e,n),e._zod.pattern=[...(null==(t=null==e?void 0:e._zod.bag)?void 0:t.patterns)??[]].pop()??(e=>{const n=e?`[\\s\\S]{${(null==e?void 0:e.minimum)??0},${(null==e?void 0:e.maximum)??""}}`:"[\\s\\S]*";return new RegExp(`^${n}$`)})(e._zod.bag),e._zod.parse=(t,o)=>{if(n.coerce)try{t.value=String(t.value)}catch(a){}return"string"==typeof t.value||t.issues.push({expected:"string",code:"invalid_type",input:t.value,inst:e}),t}})),nn=m("$ZodStringFormat",((e,n)=>{Be.init(e,n),en.init(e,n)})),tn=m("$ZodGUID",((e,n)=>{n.pattern??(n.pattern=ge),nn.init(e,n)})),on=m("$ZodUUID",((e,n)=>{if(n.version){const e={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[n.version];if(void 0===e)throw new Error(`Invalid UUID version: "${n.version}"`);n.pattern??(n.pattern=ve(e))}else n.pattern??(n.pattern=ve());nn.init(e,n)})),an=m("$ZodEmail",((e,n)=>{n.pattern??(n.pattern=be),nn.init(e,n)})),rn=m("$ZodURL",((e,n)=>{nn.init(e,n),e._zod.check=t=>{try{const o=t.value.trim(),a=new URL(o);return n.hostname&&(n.hostname.lastIndex=0,n.hostname.test(a.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(a.protocol.endsWith(":")?a.protocol.slice(0,-1):a.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=a.href:t.value=o)}catch(o){t.issues.push({code:"invalid_format",format:"url",input:t.value,inst:e,continue:!n.abort})}}})),sn=m("$ZodEmoji",((e,n)=>{n.pattern??(n.pattern=new RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),nn.init(e,n)})),cn=m("$ZodNanoID",((e,n)=>{n.pattern??(n.pattern=he),nn.init(e,n)})),dn=m("$ZodCUID",((e,n)=>{n.pattern??(n.pattern=de),nn.init(e,n)})),ln=m("$ZodCUID2",((e,n)=>{n.pattern??(n.pattern=le),nn.init(e,n)})),un=m("$ZodULID",((e,n)=>{n.pattern??(n.pattern=ue),nn.init(e,n)})),pn=m("$ZodXID",((e,n)=>{n.pattern??(n.pattern=pe),nn.init(e,n)})),fn=m("$ZodKSUID",((e,n)=>{n.pattern??(n.pattern=fe),nn.init(e,n)})),hn=m("$ZodISODateTime",((e,n)=>{n.pattern??(n.pattern=function(e){const n=Oe({precision:e.precision}),t=["Z"];e.local&&t.push(""),e.offset&&t.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");const o=`${n}(?:${t.join("|")})`;return new RegExp(`^${Ne}T(?:${o})$`)}(n)),nn.init(e,n)})),mn=m("$ZodISODate",((e,n)=>{n.pattern??(n.pattern=Te),nn.init(e,n)})),gn=m("$ZodISOTime",((e,n)=>{n.pattern??(n.pattern=new RegExp(`^${Oe(n)}$`)),nn.init(e,n)})),vn=m("$ZodISODuration",((e,n)=>{n.pattern??(n.pattern=me),nn.init(e,n)})),bn=m("$ZodIPv4",((e,n)=>{n.pattern??(n.pattern=we),nn.init(e,n),e._zod.bag.format="ipv4"})),wn=m("$ZodIPv6",((e,n)=>{n.pattern??(n.pattern=ye),nn.init(e,n),e._zod.bag.format="ipv6",e._zod.check=t=>{try{new URL(`http://[${t.value}]`)}catch{t.issues.push({code:"invalid_format",format:"ipv6",input:t.value,inst:e,continue:!n.abort})}}})),yn=m("$ZodCIDRv4",((e,n)=>{n.pattern??(n.pattern=xe),nn.init(e,n)})),xn=m("$ZodCIDRv6",((e,n)=>{n.pattern??(n.pattern=ke),nn.init(e,n),e._zod.check=t=>{const o=t.value.split("/");try{if(2!==o.length)throw new Error;const[e,n]=o;if(!n)throw new Error;const t=Number(n);if(`${t}`!==n)throw new Error;if(t<0||t>128)throw new Error;new URL(`http://[${e}]`)}catch{t.issues.push({code:"invalid_format",format:"cidrv6",input:t.value,inst:e,continue:!n.abort})}}}));function kn(e){if(""===e)return!0;if(e.length%4!=0)return!1;try{return atob(e),!0}catch{return!1}}const En=m("$ZodBase64",((e,n)=>{n.pattern??(n.pattern=Ee),nn.init(e,n),e._zod.bag.contentEncoding="base64",e._zod.check=t=>{kn(t.value)||t.issues.push({code:"invalid_format",format:"base64",input:t.value,inst:e,continue:!n.abort})}}));const _n=m("$ZodBase64URL",((e,n)=>{n.pattern??(n.pattern=_e),nn.init(e,n),e._zod.bag.contentEncoding="base64url",e._zod.check=t=>{(function(e){if(!_e.test(e))return!1;const n=e.replace(/[-_]/g,(e=>"-"===e?"+":"/"));return kn(n.padEnd(4*Math.ceil(n.length/4),"="))})(t.value)||t.issues.push({code:"invalid_format",format:"base64url",input:t.value,inst:e,continue:!n.abort})}})),Rn=m("$ZodE164",((e,n)=>{n.pattern??(n.pattern=Re),nn.init(e,n)}));const Nn=m("$ZodJWT",((e,n)=>{nn.init(e,n),e._zod.check=t=>{(function(e,n=null){try{const t=e.split(".");if(3!==t.length)return!1;const[o]=t;if(!o)return!1;const a=JSON.parse(atob(o));return!("typ"in a&&"JWT"!==(null==a?void 0:a.typ)||!a.alg||n&&(!("alg"in a)||a.alg!==n))}catch{return!1}})(t.value,n.alg)||t.issues.push({code:"invalid_format",format:"jwt",input:t.value,inst:e,continue:!n.abort})}})),Tn=m("$ZodNumber",((e,n)=>{Qe.init(e,n),e._zod.pattern=e._zod.bag.pattern??Se,e._zod.parse=(t,o)=>{if(n.coerce)try{t.value=Number(t.value)}catch(i){}const a=t.value;if("number"==typeof a&&!Number.isNaN(a)&&Number.isFinite(a))return t;const r="number"==typeof a?Number.isNaN(a)?"NaN":Number.isFinite(a)?void 0:"Infinity":void 0;return t.issues.push({expected:"number",code:"invalid_type",input:a,inst:e,...r?{received:r}:{}}),t}})),On=m("$ZodNumberFormat",((e,n)=>{Le.init(e,n),Tn.init(e,n)})),In=m("$ZodBoolean",((e,n)=>{Qe.init(e,n),e._zod.pattern=Ce,e._zod.parse=(t,o)=>{if(n.coerce)try{t.value=Boolean(t.value)}catch(r){}const a=t.value;return"boolean"==typeof a||t.issues.push({expected:"boolean",code:"invalid_type",input:a,inst:e}),t}})),Sn=m("$ZodAny",((e,n)=>{Qe.init(e,n),e._zod.parse=e=>e})),Cn=m("$ZodUnknown",((e,n)=>{Qe.init(e,n),e._zod.parse=e=>e})),zn=m("$ZodNever",((e,n)=>{Qe.init(e,n),e._zod.parse=(n,t)=>(n.issues.push({expected:"never",code:"invalid_type",input:n.value,inst:e}),n)}));function jn(e,n,t){e.issues.length&&n.issues.push(...q(t,e.issues)),n.value[t]=e.value}const An=m("$ZodArray",((e,n)=>{Qe.init(e,n),e._zod.parse=(t,o)=>{const a=t.value;if(!Array.isArray(a))return t.issues.push({expected:"array",code:"invalid_type",input:a,inst:e}),t;t.value=Array(a.length);const r=[];for(let e=0;e<a.length;e++){const i=a[e],s=n.element._zod.run({value:i,issues:[]},o);s instanceof Promise?r.push(s.then((n=>jn(n,t,e)))):jn(s,t,e)}return r.length?Promise.all(r).then((()=>t)):t}}));function Fn(e,n,t,o,a){if(e.issues.length){if(a&&!(t in o))return;n.issues.push(...q(t,e.issues))}void 0===e.value?t in o&&(n.value[t]=void 0):n.value[t]=e.value}function Pn(e){var n,t,o,a;const r=Object.keys(e.shape);for(const c of r)if(!(null==(a=null==(o=null==(t=null==(n=e.shape)?void 0:n[c])?void 0:t._zod)?void 0:o.traits)?void 0:a.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:r,keySet:new Set(r),numKeys:r.length,optionalKeys:new Set(i)}}function $n(e,n,t,o,a,r){const i=[],s=a.keySet,c=a.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 a=c.run({value:n[u],issues:[]},o);a instanceof Promise?e.push(a.then((e=>Fn(e,t,u,n,l)))):Fn(a,t,u,n,l)}return i.length&&t.issues.push({code:"unrecognized_keys",keys:i,input:n,inst:r}),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)));N(e._zod,"propValues",(()=>{const e=n.shape,t={};for(const n in e){const o=e[n]._zod;if(o.values){t[n]??(t[n]=new Set);for(const e of o.values)t[n].add(e)}}return t}));const a=C,r=n.catchall;let i;e._zod.parse=(n,t)=>{i??(i=o.value);const s=n.value;if(!a(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],a="optional"===o._zod.optout,r=o._zod.run({value:s[e],issues:[]},t);r instanceof Promise?c.push(r.then((t=>Fn(t,n,e,s,a)))):Fn(r,n,e,s,a)}return r?$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 a;const r=C,i=!b.jitless,s=i&&z.value,c=n.catchall;let d;e._zod.parse=(l,u)=>{d??(d=o.value);const p=l.value;return r(p)?i&&s&&!1===(null==u?void 0:u.async)&&!0!==u.jitless?(a||(a=(e=>{var n;const t=new Xe(["shape","payload","ctx"]),a=o.value,r=e=>{const n=I(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 a.keys)i[o]="key_"+s++;t.write("const newResult = {};");for(const o of a.keys){const a=i[o],s=I(o),c=e[o],d="optional"===(null==(n=null==c?void 0:c._zod)?void 0:n.optout);t.write(`const ${a} = ${r(o)};`),d?t.write(`\n if (${a}.issues.length) {\n if (${s} in input) {\n payload.issues = payload.issues.concat(${a}.issues.map(iss => ({\n ...iss,\n path: iss.path ? [${s}, ...iss.path] : [${s}]\n })));\n }\n }\n \n if (${a}.value === undefined) {\n if (${s} in input) {\n newResult[${s}] = undefined;\n }\n } else {\n newResult[${s}] = ${a}.value;\n }\n \n `):t.write(`\n if (${a}.issues.length) {\n payload.issues = payload.issues.concat(${a}.issues.map(iss => ({\n ...iss,\n path: iss.path ? [${s}, ...iss.path] : [${s}]\n })));\n }\n \n if (${a}.value === undefined) {\n if (${s} in input) {\n newResult[${s}] = undefined;\n }\n } else {\n newResult[${s}] = ${a}.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=a(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 r of e)if(0===r.issues.length)return n.value=r.value,n;const a=e.filter((e=>!M(e)));return 1===a.length?(n.value=a[0].value,a[0]):(n.issues.push({code:"invalid_union",input:n.value,inst:t,errors:e.map((e=>e.issues.map((e=>B(e,o,w())))))}),n)}const qn=m("$ZodUnion",((e,n)=>{Qe.init(e,n),N(e._zod,"optin",(()=>n.options.some((e=>"optional"===e._zod.optin))?"optional":void 0)),N(e._zod,"optout",(()=>n.options.some((e=>"optional"===e._zod.optout))?"optional":void 0)),N(e._zod,"values",(()=>{if(n.options.every((e=>e._zod.values)))return new Set(n.options.flatMap((e=>Array.from(e._zod.values))))})),N(e._zod,"pattern",(()=>{if(n.options.every((e=>e._zod.pattern))){const e=n.options.map((e=>e._zod.pattern));return new RegExp(`^(${e.map((e=>_(e.source))).join("|")})$`)}}));const t=1===n.options.length,o=n.options[0]._zod.run;e._zod.parse=(a,r)=>{if(t)return o(a,r);let i=!1;const s=[];for(const e of n.options){const n=e._zod.run({value:a.value,issues:[]},r);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,a,e,r))):Mn(s,a,e,r)}})),Un=m("$ZodIntersection",((e,n)=>{Qe.init(e,n),e._zod.parse=(e,t)=>{const o=e.value,a=n.left._zod.run({value:o,issues:[]},t),r=n.right._zod.run({value:o,issues:[]},t);return a instanceof Promise||r instanceof Promise?Promise.all([a,r]).then((([n,t])=>Wn(e,n,t))):Wn(e,a,r)}}));function Bn(e,n){if(e===n)return{valid:!0,data:e};if(e instanceof Date&&n instanceof Date&&+e==+n)return{valid:!0,data:e};if(j(e)&&j(n)){const t=Object.keys(n),o=Object.keys(e).filter((e=>-1!==t.indexOf(e))),a={...e,...n};for(const r of o){const t=Bn(e[r],n[r]);if(!t.valid)return{valid:!1,mergeErrorPath:[r,...t.mergeErrorPath]};a[r]=t.data}return{valid:!0,data:a}}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 a=Bn(e[o],n[o]);if(!a.valid)return{valid:!1,mergeErrorPath:[o,...a.mergeErrorPath]};t.push(a.data)}return{valid:!0,data:t}}return{valid:!1,mergeErrorPath:[]}}function Wn(e,n,t){const o=new Map;let a;for(const s of n.issues)if("unrecognized_keys"===s.code){a??(a=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 r=[...o].filter((([,e])=>e.l&&e.r)).map((([e])=>e));if(r.length&&a&&e.issues.push({...a,keys:r}),M(e))return e;const i=Bn(n.value,t.value);if(!i.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(i.mergeErrorPath)}`);return e.value=i.data,e}const Vn=m("$ZodEnum",((e,n)=>{Qe.init(e,n);const t=y(n.entries),o=new Set(t);e._zod.values=o,e._zod.pattern=new RegExp(`^(${t.filter((e=>F.has(typeof e))).map((e=>"string"==typeof e?P(e):e.toString())).join("|")})$`),e._zod.parse=(n,a)=>{const r=n.value;return o.has(r)||n.issues.push({code:"invalid_value",values:t,input:r,inst:e}),n}})),Zn=m("$ZodTransform",((e,n)=>{Qe.init(e,n),e._zod.parse=(t,o)=>{if("backward"===o.direction)throw new v(e.constructor.name);const a=n.transform(t.value,t);if(o.async){return(a instanceof Promise?a:Promise.resolve(a)).then((e=>(t.value=e,t)))}if(a instanceof Promise)throw new g;return t.value=a,t}}));function Kn(e,n){return e.issues.length&&void 0===n?{issues:[],value:void 0}:e}const Jn=m("$ZodOptional",((e,n)=>{Qe.init(e,n),e._zod.optin="optional",e._zod.optout="optional",N(e._zod,"values",(()=>n.innerType._zod.values?new Set([...n.innerType._zod.values,void 0]):void 0)),N(e._zod,"pattern",(()=>{const e=n.innerType._zod.pattern;return e?new RegExp(`^(${_(e.source)})?$`):void 0})),e._zod.parse=(e,t)=>{if("optional"===n.innerType._zod.optin){const o=n.innerType._zod.run(e,t);return o instanceof Promise?o.then((n=>Kn(n,e.value))):Kn(o,e.value)}return void 0===e.value?e:n.innerType._zod.run(e,t)}})),Gn=m("$ZodExactOptional",((e,n)=>{Jn.init(e,n),N(e._zod,"values",(()=>n.innerType._zod.values)),N(e._zod,"pattern",(()=>n.innerType._zod.pattern)),e._zod.parse=(e,t)=>n.innerType._zod.run(e,t)})),Hn=m("$ZodNullable",((e,n)=>{Qe.init(e,n),N(e._zod,"optin",(()=>n.innerType._zod.optin)),N(e._zod,"optout",(()=>n.innerType._zod.optout)),N(e._zod,"pattern",(()=>{const e=n.innerType._zod.pattern;return e?new RegExp(`^(${_(e.source)}|null)$`):void 0})),N(e._zod,"values",(()=>n.innerType._zod.values?new Set([...n.innerType._zod.values,null]):void 0)),e._zod.parse=(e,t)=>null===e.value?e:n.innerType._zod.run(e,t)})),Xn=m("$ZodDefault",((e,n)=>{Qe.init(e,n),e._zod.optin="optional",N(e._zod,"values",(()=>n.innerType._zod.values)),e._zod.parse=(e,t)=>{if("backward"===t.direction)return n.innerType._zod.run(e,t);if(void 0===e.value)return e.value=n.defaultValue,e;const o=n.innerType._zod.run(e,t);return o instanceof Promise?o.then((e=>Yn(e,n))):Yn(o,n)}}));function Yn(e,n){return void 0===e.value&&(e.value=n.defaultValue),e}const Qn=m("$ZodPrefault",((e,n)=>{Qe.init(e,n),e._zod.optin="optional",N(e._zod,"values",(()=>n.innerType._zod.values)),e._zod.parse=(e,t)=>("backward"===t.direction||void 0===e.value&&(e.value=n.defaultValue),n.innerType._zod.run(e,t))})),et=m("$ZodNonOptional",((e,n)=>{Qe.init(e,n),N(e._zod,"values",(()=>{const e=n.innerType._zod.values;return e?new Set([...e].filter((e=>void 0!==e))):void 0})),e._zod.parse=(t,o)=>{const a=n.innerType._zod.run(t,o);return a instanceof Promise?a.then((n=>nt(n,e))):nt(a,e)}}));function nt(e,n){return e.issues.length||void 0!==e.value||e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:n}),e}const tt=m("$ZodCatch",((e,n)=>{Qe.init(e,n),N(e._zod,"optin",(()=>n.innerType._zod.optin)),N(e._zod,"optout",(()=>n.innerType._zod.optout)),N(e._zod,"values",(()=>n.innerType._zod.values)),e._zod.parse=(e,t)=>{if("backward"===t.direction)return n.innerType._zod.run(e,t);const o=n.innerType._zod.run(e,t);return o instanceof Promise?o.then((o=>(e.value=o.value,o.issues.length&&(e.value=n.catchValue({...e,error:{issues:o.issues.map((e=>B(e,t,w())))},input:e.value}),e.issues=[]),e))):(e.value=o.value,o.issues.length&&(e.value=n.catchValue({...e,error:{issues:o.issues.map((e=>B(e,t,w())))},input:e.value}),e.issues=[]),e)}})),ot=m("$ZodPipe",((e,n)=>{Qe.init(e,n),N(e._zod,"values",(()=>n.in._zod.values)),N(e._zod,"optin",(()=>n.in._zod.optin)),N(e._zod,"optout",(()=>n.out._zod.optout)),N(e._zod,"propValues",(()=>n.in._zod.propValues)),e._zod.parse=(e,t)=>{if("backward"===t.direction){const o=n.out._zod.run(e,t);return o instanceof Promise?o.then((e=>at(e,n.in,t))):at(o,n.in,t)}const o=n.in._zod.run(e,t);return o instanceof Promise?o.then((e=>at(e,n.out,t))):at(o,n.out,t)}}));function at(e,n,t){return e.issues.length?(e.aborted=!0,e):n._zod.run({value:e.value,issues:e.issues},t)}const rt=m("$ZodReadonly",((e,n)=>{Qe.init(e,n),N(e._zod,"propValues",(()=>n.innerType._zod.propValues)),N(e._zod,"values",(()=>n.innerType._zod.values)),N(e._zod,"optin",(()=>{var e,t;return null==(t=null==(e=n.innerType)?void 0:e._zod)?void 0:t.optin})),N(e._zod,"optout",(()=>{var e,t;return null==(t=null==(e=n.innerType)?void 0:e._zod)?void 0:t.optout})),e._zod.parse=(e,t)=>{if("backward"===t.direction)return n.innerType._zod.run(e,t);const o=n.innerType._zod.run(e,t);return o instanceof Promise?o.then(it):it(o)}}));function it(e){return e.value=Object.freeze(e.value),e}const st=m("$ZodCustom",((e,n)=>{Ae.init(e,n),Qe.init(e,n),e._zod.parse=(e,n)=>e,e._zod.check=t=>{const o=t.value,a=n.fn(o);if(a instanceof Promise)return a.then((n=>ct(n,t,o,e)));ct(a,t,o,e)}}));function ct(e,n,t,o){if(!e){const e={code:"custom",input:t,inst:o,path:[...o._zod.def.path??[]],continue:!o._zod.def.abort};o._zod.def.params&&(e.params=o._zod.def.params),n.issues.push(V(e))}}var dt;class lt{constructor(){this._map=new WeakMap,this._idmap=new Map}add(e,...n){const t=n[0];return this._map.set(e,t),t&&"object"==typeof t&&"id"in t&&this._idmap.set(t.id,e),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(e){const n=this._map.get(e);return n&&"object"==typeof n&&"id"in n&&this._idmap.delete(n.id),this._map.delete(e),this}get(e){const n=e._zod.parent;if(n){const t={...this.get(n)??{}};delete t.id;const o={...t,...this._map.get(e)};return Object.keys(o).length?o:void 0}return this._map.get(e)}has(e){return this._map.has(e)}}(dt=globalThis).__zod_globalRegistry??(dt.__zod_globalRegistry=new lt);const ut=globalThis.__zod_globalRegistry;function pt(e,n){return new e({type:"string",...D(n)})}function ft(e,n){return new e({type:"string",format:"email",check:"string_format",abort:!1,...D(n)})}function ht(e,n){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...D(n)})}function mt(e,n){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...D(n)})}function gt(e,n){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...D(n)})}function vt(e,n){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...D(n)})}function bt(e,n){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...D(n)})}function wt(e,n){return new e({type:"string",format:"url",check:"string_format",abort:!1,...D(n)})}function yt(e,n){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...D(n)})}function xt(e,n){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...D(n)})}function kt(e,n){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...D(n)})}function Et(e,n){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...D(n)})}function _t(e,n){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...D(n)})}function Rt(e,n){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...D(n)})}function Nt(e,n){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...D(n)})}function Tt(e,n){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...D(n)})}function Ot(e,n){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...D(n)})}function It(e,n){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...D(n)})}function St(e,n){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...D(n)})}function Ct(e,n){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...D(n)})}function zt(e,n){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...D(n)})}function jt(e,n){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...D(n)})}function At(e,n){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...D(n)})}function Ft(e,n){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...D(n)})}function 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 qt(e,n){return new e({type:"boolean",...D(n)})}function Ut(e){return new e({type:"any"})}function Bt(e){return new e({type:"unknown"})}function Wt(e,n){return new e({type:"never",...D(n)})}function Vt(e,n){return new Pe({check:"less_than",...D(n),value:e,inclusive:!1})}function Zt(e,n){return new Pe({check:"less_than",...D(n),value:e,inclusive:!0})}function Kt(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 qe({check:"min_length",...D(n),minimum:e})}function Yt(e,n){return new Ue({check:"length_equals",...D(n),length:e})}function Qt(e,n){return new We({check:"string_format",format:"regex",...D(n),pattern:e})}function eo(e){return new Ve({check:"string_format",format:"lowercase",...D(e)})}function no(e){return new Ze({check:"string_format",format:"uppercase",...D(e)})}function to(e,n){return new Ke({check:"string_format",format:"includes",...D(n),includes:e})}function oo(e,n){return new Je({check:"string_format",format:"starts_with",...D(n),prefix:e})}function ao(e,n){return new Ge({check:"string_format",format:"ends_with",...D(n),suffix:e})}function ro(e){return new He({check:"overwrite",tx:e})}function io(e){return ro((n=>n.normalize(e)))}function so(){return ro((e=>e.trim()))}function co(){return ro((e=>e.toLowerCase()))}function lo(){return ro((e=>e.toUpperCase()))}function uo(){return ro((e=>function(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}(e)))}function po(e,n,t){return new e({type:"array",element:n,...D(t)})}function fo(e,n,t){return new e({type:"custom",check:"custom",fn:n,...D(t)})}function ho(e){const n=mo((t=>(t.addIssue=e=>{if("string"==typeof e)t.issues.push(V(e,t.value,n._zod.def));else{const o=e;o.fatal&&(o.continue=!1),o.code??(o.code="custom"),o.input??(o.input=t.value),o.inst??(o.inst=n),o.continue??(o.continue=!n._zod.def.abort),t.issues.push(V(o))}},e(t.value,t))));return n}function mo(e,n){const t=new Ae({check:"custom",...D(n)});return t._zod.check=e,t}function go(e){let n=(null==e?void 0:e.target)??"draft-2020-12";return"draft-4"===n&&(n="draft-04"),"draft-7"===n&&(n="draft-07"),{processors:e.processors??{},metadataRegistry:(null==e?void 0:e.metadata)??ut,target:n,unrepresentable:(null==e?void 0:e.unrepresentable)??"throw",override:(null==e?void 0:e.override)??(()=>{}),io:(null==e?void 0:e.io)??"output",counter:0,seen:new Map,cycles:(null==e?void 0:e.cycles)??"ref",reused:(null==e?void 0:e.reused)??"inline",external:(null==e?void 0:e.external)??void 0}}function vo(e,n,t={path:[],schemaPath:[]}){var o,a,r;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==(a=(o=e._zod).toJSONSchema)?void 0:a.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,a=n.processors[i.type];if(!a)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${i.type}`);a(e,n,t,o)}const a=e._zod.parent;a&&(c.ref||(c.ref=a),vo(a,n,o),n.seen.get(a).isParent=!0)}const l=n.metadataRegistry.get(e);l&&Object.assign(c.schema,l),"input"===n.io&&yo(e)&&(delete c.schema.examples,delete c.schema.default),"input"===n.io&&c.schema._prefault&&((r=c.schema).default??(r.default=c.schema._prefault)),delete c.schema._prefault;return n.seen.get(e).schema}function bo(e,n){var t,o,a,r;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:a}=(n=>{var t;const o="draft-2020-12"===e.target?"$defs":"definitions";if(e.external){const a=null==(t=e.external.registry.get(n[0]))?void 0:t.id,r=e.external.uri??(e=>e);if(a)return{ref:r(a)};const i=n[1].defId??n[1].schema.id??"schema"+e.counter++;return n[1].defId=i,{defId:i,ref:`${r("__shared")}#/${o}/${i}`}}if(n[1]===i)return{ref:"#"};const a=`#/${o}/`,r=n[1].schema.id??"__schema"+e.counter++;return{defId:r,ref:a+r}})(n);t.def={...t.schema},a&&(t.defId=a);const r=t.schema;for(const e in r)delete r[e];r.$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==(a=e.external.registry.get(d[0]))?void 0:a.id;if(n!==d[0]&&t){c(d);continue}}(null==(r=e.metadataRegistry.get(d[0]))?void 0:r.id)?c(d):(t.cycle||t.count>1&&"ref"===e.reused)&&c(d)}}function wo(e,n){var t,o,a;const r=e.seen.get(n);if(!r)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,a={...o},r=t.ref;if(t.ref=null,r){i(r);const t=e.seen.get(r),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,a);if(n._zod.parent===r)for(const e in o)"$ref"!==e&&"allOf"!==e&&(e in a||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!==r){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,r.def??r.schema);const c=(null==(a=e.external)?void 0:a.defs)??{};for(const l of e.seen.entries()){const e=l[1];e.def&&e.defId&&(c[e.defId]=e.def)}e.external||Object.keys(c).length>0&&("draft-2020-12"===e.target?s.$defs=c:s.definitions=c);try{const t=JSON.parse(JSON.stringify(s));return Object.defineProperty(t,"~standard",{value:{...n["~standard"],jsonSchema:{input:xo(n,"input",e.processors),output:xo(n,"output",e.processors)}},enumerable:!1,writable:!1}),t}catch(d){throw new Error("Error converting schema to JSON.")}}function yo(e,n){const t=n??{seen:new Set};if(t.seen.has(e))return!1;t.seen.add(e);const o=e._zod.def;if("transform"===o.type)return!0;if("array"===o.type)return yo(o.element,t);if("set"===o.type)return yo(o.valueType,t);if("lazy"===o.type)return yo(o.getter(),t);if("promise"===o.type||"optional"===o.type||"nonoptional"===o.type||"nullable"===o.type||"readonly"===o.type||"default"===o.type||"prefault"===o.type)return yo(o.innerType,t);if("intersection"===o.type)return yo(o.left,t)||yo(o.right,t);if("record"===o.type||"map"===o.type)return yo(o.keyType,t)||yo(o.valueType,t);if("pipe"===o.type)return yo(o.in,t)||yo(o.out,t);if("object"===o.type){for(const e in o.shape)if(yo(o.shape[e],t))return!0;return!1}if("union"===o.type){for(const e of o.options)if(yo(e,t))return!0;return!1}if("tuple"===o.type){for(const e of o.items)if(yo(e,t))return!0;return!(!o.rest||!yo(o.rest,t))}return!1}const xo=(e,n,t={})=>o=>{const{libraryOptions:a,target:r}=o??{},i=go({...a??{},target:r,io:n,processors:t});return vo(e,i),bo(i,e),wo(i,e)},ko={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},Eo=(e,n,t,o)=>{const a=e._zod.def;vo(a.innerType,n,o);n.seen.get(e).ref=a.innerType},_o=m("ZodISODateTime",((e,n)=>{hn.init(e,n),Vo.init(e,n)}));const Ro=m("ZodISODate",((e,n)=>{mn.init(e,n),Vo.init(e,n)}));const No=m("ZodISOTime",((e,n)=>{gn.init(e,n),Vo.init(e,n)}));const To=m("ZodISODuration",((e,n)=>{vn.init(e,n),Vo.init(e,n)}));const Oo=m("ZodError",((e,n)=>{K.init(e,n),e.name="ZodError",Object.defineProperties(e,{format:{value:n=>function(e,n=e=>e.message){const t={_errors:[]},o=e=>{for(const a of e.issues)if("invalid_union"===a.code&&a.errors.length)a.errors.map((e=>o({issues:e})));else if("invalid_key"===a.code)o({issues:a.issues});else if("invalid_element"===a.code)o({issues:a.issues});else if(0===a.path.length)t._errors.push(n(a));else{let e=t,o=0;for(;o<a.path.length;){const t=a.path[o];o===a.path.length-1?(e[t]=e[t]||{_errors:[]},e[t]._errors.push(n(a))):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 a of e.issues)a.path.length>0?(t[a.path[0]]=t[a.path[0]]||[],t[a.path[0]].push(n(a))):o.push(n(a));return{formErrors:o,fieldErrors:t}}(e,n)},addIssue:{value:n=>{e.issues.push(n),e.message=JSON.stringify(e.issues,x,2)}},addIssues:{value:n=>{e.issues.push(...n),e.message=JSON.stringify(e.issues,x,2)}},isEmpty:{get:()=>0===e.issues.length}})}),{Parent:Error}),Io=G(Oo),So=H(Oo),Co=X(Oo),zo=Q(Oo),jo=ne(Oo),Ao=te(Oo),Fo=oe(Oo),Po=ae(Oo),$o=re(Oo),Do=ie(Oo),Lo=se(Oo),Mo=ce(Oo),qo=m("ZodType",((e,n)=>(Qe.init(e,n),Object.assign(e["~standard"],{jsonSchema:{input:xo(e,"input"),output:xo(e,"output")}}),e.toJSONSchema=((e,n={})=>t=>{const o=go({...t,processors:n});return vo(e,o),bo(o,e),wo(o,e)})(e,{}),e.def=n,e.type=n.type,Object.defineProperty(e,"_def",{value:n}),e.check=(...t)=>e.clone(O(n,{checks:[...n.checks??[],...t.map((e=>"function"==typeof e?{_zod:{check:e,def:{check:"custom"},onattach:[]}}:e))]}),{parent:!0}),e.with=e.check,e.clone=(n,t)=>$(e,n,t),e.brand=()=>e,e.register=(n,t)=>(n.add(e,t),e),e.parse=(n,t)=>Io(e,n,t,{callee:e.parse}),e.safeParse=(n,t)=>Co(e,n,t),e.parseAsync=async(n,t)=>So(e,n,t,{callee:e.parseAsync}),e.safeParseAsync=async(n,t)=>zo(e,n,t),e.spa=e.safeParseAsync,e.encode=(n,t)=>jo(e,n,t),e.decode=(n,t)=>Ao(e,n,t),e.encodeAsync=async(n,t)=>Fo(e,n,t),e.decodeAsync=async(n,t)=>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(La,e,n)}(n,t)),e.superRefine=n=>e.check(ho(n)),e.overwrite=n=>e.check(ro(n)),e.optional=()=>Oa(e),e.exactOptional=()=>new Ia({type:"optional",innerType:e}),e.nullable=()=>Ca(e),e.nullish=()=>Oa(Ca(e)),e.nonoptional=n=>function(e,n){return new Aa({type:"nonoptional",innerType:e,...D(n)})}(e,n),e.array=()=>{return po(ya,e,n);var n},e.or=n=>{return new Ea({type:"union",options:[e,n],...D(t)});var t},e.and=n=>new _a({type:"intersection",left:e,right:n}),e.transform=n=>$a(e,new Na({type:"transform",transform:n})),e.default=n=>{return t=n,new za({type:"default",innerType:e,get defaultValue(){return"function"==typeof t?t():A(t)}});var t},e.prefault=n=>{return t=n,new ja({type:"prefault",innerType:e,get defaultValue(){return"function"==typeof t?t():A(t)}});var t},e.catch=n=>{return new Fa({type:"catch",innerType:e,catchValue:"function"==typeof(t=n)?t:()=>t});var t},e.pipe=n=>$a(e,n),e.readonly=()=>new Da({type:"readonly",innerType:e}),e.describe=n=>{const t=e.clone();return ut.add(t,{description:n}),t},Object.defineProperty(e,"description",{get(){var n;return null==(n=ut.get(e))?void 0:n.description},configurable:!0}),e.meta=(...n)=>{if(0===n.length)return ut.get(e);const t=e.clone();return ut.add(t,n[0]),t},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e.apply=n=>n(e),e))),Uo=m("_ZodString",((e,n)=>{en.init(e,n),qo.init(e,n),e._zod.processJSONSchema=(n,t,o)=>((e,n,t)=>{const o=t;o.type="string";const{minimum:a,maximum:r,format:i,patterns:s,contentEncoding:c}=e._zod.bag;if("number"==typeof a&&(o.minLength=a),"number"==typeof r&&(o.maxLength=r),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(ao(...n)),e.min=(...n)=>e.check(Xt(...n)),e.max=(...n)=>e.check(Ht(...n)),e.length=(...n)=>e.check(Yt(...n)),e.nonempty=(...n)=>e.check(Xt(1,...n)),e.lowercase=n=>e.check(eo(n)),e.uppercase=n=>e.check(no(n)),e.trim=()=>e.check(so()),e.normalize=(...n)=>e.check(io(...n)),e.toLowerCase=()=>e.check(co()),e.toUpperCase=()=>e.check(lo()),e.slugify=()=>e.check(uo())})),Bo=m("ZodString",((e,n)=>{en.init(e,n),Uo.init(e,n),e.email=n=>e.check(ft(Zo,n)),e.url=n=>e.check(wt(Go,n)),e.jwt=n=>e.check(At(la,n)),e.emoji=n=>e.check(yt(Ho,n)),e.guid=n=>e.check(ht(Ko,n)),e.uuid=n=>e.check(mt(Jo,n)),e.uuidv4=n=>e.check(gt(Jo,n)),e.uuidv6=n=>e.check(vt(Jo,n)),e.uuidv7=n=>e.check(bt(Jo,n)),e.nanoid=n=>e.check(xt(Xo,n)),e.guid=n=>e.check(ht(Ko,n)),e.cuid=n=>e.check(kt(Yo,n)),e.cuid2=n=>e.check(Et(Qo,n)),e.ulid=n=>e.check(_t(ea,n)),e.base64=n=>e.check(Ct(sa,n)),e.base64url=n=>e.check(zt(ca,n)),e.xid=n=>e.check(Rt(na,n)),e.ksuid=n=>e.check(Nt(ta,n)),e.ipv4=n=>e.check(Tt(oa,n)),e.ipv6=n=>e.check(Ot(aa,n)),e.cidrv4=n=>e.check(It(ra,n)),e.cidrv6=n=>e.check(St(ia,n)),e.e164=n=>e.check(jt(da,n)),e.datetime=n=>e.check(function(e){return Ft(_o,e)}(n)),e.date=n=>e.check(function(e){return Pt(Ro,e)}(n)),e.time=n=>e.check(function(e){return $t(No,e)}(n)),e.duration=n=>e.check(function(e){return Dt(To,e)}(n))}));function Wo(e){return pt(Bo,e)}const Vo=m("ZodStringFormat",((e,n)=>{nn.init(e,n),Uo.init(e,n)})),Zo=m("ZodEmail",((e,n)=>{an.init(e,n),Vo.init(e,n)})),Ko=m("ZodGUID",((e,n)=>{tn.init(e,n),Vo.init(e,n)})),Jo=m("ZodUUID",((e,n)=>{on.init(e,n),Vo.init(e,n)})),Go=m("ZodURL",((e,n)=>{rn.init(e,n),Vo.init(e,n)})),Ho=m("ZodEmoji",((e,n)=>{sn.init(e,n),Vo.init(e,n)})),Xo=m("ZodNanoID",((e,n)=>{cn.init(e,n),Vo.init(e,n)})),Yo=m("ZodCUID",((e,n)=>{dn.init(e,n),Vo.init(e,n)})),Qo=m("ZodCUID2",((e,n)=>{ln.init(e,n),Vo.init(e,n)})),ea=m("ZodULID",((e,n)=>{un.init(e,n),Vo.init(e,n)})),na=m("ZodXID",((e,n)=>{pn.init(e,n),Vo.init(e,n)})),ta=m("ZodKSUID",((e,n)=>{fn.init(e,n),Vo.init(e,n)})),oa=m("ZodIPv4",((e,n)=>{bn.init(e,n),Vo.init(e,n)})),aa=m("ZodIPv6",((e,n)=>{wn.init(e,n),Vo.init(e,n)})),ra=m("ZodCIDRv4",((e,n)=>{yn.init(e,n),Vo.init(e,n)})),ia=m("ZodCIDRv6",((e,n)=>{xn.init(e,n),Vo.init(e,n)})),sa=m("ZodBase64",((e,n)=>{En.init(e,n),Vo.init(e,n)})),ca=m("ZodBase64URL",((e,n)=>{_n.init(e,n),Vo.init(e,n)})),da=m("ZodE164",((e,n)=>{Rn.init(e,n),Vo.init(e,n)})),la=m("ZodJWT",((e,n)=>{Nn.init(e,n),Vo.init(e,n)})),ua=m("ZodNumber",((e,n)=>{Tn.init(e,n),qo.init(e,n),e._zod.processJSONSchema=(n,t,o)=>((e,n,t)=>{const o=t,{minimum:a,maximum:r,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 a&&(o.minimum=a,"number"==typeof d&&"draft-04"!==n.target&&(d>=a?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 r&&(o.maximum=r,"number"==typeof c&&"draft-04"!==n.target&&(c<=r?delete o.maximum:delete o.exclusiveMaximum)),"number"==typeof s&&(o.multipleOf=s)})(e,n,t),e.gt=(n,t)=>e.check(Kt(n,t)),e.gte=(n,t)=>e.check(Jt(n,t)),e.min=(n,t)=>e.check(Jt(n,t)),e.lt=(n,t)=>e.check(Vt(n,t)),e.lte=(n,t)=>e.check(Zt(n,t)),e.max=(n,t)=>e.check(Zt(n,t)),e.int=n=>e.check(fa(n)),e.safe=n=>e.check(fa(n)),e.positive=n=>e.check(Kt(0,n)),e.nonnegative=n=>e.check(Jt(0,n)),e.negative=n=>e.check(Vt(0,n)),e.nonpositive=n=>e.check(Zt(0,n)),e.multipleOf=(n,t)=>e.check(Gt(n,t)),e.step=(n,t)=>e.check(Gt(n,t)),e.finite=()=>e;const t=e._zod.bag;e.minValue=Math.max(t.minimum??Number.NEGATIVE_INFINITY,t.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,e.maxValue=Math.min(t.maximum??Number.POSITIVE_INFINITY,t.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,e.isInt=(t.format??"").includes("int")||Number.isSafeInteger(t.multipleOf??.5),e.isFinite=!0,e.format=t.format??null}));const pa=m("ZodNumberFormat",((e,n)=>{On.init(e,n),ua.init(e,n)}));function fa(e){return Mt(pa,e)}const ha=m("ZodBoolean",((e,n)=>{In.init(e,n),qo.init(e,n),e._zod.processJSONSchema=(e,n,t)=>((e,n,t)=>{t.type="boolean"})(0,0,n)}));function ma(e){return qt(ha,e)}const ga=m("ZodAny",((e,n)=>{Sn.init(e,n),qo.init(e,n),e._zod.processJSONSchema=(e,n,t)=>{}}));const va=m("ZodUnknown",((e,n)=>{Cn.init(e,n),qo.init(e,n),e._zod.processJSONSchema=(e,n,t)=>{}}));function ba(){return Bt(va)}const wa=m("ZodNever",((e,n)=>{zn.init(e,n),qo.init(e,n),e._zod.processJSONSchema=(e,n,t)=>((e,n,t)=>{t.not={}})(0,0,n)}));const ya=m("ZodArray",((e,n)=>{An.init(e,n),qo.init(e,n),e._zod.processJSONSchema=(n,t,o)=>((e,n,t,o)=>{const a=t,r=e._zod.def,{minimum:i,maximum:s}=e._zod.bag;"number"==typeof i&&(a.minItems=i),"number"==typeof s&&(a.maxItems=s),a.type="array",a.items=vo(r.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 xa=m("ZodObject",((e,n)=>{Ln.init(e,n),qo.init(e,n),e._zod.processJSONSchema=(n,t,o)=>((e,n,t,o)=>{var a;const r=t,i=e._zod.def;r.type="object",r.properties={};const s=i.shape;for(const l in s)r.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&&(r.required=Array.from(d)),"never"===(null==(a=i.catchall)?void 0:a._zod.def.type)?r.additionalProperties=!1:i.catchall?i.catchall&&(r.additionalProperties=vo(i.catchall,n,{...o,path:[...o.path,"additionalProperties"]})):"output"===n.io&&(r.additionalProperties=!1)})(e,n,t,o),N(e,"shape",(()=>n.shape)),e.keyof=()=>function(e,n){const t=Array.isArray(e)?Object.fromEntries(e.map((e=>[e,e]))):e;return new Ra({type:"enum",entries:t,...D(n)})}(Object.keys(e._zod.def.shape)),e.catchall=n=>e.clone({...e._zod.def,catchall:n}),e.passthrough=()=>e.clone({...e._zod.def,catchall:ba()}),e.loose=()=>e.clone({...e._zod.def,catchall:ba()}),e.strict=()=>{return e.clone({...e._zod.def,catchall:Wt(wa,n)});var n},e.strip=()=>e.clone({...e._zod.def,catchall:void 0}),e.extend=n=>function(e,n){if(!j(n))throw new Error("Invalid input to extend: expected a plain object");const t=e._zod.def.checks;if(t&&t.length>0){const t=e._zod.def.shape;for(const e in n)if(void 0!==Object.getOwnPropertyDescriptor(t,e))throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}const o=O(e._zod.def,{get shape(){const t={...e._zod.def.shape,...n};return T(this,"shape",t),t}});return $(e,o)}(e,n),e.safeExtend=n=>function(e,n){if(!j(n))throw new Error("Invalid input to safeExtend: expected a plain object");const t=O(e._zod.def,{get shape(){const t={...e._zod.def.shape,...n};return T(this,"shape",t),t}});return $(e,t)}(e,n),e.merge=n=>function(e,n){const t=O(e._zod.def,{get shape(){const t={...e._zod.def.shape,...n._zod.def.shape};return T(this,"shape",t),t},get catchall(){return n._zod.def.catchall},checks:[]});return $(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,O(e._zod.def,{get shape(){const e={};for(const o in n){if(!(o in t.shape))throw new Error(`Unrecognized key: "${o}"`);n[o]&&(e[o]=t.shape[o])}return T(this,"shape",e),e},checks:[]}))}(e,n),e.omit=n=>function(e,n){const t=e._zod.def,o=t.checks;if(o&&o.length>0)throw new Error(".omit() cannot be used on object schemas containing refinements");const a=O(e._zod.def,{get shape(){const o={...e._zod.def.shape};for(const e in n){if(!(e in t.shape))throw new Error(`Unrecognized key: "${e}"`);n[e]&&delete o[e]}return T(this,"shape",o),o},checks:[]});return $(e,a)}(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 a=O(n._zod.def,{get shape(){const o=n._zod.def.shape,a={...o};if(t)for(const n in t){if(!(n in o))throw new Error(`Unrecognized key: "${n}"`);t[n]&&(a[n]=e?new e({type:"optional",innerType:o[n]}):o[n])}else for(const n in o)a[n]=e?new e({type:"optional",innerType:o[n]}):o[n];return T(this,"shape",a),a},checks:[]});return $(n,a)}(Ta,e,n[0]),e.required=(...n)=>function(e,n,t){const o=O(n._zod.def,{get shape(){const o=n._zod.def.shape,a={...o};if(t)for(const n in t){if(!(n in a))throw new Error(`Unrecognized key: "${n}"`);t[n]&&(a[n]=new e({type:"nonoptional",innerType:o[n]}))}else for(const n in o)a[n]=new e({type:"nonoptional",innerType:o[n]});return T(this,"shape",a),a}});return $(n,o)}(Aa,e,n[0])}));function ka(e,n){const t={type:"object",shape:e??{},...D(n)};return new xa(t)}const Ea=m("ZodUnion",((e,n)=>{qn.init(e,n),qo.init(e,n),e._zod.processJSONSchema=(n,t,o)=>((e,n,t,o)=>{const a=e._zod.def,r=!1===a.inclusive,i=a.options.map(((e,t)=>vo(e,n,{...o,path:[...o.path,r?"oneOf":"anyOf",t]})));r?t.oneOf=i:t.anyOf=i})(e,n,t,o),e.options=n.options}));const _a=m("ZodIntersection",((e,n)=>{Un.init(e,n),qo.init(e,n),e._zod.processJSONSchema=(n,t,o)=>((e,n,t,o)=>{const a=e._zod.def,r=vo(a.left,n,{...o,path:[...o.path,"allOf",0]}),i=vo(a.right,n,{...o,path:[...o.path,"allOf",1]}),s=e=>"allOf"in e&&1===Object.keys(e).length,c=[...s(r)?r.allOf:[r],...s(i)?i.allOf:[i]];t.allOf=c})(e,n,t,o)}));const Ra=m("ZodEnum",((e,n)=>{Vn.init(e,n),qo.init(e,n),e._zod.processJSONSchema=(n,t,o)=>((e,n,t)=>{const o=y(e._zod.def.entries);o.every((e=>"number"==typeof e))&&(t.type="number"),o.every((e=>"string"==typeof e))&&(t.type="string"),t.enum=o})(e,0,t),e.enum=n.entries,e.options=Object.values(n.entries);const t=new Set(Object.keys(n.entries));e.extract=(e,o)=>{const a={};for(const r of e){if(!t.has(r))throw new Error(`Key ${r} not found in enum`);a[r]=n.entries[r]}return new Ra({...n,checks:[],...D(o),entries:a})},e.exclude=(e,o)=>{const a={...n.entries};for(const n of e){if(!t.has(n))throw new Error(`Key ${n} not found in enum`);delete a[n]}return new Ra({...n,checks:[],...D(o),entries:a})}}));const Na=m("ZodTransform",((e,n)=>{Zn.init(e,n),qo.init(e,n),e._zod.processJSONSchema=(e,n,t)=>((e,n)=>{if("throw"===n.unrepresentable)throw new Error("Transforms cannot be represented in JSON Schema")})(0,e),e._zod.parse=(t,o)=>{if("backward"===o.direction)throw new v(e.constructor.name);t.addIssue=o=>{if("string"==typeof o)t.issues.push(V(o,t.value,n));else{const n=o;n.fatal&&(n.continue=!1),n.code??(n.code="custom"),n.input??(n.input=t.value),n.inst??(n.inst=e),t.issues.push(V(n))}};const a=n.transform(t.value,t);return a instanceof Promise?a.then((e=>(t.value=e,t))):(t.value=a,t)}}));const Ta=m("ZodOptional",((e,n)=>{Jn.init(e,n),qo.init(e,n),e._zod.processJSONSchema=(n,t,o)=>Eo(e,n,0,o),e.unwrap=()=>e._zod.def.innerType}));function Oa(e){return new Ta({type:"optional",innerType:e})}const Ia=m("ZodExactOptional",((e,n)=>{Gn.init(e,n),qo.init(e,n),e._zod.processJSONSchema=(n,t,o)=>Eo(e,n,0,o),e.unwrap=()=>e._zod.def.innerType}));const Sa=m("ZodNullable",((e,n)=>{Hn.init(e,n),qo.init(e,n),e._zod.processJSONSchema=(n,t,o)=>((e,n,t,o)=>{const a=e._zod.def,r=vo(a.innerType,n,o),i=n.seen.get(e);"openapi-3.0"===n.target?(i.ref=a.innerType,t.nullable=!0):t.anyOf=[r,{type:"null"}]})(e,n,t,o),e.unwrap=()=>e._zod.def.innerType}));function Ca(e){return new Sa({type:"nullable",innerType:e})}const za=m("ZodDefault",((e,n)=>{Xn.init(e,n),qo.init(e,n),e._zod.processJSONSchema=(n,t,o)=>((e,n,t,o)=>{const a=e._zod.def;vo(a.innerType,n,o),n.seen.get(e).ref=a.innerType,t.default=JSON.parse(JSON.stringify(a.defaultValue))})(e,n,t,o),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap}));const ja=m("ZodPrefault",((e,n)=>{Qn.init(e,n),qo.init(e,n),e._zod.processJSONSchema=(n,t,o)=>((e,n,t,o)=>{const a=e._zod.def;vo(a.innerType,n,o),n.seen.get(e).ref=a.innerType,"input"===n.io&&(t._prefault=JSON.parse(JSON.stringify(a.defaultValue)))})(e,n,t,o),e.unwrap=()=>e._zod.def.innerType}));const Aa=m("ZodNonOptional",((e,n)=>{et.init(e,n),qo.init(e,n),e._zod.processJSONSchema=(n,t,o)=>((e,n,t,o)=>{const a=e._zod.def;vo(a.innerType,n,o),n.seen.get(e).ref=a.innerType})(e,n,0,o),e.unwrap=()=>e._zod.def.innerType}));const Fa=m("ZodCatch",((e,n)=>{tt.init(e,n),qo.init(e,n),e._zod.processJSONSchema=(n,t,o)=>((e,n,t,o)=>{const a=e._zod.def;let r;vo(a.innerType,n,o),n.seen.get(e).ref=a.innerType;try{r=a.catchValue(void 0)}catch{throw new Error("Dynamic catch values are not supported in JSON Schema")}t.default=r})(e,n,t,o),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap}));const Pa=m("ZodPipe",((e,n)=>{ot.init(e,n),qo.init(e,n),e._zod.processJSONSchema=(n,t,o)=>((e,n,t,o)=>{const a=e._zod.def,r="input"===n.io?"transform"===a.in._zod.def.type?a.out:a.in:a.out;vo(r,n,o),n.seen.get(e).ref=r})(e,n,0,o),e.in=n.in,e.out=n.out}));function $a(e,n){return new Pa({type:"pipe",in:e,out:n})}const Da=m("ZodReadonly",((e,n)=>{rt.init(e,n),qo.init(e,n),e._zod.processJSONSchema=(n,t,o)=>((e,n,t,o)=>{const a=e._zod.def;vo(a.innerType,n,o),n.seen.get(e).ref=a.innerType,t.readOnly=!0})(e,n,t,o),e.unwrap=()=>e._zod.def.innerType}));const La=m("ZodCustom",((e,n)=>{st.init(e,n),qo.init(e,n),e._zod.processJSONSchema=(e,n,t)=>((e,n)=>{if("throw"===n.unrepresentable)throw new Error("Custom types cannot be represented in JSON Schema")})(0,e)}));var Ma;ka({success:ma(),accessToken:Wo().optional(),alias:Wo().optional(),user:ka({id:Wo(),email:Wo(),role:Wo(),validated:ma(),active:ma()}).optional(),person:ka({id:Wo(),name:Wo(),birth_date:Wo()}).optional(),confidence_score:Lt(ua,Ma).optional(),recognition_id:Wo().optional(),task_id:Wo().optional(),status:Wo().optional(),message:Wo().optional()}),ka({success:ma(),message:Wo(),person_id:Wo().optional(),user_id:Wo().optional(),person_validated:ma().optional(),face_processing:Ut(ga).optional(),onboarding_link:Wo().optional(),task_id:Wo().optional(),status:Wo().optional()});const qa="#0059C4",Ua="#F1BE00",Ba="#0A1320",Wa={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"}},Va={ground:"#F7F9FC",surface:"#FFFFFF",surfaceMuted:"#F1F5FA",line:"#E6ECF4",text:Ba,textMuted:"#48586B",textSubtle:"#617489",action:qa,actionText:"#FFFFFF",accent:Ua,overlay:"rgba(10,19,32,.55)",focusRing:qa},Za={ground:Ba,surface:"#111C2B",surfaceMuted:"#1E2B3C",line:"#22334D",text:"#EEF3F9",textMuted:"#AFBDCE",textSubtle:"#8496AD",action:"#0091F6",actionText:"#FFFFFF",accent:Ua,overlay:"rgba(10,19,32,.72)",focusRing:"#00B0F8"};function Ka(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 Ja=[8,16,24];function Ga(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?{...Za}:{...Va};let o=16;void 0!==e.radius&&Ja.includes(e.radius)&&(o=e.radius);let a=t.action,r=!1;if(e.accent){(function(e,n){const t=Ka(e),o=Ka(n),[a,r]=t>o?[t,o]:[o,t];return(a+.05)/(r+.05)})(e.accent,"#FFFFFF")>=4.5?a=e.accent:(r=!0,a=qa)}return{mode:n,tokens:{...t,action:a},radius:o,accent:a,accentFellBack:r}}const Ha="--nfid-ground",Xa="--nfid-surface",Ya="--nfid-surface-muted",Qa="--nfid-line",er="--nfid-text",nr="--nfid-text-muted",tr="--nfid-text-subtle",or="--nfid-action",ar="--nfid-action-text",rr="--nfid-accent",ir="--nfid-overlay",sr="--nfid-focus-ring",cr="--nfid-radius",dr="neofaceid-focus-frame-tokens";function lr(e={}){const n=Ga(e);if("undefined"==typeof document)return n;const t=function(e){const n=e.tokens;return`.neofaceid-root {\n ${Ha}: ${n.ground};\n ${Xa}: ${n.surface};\n ${Ya}: ${n.surfaceMuted};\n ${Qa}: ${n.line};\n ${er}: ${n.text};\n ${nr}: ${n.textMuted};\n ${tr}: ${n.textSubtle};\n ${or}: ${n.action};\n ${ar}: ${n.actionText};\n ${rr}: ${n.accent};\n ${ir}: ${n.overlay};\n ${sr}: ${n.focusRing};\n ${cr}: ${e.radius}px;\n color: var(${er});\n font-family: inherit;\n}\n.neofaceid-root :focus-visible {\n outline: 2px solid var(${sr});\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(dr);if(o)return o.textContent!==t&&(o.textContent=t),n;const a=document.createElement("style");return a.id=dr,a.textContent=t,document.head.appendChild(a),n}function ur(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 pr={},fr={purpose:"authentication",legalBasis:"fraud_prevention",privacyPolicyUrl:"",retentionDays:0},hr={development:"http://localhost:8000",sandbox:"https://sandbox-core.neofaceid.com",production:"https://core.neofaceid.com.br"},mr=[8,16,24];let gr={baseUrl:hr.sandbox,applicationToken:null,environment:"sandbox",initialized:!1,appName:null,accent:null,radius:16,theme:"light",locale:"pt-BR",resolvedTheme:null,consent:{...fr}},vr=!1;function br(){return gr.initialized,gr.baseUrl}function wr(){return gr.appName}function yr(){return gr.locale}const xr=()=>br(),kr=()=>{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)},Er=()=>{const e=new AbortController,n=setTimeout((()=>e.abort()),1e4);return e.signal.addEventListener("abort",(()=>clearTimeout(n))),e},_r=async 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 a=e.getContext("2d");a?(a.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=URL.createObjectURL(e)})),Rr=async e=>new Promise(((n,t)=>{const o=new Image;o.onload=()=>{const e=1280;let{width:a}=o,{height:r}=o;a>r&&a>e?(r=r*e/a,a=e):r>e&&(a=a*e/r,r=e);const i=document.createElement("canvas");i.width=a,i.height=r;const s=i.getContext("2d");s?(s.drawImage(o,0,0,a,r),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=URL.createObjectURL(e)})),Nr=async e=>{kr();const n=Er();try{const t=await fetch(`${xr()}/api/v1/auth/application/validate_token/`,{method:"POST",headers:{"Content-Type":"application/json","X-App-Token":e},body:JSON.stringify({}),signal:n.signal});if(!t.ok)throw new h(`API Error ${t.status}`,f.INVALID_TOKEN);return t.ok}catch(t){if(t instanceof Error){if("AbortError"===t.name)throw new h("Request timeout",f.NETWORK_ERROR);throw new h(t.message,f.NETWORK_ERROR)}throw new h("Unknown error",f.NETWORK_ERROR)}},Tr=async(e,n)=>{kr();const t=Er();try{const o=await fetch(`${xr()}/api/v1/onboardings/${encodeURIComponent(n)}/`,{method:"GET",headers:{"X-App-Token":e},signal:t.signal});if(!o.ok){if(401===o.status||403===o.status)throw new h("Token de aplicação inválido ou expirado",f.INVALID_TOKEN);if(404===o.status)throw new h("Link de onboarding não encontrado",f.NOT_FOUND);throw new h(`Falha ao obter detalhes (${o.status})`,f.NETWORK)}return await o.json()}catch(o){if(o instanceof Error){if("AbortError"===o.name)throw new h("Tempo de requisição excedido",f.NETWORK);if(o instanceof h)throw o;throw new h(o.message,f.NETWORK)}throw new h("Erro desconhecido",f.NETWORK_ERROR)}},Or=async(e,n)=>{kr();const t=Er();try{const o=await fetch(`${xr()}/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 a=await o.json();return!0===(null==a?void 0:a.is_valid)}catch(o){if(o instanceof Error){if("AbortError"===o.name)throw new h("Tempo de requisição excedido",f.NETWORK);if(o instanceof h)throw o;throw new h(o.message,f.NETWORK)}throw new h("Erro desconhecido",f.NETWORK_ERROR)}},Ir=async(e,n,t,o)=>{kr();const a=Er(),r=await _r(t),i=await _r(o);try{const t=await new Promise(((e,n)=>{const t=new FileReader;t.onload=()=>e(t.result),t.onerror=n,t.readAsDataURL(r)})),o=await new Promise(((e,n)=>{const t=new FileReader;t.onload=()=>e(t.result),t.onerror=n,t.readAsDataURL(i)})),s=await fetch(`${xr()}/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:a.signal}),c=await s.json();if(!s.ok){if(401===s.status||403===s.status)throw new h("Token de aplicação inválido ou expirado",f.INVALID_TOKEN);if(404===s.status)throw new h("Link de onboarding não encontrado",f.NOT_FOUND);throw new h((null==c?void 0:c.error)||(null==c?void 0:c.message)||"Falha ao concluir onboarding",f.NETWORK)}return{success:!!c.success,message:c.message||"Onboarding concluído",person_id:c.person_id,identity_data_id:c.identity_data_id,confidence_score:c.confidence_score,processing_time:c.processing_time}}catch(s){if(s instanceof Error){if("AbortError"===s.name)throw new h("Tempo de requisição excedido",f.NETWORK);if(s instanceof h)throw s;throw new h(s.message,f.NETWORK)}throw new h("Erro desconhecido",f.NETWORK_ERROR)}},Sr=async(e,n,t,o,a)=>{if(kr(),!o||0===o.length)throw new h("Pelo menos uma imagem da pessoa é obrigatória",f.VALIDATION_ERROR);const r=Er();try{const i=await Promise.all(o.map((async e=>{const n=await _r(e);return new Promise(((e,t)=>{const o=new FileReader;o.onload=()=>e(o.result),o.onerror=t,o.readAsDataURL(n)}))}))),s=await _r(a),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(`${xr()}/api/v1/onboardings/${encodeURIComponent(n)}/complete/`,{method:"POST",headers:{"Content-Type":"application/json","X-App-Token":e},body:JSON.stringify(c),signal:r.signal}),l=await d.json();if(!d.ok){if(401===d.status||403===d.status)throw new h("Token de aplicação inválido ou expirado",f.INVALID_TOKEN);if(404===d.status)throw new h("Link de onboarding não encontrado",f.NOT_FOUND);throw new h((null==l?void 0:l.error)||(null==l?void 0:l.message)||"Falha ao concluir onboarding",f.NETWORK)}return{success:!!l.success,message:l.message||"Onboarding concluído com sucesso",person_id:l.person_id,identity_data_id:l.identity_data_id,confidence_score:l.confidence_score,processing_time:l.processing_time,liveness_passed:l.liveness_passed,document_verified:l.document_verified,person_created:l.person_created}}catch(i){if(i instanceof Error){if("AbortError"===i.name)throw new h("Tempo de requisição excedido",f.NETWORK);if(i instanceof h)throw i;throw new h(i.message,f.NETWORK)}throw new h("Erro desconhecido",f.NETWORK_ERROR)}},Cr=async(e,n)=>{kr();const t=Er(),o=await _r(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)})),a=await fetch(`${xr()}/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(!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 r=await a.json();if(!r.success)throw new h(r.message||"Recognition failed",f.RECOGNITION_FAILED);return{accessToken:r.accessToken,payload:r.payload}}catch(a){if(a instanceof Error){if("AbortError"===a.name)throw new h("Request timed out",f.NETWORK);if(a instanceof h)throw a;throw new h(a.message,f.NETWORK)}throw new h("Unknown error occurred",f.NETWORK_ERROR)}},zr=async(e,n)=>{var t,o,a,r,i;kr();const s=Er(),c=await _r(e);try{const e=await c.arrayBuffer(),d=btoa(new Uint8Array(e).reduce(((e,n)=>e+String.fromCharCode(n)),"")),l=await fetch(`${xr()}/api/v1/login/donor/face/`,{method:"POST",headers:{"Content-Type":"application/json","X-App-Token":n},body:JSON.stringify({image:d,biometric_type:"FACE"}),signal:s.signal});if(!l.ok){if(401===l.status||403===l.status)throw new h("Invalid application token",f.INVALID_TOKEN);if(l.status>=500)throw new h(`Server Error ${l.status}`,f.API_ERROR);throw new h(`API Error ${l.status}`,f.API_ERROR)}const u=await l.json();if(!u.success)throw new h(u.message||"Login failed",f.LOGIN_FAILED);return{success:!0,accessToken:u.accessToken||u.access_token||"",alias:u.alias,user:{id:(null==(t=u.user)?void 0:t.id)||"",email:(null==(o=u.user)?void 0:o.email)||"",role:(null==(a=u.user)?void 0:a.role)||"",validated:(null==(r=u.user)?void 0:r.validated)||!1,active:(null==(i=u.user)?void 0:i.active)||!1},person:u.person?{id:u.person.id||"",name:u.person.name||"",birth_date:u.person.birth_date||""}:void 0,confidence_score:u.confidence_score,recognition_id:u.recognition_id}}catch(d){if(d instanceof Error){if("AbortError"===d.name)throw new h("Request timed out",f.NETWORK);if(d instanceof h)throw d;throw new h(d.message,f.NETWORK)}throw new h("Unknown error occurred",f.NETWORK_ERROR)}},jr=async(e,n,t=!0,o=.8)=>{kr();const a=Er(),r=await _r(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(r)})),i=await fetch(`${xr()}/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:a.signal});if(!i.ok){if(401===i.status||403===i.status)throw new h("Invalid or expired application token",f.INVALID_TOKEN);throw new h(`Server returned status ${i.status}`,f.NETWORK)}const s=await i.json();return{success:s.success,confidenceScore:s.confidence_score,accessToken:s.access_token,payload:s.payload}}catch(i){if(i instanceof Error){if("AbortError"===i.name)throw new h("Request timed out",f.NETWORK);if(i instanceof h)throw i;throw new h(i.message,f.NETWORK)}throw new h("Unknown error occurred",f.NETWORK_ERROR)}},Ar=async(e,n,t,o="LOGIN")=>{kr();const a=Er();try{const r=await fetch(`${xr()}/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:a.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 i=await r.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(r){if(r instanceof Error){if("AbortError"===r.name)throw new h("Request timed out",f.NETWORK);if(r instanceof h)throw r;throw new h(r.message,f.NETWORK)}throw new h("Unknown error occurred",f.NETWORK_ERROR)}},Fr=async(e,n,t,o=.8,a,r)=>{var i;kr();const s=Er(),c=await _r(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};a&&(e.signature=a);const c=await fetch(`${xr()}/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==r?void 0:r.email),cpf:l.cpf||(null==r?void 0:r.cpf),confidenceScore:l.confidence_score,accessToken:l.access_token,payload:l.payload,signature:a,sessionId:null==r?void 0:r.sessionId}}catch(l){if(l instanceof Error){if("AbortError"===l.name)throw new h("Request timed out",f.NETWORK);if(l instanceof h)throw l;throw new h(l.message,f.NETWORK)}throw new h("Unknown error occurred",f.NETWORK_ERROR)}},Pr=async(e,n,t)=>{kr();const o=Er();try{let a,r;if(null==t?void 0:t.documentFront){const e=await Rr(t.documentFront);a=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 Rr(t.documentBack);r=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};a&&(i.document_images=[{front:a,back:r||void 0,type:(null==t?void 0:t.documentType)||"RG"}]);const s=await fetch(`${xr()}/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(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)}},$r=async e=>{const n=Er(),t=new URLSearchParams;e.email&&t.append("email",e.email),e.cpf&&t.append("cpf",e.cpf);try{const e=await fetch(`${xr()}/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)}},Dr=async(e,n,t,o)=>{var a,r,i,s,c,d,l,u;if(kr(),!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=Er();try{const g=await Promise.all(n.map((async e=>{const n=await _r(e);return new Promise(((e,t)=>{const o=new FileReader;o.onload=()=>{const n=o.result;e(n)},o.onerror=t,o.readAsDataURL(n)}))})));let v,b;if(null==o?void 0:o.documentFront){const e=await Rr(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 Rr(o.documentBack);b=await new Promise(((n,t)=>{const o=new FileReader;o.onload=()=>n(o.result),o.onerror=t,o.readAsDataURL(e)}))}const w={name:e.name,birth_date:e.birth_date,cpf:e.cpf,email:e.email,password:e.password,password_confirm:e.password,face_photos:g,is_pep:e.is_pep??!1};v&&(w.document_images=[{front:v,back:b||void 0,type:(null==o?void 0:o.documentType)||"RG"}]);const y=await fetch(`${xr()}/api/v1/signup/donor/`,{method:"POST",headers:{"Content-Type":"application/json","X-App-Token":t},body:JSON.stringify(w),signal:p.signal});if(!y.ok){if(401===y.status||403===y.status)throw new h("Invalid or expired application token",f.INVALID_TOKEN);try{const e=await y.json();if(e.errors){const n=Object.entries(e.errors).map((([e,n])=>`${"password"===e?"senha":"password_confirm"===e?"confirmação de senha":e}: ${Array.isArray(n)?n.join(", "):String(n)}`)).join("; ");throw new h(`Erro de validação: ${n}`,f.VALIDATION_ERROR)}if("fraud_detected"===e.error)throw new h("Fraud detected in biometric images. Registration blocked.",f.VALIDATION_ERROR);if("user_exists"===e.error||"ALREADY_EXISTS"===e.error_code)throw new h("User with this email already exists",f.VALIDATION_ERROR);if("person_exists"===e.error)throw new h("Person with this CPF already exists",f.VALIDATION_ERROR);const n=e.message||e.error||`Server returned status ${y.status}`;throw new h(n,f.VALIDATION_ERROR)}catch(m){if(m instanceof h)throw m;throw new h(`Server returned status ${y.status}`,f.NETWORK)}}const x=await y.json();return 202===y.status&&(null==(a=x.data)?void 0:a.task_id)?{success:x.success,message:x.message||"Registration is being processed. You will receive an email when completed.",task_id:x.data.task_id,status:x.data.status||"processing",person_id:void 0,user_id:void 0,person_validated:void 0,face_processing:void 0,onboarding_link:void 0}:{success:x.success,message:x.message,person_id:(null==(r=x.data)?void 0:r.person_id)||x.person_id,user_id:(null==(i=x.data)?void 0:i.user_id)||x.user_id,person_validated:(null==(s=x.data)?void 0:s.person_validated)||x.person_validated,face_processing:(null==(c=x.data)?void 0:c.face_processing)||x.face_processing,onboarding_link:(null==(d=x.data)?void 0:d.onboarding_link)||x.onboarding_link,task_id:null==(l=x.data)?void 0:l.task_id,status:null==(u=x.data)?void 0:u.status}}catch(g){if(g instanceof Error){if("AbortError"===g.name)throw new h("Request timed out",f.NETWORK);if(g instanceof h)throw g;throw new h(g.message,f.NETWORK)}throw new h("Unknown error occurred",f.NETWORK_ERROR)}},Lr=async(e,n,t)=>{const o=Er();try{const a=await fetch(`${xr()}/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(!a.ok){if(401===a.status||403===a.status)throw new h("Email ou senha inválidos",f.INVALID_TOKEN);throw new h(`API Error ${a.status}`,f.API_ERROR)}const r=await a.json();return{success:!0,accessToken:r.access_token||r.access,alias:r.user&&r.user.alias||r.alias,user:{id:r.user&&r.user.id||"",email:r.user&&r.user.email||"",role:r.user&&r.user.role||"",validated:r.user&&r.user.validated||!1,active:r.user&&r.user.active||!1}}}catch(a){if(a instanceof Error){if("AbortError"===a.name)throw new h("Request timed out",f.NETWORK);if(a instanceof h)throw a;throw new h(a.message,f.NETWORK)}throw new h("Unknown error occurred",f.NETWORK_ERROR)}},Mr=async(e,n)=>{var t,o,a,r;kr();const i=Er(),s=await Rr(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(`${xr()}/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==(a=s.person)?void 0:a.name)||"",birth_date:(null==(r=s.person)?void 0:r.birth_date)||""}}}catch(d){if(d instanceof Error){if("AbortError"===d.name)throw new h("Request timed out",f.NETWORK);if(d instanceof h)throw d;throw new h(d.message,f.NETWORK)}throw new h("Unknown error occurred",f.NETWORK_ERROR)}},qr=async(e,n,t)=>{if(kr(),!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=Er(),a=await _r(n),r=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)}));try{const n=await fetch(`${xr()}/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:r}),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 a=await n.json();return{success:!0,message:"Biometric data registered successfully",identity_data_id:a.id,type_of_identification:a.type_of_identification,have_biometric_data:a.have_biometric_data,created_at:a.created_at}}catch(s){if(s instanceof Error){if("AbortError"===s.name)throw new h("Request timed out",f.NETWORK);if(s instanceof h)throw s;throw new h(s.message,f.NETWORK)}throw new h("Unknown error occurred",f.NETWORK_ERROR)}},Ur=async(e,n,t)=>{kr();const o=Er();try{const r=await fetch(`${xr()}/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(!r.ok){if(401===r.status)throw new h("Invalid or expired JWT token",f.INVALID_TOKEN);if(403===r.status)throw new h("Insufficient permissions to create application",f.INVALID_TOKEN);if(400===r.status)try{const e=await r.json(),n=e.message||e.error||"Invalid application data";throw new h(n,f.VALIDATION_ERROR)}catch(a){if(a instanceof h)throw a;throw new h("Invalid application data",f.VALIDATION_ERROR)}throw new h(`Server returned status ${r.status}`,f.NETWORK)}const i=await r.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(r){if(r instanceof Error){if("AbortError"===r.name)throw new h("Request timed out",f.NETWORK);if(r instanceof h)throw r;throw new h(r.message,f.NETWORK)}throw new h("Unknown error occurred",f.NETWORK_ERROR)}},Br=async(e={})=>{kr();const{durationMs:n=3e3,onProgress:t}=e;return new Promise((async(e,o)=>{let a=null;const r=[];try{a=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(a,{mimeType:i,videoBitsPerSecond:1e6}):new MediaRecorder(a,{videoBitsPerSecond:1e6})}catch{s=new MediaRecorder(a)}const c=s.mimeType||i;if(s.ondataavailable=e=>{e.data.size>0&&r.push(e.data)},s.onstop=()=>{a&&a.getTracks().forEach((e=>e.stop()));const n=new Blob(r,{type:c});e(n)},s.onerror=e=>{a&&a.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 a=setInterval((()=>{o+=e;const r=Math.min(100,o/n*100);t(r),o>=n&&clearInterval(a)}),e)}setTimeout((()=>{s&&"recording"===s.state&&s.stop()}),n)}catch(i){a&&a.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))}}))},Wr=async(e,n,t={})=>{var o,a,r,i,s,c;const{maxAttempts:d=60,intervalMs:l=1e3,onStatusChange:u}=t;let p=0;for(;p<d;){p++;try{const t=await fetch(`${xr()}/api/v1/tasks/status/?task_id=${e}`,{method:"GET",headers:{Accept:"application/json","X-App-Token":n}});if(!t.ok)throw new h(`Task status check failed: ${t.status}`,f.NETWORK);const d=await t.json(),p=(null==(o=d.data)?void 0:o.status)||"unknown";if(u){u(p,null==(r=null==(a=d.data)?void 0:a.progress)?void 0:r.percentage)}if("success"===p)return d.data.result;if("failure"===p){const e=(null==(s=null==(i=d.data)?void 0:i.result)?void 0:s.message)||(null==(c=d.data)?void 0:c.error)||"Task failed";throw new h(e,f.RECOGNITION_FAILED)}if("revoked"===p)throw new h("Task was cancelled",f.RECOGNITION_FAILED);await new Promise((e=>setTimeout(e,l)))}catch(m){if(m instanceof h)throw m;throw new h(`Polling error: ${m instanceof Error?m.message:"Unknown error"}`,f.NETWORK)}}throw new h("Task status polling timed out",f.NETWORK)},Vr=async(e,n)=>{var t;kr();const o=Er();try{const a=await fetch(`${xr()}/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(!a.ok){if(401===a.status||403===a.status)throw new h("Invalid or expired application token",f.INVALID_TOKEN);if(400===a.status){const e=await a.json();throw new h(e.message||"Invalid request data",f.VALIDATION_ERROR)}throw new h(`Server returned status ${a.status}`,f.NETWORK)}const r=await a.json();if(!r.success||!(null==(t=r.data)?void 0:t.task_id))throw new h(r.message||"Failed to start proof of life",f.RECOGNITION_FAILED);return{taskId:r.data.task_id,historyId:r.data.history_id,status:r.data.status,message:r.message||"Recognition started successfully"}}catch(a){if(a instanceof Error){if("AbortError"===a.name)throw new h("Request timed out",f.NETWORK);if(a instanceof h)throw a;throw new h(a.message,f.NETWORK)}throw new h("Unknown error occurred",f.NETWORK_ERROR)}},Zr=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)})),Kr=async(e,n,t)=>{var o,a;if(kr(),!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 r=await Promise.all(t.map((async e=>{const n=await Rr(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=Er();try{const t=await fetch(`${xr()}/api/v1/donors/${e}/documents/`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${n}`},body:JSON.stringify({document_images:r}),signal:i.signal}),s=await t.json();if(!t.ok)throw new h((null==s?void 0:s.message)||`API Error ${t.status}`,f.NETWORK_ERROR);return{success:!0,taskId:(null==(o=s.data)?void 0:o.task_id)??"",status:(null==(a=s.data)?void 0:a.status)??"processing",message:s.message??"Documents submitted for processing"}}catch(s){if(s instanceof h)throw s;if(s instanceof Error){if("AbortError"===s.name)throw new h("Request timeout",f.NETWORK_ERROR);throw new h(s.message,f.NETWORK_ERROR)}throw new h("Unknown error occurred",f.NETWORK_ERROR)}},Jr=async(e,n)=>{const t=Er();try{const o=await fetch(`${xr()}/api/v1/tasks/status/?task_id=${e}`,{method:"GET",headers:{"Content-Type":"application/json",...n?{"X-App-Token":n}:{}},signal:t.signal}),a=await o.json();if(!o.ok)throw new h((null==a?void 0:a.message)||`API Error ${o.status}`,f.NETWORK_ERROR);return{success:a.success,status:a.data.status,result:a.data.result,error:a.data.error}}catch(o){if(o instanceof h)throw o;throw new h("Failed to fetch task status",f.NETWORK_ERROR)}},Gr=async(e,n,t={})=>{var o,a;const{maxRetries:r=30,interval:i=2e3}=t,s=await Mr(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<r;d++){const e=await Jr(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==(a=e.result.person)?void 0:a.birth_date)||""}}:{personFound:!1};if("failure"===e.status)return{personFound:!1};await new Promise((e=>setTimeout(e,i)))}throw new h("Timed out waiting for identification",f.NETWORK_ERROR)};async function Hr(e,n){const t=br(),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 Xr(e,n){const t=br(),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 Yr=Object.freeze(Object.defineProperty({__proto__:null,checkUserExistence:$r,completeOnboarding:Ir,completeOnboardingWithData:Sr,confirmPasswordReset:Xr,getOnboardingDetails:Tr,getTaskStatus:Jr,identifyPerson:Mr,identifyPersonAsync:Gr,loginWithBiometric:zr,loginWithEmail:Lr,pollTaskStatus:Wr,recognize:Cr,recognizeBiometric:jr,recognizeByPurpose:Fr,recordFaceVideo:Br,registerApplication:Ur,registerBiometric:qr,registerDocumentByImage:Kr,registerPersonWithBiometric:Dr,registerPersonWithoutFace:Pr,requestPasswordReset:Hr,simpleIdentification:Ar,startProofOfLife:Vr,validateOnboardingToken:Or,validateToken:Nr,videoToBase64:Zr},Symbol.toStringTag,{value:"Module"}));function Qr(e,n={}){if(!e||0===e.videoWidth||0===e.videoHeight)return 0;const t=n.sample??64,o=e.videoWidth,a=e.videoHeight,r=n.roi??function(e,n,t){const o=Math.round(e*t),a=Math.round(n*t);return{x:Math.round((e-o)/2),y:Math.round((n-a)/2),width:o,height:a}}(o,a,.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,r.x,r.y,r.width,r.height,0,0,t,t);return function(e){const n=e.length;if(0===n)return 0;let t=0,o=0;for(let a=0;a<n;a+=4){t+=.2126*e[a]+.7152*e[a+1]+.0722*e[a+2],o+=1}return 0===o?0:t/(255*o)}(s.getImageData(0,0,t,t).data)}catch{return 0}}function ei(e,t={}){const o=t.enabled??!0,a=t.darkThreshold??.235,r=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=Qr(e.current,{scratch:g.current??void 0});u(n);const o=Date.now();m.current||(n>0&&n<a?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;Qr(e.current,{scratch:g.current??void 0})-(h.current??0)<r&&(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,a,r,i,s,e]),{flashOn:c,lastBrightness:l}}function ni({active:e,zIndex:n=10001,onDismiss:t}){if(!e)return null;const a={position:"fixed",inset:0,background:"#FFFFFF",zIndex:n,pointerEvents:"none",animation:"nfid-flash-in 200ms ease-out"},r={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:a,"aria-hidden":"true"}),o.jsxs("div",{className:"nfid-screen-flash-hint",style:r,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:"×"})]})]})}const ti=(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}},oi={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 ai({accessToken:e,onClose:t,onSuccess:a,onCannotGesture:r,autoLighting:i=!0}){const s=n.useRef(null),c=n.useRef(null),l=n.useRef(null),u=n.useRef(null),[f,h]=n.useReducer(ti,{status:"requestingPermission"}),[m,g]=n.useState(!1),{startCamera:v,stopCamera:b}=p(),w=()=>{if(!s.current)return;const e=async()=>{if(s.current&&"ready"===f.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,a=t/2,r=o/2,i=.4*t,c=.4*o;return n.x+n.width/2>a-i/2&&n.x+n.width/2<a+i/2&&n.y+n.height/2>r-c/2&&n.y+n.height/2<r+c/2})(e[0]);g(n&&t)}catch(n){}u.current=window.setTimeout(e,100)}};e()};n.useEffect((()=>{lr()}),[]);const y=i&&("ready"===f.status||"capturing"===f.status),{flashOn:x}=ei(s,{enabled:y});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 v();l.current=e,s.current&&(s.current.srcObject=e),h({type:"PERMISSION_GRANTED"}),w()}catch(e){h({type:"PERMISSION_DENIED"})}})(),()=>{l.current&&b(l.current)})),[v,b]);const k=async()=>{if(c.current&&s.current)try{h({type:"START_CAPTURE"});const o=c.current.getContext("2d");if(!o)return void h({type:"SET_ERROR",message:"Failed to get canvas context"});c.current.width=s.current.videoWidth,c.current.height=s.current.videoHeight,o.drawImage(s.current,0,0,c.current.width,c.current.height);const r=await new Promise(((e,n)=>{var t;null==(t=c.current)||t.toBlob((t=>{t?e(t):n(new Error("Failed to convert canvas to blob"))}),"image/jpeg",.95)}));try{const n=await Cr(r,e);a({success:!0,data:{faceId:n.payload.documentId,confidence:1}}),h({type:"UPLOAD_SUCCESS"}),setTimeout(t,1500)}catch(n){h({type:"SET_ERROR",message:"Face recognition failed"})}}catch(n){h({type:"SET_ERROR",message:"Failed to capture image"})}};return o.jsxs("div",{className:"neofaceid-root",style:oi.overlay,children:[o.jsx(ni,{active:x}),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:oi.modal,className:"modal",children:[o.jsx("button",{type:"button",style:oi.closeButton,onClick:t,children:"×"}),o.jsx("video",{ref:s,style:oi.video,autoPlay:!0,playsInline:!0,muted:!0}),o.jsx("canvas",{ref:c,style:oi.canvas}),o.jsx("div",{style:oi.guide}),"ready"===f.status&&!m&&o.jsx("div",{style:oi.message,"aria-live":"assertive",children:"Centralize seu rosto no círculo"}),"capturing"===f.status&&o.jsx("div",{style:oi.message,"aria-live":"assertive",children:"Por favor, pisque os olhos"}),("ready"===f.status||"capturing"===f.status)&&o.jsx("button",{type:"button",className:"neofaceid-face-cannot-gesture",onClick:()=>{r?r():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"===f.status&&o.jsx("div",{style:oi.spinner}),"success"===f.status&&o.jsx("div",{style:oi.message,children:"Autenticado!"}),"error"===f.status&&o.jsx("div",{style:oi.message,children:f.message}),o.jsxs("div",{style:oi.controls,children:["ready"===f.status&&m&&o.jsx("button",{type:"button",style:oi.button,onClick:k,children:"Capturar"}),"capturing"===f.status&&o.jsx("button",{type:"button",style:oi.button,onClick:k,children:"Capturar"}),"error"===f.status&&o.jsx("button",{type:"button",style:oi.button,onClick:()=>{h({type:"RESET"})},children:"Tentar Novamente"})]})]})]})}const ri='<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 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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>',ii=ri;function si(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;">${ri}</span>`}class ci{constructor(e){i(this,"applicationToken"),i(this,"modalElement",null),this.applicationToken=e}open(){this.modalElement||(lr(),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 ${si(18)}\n <span>NeoFaceId by</span>\n <span class="neoface-forgot-brand-name">OCTA</span>\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 ${si(18)}\n <span>NeoFaceId by</span>\n <span class="neoface-forgot-brand-name">OCTA</span>\n </div>\n `;e.querySelector(".neoface-forgot-close-success").addEventListener("click",this.close.bind(this))}async handleSubmit(e){var n,t,o,a;e.preventDefault();const r=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==(a=null==r?void 0:r.value)?void 0:a.trim();if(c){i.disabled=!0,i.textContent="Enviando...",s.style.display="none";try{await Hr(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)||ur(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 di=(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 ui();default:return e}},li={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..."},ui=()=>{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}},pi=8,fi=10,hi=26,mi=8,gi=-8,vi=15,bi=-15,wi=1500,yi=150,xi=.35,ki=.65,Ei=.18,_i=.22,Ri=2e4;function Ni({personData:e,applicationToken:t,onClose:a,onSuccess:r,onPhotosCaptured:i,onError:s,onCannotGesture:c,autoLighting:l=!0}){const u=n.useRef(null),p=n.useRef(null),f=n.useRef(null),h=n.useRef(null),m=n.useRef(null),g=n.useRef(!1),v=n.useRef("center"),b=n.useRef(null),w=n.useRef(null),y=n.useRef(!1),x=n.useRef(null),[k,E]=n.useReducer(di,void 0,ui),[_,R]=n.useState(!1),[N,T]=n.useState("ok"),[O,I]=n.useState(!1);n.useEffect((()=>{lr()}),[]);const S=l&&("liveness"===k.status||"camera-loading"===k.status),{flashOn:C}=ei(u,{enabled:S});n.useEffect((()=>{if("liveness"===k.status){const e=k.step;v.current!==e&&(v.current=e,g.current||(h.current&&(h.current=null),m.current&&(clearInterval(m.current),m.current=null),E({type:"UPDATE_PROGRESS",progress:0}))),x.current={stepSequence:k.stepSequence,currentStepIndex:k.currentStepIndex,capturedPhotos:k.capturedPhotos},w.current&&clearTimeout(w.current),"complete"!==k.step&&(w.current=window.setTimeout((()=>{E({type:"ERROR",message:"Tempo limite atingido para o movimento. Por favor, tente novamente em um ambiente bem iluminado.",retryable:!0})}),Ri))}}),[k.status,"liveness"===k.status&&k.step,"liveness"===k.status&&k.currentStepIndex]);const z=e=>{if(g.current||"complete"===v.current)return;const n=Date.now();e?h.current||(h.current=n,m.current&&clearInterval(m.current),m.current=window.setInterval((()=>{if(!h.current)return;const e=Date.now()-h.current,n=Math.min(e/wi*100,100);E({type:"UPDATE_PROGRESS",progress:n}),n>=100&&(clearInterval(m.current),m.current=null,j())}),50)):h.current&&(h.current=null,m.current&&(clearInterval(m.current),m.current=null),E({type:"UPDATE_PROGRESS",progress:0}))};n.useEffect((()=>{(async()=>{try{const e="/models",n=new Promise(((e,n)=>setTimeout((()=>n(new Error("Timeout ao carregar modelos"))),1e4)));await Promise.race([Promise.all([d.nets.tinyFaceDetector.loadFromUri(e),d.nets.faceLandmark68Net.loadFromUri(e)]),n])}catch(e){E({type:"ERROR",message:"Não foi possível carregar os modelos de IA. Verifique sua conexão e tente novamente.",retryable:!0})}})()}),[]),n.useEffect((()=>()=>{f.current&&(f.current.getTracks().forEach((e=>{e.stop()})),f.current=null),u.current&&(u.current.srcObject=null),b.current&&(clearTimeout(b.current),b.current=null),m.current&&(clearInterval(m.current),m.current=null),w.current&&(clearTimeout(w.current),w.current=null)}),[]),n.useEffect((()=>{let e=!0;return(async()=>{if("liveness"===k.status&&!f.current){y.current=!1,b.current&&(clearTimeout(b.current),b.current=null),b.current=window.setTimeout((()=>{e&&!1===y.current&&E({type:"ERROR",message:"A câmera não respondeu a tempo. Verifique se ela está disponível e tente novamente.",retryable:!0})}),2e4);try{const n=await navigator.mediaDevices.getUserMedia({video:{width:{ideal:640},height:{ideal:480},facingMode:"user"}});if(!e)return void n.getTracks().forEach((e=>e.stop()));const t=async()=>{let e=0;for(;!u.current&&e<50;)await new Promise((e=>setTimeout(e,100))),e++;return u.current},o=await t();if(!o)throw new Error("Elemento de vídeo não encontrado");o.srcObject=n,f.current=n,o.onloadedmetadata=()=>{o.play().then((()=>{e&&I(!0)}))}}catch(n){if(!e)return;b.current&&(clearTimeout(b.current),b.current=null);let t=n instanceof Error?n.message:"Erro ao acessar câmera";n instanceof DOMException&&("NotAllowedError"===n.name||"PermissionDeniedError"===n.name?t="Permissão de câmera negada. Permita o acesso à câmera nas configurações do navegador e tente novamente.":"NotFoundError"===n.name||"DevicesNotFoundError"===n.name?t="Nenhuma câmera encontrada. Conecte uma câmera e tente novamente.":"NotReadableError"===n.name&&(t="A câmera está sendo usada por outro programa. Feche-o e tente novamente.")),E({type:"ERROR",message:t,retryable:!0})}}})(),()=>{e=!1,b.current&&(clearTimeout(b.current),b.current=null),f.current&&(f.current.getTracks().forEach((e=>e.stop())),f.current=null),m.current&&(clearInterval(m.current),m.current=null),h.current=null}}),[k.status]),n.useEffect((()=>{if("liveness"!==k.status||!u.current)return;let e=!0,n=0;const t=async()=>{if(!e||"liveness"!==k.status)return;if(g.current||"complete"===v.current)return void requestAnimationFrame(t);const o=Date.now();if(o-n<yi)requestAnimationFrame(t);else{n=o;try{const n=await d.detectSingleFace(u.current,new d.TinyFaceDetectorOptions({inputSize:224,scoreThreshold:.35})).withFaceLandmarks();if(!e)return;const o=!!n;if(R(o),o&&n.detection){const e=(e=>{if(!e||!u.current)return"not-detected";const{box:n}=e.detection,t=u.current.videoWidth||640,o=u.current.videoHeight||480,a=n.width/t;if(a<xi)return"too-far";if(a>ki)return"too-close";const r=n.x+n.width/2,i=n.y+n.height/2,s=Math.abs(r-t/2)/t,c=Math.abs(i-o/2)/o;return s>Ei||c>_i?"not-centered":"ok"})(n);if("not-detected"!==e&&T(e),"ok"!==e)return z(!1),void requestAnimationFrame(t)}if(o&&n.landmarks){const e=(e=>{try{const n=e.positions||e._positions;if(!Array.isArray(n)||n.length<68)return null;const t=e=>{const t=n[e];return{x:void 0!==t._x?t._x:t.x,y:void 0!==t._y?t._y:t.y}},o=t(30),a=t(8),r=t(36),i=t(45),s=(r.x+i.x)/2,c=(o.x-s)/Math.abs(i.x-r.x)*90,d=(r.y+i.y)/2,l=o.y-d,u=-l/Math.abs(a.y-d)*90+hi;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)<pi&&Math.abs(n)<fi;case"up":return e>mi;case"down":return e<gi;case"left":return n>vi;case"right":return n<bi;default:return!1}})(e.pitch,e.yaw,v.current);z(n)}}else h.current&&(h.current=null,m.current&&(clearInterval(m.current),m.current=null),E({type:"UPDATE_PROGRESS",progress:0}))}catch(a){}e&&"liveness"===k.status&&requestAnimationFrame(t)}},o=()=>{e&&u.current&&(y.current=!0,b.current&&(clearTimeout(b.current),b.current=null),t())},a=u.current;if(a&&a.readyState>=2){const n=setTimeout(o,200);return()=>{e=!1,clearTimeout(n),m.current&&(clearInterval(m.current),m.current=null),h.current=null}}const r=()=>{e&&o()};let i=0;const s=window.setInterval((()=>{i++,e?u.current&&u.current.readyState>=2?(clearInterval(s),u.current.removeEventListener("canplay",r),o()):i>=50&&clearInterval(s):clearInterval(s)}),300);return null==a||a.addEventListener("canplay",r,{once:!0}),()=>{e=!1,clearInterval(s),null==a||a.removeEventListener("canplay",r),m.current&&(clearInterval(m.current),m.current=null),h.current=null}}),[k.status]);const j=async()=>{if(!u.current||!p.current||g.current)return;g.current=!0,h.current=null;const e=x.current;if(!e)return void(g.current=!1);const n=p.current,t=u.current,o=n.getContext("2d");o?(n.width=t.videoWidth,n.height=t.videoHeight,o.scale(-1,1),o.drawImage(t,-n.width,0,n.width,n.height),n.toBlob((n=>{if(!n)return void(g.current=!1);const t=e.currentStepIndex+1,o=e.stepSequence[t];if("complete"===o){const t=[...e.capturedPhotos,n];E({type:"START_PROCESSING"}),A(t)}else setTimeout((()=>{g.current=!1,E({type:"NEXT_STEP",step:o,photo:n})}),100)}),"image/jpeg",.85)):g.current=!1},A=async n=>{var o;try{if(E({type:"START_PROCESSING"}),t&&n.length>0)try{const{identifyPersonAsync:e}=await Promise.resolve().then((()=>Yr)),a=new Promise((e=>setTimeout((()=>e(null)),5e3))),r=await Promise.race([e(n[0],t,{maxRetries:3,interval:1e3}),a]);if(r&&r.personFound)return void E({type:"DUPLICATE",personName:(null==(o=r.person)?void 0:o.name)||"Pessoa identificada"})}catch(a){}if(i)return E({type:"SUCCESS"}),void i(n);if(!e||!t)throw new Error("Dados de registro não fornecidos");const s=await Dr(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"}),r&&r(c)}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(ni,{active:C}),o.jsx("div",{className:"neofaceid-root modal-overlay",children:o.jsxs("div",{className:"modal-content",children:[o.jsx("button",{type:"button",className:"close-button",onClick:a,children:"×"}),"liveness"===k.status&&(()=>{if("liveness"!==k.status)return null;const e=`${k.currentStepIndex+1}/${k.stepSequence.length-1}`,{stepProgress:n}=k;return o.jsxs("div",{className:"liveness-container",children:[o.jsx("div",{className:"progress-indicator",children:o.jsx("span",{className:"progress-text",children:e})}),_&&"ok"!==N&&o.jsxs("div",{className:"status-badge "+("not-centered"===N?"warning":"error"),children:["too-far"===N&&"Aproxime-se mais","too-close"===N&&"Afaste-se um pouco","not-centered"===N&&"Centralize seu rosto"]}),o.jsx("div",{className:"video-wrapper",children:o.jsx("div",{className:`video-circle ${_&&"ok"===N?"face-detected":""} ${n>0?"capturing":""}`,children:o.jsx("video",{ref:u,className:"video-feed "+(O?"ready":""),autoPlay:!0,muted:!0,playsInline:!0})})}),o.jsxs("div",{className:"instruction-box",children:[o.jsx("p",{className:"instruction-text","aria-live":"assertive",children:li[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():a()},"aria-label":"Não consigo fazer esse movimento — buscar alternativa",children:"Não consigo fazer esse movimento"}),o.jsxs("div",{className:"branding-small",children:[o.jsx("span",{className:"brand-logo-small",style:{display:"inline-flex",width:18,height:18,color:"currentColor"},dangerouslySetInnerHTML:{__html:ii}}),o.jsx("span",{children:"NeoFaceId by"}),o.jsx("span",{className:"brand-name",children:"OCTA"})]})]})})(),"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.jsxs("div",{className:"branding",style:{marginTop:"40px",paddingTop:"24px",borderTop:"1px solid rgba(255, 255, 255, 0.1)"},children:[o.jsx("span",{children:"NeoFaceId by"}),o.jsx("span",{className:"brand-name",children:"OCTA"})]})]}),"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.jsxs("div",{className:"branding",style:{marginTop:"40px",paddingTop:"24px",borderTop:"1px solid rgba(255, 255, 255, 0.1)"},children:[o.jsx("span",{children:"NeoFaceId by"}),o.jsx("span",{className:"brand-name",children:"OCTA"})]})]}),"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:a,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:a,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:()=>{a(),window.location.href="/"},children:"Ir para o Login"}),o.jsx("button",{type:"button",className:"secondary-button",style:{marginTop:"12px"},onClick:()=>{a(),new ci(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.jsxs("div",{className:"branding",style:{marginTop:"32px",paddingTop:"20px",borderTop:"1px solid rgba(255, 255, 255, 0.08)",width:"100%"},children:[o.jsx("span",{className:"brand-logo",style:{display:"inline-flex",width:18,height:18,color:"currentColor"},dangerouslySetInnerHTML:{__html:ii}}),o.jsx("span",{children:"NeoFaceId by"}),o.jsx("span",{className:"brand-name",children:"OCTA"})]})]})})()]})}),o.jsx("canvas",{ref:p})]})}const Ti="https://neofaceid.com/privacidade",Oi={verification:{title:"Vamos confirmar que é você",duration:"Leva cerca de 20 segundos e usa a câmera do seu dispositivo.",bullet1Title:"Sua câmera liga agora",bullet1Body:"Você vê a imagem o tempo todo e pode encerrar quando quiser.",bullet2Title:"Pediremos dois movimentos simples",bullet2Body:"Virar o rosto ou piscar — é assim que sabemos que há alguém ali.",bullet3Title:"A imagem não fica guardada",bullet3Body:"Ela é usada para a verificação e descartada em seguida.",primary:"Começar verificação"},registration:{title:"Vamos cadastrar seu rosto",duration:"Leva cerca de 20 segundos e usa a câmera do seu dispositivo.",bullet1Title:"Sua câmera liga agora",bullet1Body:"Você vê a imagem o tempo todo e pode encerrar quando quiser.",bullet2Title:"Pediremos dois movimentos simples",bullet2Body:"Virar o rosto ou piscar — é assim que sabemos que há alguém ali.",bullet3Title:"Guardamos um vetor matemático do seu rosto",bullet3Body:"Não a foto. A imagem é descartada.",primary:"Começar cadastro"}},Ii=()=>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"})]}),Si=()=>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"})]}),Ci=()=>o.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[o.jsx("path",{d:"M12 2 4 5v7c0 5 3.5 8.5 8 10 4.5-1.5 8-5 8-10V5l-8-3Z"}),o.jsx("path",{d:"m9 12 2 2 4-4"})]});function zi({appName:e,flow:n,privacyPolicyUrl:t=Ti,retentionDays:a=90,onAccept:r,onDecline:i}){const s=Oi[n];return o.jsxs(o.Fragment,{children:[o.jsx("style",{children:"\n @keyframes neofaceidConsentFadeIn { from { opacity: 0 } to { opacity: 1 } }\n @keyframes neofaceidConsentSlideUp {\n from { opacity: 0; transform: translateY(12px) }\n to { opacity: 1; transform: translateY(0) }\n }\n .neofaceid-consent-overlay {\n position: fixed; inset: 0;\n background: var(--nfid-overlay);\n backdrop-filter: blur(3px);\n -webkit-backdrop-filter: blur(3px);\n display: flex; align-items: center; justify-content: center;\n z-index: 10001; padding: 20px;\n animation: neofaceidConsentFadeIn 200ms ease-out;\n font-family: inherit;\n color: var(--nfid-text);\n }\n .neofaceid-consent-modal {\n background: var(--nfid-surface);\n border-radius: var(--nfid-radius, 16px);\n padding: 28px;\n max-width: 440px;\n width: 100%;\n box-shadow: 0 1px 3px rgba(10, 19, 32, 0.08);\n animation: neofaceidConsentSlideUp 320ms cubic-bezier(.2,0,0,1);\n box-sizing: border-box;\n }\n .neofaceid-consent-header {\n display: flex;\n align-items: baseline;\n gap: 10px;\n margin-bottom: 20px;\n }\n .neofaceid-consent-appname {\n font-size: 17px;\n font-weight: 700;\n color: var(--nfid-text);\n line-height: 1.2;\n }\n .neofaceid-consent-brand-caption {\n font-size: 11px;\n font-weight: 700;\n letter-spacing: 0.09em;\n text-transform: uppercase;\n color: var(--nfid-text-subtle);\n }\n .neofaceid-consent-title {\n font-size: 22px;\n font-weight: 700;\n color: var(--nfid-text);\n margin: 0 0 8px;\n line-height: 1.25;\n letter-spacing: -0.015em;\n }\n .neofaceid-consent-duration {\n font-size: 14px;\n color: var(--nfid-text-muted);\n margin: 0 0 20px;\n line-height: 1.5;\n }\n .neofaceid-consent-bullets {\n display: flex;\n flex-direction: column;\n gap: 14px;\n margin-bottom: 20px;\n }\n .neofaceid-consent-bullet {\n display: flex;\n gap: 12px;\n align-items: flex-start;\n }\n .neofaceid-consent-bullet-icon {\n flex-shrink: 0;\n color: var(--nfid-action);\n margin-top: 2px;\n }\n .neofaceid-consent-bullet-title {\n font-size: 14px;\n font-weight: 600;\n color: var(--nfid-text);\n margin: 0 0 2px;\n line-height: 1.35;\n }\n .neofaceid-consent-bullet-body {\n font-size: 13px;\n color: var(--nfid-text-muted);\n margin: 0;\n line-height: 1.45;\n }\n .neofaceid-consent-link {\n display: inline-block;\n font-size: 13px;\n color: var(--nfid-action);\n text-decoration: underline;\n margin-bottom: 20px;\n }\n .neofaceid-consent-link:hover { opacity: 0.85; }\n .neofaceid-consent-actions {\n display: flex;\n flex-direction: column;\n gap: 10px;\n }\n .neofaceid-consent-button {\n min-height: 44px;\n padding: 12px 20px;\n border-radius: var(--nfid-radius, 16px);\n border: none;\n font-size: 15px;\n font-weight: 600;\n cursor: pointer;\n transition: background 120ms ease-out, transform 120ms ease-out;\n font-family: inherit;\n }\n .neofaceid-consent-button-primary {\n background: var(--nfid-action);\n color: var(--nfid-action-text);\n }\n .neofaceid-consent-button-primary:hover { opacity: 0.92; }\n .neofaceid-consent-button-primary:focus-visible {\n outline: 2px solid var(--nfid-focus-ring);\n outline-offset: 2px;\n }\n .neofaceid-consent-button-ghost {\n background: transparent;\n color: var(--nfid-text-muted);\n }\n .neofaceid-consent-button-ghost:hover { background: var(--nfid-surface-muted); }\n .neofaceid-consent-footer {\n display: flex;\n justify-content: center;\n margin-top: 20px;\n padding-top: 16px;\n border-top: 1px solid var(--nfid-line);\n }\n .neofaceid-consent-seal {\n font-size: 10px;\n font-weight: 500;\n letter-spacing: 0.06em;\n text-transform: uppercase;\n color: var(--nfid-text-subtle);\n }\n @media (max-width: 640px) {\n .neofaceid-consent-modal { padding: 22px; border-radius: 16px; }\n .neofaceid-consent-title { font-size: 20px; }\n }\n @media (prefers-reduced-motion: reduce) {\n .neofaceid-consent-overlay,\n .neofaceid-consent-modal { animation: none; }\n }\n "}),o.jsx("div",{className:"neofaceid-root neofaceid-consent-overlay",role:"dialog","aria-modal":"true","aria-labelledby":"neofaceid-consent-title",children:o.jsxs("div",{className:"neofaceid-consent-modal",children:[o.jsxs("div",{className:"neofaceid-consent-header",children:[o.jsx("span",{className:"neofaceid-consent-appname",children:e}),o.jsx("span",{className:"neofaceid-consent-brand-caption",children:"NeoFaceID"})]}),o.jsx("h1",{id:"neofaceid-consent-title",className:"neofaceid-consent-title",children:s.title}),o.jsx("p",{className:"neofaceid-consent-duration",children:s.duration}),o.jsxs("div",{className:"neofaceid-consent-bullets",children:[o.jsxs("div",{className:"neofaceid-consent-bullet",children:[o.jsx("div",{className:"neofaceid-consent-bullet-icon",children:o.jsx(Ii,{})}),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(Si,{})}),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(Ci,{})}),o.jsxs("div",{children:[o.jsx("p",{className:"neofaceid-consent-bullet-title",children:s.bullet3Title}),o.jsx("p",{className:"neofaceid-consent-bullet-body",children:s.bullet3Body})]})]})]}),o.jsxs("a",{href:t,target:"_blank",rel:"noopener noreferrer",className:"neofaceid-consent-link",children:["Ver política de privacidade (retenção de até ",a," dias)"]}),o.jsxs("div",{className:"neofaceid-consent-actions",children:[o.jsx("button",{type:"button",className:"neofaceid-consent-button neofaceid-consent-button-primary",onClick:r,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("span",{className:"neofaceid-consent-seal",children:"Protegido por NeoFaceID"})})]})})]})}class ji{constructor(){i(this,"container",null),i(this,"root",null)}show(e){this.container||(lr(),this.container=document.createElement("div"),this.container.id="neofaceid-consent-modal-container",document.body.appendChild(this.container),this.root=t.createRoot(this.container),this.root.render(o.jsx(zi,{...e,onAccept:()=>{this.close(),e.onAccept()},onDecline:()=>{this.close(),e.onDecline()}})))}close(){this.container&&document.body.contains(this.container)&&(this.root&&this.root.unmount(),document.body.removeChild(this.container),this.container=null,this.root=null)}}function Ai(e={}){const n=wr(),t=e.appName??n??"sua aplicação";e.appName;const o=e.flow??"verification";return new Promise((n=>{(new ji).show({appName:t,flow:o,privacyPolicyUrl:e.privacyPolicyUrl??Ti,retentionDays:e.retentionDays??90,onAccept:()=>n(!0),onDecline:()=>n(!1)})}))}const Fi={flow:"verification",privacyPolicyUrl:Ti,retentionDays:90};function Pi(e,n={}){const t=n.darkThreshold??.235,o=n.improvementTarget??.12,a=n.sampleIntervalMs??600,r=n.minToggleMs??3e3,i=n.zIndex??10001,s=`nfid-flash-${Math.random().toString(36).slice(2,9)}`;let c=null,d=null,l=!1,u=0,p=0,f=0,h=null,m=null,g=null;const v=e=>{l!==e&&(l=e,e?m||"undefined"==typeof document||(m=document.createElement("div"),m.id=s,m.setAttribute("aria-hidden","true"),m.style.cssText=`\n position: fixed; inset: 0; background: #FFFFFF;\n z-index: ${i}; pointer-events: none;\n opacity: 0; transition: opacity 200ms ease-out;\n `,document.body.appendChild(m),requestAnimationFrame((()=>{m&&(m.style.opacity="1")}))):(()=>{if(!m)return;const e=m;m=null,e.style.opacity="0",setTimeout((()=>{e.parentNode&&e.parentNode.removeChild(e)}),220)})(),n.onChange&&n.onChange(e,u))},b=()=>{"undefined"==typeof document||g||(g=document.createElement("canvas"));const n=Qr(e(),{scratch:g??void 0});u=n;const a=Date.now();l||(n>0&&n<t?p+=1:p=0,p>=2&&a-f>=r&&(h=n,f=a,p=0,v(!0),d=setTimeout((()=>{Qr(e(),{scratch:g??void 0})-(h??0)<o&&(f=Date.now(),v(!1)),h=null}),600)))};return{start(){!1!==n.enabled&&(c||(b(),c=setInterval(b,a)))},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 $i{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=Pi((()=>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 <span class="neofaceid-seal">Protegido por NeoFaceID</span>\n </div>\n </div>\n </div>\n `,lr(),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((()=>os)),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(),ur(e,"\n .neofaceid-biometric-modal {\n position: fixed;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n z-index: 10000;\n font-family: inherit;\n }\n\n .neofaceid-modal-overlay {\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n background: rgba(0, 0, 0, 0.8);\n display: flex;\n align-items: center;\n justify-content: center;\n padding: 20px;\n box-sizing: border-box;\n }\n\n .neofaceid-modal-content {\n background: white;\n border-radius: 12px;\n max-width: 600px;\n width: 100%;\n max-height: 90vh;\n overflow: hidden;\n box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);\n }\n\n .neofaceid-modal-header {\n padding: 20px;\n border-bottom: 1px solid #e0e0e0;\n display: flex;\n justify-content: space-between;\n align-items: center;\n }\n\n .neofaceid-modal-header h2 {\n margin: 0;\n font-size: 24px;\n font-weight: 600;\n color: #333;\n }\n\n .neofaceid-close-btn {\n background: none;\n border: none;\n font-size: 22px;\n cursor: pointer;\n color: #666;\n padding: 0;\n min-width: 44px;\n min-height: 44px;\n display: flex;\n align-items: center;\n justify-content: center;\n border-radius: 22px;\n transition: background-color 0.2s;\n }\n .neofaceid-close-btn:focus-visible {\n outline: 2px solid var(--nfid-focus-ring);\n outline-offset: 2px;\n }\n\n .neofaceid-close-btn:hover {\n background-color: #f0f0f0;\n }\n\n .neofaceid-modal-body {\n padding: 20px;\n }\n\n .neofaceid-subtitle {\n margin: 0 0 20px 0;\n color: #666;\n font-size: 16px;\n line-height: 1.4;\n }\n\n .neofaceid-camera-container {\n position: relative;\n background: #000;\n border-radius: 8px;\n overflow: hidden;\n aspect-ratio: 4/3;\n margin-bottom: 20px;\n }\n\n .neofaceid-video {\n width: 100%;\n height: 100%;\n object-fit: cover;\n }\n\n .neofaceid-canvas {\n position: absolute;\n top: 0;\n left: 0;\n }\n\n .neofaceid-overlay {\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n display: flex;\n align-items: center;\n justify-content: center;\n }\n\n .neofaceid-frame {\n width: 200px;\n height: 200px;\n border: 3px solid #0E9F6E;\n border-radius: 50%;\n box-shadow: 0 0 0 2px rgba(76, 175, 80, 0.3);\n animation: pulse 2s infinite;\n }\n\n .neofaceid-seal-row {\n display: flex;\n justify-content: center;\n padding: 12px 20px 16px;\n border-top: 1px solid var(--nfid-line, #E6ECF4);\n }\n .neofaceid-seal {\n font-size: 10px;\n font-weight: 500;\n letter-spacing: 0.06em;\n text-transform: uppercase;\n color: var(--nfid-text-subtle, #617489);\n }\n\n .neofaceid-status {\n text-align: center;\n margin-bottom: 20px;\n }\n\n .neofaceid-status-text {\n margin: 0;\n color: #666;\n font-size: 16px;\n }\n\n .neofaceid-modal-footer {\n padding: 20px;\n border-top: 1px solid #e0e0e0;\n display: flex;\n gap: 12px;\n justify-content: flex-end;\n }\n\n .neofaceid-cancel-btn,\n .neofaceid-capture-btn {\n padding: 12px 24px;\n border: none;\n border-radius: 6px;\n font-size: 16px;\n font-weight: 500;\n cursor: pointer;\n transition: all 0.2s;\n }\n\n .neofaceid-cancel-btn {\n background: #f5f5f5;\n color: #666;\n }\n\n .neofaceid-cancel-btn:hover {\n background: #e0e0e0;\n }\n\n .neofaceid-capture-btn {\n background: #0E9F6E;\n color: white;\n }\n\n .neofaceid-capture-btn:hover:not(:disabled) {\n background: #45a049;\n }\n\n .neofaceid-capture-btn:disabled {\n background: #ccc;\n cursor: not-allowed;\n }\n\n @keyframes pulse {\n 0% { box-shadow: 0 0 0 2px rgba(76, 175, 80, 0.3); }\n 50% { box-shadow: 0 0 0 10px rgba(76, 175, 80, 0.1); }\n 100% { box-shadow: 0 0 0 2px rgba(76, 175, 80, 0.3); }\n }\n\n @media (max-width: 640px) {\n .neofaceid-modal-overlay {\n padding: 10px;\n }\n \n .neofaceid-modal-header,\n .neofaceid-modal-body,\n .neofaceid-modal-footer {\n padding: 15px;\n }\n \n .neofaceid-frame {\n width: 150px;\n height: 150px;\n }\n }\n ")}}class Di{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,a=this.getStatusText(),r=["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;">${si(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 ${a?`\n <div class="neofaceid-status-text">\n ${a}${r?'\n <span class="neofaceid-dots">\n <span class="neofaceid-dot">.</span>\n <span class="neofaceid-dot">.</span>\n <span class="neofaceid-dot">.</span>\n </span>\n ':""}\n </div>\n `:""}\n </div>\n </div>\n `}show(e="preparing"){this.container?this.updateStatus(e):(this.container=document.createElement("div"),this.container.id="neofaceid-status-overlay",this.currentStatus=e,this.container.innerHTML=this.renderContent(),document.body.appendChild(this.container))}updateStatus(e){this.currentStatus=e,this.container&&(this.container.innerHTML=this.renderContent())}close(){if(this.container){const e=this.container.querySelector(".neofaceid-overlay-container");e&&e.classList.add("fade-out"),setTimeout((()=>{this.container&&document.body.contains(this.container)&&document.body.removeChild(this.container),this.container=null}),300)}}}function Li({error:e,onRetry:n,onCredentials:t,onCancel:a,applicationToken:r}){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"}),r&&o.jsx("button",{type:"button",className:"neofaceid-fallback-button neofaceid-fallback-button-ghost",onClick:()=>{new ci(r).open()},children:"Esqueceu sua senha?"}),a&&o.jsx("button",{type:"button",className:"neofaceid-fallback-button neofaceid-fallback-button-ghost",onClick:a,children:"Cancelar"})]})]})})]})}class Mi{constructor(){i(this,"container",null),i(this,"root",null)}show(e,n,o,a,r){this.container||(lr(),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,a,r))}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,a,r){this.root&&this.container&&this.root.render(o.jsx(Li,{error:e,onRetry:()=>{this.close(),n()},onCredentials:()=>{this.close(),t()},applicationToken:r??"",onCancel:()=>{this.close(),null==a||a()}}))}}class qi{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(){lr(),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 ${si(18)}\n <span>NeoFaceId by</span>\n <span class="neoface-email-brand-name">OCTA</span>\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)||ur(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"),a=this.modalElement.querySelector("#login-error"),r=e=>{a.textContent=e,a.style.display="block"};a.style.display="none",a.textContent="";const i=n.value.trim(),s=t.value.trim();if(i&&s){o.disabled=!0,o.textContent="Entrando...";try{const e=await Lr(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"))?(r("Email ou senha incorretos. Verifique seus dados e tente novamente."),t.value="",t.focus()):(r("Ocorreu um erro inesperado. Tente novamente mais tarde."),this.options.onError(c))}}else r("Preencha o email e a senha para continuar.")}}let Ui=!1,Bi=null;async function Wi(){if(!Ui)return Bi||(Bi=(async()=>{try{const e="/models";await d.nets.tinyFaceDetector.loadFromUri(e),Ui=!0}catch(e){}})(),Bi)}async function Vi(e,n,t=!1,o=!1){o?n.updateStatus("detecting"):n.updateStatus("preparing");const a=document.createElement("video");a.style.position="fixed",a.style.top="-9999px",a.style.left="-9999px",a.style.width="1px",a.style.height="1px",a.style.opacity="0",a.muted=!0,a.playsInline=!0,a.setAttribute("autoplay",""),a.setAttribute("playsinline",""),document.body.appendChild(a);let r=null;try{try{r=await navigator.mediaDevices.getUserMedia({video:{width:{ideal:640},height:{ideal:480},facingMode:"user"},audio:!1})}catch{r=await navigator.mediaDevices.getUserMedia({video:{facingMode:"user"},audio:!1})}a.srcObject=r,await new Promise((e=>{if(a.readyState>=1)e();else{const n=()=>{a.removeEventListener("loadedmetadata",n),e()};a.addEventListener("loadedmetadata",n),setTimeout(e,2e3)}})),await a.play(),await new Promise((e=>{if(a.videoWidth&&a.videoHeight)e();else{const n=()=>{a.videoWidth&&a.videoHeight?e():setTimeout(n,100)};setTimeout(e,3e3),n()}})),n.updateStatus("detecting"),await new Promise((e=>setTimeout(e,100)));let o=!0;if(t||(o=await async function(e,n=5e3,t=100,o){return new Promise((a=>{let r=0;const i=Math.ceil(n/t);let s=null,c=!1,l=!1;const u=Math.ceil(3e3/t),p=e=>{c||(c=!0,s&&clearTimeout(s),a(e))},f=async()=>{if(!c){if(r++,!Ui)return o&&!l&&r>=u&&(o.updateStatus("waiting-for-face"),l=!0),r>=i?void p(!1):void(s=window.setTimeout(f,t));try{if(await d.detectSingleFace(e,new d.TinyFaceDetectorOptions({inputSize:160,scoreThreshold:.3})))return o&&l&&(o.updateStatus("detecting"),l=!1),void p(!0);if(o&&!l&&r>=u&&(o.updateStatus("waiting-for-face"),l=!0),r>=i)return void p(!1);s=window.setTimeout(f,t)}catch(n){if(o&&!l&&r>=u&&(o.updateStatus("waiting-for-face"),l=!0),r>=i)return void p(!1);s=window.setTimeout(f,t)}}};window.setTimeout((()=>{c||p(!1)}),n+500),f()}))}(a,5e3,100,n)),!o)throw r&&r.getTracks().forEach((e=>e.stop())),a.parentElement&&a.parentElement.removeChild(a),new h("Nenhum rosto detectado. Por favor, posicione seu rosto na frente da câmera e tente novamente.",f.VALIDATION_ERROR);n.updateStatus("capturing");const i=document.createElement("canvas");i.width=a.videoWidth,i.height=a.videoHeight;const s=i.getContext("2d");if(!s)throw r&&r.getTracks().forEach((e=>e.stop())),a.parentElement&&a.parentElement.removeChild(a),new h("Erro ao capturar imagem",f.CAPTURE_ERROR);s.drawImage(a,0,0,i.width,i.height),r&&r.getTracks().forEach((e=>e.stop())),a.parentElement&&a.parentElement.removeChild(a);const c=await new Promise(((e,n)=>{i.toBlob((t=>{i.remove(),t?e(t):n(new Error("Failed to capture image"))}),"image/jpeg",.85)}));n.updateStatus("verifying");const l=await zr(c,e);if(!l.success)throw new h("Login falhou",f.LOGIN_FAILED);return l}catch(i){if(r&&r.getTracks().forEach((e=>e.stop())),a.parentElement&&a.parentElement.removeChild(a),i instanceof h)throw i;throw new h(i instanceof Error?i.message:"Erro desconhecido",f.UNKNOWN)}}async function Zi(e){const{applicationToken:n,onSuccess:t,onError:o,onFallbackRequest:a,onCancel:r,fastMode:i=!1}=e,s=new Di,c=new Mi;let d,l=0;Ui||i||Wi().catch((()=>{})),s.show("preparing");const u=async()=>{try{l++;const e=await Vi(n,s,i,l>1);s.updateStatus("success"),setTimeout((()=>{s.close(),t(e)}),200)}catch(e){d=e instanceof h?e:new h(e instanceof Error?e.message:"Erro desconhecido",f.UNKNOWN),s.updateStatus("error"),l<2?setTimeout((()=>{u()}),500):setTimeout((()=>{s.close(),c.show(d,(()=>{l=0,s.show("preparing"),setTimeout((()=>u()),500)}),(()=>{a?a():o(new h("Por favor, use email e senha para fazer login",f.LOGIN_FAILED))}),r,n)}),500)}};u()}const Ki=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 a=null,r=0;const i=()=>{a&&a.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=>{a=s,t.srcObject=a;const c=()=>{if(!t.videoWidth||!t.videoHeight)return r<30?(r++,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 a=o.getContext("2d");if(!a)return i(),void n(new Error("Failed to get canvas context"));(async()=>{if(!Ui)return!0;try{return!!(await d.detectSingleFace(t,new d.TinyFaceDetectorOptions({inputSize:160,scoreThreshold:.3})))}catch{return!0}})().then((s=>{if(!s&&r<30)return r++,void setTimeout(c,150);a.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:Zi,preloadFaceDetectionModels:Wi},Symbol.toStringTag,{value:"Module"})),Ji="Consentimento recusado pelo usuário.";async function Gi(e){if(await Ai({appName:e.appName,flow:"verification"}))try{await Zi({applicationToken:e.applicationToken,onSuccess:e.onSuccess,onError:e.onError,onFallbackRequest:e.onFallbackRequest||(()=>{const n={applicationToken:e.applicationToken,onSuccess:e.onSuccess,onError:e.onError,title:"Login Alternativo",subtitle:"Biometria não reconhecida. Por favor, informe email e senha."};new qi(n).open()}),onCancel:e.onCancel})}catch(n){e.onError(new h(`Erro ao inicializar login facial: ${n.message}`,f.INITIALIZATION_ERROR))}else e.onError(new h(Ji,f.CONSENT_DENIED))}async function Hi(e){if(await Ai({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 zr(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 $i(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(Ji,f.CONSENT_DENIED))}async function Xi(e){if(await Ai({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 zr(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 $i(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(Ji,f.CONSENT_DENIED))}async function Yi(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 a=n.startsWith("data:")?n:`data:image/jpeg;base64,${n}`;o.src=a}))),o=await async function(e){try{if("undefined"!=typeof window&&window.faceapi){const{faceapi:n}=window;await es();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 a=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 a=0,r=0;for(let l=0;l<n.length;l+=4){Qi(n[l],n[l+1],n[l+2])&&a++,r++}const i=a/r,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:a,totalPixels:r}}(t.getImageData(0,0,n.width,n.height));return{confidence:o.confidence,details:o}}catch(n){return{confidence:0}}}(t);return a.confidence>.6?{type:"hand",confidence:a.confidence,details:a.details}:{type:"unknown",confidence:Math.max(o.confidence,a.confidence)}}catch(t){return{type:"face",confidence:.5}}var n}function Qi(e,n,t){const o=.299*e+.587*n+.114*t,a=-.169*e-.331*n+.5*t+128,r=.5*e-.419*n-.081*t+128;return o>80&&o<255&&a>85&&a<135&&r>135&&r<180}async function es(){if("undefined"==typeof window||!window.faceapi)return;const{faceapi:e}=window;if(!e.nets.tinyFaceDetector.isLoaded)try{await Promise.all([e.nets.tinyFaceDetector.loadFromUri("/models"),e.nets.faceLandmark68Net.loadFromUri("/models")])}catch(n){}}async function ns(){try{"undefined"!=typeof window&&await es()}catch(e){}}function ts(){return"undefined"!=typeof window&&window.faceapi&&window.faceapi.nets.tinyFaceDetector.isLoaded}const os=Object.freeze(Object.defineProperty({__proto__:null,detectBiometricType:Yi,initializeBiometricDetection:ns,isAdvancedDetectionAvailable:ts},Symbol.toStringTag,{value:"Module"}));let as=null;function rs(){as=null}async function is({applicationToken:e,purpose:n}){if(!e)throw new h("applicationToken é obrigatório para abrir sessão de captura",f.INVALID_TOKEN);const t=`${br()}/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 a=await o.json().catch((()=>null)),r=(null==a?void 0:a.data)??a,i=null==r?void 0:r.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==r?void 0:r.expires_at)&&r.expires_at.length>0?r.expires_at:function(e){const n="number"==typeof e&&Number.isFinite(e)?e:0;return new Date(Date.now()+1e3*n).toISOString()}(null==r?void 0:r.expires_in);return as={session_id:i,expires_at:s},as}async function ss({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=`${br()}/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 a=await o.json().catch((()=>null)),r=(null==a?void 0:a.data)??a,i=null==r?void 0:r.steps,s=null==r?void 0:r.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==r?void 0:r.expires_in)?r.expires_in:void 0,u="string"==typeof(null==r?void 0:r.expires_at)&&r.expires_at.length>0?r.expires_at:void 0!==l?new Date(Date.now()+1e3*l).toISOString():void 0;return{challenge_id:"string"==typeof(null==r?void 0:r.challenge_id)?r.challenge_id:void 0,gestures:d,expires_at:u,expires_in:l,language:"string"==typeof(null==r?void 0:r.language)?r.language:void 0}}async function cs({applicationToken:e,purpose:n,collectFramesForGesture:t,retryOnSessionExpired:o=!0}){const a=async()=>{const o=await is({applicationToken:e,purpose:n}),a=await ss({sessionId:o.session_id,applicationToken:e}),r=[];for(let e=0;e<a.gestures.length;e+=1){const n=a.gestures[e],o=await t(n,e,a.gestures.length);r.push({gesture_key:String(n.gesture_key),images:o})}return{sessionId:o.session_id,challenge:a,capturedGestures:r}};try{return await a()}catch(r){if(o&&r instanceof h&&r.message.includes("410"))return rs(),a();throw r}}class ds{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 <span class="neofaceid-seal">Protegido por NeoFaceID</span>\n </div>\n </div>\n `,lr(),ur("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=Pi((()=>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 a=setInterval((()=>{o-=1,n.textContent=String(o),o<=0&&(clearInterval(a),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"),a=this.overlay.querySelector(".neofaceid-frame");t.textContent=e,o.textContent=n,"document"===this.step&&(a.style.borderRadius="8px",a.style.width="280px",a.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 ls=["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 us({open:e,onDismiss:t,dismissOnOverlay:a=!0,ariaLabel:r,ariaLabelledBy:i,children:s,className:c,style:d}){if(n.useEffect((()=>{lr()}),[]),!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(${ir})`,backdropFilter:"blur(3px)",WebkitBackdropFilter:"blur(3px)"},onClick:()=>{a&&t&&t()},children:o.jsx("div",{role:"dialog","aria-modal":"true","aria-label":r,"aria-labelledby":i,className:c,onClick:e=>e.stopPropagation(),style:{background:`var(${Xa})`,color:`var(${er})`,borderRadius:`var(${cr}, 16px)`,padding:28,maxWidth:440,width:"100%",boxShadow:"0 1px 3px rgba(10,19,32,.08)",boxSizing:"border-box",...d},children:s})})}const ps={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},fs=n.forwardRef((({variant:e="primary",style:n,type:t="button",...a},r)=>{const i="primary"===e?{background:`var(${or})`,color:`var(${ar})`}:"secondary"===e?{background:`var(${Ya})`,color:`var(${er})`}:{background:"transparent",color:`var(${nr})`};return o.jsx("button",{ref:r,type:t,...a,style:{...ps,...i,...n}})}));function hs({size:e=96,color:n,strokeWidth:t,glow:a=!1,className:r,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:r,style:{color:n??`var(${or})`,filter:a?"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 ms({progress:e,size:n=268,children:t,className:a,style:r}){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:a,style:{position:"relative",width:l,height:l,display:"inline-flex",alignItems:"center",justifyContent:"center",...r},children:[o.jsx("div",{style:{position:"absolute",inset:0},children:o.jsx(hs,{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(${or}, url(#nfid-challenge-arc))`,strokeWidth:4.2,strokeLinecap:"round",strokeDasharray:c,strokeDashoffset:d,fill:"none",style:{transition:"stroke-dashoffset 200ms ease-out"}})]})]})}function gs({gesture:e,size:n=48,color:t,className:a,style:r}){return o.jsxs("svg",{width:n,height:n,viewBox:"0 0 48 48",xmlns:"http://www.w3.org/2000/svg",className:a,style:{color:t??`var(${or})`,...r},role:"img","aria-label":vs[e],children:["blink"===e?o.jsx(ws,{stroke:3.4}):o.jsx(bs,{stroke:3.4}),"blink"!==e&&"center"!==e&&o.jsx(ys,{gesture:e,stroke:3.4})]})}fs.displayName="Button";const vs={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 bs({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 ws({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 ys({gesture:e,stroke:n}){const[t,a,r]=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 ${a} L ${r}`,fill:"none",stroke:"currentColor",strokeWidth:n,strokeLinecap:"round",strokeLinejoin:"round"})}function xs({tone:e,children:n,icon:t,className:a}){const r=Wa[e];return o.jsxs("span",{className:a,style:{display:"inline-flex",alignItems:"center",gap:6,padding:"4px 10px",borderRadius:9999,background:r.bg,color:r.fg,fontSize:13,fontWeight:600,fontFamily:"inherit",lineHeight:1.3},children:[t,n]})}const ks={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"]},Es={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 _s={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 Rs(){n.useEffect((()=>{lr(),ur("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 Ns({appName:e,onContinue:n}){return Rs(),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(fs,{variant:"primary",onClick:n,children:"Continuar"})})]})}function Ts({errorCode:e,attempt:n,maxAttempts:t,timestamp:a,onRetry:r,onFallback:i}){Rs();const s=function(e){if(!e)return ks;const n=e.toUpperCase();return Es[n]??ks}(e),c=a??new Date;return o.jsxs("div",{className:"nfid-state",role:"alert","aria-live":"assertive",children:[o.jsxs(xs,{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(fs,{variant:"primary",onClick:r,children:"Tentar de novo"}),o.jsx(fs,{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 Os({browser:e,onFallback:n,onCancel:t}){Rs();const a=function(e){return _s[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:a}),o.jsxs("div",{className:"nfid-state-actions",children:[o.jsx(fs,{variant:"primary",onClick:n,children:"Verificar de outro jeito"}),o.jsx(fs,{variant:"ghost",onClick:t,children:"Agora não"})]})]})}const Is={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"},Ss={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 Cs({applicationToken:e,appName:t,amount:a,onChallengeStart:r,onChallengeComplete:i,onSuccess:s,onError:c,onCancel:d,autoLighting:l=!0,onClose:u}){const p=n.useRef(null),[m,g]=n.useState(0),[v,b]=n.useState(null),[w,y]=n.useState("preparing"),[x,k]=n.useState(1),[E,_]=n.useState(void 0),[R,N]=n.useState(void 0),[T,O]=n.useState(0),I=n.useRef(!1),[S,C]=n.useState(!1),{flashOn:z}=ei(p,{enabled:l&&!S&&"challenging"===w}),j=yr(),A=t??wr()??"sua aplicação",F="number"==typeof a&&Number.isFinite(a)?function(e,n){try{return new Intl.NumberFormat(n,{style:"currency",currency:"BRL"}).format(e)}catch{return`R$ ${e.toFixed(2)}`}}(a,j):null;n.useEffect((()=>{lr(),ur("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 I.current=!1,y("preparing"),g(0),b(null),async function(){try{try{n=await navigator.mediaDevices.getUserMedia({video:{facingMode:"user",width:{ideal:1280},height:{ideal:720}}})}catch(t){const e=function(e){if(!e||"object"!=typeof e)return"UNKNOWN";const n=(e.name??"").toString();return"NotAllowedError"===n||"SecurityError"===n?"PERMISSION_DENIED":"NotFoundError"===n||"OverconstrainedError"===n?"NO_CAMERA":"NotReadableError"===n||"TrackStartError"===n?"IN_USE":"UNKNOWN"}(t);if("PERMISSION_DENIED"===e)return void y("permission-denied");throw new h("NO_CAMERA"===e?"Câmera não encontrada":"IN_USE"===e?"Câmera em uso por outro app":"Falha ao acessar a câmera",f.CAMERA_ERROR)}p.current&&(p.current.srcObject=n,p.current.play().catch((()=>{}))),y("challenging");const o=await cs({applicationToken:e,purpose:"authorization",collectFramesForGesture:async(e,n,t)=>{if(I.current)throw new h("Cancelado",f.UNKNOWN);b(e),g(0),r&&r(e,n,t),await async function(e){const n=1500,t=Date.now();return new Promise((o=>{const a=()=>{const r=Date.now()-t,i=Math.min(1,r/n);e(i),r>=n?o():setTimeout(a,50)};a()}))}(g),i&&i(e,n,t);const o=await async function(e){if(!e||0===e.videoWidth)return null;const n=document.createElement("canvas");n.width=e.videoWidth,n.height=e.videoHeight;const t=n.getContext("2d");return t?(t.drawImage(e,0,0),n.toDataURL("image/jpeg",.85)):null}(p.current);return o?[o]:[]}});n&&n.getTracks().forEach((e=>e.stop())),n=null,y("success"),s&&s(o)}catch(o){if(I.current)return;const e=o instanceof h?o:new h(o instanceof Error?o.message:"Falha",f.UNKNOWN);_(e.type),N(new Date),y("failure"),c&&c(e)}finally{n&&n.getTracks().forEach((e=>e.stop()))}}(),()=>{I.current=!0,n&&n.getTracks().forEach((e=>e.stop()))}}),[T]);const P=()=>{I.current=!0,d&&d(),u()},$=()=>{x>=3?P():(k((e=>e+1)),_(void 0),N(void 0),O((e=>e+1)))},D=()=>{I.current=!0,c&&c(new h("Fluxo alternativo solicitado pelo usuário",f.CONSENT_DENIED)),u()},L=v?Is[v.gesture_key]??"center":"center",M=v?Ss[v.gesture_key]??"Siga a instrução":"Preparando a câmera…";return"success"===w?o.jsx(us,{open:!0,dismissOnOverlay:!1,ariaLabel:"Identidade confirmada",children:o.jsx(Ns,{appName:A,onContinue:u})}):"permission-denied"===w?o.jsx(us,{open:!0,dismissOnOverlay:!1,ariaLabel:"Câmera bloqueada",children:o.jsx(Os,{onFallback:D,onCancel:P})}):"failure"===w?o.jsx(us,{open:!0,dismissOnOverlay:!1,ariaLabel:"Não foi possível confirmar",children:o.jsx(Ts,{errorCode:E,attempt:x,maxAttempts:3,timestamp:R,onRetry:$,onFallback:D})}):o.jsxs(us,{open:!0,onDismiss:void 0,dismissOnOverlay:!1,ariaLabel:"Autorização por biometria",children:[o.jsx(ni,{active:z,onDismiss:()=>C(!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(ms,{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(gs,{gesture:L,size:40}),o.jsx("p",{className:"nfid-authorize-instruction","aria-live":"assertive",style:{margin:0},children:M})]}),"preparing"===w&&o.jsx("p",{className:"nfid-authorize-support",children:"Ligando sua câmera…"}),o.jsx("div",{className:"nfid-authorize-actions",children:o.jsx(fs,{variant:"ghost",onClick:P,children:"Não consigo fazer esse movimento"})}),o.jsx("div",{className:"nfid-authorize-footer",children:o.jsx("span",{className:"nfid-authorize-seal",children:"Protegido por NeoFaceID"})})]})]})}const zs={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 js{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),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 Ai({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 ',lr(),ur("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(zs).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?zs[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?zs[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 ${si(18)}\n <span class="neoface-doc-brand-name-text">NeoFaceId</span>\n <span class="neoface-doc-brand-text">by</span>\n <span class="neoface-doc-brand-name">OCTA</span>\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 a=null==(e=this.overlay)?void 0:e.querySelector(".neoface-doc-capture-btn"),r=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==a||a.addEventListener("click",(()=>this.handleCapture())),null==r||r.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 a=null==(t=this.overlay)?void 0:t.querySelector(".neoface-doc-loading");a&&(a.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(r){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 new Promise(((n,t)=>{const o=new Image;o.onload=()=>{const e=1280;let{width:a}=o,{height:r}=o;a>r&&a>e?(r=r*e/a,a=e):r>e&&(a=a*e/r,r=e);const i=document.createElement("canvas");i.width=a,i.height=r;const s=i.getContext("2d");s?(s.drawImage(o,0,0,a,r),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=URL.createObjectURL(e)}))}bindPreviewEvents(){var e,n,t;const o=null==(e=this.overlay)?void 0:e.querySelector(".neoface-doc-confirm-btn"),a=null==(n=this.overlay)?void 0:n.querySelector(".neoface-doc-retake-btn");null==o||o.addEventListener("click",(()=>this.handleConfirm())),null==a||a.addEventListener("click",(()=>this.handleRetake()));const r=null==(t=this.overlay)?void 0:t.querySelector(".neoface-doc-preview-current");if(r){const e="preview-front"===this.currentStep?this.frontBlob:this.backBlob;e&&(r.src=URL.createObjectURL(e))}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(a){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=Pi((()=>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:a}=this.video,r=Math.floor(.75*o),i=Math.floor(.65*a),s=Math.floor((o-r)/2),c=Math.floor((a-i)/2);this.canvas.width=r,this.canvas.height=i,t.drawImage(this.video,s,c,r,i,0,0,r,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?zs[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.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 As=async e=>new js(e).open(),Fs=Object.freeze(Object.defineProperty({__proto__:null,DocumentCaptureModal:js,startDocumentCapture:As},Symbol.toStringTag,{value:"Module"})),Ps="Consentimento recusado pelo usuário.";e.BiometricCaptureModal=$i,e.BiometricRegistrationModal=Ni,e.BiometricStatusOverlay=Di,e.ConsentModal=ji,e.DEFAULT_CONSENT_INFO=Fi,e.DocumentCaptureModal=js,e.ENVIRONMENT_URLS=hr,e.EmailPasswordModal=qi,e.ErrorType=f,e.FaceCaptureModal=ai,e.FallbackPrompt=Mi,e.ForgotPasswordModal=ci,e.NeoFaceError=h,e.NeoFaceID=class{constructor(e){if(i(this,"appToken"),i(this,"signature"),i(this,"sessionData"),this.appToken=e.appToken,this.signature=e.signature,this.sessionData=e.sessionData,this.signature&&!this.validateSignatureFormat(this.signature))throw new h("Invalid signature format. Expected HMAC-SHA256 hex string (minimum 64 characters)",f.VALIDATION_ERROR);if(this.sessionData&&(!this.sessionData.email||!this.sessionData.cpf||!this.sessionData.sessionId))throw new h("Session data must include email, cpf, and sessionId",f.VALIDATION_ERROR)}validateSignatureFormat(e){return/^[a-f0-9]{64,}$/i.test(e)}async captureFaceFrames(e){const{numFrames:n,livenessCheck:t}=e;if(n<1||n>10)throw new h("Number of frames must be between 1 and 10",f.VALIDATION_ERROR);const o=[];try{const{captureFaceSilently:e}=await Promise.resolve().then((()=>Ki));for(let a=0;a<n;a++){const r=await e();o.push(r),t&&a<n-1&&await new Promise((e=>setTimeout(e,300)))}return o}catch(a){if(a instanceof h)throw a;throw new h(`Failed to capture face frames: ${a instanceof Error?a.message:"Unknown error"}`,f.CAPTURE_ERROR)}}async loginRecognition(e){const{biometricData:n,purpose:t,confidenceThreshold:o=.8}=e,a=Array.isArray(n)?n:[n];if(0===a.length)throw new h("At least one biometric data frame is required",f.VALIDATION_ERROR);const r=a[0];try{const e=await Fr(r,this.appToken,t,o,this.signature,this.sessionData);if(!e.success)throw new h("Recognition failed",f.RECOGNITION_FAILED);if(!e.personName||!e.email||!e.cpf)throw new h("Incomplete recognition result: missing personName, email, or cpf",f.RECOGNITION_FAILED);return{success:!0,personName:e.personName,email:e.email,cpf:e.cpf,signature:e.signature,sessionId:e.sessionId,confidenceScore:e.confidenceScore,accessToken:e.accessToken}}catch(i){if(i instanceof h)throw i;throw new h(`Login recognition failed: ${i instanceof Error?i.message:"Unknown error"}`,f.RECOGNITION_FAILED)}}async registerApplication(e,n,t){try{return await Ur(e,n,t)}catch(o){if(o instanceof h)throw o;throw new h(`Application registration failed: ${o instanceof Error?o.message:"Unknown error"}`,f.VALIDATION_ERROR)}}async registerDocumentByImage(e,n,t={}){const{DocumentCaptureModal:o}=await Promise.resolve().then((()=>Fs)),a=new o({useBackCamera:t.useBackCamera??!0,preSelectedDocument:t.preSelectedDocument}),r=await a.open();if(!r.success||!r.frontImage)throw new h("cancelled"===r.error?"Document capture was cancelled by the user":`Document capture failed: ${r.error??"unknown error"}`,f.CAPTURE_ERROR);const i=[r.frontImage];return r.backImage&&i.push(r.backImage),Kr(e,n,i)}async proofOfLife(e={}){const{videoDurationMs:n=3e3,maxPollingAttempts:t=60,pollingIntervalMs:o=1e3,onRecordingProgress:a,onTaskStatusChange:r}=e;try{const e=await Br({durationMs:n,onProgress:a}),i=await Zr(e),s=await Vr(i,this.appToken);r&&r("processing",0);const c=await Wr(s.taskId,this.appToken,{maxAttempts:t,intervalMs:o,onStatusChange:r});return c&&c.success?{success:!0,isLive:c.is_live||!1,livenessScore:c.liveness_score||0,faceRecognitionScore:c.face_recognition_score||0,combinedConfidence:c.combined_confidence||0,personId:c.person_id,personalData:c.personal_data||[],processingTime:c.processing_time||0,historyId:s.historyId,taskId:s.taskId,message:"Proof of life verification successful"}:{success:!1,isLive:(null==c?void 0:c.is_live)||!1,livenessScore:(null==c?void 0:c.liveness_score)||0,faceRecognitionScore:(null==c?void 0:c.face_recognition_score)||0,combinedConfidence:(null==c?void 0:c.combined_confidence)||0,personId:null==c?void 0:c.person_id,personalData:(null==c?void 0:c.personal_data)||[],processingTime:(null==c?void 0:c.processing_time)||0,historyId:s.historyId,taskId:s.taskId,error:(null==c?void 0:c.error)||"Verification failed",message:(null==c?void 0:c.message)||"Proof of life verification failed"}}catch(i){if(i instanceof h)throw i;throw new h(`Proof of life failed: ${i instanceof Error?i.message:"Unknown error"}`,f.RECOGNITION_FAILED)}}},e.RELEASE_DATE="2026-09-06",e.VERSION="1.38.2",e.authorize=async function(e){if(!(await Ai({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 a=t.createRoot(n);a.render(o.jsx(Cs,{...e,onClose:()=>{a.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 a=[],r=(null==t?void 0:t.captureDelay)||2e3;if(!(await Ai({appName:null==t?void 0:t.appName,flow:"verification"})))throw new h("Consentimento recusado pelo usuário.",f.CONSENT_DENIED);try{if(!navigator.mediaDevices||!navigator.mediaDevices.getUserMedia)throw new h("Camera not available",f.NO_CAMERA);const n=await navigator.mediaDevices.getUserMedia({video:{facingMode:"user",width:{ideal:1280},height:{ideal:720}}}),i=document.createElement("video");i.srcObject=n,i.autoplay=!0,i.playsInline=!0,await new Promise((e=>{i.onloadedmetadata=()=>{i.play(),e()}}));const s=document.createElement("canvas");s.width=i.videoWidth,s.height=i.videoHeight;const c=s.getContext("2d");if(!c)throw new h("Failed to get canvas context",f.CAPTURE_ERROR);for(let e=0;e<4;e++){const n=ls[e];(null==t?void 0:t.onProgress)&&t.onProgress(e+1,4,n),e>0&&await new Promise((e=>setTimeout(e,r))),c.drawImage(i,0,0,s.width,s.height);const o=await new Promise(((e,n)=>{s.toBlob((t=>{t?e(t):n(new Error("Failed to capture photo"))}),"image/jpeg",.9)}));a.push(o),(null==t?void 0:t.onPhotoTaken)&&t.onPhotoTaken(e+1,o)}n.getTracks().forEach((e=>e.stop()));const d=a[3],l={cpf:o,email:"",sessionId:`auth_${Date.now()}_${Math.random().toString(36).substring(7)}`},u=await Fr(d,e,"AUTHORIZATION",.8,void 0,l);if(!u.success)throw new h("Authorization failed: Person not recognized",f.RECOGNITION_FAILED);return{success:!0,authorizationHash:l.sessionId,name:u.personName,birthDate:void 0,cpf:u.cpf||o,confidenceScore:u.confidenceScore,message:"Authorization successful"}}catch(i){if(i instanceof h)throw i;if(i instanceof Error)throw new h(i.message,f.CAPTURE_ERROR);throw new h("Unknown error during authorization",f.UNKNOWN)}},e.biometricLogin=function(e,n="auto"){return new Promise(((t,o)=>{const a={applicationToken:e,onSuccess:t,onError:o};switch(n){case"face":Gi(a);break;case"hand":Hi(a);break;case"auto":Xi(a);break;default:o(new h("Modo de login inválido",f.VALIDATION_ERROR))}}))},e.biometricLoginWithFallback=function(e,n="auto"){return new Promise(((t,o)=>{const a={applicationToken:e,onSuccess:t,onError:n=>{if(n.type===f.LOGIN_FAILED){new qi({applicationToken:e,onSuccess:t,onError:o,title:"Login Alternativo",subtitle:"Biometria não reconhecida. Por favor, informe email e senha."}).open()}else o(n)}};switch(n){case"face":Gi(a);break;case"hand":Hi(a);break;case"auto":Xi(a);break;default:o(new h("Modo de login inválido",f.VALIDATION_ERROR))}}))},e.checkUserExistence=$r,e.completeOnboarding=Ir,e.completeOnboardingWithData=Sr,e.confirmPasswordReset=Xr,e.detectBiometricType=Yi,e.getAccent=function(){return gr.accent},e.getAppName=wr,e.getApplicationToken=function(){return gr.applicationToken},e.getBaseUrl=br,e.getCachedCaptureSession=function(){return as},e.getConfig=function(){return{...gr}},e.getConsent=function(){return{...gr.consent}},e.getEnvironment=function(){return gr.environment},e.getLocale=yr,e.getRadius=function(){return gr.radius},e.getResolvedThemeMode=function(){var e;return(null==(e=gr.resolvedTheme)?void 0:e.mode)??("dark"===gr.theme?"dark":"light")},e.getTheme=function(){return gr.theme},e.identifyPerson=Mr,e.identifyPersonAsync=Gr,e.init=function(e={}){const{environment:n,baseUrl:t,applicationToken:o,appName:a,accent:r,radius:i,theme:c,locale:d,consent:l}=e;if(l?gr.consent=l:(gr.consent={...fr},vr||(vr=!0)),t)gr.baseUrl=t,gr.environment="custom";else if(n)hr[n]?(gr.baseUrl=hr[n],gr.environment=n):(gr.baseUrl=hr.sandbox,gr.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==pr?void 0:pr.VITE_API_BASE_URL);e&&(gr.baseUrl=e,gr.environment="custom")}o&&(gr.applicationToken=o),a&&a.trim()&&(gr.appName=a.trim()),void 0!==i&&(mr.includes(i)?gr.radius=i:gr.radius=16),c&&(gr.theme=c),d&&(gr.locale=d),void 0!==r&&(gr.accent=r);const u=Ga({accent:gr.accent??void 0,radius:gr.radius,theme:gr.theme});gr.resolvedTheme=u,lr({accent:gr.accent??void 0,radius:gr.radius,theme:gr.theme}),gr.initialized=!0},e.initializeBiometricDetection=ns,e.isAdvancedDetectionAvailable=ts,e.isInitialized=function(){return gr.initialized},e.loginWithBiometric=zr,e.loginWithEmail=Lr,e.openCaptureSession=is,e.preloadFaceDetectionModels=Wi,e.recognize=Cr,e.recognizeBiometric=jr,e.recognizeByPurpose=Fr,e.registerBiometric=qr,e.registerPersonWithBiometric=Dr,e.registerPersonWithoutFace=Pr,e.requestConsent=Ai,e.requestLivenessChallenge=ss,e.requestLivenessChallengeWithSession=async function({applicationToken:e,purpose:n,sessionId:t}){let o=t??(await is({applicationToken:e,purpose:n})).session_id;try{return await ss({sessionId:o,applicationToken:e})}catch(a){if(a instanceof h&&a.message.includes("410"))return rs(),o=(await is({applicationToken:e,purpose:n})).session_id,ss({sessionId:o,applicationToken:e});throw a}},e.requestPasswordReset=Hr,e.resetCaptureSession=rs,e.runLivenessChallenge=cs,e.simpleIdentification=Ar,e.start=function(e,o,a){Ai({appName:null==a?void 0:a.appName,flow:"verification"}).then((r=>{if(!r)return void o.onError("CONSENT_DENIED",Ps);const i=document.createElement("div");i.id="neoface-modal-container",document.body.appendChild(i);const s=()=>{document.body.contains(i)&&document.body.removeChild(i)};Nr(e).then((()=>{const r=n.createElement(ai,{accessToken:e,onClose:s,onSuccess:e=>{s(),o.onSuccess({name:e.data.faceId,email:e.data.faceId,documentId:e.data.faceId})},onCannotGesture:null==a?void 0:a.onCannotGesture});t.createRoot(i).render(r)})).catch((e=>{s(),o.onError("TOKEN_VALIDATION_ERROR",e.message||"Failed to validate token")}))}))},e.startAutoLogin=Xi,e.startBiometricRegistration=function(e,o,a,r){Ai({appName:null==r?void 0:r.appName,flow:"registration"}).then((i=>{if(!i)return void a.onError("CONSENT_DENIED",Ps);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)};Nr(o).then((()=>{const i=n.createElement(Ni,{personData:e,applicationToken:o,useRealApi:(null==r?void 0:r.useRealApi)??!0,onClose:d,onSuccess:e=>{d(),a.onSuccess(e)},onError:e=>{d(),a.onError("BIOMETRIC_REGISTRATION_ERROR",e)},onCannotGesture:null==r?void 0:r.onCannotGesture});c=t.createRoot(s),c.render(i)})).catch((e=>{d(),a.onError("TOKEN_VALIDATION_ERROR",e.message||"Failed to validate token")}))}))},e.startDocumentCapture=As,e.startFaceLogin=Gi,e.startHandLogin=Hi,e.startLivenessCapture=function(e,o,a){Ai({appName:null==a?void 0:a.appName,flow:"verification"}).then((r=>{if(!r)return void o.onError("CONSENT_DENIED",Ps);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()};Nr(e).then((()=>{const r=n.createElement(Ni,{applicationToken:e,onClose:l,onPhotosCaptured:e=>{s=!0,o.onSuccess(e)},onError:e=>{d(),o.onError("LIVENESS_CAPTURE_ERROR",e)},onCannotGesture:null==a?void 0:a.onCannotGesture});c=t.createRoot(i),c.render(r)})).catch((e=>{d(),o.onError("TOKEN_VALIDATION_ERROR",e.message||"Failed to validate token")}))}))},e.startOnboarding=async e=>{const{applicationToken:n,onboardingToken:t,countdown:o,title:a,subtitle:r,onSuccess:i,onError:s}=e;try{if(!(await Ai({appName:e.appName,flow:"registration"})))return void s(new h("Consentimento recusado pelo usuário.",f.CONSENT_DENIED));const c=await Tr(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 ds({countdown:o,title:a,subtitle:r}),{face:l,document:u}=await d.open();i({...await Ir(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 a=e?`${encodeURIComponent(e)}/submit/`:"submit/",r=`${br()}/api/v1/auth/liveness/challenge/${a}`;let i;try{i=await fetch(r,{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=Or,e.validateToken=Nr,e.withCaptureSession=async function(e,n){const t=as??await is(e);try{return await n(t.session_id)}catch(o){if(o instanceof h&&o.message.includes("410")){rs();return n((await is(e)).session_id)}throw o}},e.withSessionId=function(e){const n=as;return n?{...e,session_id:n.session_id}:e},Object.defineProperty(e,Symbol.toStringTag,{value:"Module"})}));
|