@neofaceid/web-sdk 1.24.1 → 1.25.4
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 +1365 -0
- package/dist/neoface-id-sdk.es.js +392 -113
- package/dist/neoface-id-sdk.umd.js +1 -1
- package/package.json +23 -3
- package/dist/logo-horizontal-branco-no-background.png +0 -0
- package/dist/logo-horizontal-preto-no-background.png +0 -0
- package/dist/logo-horizontal-preto.png +0 -0
- package/dist/logo-icone-no-background.png +0 -0
- package/dist/logo-icone.png +0 -0
|
@@ -7,4 +7,4 @@
|
|
|
7
7
|
*
|
|
8
8
|
* This source code is licensed under the MIT license found in the
|
|
9
9
|
* LICENSE file in the root directory of this source tree.
|
|
10
|
-
*/function b(){return m||(m=1,"production"!==process.env.NODE_ENV&&function(){var e=n,t=Symbol.for("react.element"),o=Symbol.for("react.portal"),r=Symbol.for("react.fragment"),a=Symbol.for("react.strict_mode"),i=Symbol.for("react.profiler"),s=Symbol.for("react.provider"),c=Symbol.for("react.context"),d=Symbol.for("react.forward_ref"),l=Symbol.for("react.suspense"),u=Symbol.for("react.suspense_list"),p=Symbol.for("react.memo"),f=Symbol.for("react.lazy"),h=Symbol.for("react.offscreen"),m=Symbol.iterator;var g=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function b(e){for(var n=arguments.length,t=new Array(n>1?n-1:0),o=1;o<n;o++)t[o-1]=arguments[o];!function(e,n,t){var o=g.ReactDebugCurrentFrame.getStackAddendum();""!==o&&(n+="%s",t=t.concat([o]));var r=t.map((function(e){return String(e)}));r.unshift("Warning: "+n),Function.prototype.apply.call(console[e],console,r)}("error",e,t)}var y;function w(e){return e.displayName||"Context"}function x(e){if(null==e)return null;if("number"==typeof e.tag&&b("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),"function"==typeof e)return e.displayName||e.name||null;if("string"==typeof e)return e;switch(e){case r:return"Fragment";case o:return"Portal";case i:return"Profiler";case a:return"StrictMode";case l:return"Suspense";case u:return"SuspenseList"}if("object"==typeof e)switch(e.$$typeof){case c:return w(e)+".Consumer";case s:return w(e._context)+".Provider";case d:return function(e,n,t){var o=e.displayName;if(o)return o;var r=n.displayName||n.name||"";return""!==r?t+"("+r+")":t}(e,e.render,"ForwardRef");case p:var n=e.displayName||null;return null!==n?n:x(e.type)||"Memo";case f:var t=e,h=t._payload,m=t._init;try{return x(m(h))}catch(g){return null}}return null}y=Symbol.for("react.module.reference");var _,k,E,R,T,O,S,I=Object.assign,N=0;function z(){}z.__reactDisabledLog=!0;var A,C=g.ReactCurrentDispatcher;function j(e,n,t){if(void 0===A)try{throw Error()}catch(r){var o=r.stack.trim().match(/\n( *(at )?)/);A=o&&o[1]||""}return"\n"+A+e}var P,$=!1,F="function"==typeof WeakMap?WeakMap:Map;function D(e,n){if(!e||$)return"";var t,o=P.get(e);if(void 0!==o)return o;$=!0;var r,a=Error.prepareStackTrace;Error.prepareStackTrace=void 0,r=C.current,C.current=null,function(){if(0===N){_=console.log,k=console.info,E=console.warn,R=console.error,T=console.group,O=console.groupCollapsed,S=console.groupEnd;var e={configurable:!0,enumerable:!0,value:z,writable:!0};Object.defineProperties(console,{info:e,log:e,warn:e,error:e,group:e,groupCollapsed:e,groupEnd:e})}N++}();try{if(n){var i=function(){throw Error()};if(Object.defineProperty(i.prototype,"props",{set:function(){throw Error()}}),"object"==typeof Reflect&&Reflect.construct){try{Reflect.construct(i,[])}catch(h){t=h}Reflect.construct(e,[],i)}else{try{i.call()}catch(h){t=h}e.call(i.prototype)}}else{try{throw Error()}catch(h){t=h}e()}}catch(m){if(m&&t&&"string"==typeof m.stack){for(var s=m.stack.split("\n"),c=t.stack.split("\n"),d=s.length-1,l=c.length-1;d>=1&&l>=0&&s[d]!==c[l];)l--;for(;d>=1&&l>=0;d--,l--)if(s[d]!==c[l]){if(1!==d||1!==l)do{if(d--,--l<0||s[d]!==c[l]){var u="\n"+s[d].replace(" at new "," at ");return e.displayName&&u.includes("<anonymous>")&&(u=u.replace("<anonymous>",e.displayName)),"function"==typeof e&&P.set(e,u),u}}while(d>=1&&l>=0);break}}}finally{$=!1,C.current=r,function(){if(0==--N){var e={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:I({},e,{value:_}),info:I({},e,{value:k}),warn:I({},e,{value:E}),error:I({},e,{value:R}),group:I({},e,{value:T}),groupCollapsed:I({},e,{value:O}),groupEnd:I({},e,{value:S})})}N<0&&b("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}(),Error.prepareStackTrace=a}var p=e?e.displayName||e.name:"",f=p?j(p):"";return"function"==typeof e&&P.set(e,f),f}function L(e,n,t){if(null==e)return"";if("function"==typeof e)return D(e,!(!(o=e.prototype)||!o.isReactComponent));var o;if("string"==typeof e)return j(e);switch(e){case l:return j("Suspense");case u:return j("SuspenseList")}if("object"==typeof e)switch(e.$$typeof){case d:return D(e.render,!1);case p:return L(e.type,n,t);case f:var r=e,a=r._payload,i=r._init;try{return L(i(a),n,t)}catch(s){}}return""}P=new F;var M=Object.prototype.hasOwnProperty,U={},B=g.ReactDebugCurrentFrame;function W(e){if(e){var n=e._owner,t=L(e.type,e._source,n?n.type:null);B.setExtraStackFrame(t)}else B.setExtraStackFrame(null)}var q=Array.isArray;function Z(e){return q(e)}function V(e){return""+e}function K(e){if(function(e){try{return V(e),!1}catch(n){return!0}}(e))return b("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",function(e){return"function"==typeof Symbol&&Symbol.toStringTag&&e[Symbol.toStringTag]||e.constructor.name||"Object"}(e)),V(e)}var J,G,H=g.ReactCurrentOwner,Y={key:!0,ref:!0,__self:!0,__source:!0};function X(e,n,o,r,a){var i,s={},c=null,d=null;for(i in void 0!==o&&(K(o),c=""+o),function(e){if(M.call(e,"key")){var n=Object.getOwnPropertyDescriptor(e,"key").get;if(n&&n.isReactWarning)return!1}return void 0!==e.key}(n)&&(K(n.key),c=""+n.key),function(e){if(M.call(e,"ref")){var n=Object.getOwnPropertyDescriptor(e,"ref").get;if(n&&n.isReactWarning)return!1}return void 0!==e.ref}(n)&&(d=n.ref,function(e){"string"==typeof e.ref&&H.current}(n)),n)M.call(n,i)&&!Y.hasOwnProperty(i)&&(s[i]=n[i]);if(e&&e.defaultProps){var l=e.defaultProps;for(i in l)void 0===s[i]&&(s[i]=l[i])}if(c||d){var u="function"==typeof e?e.displayName||e.name||"Unknown":e;c&&function(e,n){var t=function(){J||(J=!0,b("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",n))};t.isReactWarning=!0,Object.defineProperty(e,"key",{get:t,configurable:!0})}(s,u),d&&function(e,n){var t=function(){G||(G=!0,b("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",n))};t.isReactWarning=!0,Object.defineProperty(e,"ref",{get:t,configurable:!0})}(s,u)}return function(e,n,o,r,a,i,s){var c={$$typeof:t,type:e,key:n,ref:o,props:s,_owner:i,_store:{}};return Object.defineProperty(c._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(c,"_self",{configurable:!1,enumerable:!1,writable:!1,value:r}),Object.defineProperty(c,"_source",{configurable:!1,enumerable:!1,writable:!1,value:a}),Object.freeze&&(Object.freeze(c.props),Object.freeze(c)),c}(e,c,d,a,r,H.current,s)}var Q,ee=g.ReactCurrentOwner,ne=g.ReactDebugCurrentFrame;function te(e){if(e){var n=e._owner,t=L(e.type,e._source,n?n.type:null);ne.setExtraStackFrame(t)}else ne.setExtraStackFrame(null)}function oe(e){return"object"==typeof e&&null!==e&&e.$$typeof===t}function re(){if(ee.current){var e=x(ee.current.type);if(e)return"\n\nCheck the render method of `"+e+"`."}return""}Q=!1;var ae={};function ie(e,n){if(e._store&&!e._store.validated&&null==e.key){e._store.validated=!0;var t=function(e){var n=re();if(!n){var t="string"==typeof e?e:e.displayName||e.name;t&&(n="\n\nCheck the top-level render call using <"+t+">.")}return n}(n);if(!ae[t]){ae[t]=!0;var o="";e&&e._owner&&e._owner!==ee.current&&(o=" It was passed a child from "+x(e._owner.type)+"."),te(e),b('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',t,o),te(null)}}}function se(e,n){if("object"==typeof e)if(Z(e))for(var t=0;t<e.length;t++){var o=e[t];oe(o)&&ie(o,n)}else if(oe(e))e._store&&(e._store.validated=!0);else if(e){var r=function(e){if(null===e||"object"!=typeof e)return null;var n=m&&e[m]||e["@@iterator"];return"function"==typeof n?n:null}(e);if("function"==typeof r&&r!==e.entries)for(var a,i=r.call(e);!(a=i.next()).done;)oe(a.value)&&ie(a.value,n)}}function ce(e){var n,t=e.type;if(null!=t&&"string"!=typeof t){if("function"==typeof t)n=t.propTypes;else{if("object"!=typeof t||t.$$typeof!==d&&t.$$typeof!==p)return;n=t.propTypes}if(n){var o=x(t);!function(e,n,t,o,r){var a=Function.call.bind(M);for(var i in e)if(a(e,i)){var s=void 0;try{if("function"!=typeof e[i]){var c=Error((o||"React class")+": "+t+" type `"+i+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof e[i]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw c.name="Invariant Violation",c}s=e[i](n,i,o,t,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(d){s=d}!s||s instanceof Error||(W(r),b("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).",o||"React class",t,i,typeof s),W(null)),s instanceof Error&&!(s.message in U)&&(U[s.message]=!0,W(r),b("Failed %s type: %s",t,s.message),W(null))}}(n,e.props,"prop",o,e)}else if(void 0!==t.PropTypes&&!Q){Q=!0,b("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",x(t)||"Unknown")}"function"!=typeof t.getDefaultProps||t.getDefaultProps.isReactClassApproved||b("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}var de={};function le(e,n,o,m,g,v){var w=function(e){return"string"==typeof e||"function"==typeof e||e===r||e===i||e===a||e===l||e===u||e===h||"object"==typeof e&&null!==e&&(e.$$typeof===f||e.$$typeof===p||e.$$typeof===s||e.$$typeof===c||e.$$typeof===d||e.$$typeof===y||void 0!==e.getModuleId)}(e);if(!w){var _="";(void 0===e||"object"==typeof e&&null!==e&&0===Object.keys(e).length)&&(_+=" You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");var k;_+=re(),null===e?k="null":Z(e)?k="array":void 0!==e&&e.$$typeof===t?(k="<"+(x(e.type)||"Unknown")+" />",_=" Did you accidentally export a JSX literal instead of a component?"):k=typeof e,b("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",k,_)}var E=X(e,n,o,g,v);if(null==E)return E;if(w){var R=n.children;if(void 0!==R)if(m)if(Z(R)){for(var T=0;T<R.length;T++)se(R[T],e);Object.freeze&&Object.freeze(R)}else b("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else se(R,e)}if(M.call(n,"key")){var O=x(e),S=Object.keys(n).filter((function(e){return"key"!==e})),I=S.length>0?"{key: someKey, "+S.join(": ..., ")+": ...}":"{key: someKey}";if(!de[O+I])b('A props object containing a "key" prop is being spread into JSX:\n let props = %s;\n <%s {...props} />\nReact keys must be passed directly to JSX without using spread:\n let props = %s;\n <%s key={someKey} {...props} />',I,O,S.length>0?"{"+S.join(": ..., ")+": ...}":"{}",O),de[O+I]=!0}return e===r?function(e){for(var n=Object.keys(e.props),t=0;t<n.length;t++){var o=n[t];if("children"!==o&&"key"!==o){te(e),b("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",o),te(null);break}}null!==e.ref&&(te(e),b("Invalid attribute `ref` supplied to `React.Fragment`."),te(null))}(E):ce(E),E}var ue=function(e,n,t){return le(e,n,t,!1)},pe=function(e,n,t){return le(e,n,t,!0)};v.Fragment=r,v.jsx=ue,v.jsxs=pe}()),v}var y=(g||(g=1,"production"===process.env.NODE_ENV?f.exports=function(){if(u)return h;u=1;var e=n,t=Symbol.for("react.element"),o=Symbol.for("react.fragment"),r=Object.prototype.hasOwnProperty,a=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,i={key:!0,ref:!0,__self:!0,__source:!0};function s(e,n,o){var s,c={},d=null,l=null;for(s in void 0!==o&&(d=""+o),void 0!==n.key&&(d=""+n.key),void 0!==n.ref&&(l=n.ref),n)r.call(n,s)&&!i.hasOwnProperty(s)&&(c[s]=n[s]);if(e&&e.defaultProps)for(s in n=e.defaultProps)void 0===c[s]&&(c[s]=n[s]);return{$$typeof:t,type:e,key:d,ref:l,props:c,_owner:a.current}}return h.Fragment=o,h.jsx=s,h.jsxs=s,h}():f.exports=b()),f.exports);class w extends Error{constructor(e){super(e),this.name="CameraPermissionDenied"}}class x{constructor(e){a(this,"stream"),this.stream=e}getStream(){return this.stream}stop(){this.stream.getTracks().forEach((e=>e.stop()))}}const _=()=>{const e=n.useRef(null),[t,o]=n.useState(!1),r=n.useRef(!1);return{startCamera:n.useCallback((async n=>{const t=e.current;if(t)return t.getStream();if(r.current){await new Promise((e=>setTimeout(e,100)));const n=e.current;if(n)return n.getStream()}r.current=!0;try{const t=n||(()=>{const e=/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent);return{video:{facingMode:"user",width:{ideal:e?640:1280},height:{ideal:e?480:720},aspectRatio:{ideal:1.777777778}},audio:!1}})(),a=await navigator.mediaDevices.getUserMedia(t),i=new x(a);return e.current=i,o(!0),r.current=!1,a}catch(a){if(r.current=!1,a instanceof Error){if("NotAllowedError"===a.name||"PermissionDeniedError"===a.name)throw new w("Permissão para acessar a câmera foi negada pelo usuário");if("NotFoundError"===a.name||"DevicesNotFoundError"===a.name)throw new Error("Nenhuma câmera foi encontrada no dispositivo");if("NotReadableError"===a.name||"TrackStartError"===a.name)throw new Error("A câmera já está sendo usada por outro aplicativo");if("OverconstrainedError"===a.name||"ConstraintNotSatisfiedError"===a.name)throw new Error("As configurações solicitadas não são suportadas pela câmera")}throw new Error(`Erro ao inicializar câmera: ${a instanceof Error?a.message:String(a)}`)}}),[]),stopCamera:n.useCallback((n=>{const t=e.current;t&&t.getStream()===n&&(t.stop(),e.current=null,o(!1),r.current=!1)}),[]),cleanup:n.useCallback((()=>{e.current&&(e.current.stop(),e.current=null,o(!1),r.current=!1)}),[]),isActive:t}};var k=(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))(k||{});class E extends Error{constructor(e,n){super(e),a(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"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 R(e,n,t){function o(t,o){if(t._zod||Object.defineProperty(t,"_zod",{value:{def:o,constr:i,traits:new Set},enumerable:!1}),t._zod.traits.has(e))return;t._zod.traits.add(e),n(t,o);const r=i.prototype,a=Object.keys(r);for(let e=0;e<a.length;e++){const n=a[e];n in t||(t[n]=r[n].bind(t))}}const r=(null==t?void 0:t.Parent)??Object;class a extends r{}function i(e){var n;const r=(null==t?void 0:t.Parent)?new a:this;o(r,e),(n=r._zod).deferred??(n.deferred=[]);for(const t of r._zod.deferred)t();return r}return Object.defineProperty(a,"name",{value:e}),Object.defineProperty(i,"init",{value:o}),Object.defineProperty(i,Symbol.hasInstance,{value:n=>{var o,r;return!!((null==t?void 0:t.Parent)&&n instanceof t.Parent)||(null==(r=null==(o=null==n?void 0:n._zod)?void 0:o.traits)?void 0:r.has(e))}}),Object.defineProperty(i,"name",{value:e}),i}class T extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class O extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name="ZodEncodeError"}}const S={};function I(e){return S}function N(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 z(e,n){return"bigint"==typeof n?n.toString():n}function A(e){return{get value(){{const n=e();return Object.defineProperty(this,"value",{value:n}),n}}}}function C(e){return null==e}function j(e){const n=e.startsWith("^")?1:0,t=e.endsWith("$")?e.length-1:e.length;return e.slice(n,t)}const P=Symbol("evaluating");function $(e,n,t){let o;Object.defineProperty(e,n,{get(){if(o!==P)return void 0===o&&(o=P,o=t()),o},set(t){Object.defineProperty(e,n,{value:t})},configurable:!0})}function F(e,n,t){Object.defineProperty(e,n,{value:t,writable:!0,enumerable:!0,configurable:!0})}function D(...e){const n={};for(const t of e){const e=Object.getOwnPropertyDescriptors(t);Object.assign(n,e)}return Object.defineProperties({},n)}function L(e){return JSON.stringify(e)}const M="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function U(e){return"object"==typeof e&&null!==e&&!Array.isArray(e)}const B=A((()=>{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 W(e){if(!1===U(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!==U(t)&&!1!==Object.prototype.hasOwnProperty.call(t,"isPrototypeOf")}function q(e){return W(e)?{...e}:Array.isArray(e)?[...e]:e}const Z=new Set(["string","number","symbol"]);function V(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function K(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 J(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 G={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 H(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 Y(e,n){return n.map((n=>{var t;return(t=n).path??(t.path=[]),n.path.unshift(e),n}))}function X(e){return"string"==typeof e?e:null==e?void 0:e.message}function Q(e,n,t){var o,r,a,i,s,c;const d={...e,path:e.path??[]};if(!e.message){const l=X(null==(a=null==(r=null==(o=e.inst)?void 0:o._zod.def)?void 0:r.error)?void 0:a.call(r,e))??X(null==(i=null==n?void 0:n.error)?void 0:i.call(n,e))??X(null==(s=t.customError)?void 0:s.call(t,e))??X(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 ee(e){return Array.isArray(e)?"array":"string"==typeof e?"string":"unknown"}function ne(...e){const[n,t,o]=e;return"string"==typeof n?{message:n,code:"custom",input:t,inst:o}:{...n}}const te=(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,z,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},oe=R("$ZodError",te),re=R("$ZodError",te,{Parent:Error});const ae=e=>(n,t,o,r)=>{const a=o?Object.assign(o,{async:!1}):{async:!1},i=n._zod.run({value:t,issues:[]},a);if(i instanceof Promise)throw new T;if(i.issues.length){const n=new((null==r?void 0:r.Err)??e)(i.issues.map((e=>Q(e,a,I()))));throw M(n,null==r?void 0:r.callee),n}return i.value},ie=e=>async(n,t,o,r)=>{const a=o?Object.assign(o,{async:!0}):{async:!0};let i=n._zod.run({value:t,issues:[]},a);if(i instanceof Promise&&(i=await i),i.issues.length){const n=new((null==r?void 0:r.Err)??e)(i.issues.map((e=>Q(e,a,I()))));throw M(n,null==r?void 0:r.callee),n}return i.value},se=e=>(n,t,o)=>{const r=o?{...o,async:!1}:{async:!1},a=n._zod.run({value:t,issues:[]},r);if(a instanceof Promise)throw new T;return a.issues.length?{success:!1,error:new(e??oe)(a.issues.map((e=>Q(e,r,I()))))}:{success:!0,data:a.value}},ce=se(re),de=e=>async(n,t,o)=>{const r=o?Object.assign(o,{async:!0}):{async:!0};let a=n._zod.run({value:t,issues:[]},r);return a instanceof Promise&&(a=await a),a.issues.length?{success:!1,error:new e(a.issues.map((e=>Q(e,r,I()))))}:{success:!0,data:a.value}},le=de(re),ue=e=>(n,t,o)=>{const r=o?Object.assign(o,{direction:"backward"}):{direction:"backward"};return ae(e)(n,t,r)},pe=e=>(n,t,o)=>ae(e)(n,t,o),fe=e=>async(n,t,o)=>{const r=o?Object.assign(o,{direction:"backward"}):{direction:"backward"};return ie(e)(n,t,r)},he=e=>async(n,t,o)=>ie(e)(n,t,o),me=e=>(n,t,o)=>{const r=o?Object.assign(o,{direction:"backward"}):{direction:"backward"};return se(e)(n,t,r)},ge=e=>(n,t,o)=>se(e)(n,t,o),ve=e=>async(n,t,o)=>{const r=o?Object.assign(o,{direction:"backward"}):{direction:"backward"};return de(e)(n,t,r)},be=e=>async(n,t,o)=>de(e)(n,t,o),ye=/^[cC][^\s-]{8,}$/,we=/^[0-9a-z]+$/,xe=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,_e=/^[0-9a-vA-V]{20}$/,ke=/^[A-Za-z0-9]{27}$/,Ee=/^[a-zA-Z0-9_-]{21}$/,Re=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,Te=/^([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})$/,Oe=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)$/,Se=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/;const Ie=/^(?:(?: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])$/,Ne=/^(([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}|:))$/,ze=/^((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])$/,Ae=/^(([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])$/,Ce=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,je=/^[A-Za-z0-9_-]*$/,Pe=/^\+[1-9]\d{6,14}$/,$e="(?:(?:\\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])))",Fe=new RegExp(`^${$e}$`);function De(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 Le=/^-?\d+$/,Me=/^-?\d+(?:\.\d+)?$/,Ue=/^(?:true|false)$/i,Be=/^[^A-Z]*$/,We=/^[^a-z]*$/,qe=R("$ZodCheck",((e,n)=>{var t;e._zod??(e._zod={}),e._zod.def=n,(t=e._zod).onattach??(t.onattach=[])})),Ze={number:"number",bigint:"bigint",object:"date"},Ve=R("$ZodCheckLessThan",((e,n)=>{qe.init(e,n);const t=Ze[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})}})),Ke=R("$ZodCheckGreaterThan",((e,n)=>{qe.init(e,n);const t=Ze[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})}})),Je=R("$ZodCheckMultipleOf",((e,n)=>{qe.init(e,n),e._zod.onattach.push((e=>{var t;(t=e._zod.bag).multipleOf??(t.multipleOf=n.value)})),e._zod.check=t=>{if(typeof t.value!=typeof n.value)throw new Error("Cannot mix number and bigint in multiple_of check.");("bigint"==typeof t.value?t.value%n.value===BigInt(0):0===function(e,n){const t=(e.toString().split(".")[1]||"").length,o=n.toString();let r=(o.split(".")[1]||"").length;if(0===r&&/\d?e-\d?/.test(o)){const e=o.match(/\d?e-(\d?)/);(null==e?void 0:e[1])&&(r=Number.parseInt(e[1]))}const a=t>r?t:r;return Number.parseInt(e.toFixed(a).replace(".",""))%Number.parseInt(n.toFixed(a).replace(".",""))/10**a}(t.value,n.value))||t.issues.push({origin:typeof t.value,code:"not_multiple_of",divisor:n.value,input:t.value,inst:e,continue:!n.abort})}})),Ge=R("$ZodCheckNumberFormat",((e,n)=>{var t;qe.init(e,n),n.format=n.format||"float64";const o=null==(t=n.format)?void 0:t.includes("int"),r=o?"int":"number",[a,i]=G[n.format];e._zod.onattach.push((e=>{const t=e._zod.bag;t.format=n.format,t.minimum=a,t.maximum=i,o&&(t.pattern=Le)})),e._zod.check=t=>{const s=t.value;if(o){if(!Number.isInteger(s))return void t.issues.push({expected:r,format:n.format,code:"invalid_type",continue:!1,input:s,inst:e});if(!Number.isSafeInteger(s))return void(s>0?t.issues.push({input:s,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:r,inclusive:!0,continue:!n.abort}):t.issues.push({input:s,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:r,inclusive:!0,continue:!n.abort}))}s<a&&t.issues.push({origin:"number",input:s,code:"too_small",minimum:a,inclusive:!0,inst:e,continue:!n.abort}),s>i&&t.issues.push({origin:"number",input:s,code:"too_big",maximum:i,inclusive:!0,inst:e,continue:!n.abort})}})),He=R("$ZodCheckMaxLength",((e,n)=>{var t;qe.init(e,n),(t=e._zod.def).when??(t.when=e=>{const n=e.value;return!C(n)&&void 0!==n.length}),e._zod.onattach.push((e=>{const t=e._zod.bag.maximum??Number.POSITIVE_INFINITY;n.maximum<t&&(e._zod.bag.maximum=n.maximum)})),e._zod.check=t=>{const o=t.value;if(o.length<=n.maximum)return;const r=ee(o);t.issues.push({origin:r,code:"too_big",maximum:n.maximum,inclusive:!0,input:o,inst:e,continue:!n.abort})}})),Ye=R("$ZodCheckMinLength",((e,n)=>{var t;qe.init(e,n),(t=e._zod.def).when??(t.when=e=>{const n=e.value;return!C(n)&&void 0!==n.length}),e._zod.onattach.push((e=>{const t=e._zod.bag.minimum??Number.NEGATIVE_INFINITY;n.minimum>t&&(e._zod.bag.minimum=n.minimum)})),e._zod.check=t=>{const o=t.value;if(o.length>=n.minimum)return;const r=ee(o);t.issues.push({origin:r,code:"too_small",minimum:n.minimum,inclusive:!0,input:o,inst:e,continue:!n.abort})}})),Xe=R("$ZodCheckLengthEquals",((e,n)=>{var t;qe.init(e,n),(t=e._zod.def).when??(t.when=e=>{const n=e.value;return!C(n)&&void 0!==n.length}),e._zod.onattach.push((e=>{const t=e._zod.bag;t.minimum=n.length,t.maximum=n.length,t.length=n.length})),e._zod.check=t=>{const o=t.value,r=o.length;if(r===n.length)return;const a=ee(o),i=r>n.length;t.issues.push({origin:a,...i?{code:"too_big",maximum:n.length}:{code:"too_small",minimum:n.length},inclusive:!0,exact:!0,input:t.value,inst:e,continue:!n.abort})}})),Qe=R("$ZodCheckStringFormat",((e,n)=>{var t,o;qe.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=()=>{})})),en=R("$ZodCheckRegex",((e,n)=>{Qe.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})}})),nn=R("$ZodCheckLowerCase",((e,n)=>{n.pattern??(n.pattern=Be),Qe.init(e,n)})),tn=R("$ZodCheckUpperCase",((e,n)=>{n.pattern??(n.pattern=We),Qe.init(e,n)})),on=R("$ZodCheckIncludes",((e,n)=>{qe.init(e,n);const t=V(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})}})),rn=R("$ZodCheckStartsWith",((e,n)=>{qe.init(e,n);const t=new RegExp(`^${V(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})}})),an=R("$ZodCheckEndsWith",((e,n)=>{qe.init(e,n);const t=new RegExp(`.*${V(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})}})),sn=R("$ZodCheckOverwrite",((e,n)=>{qe.init(e,n),e._zod.check=e=>{e.value=n.tx(e.value)}}));class cn{constructor(e=[]){this.content=[],this.indent=0,this&&(this.args=e)}indented(e){this.indent+=1,e(this),this.indent-=1}write(e){if("function"==typeof e)return e(this,{execution:"sync"}),void e(this,{execution:"async"});const n=e.split("\n").filter((e=>e)),t=Math.min(...n.map((e=>e.length-e.trimStart().length))),o=n.map((e=>e.slice(t))).map((e=>" ".repeat(2*this.indent)+e));for(const r of o)this.content.push(r)}compile(){return new Function(...null==this?void 0:this.args,[...((null==this?void 0:this.content)??[""]).map((e=>` ${e}`))].join("\n"))}}const dn={major:4,minor:3,patch:6},ln=R("$ZodType",((e,n)=>{var t,o;e??(e={}),e._zod.def=n,e._zod.bag=e._zod.bag||{},e._zod.version=dn;const r=[...e._zod.def.checks??[]];e._zod.traits.has("$ZodCheck")&&r.unshift(e);for(const a of r)for(const n of a._zod.onattach)n(e);if(0===r.length)(o=e._zod).deferred??(o.deferred=[]),null==(t=e._zod.deferred)||t.push((()=>{e._zod.run=e._zod.parse}));else{const n=(e,n,t)=>{let o,r=H(e);for(const a of n){if(a._zod.def.when){if(!a._zod.def.when(e))continue}else if(r)continue;const n=e.issues.length,i=a._zod.check(e);if(i instanceof Promise&&!1===(null==t?void 0:t.async))throw new T;if(o||i instanceof Promise)o=(o??Promise.resolve()).then((async()=>{await i;e.issues.length!==n&&(r||(r=H(e,n)))}));else{if(e.issues.length===n)continue;r||(r=H(e,n))}}return o?o.then((()=>e)):e},t=(t,o,a)=>{if(H(t))return t.aborted=!0,t;const i=n(o,r,a);if(i instanceof Promise){if(!1===a.async)throw new T;return i.then((n=>e._zod.parse(n,a)))}return e._zod.parse(i,a)};e._zod.run=(o,a)=>{if(a.skipChecks)return e._zod.parse(o,a);if("backward"===a.direction){const n=e._zod.parse({value:o.value,issues:[]},{...a,skipChecks:!0});return n instanceof Promise?n.then((e=>t(e,o,a))):t(n,o,a)}const i=e._zod.parse(o,a);if(i instanceof Promise){if(!1===a.async)throw new T;return i.then((e=>n(e,r,a)))}return n(i,r,a)}}$(e,"~standard",(()=>({validate:n=>{var t;try{const o=ce(e,n);return o.success?{value:o.data}:{issues:null==(t=o.error)?void 0:t.issues}}catch(o){return le(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})))})),un=R("$ZodString",((e,n)=>{var t;ln.init(e,n),e._zod.pattern=[...(null==(t=null==e?void 0:e._zod.bag)?void 0:t.patterns)??[]].pop()??(e=>{const n=e?`[\\s\\S]{${(null==e?void 0:e.minimum)??0},${(null==e?void 0:e.maximum)??""}}`:"[\\s\\S]*";return new RegExp(`^${n}$`)})(e._zod.bag),e._zod.parse=(t,o)=>{if(n.coerce)try{t.value=String(t.value)}catch(r){}return"string"==typeof t.value||t.issues.push({expected:"string",code:"invalid_type",input:t.value,inst:e}),t}})),pn=R("$ZodStringFormat",((e,n)=>{Qe.init(e,n),un.init(e,n)})),fn=R("$ZodGUID",((e,n)=>{n.pattern??(n.pattern=Te),pn.init(e,n)})),hn=R("$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=Oe(e))}else n.pattern??(n.pattern=Oe());pn.init(e,n)})),mn=R("$ZodEmail",((e,n)=>{n.pattern??(n.pattern=Se),pn.init(e,n)})),gn=R("$ZodURL",((e,n)=>{pn.init(e,n),e._zod.check=t=>{try{const o=t.value.trim(),r=new URL(o);return n.hostname&&(n.hostname.lastIndex=0,n.hostname.test(r.hostname)||t.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:n.hostname.source,input:t.value,inst:e,continue:!n.abort})),n.protocol&&(n.protocol.lastIndex=0,n.protocol.test(r.protocol.endsWith(":")?r.protocol.slice(0,-1):r.protocol)||t.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:n.protocol.source,input:t.value,inst:e,continue:!n.abort})),void(n.normalize?t.value=r.href:t.value=o)}catch(o){t.issues.push({code:"invalid_format",format:"url",input:t.value,inst:e,continue:!n.abort})}}})),vn=R("$ZodEmoji",((e,n)=>{n.pattern??(n.pattern=new RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),pn.init(e,n)})),bn=R("$ZodNanoID",((e,n)=>{n.pattern??(n.pattern=Ee),pn.init(e,n)})),yn=R("$ZodCUID",((e,n)=>{n.pattern??(n.pattern=ye),pn.init(e,n)})),wn=R("$ZodCUID2",((e,n)=>{n.pattern??(n.pattern=we),pn.init(e,n)})),xn=R("$ZodULID",((e,n)=>{n.pattern??(n.pattern=xe),pn.init(e,n)})),_n=R("$ZodXID",((e,n)=>{n.pattern??(n.pattern=_e),pn.init(e,n)})),kn=R("$ZodKSUID",((e,n)=>{n.pattern??(n.pattern=ke),pn.init(e,n)})),En=R("$ZodISODateTime",((e,n)=>{n.pattern??(n.pattern=function(e){const n=De({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(`^${$e}T(?:${o})$`)}(n)),pn.init(e,n)})),Rn=R("$ZodISODate",((e,n)=>{n.pattern??(n.pattern=Fe),pn.init(e,n)})),Tn=R("$ZodISOTime",((e,n)=>{n.pattern??(n.pattern=new RegExp(`^${De(n)}$`)),pn.init(e,n)})),On=R("$ZodISODuration",((e,n)=>{n.pattern??(n.pattern=Re),pn.init(e,n)})),Sn=R("$ZodIPv4",((e,n)=>{n.pattern??(n.pattern=Ie),pn.init(e,n),e._zod.bag.format="ipv4"})),In=R("$ZodIPv6",((e,n)=>{n.pattern??(n.pattern=Ne),pn.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})}}})),Nn=R("$ZodCIDRv4",((e,n)=>{n.pattern??(n.pattern=ze),pn.init(e,n)})),zn=R("$ZodCIDRv6",((e,n)=>{n.pattern??(n.pattern=Ae),pn.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 An(e){if(""===e)return!0;if(e.length%4!=0)return!1;try{return atob(e),!0}catch{return!1}}const Cn=R("$ZodBase64",((e,n)=>{n.pattern??(n.pattern=Ce),pn.init(e,n),e._zod.bag.contentEncoding="base64",e._zod.check=t=>{An(t.value)||t.issues.push({code:"invalid_format",format:"base64",input:t.value,inst:e,continue:!n.abort})}}));const jn=R("$ZodBase64URL",((e,n)=>{n.pattern??(n.pattern=je),pn.init(e,n),e._zod.bag.contentEncoding="base64url",e._zod.check=t=>{(function(e){if(!je.test(e))return!1;const n=e.replace(/[-_]/g,(e=>"-"===e?"+":"/"));return An(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})}})),Pn=R("$ZodE164",((e,n)=>{n.pattern??(n.pattern=Pe),pn.init(e,n)}));const $n=R("$ZodJWT",((e,n)=>{pn.init(e,n),e._zod.check=t=>{(function(e,n=null){try{const t=e.split(".");if(3!==t.length)return!1;const[o]=t;if(!o)return!1;const r=JSON.parse(atob(o));return!("typ"in r&&"JWT"!==(null==r?void 0:r.typ)||!r.alg||n&&(!("alg"in r)||r.alg!==n))}catch{return!1}})(t.value,n.alg)||t.issues.push({code:"invalid_format",format:"jwt",input:t.value,inst:e,continue:!n.abort})}})),Fn=R("$ZodNumber",((e,n)=>{ln.init(e,n),e._zod.pattern=e._zod.bag.pattern??Me,e._zod.parse=(t,o)=>{if(n.coerce)try{t.value=Number(t.value)}catch(i){}const r=t.value;if("number"==typeof r&&!Number.isNaN(r)&&Number.isFinite(r))return t;const a="number"==typeof r?Number.isNaN(r)?"NaN":Number.isFinite(r)?void 0:"Infinity":void 0;return t.issues.push({expected:"number",code:"invalid_type",input:r,inst:e,...a?{received:a}:{}}),t}})),Dn=R("$ZodNumberFormat",((e,n)=>{Ge.init(e,n),Fn.init(e,n)})),Ln=R("$ZodBoolean",((e,n)=>{ln.init(e,n),e._zod.pattern=Ue,e._zod.parse=(t,o)=>{if(n.coerce)try{t.value=Boolean(t.value)}catch(a){}const r=t.value;return"boolean"==typeof r||t.issues.push({expected:"boolean",code:"invalid_type",input:r,inst:e}),t}})),Mn=R("$ZodAny",((e,n)=>{ln.init(e,n),e._zod.parse=e=>e})),Un=R("$ZodUnknown",((e,n)=>{ln.init(e,n),e._zod.parse=e=>e})),Bn=R("$ZodNever",((e,n)=>{ln.init(e,n),e._zod.parse=(n,t)=>(n.issues.push({expected:"never",code:"invalid_type",input:n.value,inst:e}),n)}));function Wn(e,n,t){e.issues.length&&n.issues.push(...Y(t,e.issues)),n.value[t]=e.value}const qn=R("$ZodArray",((e,n)=>{ln.init(e,n),e._zod.parse=(t,o)=>{const r=t.value;if(!Array.isArray(r))return t.issues.push({expected:"array",code:"invalid_type",input:r,inst:e}),t;t.value=Array(r.length);const a=[];for(let e=0;e<r.length;e++){const i=r[e],s=n.element._zod.run({value:i,issues:[]},o);s instanceof Promise?a.push(s.then((n=>Wn(n,t,e)))):Wn(s,t,e)}return a.length?Promise.all(a).then((()=>t)):t}}));function Zn(e,n,t,o,r){if(e.issues.length){if(r&&!(t in o))return;n.issues.push(...Y(t,e.issues))}void 0===e.value?t in o&&(n.value[t]=void 0):n.value[t]=e.value}function Vn(e){var n,t,o,r;const a=Object.keys(e.shape);for(const c of a)if(!(null==(r=null==(o=null==(t=null==(n=e.shape)?void 0:n[c])?void 0:t._zod)?void 0:o.traits)?void 0:r.has("$ZodType")))throw new Error(`Invalid element at key "${c}": expected a Zod schema`);const i=(s=e.shape,Object.keys(s).filter((e=>"optional"===s[e]._zod.optin&&"optional"===s[e]._zod.optout)));var s;return{...e,keys:a,keySet:new Set(a),numKeys:a.length,optionalKeys:new Set(i)}}function Kn(e,n,t,o,r,a){const i=[],s=r.keySet,c=r.catchall._zod,d=c.def.type,l="optional"===c.optout;for(const u in n){if(s.has(u))continue;if("never"===d){i.push(u);continue}const r=c.run({value:n[u],issues:[]},o);r instanceof Promise?e.push(r.then((e=>Zn(e,t,u,n,l)))):Zn(r,t,u,n,l)}return i.length&&t.issues.push({code:"unrecognized_keys",keys:i,input:n,inst:a}),e.length?Promise.all(e).then((()=>t)):t}const Jn=R("$ZodObject",((e,n)=>{ln.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=A((()=>Vn(n)));$(e._zod,"propValues",(()=>{const e=n.shape,t={};for(const n in e){const o=e[n]._zod;if(o.values){t[n]??(t[n]=new Set);for(const e of o.values)t[n].add(e)}}return t}));const r=U,a=n.catchall;let i;e._zod.parse=(n,t)=>{i??(i=o.value);const s=n.value;if(!r(s))return n.issues.push({expected:"object",code:"invalid_type",input:s,inst:e}),n;n.value={};const c=[],d=i.shape;for(const e of i.keys){const o=d[e],r="optional"===o._zod.optout,a=o._zod.run({value:s[e],issues:[]},t);a instanceof Promise?c.push(a.then((t=>Zn(t,n,e,s,r)))):Zn(a,n,e,s,r)}return a?Kn(c,s,n,t,o.value,e):c.length?Promise.all(c).then((()=>n)):n}})),Gn=R("$ZodObjectJIT",((e,n)=>{Jn.init(e,n);const t=e._zod.parse,o=A((()=>Vn(n)));let r;const a=U,i=!S.jitless,s=i&&B.value,c=n.catchall;let d;e._zod.parse=(l,u)=>{d??(d=o.value);const p=l.value;return a(p)?i&&s&&!1===(null==u?void 0:u.async)&&!0!==u.jitless?(r||(r=(e=>{var n;const t=new cn(["shape","payload","ctx"]),r=o.value,a=e=>{const n=L(e);return`shape[${n}]._zod.run({ value: input[${n}], issues: [] }, ctx)`};t.write("const input = payload.value;");const i=Object.create(null);let s=0;for(const o of r.keys)i[o]="key_"+s++;t.write("const newResult = {};");for(const o of r.keys){const r=i[o],s=L(o),c=e[o],d="optional"===(null==(n=null==c?void 0:c._zod)?void 0:n.optout);t.write(`const ${r} = ${a(o)};`),d?t.write(`\n if (${r}.issues.length) {\n if (${s} in input) {\n payload.issues = payload.issues.concat(${r}.issues.map(iss => ({\n ...iss,\n path: iss.path ? [${s}, ...iss.path] : [${s}]\n })));\n }\n }\n \n if (${r}.value === undefined) {\n if (${s} in input) {\n newResult[${s}] = undefined;\n }\n } else {\n newResult[${s}] = ${r}.value;\n }\n \n `):t.write(`\n if (${r}.issues.length) {\n payload.issues = payload.issues.concat(${r}.issues.map(iss => ({\n ...iss,\n path: iss.path ? [${s}, ...iss.path] : [${s}]\n })));\n }\n \n if (${r}.value === undefined) {\n if (${s} in input) {\n newResult[${s}] = undefined;\n }\n } else {\n newResult[${s}] = ${r}.value;\n }\n \n `)}t.write("payload.value = newResult;"),t.write("return payload;");const c=t.compile();return(n,t)=>c(e,n,t)})(n.shape)),l=r(l,u),c?Kn([],p,l,u,d,e):l):t(l,u):(l.issues.push({expected:"object",code:"invalid_type",input:p,inst:e}),l)}}));function Hn(e,n,t,o){for(const a of e)if(0===a.issues.length)return n.value=a.value,n;const r=e.filter((e=>!H(e)));return 1===r.length?(n.value=r[0].value,r[0]):(n.issues.push({code:"invalid_union",input:n.value,inst:t,errors:e.map((e=>e.issues.map((e=>Q(e,o,I())))))}),n)}const Yn=R("$ZodUnion",((e,n)=>{ln.init(e,n),$(e._zod,"optin",(()=>n.options.some((e=>"optional"===e._zod.optin))?"optional":void 0)),$(e._zod,"optout",(()=>n.options.some((e=>"optional"===e._zod.optout))?"optional":void 0)),$(e._zod,"values",(()=>{if(n.options.every((e=>e._zod.values)))return new Set(n.options.flatMap((e=>Array.from(e._zod.values))))})),$(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=>j(e.source))).join("|")})$`)}}));const t=1===n.options.length,o=n.options[0]._zod.run;e._zod.parse=(r,a)=>{if(t)return o(r,a);let i=!1;const s=[];for(const e of n.options){const n=e._zod.run({value:r.value,issues:[]},a);if(n instanceof Promise)s.push(n),i=!0;else{if(0===n.issues.length)return n;s.push(n)}}return i?Promise.all(s).then((n=>Hn(n,r,e,a))):Hn(s,r,e,a)}})),Xn=R("$ZodIntersection",((e,n)=>{ln.init(e,n),e._zod.parse=(e,t)=>{const o=e.value,r=n.left._zod.run({value:o,issues:[]},t),a=n.right._zod.run({value:o,issues:[]},t);return r instanceof Promise||a instanceof Promise?Promise.all([r,a]).then((([n,t])=>et(e,n,t))):et(e,r,a)}}));function Qn(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(W(e)&&W(n)){const t=Object.keys(n),o=Object.keys(e).filter((e=>-1!==t.indexOf(e))),r={...e,...n};for(const a of o){const t=Qn(e[a],n[a]);if(!t.valid)return{valid:!1,mergeErrorPath:[a,...t.mergeErrorPath]};r[a]=t.data}return{valid:!0,data:r}}if(Array.isArray(e)&&Array.isArray(n)){if(e.length!==n.length)return{valid:!1,mergeErrorPath:[]};const t=[];for(let o=0;o<e.length;o++){const r=Qn(e[o],n[o]);if(!r.valid)return{valid:!1,mergeErrorPath:[o,...r.mergeErrorPath]};t.push(r.data)}return{valid:!0,data:t}}return{valid:!1,mergeErrorPath:[]}}function et(e,n,t){const o=new Map;let r;for(const s of n.issues)if("unrecognized_keys"===s.code){r??(r=s);for(const e of s.keys)o.has(e)||o.set(e,{}),o.get(e).l=!0}else e.issues.push(s);for(const s of t.issues)if("unrecognized_keys"===s.code)for(const e of s.keys)o.has(e)||o.set(e,{}),o.get(e).r=!0;else e.issues.push(s);const a=[...o].filter((([,e])=>e.l&&e.r)).map((([e])=>e));if(a.length&&r&&e.issues.push({...r,keys:a}),H(e))return e;const i=Qn(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 nt=R("$ZodEnum",((e,n)=>{ln.init(e,n);const t=N(n.entries),o=new Set(t);e._zod.values=o,e._zod.pattern=new RegExp(`^(${t.filter((e=>Z.has(typeof e))).map((e=>"string"==typeof e?V(e):e.toString())).join("|")})$`),e._zod.parse=(n,r)=>{const a=n.value;return o.has(a)||n.issues.push({code:"invalid_value",values:t,input:a,inst:e}),n}})),tt=R("$ZodTransform",((e,n)=>{ln.init(e,n),e._zod.parse=(t,o)=>{if("backward"===o.direction)throw new O(e.constructor.name);const r=n.transform(t.value,t);if(o.async){return(r instanceof Promise?r:Promise.resolve(r)).then((e=>(t.value=e,t)))}if(r instanceof Promise)throw new T;return t.value=r,t}}));function ot(e,n){return e.issues.length&&void 0===n?{issues:[],value:void 0}:e}const rt=R("$ZodOptional",((e,n)=>{ln.init(e,n),e._zod.optin="optional",e._zod.optout="optional",$(e._zod,"values",(()=>n.innerType._zod.values?new Set([...n.innerType._zod.values,void 0]):void 0)),$(e._zod,"pattern",(()=>{const e=n.innerType._zod.pattern;return e?new RegExp(`^(${j(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=>ot(n,e.value))):ot(o,e.value)}return void 0===e.value?e:n.innerType._zod.run(e,t)}})),at=R("$ZodExactOptional",((e,n)=>{rt.init(e,n),$(e._zod,"values",(()=>n.innerType._zod.values)),$(e._zod,"pattern",(()=>n.innerType._zod.pattern)),e._zod.parse=(e,t)=>n.innerType._zod.run(e,t)})),it=R("$ZodNullable",((e,n)=>{ln.init(e,n),$(e._zod,"optin",(()=>n.innerType._zod.optin)),$(e._zod,"optout",(()=>n.innerType._zod.optout)),$(e._zod,"pattern",(()=>{const e=n.innerType._zod.pattern;return e?new RegExp(`^(${j(e.source)}|null)$`):void 0})),$(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)})),st=R("$ZodDefault",((e,n)=>{ln.init(e,n),e._zod.optin="optional",$(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=>ct(e,n))):ct(o,n)}}));function ct(e,n){return void 0===e.value&&(e.value=n.defaultValue),e}const dt=R("$ZodPrefault",((e,n)=>{ln.init(e,n),e._zod.optin="optional",$(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))})),lt=R("$ZodNonOptional",((e,n)=>{ln.init(e,n),$(e._zod,"values",(()=>{const e=n.innerType._zod.values;return e?new Set([...e].filter((e=>void 0!==e))):void 0})),e._zod.parse=(t,o)=>{const r=n.innerType._zod.run(t,o);return r instanceof Promise?r.then((n=>ut(n,e))):ut(r,e)}}));function ut(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 pt=R("$ZodCatch",((e,n)=>{ln.init(e,n),$(e._zod,"optin",(()=>n.innerType._zod.optin)),$(e._zod,"optout",(()=>n.innerType._zod.optout)),$(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=>Q(e,t,I())))},input:e.value}),e.issues=[]),e))):(e.value=o.value,o.issues.length&&(e.value=n.catchValue({...e,error:{issues:o.issues.map((e=>Q(e,t,I())))},input:e.value}),e.issues=[]),e)}})),ft=R("$ZodPipe",((e,n)=>{ln.init(e,n),$(e._zod,"values",(()=>n.in._zod.values)),$(e._zod,"optin",(()=>n.in._zod.optin)),$(e._zod,"optout",(()=>n.out._zod.optout)),$(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=>ht(e,n.in,t))):ht(o,n.in,t)}const o=n.in._zod.run(e,t);return o instanceof Promise?o.then((e=>ht(e,n.out,t))):ht(o,n.out,t)}}));function ht(e,n,t){return e.issues.length?(e.aborted=!0,e):n._zod.run({value:e.value,issues:e.issues},t)}const mt=R("$ZodReadonly",((e,n)=>{ln.init(e,n),$(e._zod,"propValues",(()=>n.innerType._zod.propValues)),$(e._zod,"values",(()=>n.innerType._zod.values)),$(e._zod,"optin",(()=>{var e,t;return null==(t=null==(e=n.innerType)?void 0:e._zod)?void 0:t.optin})),$(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(gt):gt(o)}}));function gt(e){return e.value=Object.freeze(e.value),e}const vt=R("$ZodCustom",((e,n)=>{qe.init(e,n),ln.init(e,n),e._zod.parse=(e,n)=>e,e._zod.check=t=>{const o=t.value,r=n.fn(o);if(r instanceof Promise)return r.then((n=>bt(n,t,o,e)));bt(r,t,o,e)}}));function bt(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(ne(e))}}var yt;class wt{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)}}(yt=globalThis).__zod_globalRegistry??(yt.__zod_globalRegistry=new wt);const xt=globalThis.__zod_globalRegistry;function _t(e,n){return new e({type:"string",...J(n)})}function kt(e,n){return new e({type:"string",format:"email",check:"string_format",abort:!1,...J(n)})}function Et(e,n){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...J(n)})}function Rt(e,n){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...J(n)})}function Tt(e,n){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...J(n)})}function Ot(e,n){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...J(n)})}function St(e,n){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...J(n)})}function It(e,n){return new e({type:"string",format:"url",check:"string_format",abort:!1,...J(n)})}function Nt(e,n){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...J(n)})}function zt(e,n){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...J(n)})}function At(e,n){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...J(n)})}function Ct(e,n){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...J(n)})}function jt(e,n){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...J(n)})}function Pt(e,n){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...J(n)})}function $t(e,n){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...J(n)})}function Ft(e,n){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...J(n)})}function Dt(e,n){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...J(n)})}function Lt(e,n){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...J(n)})}function Mt(e,n){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...J(n)})}function Ut(e,n){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...J(n)})}function Bt(e,n){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...J(n)})}function Wt(e,n){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...J(n)})}function qt(e,n){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...J(n)})}function Zt(e,n){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...J(n)})}function Vt(e,n){return new e({type:"string",format:"date",check:"string_format",...J(n)})}function Kt(e,n){return new e({type:"string",format:"time",check:"string_format",precision:null,...J(n)})}function Jt(e,n){return new e({type:"string",format:"duration",check:"string_format",...J(n)})}function Gt(e,n){return new e({type:"number",checks:[],...J(n)})}function Ht(e,n){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...J(n)})}function Yt(e,n){return new e({type:"boolean",...J(n)})}function Xt(e){return new e({type:"any"})}function Qt(e){return new e({type:"unknown"})}function eo(e,n){return new e({type:"never",...J(n)})}function no(e,n){return new Ve({check:"less_than",...J(n),value:e,inclusive:!1})}function to(e,n){return new Ve({check:"less_than",...J(n),value:e,inclusive:!0})}function oo(e,n){return new Ke({check:"greater_than",...J(n),value:e,inclusive:!1})}function ro(e,n){return new Ke({check:"greater_than",...J(n),value:e,inclusive:!0})}function ao(e,n){return new Je({check:"multiple_of",...J(n),value:e})}function io(e,n){return new He({check:"max_length",...J(n),maximum:e})}function so(e,n){return new Ye({check:"min_length",...J(n),minimum:e})}function co(e,n){return new Xe({check:"length_equals",...J(n),length:e})}function lo(e,n){return new en({check:"string_format",format:"regex",...J(n),pattern:e})}function uo(e){return new nn({check:"string_format",format:"lowercase",...J(e)})}function po(e){return new tn({check:"string_format",format:"uppercase",...J(e)})}function fo(e,n){return new on({check:"string_format",format:"includes",...J(n),includes:e})}function ho(e,n){return new rn({check:"string_format",format:"starts_with",...J(n),prefix:e})}function mo(e,n){return new an({check:"string_format",format:"ends_with",...J(n),suffix:e})}function go(e){return new sn({check:"overwrite",tx:e})}function vo(e){return go((n=>n.normalize(e)))}function bo(){return go((e=>e.trim()))}function yo(){return go((e=>e.toLowerCase()))}function wo(){return go((e=>e.toUpperCase()))}function xo(){return go((e=>function(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}(e)))}function _o(e,n,t){return new e({type:"array",element:n,...J(t)})}function ko(e,n,t){return new e({type:"custom",check:"custom",fn:n,...J(t)})}function Eo(e){const n=Ro((t=>(t.addIssue=e=>{if("string"==typeof e)t.issues.push(ne(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(ne(o))}},e(t.value,t))));return n}function Ro(e,n){const t=new qe({check:"custom",...J(n)});return t._zod.check=e,t}function To(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)??xt,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 Oo(e,n,t={path:[],schemaPath:[]}){var o,r,a;const i=e._zod.def,s=n.seen.get(e);if(s){s.count++;return t.schemaPath.includes(e)&&(s.cycle=t.path),s.schema}const c={schema:{},count:1,cycle:void 0,path:t.path};n.seen.set(e,c);const d=null==(r=(o=e._zod).toJSONSchema)?void 0:r.call(o);if(d)c.schema=d;else{const o={...t,schemaPath:[...t.schemaPath,e],path:t.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(n,c.schema,o);else{const t=c.schema,r=n.processors[i.type];if(!r)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${i.type}`);r(e,n,t,o)}const r=e._zod.parent;r&&(c.ref||(c.ref=r),Oo(r,n,o),n.seen.get(r).isParent=!0)}const l=n.metadataRegistry.get(e);l&&Object.assign(c.schema,l),"input"===n.io&&No(e)&&(delete c.schema.examples,delete c.schema.default),"input"===n.io&&c.schema._prefault&&((a=c.schema).default??(a.default=c.schema._prefault)),delete c.schema._prefault;return n.seen.get(e).schema}function So(e,n){var t,o,r,a;const i=e.seen.get(n);if(!i)throw new Error("Unprocessed schema. This is a bug in Zod.");const s=new Map;for(const d of e.seen.entries()){const n=null==(t=e.metadataRegistry.get(d[0]))?void 0:t.id;if(n){const e=s.get(n);if(e&&e!==d[0])throw new Error(`Duplicate schema id "${n}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);s.set(n,d[0])}}const c=n=>{if(n[1].schema.$ref)return;const t=n[1],{ref:o,defId:r}=(n=>{var t;const o="draft-2020-12"===e.target?"$defs":"definitions";if(e.external){const r=null==(t=e.external.registry.get(n[0]))?void 0:t.id,a=e.external.uri??(e=>e);if(r)return{ref:a(r)};const i=n[1].defId??n[1].schema.id??"schema"+e.counter++;return n[1].defId=i,{defId:i,ref:`${a("__shared")}#/${o}/${i}`}}if(n[1]===i)return{ref:"#"};const r=`#/${o}/`,a=n[1].schema.id??"__schema"+e.counter++;return{defId:a,ref:r+a}})(n);t.def={...t.schema},r&&(t.defId=r);const a=t.schema;for(const e in a)delete a[e];a.$ref=o};if("throw"===e.cycles)for(const d of e.seen.entries()){const e=d[1];if(e.cycle)throw new Error(`Cycle detected: #/${null==(o=e.cycle)?void 0:o.join("/")}/<root>\n\nSet the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(const d of e.seen.entries()){const t=d[1];if(n===d[0]){c(d);continue}if(e.external){const t=null==(r=e.external.registry.get(d[0]))?void 0:r.id;if(n!==d[0]&&t){c(d);continue}}(null==(a=e.metadataRegistry.get(d[0]))?void 0:a.id)?c(d):(t.cycle||t.count>1&&"ref"===e.reused)&&c(d)}}function Io(e,n){var t,o,r;const a=e.seen.get(n);if(!a)throw new Error("Unprocessed schema. This is a bug in Zod.");const i=n=>{const t=e.seen.get(n);if(null===t.ref)return;const o=t.def??t.schema,r={...o},a=t.ref;if(t.ref=null,a){i(a);const t=e.seen.get(a),s=t.schema;!s.$ref||"draft-07"!==e.target&&"draft-04"!==e.target&&"openapi-3.0"!==e.target?Object.assign(o,s):(o.allOf=o.allOf??[],o.allOf.push(s)),Object.assign(o,r);if(n._zod.parent===a)for(const e in o)"$ref"!==e&&"allOf"!==e&&(e in r||delete o[e]);if(s.$ref&&t.def)for(const e in o)"$ref"!==e&&"allOf"!==e&&e in t.def&&JSON.stringify(o[e])===JSON.stringify(t.def[e])&&delete o[e]}const s=n._zod.parent;if(s&&s!==a){i(s);const n=e.seen.get(s);if((null==n?void 0:n.schema.$ref)&&(o.$ref=n.schema.$ref,n.def))for(const e in o)"$ref"!==e&&"allOf"!==e&&e in n.def&&JSON.stringify(o[e])===JSON.stringify(n.def[e])&&delete o[e]}e.override({zodSchema:n,jsonSchema:o,path:t.path??[]})};for(const l of[...e.seen.entries()].reverse())i(l[0]);const s={};if("draft-2020-12"===e.target?s.$schema="https://json-schema.org/draft/2020-12/schema":"draft-07"===e.target?s.$schema="http://json-schema.org/draft-07/schema#":"draft-04"===e.target?s.$schema="http://json-schema.org/draft-04/schema#":e.target,null==(t=e.external)?void 0:t.uri){const t=null==(o=e.external.registry.get(n))?void 0:o.id;if(!t)throw new Error("Schema is missing an `id` property");s.$id=e.external.uri(t)}Object.assign(s,a.def??a.schema);const c=(null==(r=e.external)?void 0:r.defs)??{};for(const l of e.seen.entries()){const e=l[1];e.def&&e.defId&&(c[e.defId]=e.def)}e.external||Object.keys(c).length>0&&("draft-2020-12"===e.target?s.$defs=c:s.definitions=c);try{const t=JSON.parse(JSON.stringify(s));return Object.defineProperty(t,"~standard",{value:{...n["~standard"],jsonSchema:{input:zo(n,"input",e.processors),output:zo(n,"output",e.processors)}},enumerable:!1,writable:!1}),t}catch(d){throw new Error("Error converting schema to JSON.")}}function No(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 No(o.element,t);if("set"===o.type)return No(o.valueType,t);if("lazy"===o.type)return No(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 No(o.innerType,t);if("intersection"===o.type)return No(o.left,t)||No(o.right,t);if("record"===o.type||"map"===o.type)return No(o.keyType,t)||No(o.valueType,t);if("pipe"===o.type)return No(o.in,t)||No(o.out,t);if("object"===o.type){for(const e in o.shape)if(No(o.shape[e],t))return!0;return!1}if("union"===o.type){for(const e of o.options)if(No(e,t))return!0;return!1}if("tuple"===o.type){for(const e of o.items)if(No(e,t))return!0;return!(!o.rest||!No(o.rest,t))}return!1}const zo=(e,n,t={})=>o=>{const{libraryOptions:r,target:a}=o??{},i=To({...r??{},target:a,io:n,processors:t});return Oo(e,i),So(i,e),Io(i,e)},Ao={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},Co=(e,n,t,o)=>{const r=e._zod.def;Oo(r.innerType,n,o);n.seen.get(e).ref=r.innerType},jo=R("ZodISODateTime",((e,n)=>{En.init(e,n),nr.init(e,n)}));const Po=R("ZodISODate",((e,n)=>{Rn.init(e,n),nr.init(e,n)}));const $o=R("ZodISOTime",((e,n)=>{Tn.init(e,n),nr.init(e,n)}));const Fo=R("ZodISODuration",((e,n)=>{On.init(e,n),nr.init(e,n)}));const Do=R("ZodError",((e,n)=>{oe.init(e,n),e.name="ZodError",Object.defineProperties(e,{format:{value:n=>function(e,n=e=>e.message){const t={_errors:[]},o=e=>{for(const r of e.issues)if("invalid_union"===r.code&&r.errors.length)r.errors.map((e=>o({issues:e})));else if("invalid_key"===r.code)o({issues:r.issues});else if("invalid_element"===r.code)o({issues:r.issues});else if(0===r.path.length)t._errors.push(n(r));else{let e=t,o=0;for(;o<r.path.length;){const t=r.path[o];o===r.path.length-1?(e[t]=e[t]||{_errors:[]},e[t]._errors.push(n(r))):e[t]=e[t]||{_errors:[]},e=e[t],o++}}};return o(e),t}(e,n)},flatten:{value:n=>function(e,n=e=>e.message){const t={},o=[];for(const r of e.issues)r.path.length>0?(t[r.path[0]]=t[r.path[0]]||[],t[r.path[0]].push(n(r))):o.push(n(r));return{formErrors:o,fieldErrors:t}}(e,n)},addIssue:{value:n=>{e.issues.push(n),e.message=JSON.stringify(e.issues,z,2)}},addIssues:{value:n=>{e.issues.push(...n),e.message=JSON.stringify(e.issues,z,2)}},isEmpty:{get:()=>0===e.issues.length}})}),{Parent:Error}),Lo=ae(Do),Mo=ie(Do),Uo=se(Do),Bo=de(Do),Wo=ue(Do),qo=pe(Do),Zo=fe(Do),Vo=he(Do),Ko=me(Do),Jo=ge(Do),Go=ve(Do),Ho=be(Do),Yo=R("ZodType",((e,n)=>(ln.init(e,n),Object.assign(e["~standard"],{jsonSchema:{input:zo(e,"input"),output:zo(e,"output")}}),e.toJSONSchema=((e,n={})=>t=>{const o=To({...t,processors:n});return Oo(e,o),So(o,e),Io(o,e)})(e,{}),e.def=n,e.type=n.type,Object.defineProperty(e,"_def",{value:n}),e.check=(...t)=>e.clone(D(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)=>K(e,n,t),e.brand=()=>e,e.register=(n,t)=>(n.add(e,t),e),e.parse=(n,t)=>Lo(e,n,t,{callee:e.parse}),e.safeParse=(n,t)=>Uo(e,n,t),e.parseAsync=async(n,t)=>Mo(e,n,t,{callee:e.parseAsync}),e.safeParseAsync=async(n,t)=>Bo(e,n,t),e.spa=e.safeParseAsync,e.encode=(n,t)=>Wo(e,n,t),e.decode=(n,t)=>qo(e,n,t),e.encodeAsync=async(n,t)=>Zo(e,n,t),e.decodeAsync=async(n,t)=>Vo(e,n,t),e.safeEncode=(n,t)=>Ko(e,n,t),e.safeDecode=(n,t)=>Jo(e,n,t),e.safeEncodeAsync=async(n,t)=>Go(e,n,t),e.safeDecodeAsync=async(n,t)=>Ho(e,n,t),e.refine=(n,t)=>e.check(function(e,n={}){return ko(Gr,e,n)}(n,t)),e.superRefine=n=>e.check(Eo(n)),e.overwrite=n=>e.check(go(n)),e.optional=()=>Dr(e),e.exactOptional=()=>new Lr({type:"optional",innerType:e}),e.nullable=()=>Ur(e),e.nullish=()=>Dr(Ur(e)),e.nonoptional=n=>function(e,n){return new qr({type:"nonoptional",innerType:e,...J(n)})}(e,n),e.array=()=>{return _o(Nr,e,n);var n},e.or=n=>{return new Cr({type:"union",options:[e,n],...J(t)});var t},e.and=n=>new jr({type:"intersection",left:e,right:n}),e.transform=n=>Kr(e,new $r({type:"transform",transform:n})),e.default=n=>{return t=n,new Br({type:"default",innerType:e,get defaultValue(){return"function"==typeof t?t():q(t)}});var t},e.prefault=n=>{return t=n,new Wr({type:"prefault",innerType:e,get defaultValue(){return"function"==typeof t?t():q(t)}});var t},e.catch=n=>{return new Zr({type:"catch",innerType:e,catchValue:"function"==typeof(t=n)?t:()=>t});var t},e.pipe=n=>Kr(e,n),e.readonly=()=>new Jr({type:"readonly",innerType:e}),e.describe=n=>{const t=e.clone();return xt.add(t,{description:n}),t},Object.defineProperty(e,"description",{get(){var n;return null==(n=xt.get(e))?void 0:n.description},configurable:!0}),e.meta=(...n)=>{if(0===n.length)return xt.get(e);const t=e.clone();return xt.add(t,n[0]),t},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e.apply=n=>n(e),e))),Xo=R("_ZodString",((e,n)=>{un.init(e,n),Yo.init(e,n),e._zod.processJSONSchema=(n,t,o)=>((e,n,t)=>{const o=t;o.type="string";const{minimum:r,maximum:a,format:i,patterns:s,contentEncoding:c}=e._zod.bag;if("number"==typeof r&&(o.minLength=r),"number"==typeof a&&(o.maxLength=a),i&&(o.format=Ao[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(lo(...n)),e.includes=(...n)=>e.check(fo(...n)),e.startsWith=(...n)=>e.check(ho(...n)),e.endsWith=(...n)=>e.check(mo(...n)),e.min=(...n)=>e.check(so(...n)),e.max=(...n)=>e.check(io(...n)),e.length=(...n)=>e.check(co(...n)),e.nonempty=(...n)=>e.check(so(1,...n)),e.lowercase=n=>e.check(uo(n)),e.uppercase=n=>e.check(po(n)),e.trim=()=>e.check(bo()),e.normalize=(...n)=>e.check(vo(...n)),e.toLowerCase=()=>e.check(yo()),e.toUpperCase=()=>e.check(wo()),e.slugify=()=>e.check(xo())})),Qo=R("ZodString",((e,n)=>{un.init(e,n),Xo.init(e,n),e.email=n=>e.check(kt(tr,n)),e.url=n=>e.check(It(ar,n)),e.jwt=n=>e.check(qt(wr,n)),e.emoji=n=>e.check(Nt(ir,n)),e.guid=n=>e.check(Et(or,n)),e.uuid=n=>e.check(Rt(rr,n)),e.uuidv4=n=>e.check(Tt(rr,n)),e.uuidv6=n=>e.check(Ot(rr,n)),e.uuidv7=n=>e.check(St(rr,n)),e.nanoid=n=>e.check(zt(sr,n)),e.guid=n=>e.check(Et(or,n)),e.cuid=n=>e.check(At(cr,n)),e.cuid2=n=>e.check(Ct(dr,n)),e.ulid=n=>e.check(jt(lr,n)),e.base64=n=>e.check(Ut(vr,n)),e.base64url=n=>e.check(Bt(br,n)),e.xid=n=>e.check(Pt(ur,n)),e.ksuid=n=>e.check($t(pr,n)),e.ipv4=n=>e.check(Ft(fr,n)),e.ipv6=n=>e.check(Dt(hr,n)),e.cidrv4=n=>e.check(Lt(mr,n)),e.cidrv6=n=>e.check(Mt(gr,n)),e.e164=n=>e.check(Wt(yr,n)),e.datetime=n=>e.check(function(e){return Zt(jo,e)}(n)),e.date=n=>e.check(function(e){return Vt(Po,e)}(n)),e.time=n=>e.check(function(e){return Kt($o,e)}(n)),e.duration=n=>e.check(function(e){return Jt(Fo,e)}(n))}));function er(e){return _t(Qo,e)}const nr=R("ZodStringFormat",((e,n)=>{pn.init(e,n),Xo.init(e,n)})),tr=R("ZodEmail",((e,n)=>{mn.init(e,n),nr.init(e,n)})),or=R("ZodGUID",((e,n)=>{fn.init(e,n),nr.init(e,n)})),rr=R("ZodUUID",((e,n)=>{hn.init(e,n),nr.init(e,n)})),ar=R("ZodURL",((e,n)=>{gn.init(e,n),nr.init(e,n)})),ir=R("ZodEmoji",((e,n)=>{vn.init(e,n),nr.init(e,n)})),sr=R("ZodNanoID",((e,n)=>{bn.init(e,n),nr.init(e,n)})),cr=R("ZodCUID",((e,n)=>{yn.init(e,n),nr.init(e,n)})),dr=R("ZodCUID2",((e,n)=>{wn.init(e,n),nr.init(e,n)})),lr=R("ZodULID",((e,n)=>{xn.init(e,n),nr.init(e,n)})),ur=R("ZodXID",((e,n)=>{_n.init(e,n),nr.init(e,n)})),pr=R("ZodKSUID",((e,n)=>{kn.init(e,n),nr.init(e,n)})),fr=R("ZodIPv4",((e,n)=>{Sn.init(e,n),nr.init(e,n)})),hr=R("ZodIPv6",((e,n)=>{In.init(e,n),nr.init(e,n)})),mr=R("ZodCIDRv4",((e,n)=>{Nn.init(e,n),nr.init(e,n)})),gr=R("ZodCIDRv6",((e,n)=>{zn.init(e,n),nr.init(e,n)})),vr=R("ZodBase64",((e,n)=>{Cn.init(e,n),nr.init(e,n)})),br=R("ZodBase64URL",((e,n)=>{jn.init(e,n),nr.init(e,n)})),yr=R("ZodE164",((e,n)=>{Pn.init(e,n),nr.init(e,n)})),wr=R("ZodJWT",((e,n)=>{$n.init(e,n),nr.init(e,n)})),xr=R("ZodNumber",((e,n)=>{Fn.init(e,n),Yo.init(e,n),e._zod.processJSONSchema=(n,t,o)=>((e,n,t)=>{const o=t,{minimum:r,maximum:a,format:i,multipleOf:s,exclusiveMaximum:c,exclusiveMinimum:d}=e._zod.bag;"string"==typeof i&&i.includes("int")?o.type="integer":o.type="number","number"==typeof d&&("draft-04"===n.target||"openapi-3.0"===n.target?(o.minimum=d,o.exclusiveMinimum=!0):o.exclusiveMinimum=d),"number"==typeof r&&(o.minimum=r,"number"==typeof d&&"draft-04"!==n.target&&(d>=r?delete o.minimum:delete o.exclusiveMinimum)),"number"==typeof c&&("draft-04"===n.target||"openapi-3.0"===n.target?(o.maximum=c,o.exclusiveMaximum=!0):o.exclusiveMaximum=c),"number"==typeof a&&(o.maximum=a,"number"==typeof c&&"draft-04"!==n.target&&(c<=a?delete o.maximum:delete o.exclusiveMaximum)),"number"==typeof s&&(o.multipleOf=s)})(e,n,t),e.gt=(n,t)=>e.check(oo(n,t)),e.gte=(n,t)=>e.check(ro(n,t)),e.min=(n,t)=>e.check(ro(n,t)),e.lt=(n,t)=>e.check(no(n,t)),e.lte=(n,t)=>e.check(to(n,t)),e.max=(n,t)=>e.check(to(n,t)),e.int=n=>e.check(kr(n)),e.safe=n=>e.check(kr(n)),e.positive=n=>e.check(oo(0,n)),e.nonnegative=n=>e.check(ro(0,n)),e.negative=n=>e.check(no(0,n)),e.nonpositive=n=>e.check(to(0,n)),e.multipleOf=(n,t)=>e.check(ao(n,t)),e.step=(n,t)=>e.check(ao(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 _r=R("ZodNumberFormat",((e,n)=>{Dn.init(e,n),xr.init(e,n)}));function kr(e){return Ht(_r,e)}const Er=R("ZodBoolean",((e,n)=>{Ln.init(e,n),Yo.init(e,n),e._zod.processJSONSchema=(e,n,t)=>((e,n,t)=>{t.type="boolean"})(0,0,n)}));function Rr(e){return Yt(Er,e)}const Tr=R("ZodAny",((e,n)=>{Mn.init(e,n),Yo.init(e,n),e._zod.processJSONSchema=(e,n,t)=>{}}));const Or=R("ZodUnknown",((e,n)=>{Un.init(e,n),Yo.init(e,n),e._zod.processJSONSchema=(e,n,t)=>{}}));function Sr(){return Qt(Or)}const Ir=R("ZodNever",((e,n)=>{Bn.init(e,n),Yo.init(e,n),e._zod.processJSONSchema=(e,n,t)=>((e,n,t)=>{t.not={}})(0,0,n)}));const Nr=R("ZodArray",((e,n)=>{qn.init(e,n),Yo.init(e,n),e._zod.processJSONSchema=(n,t,o)=>((e,n,t,o)=>{const r=t,a=e._zod.def,{minimum:i,maximum:s}=e._zod.bag;"number"==typeof i&&(r.minItems=i),"number"==typeof s&&(r.maxItems=s),r.type="array",r.items=Oo(a.element,n,{...o,path:[...o.path,"items"]})})(e,n,t,o),e.element=n.element,e.min=(n,t)=>e.check(so(n,t)),e.nonempty=n=>e.check(so(1,n)),e.max=(n,t)=>e.check(io(n,t)),e.length=(n,t)=>e.check(co(n,t)),e.unwrap=()=>e.element}));const zr=R("ZodObject",((e,n)=>{Gn.init(e,n),Yo.init(e,n),e._zod.processJSONSchema=(n,t,o)=>((e,n,t,o)=>{var r;const a=t,i=e._zod.def;a.type="object",a.properties={};const s=i.shape;for(const l in s)a.properties[l]=Oo(s[l],n,{...o,path:[...o.path,"properties",l]});const c=new Set(Object.keys(s)),d=new Set([...c].filter((e=>{const t=i.shape[e]._zod;return"input"===n.io?void 0===t.optin:void 0===t.optout})));d.size>0&&(a.required=Array.from(d)),"never"===(null==(r=i.catchall)?void 0:r._zod.def.type)?a.additionalProperties=!1:i.catchall?i.catchall&&(a.additionalProperties=Oo(i.catchall,n,{...o,path:[...o.path,"additionalProperties"]})):"output"===n.io&&(a.additionalProperties=!1)})(e,n,t,o),$(e,"shape",(()=>n.shape)),e.keyof=()=>function(e,n){const t=Array.isArray(e)?Object.fromEntries(e.map((e=>[e,e]))):e;return new Pr({type:"enum",entries:t,...J(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:Sr()}),e.loose=()=>e.clone({...e._zod.def,catchall:Sr()}),e.strict=()=>{return e.clone({...e._zod.def,catchall:eo(Ir,n)});var n},e.strip=()=>e.clone({...e._zod.def,catchall:void 0}),e.extend=n=>function(e,n){if(!W(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=D(e._zod.def,{get shape(){const t={...e._zod.def.shape,...n};return F(this,"shape",t),t}});return K(e,o)}(e,n),e.safeExtend=n=>function(e,n){if(!W(n))throw new Error("Invalid input to safeExtend: expected a plain object");const t=D(e._zod.def,{get shape(){const t={...e._zod.def.shape,...n};return F(this,"shape",t),t}});return K(e,t)}(e,n),e.merge=n=>function(e,n){const t=D(e._zod.def,{get shape(){const t={...e._zod.def.shape,...n._zod.def.shape};return F(this,"shape",t),t},get catchall(){return n._zod.def.catchall},checks:[]});return K(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 K(e,D(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 F(this,"shape",e),e},checks:[]}))}(e,n),e.omit=n=>function(e,n){const t=e._zod.def,o=t.checks;if(o&&o.length>0)throw new Error(".omit() cannot be used on object schemas containing refinements");const r=D(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 F(this,"shape",o),o},checks:[]});return K(e,r)}(e,n),e.partial=(...n)=>function(e,n,t){const o=n._zod.def.checks;if(o&&o.length>0)throw new Error(".partial() cannot be used on object schemas containing refinements");const r=D(n._zod.def,{get shape(){const o=n._zod.def.shape,r={...o};if(t)for(const n in t){if(!(n in o))throw new Error(`Unrecognized key: "${n}"`);t[n]&&(r[n]=e?new e({type:"optional",innerType:o[n]}):o[n])}else for(const n in o)r[n]=e?new e({type:"optional",innerType:o[n]}):o[n];return F(this,"shape",r),r},checks:[]});return K(n,r)}(Fr,e,n[0]),e.required=(...n)=>function(e,n,t){const o=D(n._zod.def,{get shape(){const o=n._zod.def.shape,r={...o};if(t)for(const n in t){if(!(n in r))throw new Error(`Unrecognized key: "${n}"`);t[n]&&(r[n]=new e({type:"nonoptional",innerType:o[n]}))}else for(const n in o)r[n]=new e({type:"nonoptional",innerType:o[n]});return F(this,"shape",r),r}});return K(n,o)}(qr,e,n[0])}));function Ar(e,n){const t={type:"object",shape:e??{},...J(n)};return new zr(t)}const Cr=R("ZodUnion",((e,n)=>{Yn.init(e,n),Yo.init(e,n),e._zod.processJSONSchema=(n,t,o)=>((e,n,t,o)=>{const r=e._zod.def,a=!1===r.inclusive,i=r.options.map(((e,t)=>Oo(e,n,{...o,path:[...o.path,a?"oneOf":"anyOf",t]})));a?t.oneOf=i:t.anyOf=i})(e,n,t,o),e.options=n.options}));const jr=R("ZodIntersection",((e,n)=>{Xn.init(e,n),Yo.init(e,n),e._zod.processJSONSchema=(n,t,o)=>((e,n,t,o)=>{const r=e._zod.def,a=Oo(r.left,n,{...o,path:[...o.path,"allOf",0]}),i=Oo(r.right,n,{...o,path:[...o.path,"allOf",1]}),s=e=>"allOf"in e&&1===Object.keys(e).length,c=[...s(a)?a.allOf:[a],...s(i)?i.allOf:[i]];t.allOf=c})(e,n,t,o)}));const Pr=R("ZodEnum",((e,n)=>{nt.init(e,n),Yo.init(e,n),e._zod.processJSONSchema=(n,t,o)=>((e,n,t)=>{const o=N(e._zod.def.entries);o.every((e=>"number"==typeof e))&&(t.type="number"),o.every((e=>"string"==typeof e))&&(t.type="string"),t.enum=o})(e,0,t),e.enum=n.entries,e.options=Object.values(n.entries);const t=new Set(Object.keys(n.entries));e.extract=(e,o)=>{const r={};for(const a of e){if(!t.has(a))throw new Error(`Key ${a} not found in enum`);r[a]=n.entries[a]}return new Pr({...n,checks:[],...J(o),entries:r})},e.exclude=(e,o)=>{const r={...n.entries};for(const n of e){if(!t.has(n))throw new Error(`Key ${n} not found in enum`);delete r[n]}return new Pr({...n,checks:[],...J(o),entries:r})}}));const $r=R("ZodTransform",((e,n)=>{tt.init(e,n),Yo.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 O(e.constructor.name);t.addIssue=o=>{if("string"==typeof o)t.issues.push(ne(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(ne(n))}};const r=n.transform(t.value,t);return r instanceof Promise?r.then((e=>(t.value=e,t))):(t.value=r,t)}}));const Fr=R("ZodOptional",((e,n)=>{rt.init(e,n),Yo.init(e,n),e._zod.processJSONSchema=(n,t,o)=>Co(e,n,0,o),e.unwrap=()=>e._zod.def.innerType}));function Dr(e){return new Fr({type:"optional",innerType:e})}const Lr=R("ZodExactOptional",((e,n)=>{at.init(e,n),Yo.init(e,n),e._zod.processJSONSchema=(n,t,o)=>Co(e,n,0,o),e.unwrap=()=>e._zod.def.innerType}));const Mr=R("ZodNullable",((e,n)=>{it.init(e,n),Yo.init(e,n),e._zod.processJSONSchema=(n,t,o)=>((e,n,t,o)=>{const r=e._zod.def,a=Oo(r.innerType,n,o),i=n.seen.get(e);"openapi-3.0"===n.target?(i.ref=r.innerType,t.nullable=!0):t.anyOf=[a,{type:"null"}]})(e,n,t,o),e.unwrap=()=>e._zod.def.innerType}));function Ur(e){return new Mr({type:"nullable",innerType:e})}const Br=R("ZodDefault",((e,n)=>{st.init(e,n),Yo.init(e,n),e._zod.processJSONSchema=(n,t,o)=>((e,n,t,o)=>{const r=e._zod.def;Oo(r.innerType,n,o),n.seen.get(e).ref=r.innerType,t.default=JSON.parse(JSON.stringify(r.defaultValue))})(e,n,t,o),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap}));const Wr=R("ZodPrefault",((e,n)=>{dt.init(e,n),Yo.init(e,n),e._zod.processJSONSchema=(n,t,o)=>((e,n,t,o)=>{const r=e._zod.def;Oo(r.innerType,n,o),n.seen.get(e).ref=r.innerType,"input"===n.io&&(t._prefault=JSON.parse(JSON.stringify(r.defaultValue)))})(e,n,t,o),e.unwrap=()=>e._zod.def.innerType}));const qr=R("ZodNonOptional",((e,n)=>{lt.init(e,n),Yo.init(e,n),e._zod.processJSONSchema=(n,t,o)=>((e,n,t,o)=>{const r=e._zod.def;Oo(r.innerType,n,o),n.seen.get(e).ref=r.innerType})(e,n,0,o),e.unwrap=()=>e._zod.def.innerType}));const Zr=R("ZodCatch",((e,n)=>{pt.init(e,n),Yo.init(e,n),e._zod.processJSONSchema=(n,t,o)=>((e,n,t,o)=>{const r=e._zod.def;let a;Oo(r.innerType,n,o),n.seen.get(e).ref=r.innerType;try{a=r.catchValue(void 0)}catch{throw new Error("Dynamic catch values are not supported in JSON Schema")}t.default=a})(e,n,t,o),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap}));const Vr=R("ZodPipe",((e,n)=>{ft.init(e,n),Yo.init(e,n),e._zod.processJSONSchema=(n,t,o)=>((e,n,t,o)=>{const r=e._zod.def,a="input"===n.io?"transform"===r.in._zod.def.type?r.out:r.in:r.out;Oo(a,n,o),n.seen.get(e).ref=a})(e,n,0,o),e.in=n.in,e.out=n.out}));function Kr(e,n){return new Vr({type:"pipe",in:e,out:n})}const Jr=R("ZodReadonly",((e,n)=>{mt.init(e,n),Yo.init(e,n),e._zod.processJSONSchema=(n,t,o)=>((e,n,t,o)=>{const r=e._zod.def;Oo(r.innerType,n,o),n.seen.get(e).ref=r.innerType,t.readOnly=!0})(e,n,t,o),e.unwrap=()=>e._zod.def.innerType}));const Gr=R("ZodCustom",((e,n)=>{vt.init(e,n),Yo.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 Hr;Ar({success:Rr(),accessToken:er().optional(),alias:er().optional(),user:Ar({id:er(),email:er(),role:er(),validated:Rr(),active:Rr()}).optional(),person:Ar({id:er(),name:er(),birth_date:er()}).optional(),confidence_score:Gt(xr,Hr).optional(),recognition_id:er().optional(),task_id:er().optional(),status:er().optional(),message:er().optional()}),Ar({success:Rr(),message:er(),person_id:er().optional(),user_id:er().optional(),person_validated:Rr().optional(),face_processing:Xt(Tr).optional(),onboarding_link:er().optional(),task_id:er().optional(),status:er().optional()});const Yr={},Xr={development:"http://localhost:8000",sandbox:"https://sandbox-core.neofaceid.com",production:"https://core.neofaceid.com.br"};let Qr={baseUrl:Xr.sandbox,applicationToken:null,environment:"sandbox",initialized:!1};function ea(){return Qr.initialized,Qr.baseUrl}const na=()=>ea(),ta=()=>{const e="localhost"===window.location.hostname||"127.0.0.1"===window.location.hostname||""===window.location.hostname;if(!window.isSecureContext&&!e)throw new E("Secure context (HTTPS) is required for this operation",k.NETWORK)},oa=()=>{const e=new AbortController,n=setTimeout((()=>e.abort()),1e4);return e.signal.addEventListener("abort",(()=>clearTimeout(n))),e},ra=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 r=e.getContext("2d");r?(r.drawImage(o,0,0),e.toBlob((e=>{e?n(e):t(new Error("Failed to compress image"))}),"image/jpeg",.7)):t(new Error("Failed to get canvas context"))},o.onerror=()=>{t(new Error("Failed to load image"))},o.src=URL.createObjectURL(e)})),aa=async e=>new Promise(((n,t)=>{const o=new Image;o.onload=()=>{const e=1280;let r=o.width,a=o.height;r>a&&r>e?(a=a*e/r,r=e):a>e&&(r=r*e/a,a=e);const i=document.createElement("canvas");i.width=r,i.height=a;const s=i.getContext("2d");s?(s.drawImage(o,0,0,r,a),i.toBlob((e=>{e?n(e):t(new Error("Failed to compress document image"))}),"image/jpeg",.75)):t(new Error("Failed to get canvas context"))},o.onerror=()=>{t(new Error("Failed to load document image"))},o.src=URL.createObjectURL(e)})),ia=async e=>{ta();const n=oa();try{const t=await fetch(`${na()}/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 E(`API Error ${t.status}`,k.INVALID_TOKEN);return t.ok}catch(t){if(t instanceof Error){if("AbortError"===t.name)throw new E("Request timeout",k.NETWORK_ERROR);throw new E(t.message,k.NETWORK_ERROR)}throw new E("Unknown error",k.NETWORK_ERROR)}},sa=async(e,n)=>{ta();const t=oa();try{const o=await fetch(`${na()}/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 E("Token de aplicação inválido ou expirado",k.INVALID_TOKEN);if(404===o.status)throw new E("Link de onboarding não encontrado",k.NOT_FOUND);throw new E(`Falha ao obter detalhes (${o.status})`,k.NETWORK)}return await o.json()}catch(o){if(o instanceof Error){if("AbortError"===o.name)throw new E("Tempo de requisição excedido",k.NETWORK);if(o instanceof E)throw o;throw new E(o.message,k.NETWORK)}throw new E("Erro desconhecido",k.NETWORK_ERROR)}},ca=async(e,n)=>{ta();const t=oa();try{const o=await fetch(`${na()}/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 E("Token de aplicação inválido ou expirado",k.INVALID_TOKEN);if(404===o.status)return!1;throw new E(`Falha ao validar token (${o.status})`,k.NETWORK)}const r=await o.json();return!0===(null==r?void 0:r.is_valid)}catch(o){if(o instanceof Error){if("AbortError"===o.name)throw new E("Tempo de requisição excedido",k.NETWORK);if(o instanceof E)throw o;throw new E(o.message,k.NETWORK)}throw new E("Erro desconhecido",k.NETWORK_ERROR)}},da=async(e,n,t,o)=>{ta();const r=oa(),a=await ra(t),i=await ra(o);try{const t=await new Promise(((e,n)=>{const t=new FileReader;t.onload=()=>e(t.result),t.onerror=n,t.readAsDataURL(a)})),o=await new Promise(((e,n)=>{const t=new FileReader;t.onload=()=>e(t.result),t.onerror=n,t.readAsDataURL(i)})),s=await fetch(`${na()}/api/v1/onboardings/${encodeURIComponent(n)}/complete`,{method:"POST",headers:{"Content-Type":"application/json","X-App-Token":e},body:JSON.stringify({face_image:t,document_image:o}),signal:r.signal}),c=await s.json();if(!s.ok){if(401===s.status||403===s.status)throw new E("Token de aplicação inválido ou expirado",k.INVALID_TOKEN);if(404===s.status)throw new E("Link de onboarding não encontrado",k.NOT_FOUND);throw new E((null==c?void 0:c.error)||(null==c?void 0:c.message)||"Falha ao concluir onboarding",k.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 E("Tempo de requisição excedido",k.NETWORK);if(s instanceof E)throw s;throw new E(s.message,k.NETWORK)}throw new E("Erro desconhecido",k.NETWORK_ERROR)}},la=async(e,n,t,o,r)=>{if(ta(),!o||0===o.length)throw new E("Pelo menos uma imagem da pessoa é obrigatória",k.VALIDATION_ERROR);const a=oa();try{const i=await Promise.all(o.map((async e=>{const n=await ra(e);return new Promise(((e,t)=>{const o=new FileReader;o.onload=()=>e(o.result),o.onerror=t,o.readAsDataURL(n)}))}))),s=await ra(r),c={person_images:i,document_image:await new Promise(((e,n)=>{const t=new FileReader;t.onload=()=>e(t.result),t.onerror=n,t.readAsDataURL(s)})),name:t.name,birth_date:t.birth_date,cpf:t.cpf,cnpj:t.cnpj,email:t.email},d=await fetch(`${na()}/api/v1/onboardings/${encodeURIComponent(n)}/complete`,{method:"POST",headers:{"Content-Type":"application/json","X-App-Token":e},body:JSON.stringify(c),signal:a.signal}),l=await d.json();if(!d.ok){if(401===d.status||403===d.status)throw new E("Token de aplicação inválido ou expirado",k.INVALID_TOKEN);if(404===d.status)throw new E("Link de onboarding não encontrado",k.NOT_FOUND);throw new E((null==l?void 0:l.error)||(null==l?void 0:l.message)||"Falha ao concluir onboarding",k.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 E("Tempo de requisição excedido",k.NETWORK);if(i instanceof E)throw i;throw new E(i.message,k.NETWORK)}throw new E("Erro desconhecido",k.NETWORK_ERROR)}},ua=async(e,n)=>{ta();const t=oa(),o=await ra(e);try{const e=await new Promise(((e,n)=>{const t=new FileReader;t.onload=()=>{const n=t.result;e(n.split(",")[1])},t.onerror=n,t.readAsDataURL(o)})),r=await fetch(`${na()}/api/v1/external/recognition/face/`,{method:"POST",headers:{"Content-Type":"application/json","X-App-Token":n},body:JSON.stringify({face_frames:e}),signal:t.signal});if(!r.ok){if(401===r.status||403===r.status)throw new E("Invalid or expired application token",k.INVALID_TOKEN);throw new E(`Server returned status ${r.status}`,k.NETWORK)}const a=await r.json();if(!a.success)throw new E(a.message||"Recognition failed",k.RECOGNITION_FAILED);return{accessToken:a.accessToken,payload:a.payload}}catch(r){if(r instanceof Error){if("AbortError"===r.name)throw new E("Request timed out",k.NETWORK);if(r instanceof E)throw r;throw new E(r.message,k.NETWORK)}throw new E("Unknown error occurred",k.NETWORK_ERROR)}},pa=async(e,n)=>{var t,o,r,a,i;ta();const s=oa(),c=await ra(e);try{const e=await c.arrayBuffer(),d=btoa(new Uint8Array(e).reduce(((e,n)=>e+String.fromCharCode(n)),"")),l=await fetch(`${na()}/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 E("Invalid application token",k.INVALID_TOKEN);if(l.status>=500)throw new E(`Server Error ${l.status}`,k.API_ERROR);throw new E(`API Error ${l.status}`,k.API_ERROR)}const u=await l.json();if(!u.success)throw new E(u.message||"Login failed",k.LOGIN_FAILED);return{success:!0,accessToken:u.accessToken||u.access_token||"",alias:u.alias,user:{id:(null==(t=u.user)?void 0:t.id)||"",email:(null==(o=u.user)?void 0:o.email)||"",role:(null==(r=u.user)?void 0:r.role)||"",validated:(null==(a=u.user)?void 0:a.validated)||!1,active:(null==(i=u.user)?void 0:i.active)||!1},person:u.person?{id:u.person.id||"",name:u.person.name||"",birth_date:u.person.birth_date||""}:void 0,confidence_score:u.confidence_score,recognition_id:u.recognition_id}}catch(d){if(d instanceof Error){if("AbortError"===d.name)throw new E("Request timed out",k.NETWORK);if(d instanceof E)throw d;throw new E(d.message,k.NETWORK)}throw new E("Unknown error occurred",k.NETWORK_ERROR)}},fa=async(e,n,t=!0,o=.8)=>{ta();const r=oa(),a=await ra(e);try{const e=await new Promise(((e,n)=>{const t=new FileReader;t.onload=()=>{const n=t.result;e(n.split(",")[1])},t.onerror=n,t.readAsDataURL(a)})),i=await fetch(`${na()}/api/v1/external/recognition/biometric/`,{method:"POST",headers:{"Content-Type":"application/json","X-App-Token":n},body:JSON.stringify({face_frames:e,liveness_check:t,confidence_threshold:o}),signal:r.signal});if(!i.ok){if(401===i.status||403===i.status)throw new E("Invalid or expired application token",k.INVALID_TOKEN);throw new E(`Server returned status ${i.status}`,k.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 E("Request timed out",k.NETWORK);if(i instanceof E)throw i;throw new E(i.message,k.NETWORK)}throw new E("Unknown error occurred",k.NETWORK_ERROR)}},ha=async(e,n,t,o="LOGIN")=>{ta();const r=oa();try{const a=await fetch(`${na()}/api/v1/external/recognition/simple/`,{method:"POST",headers:{"Content-Type":"application/json","X-App-Token":t},body:JSON.stringify({document_type:e,document_number:n,purpose:o}),signal:r.signal});if(!a.ok){if(401===a.status||403===a.status)throw new E("Invalid or expired application token",k.INVALID_TOKEN);throw new E(`Server returned status ${a.status}`,k.NETWORK)}const i=await a.json();if(!i.success)throw new E(i.message||"Identification failed",k.RECOGNITION_FAILED);return{success:i.success,personId:i.person_id,accessToken:i.access_token,payload:i.payload}}catch(a){if(a instanceof Error){if("AbortError"===a.name)throw new E("Request timed out",k.NETWORK);if(a instanceof E)throw a;throw new E(a.message,k.NETWORK)}throw new E("Unknown error occurred",k.NETWORK_ERROR)}},ma=async(e,n,t,o=.8,r,a)=>{var i;ta();const s=oa(),c=await ra(e),d=await new Promise(((e,n)=>{const t=new FileReader;t.onload=()=>{const n=t.result;e(n.split(",")[1])},t.onerror=n,t.readAsDataURL(c)}));try{const e={biometric_data:d,type_of_identification:"FACE",purpose:t,confidence_threshold:o};r&&(e.signature=r);const c=await fetch(`${na()}/api/v1/external/recognition/purpose/`,{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 E("Invalid or expired application token",k.INVALID_TOKEN);throw new E(`Server returned status ${c.status}`,k.NETWORK)}const l=await c.json();return{success:l.success,personName:l.person_name||(null==(i=l.person)?void 0:i.name),email:l.email||(null==a?void 0:a.email),cpf:l.cpf||(null==a?void 0:a.cpf),confidenceScore:l.confidence_score,accessToken:l.access_token,payload:l.payload,signature:r,sessionId:null==a?void 0:a.sessionId}}catch(l){if(l instanceof Error){if("AbortError"===l.name)throw new E("Request timed out",k.NETWORK);if(l instanceof E)throw l;throw new E(l.message,k.NETWORK)}throw new E("Unknown error occurred",k.NETWORK_ERROR)}},ga=async(e,n,t)=>{ta();const o=oa();try{let r,a;if(null==t?void 0:t.documentFront){const e=await aa(t.documentFront);r=await new Promise(((n,t)=>{const o=new FileReader;o.onload=()=>n(o.result),o.onerror=t,o.readAsDataURL(e)}))}if(null==t?void 0:t.documentBack){const e=await aa(t.documentBack);a=await new Promise(((n,t)=>{const o=new FileReader;o.onload=()=>n(o.result),o.onerror=t,o.readAsDataURL(e)}))}const i={name:e.name,birth_date:e.birth_date,cpf:e.cpf,email:e.email,password:e.password,password_confirm:e.password,is_pep:e.is_pep??!1};r&&(i.document_images=[{front:r,back:a||void 0,type:(null==t?void 0:t.documentType)||"RG"}]);const s=await fetch(`${na()}/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 E("Invalid or expired application token",k.INVALID_TOKEN);throw new E(`Server returned status ${s.status}`,k.NETWORK)}return await s.json()}catch(r){if(r instanceof Error){if("AbortError"===r.name)throw new E("Request timed out",k.NETWORK);if(r instanceof E)throw r;throw new E(r.message,k.NETWORK)}throw new E("Unknown error occurred",k.NETWORK)}},va=async e=>{const n=oa(),t=new URLSearchParams;e.email&&t.append("email",e.email),e.cpf&&t.append("cpf",e.cpf);try{const e=await fetch(`${na()}/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 E(n.message||`Server returned status ${e.status}`,k.NETWORK)}return await e.json()}catch(o){if(o instanceof Error){if("AbortError"===o.name)throw new E("Request timed out",k.NETWORK);if(o instanceof E)throw o;throw new E(o.message,k.NETWORK)}throw new E("Unknown error occurred",k.NETWORK)}},ba=async(e,n,t,o)=>{var r,a,i,s,c,d,l,u;if(ta(),!n||0===n.length)throw new E("At least one face photo is required for biometric registration",k.VALIDATION_ERROR);if(n.length>5)throw new E("Maximum of 5 face photos allowed",k.VALIDATION_ERROR);const p=oa();try{const h=await Promise.all(n.map((async e=>{const n=await ra(e);return new Promise(((e,t)=>{const o=new FileReader;o.onload=()=>{const n=o.result;e(n)},o.onerror=t,o.readAsDataURL(n)}))})));let m,g;if(null==o?void 0:o.documentFront){const e=await aa(o.documentFront);m=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 aa(o.documentBack);g=await new Promise(((n,t)=>{const o=new FileReader;o.onload=()=>n(o.result),o.onerror=t,o.readAsDataURL(e)}))}const v={name:e.name,birth_date:e.birth_date,cpf:e.cpf,email:e.email,password:e.password,password_confirm:e.password,face_photos:h,is_pep:e.is_pep??!1};m&&(v.document_images=[{front:m,back:g||void 0,type:(null==o?void 0:o.documentType)||"RG"}]);const b=await fetch(`${na()}/api/v1/signup/donor/`,{method:"POST",headers:{"Content-Type":"application/json","X-App-Token":t},body:JSON.stringify(v),signal:p.signal});if(!b.ok){if(401===b.status||403===b.status)throw new E("Invalid or expired application token",k.INVALID_TOKEN);try{const e=await b.json();if(e.errors){const n=Object.entries(e.errors).map((([e,n])=>`${"password"===e?"senha":"password_confirm"===e?"confirmação de senha":e}: ${Array.isArray(n)?n.join(", "):String(n)}`)).join("; ");throw new E(`Erro de validação: ${n}`,k.VALIDATION_ERROR)}if("fraud_detected"===e.error)throw new E("Fraud detected in biometric images. Registration blocked.",k.VALIDATION_ERROR);if("user_exists"===e.error||"ALREADY_EXISTS"===e.error_code)throw new E("User with this email already exists",k.VALIDATION_ERROR);if("person_exists"===e.error)throw new E("Person with this CPF already exists",k.VALIDATION_ERROR);const n=e.message||e.error||`Server returned status ${b.status}`;throw new E(n,k.VALIDATION_ERROR)}catch(f){if(f instanceof E)throw f;throw new E(`Server returned status ${b.status}`,k.NETWORK)}}const y=await b.json();return 202===b.status&&(null==(r=y.data)?void 0:r.task_id)?{success:y.success,message:y.message||"Registration is being processed. You will receive an email when completed.",task_id:y.data.task_id,status:y.data.status||"processing",person_id:void 0,user_id:void 0,person_validated:void 0,face_processing:void 0,onboarding_link:void 0}:{success:y.success,message:y.message,person_id:(null==(a=y.data)?void 0:a.person_id)||y.person_id,user_id:(null==(i=y.data)?void 0:i.user_id)||y.user_id,person_validated:(null==(s=y.data)?void 0:s.person_validated)||y.person_validated,face_processing:(null==(c=y.data)?void 0:c.face_processing)||y.face_processing,onboarding_link:(null==(d=y.data)?void 0:d.onboarding_link)||y.onboarding_link,task_id:null==(l=y.data)?void 0:l.task_id,status:null==(u=y.data)?void 0:u.status}}catch(h){if(h instanceof Error){if("AbortError"===h.name)throw new E("Request timed out",k.NETWORK);if(h instanceof E)throw h;throw new E(h.message,k.NETWORK)}throw new E("Unknown error occurred",k.NETWORK_ERROR)}},ya=async(e,n,t)=>{const o=oa();try{const r=await fetch(`${na()}/api/v1/auth/login/`,{method:"POST",headers:{"Content-Type":"application/json","X-App-Token":t},body:JSON.stringify({email:e,password:n}),signal:o.signal});if(!r.ok){if(401===r.status||403===r.status)throw new E("Email ou senha inválidos",k.INVALID_TOKEN);throw new E(`API Error ${r.status}`,k.API_ERROR)}const a=await r.json();return{success:!0,accessToken:a.access_token||a.access,alias:a.user&&a.user.alias||a.alias,user:{id:a.user&&a.user.id||"",email:a.user&&a.user.email||"",role:a.user&&a.user.role||"",validated:a.user&&a.user.validated||!1,active:a.user&&a.user.active||!1}}}catch(r){if(r instanceof Error){if("AbortError"===r.name)throw new E("Request timed out",k.NETWORK);if(r instanceof E)throw r;throw new E(r.message,k.NETWORK)}throw new E("Unknown error occurred",k.NETWORK_ERROR)}},wa=async(e,n)=>{var t,o,r,a;ta();const i=oa(),s=await aa(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(`${na()}/api/v1/auth/recognition/face/external/`,{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 E("Invalid or expired application token",k.INVALID_TOKEN);throw new E(`Server returned status ${e.status}`,k.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 E(s.message||"Person identification failed",k.RECOGNITION_FAILED);return{success:!0,person:{name:(null==(r=s.person)?void 0:r.name)||"",birth_date:(null==(a=s.person)?void 0:a.birth_date)||""}}}catch(d){if(d instanceof Error){if("AbortError"===d.name)throw new E("Request timed out",k.NETWORK);if(d instanceof E)throw d;throw new E(d.message,k.NETWORK)}throw new E("Unknown error occurred",k.NETWORK_ERROR)}},xa=async(e,n,t)=>{if(ta(),!e)throw new E("Person ID is required",k.VALIDATION_ERROR);if(!n)throw new E("Face image is required",k.VALIDATION_ERROR);const o=oa(),r=await ra(n),a=await new Promise(((e,n)=>{const t=new FileReader;t.onload=()=>{const n=t.result;e(n.split(",")[1])},t.onerror=n,t.readAsDataURL(r)}));try{const n=await fetch(`${na()}/api/v1/identity-data/`,{method:"POST",headers:{"Content-Type":"application/json","X-App-Token":t},body:JSON.stringify({person:e,type_of_identification:"FACE",biometric_data:a}),signal:o.signal});if(!n.ok){if(401===n.status||403===n.status)throw new E("Invalid or expired application token, or insufficient permissions",k.INVALID_TOKEN);if(400===n.status)try{const e=await n.json(),t=e.message||e.error||"Invalid biometric data";throw new E(t,k.VALIDATION_ERROR)}catch(i){if(i instanceof E)throw i;throw new E("Invalid biometric data",k.VALIDATION_ERROR)}throw new E(`Server returned status ${n.status}`,k.NETWORK)}const r=await n.json();return{success:!0,message:"Biometric data registered successfully",identity_data_id:r.id,type_of_identification:r.type_of_identification,have_biometric_data:r.have_biometric_data,created_at:r.created_at}}catch(s){if(s instanceof Error){if("AbortError"===s.name)throw new E("Request timed out",k.NETWORK);if(s instanceof E)throw s;throw new E(s.message,k.NETWORK)}throw new E("Unknown error occurred",k.NETWORK_ERROR)}},_a=async(e,n,t)=>{ta();const o=oa();try{const a=await fetch(`${na()}/api/v1/applications/`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${e}`},body:JSON.stringify({consumer:n,application_name:t.applicationName,domain:t.domain,accept_only_email_with_same_domain:t.acceptOnlyEmailWithSameDomain}),signal:o.signal});if(!a.ok){if(401===a.status)throw new E("Invalid or expired JWT token",k.INVALID_TOKEN);if(403===a.status)throw new E("Insufficient permissions to create application",k.INVALID_TOKEN);if(400===a.status)try{const e=await a.json(),n=e.message||e.error||"Invalid application data";throw new E(n,k.VALIDATION_ERROR)}catch(r){if(r instanceof E)throw r;throw new E("Invalid application data",k.VALIDATION_ERROR)}throw new E(`Server returned status ${a.status}`,k.NETWORK)}const i=await a.json();return{success:!0,application:{id:i.id,application_name:i.application_name,domain:i.domain,accept_only_email_with_same_domain:i.accept_only_email_with_same_domain,app_token:i.app_token,is_active:i.is_active,created_at:i.created_at},message:"Application registered successfully"}}catch(a){if(a instanceof Error){if("AbortError"===a.name)throw new E("Request timed out",k.NETWORK);if(a instanceof E)throw a;throw new E(a.message,k.NETWORK)}throw new E("Unknown error occurred",k.NETWORK_ERROR)}},ka=async(e={})=>{ta();const{durationMs:n=3e3,onProgress:t}=e;return new Promise((async(e,o)=>{let r=null;const a=[];try{r=await navigator.mediaDevices.getUserMedia({video:{facingMode:"user",width:{ideal:640},height:{ideal:480}},audio:!1});const i=(()=>{const e=["video/mp4;codecs=avc1","video/mp4","video/webm;codecs=vp9","video/webm;codecs=vp8","video/webm"];for(const n of e)if(MediaRecorder.isTypeSupported(n))return n;return""})();let s;try{s=i?new MediaRecorder(r,{mimeType:i,videoBitsPerSecond:1e6}):new MediaRecorder(r,{videoBitsPerSecond:1e6})}catch{s=new MediaRecorder(r)}const c=s.mimeType||i;if(s.ondataavailable=e=>{e.data.size>0&&a.push(e.data)},s.onstop=()=>{r&&r.getTracks().forEach((e=>e.stop()));const n=new Blob(a,{type:c});e(n)},s.onerror=e=>{r&&r.getTracks().forEach((e=>e.stop())),o(new E(`Recording error: ${e}`,k.CAPTURE_ERROR))},s.start(100),t){const e=100;let o=0;const r=setInterval((()=>{o+=e;const a=Math.min(100,o/n*100);t(a),o>=n&&clearInterval(r)}),e)}setTimeout((()=>{s&&"recording"===s.state&&s.stop()}),n)}catch(i){r&&r.getTracks().forEach((e=>e.stop())),i instanceof Error?"NotAllowedError"===i.name?o(new E("Camera permission denied",k.CAMERA_ERROR)):"NotFoundError"===i.name?o(new E("No camera found",k.NO_CAMERA)):o(new E(i.message,k.CAPTURE_ERROR)):o(new E("Failed to record video",k.CAPTURE_ERROR))}}))},Ea=async(e,n,t={})=>{var o,r,a,i,s,c;const{maxAttempts:d=60,intervalMs:l=1e3,onStatusChange:u}=t;let p=0;for(;p<d;){p++;try{const t=await fetch(`${na()}/api/v1/tasks/status/?task_id=${e}`,{method:"GET",headers:{Accept:"application/json","X-App-Token":n}});if(!t.ok)throw new E(`Task status check failed: ${t.status}`,k.NETWORK);const d=await t.json(),p=(null==(o=d.data)?void 0:o.status)||"unknown";if(u){u(p,null==(a=null==(r=d.data)?void 0:r.progress)?void 0:a.percentage)}if("success"===p)return d.data.result;if("failure"===p){const e=(null==(s=null==(i=d.data)?void 0:i.result)?void 0:s.message)||(null==(c=d.data)?void 0:c.error)||"Task failed";throw new E(e,k.RECOGNITION_FAILED)}if("revoked"===p)throw new E("Task was cancelled",k.RECOGNITION_FAILED);await new Promise((e=>setTimeout(e,l)))}catch(f){if(f instanceof E)throw f;throw new E(`Polling error: ${f instanceof Error?f.message:"Unknown error"}`,k.NETWORK)}}throw new E("Task status polling timed out",k.NETWORK)},Ra=async(e,n)=>{var t;ta();const o=oa();try{const r=await fetch(`${na()}/api/v1/auth/recognition/face/external/`,{method:"POST",headers:{"Content-Type":"application/json","X-App-Token":n},body:JSON.stringify({video:e,purpose:"PROOF_OF_LIFE"}),signal:o.signal});if(!r.ok){if(401===r.status||403===r.status)throw new E("Invalid or expired application token",k.INVALID_TOKEN);if(400===r.status){const e=await r.json();throw new E(e.message||"Invalid request data",k.VALIDATION_ERROR)}throw new E(`Server returned status ${r.status}`,k.NETWORK)}const a=await r.json();if(!a.success||!(null==(t=a.data)?void 0:t.task_id))throw new E(a.message||"Failed to start proof of life",k.RECOGNITION_FAILED);return{taskId:a.data.task_id,historyId:a.data.history_id,status:a.data.status,message:a.message||"Recognition started successfully"}}catch(r){if(r instanceof Error){if("AbortError"===r.name)throw new E("Request timed out",k.NETWORK);if(r instanceof E)throw r;throw new E(r.message,k.NETWORK)}throw new E("Unknown error occurred",k.NETWORK_ERROR)}},Ta=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 E("Failed to convert video to base64",k.CAPTURE_ERROR)),o.readAsDataURL(e)})),Oa=async(e,n,t)=>{var o,r;if(ta(),!e)throw new E("personId is required",k.VALIDATION_ERROR);if(!n)throw new E("jwtToken is required",k.VALIDATION_ERROR);if(!t||0===t.length)throw new E("At least one document image is required",k.VALIDATION_ERROR);const a=await Promise.all(t.map((async e=>{const n=await aa(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 E("Failed to convert image to base64",k.CAPTURE_ERROR)),o.readAsDataURL(t)}));var t}))),i=oa();try{const t=await fetch(`${na()}/api/v1/donors/${e}/documents/`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${n}`},body:JSON.stringify({document_images:a}),signal:i.signal}),s=await t.json();if(!t.ok)throw new E((null==s?void 0:s.message)||`API Error ${t.status}`,k.NETWORK_ERROR);return{success:!0,taskId:(null==(o=s.data)?void 0:o.task_id)??"",status:(null==(r=s.data)?void 0:r.status)??"processing",message:s.message??"Documents submitted for processing"}}catch(s){if(s instanceof E)throw s;if(s instanceof Error){if("AbortError"===s.name)throw new E("Request timeout",k.NETWORK_ERROR);throw new E(s.message,k.NETWORK_ERROR)}throw new E("Unknown error occurred",k.NETWORK_ERROR)}},Sa=async e=>{const n=oa();try{const t=await fetch(`${na()}/api/v1/tasks/status/?task_id=${e}`,{method:"GET",headers:{"Content-Type":"application/json"},signal:n.signal}),o=await t.json();if(!t.ok)throw new E((null==o?void 0:o.message)||`API Error ${t.status}`,k.NETWORK_ERROR);return{success:o.success,status:o.data.status,result:o.data.result,error:o.data.error}}catch(t){if(t instanceof E)throw t;throw new E("Failed to fetch task status",k.NETWORK_ERROR)}},Ia=async(e,n,t={})=>{var o,r;const{maxRetries:a=30,interval:i=2e3}=t,s=await wa(e,n);if(s.person)return{personFound:!0,person:s.person};const c=s.taskId;if(!c)return{personFound:!1};for(let d=0;d<a;d++){const e=await Sa(c);if("success"===e.status)return e.result&&e.result.success?{personFound:!0,person:{name:(null==(o=e.result.person)?void 0:o.name)||"Pessoa identificada",birth_date:(null==(r=e.result.person)?void 0:r.birth_date)||""}}:{personFound:!1};if("failure"===e.status)return{personFound:!1};await new Promise((e=>setTimeout(e,i)))}throw new E("Timed out waiting for identification",k.NETWORK_ERROR)};async function Na(e,n){const t=ea(),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 E(e.message||"Erro ao solicitar recuperação de senha",k.API_ERROR)}return o.json()}async function za(e,n){const t=ea(),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 E(e.error||e.message||"Erro ao redefinir senha",k.API_ERROR)}return o.json()}const Aa=Object.freeze(Object.defineProperty({__proto__:null,checkUserExistence:va,completeOnboarding:da,completeOnboardingWithData:la,confirmPasswordReset:za,getOnboardingDetails:sa,getTaskStatus:Sa,identifyPerson:wa,identifyPersonAsync:Ia,loginWithBiometric:pa,loginWithEmail:ya,pollTaskStatus:Ea,recognize:ua,recognizeBiometric:fa,recognizeByPurpose:ma,recordFaceVideo:ka,registerApplication:_a,registerBiometric:xa,registerDocumentByImage:Oa,registerPersonWithBiometric:ba,registerPersonWithoutFace:ga,requestPasswordReset:Na,simpleIdentification:ha,startProofOfLife:Ra,validateOnboardingToken:ca,validateToken:ia,videoToBase64:Ta},Symbol.toStringTag,{value:"Module"})),Ca=(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}},ja={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:"#007AFF",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 Pa({accessToken:e,onClose:t,onSuccess:o}){const r=n.useRef(null),a=n.useRef(null),i=n.useRef(null),s=n.useRef(null),d=n.useRef(null),[l,u]=n.useReducer(Ca,{status:"requestingPermission"}),[p,f]=n.useState(!1),[h,m]=n.useState(0),{startCamera:g,stopCamera:v}=_(),b=()=>{if(!r.current)return;const e=async()=>{if(r.current&&"ready"===l.status){try{const e=await c.detectAllFaces(r.current,new c.TinyFaceDetectorOptions),n=1===e.length,t=n&&(e=>{if(!r.current)return!1;const{box:n}=e,{videoWidth:t,videoHeight:o}=r.current,a=t/2,i=o/2,s=.4*t,c=.4*o;return n.x+n.width/2>a-s/2&&n.x+n.width/2<a+s/2&&n.y+n.height/2>i-c/2&&n.y+n.height/2<i+c/2})(e[0]);f(n&&t),n&&t&&0===h&&(d.current=window.setTimeout((()=>{"ready"===l.status&&(m((e=>e+1)),u({type:"START_CAPTURE"}))}),3e3))}catch(n){}s.current=window.setTimeout(e,100)}};e()};n.useEffect((()=>((async()=>{try{await Promise.all([c.nets.tinyFaceDetector.loadFromUri("/models"),c.nets.faceLandmark68Net.loadFromUri("/models")])}catch(e){}})(),()=>{s.current&&window.clearTimeout(s.current),d.current&&window.clearInterval(d.current)})),[]),n.useEffect((()=>((async()=>{try{const e=await g();i.current=e,r.current&&(r.current.srcObject=e),u({type:"PERMISSION_GRANTED"}),b()}catch(e){u({type:"PERMISSION_DENIED"})}})(),()=>{i.current&&v(i.current)})),[g,v]);const w=async()=>{if(a.current&&r.current)try{u({type:"START_CAPTURE"});const i=a.current.getContext("2d");if(!i)return void u({type:"SET_ERROR",message:"Failed to get canvas context"});a.current.width=r.current.videoWidth,a.current.height=r.current.videoHeight,i.drawImage(r.current,0,0,a.current.width,a.current.height);const s=await new Promise(((e,n)=>{var t;null==(t=a.current)||t.toBlob((t=>{t?e(t):n(new Error("Failed to convert canvas to blob"))}),"image/jpeg",.95)}));try{const n=await ua(s,e);o({success:!0,data:{faceId:n.payload.documentId,confidence:1}}),u({type:"UPLOAD_SUCCESS"}),setTimeout(t,1500)}catch(n){u({type:"SET_ERROR",message:"Face recognition failed"})}}catch(n){u({type:"SET_ERROR",message:"Failed to capture image"})}};return y.jsxs("div",{style:ja.overlay,children:[y.jsx("style",{children:"\n @keyframes spin {\n 0% { transform: translate(-50%, -50%) rotate(0deg); }\n 100% { transform: translate(-50%, -50%) rotate(360deg); }\n }\n"}),y.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"}),y.jsxs("div",{style:ja.modal,className:"modal",children:[y.jsx("button",{type:"button",style:ja.closeButton,onClick:t,children:"×"}),y.jsx("video",{ref:r,style:ja.video,autoPlay:!0,playsInline:!0,muted:!0}),y.jsx("canvas",{ref:a,style:ja.canvas}),y.jsx("div",{style:ja.guide}),"ready"===l.status&&!p&&y.jsx("div",{style:ja.message,children:"Centralize seu rosto no círculo"}),"capturing"===l.status&&y.jsx("div",{style:ja.message,children:"Por favor, pisque os olhos"}),"uploading"===l.status&&y.jsx("div",{style:ja.spinner}),"success"===l.status&&y.jsx("div",{style:ja.message,children:"Autenticado!"}),"error"===l.status&&y.jsx("div",{style:ja.message,children:l.message}),y.jsxs("div",{style:ja.controls,children:["ready"===l.status&&p&&y.jsx("button",{type:"button",style:ja.button,onClick:w,children:"Capturar"}),"capturing"===l.status&&y.jsx("button",{type:"button",style:ja.button,onClick:w,children:"Capturar"}),"error"===l.status&&y.jsx("button",{type:"button",style:ja.button,onClick:()=>{u({type:"RESET"}),m(0)},children:"Tentar Novamente"})]})]})]})}class $a{constructor(e){a(this,"applicationToken"),a(this,"modalElement",null),this.applicationToken=e}open(){this.modalElement||(this.addStyles(),this.modalElement=document.createElement("div"),this.modalElement.className="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="#7c3aed" stroke-width="3" fill="none"/>\n <rect x="22" y="28" width="20" height="16" rx="3" stroke="#7c3aed" stroke-width="2.5" fill="none"/>\n <path d="M26 28v-4a6 6 0 0 1 12 0v4" stroke="#7c3aed" stroke-width="2.5" stroke-linecap="round"/>\n <circle cx="32" cy="36" r="2" fill="#7c3aed"/>\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 <img src="/logo-icone-no-background.png" alt="NeoFaceId" class="neoface-forgot-brand-logo" onerror="this.style.display=\'none\'" />\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="#10b981" stroke-width="3" fill="none"/>\n <path d="M20 32 L28 40 L44 24" stroke="#10b981" 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 <img src="/logo-icone-no-background.png" alt="NeoFaceId" class="neoface-forgot-brand-logo" onerror="this.style.display=\'none\'" />\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,r;e.preventDefault();const a=null==(n=this.modalElement)?void 0:n.querySelector("#neoface-forgot-email"),i=null==(t=this.modalElement)?void 0:t.querySelector(".neoface-forgot-btn-primary"),s=null==(o=this.modalElement)?void 0:o.querySelector("#neoface-forgot-error"),c=null==(r=null==a?void 0:a.value)?void 0:r.trim();if(c){i.disabled=!0,i.textContent="Enviando...",s.style.display="none";try{await Na(c,this.applicationToken),this.renderSuccess()}catch(d){i.disabled=!1,i.textContent="Enviar link",s.style.display="block",s.textContent=d instanceof E?d.message:"Erro ao enviar email. Tente novamente."}}}addStyles(){const e="neoface-forgot-password-modal-styles";if(document.getElementById(e))return;const n=document.createElement("style");n.id=e,n.textContent="\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: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;\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, #1a1a2e 0%, #16213e 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: #7c3aed;\n box-shadow: 0 0 0 3px rgba(124, 58, 237, 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, #7c3aed 0%, #6d28d9 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(124, 58, 237, 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(124, 58, 237, 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 ",document.head.appendChild(n)}}const Fa=(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 La();default:return e}},Da={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..."},La=()=>{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}},Ma=8,Ua=10,Ba=26,Wa=8,qa=-8,Za=15,Va=-15,Ka=1500,Ja=150,Ga=.35,Ha=.65,Ya=.18,Xa=.22,Qa=2e4;function ei({personData:e,applicationToken:t,onClose:o,onSuccess:r,onPhotosCaptured:a,onError:i}){const s=n.useRef(null),d=n.useRef(null),l=n.useRef(null),u=n.useRef(null),p=n.useRef(null),f=n.useRef(!1),h=n.useRef("center"),m=n.useRef(null),g=n.useRef(null),v=n.useRef(!1),b=n.useRef(null),[w,x]=n.useReducer(Fa,void 0,La),[_,k]=n.useState(!1),[E,R]=n.useState("ok"),[T,O]=n.useState(!1);n.useEffect((()=>{if("liveness"===w.status){const e=w.step;h.current!==e&&(h.current=e,f.current||(u.current&&(u.current=null),p.current&&(clearInterval(p.current),p.current=null),x({type:"UPDATE_PROGRESS",progress:0}))),b.current={stepSequence:w.stepSequence,currentStepIndex:w.currentStepIndex,capturedPhotos:w.capturedPhotos},g.current&&clearTimeout(g.current),"complete"!==w.step&&(g.current=window.setTimeout((()=>{x({type:"ERROR",message:"Tempo limite atingido para o movimento. Por favor, tente novamente em um ambiente bem iluminado.",retryable:!0})}),Qa))}}),[w.status,"liveness"===w.status&&w.step,"liveness"===w.status&&w.currentStepIndex]);const S=e=>{if(f.current||"complete"===h.current)return;const n=Date.now();e?u.current||(u.current=n,p.current&&clearInterval(p.current),p.current=window.setInterval((()=>{if(!u.current)return;const e=Date.now()-u.current,n=Math.min(e/Ka*100,100);x({type:"UPDATE_PROGRESS",progress:n}),n>=100&&(clearInterval(p.current),p.current=null,I())}),50)):u.current&&(u.current=null,p.current&&(clearInterval(p.current),p.current=null),x({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([c.nets.tinyFaceDetector.loadFromUri(e),c.nets.faceLandmark68Net.loadFromUri(e)]),n])}catch(e){x({type:"ERROR",message:"Não foi possível carregar os modelos de IA. Verifique sua conexão e tente novamente.",retryable:!0})}})()}),[]),n.useEffect((()=>()=>{l.current&&(l.current.getTracks().forEach((e=>{e.stop()})),l.current=null),s.current&&(s.current.srcObject=null),m.current&&(clearTimeout(m.current),m.current=null),p.current&&(clearInterval(p.current),p.current=null),g.current&&(clearTimeout(g.current),g.current=null)}),[]),n.useEffect((()=>{let e=!0;return(async()=>{if("liveness"===w.status&&!l.current){v.current=!1,m.current&&(clearTimeout(m.current),m.current=null),m.current=window.setTimeout((()=>{e&&!1===v.current&&x({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(;!s.current&&e<50;)await new Promise((e=>setTimeout(e,100))),e++;return s.current},o=await t();if(!o)throw new Error("Elemento de vídeo não encontrado");o.srcObject=n,l.current=n,o.onloadedmetadata=()=>{o.play().then((()=>{e&&O(!0)}))}}catch(n){if(!e)return;m.current&&(clearTimeout(m.current),m.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.")),x({type:"ERROR",message:t,retryable:!0})}}})(),()=>{e=!1,m.current&&(clearTimeout(m.current),m.current=null),l.current&&(l.current.getTracks().forEach((e=>e.stop())),l.current=null),p.current&&(clearInterval(p.current),p.current=null),u.current=null}}),[w.status]),n.useEffect((()=>{if("liveness"!==w.status||!s.current)return;let e=!0,n=0;const t=async()=>{if(!e||"liveness"!==w.status)return;if(f.current||"complete"===h.current)return void requestAnimationFrame(t);const o=Date.now();if(o-n<Ja)requestAnimationFrame(t);else{n=o;try{const n=await c.detectSingleFace(s.current,new c.TinyFaceDetectorOptions({inputSize:224,scoreThreshold:.35})).withFaceLandmarks();if(!e)return;const o=!!n;if(k(o),o&&n.detection){const e=(e=>{if(!e||!s.current)return"not-detected";const{box:n}=e.detection,t=s.current.videoWidth||640,o=s.current.videoHeight||480,r=n.width/t;if(r<Ga)return"too-far";if(r>Ha)return"too-close";const a=n.x+n.width/2,i=n.y+n.height/2,c=Math.abs(a-t/2)/t,d=Math.abs(i-o/2)/o;return c>Ya||d>Xa?"not-centered":"ok"})(n);if("not-detected"!==e&&R(e),"ok"!==e)return S(!1),void requestAnimationFrame(t)}if(o&&n.landmarks){const e=(e=>{try{const n=e.positions||e._positions;if(!Array.isArray(n)||n.length<68)return null;const t=e=>{const t=n[e];return{x:void 0!==t._x?t._x:t.x,y:void 0!==t._y?t._y:t.y}},o=t(30),r=t(8),a=t(36),i=t(45),s=(a.x+i.x)/2,c=(o.x-s)/Math.abs(i.x-a.x)*90,d=(a.y+i.y)/2,l=o.y-d,u=-l/Math.abs(r.y-d)*90+Ba;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)<Ma&&Math.abs(n)<Ua;case"up":return e>Wa;case"down":return e<qa;case"left":return n>Za;case"right":return n<Va;default:return!1}})(e.pitch,e.yaw,h.current);S(n)}}else u.current&&(u.current=null,p.current&&(clearInterval(p.current),p.current=null),x({type:"UPDATE_PROGRESS",progress:0}))}catch(r){}e&&"liveness"===w.status&&requestAnimationFrame(t)}},o=()=>{e&&s.current&&(v.current=!0,m.current&&(clearTimeout(m.current),m.current=null),t())},r=s.current;if(r&&r.readyState>=2){const n=setTimeout(o,200);return()=>{e=!1,clearTimeout(n),p.current&&(clearInterval(p.current),p.current=null),u.current=null}}{const n=()=>{e&&o()};let t=0;const a=50,i=window.setInterval((()=>{t++,e?s.current&&s.current.readyState>=2?(clearInterval(i),s.current.removeEventListener("canplay",n),o()):t>=a&&clearInterval(i):clearInterval(i)}),300);return null==r||r.addEventListener("canplay",n,{once:!0}),()=>{e=!1,clearInterval(i),null==r||r.removeEventListener("canplay",n),p.current&&(clearInterval(p.current),p.current=null),u.current=null}}}),[w.status]);const I=async()=>{if(!s.current||!d.current||f.current)return;f.current=!0,u.current=null;const e=b.current;if(!e)return void(f.current=!1);const n=d.current,t=s.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(f.current=!1);const t=e.currentStepIndex+1,o=e.stepSequence[t];if("complete"===o){const t=[...e.capturedPhotos,n];x({type:"START_PROCESSING"}),N(t)}else setTimeout((()=>{f.current=!1,x({type:"NEXT_STEP",step:o,photo:n})}),100)}),"image/jpeg",.85)):f.current=!1},N=async n=>{var o;try{if(x({type:"START_PROCESSING"}),t&&n.length>0)try{const{identifyPersonAsync:e}=await Promise.resolve().then((()=>Aa)),r=new Promise((e=>setTimeout((()=>e(null)),5e3))),a=await Promise.race([e(n[0],t,{maxRetries:3,interval:1e3}),r]);if(a&&a.personFound)return void x({type:"DUPLICATE",personName:(null==(o=a.person)?void 0:o.name)||"Pessoa identificada"})}catch(s){}if(a)return x({type:"SUCCESS"}),void a(n);if(!e||!t)throw new Error("Dados de registro não fornecidos");const i=await ba(e,n,t),c={success:i.success,message:i.message,person_id:i.person_id,user_id:i.user_id,person_validated:i.person_validated,face_processing:i.face_processing,onboarding_link:i.onboarding_link};x({type:"SUCCESS"}),r&&r(c)}catch(c){const e=c instanceof Error?c.message:"Erro desconhecido";x({type:"ERROR",message:e}),i(e)}};return y.jsxs(y.Fragment,{children:[y.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, #1a1a2e 0%, #16213e 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: #7c3aed;\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, #7c3aed 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: #10b981;\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, #7c3aed 0%, #6d28d9 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(124, 58, 237, 0.3);\n }\n\n .primary-button:hover {\n transform: translateY(-2px);\n box-shadow: 0 8px 24px rgba(124, 58, 237, 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: 'SF Pro Display', -apple-system, system-ui, sans-serif;\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(124, 58, 237, 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, #7c3aed 0%, #10b981 100%);\n border-radius: 2px;\n transition: width 0.05s linear;\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(124, 58, 237, 0.2);\n border-top-color: #7c3aed;\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(124, 58, 237, 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: #10b981;\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(124, 58, 237, 0.1);\n color: #7c3aed;\n padding: 20px;\n border-radius: 50%;\n border: 2px solid rgba(124, 58, 237, 0.2);\n box-shadow: 0 0 30px rgba(124, 58, 237, 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: #10b981;\n border-radius: 50%;\n padding: 4px;\n border: 3px solid #16213e;\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 "}),y.jsx("div",{className:"modal-overlay",children:y.jsxs("div",{className:"modal-content",children:[y.jsx("button",{className:"close-button",onClick:o,children:"×"}),"liveness"===w.status&&(()=>{if("liveness"!==w.status)return null;const e=`${w.currentStepIndex+1}/${w.stepSequence.length-1}`,n=w.stepProgress;return y.jsxs("div",{className:"liveness-container",children:[y.jsx("div",{className:"progress-indicator",children:y.jsx("span",{className:"progress-text",children:e})}),_&&"ok"!==E&&y.jsxs("div",{className:"status-badge "+("not-centered"===E?"warning":"error"),children:["too-far"===E&&"Aproxime-se mais","too-close"===E&&"Afaste-se um pouco","not-centered"===E&&"Centralize seu rosto"]}),y.jsx("div",{className:"video-wrapper",children:y.jsx("div",{className:`video-circle ${_&&"ok"===E?"face-detected":""} ${n>0?"capturing":""}`,children:y.jsx("video",{ref:s,className:"video-feed "+(T?"ready":""),autoPlay:!0,muted:!0,playsInline:!0})})}),y.jsxs("div",{className:"instruction-box",children:[y.jsx("p",{className:"instruction-text",children:Da[w.step]}),n>0&&y.jsx("div",{className:"progress-bar",children:y.jsx("div",{className:"progress-fill",style:{width:`${n}%`}})})]}),y.jsxs("div",{className:"branding-small",children:[y.jsx("img",{src:"/logo-icone.png",alt:"NeoFaceId",className:"brand-logo-small"}),y.jsx("span",{children:"NeoFaceId by"}),y.jsx("span",{className:"brand-name",children:"OCTA"})]})]})})(),"camera-loading"===w.status&&y.jsxs("div",{className:"processing-container",children:[y.jsxs("div",{className:"spinner-wrapper",children:[y.jsx("div",{className:"spinner"}),y.jsx("div",{className:"spinner-ring"})]}),y.jsx("h3",{children:"Inicializando câmera"}),y.jsx("p",{children:"Aguarde enquanto preparamos a câmera..."}),y.jsxs("div",{className:"branding",style:{marginTop:"40px",paddingTop:"24px",borderTop:"1px solid rgba(255, 255, 255, 0.1)"},children:[y.jsx("span",{children:"NeoFaceId by"}),y.jsx("span",{className:"brand-name",children:"OCTA"})]})]}),"processing"===w.status&&y.jsxs("div",{className:"processing-container",children:[y.jsxs("div",{className:"spinner-wrapper",children:[y.jsx("div",{className:"spinner"}),y.jsx("div",{className:"spinner-ring"})]}),y.jsx("h3",{children:"Processando biometria"}),y.jsx("p",{children:"Analisando suas capturas faciais..."}),y.jsxs("div",{className:"branding",style:{marginTop:"40px",paddingTop:"24px",borderTop:"1px solid rgba(255, 255, 255, 0.1)"},children:[y.jsx("span",{children:"NeoFaceId by"}),y.jsx("span",{className:"brand-name",children:"OCTA"})]})]}),"error"===w.status&&("error"!==w.status?null:y.jsxs("div",{className:"result-container error",children:[y.jsx("div",{className:"result-icon error-icon",children:y.jsxs("svg",{width:"60",height:"60",viewBox:"0 0 60 60",fill:"none",children:[y.jsx("circle",{cx:"30",cy:"30",r:"28",stroke:"currentColor",strokeWidth:"3"}),y.jsx("path",{d:"M20 20 L40 40 M40 20 L20 40",stroke:"currentColor",strokeWidth:"3",strokeLinecap:"round"})]})}),y.jsx("h3",{children:"Não foi possível processar"}),y.jsx("p",{children:w.message}),y.jsxs("div",{className:"button-group",children:[w.retryable&&y.jsx("button",{className:"secondary-button",onClick:()=>x({type:"RESET"}),children:"Tentar Novamente"}),y.jsx("button",{className:"ghost-button",onClick:o,children:"Cancelar"})]})]})),"success"===w.status&&y.jsxs("div",{className:"result-container success",children:[y.jsx("div",{className:"result-icon success-icon",children:y.jsxs("svg",{width:"60",height:"60",viewBox:"0 0 60 60",fill:"none",children:[y.jsx("circle",{cx:"30",cy:"30",r:"28",stroke:"currentColor",strokeWidth:"3"}),y.jsx("path",{d:"M15 30 L25 40 L45 20",stroke:"currentColor",strokeWidth:"3",strokeLinecap:"round",strokeLinejoin:"round"})]})}),y.jsx("h3",{children:a?"Captura concluída!":"Verificação concluída!"}),y.jsx("p",{children:a?"Suas capturas faciais foram realizadas":"Sua biometria foi registrada com sucesso"}),y.jsx("button",{className:"primary-button",onClick:o,children:"Continuar"})]}),"duplicate"===w.status&&(()=>{if("duplicate"!==w.status)return null;const e=w.personName&&"Pessoa identificada"!==w.personName?`Olá, ${w.personName.split(" ")[0]}!`:"Olá!";return y.jsxs("div",{className:"result-container duplicate scale-in",children:[y.jsx("h3",{style:{marginTop:"0px"},children:e}),y.jsx("p",{style:{marginBottom:"32px",fontSize:"15px"},children:"Identificamos seu cadastro biométrico em nossa rede. Você já faz parte da NeoFaceId!"}),y.jsxs("div",{className:"button-group-vertical",children:[y.jsx("button",{className:"primary-button",onClick:()=>{o(),window.location.href="/"},children:"Ir para o Login"}),y.jsx("button",{className:"secondary-button",style:{marginTop:"12px"},onClick:()=>{o(),new $a(t??"").open()},children:"Esqueci minha senha"}),y.jsxs("div",{className:"support-section",children:[y.jsx("p",{children:"Não reconhece esta conta?"}),y.jsx("button",{className:"ghost-button",onClick:()=>window.open("https://support.neofaceid.com","_blank"),children:"Falar com Suporte"})]})]}),y.jsxs("div",{className:"branding",style:{marginTop:"32px",paddingTop:"20px",borderTop:"1px solid rgba(255, 255, 255, 0.08)",width:"100%"},children:[y.jsx("img",{src:"/logo-icone.png",alt:"NeoFaceId",className:"brand-logo",style:{height:"18px"}}),y.jsx("span",{children:"NeoFaceId by"}),y.jsx("span",{className:"brand-name",children:"OCTA"})]})]})})()]})}),y.jsx("canvas",{ref:d})]})}class ni{constructor(e){a(this,"modal",null),a(this,"video",null),a(this,"canvas",null),a(this,"stream",null),a(this,"options"),a(this,"countdownInterval",null),a(this,"isCapturing",!1),this.options=e}async open(){try{await this.createModal(),await this.initializeCamera(),this.startCountdown()}catch(e){this.options.onError(new E("Erro ao inicializar câmera: "+e.message,k.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-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">×</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 class="neofaceid-countdown">\n <span class="neofaceid-countdown-number">${this.options.countdown||3}</span>\n </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>\n </div>\n `,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)}}startCountdown(){if(!this.modal)return;const e=this.modal.querySelector(".neofaceid-countdown-number"),n=this.modal.querySelector(".neofaceid-capture-btn"),t=this.modal.querySelector(".neofaceid-status-text");let o=this.options.countdown||3;e&&(e.textContent=o.toString()),this.countdownInterval=window.setInterval((()=>{o--,e&&(e.textContent=o.toString()),o<=0&&(this.countdownInterval&&(clearInterval(this.countdownInterval),this.countdownInterval=null),e&&(e.style.display="none"),n&&(n.disabled=!1,n.textContent="Capturar Agora"),t&&(t.textContent="Pronto para capturar!"),"auto"===this.options.mode&&setTimeout((()=>this.captureImage()),500))}),1e3)}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}`;let 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 E("Erro ao capturar imagem: "+e.message,k.CAPTURE_ERROR))}finally{this.isCapturing=!1}}}async detectBiometricType(e){try{const{detectBiometricType:n}=await Promise.resolve().then((()=>wi)),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.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();const t=document.createElement("style");t.id=e,t.textContent="\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: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;\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: 28px;\n cursor: pointer;\n color: #666;\n padding: 0;\n width: 32px;\n height: 32px;\n display: flex;\n align-items: center;\n justify-content: center;\n border-radius: 50%;\n transition: background-color 0.2s;\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 #4CAF50;\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-countdown {\n position: absolute;\n top: 20px;\n right: 20px;\n background: rgba(0, 0, 0, 0.7);\n color: white;\n padding: 10px;\n border-radius: 50%;\n width: 50px;\n height: 50px;\n display: flex;\n align-items: center;\n justify-content: center;\n }\n\n .neofaceid-countdown-number {\n font-size: 24px;\n font-weight: bold;\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: #4CAF50;\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 ",document.head.appendChild(t)}}class ti{constructor(){a(this,"container",null),a(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: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;\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(124, 58, 237, 0.3));\n }\n\n /* Cores por estado */\n .neofaceid-state-preparing .neofaceid-logo { filter: drop-shadow(0 0 15px rgba(124, 58, 237, 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: #10b981;\n animation: neofaceid-scaleIn 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);\n }\n\n .neofaceid-error-icon {\n width: 80px;\n height: 80px;\n color: #ef4444;\n animation: neofaceid-errorShake 0.5s linear, neofaceid-scaleIn 0.4s ease-out;\n }\n "}getStatusText(){switch(this.currentStatus){case"preparing":return"Iniciando câmera";case"detecting":return"Posicione seu rosto";case"waiting-for-face":return"Aguardando rosto";case"capturing":return"Capturando";case"verifying":return"Verificando identidade";case"success":return"Identificado!";case"error":return"Falha na identificação";default:return""}}renderContent(){const e=["detecting","waiting-for-face","verifying"].includes(this.currentStatus),n=!["success","error"].includes(this.currentStatus),t="success"===this.currentStatus,o="error"===this.currentStatus,r=this.getStatusText(),a=["preparing","detecting","waiting-for-face","capturing","verifying"].includes(this.currentStatus);return`\n <style>${this.getStyles()}</style>\n <div class="neofaceid-overlay-container neofaceid-state-${this.currentStatus}">\n <div class="neofaceid-overlay-content">\n <div class="neofaceid-visual-wrapper">\n ${n?`\n <img\n src="/logo-icone-no-background.png"\n alt="NeoFaceId"\n class="neofaceid-logo ${e?"pulsing":""}"\n onerror="this.style.display='none'"\n />\n `:""}\n \n ${t?'\n <div class="neofaceid-status-icon">\n <svg class="neofaceid-success-icon" viewBox="0 0 60 60" fill="none" xmlns="http://www.w3.org/2000/svg">\n <circle cx="30" cy="30" r="28" stroke="currentColor" stroke-width="3" fill="none"/>\n <path d="M15 30 L25 40 L45 20" stroke="currentColor" stroke-width="3" stroke-linecap="round" stroke-linejoin="round" fill="none"/>\n </svg>\n </div>\n ':""}\n \n ${o?'\n <div class="neofaceid-status-icon">\n <svg class="neofaceid-error-icon" viewBox="0 0 60 60" fill="none" xmlns="http://www.w3.org/2000/svg">\n <circle cx="30" cy="30" r="28" stroke="currentColor" stroke-width="3" fill="none"/>\n <path d="M20 20 L40 40 M40 20 L20 40" stroke="currentColor" stroke-width="3" stroke-linecap="round"/>\n </svg>\n </div>\n ':""}\n </div>\n \n ${r?`\n <div class="neofaceid-status-text">\n ${r}${a?'\n <span class="neofaceid-dots">\n <span class="neofaceid-dot">.</span>\n <span class="neofaceid-dot">.</span>\n <span class="neofaceid-dot">.</span>\n </span>\n ':""}\n </div>\n `:""}\n </div>\n </div>\n `}show(e="preparing"){this.container?this.updateStatus(e):(this.container=document.createElement("div"),this.container.id="neofaceid-status-overlay",this.currentStatus=e,this.container.innerHTML=this.renderContent(),document.body.appendChild(this.container))}updateStatus(e){this.currentStatus=e,this.container&&(this.container.innerHTML=this.renderContent())}close(){if(this.container){const e=this.container.querySelector(".neofaceid-overlay-container");e&&e.classList.add("fade-out"),setTimeout((()=>{this.container&&document.body.contains(this.container)&&document.body.removeChild(this.container),this.container=null}),300)}}}function oi({error:e,onRetry:n,onCredentials:t,onCancel:o,applicationToken:r}){return y.jsxs(y.Fragment,{children:[y.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: rgba(0, 0, 0, 0.6);\n backdrop-filter: blur(8px);\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 }\n\n .neofaceid-fallback-prompt {\n background: linear-gradient(135deg, #1a1a2e 0%, #16213e 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 text-align: center;\n }\n\n .neofaceid-fallback-icon {\n width: 64px;\n height: 64px;\n margin: 0 auto 20px;\n color: #ef4444;\n animation: scaleIn 0.4s ease-out;\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 .neofaceid-fallback-title {\n font-size: 22px;\n font-weight: 700;\n color: white;\n margin: 0 0 12px 0;\n }\n\n .neofaceid-fallback-message {\n font-size: 15px;\n color: rgba(255, 255, 255, 0.7);\n margin: 0 0 28px 0;\n line-height: 1.5;\n }\n\n .neofaceid-fallback-actions {\n display: flex;\n flex-direction: column;\n gap: 12px;\n }\n\n .neofaceid-fallback-button {\n padding: 14px 24px;\n border-radius: 12px;\n border: none;\n font-size: 16px;\n font-weight: 600;\n cursor: pointer;\n transition: all 0.2s;\n font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;\n }\n\n .neofaceid-fallback-button-primary {\n background: linear-gradient(135deg, #7c3aed 0%, #6d28d9 100%);\n color: white;\n box-shadow: 0 4px 16px rgba(124, 58, 237, 0.3);\n }\n\n .neofaceid-fallback-button-primary:hover {\n transform: translateY(-2px);\n box-shadow: 0 8px 24px rgba(124, 58, 237, 0.4);\n }\n\n .neofaceid-fallback-button-primary:active {\n transform: translateY(0);\n }\n\n .neofaceid-fallback-button-secondary {\n background: rgba(255, 255, 255, 0.1);\n color: white;\n border: 1px solid rgba(255, 255, 255, 0.2);\n }\n\n .neofaceid-fallback-button-secondary:hover {\n background: rgba(255, 255, 255, 0.15);\n border-color: rgba(255, 255, 255, 0.3);\n }\n\n .neofaceid-fallback-button-ghost {\n background: transparent;\n color: rgba(255, 255, 255, 0.7);\n padding: 10px;\n }\n\n .neofaceid-fallback-button-ghost:hover {\n color: white;\n background: rgba(255, 255, 255, 0.05);\n }\n\n @media (max-width: 640px) {\n .neofaceid-fallback-prompt {\n padding: 24px;\n border-radius: 16px;\n }\n\n .neofaceid-fallback-title {\n font-size: 20px;\n }\n }\n "}),y.jsx("div",{className:"neofaceid-fallback-overlay",children:y.jsxs("div",{className:"neofaceid-fallback-prompt",children:[y.jsx("div",{className:"neofaceid-fallback-icon",children:y.jsxs("svg",{viewBox:"0 0 64 64",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[y.jsx("circle",{cx:"32",cy:"32",r:"30",stroke:"currentColor",strokeWidth:"3",fill:"none"}),y.jsx("path",{d:"M20 20 L44 44 M44 20 L20 44",stroke:"currentColor",strokeWidth:"3",strokeLinecap:"round"})]})}),y.jsx("h3",{className:"neofaceid-fallback-title",children:"Não foi possível reconhecer"}),y.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."}),y.jsxs("div",{className:"neofaceid-fallback-actions",children:[y.jsx("button",{type:"button",className:"neofaceid-fallback-button neofaceid-fallback-button-primary",onClick:n,children:"Tentar Novamente"}),y.jsx("button",{type:"button",className:"neofaceid-fallback-button neofaceid-fallback-button-secondary",onClick:t,children:"Entrar com Email e Senha"}),r&&y.jsx("button",{type:"button",className:"neofaceid-fallback-button neofaceid-fallback-button-ghost",onClick:()=>{new $a(r).open()},children:"Esqueceu sua senha?"}),o&&y.jsx("button",{type:"button",className:"neofaceid-fallback-button neofaceid-fallback-button-ghost",onClick:o,children:"Cancelar"})]})]})})]})}class ri{constructor(){a(this,"container",null),a(this,"root",null)}show(e,n,t,o,r){this.container||(this.container=document.createElement("div"),this.container.id="neofaceid-fallback-prompt",document.body.appendChild(this.container),this.root=p.createRoot(this.container),this.render(e,n,t,o,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,o,r){this.root&&this.container&&this.root.render(y.jsx(oi,{error:e,onRetry:()=>{this.close(),n()},onCredentials:()=>{this.close(),t()},applicationToken:r??"",onCancel:()=>{this.close(),null==o||o()}}))}}class ai{constructor(e){a(this,"options"),a(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(){this.addStyles(),this.modalElement=document.createElement("div"),this.modalElement.className="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 <img src="/logo-icone-no-background.png" alt="NeoFaceId" class="neoface-email-brand-logo" onerror="this.style.display='none'" />\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";if(document.getElementById(e))return;const n=document.createElement("style");n.id=e,n.textContent="\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: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;\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, #1a1a2e 0%, #16213e 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: #7c3aed;\n box-shadow: 0 0 0 3px rgba(124, 58, 237, 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, #7c3aed 0%, #6d28d9 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(124, 58, 237, 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(124, 58, 237, 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: 'SF Pro Display', -apple-system, system-ui, sans-serif;\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 ",document.head.appendChild(n)}async handleSubmit(e){e.preventDefault();const n=this.modalElement.querySelector("#email"),t=this.modalElement.querySelector("#password"),o=this.modalElement.querySelector(".neoface-email-submit-btn"),r=this.modalElement.querySelector("#login-error"),a=e=>{r.textContent=e,r.style.display="block"};r.style.display="none",r.textContent="";const i=n.value.trim(),s=t.value.trim();if(i&&s){o.disabled=!0,o.textContent="Entrando...";try{const e=await ya(i,s,this.options.applicationToken);this.options.onSuccess(e),this.close()}catch(c){o.disabled=!1,o.textContent="Entrar";c instanceof E&&(c.type===k.INVALID_TOKEN||c.type===k.API_ERROR&&c.message.includes("400"))?(a("Email ou senha incorretos. Verifique seus dados e tente novamente."),t.value="",t.focus()):(a("Ocorreu um erro inesperado. Tente novamente mais tarde."),this.options.onError(c))}}else a("Preencha o email e a senha para continuar.")}}let ii=!1,si=null;async function ci(){if(!ii)return si||(si=(async()=>{try{const e="/models";await c.nets.tinyFaceDetector.loadFromUri(e),ii=!0}catch(e){}})(),si)}async function di(e,n,t=!1,o=!1){o?n.updateStatus("detecting"):n.updateStatus("preparing");const r=document.createElement("video");r.style.position="fixed",r.style.top="-9999px",r.style.left="-9999px",r.style.width="1px",r.style.height="1px",r.style.opacity="0",r.muted=!0,r.playsInline=!0,r.setAttribute("autoplay",""),r.setAttribute("playsinline",""),document.body.appendChild(r);let a=null;try{try{a=await navigator.mediaDevices.getUserMedia({video:{width:{ideal:640},height:{ideal:480},facingMode:"user"},audio:!1})}catch{a=await navigator.mediaDevices.getUserMedia({video:{facingMode:"user"},audio:!1})}r.srcObject=a,await new Promise((e=>{if(r.readyState>=1)e();else{const n=()=>{r.removeEventListener("loadedmetadata",n),e()};r.addEventListener("loadedmetadata",n),setTimeout(e,2e3)}})),await r.play(),await new Promise((e=>{if(r.videoWidth&&r.videoHeight)e();else{const n=()=>{r.videoWidth&&r.videoHeight?e():setTimeout(n,100)};setTimeout(e,3e3),n()}})),n.updateStatus("detecting"),await new Promise((e=>setTimeout(e,100)));let o=!0;if(t||(o=await async function(e,n=5e3,t=100,o){return new Promise((r=>{let a=0;const i=Math.ceil(n/t);let s=null,d=!1,l=!1;const u=Math.ceil(3e3/t),p=e=>{d||(d=!0,s&&clearTimeout(s),r(e))},f=async()=>{if(!d){if(a++,!ii)return o&&!l&&a>=u&&(o.updateStatus("waiting-for-face"),l=!0),a>=i?void p(!1):void(s=window.setTimeout(f,t));try{if(await c.detectSingleFace(e,new c.TinyFaceDetectorOptions({inputSize:160,scoreThreshold:.3})))return o&&l&&(o.updateStatus("detecting"),l=!1),void p(!0);if(o&&!l&&a>=u&&(o.updateStatus("waiting-for-face"),l=!0),a>=i)return void p(!1);s=window.setTimeout(f,t)}catch(n){if(o&&!l&&a>=u&&(o.updateStatus("waiting-for-face"),l=!0),a>=i)return void p(!1);s=window.setTimeout(f,t)}}};window.setTimeout((()=>{d||p(!1)}),n+500),f()}))}(r,5e3,100,n)),!o)throw a&&a.getTracks().forEach((e=>e.stop())),r.parentElement&&r.parentElement.removeChild(r),new E("Nenhum rosto detectado. Por favor, posicione seu rosto na frente da câmera e tente novamente.",k.VALIDATION_ERROR);n.updateStatus("capturing");const i=document.createElement("canvas");i.width=r.videoWidth,i.height=r.videoHeight;const s=i.getContext("2d");if(!s)throw a&&a.getTracks().forEach((e=>e.stop())),r.parentElement&&r.parentElement.removeChild(r),new E("Erro ao capturar imagem",k.CAPTURE_ERROR);s.drawImage(r,0,0,i.width,i.height),a&&a.getTracks().forEach((e=>e.stop())),r.parentElement&&r.parentElement.removeChild(r);const d=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 pa(d,e);if(!l.success)throw new E("Login falhou",k.LOGIN_FAILED);return l}catch(i){if(a&&a.getTracks().forEach((e=>e.stop())),r.parentElement&&r.parentElement.removeChild(r),i instanceof E)throw i;throw new E(i instanceof Error?i.message:"Erro desconhecido",k.UNKNOWN)}}async function li(e){const{applicationToken:n,onSuccess:t,onError:o,onFallbackRequest:r,onCancel:a,fastMode:i=!1}=e,s=new ti,c=new ri;let d,l=0;ii||i||ci().catch((()=>{})),s.show("preparing");const u=async()=>{try{l++;const e=await di(n,s,i,l>1);s.updateStatus("success"),setTimeout((()=>{s.close(),t(e)}),200)}catch(e){d=e instanceof E?e:new E(e instanceof Error?e.message:"Erro desconhecido",k.UNKNOWN),s.updateStatus("error"),l<2?setTimeout((()=>{u()}),500):setTimeout((()=>{s.close(),c.show(d,(()=>{l=0,s.show("preparing"),setTimeout((()=>u()),500)}),(()=>{r?r():o(new E("Por favor, use email e senha para fazer login",k.LOGIN_FAILED))}),a,n)}),500)}};u()}const ui=Object.freeze(Object.defineProperty({__proto__:null,captureFaceSilently:async function(){return new Promise(((e,n)=>{const t=document.createElement("video");t.style.position="fixed",t.style.top="-9999px",t.style.left="-9999px",t.style.width="1px",t.style.height="1px",t.style.opacity="0",t.muted=!0,t.playsInline=!0,t.setAttribute("autoplay",""),t.setAttribute("playsinline","");const o=document.createElement("canvas");o.style.display="none";let r=null,a=0;const i=()=>{r&&r.getTracks().forEach((e=>e.stop())),t.parentElement&&t.parentElement.removeChild(t),o.parentElement&&o.parentElement.removeChild(o)};document.body.appendChild(t),document.body.appendChild(o);const s=e=>e?navigator.mediaDevices.getUserMedia({video:{width:{ideal:640},height:{ideal:480},facingMode:"user"},audio:!1}):navigator.mediaDevices.getUserMedia({video:{facingMode:"user"},audio:!1});s(!0).catch((()=>s(!1))).then((s=>{r=s,t.srcObject=r;const d=()=>{if(!t.videoWidth||!t.videoHeight)return a<30?(a++,void setTimeout(d,150)):(i(),void n(new E("Câmera não está pronta",k.CAMERA_ERROR)));o.width=t.videoWidth,o.height=t.videoHeight;const r=o.getContext("2d");if(!r)return i(),void n(new Error("Failed to get canvas context"));(async()=>{if(!ii)return!0;try{return!!(await c.detectSingleFace(t,new c.TinyFaceDetectorOptions({inputSize:160,scoreThreshold:.3})))}catch{return!0}})().then((s=>{if(!s&&a<30)return a++,void setTimeout(d,150);r.drawImage(t,0,0,o.width,o.height),o.toBlob((t=>{i(),t?e(t):n(new Error("Failed to capture image"))}),"image/jpeg",.85)}))},l=t.play();void 0!==l?l.then((()=>{t.videoWidth&&t.videoHeight?setTimeout(d,200):(t.onloadedmetadata=()=>setTimeout(d,200),setTimeout((()=>{t.videoWidth&&t.videoHeight&&d()}),1500))})).catch((e=>{i(),n(new E("Erro ao reproduzir câmera: "+e.message,k.CAMERA_ERROR))})):t.onloadedmetadata=()=>setTimeout(d,200),t.onerror=()=>{i(),n(new E("Erro ao acessar câmera",k.CAMERA_ERROR))}})).catch((e=>{i(),n(new E("Não foi possível acessar a câmera: "+e.message,k.CAMERA_ERROR))}))}))},executeBiometricLoginFlow:li,preloadFaceDetectionModels:ci},Symbol.toStringTag,{value:"Module"}));async function pi(e){try{await li({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 ai(n).open()}),onCancel:e.onCancel})}catch(n){e.onError(new E("Erro ao inicializar login facial: "+n.message,k.INITIALIZATION_ERROR))}}async function fi(e){try{const n={mode:"hand",onSuccess:async(n,t)=>{try{const t=await fetch(n).then((e=>e.blob())),o=await pa(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 ni(n);await t.open()}catch(n){e.onError(new E("Erro ao inicializar login por mão: "+n.message,k.INITIALIZATION_ERROR))}}async function hi(e){try{const n={mode:"auto",onSuccess:async(n,t)=>{try{const t=await fetch(n).then((e=>e.blob())),o=await pa(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 ni(n);await t.open()}catch(n){e.onError(new E("Erro ao inicializar login automático: "+n.message,k.INITIALIZATION_ERROR))}}async function mi(e){try{const t=await(n=e,new Promise(((e,t)=>{const o=new Image;o.onload=()=>e(o),o.onerror=()=>t(new Error("Erro ao carregar imagem"));const r=n.startsWith("data:")?n:`data:image/jpeg;base64,${n}`;o.src=r}))),o=await async function(e){try{if("undefined"!=typeof window&&window.faceapi){const n=window.faceapi;await vi();const t=new n.TinyFaceDetectorOptions({inputSize:320,scoreThreshold:.5}),o=await n.detectAllFaces(e,t).withFaceLandmarks();if(o&&o.length>0){const e=o.reduce(((e,n)=>n.detection.score>e.detection.score?n:e));return{confidence:e.detection.score,details:{faces:o.length,landmarks:e.landmarks,box:e.detection.box}}}}return{confidence:0}}catch(n){return{confidence:0}}}(t);if(o.confidence>.7)return{type:"face",confidence:o.confidence,details:o.details};const r=await async function(e){try{const n=document.createElement("canvas"),t=n.getContext("2d");if(!t)return{confidence:0};n.width=e.width,n.height=e.height,t.drawImage(e,0,0);const o=function(e){const{data:n,width:t,height:o}=e;let r=0,a=0;for(let l=0;l<n.length;l+=4){gi(n[l],n[l+1],n[l+2])&&r++,a++}const i=r/a,s=t/o;let c=0;i>.15&&i<.7&&(c+=i/.7*.4);s>.6&&s<1.8&&(c+=.3);const d=t*o;d>1e4&&d<5e5&&(c+=.3);return{confidence:Math.min(c,.8),skinRatio:i,aspectRatio:s,imageSize:d,skinPixels:r,totalPixels:a}}(t.getImageData(0,0,n.width,n.height));return{confidence:o.confidence,details:o}}catch(n){return{confidence:0}}}(t);return r.confidence>.6?{type:"hand",confidence:r.confidence,details:r.details}:{type:"unknown",confidence:Math.max(o.confidence,r.confidence)}}catch(t){return{type:"face",confidence:.5}}var n}function gi(e,n,t){const o=.299*e+.587*n+.114*t,r=-.169*e-.331*n+.5*t+128,a=.5*e-.419*n-.081*t+128;return o>80&&o<255&&r>85&&r<135&&a>135&&a<180}async function vi(){if("undefined"==typeof window||!window.faceapi)return;const e=window.faceapi;if(!e.nets.tinyFaceDetector.isLoaded)try{await Promise.all([e.nets.tinyFaceDetector.loadFromUri("/models"),e.nets.faceLandmark68Net.loadFromUri("/models")])}catch(n){}}async function bi(){try{"undefined"!=typeof window&&await vi()}catch(e){}}function yi(){return"undefined"!=typeof window&&window.faceapi&&window.faceapi.nets.tinyFaceDetector.isLoaded}const wi=Object.freeze(Object.defineProperty({__proto__:null,detectBiometricType:mi,initializeBiometricDetection:bi,isAdvancedDetectionAvailable:yi},Symbol.toStringTag,{value:"Module"}));class xi{constructor(e){a(this,"overlay",null),a(this,"video",null),a(this,"canvas",null),a(this,"stream",null),a(this,"step","face"),a(this,"countdownSeconds"),a(this,"title"),a(this,"subtitle"),a(this,"faceBlob",null),a(this,"documentBlob",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}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>\n `;const n=document.createElement("style");n.textContent="\n .neofaceid-modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.6); display:flex; align-items:center; justify-content:center; z-index: 9999; }\n .neofaceid-modal { background:#fff; border-radius:12px; width: 92%; max-width: 640px; box-shadow: 0 20px 60px rgba(0,0,0,0.3); overflow:hidden; }\n .neofaceid-modal-header { padding: 16px 20px; border-bottom: 1px solid #eee; display:flex; align-items:center; justify-content:space-between; }\n .neofaceid-title { margin:0; font-size: 20px; color:#333; }\n .neofaceid-close-btn { background:none; border:none; font-size:24px; cursor:pointer; color:#666; }\n .neofaceid-modal-body { padding: 16px 20px; }\n .neofaceid-subtitle { margin: 0 0 12px 0; color:#666; }\n .neofaceid-camera-container { position: relative; background:#000; border-radius:8px; overflow:hidden; aspect-ratio: 4/3; margin-bottom: 12px; }\n .neofaceid-video { width:100%; height:100%; object-fit: cover; }\n .neofaceid-canvas { position:absolute; top:0; left:0; }\n .neofaceid-overlay { position:absolute; inset:0; display:flex; align-items:center; justify-content:center; }\n .neofaceid-frame { width: 200px; height: 200px; border: 3px solid #4CAF50; border-radius: 50%; box-shadow: 0 0 0 2px rgba(76,175,80,0.3); }\n .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-modal-footer { padding: 16px 20px; border-top: 1px solid #eee; display:flex; gap: 8px; justify-content:flex-end; }\n .neofaceid-cancel-btn { background:#f5f5f5; color:#666; border:none; border-radius:6px; padding:10px 18px; cursor:pointer; }\n .neofaceid-capture-btn { background:#4CAF50; color:#fff; border:none; border-radius:6px; padding:10px 18px; cursor:pointer; }\n .neofaceid-capture-btn:disabled { background:#ccc; cursor:not-allowed; }\n ",document.head.appendChild(n),document.body.appendChild(e),this.overlay=e,this.video=this.overlay.querySelector(".neofaceid-video"),this.canvas=this.overlay.querySelector(".neofaceid-canvas");const t=this.overlay.querySelector(".neofaceid-close-btn"),o=this.overlay.querySelector(".neofaceid-cancel-btn");t.onclick=()=>this.close(),o.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()}async runFaceCaptureCountdown(){if(!this.overlay)return;const e=this.overlay.querySelector(".neofaceid-countdown"),n=this.overlay.querySelector(".neofaceid-countdown-number"),t=this.overlay.querySelector(".neofaceid-status-text");e.style.display="flex",t.textContent="Prepare-se! Capturando seu rosto...";let o=this.countdownSeconds;n.textContent=String(o),await new Promise((t=>{const r=setInterval((()=>{o-=1,n.textContent=String(o),o<=0&&(clearInterval(r),e.style.display="none",t())}),1e3)}))}async waitForUserCaptureClick(){if(!this.overlay)return;const e=this.overlay.querySelector(".neofaceid-capture-btn"),n=this.overlay.querySelector(".neofaceid-status-text");e.disabled=!1,n.textContent='Clique em "Capturar" quando o documento estiver visível',await new Promise((n=>{const t=()=>{e.removeEventListener("click",t),n()};e.addEventListener("click",t)})),e.disabled=!0}async captureFrame(){if(!this.video||!this.canvas)throw new Error("Elementos de captura não encontrados");const e=this.canvas.getContext("2d");if(!e)throw new Error("Falha ao obter contexto do canvas");this.canvas.width=this.video.videoWidth,this.canvas.height=this.video.videoHeight,e.drawImage(this.video,0,0,this.canvas.width,this.canvas.height);return await new Promise(((e,n)=>{this.canvas.toBlob((t=>t?e(t):n(new Error("Falha ao gerar imagem"))),"image/jpeg",.92)}))}updateTexts(e,n){if(!this.overlay)return;const t=this.overlay.querySelector(".neofaceid-title"),o=this.overlay.querySelector(".neofaceid-subtitle"),r=this.overlay.querySelector(".neofaceid-frame");t.textContent=e,o.textContent=n,"document"===this.step&&(r.style.borderRadius="8px",r.style.width="280px",r.style.height="180px")}async close(){this.stream&&(this.stream.getTracks().forEach((e=>e.stop())),this.stream=null),this.overlay&&(this.overlay.remove(),this.overlay=null)}}const _i=["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"],ki={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 Ei{constructor(e){a(this,"overlay",null),a(this,"video",null),a(this,"canvas",null),a(this,"stream",null),a(this,"resolvePromise",null),a(this,"options"),a(this,"selectedDocument",null),a(this,"currentStep","select"),a(this,"frontBlob",null),a(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(){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");if(e.className="neoface-doc-overlay",e.innerHTML='\n <div class="neoface-doc-modal">\n <div class="neoface-doc-content"></div>\n </div>\n ',!document.getElementById("neoface-doc-styles-v2")){const e=document.createElement("style");e.id="neoface-doc-styles-v2",e.textContent=this.getStyles(),document.head.appendChild(e)}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(ki).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?ki[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>Evite reflexos e sombras</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?ki[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" />\n </div>\n \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>Verifique se todos os dados estão legíveis</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-success 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?"Confirmar e Enviar":"Próximo"}\n </button>\n </div>\n \n ${this.renderBranding()}\n `}renderBranding(){return'\n <div class="neoface-doc-branding">\n <img src="/logo-icone-no-background.png" \n alt="NeoFaceId" class="neoface-doc-brand-icon" \n onerror="this.style.display=\'none\'" />\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 r=null==(e=this.overlay)?void 0:e.querySelector(".neoface-doc-capture-btn"),a=null==(n=this.overlay)?void 0:n.querySelector(".neoface-doc-back-btn"),i=null==(t=this.overlay)?void 0:t.querySelector(".neoface-doc-upload-btn"),s=null==(o=this.overlay)?void 0:o.querySelector(".neoface-doc-file-input");null==r||r.addEventListener("click",(()=>this.handleCapture())),null==a||a.addEventListener("click",(()=>this.handleBack())),null==i||i.addEventListener("click",(()=>null==s?void 0:s.click())),null==s||s.addEventListener("change",(e=>this.handleFileUpload(e))),this.bindCloseEvent()}async handleFileUpload(e){var n,t;const o=null==(n=e.target.files)?void 0:n[0];if(!o)return;const r=null==(t=this.overlay)?void 0:t.querySelector(".neoface-doc-loading");r&&(r.style.display="flex");try{const e=await this.compressUploadedImage(o);"front"===this.currentStep?(this.frontBlob=e,this.currentStep="preview-front"):"back"===this.currentStep&&(this.backBlob=e,this.currentStep="preview-back"),this.stopCamera(),this.render()}catch(a){const e=new Blob([o],{type:o.type});"front"===this.currentStep?(this.frontBlob=e,this.currentStep="preview-front"):"back"===this.currentStep&&(this.backBlob=e,this.currentStep="preview-back"),this.stopCamera(),this.render()}}compressUploadedImage(e){return new Promise(((n,t)=>{const o=new Image;o.onload=()=>{const e=1280;let r=o.width,a=o.height;r>a&&r>e?(a=a*e/r,r=e):a>e&&(r=r*e/a,a=e);const i=document.createElement("canvas");i.width=r,i.height=a;const s=i.getContext("2d");s?(s.drawImage(o,0,0,r,a),i.toBlob((e=>{e?n(e):t(new Error("Failed to compress image"))}),"image/jpeg",.75)):t(new Error("Failed to get canvas context"))},o.onerror=()=>t(new Error("Failed to load image")),o.src=URL.createObjectURL(e)}))}bindPreviewEvents(){var e,n,t;const o=null==(e=this.overlay)?void 0:e.querySelector(".neoface-doc-confirm-btn"),r=null==(n=this.overlay)?void 0:n.querySelector(".neoface-doc-retake-btn");null==o||o.addEventListener("click",(()=>this.handleConfirm())),null==r||r.addEventListener("click",(()=>this.handleRetake()));const a=null==(t=this.overlay)?void 0:t.querySelector(".neoface-doc-preview-current");if(a){const e="preview-front"===this.currentStep?this.frontBlob:this.backBlob;e&&(a.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())}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())}catch(r){null==(t=this.resolvePromise)||t.call(this,{success:!1,frontImage:null,backImage:null,error:"Não foi possível acessar a câmera"}),this.close()}}}stopCamera(){this.stream&&(this.stream.getTracks().forEach((e=>e.stop())),this.stream=null)}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 o=this.video.videoWidth,r=this.video.videoHeight,a=Math.floor(.75*o),i=Math.floor(.65*r),s=Math.floor((o-a)/2),c=Math.floor((r-i)/2);this.canvas.width=a,this.canvas.height=i,t.drawImage(this.video,s,c,a,i,0,0,a,i);try{const e=await new Promise(((e,n)=>{this.canvas.toBlob((t=>t?e(t):n(new Error("Capture failed"))),"image/jpeg",.92)}));"front"===this.currentStep?(this.frontBlob=e,this.stopCamera(),this.currentStep="preview-front",this.render()):"back"===this.currentStep&&(this.backBlob=e,this.stopCamera(),this.currentStep="preview-back",this.render())}catch(d){}finally{n&&(n.style.display="none")}}handleBack(){this.stopCamera(),"back"===this.currentStep?(this.currentStep="front",this.frontBlob=null):"front"===this.currentStep&&(this.currentStep="select",this.selectedDocument=null),this.render()}handleRetake(){"preview-front"===this.currentStep?(this.frontBlob=null,this.currentStep="front"):"preview-back"===this.currentStep&&(this.backBlob=null,this.currentStep="back"),this.render()}handleConfirm(){var e,n;const t=this.selectedDocument?ki[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: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;\n padding: 16px;\n }\n \n .neoface-doc-modal {\n background: linear-gradient(145deg, #1a1a2e 0%, #16213e 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, #00c8ff, #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, 200, 255, 0.1);\n border-color: rgba(0, 200, 255, 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, 200, 255, 0.15);\n border-radius: 12px;\n color: #00c8ff;\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: #00c8ff;\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, 200, 255, 0.08);\n border: 1px solid rgba(0, 200, 255, 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: #00c8ff;\n flex-shrink: 0;\n }\n \n /* Camera */\n .neoface-doc-camera-container {\n position: relative;\n background: #000;\n border-radius: 16px;\n overflow: hidden;\n aspect-ratio: 4/3;\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 .neoface-doc-frame {\n width: 75%;\n height: 65%;\n position: relative;\n border: 2px dashed rgba(0, 200, 255, 0.5);\n border-radius: 12px;\n background: rgba(0, 200, 255, 0.03);\n }\n \n .neoface-doc-corner {\n position: absolute;\n width: 28px;\n height: 28px;\n border-color: #00c8ff;\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: #00c8ff;\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: #00c8ff;\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, 200, 255, 0.3);\n box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);\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, 200, 255, 0.08);\n border: 1px solid rgba(0, 200, 255, 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: #00c8ff;\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, #00c8ff 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, 200, 255, 0.4);\n }\n \n .neoface-doc-btn-success {\n background: linear-gradient(135deg, #10b981 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: #00c8ff;\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 Ri=async e=>new Ei(e).open(),Ti=Object.freeze(Object.defineProperty({__proto__:null,DocumentCaptureModal:Ei,startDocumentCapture:Ri},Symbol.toStringTag,{value:"Module"}));e.BiometricCaptureModal=ni,e.BiometricRegistrationModal=ei,e.BiometricStatusOverlay=ti,e.DocumentCaptureModal=Ei,e.ENVIRONMENT_URLS=Xr,e.EmailPasswordModal=ai,e.ErrorType=k,e.FaceCaptureModal=Pa,e.FallbackPrompt=ri,e.ForgotPasswordModal=$a,e.NeoFaceError=E,e.NeoFaceID=class{constructor(e){if(a(this,"appToken"),a(this,"signature"),a(this,"sessionData"),this.appToken=e.appToken,this.signature=e.signature,this.sessionData=e.sessionData,this.signature&&!this.validateSignatureFormat(this.signature))throw new E("Invalid signature format. Expected HMAC-SHA256 hex string (minimum 64 characters)",k.VALIDATION_ERROR);if(this.sessionData&&(!this.sessionData.email||!this.sessionData.cpf||!this.sessionData.sessionId))throw new E("Session data must include email, cpf, and sessionId",k.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 E("Number of frames must be between 1 and 10",k.VALIDATION_ERROR);const o=[];try{const{captureFaceSilently:e}=await Promise.resolve().then((()=>ui));for(let r=0;r<n;r++){const a=await e();o.push(a),t&&r<n-1&&await new Promise((e=>setTimeout(e,300)))}return o}catch(r){if(r instanceof E)throw r;throw new E(`Failed to capture face frames: ${r instanceof Error?r.message:"Unknown error"}`,k.CAPTURE_ERROR)}}async loginRecognition(e){const{biometricData:n,purpose:t,confidenceThreshold:o=.8}=e,r=Array.isArray(n)?n:[n];if(0===r.length)throw new E("At least one biometric data frame is required",k.VALIDATION_ERROR);const a=r[0];try{const e=await ma(a,this.appToken,t,o,this.signature,this.sessionData);if(!e.success)throw new E("Recognition failed",k.RECOGNITION_FAILED);if(!e.personName||!e.email||!e.cpf)throw new E("Incomplete recognition result: missing personName, email, or cpf",k.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 E)throw i;throw new E(`Login recognition failed: ${i instanceof Error?i.message:"Unknown error"}`,k.RECOGNITION_FAILED)}}async registerApplication(e,n,t){try{return await _a(e,n,t)}catch(o){if(o instanceof E)throw o;throw new E(`Application registration failed: ${o instanceof Error?o.message:"Unknown error"}`,k.VALIDATION_ERROR)}}async registerDocumentByImage(e,n,t={}){const{DocumentCaptureModal:o}=await Promise.resolve().then((()=>Ti)),r=new o({useBackCamera:t.useBackCamera??!0,preSelectedDocument:t.preSelectedDocument}),a=await r.open();if(!a.success||!a.frontImage)throw new E("cancelled"===a.error?"Document capture was cancelled by the user":`Document capture failed: ${a.error??"unknown error"}`,k.CAPTURE_ERROR);const i=[a.frontImage];return a.backImage&&i.push(a.backImage),Oa(e,n,i)}async proofOfLife(e={}){const{videoDurationMs:n=3e3,maxPollingAttempts:t=60,pollingIntervalMs:o=1e3,onRecordingProgress:r,onTaskStatusChange:a}=e;try{const e=await ka({durationMs:n,onProgress:r}),i=await Ta(e),s=await Ra(i,this.appToken);a&&a("processing",0);const c=await Ea(s.taskId,this.appToken,{maxAttempts:t,intervalMs:o,onStatusChange:a});return c&&c.success?{success:!0,isLive:c.is_live||!1,livenessScore:c.liveness_score||0,faceRecognitionScore:c.face_recognition_score||0,combinedConfidence:c.combined_confidence||0,personId:c.person_id,personalData:c.personal_data||[],processingTime:c.processing_time||0,historyId:s.historyId,taskId:s.taskId,message:"Proof of life verification successful"}:{success:!1,isLive:(null==c?void 0:c.is_live)||!1,livenessScore:(null==c?void 0:c.liveness_score)||0,faceRecognitionScore:(null==c?void 0:c.face_recognition_score)||0,combinedConfidence:(null==c?void 0:c.combined_confidence)||0,personId:null==c?void 0:c.person_id,personalData:(null==c?void 0:c.personal_data)||[],processingTime:(null==c?void 0:c.processing_time)||0,historyId:s.historyId,taskId:s.taskId,error:(null==c?void 0:c.error)||"Verification failed",message:(null==c?void 0:c.message)||"Proof of life verification failed"}}catch(i){if(i instanceof E)throw i;throw new E(`Proof of life failed: ${i instanceof Error?i.message:"Unknown error"}`,k.RECOGNITION_FAILED)}}},e.RELEASE_DATE="2026-03-28",e.VERSION="1.24.1",e.authorizeOperation=async(e,n,t)=>{if(!e)throw new E("Application token is required",k.VALIDATION_ERROR);if(!n)throw new E("CPF is required",k.VALIDATION_ERROR);const o=n.replace(/\D/g,"");if(11!==o.length)throw new E("Invalid CPF format",k.VALIDATION_ERROR);const r=[],a=(null==t?void 0:t.captureDelay)||2e3;try{if(!navigator.mediaDevices||!navigator.mediaDevices.getUserMedia)throw new E("Camera not available",k.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 E("Failed to get canvas context",k.CAPTURE_ERROR);for(let e=0;e<4;e++){const n=_i[e];(null==t?void 0:t.onProgress)&&t.onProgress(e+1,4,n),e>0&&await new Promise((e=>setTimeout(e,a))),c.drawImage(i,0,0,s.width,s.height);const o=await new Promise(((e,n)=>{s.toBlob((t=>{t?e(t):n(new Error("Failed to capture photo"))}),"image/jpeg",.9)}));r.push(o),(null==t?void 0:t.onPhotoTaken)&&t.onPhotoTaken(e+1,o)}n.getTracks().forEach((e=>e.stop()));const d=r[3],l={cpf:o,email:"",sessionId:`auth_${Date.now()}_${Math.random().toString(36).substring(7)}`},u=await ma(d,e,"AUTHORIZATION",.8,void 0,l);if(!u.success)throw new E("Authorization failed: Person not recognized",k.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 E)throw i;if(i instanceof Error)throw new E(i.message,k.CAPTURE_ERROR);throw new E("Unknown error during authorization",k.UNKNOWN)}},e.biometricLogin=function(e,n="auto"){return new Promise(((t,o)=>{const r={applicationToken:e,onSuccess:t,onError:o};switch(n){case"face":pi(r);break;case"hand":fi(r);break;case"auto":hi(r);break;default:o(new E("Modo de login inválido",k.VALIDATION_ERROR))}}))},e.biometricLoginWithFallback=function(e,n="auto"){return new Promise(((t,o)=>{const r={applicationToken:e,onSuccess:t,onError:n=>{if(n.type===k.LOGIN_FAILED){new ai({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":pi(r);break;case"hand":fi(r);break;case"auto":hi(r);break;default:o(new E("Modo de login inválido",k.VALIDATION_ERROR))}}))},e.checkUserExistence=va,e.completeOnboarding=da,e.completeOnboardingWithData=la,e.confirmPasswordReset=za,e.detectBiometricType=mi,e.getApplicationToken=function(){return Qr.applicationToken},e.getBaseUrl=ea,e.getConfig=function(){return{...Qr}},e.getEnvironment=function(){return Qr.environment},e.identifyPerson=wa,e.identifyPersonAsync=Ia,e.init=function(e={}){const{environment:n,baseUrl:t,applicationToken:o}=e;if(t)Qr.baseUrl=t,Qr.environment="custom";else if(n)Xr[n]?(Qr.baseUrl=Xr[n],Qr.environment=n):(Qr.baseUrl=Xr.sandbox,Qr.environment="sandbox");else{const e=void 0!=={url:"undefined"==typeof document&&"undefined"==typeof location?require("url").pathToFileURL(__filename).href:"undefined"==typeof document?location.href:i&&"SCRIPT"===i.tagName.toUpperCase()&&i.src||new URL("neoface-id-sdk.umd.js",document.baseURI).href}&&(null==Yr?void 0:Yr.VITE_API_BASE_URL);e&&(Qr.baseUrl=e,Qr.environment="custom")}o&&(Qr.applicationToken=o),Qr.initialized=!0},e.initializeBiometricDetection=bi,e.isAdvancedDetectionAvailable=yi,e.isInitialized=function(){return Qr.initialized},e.loginWithBiometric=pa,e.loginWithEmail=ya,e.preloadFaceDetectionModels=ci,e.recognize=ua,e.recognizeBiometric=fa,e.recognizeByPurpose=ma,e.registerBiometric=xa,e.registerPersonWithBiometric=ba,e.registerPersonWithoutFace=ga,e.requestPasswordReset=Na,e.simpleIdentification=ha,e.start=function(e,t){const o=document.createElement("div");o.id="neoface-modal-container",document.body.appendChild(o);const r=()=>{document.body.contains(o)&&document.body.removeChild(o)};ia(e).then((()=>{const a=n.createElement(Pa,{accessToken:e,onClose:r,onSuccess:e=>{r(),t.onSuccess({name:e.data.faceId,email:e.data.faceId,documentId:e.data.faceId})}});p.createRoot(o).render(a)})).catch((e=>{r(),t.onError("TOKEN_VALIDATION_ERROR",e.message||"Failed to validate token")}))},e.startAutoLogin=hi,e.startBiometricRegistration=function(e,t,o,r){const a=document.createElement("div");a.id="neoface-biometric-registration-container",document.body.appendChild(a);let i=null;const s=()=>{i&&(i.unmount(),i=null),document.body.contains(a)&&document.body.removeChild(a)};ia(t).then((()=>{const c=n.createElement(ei,{personData:e,applicationToken:t,useRealApi:(null==r?void 0:r.useRealApi)??!0,onClose:s,onSuccess:e=>{s(),o.onSuccess(e)},onError:e=>{s(),o.onError("BIOMETRIC_REGISTRATION_ERROR",e)}});i=p.createRoot(a),i.render(c)})).catch((e=>{s(),o.onError("TOKEN_VALIDATION_ERROR",e.message||"Failed to validate token")}))},e.startDocumentCapture=Ri,e.startFaceLogin=pi,e.startHandLogin=fi,e.startLivenessCapture=function(e,t){const o=document.createElement("div");o.id="neoface-liveness-capture-container",document.body.appendChild(o);let r=!1,a=null;const i=()=>{a&&(a.unmount(),a=null),document.body.contains(o)&&document.body.removeChild(o)},s=()=>{i(),!r&&t.onCancel&&t.onCancel()};ia(e).then((()=>{const c=n.createElement(ei,{applicationToken:e,onClose:s,onPhotosCaptured:e=>{r=!0,t.onSuccess(e)},onError:e=>{i(),t.onError("LIVENESS_CAPTURE_ERROR",e)}});a=p.createRoot(o),a.render(c)})).catch((e=>{i(),t.onError("TOKEN_VALIDATION_ERROR",e.message||"Failed to validate token")}))},e.startOnboarding=async e=>{const{applicationToken:n,onboardingToken:t,countdown:o,title:r,subtitle:a,onSuccess:i,onError:s}=e;try{const e=await sa(n,t);if(!(null==e?void 0:e.is_valid))throw new E("Link de onboarding inválido ou expirado",k.VALIDATION_ERROR);const s=new xi({countdown:o,title:r,subtitle:a}),{face:c,document:d}=await s.open();i({...await da(n,t,c,d),details:e})}catch(c){if(c instanceof E)return void s(c);const e=(null==c?void 0:c.message)||"Erro desconhecido no onboarding";s(new E(e,k.UNKNOWN))}},e.validateOnboardingToken=ca,e.validateToken=ia,Object.defineProperty(e,Symbol.toStringTag,{value:"Module"})}));
|
|
10
|
+
*/function b(){return m||(m=1,"production"!==process.env.NODE_ENV&&function(){var e=n,t=Symbol.for("react.element"),o=Symbol.for("react.portal"),r=Symbol.for("react.fragment"),a=Symbol.for("react.strict_mode"),i=Symbol.for("react.profiler"),s=Symbol.for("react.provider"),c=Symbol.for("react.context"),d=Symbol.for("react.forward_ref"),l=Symbol.for("react.suspense"),u=Symbol.for("react.suspense_list"),p=Symbol.for("react.memo"),f=Symbol.for("react.lazy"),h=Symbol.for("react.offscreen"),m=Symbol.iterator;var g=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function b(e){for(var n=arguments.length,t=new Array(n>1?n-1:0),o=1;o<n;o++)t[o-1]=arguments[o];!function(e,n,t){var o=g.ReactDebugCurrentFrame.getStackAddendum();""!==o&&(n+="%s",t=t.concat([o]));var r=t.map((function(e){return String(e)}));r.unshift("Warning: "+n),Function.prototype.apply.call(console[e],console,r)}("error",e,t)}var y;function w(e){return e.displayName||"Context"}function x(e){if(null==e)return null;if("number"==typeof e.tag&&b("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),"function"==typeof e)return e.displayName||e.name||null;if("string"==typeof e)return e;switch(e){case r:return"Fragment";case o:return"Portal";case i:return"Profiler";case a:return"StrictMode";case l:return"Suspense";case u:return"SuspenseList"}if("object"==typeof e)switch(e.$$typeof){case c:return w(e)+".Consumer";case s:return w(e._context)+".Provider";case d:return function(e,n,t){var o=e.displayName;if(o)return o;var r=n.displayName||n.name||"";return""!==r?t+"("+r+")":t}(e,e.render,"ForwardRef");case p:var n=e.displayName||null;return null!==n?n:x(e.type)||"Memo";case f:var t=e,h=t._payload,m=t._init;try{return x(m(h))}catch(g){return null}}return null}y=Symbol.for("react.module.reference");var _,k,E,R,T,O,S,I=Object.assign,N=0;function z(){}z.__reactDisabledLog=!0;var C,A=g.ReactCurrentDispatcher;function j(e,n,t){if(void 0===C)try{throw Error()}catch(r){var o=r.stack.trim().match(/\n( *(at )?)/);C=o&&o[1]||""}return"\n"+C+e}var P,$=!1,D="function"==typeof WeakMap?WeakMap:Map;function F(e,n){if(!e||$)return"";var t,o=P.get(e);if(void 0!==o)return o;$=!0;var r,a=Error.prepareStackTrace;Error.prepareStackTrace=void 0,r=A.current,A.current=null,function(){if(0===N){_=console.log,k=console.info,E=console.warn,R=console.error,T=console.group,O=console.groupCollapsed,S=console.groupEnd;var e={configurable:!0,enumerable:!0,value:z,writable:!0};Object.defineProperties(console,{info:e,log:e,warn:e,error:e,group:e,groupCollapsed:e,groupEnd:e})}N++}();try{if(n){var i=function(){throw Error()};if(Object.defineProperty(i.prototype,"props",{set:function(){throw Error()}}),"object"==typeof Reflect&&Reflect.construct){try{Reflect.construct(i,[])}catch(h){t=h}Reflect.construct(e,[],i)}else{try{i.call()}catch(h){t=h}e.call(i.prototype)}}else{try{throw Error()}catch(h){t=h}e()}}catch(m){if(m&&t&&"string"==typeof m.stack){for(var s=m.stack.split("\n"),c=t.stack.split("\n"),d=s.length-1,l=c.length-1;d>=1&&l>=0&&s[d]!==c[l];)l--;for(;d>=1&&l>=0;d--,l--)if(s[d]!==c[l]){if(1!==d||1!==l)do{if(d--,--l<0||s[d]!==c[l]){var u="\n"+s[d].replace(" at new "," at ");return e.displayName&&u.includes("<anonymous>")&&(u=u.replace("<anonymous>",e.displayName)),"function"==typeof e&&P.set(e,u),u}}while(d>=1&&l>=0);break}}}finally{$=!1,A.current=r,function(){if(0==--N){var e={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:I({},e,{value:_}),info:I({},e,{value:k}),warn:I({},e,{value:E}),error:I({},e,{value:R}),group:I({},e,{value:T}),groupCollapsed:I({},e,{value:O}),groupEnd:I({},e,{value:S})})}N<0&&b("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}(),Error.prepareStackTrace=a}var p=e?e.displayName||e.name:"",f=p?j(p):"";return"function"==typeof e&&P.set(e,f),f}function L(e,n,t){if(null==e)return"";if("function"==typeof e)return F(e,!(!(o=e.prototype)||!o.isReactComponent));var o;if("string"==typeof e)return j(e);switch(e){case l:return j("Suspense");case u:return j("SuspenseList")}if("object"==typeof e)switch(e.$$typeof){case d:return F(e.render,!1);case p:return L(e.type,n,t);case f:var r=e,a=r._payload,i=r._init;try{return L(i(a),n,t)}catch(s){}}return""}P=new D;var M=Object.prototype.hasOwnProperty,U={},q=g.ReactDebugCurrentFrame;function B(e){if(e){var n=e._owner,t=L(e.type,e._source,n?n.type:null);q.setExtraStackFrame(t)}else q.setExtraStackFrame(null)}var W=Array.isArray;function Z(e){return W(e)}function V(e){return""+e}function K(e){if(function(e){try{return V(e),!1}catch(n){return!0}}(e))return b("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",function(e){return"function"==typeof Symbol&&Symbol.toStringTag&&e[Symbol.toStringTag]||e.constructor.name||"Object"}(e)),V(e)}var J,G,H=g.ReactCurrentOwner,Y={key:!0,ref:!0,__self:!0,__source:!0};function X(e,n,o,r,a){var i,s={},c=null,d=null;for(i in void 0!==o&&(K(o),c=""+o),function(e){if(M.call(e,"key")){var n=Object.getOwnPropertyDescriptor(e,"key").get;if(n&&n.isReactWarning)return!1}return void 0!==e.key}(n)&&(K(n.key),c=""+n.key),function(e){if(M.call(e,"ref")){var n=Object.getOwnPropertyDescriptor(e,"ref").get;if(n&&n.isReactWarning)return!1}return void 0!==e.ref}(n)&&(d=n.ref,function(e){"string"==typeof e.ref&&H.current}(n)),n)M.call(n,i)&&!Y.hasOwnProperty(i)&&(s[i]=n[i]);if(e&&e.defaultProps){var l=e.defaultProps;for(i in l)void 0===s[i]&&(s[i]=l[i])}if(c||d){var u="function"==typeof e?e.displayName||e.name||"Unknown":e;c&&function(e,n){var t=function(){J||(J=!0,b("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",n))};t.isReactWarning=!0,Object.defineProperty(e,"key",{get:t,configurable:!0})}(s,u),d&&function(e,n){var t=function(){G||(G=!0,b("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",n))};t.isReactWarning=!0,Object.defineProperty(e,"ref",{get:t,configurable:!0})}(s,u)}return function(e,n,o,r,a,i,s){var c={$$typeof:t,type:e,key:n,ref:o,props:s,_owner:i,_store:{}};return Object.defineProperty(c._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(c,"_self",{configurable:!1,enumerable:!1,writable:!1,value:r}),Object.defineProperty(c,"_source",{configurable:!1,enumerable:!1,writable:!1,value:a}),Object.freeze&&(Object.freeze(c.props),Object.freeze(c)),c}(e,c,d,a,r,H.current,s)}var Q,ee=g.ReactCurrentOwner,ne=g.ReactDebugCurrentFrame;function te(e){if(e){var n=e._owner,t=L(e.type,e._source,n?n.type:null);ne.setExtraStackFrame(t)}else ne.setExtraStackFrame(null)}function oe(e){return"object"==typeof e&&null!==e&&e.$$typeof===t}function re(){if(ee.current){var e=x(ee.current.type);if(e)return"\n\nCheck the render method of `"+e+"`."}return""}Q=!1;var ae={};function ie(e,n){if(e._store&&!e._store.validated&&null==e.key){e._store.validated=!0;var t=function(e){var n=re();if(!n){var t="string"==typeof e?e:e.displayName||e.name;t&&(n="\n\nCheck the top-level render call using <"+t+">.")}return n}(n);if(!ae[t]){ae[t]=!0;var o="";e&&e._owner&&e._owner!==ee.current&&(o=" It was passed a child from "+x(e._owner.type)+"."),te(e),b('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',t,o),te(null)}}}function se(e,n){if("object"==typeof e)if(Z(e))for(var t=0;t<e.length;t++){var o=e[t];oe(o)&&ie(o,n)}else if(oe(e))e._store&&(e._store.validated=!0);else if(e){var r=function(e){if(null===e||"object"!=typeof e)return null;var n=m&&e[m]||e["@@iterator"];return"function"==typeof n?n:null}(e);if("function"==typeof r&&r!==e.entries)for(var a,i=r.call(e);!(a=i.next()).done;)oe(a.value)&&ie(a.value,n)}}function ce(e){var n,t=e.type;if(null!=t&&"string"!=typeof t){if("function"==typeof t)n=t.propTypes;else{if("object"!=typeof t||t.$$typeof!==d&&t.$$typeof!==p)return;n=t.propTypes}if(n){var o=x(t);!function(e,n,t,o,r){var a=Function.call.bind(M);for(var i in e)if(a(e,i)){var s=void 0;try{if("function"!=typeof e[i]){var c=Error((o||"React class")+": "+t+" type `"+i+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof e[i]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw c.name="Invariant Violation",c}s=e[i](n,i,o,t,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(d){s=d}!s||s instanceof Error||(B(r),b("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).",o||"React class",t,i,typeof s),B(null)),s instanceof Error&&!(s.message in U)&&(U[s.message]=!0,B(r),b("Failed %s type: %s",t,s.message),B(null))}}(n,e.props,"prop",o,e)}else if(void 0!==t.PropTypes&&!Q){Q=!0,b("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",x(t)||"Unknown")}"function"!=typeof t.getDefaultProps||t.getDefaultProps.isReactClassApproved||b("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}var de={};function le(e,n,o,m,g,v){var w=function(e){return"string"==typeof e||"function"==typeof e||e===r||e===i||e===a||e===l||e===u||e===h||"object"==typeof e&&null!==e&&(e.$$typeof===f||e.$$typeof===p||e.$$typeof===s||e.$$typeof===c||e.$$typeof===d||e.$$typeof===y||void 0!==e.getModuleId)}(e);if(!w){var _="";(void 0===e||"object"==typeof e&&null!==e&&0===Object.keys(e).length)&&(_+=" You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");var k;_+=re(),null===e?k="null":Z(e)?k="array":void 0!==e&&e.$$typeof===t?(k="<"+(x(e.type)||"Unknown")+" />",_=" Did you accidentally export a JSX literal instead of a component?"):k=typeof e,b("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",k,_)}var E=X(e,n,o,g,v);if(null==E)return E;if(w){var R=n.children;if(void 0!==R)if(m)if(Z(R)){for(var T=0;T<R.length;T++)se(R[T],e);Object.freeze&&Object.freeze(R)}else b("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else se(R,e)}if(M.call(n,"key")){var O=x(e),S=Object.keys(n).filter((function(e){return"key"!==e})),I=S.length>0?"{key: someKey, "+S.join(": ..., ")+": ...}":"{key: someKey}";if(!de[O+I])b('A props object containing a "key" prop is being spread into JSX:\n let props = %s;\n <%s {...props} />\nReact keys must be passed directly to JSX without using spread:\n let props = %s;\n <%s key={someKey} {...props} />',I,O,S.length>0?"{"+S.join(": ..., ")+": ...}":"{}",O),de[O+I]=!0}return e===r?function(e){for(var n=Object.keys(e.props),t=0;t<n.length;t++){var o=n[t];if("children"!==o&&"key"!==o){te(e),b("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",o),te(null);break}}null!==e.ref&&(te(e),b("Invalid attribute `ref` supplied to `React.Fragment`."),te(null))}(E):ce(E),E}var ue=function(e,n,t){return le(e,n,t,!1)},pe=function(e,n,t){return le(e,n,t,!0)};v.Fragment=r,v.jsx=ue,v.jsxs=pe}()),v}var y=(g||(g=1,"production"===process.env.NODE_ENV?f.exports=function(){if(u)return h;u=1;var e=n,t=Symbol.for("react.element"),o=Symbol.for("react.fragment"),r=Object.prototype.hasOwnProperty,a=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,i={key:!0,ref:!0,__self:!0,__source:!0};function s(e,n,o){var s,c={},d=null,l=null;for(s in void 0!==o&&(d=""+o),void 0!==n.key&&(d=""+n.key),void 0!==n.ref&&(l=n.ref),n)r.call(n,s)&&!i.hasOwnProperty(s)&&(c[s]=n[s]);if(e&&e.defaultProps)for(s in n=e.defaultProps)void 0===c[s]&&(c[s]=n[s]);return{$$typeof:t,type:e,key:d,ref:l,props:c,_owner:a.current}}return h.Fragment=o,h.jsx=s,h.jsxs=s,h}():f.exports=b()),f.exports);class w extends Error{constructor(e){super(e),this.name="CameraPermissionDenied"}}class x{constructor(e){a(this,"stream"),this.stream=e}getStream(){return this.stream}stop(){this.stream.getTracks().forEach((e=>e.stop()))}}const _=()=>{const e=n.useRef(null),[t,o]=n.useState(!1),r=n.useRef(!1);return{startCamera:n.useCallback((async n=>{const t=e.current;if(t)return t.getStream();if(r.current){await new Promise((e=>setTimeout(e,100)));const n=e.current;if(n)return n.getStream()}r.current=!0;try{const t=n||(()=>{const e=/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent);return{video:{facingMode:"user",width:{ideal:e?640:1280},height:{ideal:e?480:720},aspectRatio:{ideal:1.777777778}},audio:!1}})(),a=await navigator.mediaDevices.getUserMedia(t),i=new x(a);return e.current=i,o(!0),r.current=!1,a}catch(a){if(r.current=!1,a instanceof Error){if("NotAllowedError"===a.name||"PermissionDeniedError"===a.name)throw new w("Permissão para acessar a câmera foi negada pelo usuário");if("NotFoundError"===a.name||"DevicesNotFoundError"===a.name)throw new Error("Nenhuma câmera foi encontrada no dispositivo");if("NotReadableError"===a.name||"TrackStartError"===a.name)throw new Error("A câmera já está sendo usada por outro aplicativo");if("OverconstrainedError"===a.name||"ConstraintNotSatisfiedError"===a.name)throw new Error("As configurações solicitadas não são suportadas pela câmera")}throw new Error(`Erro ao inicializar câmera: ${a instanceof Error?a.message:String(a)}`)}}),[]),stopCamera:n.useCallback((n=>{const t=e.current;t&&t.getStream()===n&&(t.stop(),e.current=null,o(!1),r.current=!1)}),[]),cleanup:n.useCallback((()=>{e.current&&(e.current.stop(),e.current=null,o(!1),r.current=!1)}),[]),isActive:t}};var k=(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))(k||{});class E extends Error{constructor(e,n){super(e),a(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 R(e,n,t){function o(t,o){if(t._zod||Object.defineProperty(t,"_zod",{value:{def:o,constr:i,traits:new Set},enumerable:!1}),t._zod.traits.has(e))return;t._zod.traits.add(e),n(t,o);const r=i.prototype,a=Object.keys(r);for(let e=0;e<a.length;e++){const n=a[e];n in t||(t[n]=r[n].bind(t))}}const r=(null==t?void 0:t.Parent)??Object;class a extends r{}function i(e){var n;const r=(null==t?void 0:t.Parent)?new a:this;o(r,e),(n=r._zod).deferred??(n.deferred=[]);for(const t of r._zod.deferred)t();return r}return Object.defineProperty(a,"name",{value:e}),Object.defineProperty(i,"init",{value:o}),Object.defineProperty(i,Symbol.hasInstance,{value:n=>{var o,r;return!!((null==t?void 0:t.Parent)&&n instanceof t.Parent)||(null==(r=null==(o=null==n?void 0:n._zod)?void 0:o.traits)?void 0:r.has(e))}}),Object.defineProperty(i,"name",{value:e}),i}class T extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class O extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name="ZodEncodeError"}}const S={};function I(e){return S}function N(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 z(e,n){return"bigint"==typeof n?n.toString():n}function C(e){return{get value(){{const n=e();return Object.defineProperty(this,"value",{value:n}),n}}}}function A(e){return null==e}function j(e){const n=e.startsWith("^")?1:0,t=e.endsWith("$")?e.length-1:e.length;return e.slice(n,t)}const P=Symbol("evaluating");function $(e,n,t){let o;Object.defineProperty(e,n,{get(){if(o!==P)return void 0===o&&(o=P,o=t()),o},set(t){Object.defineProperty(e,n,{value:t})},configurable:!0})}function D(e,n,t){Object.defineProperty(e,n,{value:t,writable:!0,enumerable:!0,configurable:!0})}function F(...e){const n={};for(const t of e){const e=Object.getOwnPropertyDescriptors(t);Object.assign(n,e)}return Object.defineProperties({},n)}function L(e){return JSON.stringify(e)}const M="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function U(e){return"object"==typeof e&&null!==e&&!Array.isArray(e)}const q=C((()=>{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 B(e){if(!1===U(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!==U(t)&&!1!==Object.prototype.hasOwnProperty.call(t,"isPrototypeOf")}function W(e){return B(e)?{...e}:Array.isArray(e)?[...e]:e}const Z=new Set(["string","number","symbol"]);function V(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function K(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 J(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 G={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 H(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 Y(e,n){return n.map((n=>{var t;return(t=n).path??(t.path=[]),n.path.unshift(e),n}))}function X(e){return"string"==typeof e?e:null==e?void 0:e.message}function Q(e,n,t){var o,r,a,i,s,c;const d={...e,path:e.path??[]};if(!e.message){const l=X(null==(a=null==(r=null==(o=e.inst)?void 0:o._zod.def)?void 0:r.error)?void 0:a.call(r,e))??X(null==(i=null==n?void 0:n.error)?void 0:i.call(n,e))??X(null==(s=t.customError)?void 0:s.call(t,e))??X(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 ee(e){return Array.isArray(e)?"array":"string"==typeof e?"string":"unknown"}function ne(...e){const[n,t,o]=e;return"string"==typeof n?{message:n,code:"custom",input:t,inst:o}:{...n}}const te=(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,z,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},oe=R("$ZodError",te),re=R("$ZodError",te,{Parent:Error});const ae=e=>(n,t,o,r)=>{const a=o?Object.assign(o,{async:!1}):{async:!1},i=n._zod.run({value:t,issues:[]},a);if(i instanceof Promise)throw new T;if(i.issues.length){const n=new((null==r?void 0:r.Err)??e)(i.issues.map((e=>Q(e,a,I()))));throw M(n,null==r?void 0:r.callee),n}return i.value},ie=e=>async(n,t,o,r)=>{const a=o?Object.assign(o,{async:!0}):{async:!0};let i=n._zod.run({value:t,issues:[]},a);if(i instanceof Promise&&(i=await i),i.issues.length){const n=new((null==r?void 0:r.Err)??e)(i.issues.map((e=>Q(e,a,I()))));throw M(n,null==r?void 0:r.callee),n}return i.value},se=e=>(n,t,o)=>{const r=o?{...o,async:!1}:{async:!1},a=n._zod.run({value:t,issues:[]},r);if(a instanceof Promise)throw new T;return a.issues.length?{success:!1,error:new(e??oe)(a.issues.map((e=>Q(e,r,I()))))}:{success:!0,data:a.value}},ce=se(re),de=e=>async(n,t,o)=>{const r=o?Object.assign(o,{async:!0}):{async:!0};let a=n._zod.run({value:t,issues:[]},r);return a instanceof Promise&&(a=await a),a.issues.length?{success:!1,error:new e(a.issues.map((e=>Q(e,r,I()))))}:{success:!0,data:a.value}},le=de(re),ue=e=>(n,t,o)=>{const r=o?Object.assign(o,{direction:"backward"}):{direction:"backward"};return ae(e)(n,t,r)},pe=e=>(n,t,o)=>ae(e)(n,t,o),fe=e=>async(n,t,o)=>{const r=o?Object.assign(o,{direction:"backward"}):{direction:"backward"};return ie(e)(n,t,r)},he=e=>async(n,t,o)=>ie(e)(n,t,o),me=e=>(n,t,o)=>{const r=o?Object.assign(o,{direction:"backward"}):{direction:"backward"};return se(e)(n,t,r)},ge=e=>(n,t,o)=>se(e)(n,t,o),ve=e=>async(n,t,o)=>{const r=o?Object.assign(o,{direction:"backward"}):{direction:"backward"};return de(e)(n,t,r)},be=e=>async(n,t,o)=>de(e)(n,t,o),ye=/^[cC][^\s-]{8,}$/,we=/^[0-9a-z]+$/,xe=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,_e=/^[0-9a-vA-V]{20}$/,ke=/^[A-Za-z0-9]{27}$/,Ee=/^[a-zA-Z0-9_-]{21}$/,Re=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,Te=/^([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})$/,Oe=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)$/,Se=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/;const Ie=/^(?:(?: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])$/,Ne=/^(([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}|:))$/,ze=/^((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])$/,Ce=/^(([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])$/,Ae=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,je=/^[A-Za-z0-9_-]*$/,Pe=/^\+[1-9]\d{6,14}$/,$e="(?:(?:\\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])))",De=new RegExp(`^${$e}$`);function Fe(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 Le=/^-?\d+$/,Me=/^-?\d+(?:\.\d+)?$/,Ue=/^(?:true|false)$/i,qe=/^[^A-Z]*$/,Be=/^[^a-z]*$/,We=R("$ZodCheck",((e,n)=>{var t;e._zod??(e._zod={}),e._zod.def=n,(t=e._zod).onattach??(t.onattach=[])})),Ze={number:"number",bigint:"bigint",object:"date"},Ve=R("$ZodCheckLessThan",((e,n)=>{We.init(e,n);const t=Ze[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})}})),Ke=R("$ZodCheckGreaterThan",((e,n)=>{We.init(e,n);const t=Ze[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})}})),Je=R("$ZodCheckMultipleOf",((e,n)=>{We.init(e,n),e._zod.onattach.push((e=>{var t;(t=e._zod.bag).multipleOf??(t.multipleOf=n.value)})),e._zod.check=t=>{if(typeof t.value!=typeof n.value)throw new Error("Cannot mix number and bigint in multiple_of check.");("bigint"==typeof t.value?t.value%n.value===BigInt(0):0===function(e,n){const t=(e.toString().split(".")[1]||"").length,o=n.toString();let r=(o.split(".")[1]||"").length;if(0===r&&/\d?e-\d?/.test(o)){const e=o.match(/\d?e-(\d?)/);(null==e?void 0:e[1])&&(r=Number.parseInt(e[1]))}const a=t>r?t:r;return Number.parseInt(e.toFixed(a).replace(".",""))%Number.parseInt(n.toFixed(a).replace(".",""))/10**a}(t.value,n.value))||t.issues.push({origin:typeof t.value,code:"not_multiple_of",divisor:n.value,input:t.value,inst:e,continue:!n.abort})}})),Ge=R("$ZodCheckNumberFormat",((e,n)=>{var t;We.init(e,n),n.format=n.format||"float64";const o=null==(t=n.format)?void 0:t.includes("int"),r=o?"int":"number",[a,i]=G[n.format];e._zod.onattach.push((e=>{const t=e._zod.bag;t.format=n.format,t.minimum=a,t.maximum=i,o&&(t.pattern=Le)})),e._zod.check=t=>{const s=t.value;if(o){if(!Number.isInteger(s))return void t.issues.push({expected:r,format:n.format,code:"invalid_type",continue:!1,input:s,inst:e});if(!Number.isSafeInteger(s))return void(s>0?t.issues.push({input:s,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:r,inclusive:!0,continue:!n.abort}):t.issues.push({input:s,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:r,inclusive:!0,continue:!n.abort}))}s<a&&t.issues.push({origin:"number",input:s,code:"too_small",minimum:a,inclusive:!0,inst:e,continue:!n.abort}),s>i&&t.issues.push({origin:"number",input:s,code:"too_big",maximum:i,inclusive:!0,inst:e,continue:!n.abort})}})),He=R("$ZodCheckMaxLength",((e,n)=>{var t;We.init(e,n),(t=e._zod.def).when??(t.when=e=>{const n=e.value;return!A(n)&&void 0!==n.length}),e._zod.onattach.push((e=>{const t=e._zod.bag.maximum??Number.POSITIVE_INFINITY;n.maximum<t&&(e._zod.bag.maximum=n.maximum)})),e._zod.check=t=>{const o=t.value;if(o.length<=n.maximum)return;const r=ee(o);t.issues.push({origin:r,code:"too_big",maximum:n.maximum,inclusive:!0,input:o,inst:e,continue:!n.abort})}})),Ye=R("$ZodCheckMinLength",((e,n)=>{var t;We.init(e,n),(t=e._zod.def).when??(t.when=e=>{const n=e.value;return!A(n)&&void 0!==n.length}),e._zod.onattach.push((e=>{const t=e._zod.bag.minimum??Number.NEGATIVE_INFINITY;n.minimum>t&&(e._zod.bag.minimum=n.minimum)})),e._zod.check=t=>{const o=t.value;if(o.length>=n.minimum)return;const r=ee(o);t.issues.push({origin:r,code:"too_small",minimum:n.minimum,inclusive:!0,input:o,inst:e,continue:!n.abort})}})),Xe=R("$ZodCheckLengthEquals",((e,n)=>{var t;We.init(e,n),(t=e._zod.def).when??(t.when=e=>{const n=e.value;return!A(n)&&void 0!==n.length}),e._zod.onattach.push((e=>{const t=e._zod.bag;t.minimum=n.length,t.maximum=n.length,t.length=n.length})),e._zod.check=t=>{const o=t.value,r=o.length;if(r===n.length)return;const a=ee(o),i=r>n.length;t.issues.push({origin:a,...i?{code:"too_big",maximum:n.length}:{code:"too_small",minimum:n.length},inclusive:!0,exact:!0,input:t.value,inst:e,continue:!n.abort})}})),Qe=R("$ZodCheckStringFormat",((e,n)=>{var t,o;We.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=()=>{})})),en=R("$ZodCheckRegex",((e,n)=>{Qe.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})}})),nn=R("$ZodCheckLowerCase",((e,n)=>{n.pattern??(n.pattern=qe),Qe.init(e,n)})),tn=R("$ZodCheckUpperCase",((e,n)=>{n.pattern??(n.pattern=Be),Qe.init(e,n)})),on=R("$ZodCheckIncludes",((e,n)=>{We.init(e,n);const t=V(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})}})),rn=R("$ZodCheckStartsWith",((e,n)=>{We.init(e,n);const t=new RegExp(`^${V(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})}})),an=R("$ZodCheckEndsWith",((e,n)=>{We.init(e,n);const t=new RegExp(`.*${V(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})}})),sn=R("$ZodCheckOverwrite",((e,n)=>{We.init(e,n),e._zod.check=e=>{e.value=n.tx(e.value)}}));class cn{constructor(e=[]){this.content=[],this.indent=0,this&&(this.args=e)}indented(e){this.indent+=1,e(this),this.indent-=1}write(e){if("function"==typeof e)return e(this,{execution:"sync"}),void e(this,{execution:"async"});const n=e.split("\n").filter((e=>e)),t=Math.min(...n.map((e=>e.length-e.trimStart().length))),o=n.map((e=>e.slice(t))).map((e=>" ".repeat(2*this.indent)+e));for(const r of o)this.content.push(r)}compile(){return new Function(...null==this?void 0:this.args,[...((null==this?void 0:this.content)??[""]).map((e=>` ${e}`))].join("\n"))}}const dn={major:4,minor:3,patch:6},ln=R("$ZodType",((e,n)=>{var t,o;e??(e={}),e._zod.def=n,e._zod.bag=e._zod.bag||{},e._zod.version=dn;const r=[...e._zod.def.checks??[]];e._zod.traits.has("$ZodCheck")&&r.unshift(e);for(const a of r)for(const n of a._zod.onattach)n(e);if(0===r.length)(o=e._zod).deferred??(o.deferred=[]),null==(t=e._zod.deferred)||t.push((()=>{e._zod.run=e._zod.parse}));else{const n=(e,n,t)=>{let o,r=H(e);for(const a of n){if(a._zod.def.when){if(!a._zod.def.when(e))continue}else if(r)continue;const n=e.issues.length,i=a._zod.check(e);if(i instanceof Promise&&!1===(null==t?void 0:t.async))throw new T;if(o||i instanceof Promise)o=(o??Promise.resolve()).then((async()=>{await i;e.issues.length!==n&&(r||(r=H(e,n)))}));else{if(e.issues.length===n)continue;r||(r=H(e,n))}}return o?o.then((()=>e)):e},t=(t,o,a)=>{if(H(t))return t.aborted=!0,t;const i=n(o,r,a);if(i instanceof Promise){if(!1===a.async)throw new T;return i.then((n=>e._zod.parse(n,a)))}return e._zod.parse(i,a)};e._zod.run=(o,a)=>{if(a.skipChecks)return e._zod.parse(o,a);if("backward"===a.direction){const n=e._zod.parse({value:o.value,issues:[]},{...a,skipChecks:!0});return n instanceof Promise?n.then((e=>t(e,o,a))):t(n,o,a)}const i=e._zod.parse(o,a);if(i instanceof Promise){if(!1===a.async)throw new T;return i.then((e=>n(e,r,a)))}return n(i,r,a)}}$(e,"~standard",(()=>({validate:n=>{var t;try{const o=ce(e,n);return o.success?{value:o.data}:{issues:null==(t=o.error)?void 0:t.issues}}catch(o){return le(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})))})),un=R("$ZodString",((e,n)=>{var t;ln.init(e,n),e._zod.pattern=[...(null==(t=null==e?void 0:e._zod.bag)?void 0:t.patterns)??[]].pop()??(e=>{const n=e?`[\\s\\S]{${(null==e?void 0:e.minimum)??0},${(null==e?void 0:e.maximum)??""}}`:"[\\s\\S]*";return new RegExp(`^${n}$`)})(e._zod.bag),e._zod.parse=(t,o)=>{if(n.coerce)try{t.value=String(t.value)}catch(r){}return"string"==typeof t.value||t.issues.push({expected:"string",code:"invalid_type",input:t.value,inst:e}),t}})),pn=R("$ZodStringFormat",((e,n)=>{Qe.init(e,n),un.init(e,n)})),fn=R("$ZodGUID",((e,n)=>{n.pattern??(n.pattern=Te),pn.init(e,n)})),hn=R("$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=Oe(e))}else n.pattern??(n.pattern=Oe());pn.init(e,n)})),mn=R("$ZodEmail",((e,n)=>{n.pattern??(n.pattern=Se),pn.init(e,n)})),gn=R("$ZodURL",((e,n)=>{pn.init(e,n),e._zod.check=t=>{try{const o=t.value.trim(),r=new URL(o);return n.hostname&&(n.hostname.lastIndex=0,n.hostname.test(r.hostname)||t.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:n.hostname.source,input:t.value,inst:e,continue:!n.abort})),n.protocol&&(n.protocol.lastIndex=0,n.protocol.test(r.protocol.endsWith(":")?r.protocol.slice(0,-1):r.protocol)||t.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:n.protocol.source,input:t.value,inst:e,continue:!n.abort})),void(n.normalize?t.value=r.href:t.value=o)}catch(o){t.issues.push({code:"invalid_format",format:"url",input:t.value,inst:e,continue:!n.abort})}}})),vn=R("$ZodEmoji",((e,n)=>{n.pattern??(n.pattern=new RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),pn.init(e,n)})),bn=R("$ZodNanoID",((e,n)=>{n.pattern??(n.pattern=Ee),pn.init(e,n)})),yn=R("$ZodCUID",((e,n)=>{n.pattern??(n.pattern=ye),pn.init(e,n)})),wn=R("$ZodCUID2",((e,n)=>{n.pattern??(n.pattern=we),pn.init(e,n)})),xn=R("$ZodULID",((e,n)=>{n.pattern??(n.pattern=xe),pn.init(e,n)})),_n=R("$ZodXID",((e,n)=>{n.pattern??(n.pattern=_e),pn.init(e,n)})),kn=R("$ZodKSUID",((e,n)=>{n.pattern??(n.pattern=ke),pn.init(e,n)})),En=R("$ZodISODateTime",((e,n)=>{n.pattern??(n.pattern=function(e){const n=Fe({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(`^${$e}T(?:${o})$`)}(n)),pn.init(e,n)})),Rn=R("$ZodISODate",((e,n)=>{n.pattern??(n.pattern=De),pn.init(e,n)})),Tn=R("$ZodISOTime",((e,n)=>{n.pattern??(n.pattern=new RegExp(`^${Fe(n)}$`)),pn.init(e,n)})),On=R("$ZodISODuration",((e,n)=>{n.pattern??(n.pattern=Re),pn.init(e,n)})),Sn=R("$ZodIPv4",((e,n)=>{n.pattern??(n.pattern=Ie),pn.init(e,n),e._zod.bag.format="ipv4"})),In=R("$ZodIPv6",((e,n)=>{n.pattern??(n.pattern=Ne),pn.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})}}})),Nn=R("$ZodCIDRv4",((e,n)=>{n.pattern??(n.pattern=ze),pn.init(e,n)})),zn=R("$ZodCIDRv6",((e,n)=>{n.pattern??(n.pattern=Ce),pn.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 Cn(e){if(""===e)return!0;if(e.length%4!=0)return!1;try{return atob(e),!0}catch{return!1}}const An=R("$ZodBase64",((e,n)=>{n.pattern??(n.pattern=Ae),pn.init(e,n),e._zod.bag.contentEncoding="base64",e._zod.check=t=>{Cn(t.value)||t.issues.push({code:"invalid_format",format:"base64",input:t.value,inst:e,continue:!n.abort})}}));const jn=R("$ZodBase64URL",((e,n)=>{n.pattern??(n.pattern=je),pn.init(e,n),e._zod.bag.contentEncoding="base64url",e._zod.check=t=>{(function(e){if(!je.test(e))return!1;const n=e.replace(/[-_]/g,(e=>"-"===e?"+":"/"));return Cn(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})}})),Pn=R("$ZodE164",((e,n)=>{n.pattern??(n.pattern=Pe),pn.init(e,n)}));const $n=R("$ZodJWT",((e,n)=>{pn.init(e,n),e._zod.check=t=>{(function(e,n=null){try{const t=e.split(".");if(3!==t.length)return!1;const[o]=t;if(!o)return!1;const r=JSON.parse(atob(o));return!("typ"in r&&"JWT"!==(null==r?void 0:r.typ)||!r.alg||n&&(!("alg"in r)||r.alg!==n))}catch{return!1}})(t.value,n.alg)||t.issues.push({code:"invalid_format",format:"jwt",input:t.value,inst:e,continue:!n.abort})}})),Dn=R("$ZodNumber",((e,n)=>{ln.init(e,n),e._zod.pattern=e._zod.bag.pattern??Me,e._zod.parse=(t,o)=>{if(n.coerce)try{t.value=Number(t.value)}catch(i){}const r=t.value;if("number"==typeof r&&!Number.isNaN(r)&&Number.isFinite(r))return t;const a="number"==typeof r?Number.isNaN(r)?"NaN":Number.isFinite(r)?void 0:"Infinity":void 0;return t.issues.push({expected:"number",code:"invalid_type",input:r,inst:e,...a?{received:a}:{}}),t}})),Fn=R("$ZodNumberFormat",((e,n)=>{Ge.init(e,n),Dn.init(e,n)})),Ln=R("$ZodBoolean",((e,n)=>{ln.init(e,n),e._zod.pattern=Ue,e._zod.parse=(t,o)=>{if(n.coerce)try{t.value=Boolean(t.value)}catch(a){}const r=t.value;return"boolean"==typeof r||t.issues.push({expected:"boolean",code:"invalid_type",input:r,inst:e}),t}})),Mn=R("$ZodAny",((e,n)=>{ln.init(e,n),e._zod.parse=e=>e})),Un=R("$ZodUnknown",((e,n)=>{ln.init(e,n),e._zod.parse=e=>e})),qn=R("$ZodNever",((e,n)=>{ln.init(e,n),e._zod.parse=(n,t)=>(n.issues.push({expected:"never",code:"invalid_type",input:n.value,inst:e}),n)}));function Bn(e,n,t){e.issues.length&&n.issues.push(...Y(t,e.issues)),n.value[t]=e.value}const Wn=R("$ZodArray",((e,n)=>{ln.init(e,n),e._zod.parse=(t,o)=>{const r=t.value;if(!Array.isArray(r))return t.issues.push({expected:"array",code:"invalid_type",input:r,inst:e}),t;t.value=Array(r.length);const a=[];for(let e=0;e<r.length;e++){const i=r[e],s=n.element._zod.run({value:i,issues:[]},o);s instanceof Promise?a.push(s.then((n=>Bn(n,t,e)))):Bn(s,t,e)}return a.length?Promise.all(a).then((()=>t)):t}}));function Zn(e,n,t,o,r){if(e.issues.length){if(r&&!(t in o))return;n.issues.push(...Y(t,e.issues))}void 0===e.value?t in o&&(n.value[t]=void 0):n.value[t]=e.value}function Vn(e){var n,t,o,r;const a=Object.keys(e.shape);for(const c of a)if(!(null==(r=null==(o=null==(t=null==(n=e.shape)?void 0:n[c])?void 0:t._zod)?void 0:o.traits)?void 0:r.has("$ZodType")))throw new Error(`Invalid element at key "${c}": expected a Zod schema`);const i=(s=e.shape,Object.keys(s).filter((e=>"optional"===s[e]._zod.optin&&"optional"===s[e]._zod.optout)));var s;return{...e,keys:a,keySet:new Set(a),numKeys:a.length,optionalKeys:new Set(i)}}function Kn(e,n,t,o,r,a){const i=[],s=r.keySet,c=r.catchall._zod,d=c.def.type,l="optional"===c.optout;for(const u in n){if(s.has(u))continue;if("never"===d){i.push(u);continue}const r=c.run({value:n[u],issues:[]},o);r instanceof Promise?e.push(r.then((e=>Zn(e,t,u,n,l)))):Zn(r,t,u,n,l)}return i.length&&t.issues.push({code:"unrecognized_keys",keys:i,input:n,inst:a}),e.length?Promise.all(e).then((()=>t)):t}const Jn=R("$ZodObject",((e,n)=>{ln.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=C((()=>Vn(n)));$(e._zod,"propValues",(()=>{const e=n.shape,t={};for(const n in e){const o=e[n]._zod;if(o.values){t[n]??(t[n]=new Set);for(const e of o.values)t[n].add(e)}}return t}));const r=U,a=n.catchall;let i;e._zod.parse=(n,t)=>{i??(i=o.value);const s=n.value;if(!r(s))return n.issues.push({expected:"object",code:"invalid_type",input:s,inst:e}),n;n.value={};const c=[],d=i.shape;for(const e of i.keys){const o=d[e],r="optional"===o._zod.optout,a=o._zod.run({value:s[e],issues:[]},t);a instanceof Promise?c.push(a.then((t=>Zn(t,n,e,s,r)))):Zn(a,n,e,s,r)}return a?Kn(c,s,n,t,o.value,e):c.length?Promise.all(c).then((()=>n)):n}})),Gn=R("$ZodObjectJIT",((e,n)=>{Jn.init(e,n);const t=e._zod.parse,o=C((()=>Vn(n)));let r;const a=U,i=!S.jitless,s=i&&q.value,c=n.catchall;let d;e._zod.parse=(l,u)=>{d??(d=o.value);const p=l.value;return a(p)?i&&s&&!1===(null==u?void 0:u.async)&&!0!==u.jitless?(r||(r=(e=>{var n;const t=new cn(["shape","payload","ctx"]),r=o.value,a=e=>{const n=L(e);return`shape[${n}]._zod.run({ value: input[${n}], issues: [] }, ctx)`};t.write("const input = payload.value;");const i=Object.create(null);let s=0;for(const o of r.keys)i[o]="key_"+s++;t.write("const newResult = {};");for(const o of r.keys){const r=i[o],s=L(o),c=e[o],d="optional"===(null==(n=null==c?void 0:c._zod)?void 0:n.optout);t.write(`const ${r} = ${a(o)};`),d?t.write(`\n if (${r}.issues.length) {\n if (${s} in input) {\n payload.issues = payload.issues.concat(${r}.issues.map(iss => ({\n ...iss,\n path: iss.path ? [${s}, ...iss.path] : [${s}]\n })));\n }\n }\n \n if (${r}.value === undefined) {\n if (${s} in input) {\n newResult[${s}] = undefined;\n }\n } else {\n newResult[${s}] = ${r}.value;\n }\n \n `):t.write(`\n if (${r}.issues.length) {\n payload.issues = payload.issues.concat(${r}.issues.map(iss => ({\n ...iss,\n path: iss.path ? [${s}, ...iss.path] : [${s}]\n })));\n }\n \n if (${r}.value === undefined) {\n if (${s} in input) {\n newResult[${s}] = undefined;\n }\n } else {\n newResult[${s}] = ${r}.value;\n }\n \n `)}t.write("payload.value = newResult;"),t.write("return payload;");const c=t.compile();return(n,t)=>c(e,n,t)})(n.shape)),l=r(l,u),c?Kn([],p,l,u,d,e):l):t(l,u):(l.issues.push({expected:"object",code:"invalid_type",input:p,inst:e}),l)}}));function Hn(e,n,t,o){for(const a of e)if(0===a.issues.length)return n.value=a.value,n;const r=e.filter((e=>!H(e)));return 1===r.length?(n.value=r[0].value,r[0]):(n.issues.push({code:"invalid_union",input:n.value,inst:t,errors:e.map((e=>e.issues.map((e=>Q(e,o,I())))))}),n)}const Yn=R("$ZodUnion",((e,n)=>{ln.init(e,n),$(e._zod,"optin",(()=>n.options.some((e=>"optional"===e._zod.optin))?"optional":void 0)),$(e._zod,"optout",(()=>n.options.some((e=>"optional"===e._zod.optout))?"optional":void 0)),$(e._zod,"values",(()=>{if(n.options.every((e=>e._zod.values)))return new Set(n.options.flatMap((e=>Array.from(e._zod.values))))})),$(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=>j(e.source))).join("|")})$`)}}));const t=1===n.options.length,o=n.options[0]._zod.run;e._zod.parse=(r,a)=>{if(t)return o(r,a);let i=!1;const s=[];for(const e of n.options){const n=e._zod.run({value:r.value,issues:[]},a);if(n instanceof Promise)s.push(n),i=!0;else{if(0===n.issues.length)return n;s.push(n)}}return i?Promise.all(s).then((n=>Hn(n,r,e,a))):Hn(s,r,e,a)}})),Xn=R("$ZodIntersection",((e,n)=>{ln.init(e,n),e._zod.parse=(e,t)=>{const o=e.value,r=n.left._zod.run({value:o,issues:[]},t),a=n.right._zod.run({value:o,issues:[]},t);return r instanceof Promise||a instanceof Promise?Promise.all([r,a]).then((([n,t])=>et(e,n,t))):et(e,r,a)}}));function Qn(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(B(e)&&B(n)){const t=Object.keys(n),o=Object.keys(e).filter((e=>-1!==t.indexOf(e))),r={...e,...n};for(const a of o){const t=Qn(e[a],n[a]);if(!t.valid)return{valid:!1,mergeErrorPath:[a,...t.mergeErrorPath]};r[a]=t.data}return{valid:!0,data:r}}if(Array.isArray(e)&&Array.isArray(n)){if(e.length!==n.length)return{valid:!1,mergeErrorPath:[]};const t=[];for(let o=0;o<e.length;o++){const r=Qn(e[o],n[o]);if(!r.valid)return{valid:!1,mergeErrorPath:[o,...r.mergeErrorPath]};t.push(r.data)}return{valid:!0,data:t}}return{valid:!1,mergeErrorPath:[]}}function et(e,n,t){const o=new Map;let r;for(const s of n.issues)if("unrecognized_keys"===s.code){r??(r=s);for(const e of s.keys)o.has(e)||o.set(e,{}),o.get(e).l=!0}else e.issues.push(s);for(const s of t.issues)if("unrecognized_keys"===s.code)for(const e of s.keys)o.has(e)||o.set(e,{}),o.get(e).r=!0;else e.issues.push(s);const a=[...o].filter((([,e])=>e.l&&e.r)).map((([e])=>e));if(a.length&&r&&e.issues.push({...r,keys:a}),H(e))return e;const i=Qn(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 nt=R("$ZodEnum",((e,n)=>{ln.init(e,n);const t=N(n.entries),o=new Set(t);e._zod.values=o,e._zod.pattern=new RegExp(`^(${t.filter((e=>Z.has(typeof e))).map((e=>"string"==typeof e?V(e):e.toString())).join("|")})$`),e._zod.parse=(n,r)=>{const a=n.value;return o.has(a)||n.issues.push({code:"invalid_value",values:t,input:a,inst:e}),n}})),tt=R("$ZodTransform",((e,n)=>{ln.init(e,n),e._zod.parse=(t,o)=>{if("backward"===o.direction)throw new O(e.constructor.name);const r=n.transform(t.value,t);if(o.async){return(r instanceof Promise?r:Promise.resolve(r)).then((e=>(t.value=e,t)))}if(r instanceof Promise)throw new T;return t.value=r,t}}));function ot(e,n){return e.issues.length&&void 0===n?{issues:[],value:void 0}:e}const rt=R("$ZodOptional",((e,n)=>{ln.init(e,n),e._zod.optin="optional",e._zod.optout="optional",$(e._zod,"values",(()=>n.innerType._zod.values?new Set([...n.innerType._zod.values,void 0]):void 0)),$(e._zod,"pattern",(()=>{const e=n.innerType._zod.pattern;return e?new RegExp(`^(${j(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=>ot(n,e.value))):ot(o,e.value)}return void 0===e.value?e:n.innerType._zod.run(e,t)}})),at=R("$ZodExactOptional",((e,n)=>{rt.init(e,n),$(e._zod,"values",(()=>n.innerType._zod.values)),$(e._zod,"pattern",(()=>n.innerType._zod.pattern)),e._zod.parse=(e,t)=>n.innerType._zod.run(e,t)})),it=R("$ZodNullable",((e,n)=>{ln.init(e,n),$(e._zod,"optin",(()=>n.innerType._zod.optin)),$(e._zod,"optout",(()=>n.innerType._zod.optout)),$(e._zod,"pattern",(()=>{const e=n.innerType._zod.pattern;return e?new RegExp(`^(${j(e.source)}|null)$`):void 0})),$(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)})),st=R("$ZodDefault",((e,n)=>{ln.init(e,n),e._zod.optin="optional",$(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=>ct(e,n))):ct(o,n)}}));function ct(e,n){return void 0===e.value&&(e.value=n.defaultValue),e}const dt=R("$ZodPrefault",((e,n)=>{ln.init(e,n),e._zod.optin="optional",$(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))})),lt=R("$ZodNonOptional",((e,n)=>{ln.init(e,n),$(e._zod,"values",(()=>{const e=n.innerType._zod.values;return e?new Set([...e].filter((e=>void 0!==e))):void 0})),e._zod.parse=(t,o)=>{const r=n.innerType._zod.run(t,o);return r instanceof Promise?r.then((n=>ut(n,e))):ut(r,e)}}));function ut(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 pt=R("$ZodCatch",((e,n)=>{ln.init(e,n),$(e._zod,"optin",(()=>n.innerType._zod.optin)),$(e._zod,"optout",(()=>n.innerType._zod.optout)),$(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=>Q(e,t,I())))},input:e.value}),e.issues=[]),e))):(e.value=o.value,o.issues.length&&(e.value=n.catchValue({...e,error:{issues:o.issues.map((e=>Q(e,t,I())))},input:e.value}),e.issues=[]),e)}})),ft=R("$ZodPipe",((e,n)=>{ln.init(e,n),$(e._zod,"values",(()=>n.in._zod.values)),$(e._zod,"optin",(()=>n.in._zod.optin)),$(e._zod,"optout",(()=>n.out._zod.optout)),$(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=>ht(e,n.in,t))):ht(o,n.in,t)}const o=n.in._zod.run(e,t);return o instanceof Promise?o.then((e=>ht(e,n.out,t))):ht(o,n.out,t)}}));function ht(e,n,t){return e.issues.length?(e.aborted=!0,e):n._zod.run({value:e.value,issues:e.issues},t)}const mt=R("$ZodReadonly",((e,n)=>{ln.init(e,n),$(e._zod,"propValues",(()=>n.innerType._zod.propValues)),$(e._zod,"values",(()=>n.innerType._zod.values)),$(e._zod,"optin",(()=>{var e,t;return null==(t=null==(e=n.innerType)?void 0:e._zod)?void 0:t.optin})),$(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(gt):gt(o)}}));function gt(e){return e.value=Object.freeze(e.value),e}const vt=R("$ZodCustom",((e,n)=>{We.init(e,n),ln.init(e,n),e._zod.parse=(e,n)=>e,e._zod.check=t=>{const o=t.value,r=n.fn(o);if(r instanceof Promise)return r.then((n=>bt(n,t,o,e)));bt(r,t,o,e)}}));function bt(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(ne(e))}}var yt;class wt{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)}}(yt=globalThis).__zod_globalRegistry??(yt.__zod_globalRegistry=new wt);const xt=globalThis.__zod_globalRegistry;function _t(e,n){return new e({type:"string",...J(n)})}function kt(e,n){return new e({type:"string",format:"email",check:"string_format",abort:!1,...J(n)})}function Et(e,n){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...J(n)})}function Rt(e,n){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...J(n)})}function Tt(e,n){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...J(n)})}function Ot(e,n){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...J(n)})}function St(e,n){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...J(n)})}function It(e,n){return new e({type:"string",format:"url",check:"string_format",abort:!1,...J(n)})}function Nt(e,n){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...J(n)})}function zt(e,n){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...J(n)})}function Ct(e,n){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...J(n)})}function At(e,n){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...J(n)})}function jt(e,n){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...J(n)})}function Pt(e,n){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...J(n)})}function $t(e,n){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...J(n)})}function Dt(e,n){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...J(n)})}function Ft(e,n){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...J(n)})}function Lt(e,n){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...J(n)})}function Mt(e,n){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...J(n)})}function Ut(e,n){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...J(n)})}function qt(e,n){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...J(n)})}function Bt(e,n){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...J(n)})}function Wt(e,n){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...J(n)})}function Zt(e,n){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...J(n)})}function Vt(e,n){return new e({type:"string",format:"date",check:"string_format",...J(n)})}function Kt(e,n){return new e({type:"string",format:"time",check:"string_format",precision:null,...J(n)})}function Jt(e,n){return new e({type:"string",format:"duration",check:"string_format",...J(n)})}function Gt(e,n){return new e({type:"number",checks:[],...J(n)})}function Ht(e,n){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...J(n)})}function Yt(e,n){return new e({type:"boolean",...J(n)})}function Xt(e){return new e({type:"any"})}function Qt(e){return new e({type:"unknown"})}function eo(e,n){return new e({type:"never",...J(n)})}function no(e,n){return new Ve({check:"less_than",...J(n),value:e,inclusive:!1})}function to(e,n){return new Ve({check:"less_than",...J(n),value:e,inclusive:!0})}function oo(e,n){return new Ke({check:"greater_than",...J(n),value:e,inclusive:!1})}function ro(e,n){return new Ke({check:"greater_than",...J(n),value:e,inclusive:!0})}function ao(e,n){return new Je({check:"multiple_of",...J(n),value:e})}function io(e,n){return new He({check:"max_length",...J(n),maximum:e})}function so(e,n){return new Ye({check:"min_length",...J(n),minimum:e})}function co(e,n){return new Xe({check:"length_equals",...J(n),length:e})}function lo(e,n){return new en({check:"string_format",format:"regex",...J(n),pattern:e})}function uo(e){return new nn({check:"string_format",format:"lowercase",...J(e)})}function po(e){return new tn({check:"string_format",format:"uppercase",...J(e)})}function fo(e,n){return new on({check:"string_format",format:"includes",...J(n),includes:e})}function ho(e,n){return new rn({check:"string_format",format:"starts_with",...J(n),prefix:e})}function mo(e,n){return new an({check:"string_format",format:"ends_with",...J(n),suffix:e})}function go(e){return new sn({check:"overwrite",tx:e})}function vo(e){return go((n=>n.normalize(e)))}function bo(){return go((e=>e.trim()))}function yo(){return go((e=>e.toLowerCase()))}function wo(){return go((e=>e.toUpperCase()))}function xo(){return go((e=>function(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}(e)))}function _o(e,n,t){return new e({type:"array",element:n,...J(t)})}function ko(e,n,t){return new e({type:"custom",check:"custom",fn:n,...J(t)})}function Eo(e){const n=Ro((t=>(t.addIssue=e=>{if("string"==typeof e)t.issues.push(ne(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(ne(o))}},e(t.value,t))));return n}function Ro(e,n){const t=new We({check:"custom",...J(n)});return t._zod.check=e,t}function To(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)??xt,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 Oo(e,n,t={path:[],schemaPath:[]}){var o,r,a;const i=e._zod.def,s=n.seen.get(e);if(s){s.count++;return t.schemaPath.includes(e)&&(s.cycle=t.path),s.schema}const c={schema:{},count:1,cycle:void 0,path:t.path};n.seen.set(e,c);const d=null==(r=(o=e._zod).toJSONSchema)?void 0:r.call(o);if(d)c.schema=d;else{const o={...t,schemaPath:[...t.schemaPath,e],path:t.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(n,c.schema,o);else{const t=c.schema,r=n.processors[i.type];if(!r)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${i.type}`);r(e,n,t,o)}const r=e._zod.parent;r&&(c.ref||(c.ref=r),Oo(r,n,o),n.seen.get(r).isParent=!0)}const l=n.metadataRegistry.get(e);l&&Object.assign(c.schema,l),"input"===n.io&&No(e)&&(delete c.schema.examples,delete c.schema.default),"input"===n.io&&c.schema._prefault&&((a=c.schema).default??(a.default=c.schema._prefault)),delete c.schema._prefault;return n.seen.get(e).schema}function So(e,n){var t,o,r,a;const i=e.seen.get(n);if(!i)throw new Error("Unprocessed schema. This is a bug in Zod.");const s=new Map;for(const d of e.seen.entries()){const n=null==(t=e.metadataRegistry.get(d[0]))?void 0:t.id;if(n){const e=s.get(n);if(e&&e!==d[0])throw new Error(`Duplicate schema id "${n}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);s.set(n,d[0])}}const c=n=>{if(n[1].schema.$ref)return;const t=n[1],{ref:o,defId:r}=(n=>{var t;const o="draft-2020-12"===e.target?"$defs":"definitions";if(e.external){const r=null==(t=e.external.registry.get(n[0]))?void 0:t.id,a=e.external.uri??(e=>e);if(r)return{ref:a(r)};const i=n[1].defId??n[1].schema.id??"schema"+e.counter++;return n[1].defId=i,{defId:i,ref:`${a("__shared")}#/${o}/${i}`}}if(n[1]===i)return{ref:"#"};const r=`#/${o}/`,a=n[1].schema.id??"__schema"+e.counter++;return{defId:a,ref:r+a}})(n);t.def={...t.schema},r&&(t.defId=r);const a=t.schema;for(const e in a)delete a[e];a.$ref=o};if("throw"===e.cycles)for(const d of e.seen.entries()){const e=d[1];if(e.cycle)throw new Error(`Cycle detected: #/${null==(o=e.cycle)?void 0:o.join("/")}/<root>\n\nSet the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(const d of e.seen.entries()){const t=d[1];if(n===d[0]){c(d);continue}if(e.external){const t=null==(r=e.external.registry.get(d[0]))?void 0:r.id;if(n!==d[0]&&t){c(d);continue}}(null==(a=e.metadataRegistry.get(d[0]))?void 0:a.id)?c(d):(t.cycle||t.count>1&&"ref"===e.reused)&&c(d)}}function Io(e,n){var t,o,r;const a=e.seen.get(n);if(!a)throw new Error("Unprocessed schema. This is a bug in Zod.");const i=n=>{const t=e.seen.get(n);if(null===t.ref)return;const o=t.def??t.schema,r={...o},a=t.ref;if(t.ref=null,a){i(a);const t=e.seen.get(a),s=t.schema;!s.$ref||"draft-07"!==e.target&&"draft-04"!==e.target&&"openapi-3.0"!==e.target?Object.assign(o,s):(o.allOf=o.allOf??[],o.allOf.push(s)),Object.assign(o,r);if(n._zod.parent===a)for(const e in o)"$ref"!==e&&"allOf"!==e&&(e in r||delete o[e]);if(s.$ref&&t.def)for(const e in o)"$ref"!==e&&"allOf"!==e&&e in t.def&&JSON.stringify(o[e])===JSON.stringify(t.def[e])&&delete o[e]}const s=n._zod.parent;if(s&&s!==a){i(s);const n=e.seen.get(s);if((null==n?void 0:n.schema.$ref)&&(o.$ref=n.schema.$ref,n.def))for(const e in o)"$ref"!==e&&"allOf"!==e&&e in n.def&&JSON.stringify(o[e])===JSON.stringify(n.def[e])&&delete o[e]}e.override({zodSchema:n,jsonSchema:o,path:t.path??[]})};for(const l of[...e.seen.entries()].reverse())i(l[0]);const s={};if("draft-2020-12"===e.target?s.$schema="https://json-schema.org/draft/2020-12/schema":"draft-07"===e.target?s.$schema="http://json-schema.org/draft-07/schema#":"draft-04"===e.target?s.$schema="http://json-schema.org/draft-04/schema#":e.target,null==(t=e.external)?void 0:t.uri){const t=null==(o=e.external.registry.get(n))?void 0:o.id;if(!t)throw new Error("Schema is missing an `id` property");s.$id=e.external.uri(t)}Object.assign(s,a.def??a.schema);const c=(null==(r=e.external)?void 0:r.defs)??{};for(const l of e.seen.entries()){const e=l[1];e.def&&e.defId&&(c[e.defId]=e.def)}e.external||Object.keys(c).length>0&&("draft-2020-12"===e.target?s.$defs=c:s.definitions=c);try{const t=JSON.parse(JSON.stringify(s));return Object.defineProperty(t,"~standard",{value:{...n["~standard"],jsonSchema:{input:zo(n,"input",e.processors),output:zo(n,"output",e.processors)}},enumerable:!1,writable:!1}),t}catch(d){throw new Error("Error converting schema to JSON.")}}function No(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 No(o.element,t);if("set"===o.type)return No(o.valueType,t);if("lazy"===o.type)return No(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 No(o.innerType,t);if("intersection"===o.type)return No(o.left,t)||No(o.right,t);if("record"===o.type||"map"===o.type)return No(o.keyType,t)||No(o.valueType,t);if("pipe"===o.type)return No(o.in,t)||No(o.out,t);if("object"===o.type){for(const e in o.shape)if(No(o.shape[e],t))return!0;return!1}if("union"===o.type){for(const e of o.options)if(No(e,t))return!0;return!1}if("tuple"===o.type){for(const e of o.items)if(No(e,t))return!0;return!(!o.rest||!No(o.rest,t))}return!1}const zo=(e,n,t={})=>o=>{const{libraryOptions:r,target:a}=o??{},i=To({...r??{},target:a,io:n,processors:t});return Oo(e,i),So(i,e),Io(i,e)},Co={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},Ao=(e,n,t,o)=>{const r=e._zod.def;Oo(r.innerType,n,o);n.seen.get(e).ref=r.innerType},jo=R("ZodISODateTime",((e,n)=>{En.init(e,n),nr.init(e,n)}));const Po=R("ZodISODate",((e,n)=>{Rn.init(e,n),nr.init(e,n)}));const $o=R("ZodISOTime",((e,n)=>{Tn.init(e,n),nr.init(e,n)}));const Do=R("ZodISODuration",((e,n)=>{On.init(e,n),nr.init(e,n)}));const Fo=R("ZodError",((e,n)=>{oe.init(e,n),e.name="ZodError",Object.defineProperties(e,{format:{value:n=>function(e,n=e=>e.message){const t={_errors:[]},o=e=>{for(const r of e.issues)if("invalid_union"===r.code&&r.errors.length)r.errors.map((e=>o({issues:e})));else if("invalid_key"===r.code)o({issues:r.issues});else if("invalid_element"===r.code)o({issues:r.issues});else if(0===r.path.length)t._errors.push(n(r));else{let e=t,o=0;for(;o<r.path.length;){const t=r.path[o];o===r.path.length-1?(e[t]=e[t]||{_errors:[]},e[t]._errors.push(n(r))):e[t]=e[t]||{_errors:[]},e=e[t],o++}}};return o(e),t}(e,n)},flatten:{value:n=>function(e,n=e=>e.message){const t={},o=[];for(const r of e.issues)r.path.length>0?(t[r.path[0]]=t[r.path[0]]||[],t[r.path[0]].push(n(r))):o.push(n(r));return{formErrors:o,fieldErrors:t}}(e,n)},addIssue:{value:n=>{e.issues.push(n),e.message=JSON.stringify(e.issues,z,2)}},addIssues:{value:n=>{e.issues.push(...n),e.message=JSON.stringify(e.issues,z,2)}},isEmpty:{get:()=>0===e.issues.length}})}),{Parent:Error}),Lo=ae(Fo),Mo=ie(Fo),Uo=se(Fo),qo=de(Fo),Bo=ue(Fo),Wo=pe(Fo),Zo=fe(Fo),Vo=he(Fo),Ko=me(Fo),Jo=ge(Fo),Go=ve(Fo),Ho=be(Fo),Yo=R("ZodType",((e,n)=>(ln.init(e,n),Object.assign(e["~standard"],{jsonSchema:{input:zo(e,"input"),output:zo(e,"output")}}),e.toJSONSchema=((e,n={})=>t=>{const o=To({...t,processors:n});return Oo(e,o),So(o,e),Io(o,e)})(e,{}),e.def=n,e.type=n.type,Object.defineProperty(e,"_def",{value:n}),e.check=(...t)=>e.clone(F(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)=>K(e,n,t),e.brand=()=>e,e.register=(n,t)=>(n.add(e,t),e),e.parse=(n,t)=>Lo(e,n,t,{callee:e.parse}),e.safeParse=(n,t)=>Uo(e,n,t),e.parseAsync=async(n,t)=>Mo(e,n,t,{callee:e.parseAsync}),e.safeParseAsync=async(n,t)=>qo(e,n,t),e.spa=e.safeParseAsync,e.encode=(n,t)=>Bo(e,n,t),e.decode=(n,t)=>Wo(e,n,t),e.encodeAsync=async(n,t)=>Zo(e,n,t),e.decodeAsync=async(n,t)=>Vo(e,n,t),e.safeEncode=(n,t)=>Ko(e,n,t),e.safeDecode=(n,t)=>Jo(e,n,t),e.safeEncodeAsync=async(n,t)=>Go(e,n,t),e.safeDecodeAsync=async(n,t)=>Ho(e,n,t),e.refine=(n,t)=>e.check(function(e,n={}){return ko(Gr,e,n)}(n,t)),e.superRefine=n=>e.check(Eo(n)),e.overwrite=n=>e.check(go(n)),e.optional=()=>Fr(e),e.exactOptional=()=>new Lr({type:"optional",innerType:e}),e.nullable=()=>Ur(e),e.nullish=()=>Fr(Ur(e)),e.nonoptional=n=>function(e,n){return new Wr({type:"nonoptional",innerType:e,...J(n)})}(e,n),e.array=()=>{return _o(Nr,e,n);var n},e.or=n=>{return new Ar({type:"union",options:[e,n],...J(t)});var t},e.and=n=>new jr({type:"intersection",left:e,right:n}),e.transform=n=>Kr(e,new $r({type:"transform",transform:n})),e.default=n=>{return t=n,new qr({type:"default",innerType:e,get defaultValue(){return"function"==typeof t?t():W(t)}});var t},e.prefault=n=>{return t=n,new Br({type:"prefault",innerType:e,get defaultValue(){return"function"==typeof t?t():W(t)}});var t},e.catch=n=>{return new Zr({type:"catch",innerType:e,catchValue:"function"==typeof(t=n)?t:()=>t});var t},e.pipe=n=>Kr(e,n),e.readonly=()=>new Jr({type:"readonly",innerType:e}),e.describe=n=>{const t=e.clone();return xt.add(t,{description:n}),t},Object.defineProperty(e,"description",{get(){var n;return null==(n=xt.get(e))?void 0:n.description},configurable:!0}),e.meta=(...n)=>{if(0===n.length)return xt.get(e);const t=e.clone();return xt.add(t,n[0]),t},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e.apply=n=>n(e),e))),Xo=R("_ZodString",((e,n)=>{un.init(e,n),Yo.init(e,n),e._zod.processJSONSchema=(n,t,o)=>((e,n,t)=>{const o=t;o.type="string";const{minimum:r,maximum:a,format:i,patterns:s,contentEncoding:c}=e._zod.bag;if("number"==typeof r&&(o.minLength=r),"number"==typeof a&&(o.maxLength=a),i&&(o.format=Co[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(lo(...n)),e.includes=(...n)=>e.check(fo(...n)),e.startsWith=(...n)=>e.check(ho(...n)),e.endsWith=(...n)=>e.check(mo(...n)),e.min=(...n)=>e.check(so(...n)),e.max=(...n)=>e.check(io(...n)),e.length=(...n)=>e.check(co(...n)),e.nonempty=(...n)=>e.check(so(1,...n)),e.lowercase=n=>e.check(uo(n)),e.uppercase=n=>e.check(po(n)),e.trim=()=>e.check(bo()),e.normalize=(...n)=>e.check(vo(...n)),e.toLowerCase=()=>e.check(yo()),e.toUpperCase=()=>e.check(wo()),e.slugify=()=>e.check(xo())})),Qo=R("ZodString",((e,n)=>{un.init(e,n),Xo.init(e,n),e.email=n=>e.check(kt(tr,n)),e.url=n=>e.check(It(ar,n)),e.jwt=n=>e.check(Wt(wr,n)),e.emoji=n=>e.check(Nt(ir,n)),e.guid=n=>e.check(Et(or,n)),e.uuid=n=>e.check(Rt(rr,n)),e.uuidv4=n=>e.check(Tt(rr,n)),e.uuidv6=n=>e.check(Ot(rr,n)),e.uuidv7=n=>e.check(St(rr,n)),e.nanoid=n=>e.check(zt(sr,n)),e.guid=n=>e.check(Et(or,n)),e.cuid=n=>e.check(Ct(cr,n)),e.cuid2=n=>e.check(At(dr,n)),e.ulid=n=>e.check(jt(lr,n)),e.base64=n=>e.check(Ut(vr,n)),e.base64url=n=>e.check(qt(br,n)),e.xid=n=>e.check(Pt(ur,n)),e.ksuid=n=>e.check($t(pr,n)),e.ipv4=n=>e.check(Dt(fr,n)),e.ipv6=n=>e.check(Ft(hr,n)),e.cidrv4=n=>e.check(Lt(mr,n)),e.cidrv6=n=>e.check(Mt(gr,n)),e.e164=n=>e.check(Bt(yr,n)),e.datetime=n=>e.check(function(e){return Zt(jo,e)}(n)),e.date=n=>e.check(function(e){return Vt(Po,e)}(n)),e.time=n=>e.check(function(e){return Kt($o,e)}(n)),e.duration=n=>e.check(function(e){return Jt(Do,e)}(n))}));function er(e){return _t(Qo,e)}const nr=R("ZodStringFormat",((e,n)=>{pn.init(e,n),Xo.init(e,n)})),tr=R("ZodEmail",((e,n)=>{mn.init(e,n),nr.init(e,n)})),or=R("ZodGUID",((e,n)=>{fn.init(e,n),nr.init(e,n)})),rr=R("ZodUUID",((e,n)=>{hn.init(e,n),nr.init(e,n)})),ar=R("ZodURL",((e,n)=>{gn.init(e,n),nr.init(e,n)})),ir=R("ZodEmoji",((e,n)=>{vn.init(e,n),nr.init(e,n)})),sr=R("ZodNanoID",((e,n)=>{bn.init(e,n),nr.init(e,n)})),cr=R("ZodCUID",((e,n)=>{yn.init(e,n),nr.init(e,n)})),dr=R("ZodCUID2",((e,n)=>{wn.init(e,n),nr.init(e,n)})),lr=R("ZodULID",((e,n)=>{xn.init(e,n),nr.init(e,n)})),ur=R("ZodXID",((e,n)=>{_n.init(e,n),nr.init(e,n)})),pr=R("ZodKSUID",((e,n)=>{kn.init(e,n),nr.init(e,n)})),fr=R("ZodIPv4",((e,n)=>{Sn.init(e,n),nr.init(e,n)})),hr=R("ZodIPv6",((e,n)=>{In.init(e,n),nr.init(e,n)})),mr=R("ZodCIDRv4",((e,n)=>{Nn.init(e,n),nr.init(e,n)})),gr=R("ZodCIDRv6",((e,n)=>{zn.init(e,n),nr.init(e,n)})),vr=R("ZodBase64",((e,n)=>{An.init(e,n),nr.init(e,n)})),br=R("ZodBase64URL",((e,n)=>{jn.init(e,n),nr.init(e,n)})),yr=R("ZodE164",((e,n)=>{Pn.init(e,n),nr.init(e,n)})),wr=R("ZodJWT",((e,n)=>{$n.init(e,n),nr.init(e,n)})),xr=R("ZodNumber",((e,n)=>{Dn.init(e,n),Yo.init(e,n),e._zod.processJSONSchema=(n,t,o)=>((e,n,t)=>{const o=t,{minimum:r,maximum:a,format:i,multipleOf:s,exclusiveMaximum:c,exclusiveMinimum:d}=e._zod.bag;"string"==typeof i&&i.includes("int")?o.type="integer":o.type="number","number"==typeof d&&("draft-04"===n.target||"openapi-3.0"===n.target?(o.minimum=d,o.exclusiveMinimum=!0):o.exclusiveMinimum=d),"number"==typeof r&&(o.minimum=r,"number"==typeof d&&"draft-04"!==n.target&&(d>=r?delete o.minimum:delete o.exclusiveMinimum)),"number"==typeof c&&("draft-04"===n.target||"openapi-3.0"===n.target?(o.maximum=c,o.exclusiveMaximum=!0):o.exclusiveMaximum=c),"number"==typeof a&&(o.maximum=a,"number"==typeof c&&"draft-04"!==n.target&&(c<=a?delete o.maximum:delete o.exclusiveMaximum)),"number"==typeof s&&(o.multipleOf=s)})(e,n,t),e.gt=(n,t)=>e.check(oo(n,t)),e.gte=(n,t)=>e.check(ro(n,t)),e.min=(n,t)=>e.check(ro(n,t)),e.lt=(n,t)=>e.check(no(n,t)),e.lte=(n,t)=>e.check(to(n,t)),e.max=(n,t)=>e.check(to(n,t)),e.int=n=>e.check(kr(n)),e.safe=n=>e.check(kr(n)),e.positive=n=>e.check(oo(0,n)),e.nonnegative=n=>e.check(ro(0,n)),e.negative=n=>e.check(no(0,n)),e.nonpositive=n=>e.check(to(0,n)),e.multipleOf=(n,t)=>e.check(ao(n,t)),e.step=(n,t)=>e.check(ao(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 _r=R("ZodNumberFormat",((e,n)=>{Fn.init(e,n),xr.init(e,n)}));function kr(e){return Ht(_r,e)}const Er=R("ZodBoolean",((e,n)=>{Ln.init(e,n),Yo.init(e,n),e._zod.processJSONSchema=(e,n,t)=>((e,n,t)=>{t.type="boolean"})(0,0,n)}));function Rr(e){return Yt(Er,e)}const Tr=R("ZodAny",((e,n)=>{Mn.init(e,n),Yo.init(e,n),e._zod.processJSONSchema=(e,n,t)=>{}}));const Or=R("ZodUnknown",((e,n)=>{Un.init(e,n),Yo.init(e,n),e._zod.processJSONSchema=(e,n,t)=>{}}));function Sr(){return Qt(Or)}const Ir=R("ZodNever",((e,n)=>{qn.init(e,n),Yo.init(e,n),e._zod.processJSONSchema=(e,n,t)=>((e,n,t)=>{t.not={}})(0,0,n)}));const Nr=R("ZodArray",((e,n)=>{Wn.init(e,n),Yo.init(e,n),e._zod.processJSONSchema=(n,t,o)=>((e,n,t,o)=>{const r=t,a=e._zod.def,{minimum:i,maximum:s}=e._zod.bag;"number"==typeof i&&(r.minItems=i),"number"==typeof s&&(r.maxItems=s),r.type="array",r.items=Oo(a.element,n,{...o,path:[...o.path,"items"]})})(e,n,t,o),e.element=n.element,e.min=(n,t)=>e.check(so(n,t)),e.nonempty=n=>e.check(so(1,n)),e.max=(n,t)=>e.check(io(n,t)),e.length=(n,t)=>e.check(co(n,t)),e.unwrap=()=>e.element}));const zr=R("ZodObject",((e,n)=>{Gn.init(e,n),Yo.init(e,n),e._zod.processJSONSchema=(n,t,o)=>((e,n,t,o)=>{var r;const a=t,i=e._zod.def;a.type="object",a.properties={};const s=i.shape;for(const l in s)a.properties[l]=Oo(s[l],n,{...o,path:[...o.path,"properties",l]});const c=new Set(Object.keys(s)),d=new Set([...c].filter((e=>{const t=i.shape[e]._zod;return"input"===n.io?void 0===t.optin:void 0===t.optout})));d.size>0&&(a.required=Array.from(d)),"never"===(null==(r=i.catchall)?void 0:r._zod.def.type)?a.additionalProperties=!1:i.catchall?i.catchall&&(a.additionalProperties=Oo(i.catchall,n,{...o,path:[...o.path,"additionalProperties"]})):"output"===n.io&&(a.additionalProperties=!1)})(e,n,t,o),$(e,"shape",(()=>n.shape)),e.keyof=()=>function(e,n){const t=Array.isArray(e)?Object.fromEntries(e.map((e=>[e,e]))):e;return new Pr({type:"enum",entries:t,...J(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:Sr()}),e.loose=()=>e.clone({...e._zod.def,catchall:Sr()}),e.strict=()=>{return e.clone({...e._zod.def,catchall:eo(Ir,n)});var n},e.strip=()=>e.clone({...e._zod.def,catchall:void 0}),e.extend=n=>function(e,n){if(!B(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=F(e._zod.def,{get shape(){const t={...e._zod.def.shape,...n};return D(this,"shape",t),t}});return K(e,o)}(e,n),e.safeExtend=n=>function(e,n){if(!B(n))throw new Error("Invalid input to safeExtend: expected a plain object");const t=F(e._zod.def,{get shape(){const t={...e._zod.def.shape,...n};return D(this,"shape",t),t}});return K(e,t)}(e,n),e.merge=n=>function(e,n){const t=F(e._zod.def,{get shape(){const t={...e._zod.def.shape,...n._zod.def.shape};return D(this,"shape",t),t},get catchall(){return n._zod.def.catchall},checks:[]});return K(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 K(e,F(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 D(this,"shape",e),e},checks:[]}))}(e,n),e.omit=n=>function(e,n){const t=e._zod.def,o=t.checks;if(o&&o.length>0)throw new Error(".omit() cannot be used on object schemas containing refinements");const r=F(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 D(this,"shape",o),o},checks:[]});return K(e,r)}(e,n),e.partial=(...n)=>function(e,n,t){const o=n._zod.def.checks;if(o&&o.length>0)throw new Error(".partial() cannot be used on object schemas containing refinements");const r=F(n._zod.def,{get shape(){const o=n._zod.def.shape,r={...o};if(t)for(const n in t){if(!(n in o))throw new Error(`Unrecognized key: "${n}"`);t[n]&&(r[n]=e?new e({type:"optional",innerType:o[n]}):o[n])}else for(const n in o)r[n]=e?new e({type:"optional",innerType:o[n]}):o[n];return D(this,"shape",r),r},checks:[]});return K(n,r)}(Dr,e,n[0]),e.required=(...n)=>function(e,n,t){const o=F(n._zod.def,{get shape(){const o=n._zod.def.shape,r={...o};if(t)for(const n in t){if(!(n in r))throw new Error(`Unrecognized key: "${n}"`);t[n]&&(r[n]=new e({type:"nonoptional",innerType:o[n]}))}else for(const n in o)r[n]=new e({type:"nonoptional",innerType:o[n]});return D(this,"shape",r),r}});return K(n,o)}(Wr,e,n[0])}));function Cr(e,n){const t={type:"object",shape:e??{},...J(n)};return new zr(t)}const Ar=R("ZodUnion",((e,n)=>{Yn.init(e,n),Yo.init(e,n),e._zod.processJSONSchema=(n,t,o)=>((e,n,t,o)=>{const r=e._zod.def,a=!1===r.inclusive,i=r.options.map(((e,t)=>Oo(e,n,{...o,path:[...o.path,a?"oneOf":"anyOf",t]})));a?t.oneOf=i:t.anyOf=i})(e,n,t,o),e.options=n.options}));const jr=R("ZodIntersection",((e,n)=>{Xn.init(e,n),Yo.init(e,n),e._zod.processJSONSchema=(n,t,o)=>((e,n,t,o)=>{const r=e._zod.def,a=Oo(r.left,n,{...o,path:[...o.path,"allOf",0]}),i=Oo(r.right,n,{...o,path:[...o.path,"allOf",1]}),s=e=>"allOf"in e&&1===Object.keys(e).length,c=[...s(a)?a.allOf:[a],...s(i)?i.allOf:[i]];t.allOf=c})(e,n,t,o)}));const Pr=R("ZodEnum",((e,n)=>{nt.init(e,n),Yo.init(e,n),e._zod.processJSONSchema=(n,t,o)=>((e,n,t)=>{const o=N(e._zod.def.entries);o.every((e=>"number"==typeof e))&&(t.type="number"),o.every((e=>"string"==typeof e))&&(t.type="string"),t.enum=o})(e,0,t),e.enum=n.entries,e.options=Object.values(n.entries);const t=new Set(Object.keys(n.entries));e.extract=(e,o)=>{const r={};for(const a of e){if(!t.has(a))throw new Error(`Key ${a} not found in enum`);r[a]=n.entries[a]}return new Pr({...n,checks:[],...J(o),entries:r})},e.exclude=(e,o)=>{const r={...n.entries};for(const n of e){if(!t.has(n))throw new Error(`Key ${n} not found in enum`);delete r[n]}return new Pr({...n,checks:[],...J(o),entries:r})}}));const $r=R("ZodTransform",((e,n)=>{tt.init(e,n),Yo.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 O(e.constructor.name);t.addIssue=o=>{if("string"==typeof o)t.issues.push(ne(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(ne(n))}};const r=n.transform(t.value,t);return r instanceof Promise?r.then((e=>(t.value=e,t))):(t.value=r,t)}}));const Dr=R("ZodOptional",((e,n)=>{rt.init(e,n),Yo.init(e,n),e._zod.processJSONSchema=(n,t,o)=>Ao(e,n,0,o),e.unwrap=()=>e._zod.def.innerType}));function Fr(e){return new Dr({type:"optional",innerType:e})}const Lr=R("ZodExactOptional",((e,n)=>{at.init(e,n),Yo.init(e,n),e._zod.processJSONSchema=(n,t,o)=>Ao(e,n,0,o),e.unwrap=()=>e._zod.def.innerType}));const Mr=R("ZodNullable",((e,n)=>{it.init(e,n),Yo.init(e,n),e._zod.processJSONSchema=(n,t,o)=>((e,n,t,o)=>{const r=e._zod.def,a=Oo(r.innerType,n,o),i=n.seen.get(e);"openapi-3.0"===n.target?(i.ref=r.innerType,t.nullable=!0):t.anyOf=[a,{type:"null"}]})(e,n,t,o),e.unwrap=()=>e._zod.def.innerType}));function Ur(e){return new Mr({type:"nullable",innerType:e})}const qr=R("ZodDefault",((e,n)=>{st.init(e,n),Yo.init(e,n),e._zod.processJSONSchema=(n,t,o)=>((e,n,t,o)=>{const r=e._zod.def;Oo(r.innerType,n,o),n.seen.get(e).ref=r.innerType,t.default=JSON.parse(JSON.stringify(r.defaultValue))})(e,n,t,o),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap}));const Br=R("ZodPrefault",((e,n)=>{dt.init(e,n),Yo.init(e,n),e._zod.processJSONSchema=(n,t,o)=>((e,n,t,o)=>{const r=e._zod.def;Oo(r.innerType,n,o),n.seen.get(e).ref=r.innerType,"input"===n.io&&(t._prefault=JSON.parse(JSON.stringify(r.defaultValue)))})(e,n,t,o),e.unwrap=()=>e._zod.def.innerType}));const Wr=R("ZodNonOptional",((e,n)=>{lt.init(e,n),Yo.init(e,n),e._zod.processJSONSchema=(n,t,o)=>((e,n,t,o)=>{const r=e._zod.def;Oo(r.innerType,n,o),n.seen.get(e).ref=r.innerType})(e,n,0,o),e.unwrap=()=>e._zod.def.innerType}));const Zr=R("ZodCatch",((e,n)=>{pt.init(e,n),Yo.init(e,n),e._zod.processJSONSchema=(n,t,o)=>((e,n,t,o)=>{const r=e._zod.def;let a;Oo(r.innerType,n,o),n.seen.get(e).ref=r.innerType;try{a=r.catchValue(void 0)}catch{throw new Error("Dynamic catch values are not supported in JSON Schema")}t.default=a})(e,n,t,o),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap}));const Vr=R("ZodPipe",((e,n)=>{ft.init(e,n),Yo.init(e,n),e._zod.processJSONSchema=(n,t,o)=>((e,n,t,o)=>{const r=e._zod.def,a="input"===n.io?"transform"===r.in._zod.def.type?r.out:r.in:r.out;Oo(a,n,o),n.seen.get(e).ref=a})(e,n,0,o),e.in=n.in,e.out=n.out}));function Kr(e,n){return new Vr({type:"pipe",in:e,out:n})}const Jr=R("ZodReadonly",((e,n)=>{mt.init(e,n),Yo.init(e,n),e._zod.processJSONSchema=(n,t,o)=>((e,n,t,o)=>{const r=e._zod.def;Oo(r.innerType,n,o),n.seen.get(e).ref=r.innerType,t.readOnly=!0})(e,n,t,o),e.unwrap=()=>e._zod.def.innerType}));const Gr=R("ZodCustom",((e,n)=>{vt.init(e,n),Yo.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 Hr;Cr({success:Rr(),accessToken:er().optional(),alias:er().optional(),user:Cr({id:er(),email:er(),role:er(),validated:Rr(),active:Rr()}).optional(),person:Cr({id:er(),name:er(),birth_date:er()}).optional(),confidence_score:Gt(xr,Hr).optional(),recognition_id:er().optional(),task_id:er().optional(),status:er().optional(),message:er().optional()}),Cr({success:Rr(),message:er(),person_id:er().optional(),user_id:er().optional(),person_validated:Rr().optional(),face_processing:Xt(Tr).optional(),onboarding_link:er().optional(),task_id:er().optional(),status:er().optional()});const Yr={},Xr={development:"http://localhost:8000",sandbox:"https://sandbox-core.neofaceid.com",production:"https://core.neofaceid.com.br"};let Qr={baseUrl:Xr.sandbox,applicationToken:null,environment:"sandbox",initialized:!1};function ea(){return Qr.initialized,Qr.baseUrl}const na=()=>ea(),ta=()=>{const e="localhost"===window.location.hostname||"127.0.0.1"===window.location.hostname||""===window.location.hostname;if(!window.isSecureContext&&!e)throw new E("Secure context (HTTPS) is required for this operation",k.NETWORK)},oa=()=>{const e=new AbortController,n=setTimeout((()=>e.abort()),1e4);return e.signal.addEventListener("abort",(()=>clearTimeout(n))),e},ra=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 r=e.getContext("2d");r?(r.drawImage(o,0,0),e.toBlob((e=>{e?n(e):t(new Error("Failed to compress image"))}),"image/jpeg",.7)):t(new Error("Failed to get canvas context"))},o.onerror=()=>{t(new Error("Failed to load image"))},o.src=URL.createObjectURL(e)})),aa=async e=>new Promise(((n,t)=>{const o=new Image;o.onload=()=>{const e=1280;let r=o.width,a=o.height;r>a&&r>e?(a=a*e/r,r=e):a>e&&(r=r*e/a,a=e);const i=document.createElement("canvas");i.width=r,i.height=a;const s=i.getContext("2d");s?(s.drawImage(o,0,0,r,a),i.toBlob((e=>{e?n(e):t(new Error("Failed to compress document image"))}),"image/jpeg",.75)):t(new Error("Failed to get canvas context"))},o.onerror=()=>{t(new Error("Failed to load document image"))},o.src=URL.createObjectURL(e)})),ia=async e=>{ta();const n=oa();try{const t=await fetch(`${na()}/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 E(`API Error ${t.status}`,k.INVALID_TOKEN);return t.ok}catch(t){if(t instanceof Error){if("AbortError"===t.name)throw new E("Request timeout",k.NETWORK_ERROR);throw new E(t.message,k.NETWORK_ERROR)}throw new E("Unknown error",k.NETWORK_ERROR)}},sa=async(e,n)=>{ta();const t=oa();try{const o=await fetch(`${na()}/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 E("Token de aplicação inválido ou expirado",k.INVALID_TOKEN);if(404===o.status)throw new E("Link de onboarding não encontrado",k.NOT_FOUND);throw new E(`Falha ao obter detalhes (${o.status})`,k.NETWORK)}return await o.json()}catch(o){if(o instanceof Error){if("AbortError"===o.name)throw new E("Tempo de requisição excedido",k.NETWORK);if(o instanceof E)throw o;throw new E(o.message,k.NETWORK)}throw new E("Erro desconhecido",k.NETWORK_ERROR)}},ca=async(e,n)=>{ta();const t=oa();try{const o=await fetch(`${na()}/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 E("Token de aplicação inválido ou expirado",k.INVALID_TOKEN);if(404===o.status)return!1;throw new E(`Falha ao validar token (${o.status})`,k.NETWORK)}const r=await o.json();return!0===(null==r?void 0:r.is_valid)}catch(o){if(o instanceof Error){if("AbortError"===o.name)throw new E("Tempo de requisição excedido",k.NETWORK);if(o instanceof E)throw o;throw new E(o.message,k.NETWORK)}throw new E("Erro desconhecido",k.NETWORK_ERROR)}},da=async(e,n,t,o)=>{ta();const r=oa(),a=await ra(t),i=await ra(o);try{const t=await new Promise(((e,n)=>{const t=new FileReader;t.onload=()=>e(t.result),t.onerror=n,t.readAsDataURL(a)})),o=await new Promise(((e,n)=>{const t=new FileReader;t.onload=()=>e(t.result),t.onerror=n,t.readAsDataURL(i)})),s=await fetch(`${na()}/api/v1/onboardings/${encodeURIComponent(n)}/complete`,{method:"POST",headers:{"Content-Type":"application/json","X-App-Token":e},body:JSON.stringify({face_image:t,document_image:o}),signal:r.signal}),c=await s.json();if(!s.ok){if(401===s.status||403===s.status)throw new E("Token de aplicação inválido ou expirado",k.INVALID_TOKEN);if(404===s.status)throw new E("Link de onboarding não encontrado",k.NOT_FOUND);throw new E((null==c?void 0:c.error)||(null==c?void 0:c.message)||"Falha ao concluir onboarding",k.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 E("Tempo de requisição excedido",k.NETWORK);if(s instanceof E)throw s;throw new E(s.message,k.NETWORK)}throw new E("Erro desconhecido",k.NETWORK_ERROR)}},la=async(e,n,t,o,r)=>{if(ta(),!o||0===o.length)throw new E("Pelo menos uma imagem da pessoa é obrigatória",k.VALIDATION_ERROR);const a=oa();try{const i=await Promise.all(o.map((async e=>{const n=await ra(e);return new Promise(((e,t)=>{const o=new FileReader;o.onload=()=>e(o.result),o.onerror=t,o.readAsDataURL(n)}))}))),s=await ra(r),c={person_images:i,document_image:await new Promise(((e,n)=>{const t=new FileReader;t.onload=()=>e(t.result),t.onerror=n,t.readAsDataURL(s)})),name:t.name,birth_date:t.birth_date,cpf:t.cpf,cnpj:t.cnpj,email:t.email},d=await fetch(`${na()}/api/v1/onboardings/${encodeURIComponent(n)}/complete`,{method:"POST",headers:{"Content-Type":"application/json","X-App-Token":e},body:JSON.stringify(c),signal:a.signal}),l=await d.json();if(!d.ok){if(401===d.status||403===d.status)throw new E("Token de aplicação inválido ou expirado",k.INVALID_TOKEN);if(404===d.status)throw new E("Link de onboarding não encontrado",k.NOT_FOUND);throw new E((null==l?void 0:l.error)||(null==l?void 0:l.message)||"Falha ao concluir onboarding",k.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 E("Tempo de requisição excedido",k.NETWORK);if(i instanceof E)throw i;throw new E(i.message,k.NETWORK)}throw new E("Erro desconhecido",k.NETWORK_ERROR)}},ua=async(e,n)=>{ta();const t=oa(),o=await ra(e);try{const e=await new Promise(((e,n)=>{const t=new FileReader;t.onload=()=>{const n=t.result;e(n.split(",")[1])},t.onerror=n,t.readAsDataURL(o)})),r=await fetch(`${na()}/api/v1/external/recognition/face/`,{method:"POST",headers:{"Content-Type":"application/json","X-App-Token":n},body:JSON.stringify({face_frames:e}),signal:t.signal});if(!r.ok){if(401===r.status||403===r.status)throw new E("Invalid or expired application token",k.INVALID_TOKEN);throw new E(`Server returned status ${r.status}`,k.NETWORK)}const a=await r.json();if(!a.success)throw new E(a.message||"Recognition failed",k.RECOGNITION_FAILED);return{accessToken:a.accessToken,payload:a.payload}}catch(r){if(r instanceof Error){if("AbortError"===r.name)throw new E("Request timed out",k.NETWORK);if(r instanceof E)throw r;throw new E(r.message,k.NETWORK)}throw new E("Unknown error occurred",k.NETWORK_ERROR)}},pa=async(e,n)=>{var t,o,r,a,i;ta();const s=oa(),c=await ra(e);try{const e=await c.arrayBuffer(),d=btoa(new Uint8Array(e).reduce(((e,n)=>e+String.fromCharCode(n)),"")),l=await fetch(`${na()}/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 E("Invalid application token",k.INVALID_TOKEN);if(l.status>=500)throw new E(`Server Error ${l.status}`,k.API_ERROR);throw new E(`API Error ${l.status}`,k.API_ERROR)}const u=await l.json();if(!u.success)throw new E(u.message||"Login failed",k.LOGIN_FAILED);return{success:!0,accessToken:u.accessToken||u.access_token||"",alias:u.alias,user:{id:(null==(t=u.user)?void 0:t.id)||"",email:(null==(o=u.user)?void 0:o.email)||"",role:(null==(r=u.user)?void 0:r.role)||"",validated:(null==(a=u.user)?void 0:a.validated)||!1,active:(null==(i=u.user)?void 0:i.active)||!1},person:u.person?{id:u.person.id||"",name:u.person.name||"",birth_date:u.person.birth_date||""}:void 0,confidence_score:u.confidence_score,recognition_id:u.recognition_id}}catch(d){if(d instanceof Error){if("AbortError"===d.name)throw new E("Request timed out",k.NETWORK);if(d instanceof E)throw d;throw new E(d.message,k.NETWORK)}throw new E("Unknown error occurred",k.NETWORK_ERROR)}},fa=async(e,n,t=!0,o=.8)=>{ta();const r=oa(),a=await ra(e);try{const e=await new Promise(((e,n)=>{const t=new FileReader;t.onload=()=>{const n=t.result;e(n.split(",")[1])},t.onerror=n,t.readAsDataURL(a)})),i=await fetch(`${na()}/api/v1/external/recognition/biometric/`,{method:"POST",headers:{"Content-Type":"application/json","X-App-Token":n},body:JSON.stringify({face_frames:e,liveness_check:t,confidence_threshold:o}),signal:r.signal});if(!i.ok){if(401===i.status||403===i.status)throw new E("Invalid or expired application token",k.INVALID_TOKEN);throw new E(`Server returned status ${i.status}`,k.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 E("Request timed out",k.NETWORK);if(i instanceof E)throw i;throw new E(i.message,k.NETWORK)}throw new E("Unknown error occurred",k.NETWORK_ERROR)}},ha=async(e,n,t,o="LOGIN")=>{ta();const r=oa();try{const a=await fetch(`${na()}/api/v1/external/recognition/simple/`,{method:"POST",headers:{"Content-Type":"application/json","X-App-Token":t},body:JSON.stringify({document_type:e,document_number:n,purpose:o}),signal:r.signal});if(!a.ok){if(401===a.status||403===a.status)throw new E("Invalid or expired application token",k.INVALID_TOKEN);throw new E(`Server returned status ${a.status}`,k.NETWORK)}const i=await a.json();if(!i.success)throw new E(i.message||"Identification failed",k.RECOGNITION_FAILED);return{success:i.success,personId:i.person_id,accessToken:i.access_token,payload:i.payload}}catch(a){if(a instanceof Error){if("AbortError"===a.name)throw new E("Request timed out",k.NETWORK);if(a instanceof E)throw a;throw new E(a.message,k.NETWORK)}throw new E("Unknown error occurred",k.NETWORK_ERROR)}},ma=async(e,n,t,o=.8,r,a)=>{var i;ta();const s=oa(),c=await ra(e),d=await new Promise(((e,n)=>{const t=new FileReader;t.onload=()=>{const n=t.result;e(n.split(",")[1])},t.onerror=n,t.readAsDataURL(c)}));try{const e={biometric_data:d,type_of_identification:"FACE",purpose:t,confidence_threshold:o};r&&(e.signature=r);const c=await fetch(`${na()}/api/v1/external/recognition/purpose/`,{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 E("Invalid or expired application token",k.INVALID_TOKEN);throw new E(`Server returned status ${c.status}`,k.NETWORK)}const l=await c.json();return{success:l.success,personName:l.person_name||(null==(i=l.person)?void 0:i.name),email:l.email||(null==a?void 0:a.email),cpf:l.cpf||(null==a?void 0:a.cpf),confidenceScore:l.confidence_score,accessToken:l.access_token,payload:l.payload,signature:r,sessionId:null==a?void 0:a.sessionId}}catch(l){if(l instanceof Error){if("AbortError"===l.name)throw new E("Request timed out",k.NETWORK);if(l instanceof E)throw l;throw new E(l.message,k.NETWORK)}throw new E("Unknown error occurred",k.NETWORK_ERROR)}},ga=async(e,n,t)=>{ta();const o=oa();try{let r,a;if(null==t?void 0:t.documentFront){const e=await aa(t.documentFront);r=await new Promise(((n,t)=>{const o=new FileReader;o.onload=()=>n(o.result),o.onerror=t,o.readAsDataURL(e)}))}if(null==t?void 0:t.documentBack){const e=await aa(t.documentBack);a=await new Promise(((n,t)=>{const o=new FileReader;o.onload=()=>n(o.result),o.onerror=t,o.readAsDataURL(e)}))}const i={name:e.name,birth_date:e.birth_date,cpf:e.cpf,email:e.email,password:e.password,password_confirm:e.password,is_pep:e.is_pep??!1};r&&(i.document_images=[{front:r,back:a||void 0,type:(null==t?void 0:t.documentType)||"RG"}]);const s=await fetch(`${na()}/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 E("Invalid or expired application token",k.INVALID_TOKEN);throw new E(`Server returned status ${s.status}`,k.NETWORK)}return await s.json()}catch(r){if(r instanceof Error){if("AbortError"===r.name)throw new E("Request timed out",k.NETWORK);if(r instanceof E)throw r;throw new E(r.message,k.NETWORK)}throw new E("Unknown error occurred",k.NETWORK)}},va=async e=>{const n=oa(),t=new URLSearchParams;e.email&&t.append("email",e.email),e.cpf&&t.append("cpf",e.cpf);try{const e=await fetch(`${na()}/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 E(n.message||`Server returned status ${e.status}`,k.NETWORK)}return await e.json()}catch(o){if(o instanceof Error){if("AbortError"===o.name)throw new E("Request timed out",k.NETWORK);if(o instanceof E)throw o;throw new E(o.message,k.NETWORK)}throw new E("Unknown error occurred",k.NETWORK)}},ba=async(e,n,t,o)=>{var r,a,i,s,c,d,l,u;if(ta(),!n||0===n.length)throw new E("At least one face photo is required for biometric registration",k.VALIDATION_ERROR);if(n.length>5)throw new E("Maximum of 5 face photos allowed",k.VALIDATION_ERROR);const p=oa();try{const h=await Promise.all(n.map((async e=>{const n=await ra(e);return new Promise(((e,t)=>{const o=new FileReader;o.onload=()=>{const n=o.result;e(n)},o.onerror=t,o.readAsDataURL(n)}))})));let m,g;if(null==o?void 0:o.documentFront){const e=await aa(o.documentFront);m=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 aa(o.documentBack);g=await new Promise(((n,t)=>{const o=new FileReader;o.onload=()=>n(o.result),o.onerror=t,o.readAsDataURL(e)}))}const v={name:e.name,birth_date:e.birth_date,cpf:e.cpf,email:e.email,password:e.password,password_confirm:e.password,face_photos:h,is_pep:e.is_pep??!1};m&&(v.document_images=[{front:m,back:g||void 0,type:(null==o?void 0:o.documentType)||"RG"}]);const b=await fetch(`${na()}/api/v1/signup/donor/`,{method:"POST",headers:{"Content-Type":"application/json","X-App-Token":t},body:JSON.stringify(v),signal:p.signal});if(!b.ok){if(401===b.status||403===b.status)throw new E("Invalid or expired application token",k.INVALID_TOKEN);try{const e=await b.json();if(e.errors){const n=Object.entries(e.errors).map((([e,n])=>`${"password"===e?"senha":"password_confirm"===e?"confirmação de senha":e}: ${Array.isArray(n)?n.join(", "):String(n)}`)).join("; ");throw new E(`Erro de validação: ${n}`,k.VALIDATION_ERROR)}if("fraud_detected"===e.error)throw new E("Fraud detected in biometric images. Registration blocked.",k.VALIDATION_ERROR);if("user_exists"===e.error||"ALREADY_EXISTS"===e.error_code)throw new E("User with this email already exists",k.VALIDATION_ERROR);if("person_exists"===e.error)throw new E("Person with this CPF already exists",k.VALIDATION_ERROR);const n=e.message||e.error||`Server returned status ${b.status}`;throw new E(n,k.VALIDATION_ERROR)}catch(f){if(f instanceof E)throw f;throw new E(`Server returned status ${b.status}`,k.NETWORK)}}const y=await b.json();return 202===b.status&&(null==(r=y.data)?void 0:r.task_id)?{success:y.success,message:y.message||"Registration is being processed. You will receive an email when completed.",task_id:y.data.task_id,status:y.data.status||"processing",person_id:void 0,user_id:void 0,person_validated:void 0,face_processing:void 0,onboarding_link:void 0}:{success:y.success,message:y.message,person_id:(null==(a=y.data)?void 0:a.person_id)||y.person_id,user_id:(null==(i=y.data)?void 0:i.user_id)||y.user_id,person_validated:(null==(s=y.data)?void 0:s.person_validated)||y.person_validated,face_processing:(null==(c=y.data)?void 0:c.face_processing)||y.face_processing,onboarding_link:(null==(d=y.data)?void 0:d.onboarding_link)||y.onboarding_link,task_id:null==(l=y.data)?void 0:l.task_id,status:null==(u=y.data)?void 0:u.status}}catch(h){if(h instanceof Error){if("AbortError"===h.name)throw new E("Request timed out",k.NETWORK);if(h instanceof E)throw h;throw new E(h.message,k.NETWORK)}throw new E("Unknown error occurred",k.NETWORK_ERROR)}},ya=async(e,n,t)=>{const o=oa();try{const r=await fetch(`${na()}/api/v1/auth/login/`,{method:"POST",headers:{"Content-Type":"application/json","X-App-Token":t},body:JSON.stringify({email:e,password:n}),signal:o.signal});if(!r.ok){if(401===r.status||403===r.status)throw new E("Email ou senha inválidos",k.INVALID_TOKEN);throw new E(`API Error ${r.status}`,k.API_ERROR)}const a=await r.json();return{success:!0,accessToken:a.access_token||a.access,alias:a.user&&a.user.alias||a.alias,user:{id:a.user&&a.user.id||"",email:a.user&&a.user.email||"",role:a.user&&a.user.role||"",validated:a.user&&a.user.validated||!1,active:a.user&&a.user.active||!1}}}catch(r){if(r instanceof Error){if("AbortError"===r.name)throw new E("Request timed out",k.NETWORK);if(r instanceof E)throw r;throw new E(r.message,k.NETWORK)}throw new E("Unknown error occurred",k.NETWORK_ERROR)}},wa=async(e,n)=>{var t,o,r,a;ta();const i=oa(),s=await aa(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(`${na()}/api/v1/auth/recognition/face/external/`,{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 E("Invalid or expired application token",k.INVALID_TOKEN);throw new E(`Server returned status ${e.status}`,k.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 E(s.message||"Person identification failed",k.RECOGNITION_FAILED);return{success:!0,person:{name:(null==(r=s.person)?void 0:r.name)||"",birth_date:(null==(a=s.person)?void 0:a.birth_date)||""}}}catch(d){if(d instanceof Error){if("AbortError"===d.name)throw new E("Request timed out",k.NETWORK);if(d instanceof E)throw d;throw new E(d.message,k.NETWORK)}throw new E("Unknown error occurred",k.NETWORK_ERROR)}},xa=async(e,n,t)=>{if(ta(),!e)throw new E("Person ID is required",k.VALIDATION_ERROR);if(!n)throw new E("Face image is required",k.VALIDATION_ERROR);const o=oa(),r=await ra(n),a=await new Promise(((e,n)=>{const t=new FileReader;t.onload=()=>{const n=t.result;e(n.split(",")[1])},t.onerror=n,t.readAsDataURL(r)}));try{const n=await fetch(`${na()}/api/v1/identity-data/`,{method:"POST",headers:{"Content-Type":"application/json","X-App-Token":t},body:JSON.stringify({person:e,type_of_identification:"FACE",biometric_data:a}),signal:o.signal});if(!n.ok){if(401===n.status||403===n.status)throw new E("Invalid or expired application token, or insufficient permissions",k.INVALID_TOKEN);if(400===n.status)try{const e=await n.json(),t=e.message||e.error||"Invalid biometric data";throw new E(t,k.VALIDATION_ERROR)}catch(i){if(i instanceof E)throw i;throw new E("Invalid biometric data",k.VALIDATION_ERROR)}throw new E(`Server returned status ${n.status}`,k.NETWORK)}const r=await n.json();return{success:!0,message:"Biometric data registered successfully",identity_data_id:r.id,type_of_identification:r.type_of_identification,have_biometric_data:r.have_biometric_data,created_at:r.created_at}}catch(s){if(s instanceof Error){if("AbortError"===s.name)throw new E("Request timed out",k.NETWORK);if(s instanceof E)throw s;throw new E(s.message,k.NETWORK)}throw new E("Unknown error occurred",k.NETWORK_ERROR)}},_a=async(e,n,t)=>{ta();const o=oa();try{const a=await fetch(`${na()}/api/v1/applications/`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${e}`},body:JSON.stringify({consumer:n,application_name:t.applicationName,domain:t.domain,accept_only_email_with_same_domain:t.acceptOnlyEmailWithSameDomain}),signal:o.signal});if(!a.ok){if(401===a.status)throw new E("Invalid or expired JWT token",k.INVALID_TOKEN);if(403===a.status)throw new E("Insufficient permissions to create application",k.INVALID_TOKEN);if(400===a.status)try{const e=await a.json(),n=e.message||e.error||"Invalid application data";throw new E(n,k.VALIDATION_ERROR)}catch(r){if(r instanceof E)throw r;throw new E("Invalid application data",k.VALIDATION_ERROR)}throw new E(`Server returned status ${a.status}`,k.NETWORK)}const i=await a.json();return{success:!0,application:{id:i.id,application_name:i.application_name,domain:i.domain,accept_only_email_with_same_domain:i.accept_only_email_with_same_domain,app_token:i.app_token,is_active:i.is_active,created_at:i.created_at},message:"Application registered successfully"}}catch(a){if(a instanceof Error){if("AbortError"===a.name)throw new E("Request timed out",k.NETWORK);if(a instanceof E)throw a;throw new E(a.message,k.NETWORK)}throw new E("Unknown error occurred",k.NETWORK_ERROR)}},ka=async(e={})=>{ta();const{durationMs:n=3e3,onProgress:t}=e;return new Promise((async(e,o)=>{let r=null;const a=[];try{r=await navigator.mediaDevices.getUserMedia({video:{facingMode:"user",width:{ideal:640},height:{ideal:480}},audio:!1});const i=(()=>{const e=["video/mp4;codecs=avc1","video/mp4","video/webm;codecs=vp9","video/webm;codecs=vp8","video/webm"];for(const n of e)if(MediaRecorder.isTypeSupported(n))return n;return""})();let s;try{s=i?new MediaRecorder(r,{mimeType:i,videoBitsPerSecond:1e6}):new MediaRecorder(r,{videoBitsPerSecond:1e6})}catch{s=new MediaRecorder(r)}const c=s.mimeType||i;if(s.ondataavailable=e=>{e.data.size>0&&a.push(e.data)},s.onstop=()=>{r&&r.getTracks().forEach((e=>e.stop()));const n=new Blob(a,{type:c});e(n)},s.onerror=e=>{r&&r.getTracks().forEach((e=>e.stop())),o(new E(`Recording error: ${e}`,k.CAPTURE_ERROR))},s.start(100),t){const e=100;let o=0;const r=setInterval((()=>{o+=e;const a=Math.min(100,o/n*100);t(a),o>=n&&clearInterval(r)}),e)}setTimeout((()=>{s&&"recording"===s.state&&s.stop()}),n)}catch(i){r&&r.getTracks().forEach((e=>e.stop())),i instanceof Error?"NotAllowedError"===i.name?o(new E("Camera permission denied",k.CAMERA_ERROR)):"NotFoundError"===i.name?o(new E("No camera found",k.NO_CAMERA)):o(new E(i.message,k.CAPTURE_ERROR)):o(new E("Failed to record video",k.CAPTURE_ERROR))}}))},Ea=async(e,n,t={})=>{var o,r,a,i,s,c;const{maxAttempts:d=60,intervalMs:l=1e3,onStatusChange:u}=t;let p=0;for(;p<d;){p++;try{const t=await fetch(`${na()}/api/v1/tasks/status/?task_id=${e}`,{method:"GET",headers:{Accept:"application/json","X-App-Token":n}});if(!t.ok)throw new E(`Task status check failed: ${t.status}`,k.NETWORK);const d=await t.json(),p=(null==(o=d.data)?void 0:o.status)||"unknown";if(u){u(p,null==(a=null==(r=d.data)?void 0:r.progress)?void 0:a.percentage)}if("success"===p)return d.data.result;if("failure"===p){const e=(null==(s=null==(i=d.data)?void 0:i.result)?void 0:s.message)||(null==(c=d.data)?void 0:c.error)||"Task failed";throw new E(e,k.RECOGNITION_FAILED)}if("revoked"===p)throw new E("Task was cancelled",k.RECOGNITION_FAILED);await new Promise((e=>setTimeout(e,l)))}catch(f){if(f instanceof E)throw f;throw new E(`Polling error: ${f instanceof Error?f.message:"Unknown error"}`,k.NETWORK)}}throw new E("Task status polling timed out",k.NETWORK)},Ra=async(e,n)=>{var t;ta();const o=oa();try{const r=await fetch(`${na()}/api/v1/auth/recognition/face/external/`,{method:"POST",headers:{"Content-Type":"application/json","X-App-Token":n},body:JSON.stringify({video:e,purpose:"PROOF_OF_LIFE"}),signal:o.signal});if(!r.ok){if(401===r.status||403===r.status)throw new E("Invalid or expired application token",k.INVALID_TOKEN);if(400===r.status){const e=await r.json();throw new E(e.message||"Invalid request data",k.VALIDATION_ERROR)}throw new E(`Server returned status ${r.status}`,k.NETWORK)}const a=await r.json();if(!a.success||!(null==(t=a.data)?void 0:t.task_id))throw new E(a.message||"Failed to start proof of life",k.RECOGNITION_FAILED);return{taskId:a.data.task_id,historyId:a.data.history_id,status:a.data.status,message:a.message||"Recognition started successfully"}}catch(r){if(r instanceof Error){if("AbortError"===r.name)throw new E("Request timed out",k.NETWORK);if(r instanceof E)throw r;throw new E(r.message,k.NETWORK)}throw new E("Unknown error occurred",k.NETWORK_ERROR)}},Ta=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 E("Failed to convert video to base64",k.CAPTURE_ERROR)),o.readAsDataURL(e)})),Oa=async(e,n,t)=>{var o,r;if(ta(),!e)throw new E("personId is required",k.VALIDATION_ERROR);if(!n)throw new E("jwtToken is required",k.VALIDATION_ERROR);if(!t||0===t.length)throw new E("At least one document image is required",k.VALIDATION_ERROR);const a=await Promise.all(t.map((async e=>{const n=await aa(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 E("Failed to convert image to base64",k.CAPTURE_ERROR)),o.readAsDataURL(t)}));var t}))),i=oa();try{const t=await fetch(`${na()}/api/v1/donors/${e}/documents/`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${n}`},body:JSON.stringify({document_images:a}),signal:i.signal}),s=await t.json();if(!t.ok)throw new E((null==s?void 0:s.message)||`API Error ${t.status}`,k.NETWORK_ERROR);return{success:!0,taskId:(null==(o=s.data)?void 0:o.task_id)??"",status:(null==(r=s.data)?void 0:r.status)??"processing",message:s.message??"Documents submitted for processing"}}catch(s){if(s instanceof E)throw s;if(s instanceof Error){if("AbortError"===s.name)throw new E("Request timeout",k.NETWORK_ERROR);throw new E(s.message,k.NETWORK_ERROR)}throw new E("Unknown error occurred",k.NETWORK_ERROR)}},Sa=async e=>{const n=oa();try{const t=await fetch(`${na()}/api/v1/tasks/status/?task_id=${e}`,{method:"GET",headers:{"Content-Type":"application/json"},signal:n.signal}),o=await t.json();if(!t.ok)throw new E((null==o?void 0:o.message)||`API Error ${t.status}`,k.NETWORK_ERROR);return{success:o.success,status:o.data.status,result:o.data.result,error:o.data.error}}catch(t){if(t instanceof E)throw t;throw new E("Failed to fetch task status",k.NETWORK_ERROR)}},Ia=async(e,n,t={})=>{var o,r;const{maxRetries:a=30,interval:i=2e3}=t,s=await wa(e,n);if(s.person)return{personFound:!0,person:s.person};const c=s.taskId;if(!c)return{personFound:!1};for(let d=0;d<a;d++){const e=await Sa(c);if("success"===e.status)return e.result&&e.result.success?{personFound:!0,person:{name:(null==(o=e.result.person)?void 0:o.name)||"Pessoa identificada",birth_date:(null==(r=e.result.person)?void 0:r.birth_date)||""}}:{personFound:!1};if("failure"===e.status)return{personFound:!1};await new Promise((e=>setTimeout(e,i)))}throw new E("Timed out waiting for identification",k.NETWORK_ERROR)};async function Na(e,n){const t=ea(),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 E(e.message||"Erro ao solicitar recuperação de senha",k.API_ERROR)}return o.json()}async function za(e,n){const t=ea(),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 E(e.error||e.message||"Erro ao redefinir senha",k.API_ERROR)}return o.json()}const Ca=Object.freeze(Object.defineProperty({__proto__:null,checkUserExistence:va,completeOnboarding:da,completeOnboardingWithData:la,confirmPasswordReset:za,getOnboardingDetails:sa,getTaskStatus:Sa,identifyPerson:wa,identifyPersonAsync:Ia,loginWithBiometric:pa,loginWithEmail:ya,pollTaskStatus:Ea,recognize:ua,recognizeBiometric:fa,recognizeByPurpose:ma,recordFaceVideo:ka,registerApplication:_a,registerBiometric:xa,registerDocumentByImage:Oa,registerPersonWithBiometric:ba,registerPersonWithoutFace:ga,requestPasswordReset:Na,simpleIdentification:ha,startProofOfLife:Ra,validateOnboardingToken:ca,validateToken:ia,videoToBase64:Ta},Symbol.toStringTag,{value:"Module"})),Aa=(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}},ja={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:"#007AFF",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 Pa({accessToken:e,onClose:t,onSuccess:o}){const r=n.useRef(null),a=n.useRef(null),i=n.useRef(null),s=n.useRef(null),d=n.useRef(null),[l,u]=n.useReducer(Aa,{status:"requestingPermission"}),[p,f]=n.useState(!1),[h,m]=n.useState(0),{startCamera:g,stopCamera:v}=_(),b=()=>{if(!r.current)return;const e=async()=>{if(r.current&&"ready"===l.status){try{const e=await c.detectAllFaces(r.current,new c.TinyFaceDetectorOptions),n=1===e.length,t=n&&(e=>{if(!r.current)return!1;const{box:n}=e,{videoWidth:t,videoHeight:o}=r.current,a=t/2,i=o/2,s=.4*t,c=.4*o;return n.x+n.width/2>a-s/2&&n.x+n.width/2<a+s/2&&n.y+n.height/2>i-c/2&&n.y+n.height/2<i+c/2})(e[0]);f(n&&t),n&&t&&0===h&&(d.current=window.setTimeout((()=>{"ready"===l.status&&(m((e=>e+1)),u({type:"START_CAPTURE"}))}),3e3))}catch(n){}s.current=window.setTimeout(e,100)}};e()};n.useEffect((()=>((async()=>{try{await Promise.all([c.nets.tinyFaceDetector.loadFromUri("/models"),c.nets.faceLandmark68Net.loadFromUri("/models")])}catch(e){}})(),()=>{s.current&&window.clearTimeout(s.current),d.current&&window.clearInterval(d.current)})),[]),n.useEffect((()=>((async()=>{try{const e=await g();i.current=e,r.current&&(r.current.srcObject=e),u({type:"PERMISSION_GRANTED"}),b()}catch(e){u({type:"PERMISSION_DENIED"})}})(),()=>{i.current&&v(i.current)})),[g,v]);const w=async()=>{if(a.current&&r.current)try{u({type:"START_CAPTURE"});const i=a.current.getContext("2d");if(!i)return void u({type:"SET_ERROR",message:"Failed to get canvas context"});a.current.width=r.current.videoWidth,a.current.height=r.current.videoHeight,i.drawImage(r.current,0,0,a.current.width,a.current.height);const s=await new Promise(((e,n)=>{var t;null==(t=a.current)||t.toBlob((t=>{t?e(t):n(new Error("Failed to convert canvas to blob"))}),"image/jpeg",.95)}));try{const n=await ua(s,e);o({success:!0,data:{faceId:n.payload.documentId,confidence:1}}),u({type:"UPLOAD_SUCCESS"}),setTimeout(t,1500)}catch(n){u({type:"SET_ERROR",message:"Face recognition failed"})}}catch(n){u({type:"SET_ERROR",message:"Failed to capture image"})}};return y.jsxs("div",{style:ja.overlay,children:[y.jsx("style",{children:"\n @keyframes spin {\n 0% { transform: translate(-50%, -50%) rotate(0deg); }\n 100% { transform: translate(-50%, -50%) rotate(360deg); }\n }\n"}),y.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"}),y.jsxs("div",{style:ja.modal,className:"modal",children:[y.jsx("button",{type:"button",style:ja.closeButton,onClick:t,children:"×"}),y.jsx("video",{ref:r,style:ja.video,autoPlay:!0,playsInline:!0,muted:!0}),y.jsx("canvas",{ref:a,style:ja.canvas}),y.jsx("div",{style:ja.guide}),"ready"===l.status&&!p&&y.jsx("div",{style:ja.message,children:"Centralize seu rosto no círculo"}),"capturing"===l.status&&y.jsx("div",{style:ja.message,children:"Por favor, pisque os olhos"}),"uploading"===l.status&&y.jsx("div",{style:ja.spinner}),"success"===l.status&&y.jsx("div",{style:ja.message,children:"Autenticado!"}),"error"===l.status&&y.jsx("div",{style:ja.message,children:l.message}),y.jsxs("div",{style:ja.controls,children:["ready"===l.status&&p&&y.jsx("button",{type:"button",style:ja.button,onClick:w,children:"Capturar"}),"capturing"===l.status&&y.jsx("button",{type:"button",style:ja.button,onClick:w,children:"Capturar"}),"error"===l.status&&y.jsx("button",{type:"button",style:ja.button,onClick:()=>{u({type:"RESET"}),m(0)},children:"Tentar Novamente"})]})]})]})}const $a='<svg xmlns="http://www.w3.org/2000/svg" aria-label="NeoFaceID" viewBox="-43.1 -71.1 1318.2 1318.2"><g fill="currentColor"><path d="M138.1 2a10 10 0 0 1-5.8 2c-1.9 0-6.1 1.3-9.2 2.8a94 94 0 0 1-11.1 4.7c-3 1-8.1 3.4-11.2 5.2a33 33 0 0 1-6.7 3.3c-.5 0-1.4.6-1.8 1.4s-2.4 2.1-4.3 3a39 39 0 0 0-11.7 7.8 18 18 0 0 1-5.6 3.8c-1.8 0-33.9 32.3-35.3 35.5a27 27 0 0 1-4.5 6.3c-2 2-4.6 5.4-5.8 7.4-1.3 2.1-2.6 3.8-3.1 3.8s-1.2 1-1.5 2.2c-1.1 3.6-9.6 20.7-10.6 21.4-.5.3-.9 1.6-.9 2.8 0 1.3-.6 3.9-1.4 5.7s-1.2 4.6-.9 6q.4 2.5-1.1 3.8-1.6 1.4-1.6 6.2c0 3.8-.4 5.2-2 6.1-2.6 1.7-3.2 211.1-.6 212.1.8.3 2.6 3.1 4.1 6.3 3 6.3 5.3 8.7 10.2 11 1.8.8 3.3 1.9 3.3 2.4 0 1.4 6 4.2 7.7 3.6.8-.3 2.7.1 4.3.9 3.5 1.8 10.3 2 13.3.3 1.2-.6 3.8-1 5.8-1 2.2.1 4.2-.4 5-1.4.7-.8 3.2-2.7 5.6-4.1 3.9-2.2 6.8-5.6 10.8-12.2l2.7-4.3c1.7-2.6 1.8-7.8 1.8-91.1 0-87.1 0-88.4 2-90.2 1.6-1.5 2-3.1 2-8.7 0-4.2.6-8 1.5-9.8.8-1.6 1.2-3.5.9-4.3-1.2-3.3 6.7-21.9 12.4-29.2 1.2-1.5 2.2-3.3 2.2-4 0-2.1 23.3-24 27.5-25.9a192 192 0 0 0 11.6-5.7c4.2-2.1 8.8-3.9 10.1-3.9a10 10 0 0 0 5.1-2q2.5-2 7-2c2.7 0 4.9-.6 5.7-1.5 1.1-1.3 13.8-1.5 98.4-1.8 107-.4 111.3-.7 118.2-6.8 1.1-1.1 2.7-1.9 3.5-1.9 2.7 0 11.7-10.4 15.8-18.3 4.9-9.4 5.8-18.8 2.1-22.2-1.1-1-2-2.8-2-4.1 0-2-3.5-8.6-5.7-10.6-4-3.7-8.7-7.1-11.7-8.3-2-.9-3.9-2.2-4.2-3-1.1-2.7-237.1-2.1-240.3.5m718.4 0c-1 1.1-2.7 2-3.7 2-2.4 0-12.8 9.7-12.8 12 0 1-.8 2.8-1.8 4.1-8.3 11.1-4.5 32.8 7.8 44.3a27 27 0 0 0 5.9 4.6 26 26 0 0 1 5.9 2.9c7.2 4.2 8.1 4.3 109.3 4.7 79.6.4 91.8.6 92.9 1.9.7.9 2.9 1.5 5.5 1.5q4.2 0 6.5 2c1.3 1.1 3.6 2 5.1 2s3.1.4 3.4 1 1.7 1 3.1 1c1.3 0 3.2.4 4.2 1s2.8 1.5 4.2 2c2.7 1.1 7.2 3.8 14.4 8.6 5.7 3.9 22.6 20.8 22.6 22.7 0 .8.9 2.2 2 3.2a57 57 0 0 1 9 16c.6 1.8 1.8 3.9 2.6 4.5.7.7 1.4 2.7 1.4 4.5s.7 3.8 1.5 4.5q1.5 1.3 1.5 6.7c0 3 .5 6.3 1.1 7.4.7 1.3 1 29.4.9 87.7 0 74.6.1 86 1.4 87.7.9 1.1 1.6 3.7 1.6 5.9 0 2.1 1 5.5 2.2 7.5 5.6 9.4 8.2 13.1 9.3 13.1.7 0 2 .9 3 2 8.7 9.7 33.6 11 42.3 2.4.7-.8 2-1.4 2.7-1.4 2.2 0 11.4-10.1 12.6-14a20 20 0 0 1 2.7-5.3q1.7-1.8 1.4-6.4c-.1-2.5.4-5.5 1-6.6a8 8 0 0 0 .9-4.5q-.1-2 .8-2.2c2 0 1.2-6.4-.9-7.8-1.9-1.1-2-2.3-2-16.7s.1-15.5 2-16.5c2.1-1.1 2.8-4 1-4q-.9-.1-1-1.5.1-1.4 1-1.5c2 0 1.1-7.4-1.1-8.8-2.9-1.8-2.6-38.5.4-40.6 2.1-1.6 2.2-5.5.1-7.1-2.6-1.9-3-9.8-.6-12.1 2.9-2.8 3-12 .2-12.7-2.6-.7-2.6-3.7 0-4.4 2-.5 2.9-3.3 1-3.3q-.9-.1-1-1.5.1-1.4 1-1.5c2.1 0 1.2-13.4-1-15.3-1.9-1.6-2.1-2.8-1.9-17.3.1-12.5-.2-15.9-1.4-17.2-.8-.9-1.7-3.7-2.1-6.2-1-8.8-1.8-11.9-3.2-13.1-.8-.6-1.4-2.6-1.4-4.5s-.4-3.5-.9-3.9-4.3-7.4-8.5-15.9a87 87 0 0 0-9-15.9 3 3 0 0 1-1.6-2.6c0-1-2.7-4.7-6-8.2s-6-6.8-6-7.4a177 177 0 0 0-23.9-23.5c-.7 0-3.5-2.3-6.3-5a31 31 0 0 0-5.8-5c-.5 0-3-1.7-5.7-3.9a32 32 0 0 0-7.1-4.5c-1.2-.4-2.2-1.2-2.2-1.7s-2.9-2.3-6.5-4a28 28 0 0 1-7-4 14 14 0 0 0-5-2c-2.5-.6-5-1.7-5.6-2.5S1110.5 8 1109 8s-3.9-.9-5.3-2q-2.5-2-7.1-2c-3.5 0-4.9-.5-5.8-2-2-3.1-231.4-3.2-234.3 0m-283 111.3c-1.8 1.1-8.2 1.8-31.4 3.3-4.9.3-9.4 1.2-10.5 2-1.2.8-4.5 1.4-7.9 1.4-4.3 0-6.5.5-8.4 2a6 6 0 0 1-5.4 1.3q-2.9-.5-5.4 1.1a10 10 0 0 1-4.5 1.6c-1.1 0-3.2.7-4.5 1.6q-2.6 1.6-5.4 1.1-3-.6-5.4 1.3c-1.4 1.1-3.9 2-5.5 2s-3.5.7-4.2 1.5-2.2 1.5-3.4 1.5-4.5 1.1-7.4 2.5-6.3 2.5-7.4 2.5-3.1.9-4.5 2-3.8 2-5.3 2-3.3.6-3.9 1.4-3.5 2-6.4 2.6a47 47 0 0 0-13.7 5.9c-.8.5-4.6 2.4-8.5 4.1a54 54 0 0 0-10 6 15 15 0 0 1-5.9 3.4c-1.7.4-5.2 2.5-7.9 4.7a25 25 0 0 1-6.1 3.9c-.7 0-2.5 1.4-4.2 3.1a30 30 0 0 1-6.4 4.9c-1.9 1-6.4 4.8-10 8.4a33 33 0 0 1-7.8 6.6 211 211 0 0 0-28.2 27.7c0 .8-2.6 4.2-5.7 7.7-3.2 3.5-7.7 9.5-10.1 13.3a54 54 0 0 1-6.2 8.8q-1.8 1.7-2 2.8a69 69 0 0 1-8.9 17c-1 .6-2.1 2.7-2.4 4.6-.6 2.9-4.2 11-7.5 17.1a27 27 0 0 0-4.2 10.5c0 1.3-.4 2.7-1 3s-1 1.9-1 3.5-.7 3.5-1.5 4.4c-.8.8-1.5 2.8-1.5 4.4s-.6 3.5-1.4 4.1a9 9 0 0 0-2.1 4.4c-.4 1.8-1.8 6.4-3.1 10.4a47 47 0 0 0-2.4 10c0 1.6-.7 3.8-1.5 4.9a17 17 0 0 0-1.5 7.5q0 5.7-1.5 6.9c-.9.7-1.5 2.9-1.5 5.2a18 18 0 0 1-1.6 7 14 14 0 0 0-1.1 8.4c.4 3.9.1 5.8-1.1 7.5s-1.7 4.8-1.7 12.6c-.1 8.2-.4 10.5-1.8 12.1s-1.7 4.1-1.7 16.4c0 12-.3 14.8-1.6 15.8-1.3 1.2-1.5 4.5-1.3 23.8.2 25.1.5 24.2-7.2 24.2q-4.5 0-5.9 1.5c-.7.8-2.4 1.5-3.8 1.5-6.1 0-29.2 19.2-29.2 24.3 0 .9-.9 2.3-2.1 3.1-2 1.4-5.9 11-5.9 14.6 0 .9-.7 2.5-1.5 3.6-1 1.3-1.4 4.5-1.5 10.5 0 7.1-.4 9.1-2 11.2-2.8 3.5-2.8 13.4 0 17 1.8 2.3 2 4 2 20.9 0 13.4.3 18.7 1.3 19.6.6.7 1.5 5.6 2 11 1.5 19.4 1.9 22.1 3.3 23.3.8.7 1.4 3 1.4 5.6q0 4.4 2 7.1 2.1 2.5 1.5 5.1-.5 2.6 1.5 6.4c1.1 2.1 1.8 4.3 1.4 4.9a39 39 0 0 0 4.3 15.3 10 10 0 0 1 1.3 4.6c0 1.5.6 3.2 1.4 3.8.8.7 2.6 4.8 4 9.3 1.5 4.4 3.5 9.2 4.6 10.5s2 3.1 2 3.8c0 2.8 22.8 28.5 25.4 28.5.5 0 1.7.6 2.5 1.3 2.6 2.1 10.9 3.9 13.1 2.7 1-.5 3.7-1 5.9-1s4.3-.5 4.6-1c1.6-2.6 3.3-.8 3.8 4.2.9 9.1 2.3 15.8 3.5 17 .7.7 1.2 3.7 1.2 6.7q0 5.5 1.7 7.3c.9 1 1.6 3.3 1.5 5.1 0 1.7.6 4.8 1.3 6.7s2.3 6.7 3.5 10.7c1.1 4 2.5 7.5 3 7.8s1 2.1 1 3.9c0 1.9.7 3.9 1.5 4.6s1.5 2.5 1.5 4.1.4 3.1 1 3.4 1 1.7 1 3c0 1.9 3.7 10 9 19.5l7.5 15c3.7 7.4 7.2 13.8 7.8 14.2a10 10 0 0 1 2.6 3.5 83 83 0 0 0 8.9 13.5c1.7 2.2 3.2 4.5 3.2 5.2s1.8 3 4 5.1 4 4.6 4 5.5c0 2 54.1 56 56.1 56 .8 0 3.1 1.6 5 3.6a86 86 0 0 0 16.8 12.3 43 43 0 0 1 5.9 4.3 15 15 0 0 0 4.2 2.8c.4 0 2.1 1.1 3.7 2.4 1.5 1.3 3.9 2.7 5.2 3.1a71 71 0 0 1 10.5 6.1c4.4 3 8.6 5.4 9.5 5.4 1.4 0 9 4.6 10.2 6.3.8 1 7.6 4.4 11.5 5.7a11 11 0 0 1 4.4 2.6c.7.7 2.2 1.4 3.3 1.4 1.9 0 9.3 2.9 12.7 5.1l5 2.5 6.2 3c1.4.8 3.7 1.4 5 1.4 1.4 0 3.3.9 4.3 2 1.1 1.2 3.1 2 5.1 2 1.8 0 3.6.4 3.9 1s1.8 1 3.3 1 3.6.7 4.6 1.5c1.1.8 3.9 1.5 6.2 1.5 2.5 0 4.7.6 5.4 1.5q1.3 1.4 6 1.5 4.6 0 6 1.5c1 1.1 3.6 1.5 11.4 1.5q10.2 0 12.6 1.5c3.7 2.1 47.3 2.1 51.4 0q2.8-1.5 11.1-1.5c6.1 0 8.6-.4 9.5-1.5q1.3-1.4 6-1.5 4.6 0 6-1.5c.7-.8 2.9-1.5 4.9-1.5s4.9-.7 6.5-1.5 3.9-1.5 5.2-1.5c1.2 0 2.6-.5 2.9-1s1.9-1 3.4-1 3.8-.9 5.1-2 3.3-2 4.4-2 3.9-.9 6.1-2 5.5-2.3 7.4-2.6a35 35 0 0 0 8.2-3.4c2.5-1.5 5.7-3.1 7-3.5a13 13 0 0 0 3.9-2c.8-.7 4.4-2.5 8-4.1s7.6-3.6 8.9-4.6 3.1-1.8 4.1-1.8 3.7-1.5 6.1-3.4 6.6-4.6 9.3-6a52 52 0 0 0 9.2-6.6c2.4-2.2 5-4 5.7-4s2.2-.9 3.2-2 2.5-2 3.2-2 4.3-2.7 7.7-6 6.8-6 7.5-6 6.8-5.4 13.6-12 13-12 13.9-12 2.6-1.6 3.8-3.6c1.1-1.9 3.2-4 4.4-4.5s2.4-1.7 2.4-2.6 5.4-7.2 12.1-13.8S877 941.9 878 940s3.3-4.9 5-6.5c1.8-1.7 4.7-5.3 6.4-8s4-5.6 4.9-6.4c1-.7 1.7-2.1 1.7-3 0-1 1.1-2.8 2.5-4.1s2.5-2.9 2.5-3.6a13 13 0 0 1 2.8-4.6 97 97 0 0 0 8.9-13.3c.7-1.1 3.5-6.7 6.3-12.5a180 180 0 0 1 6.1-12 84 84 0 0 0 7.9-18.6c0-1.2.5-2.6 1.1-2.9a43 43 0 0 0 5.9-12.6c0-1.6 1.9-7.8 3.2-10.3.5-1 1.1-3.8 1.3-6.3a12 12 0 0 1 1.9-6.2c.9-1 1.6-3.1 1.6-4.8s.7-3.6 1.6-4.4q1.6-1.3 1.1-4.8a20 20 0 0 1 1-7.5c.7-2.1 1.3-5.2 1.3-6.8q.1-8.7 9.6-8.8 12.4 0 28-15.8a56 56 0 0 0 14.3-21.2c.6-1.4 2.4-4.8 4-7.5a22 22 0 0 0 3-7.7c.1-1.5.6-3 1.1-3.3s1-1.9 1-3.4.7-3.6 1.5-4.7c.8-1 1.5-3.1 1.5-4.5 0-1.5.7-3.2 1.5-3.9q1.5-1.2 1.5-7.2c0-4.5.5-6.6 2-8.5s1.9-3.4 1.4-6q-.6-3.4 1.1-8a20 20 0 0 0 1.1-10.5c-.4-4.6-.2-6.5 1.1-8.4s1.6-5 1.6-14.7c-.1-10.3.2-12.7 1.8-15.3 3-4.9 2.9-48.9-.1-52.7-1.7-2.2-2-3.6-1.5-8.4.4-4.3.1-6.4-1-7.9a8 8 0 0 1-1.5-4.2c-.1-11.9-25.4-37-37.5-37.2-1.1 0-2.9-.7-3.9-1.5a9 9 0 0 0-4.7-1.5c-3.9 0-4-1.1-3.8-25 .1-18.7-.1-22-1.5-24.9-1.5-2.7-1.7-5.6-1.5-16q.3-12.7-.9-14.8a44 44 0 0 1-1.2-13c0-8.1-.4-11.4-1.5-12.9a17 17 0 0 1-1.5-7.5q0-5.7-1.5-6.9t-1.5-6.9c0-3.2-.6-6.5-1.4-7.6s-1.6-4.7-1.9-8c-1.1-10.7-2.3-16-4-18.5-.9-1.3-1.7-3.6-1.7-5s-.7-3.4-1.5-4.4a9 9 0 0 1-1.5-4.7c0-1.5-.4-3.1-1-3.4s-1-1.7-1-3-1.4-4.7-3.1-7.6a36 36 0 0 1-3.6-8.3c-.3-1.7-2.3-6.5-4.4-10.7a53 53 0 0 1-3.9-8.4 59 59 0 0 1-5.6-10.5 53 53 0 0 0-4.6-8.9 9 9 0 0 1-1.8-4.2c0-1-.9-2.3-1.9-2.9-1.1-.5-2.3-2-2.7-3.2s-1.8-3.7-3.3-5.4a59 59 0 0 1-4.6-6.5l-3.8-6.4c-1-1.6-5-6.2-8.8-10a36 36 0 0 1-6.9-8.5c0-1.9-14-16-15.9-16-.7 0-5.3-3.8-10-8.5a69 69 0 0 0-9.7-8.5c-.5 0-3.4-2.2-6.5-4.8a81 81 0 0 0-14.8-10.1q-2.5-1.4-3.1-2.2c-.9-1.4-7.7-5.7-10.1-6.4-1.3-.4-3.5-1.8-4.9-3a32 32 0 0 0-7.3-4.5c-2.6-1.2-5-2.6-5.3-3.1q-.6-.8-2.3-.9c-1 0-3-.9-4.4-2s-3.9-2-5.5-2a7 7 0 0 1-4.2-1.4c-.6-.8-3.4-2.2-6.1-3.1s-5.1-2.1-5.4-2.6-1.9-.9-3.4-.9-3.8-.9-5.1-2a9 9 0 0 0-4.7-2c-1.3 0-3.1-.4-4.1-.9a54 54 0 0 0-7.7-2.6c-3.3-.9-7.3-2.3-8.8-3.1s-3.8-1.4-5-1.4-3.5-.9-5.2-2c-1.6-1.1-4.2-2-5.7-2s-3-.5-3.3-1-1.7-1-3.1-1-3.6-.7-4.9-1.6q-2.6-1.6-5.4-1.1-3 .6-5.4-1.3-2.5-2-7.7-2c-2.8 0-6.1-.6-7.3-1.2-2.4-1.4-13.5-2.6-32.4-3.4-8.8-.4-12.5-1-13.4-2-1.6-1.9-67.3-2-70.4-.1m85.7 55.8c.9.5 4.5.9 8 .9 3.9.1 7 .6 8.2 1.5s4.2 1.5 7 1.5c2.9 0 5.9.7 7 1.5s3.8 1.5 6.1 1.5 4.6.5 5.3 1.2c1.1 1.1 7.2 2.4 16.4 3.5 2.6.2 5.2 1.1 5.9 1.9.6.8 2.2 1.4 3.6 1.4s4.1.9 6.1 1.9a59 59 0 0 0 20 7.1c1.1 0 2.3.4 2.6.8.7 1.2 15.1 8.2 16.7 8.2 2 0 10.9 4.3 10.9 5.2 0 .5 2.8 2.3 6.3 3.9 6 2.9 10.8 5.6 15.8 9 6.6 4.4 8.4 5.6 11.4 7.4 9.8 6 15.6 11 31 26.7S872 280.6 872 283c0 .5 1.1 2.2 2.5 3.8s3.4 5.1 4.5 7.7 2.7 5.3 3.5 5.9a67 67 0 0 1 9.5 18.9c0 1.3.8 3.4 1.7 4.7a42 42 0 0 1 6.3 14.5c0 1.2.9 3.4 2 4.8s2 3.9 2 5.5.6 3.5 1.4 4.1c.8.7 1.7 3.3 2 5.9.9 8.6 1.8 12.1 3.2 13.3.8.7 1.4 3 1.4 5.7q0 4.4 1.8 6.5c1.2 1.3 1.7 3.6 1.7 7.7.1 3.5.7 6.5 1.5 7.5 1 1.2 1.3 3.8 1.1 9s.2 8.2 1.4 10.5c1.3 2.5 1.6 5.5 1.4 13.5-.3 8.7-.1 10.7 1.4 12.3 1.6 1.7 1.7 6.4 1.7 61.6 0 69.2-.3 66.6 9.1 71.9 5.5 3.1 7.9 3.3 11.7 1.3 1.5-.8 3.9-1.7 5.4-2s6.4-4.3 11.4-9.1c4.8-4.7 9.4-8.5 10.2-8.5 1.8 0 7.3 4.5 8.9 7.4 2 3.4 1.8 49.5-.2 53.2-1.1 2.1-1.5 6.1-1.5 14 0 8.7-.3 11.4-1.5 12.4s-1.5 3.5-1.5 10.5-.4 9.6-1.5 10.5c-.8.7-1.5 2.8-1.5 4.7s-.7 4.8-1.6 6.5-1.3 4-1 5.1-.2 3.3-1 5c-.9 1.6-1.7 4.8-1.9 7.1-.1 2.5-1.6 6.5-3.7 10.1-2 3.3-3.9 7.1-4.3 8.5-1.7 5.9-7.8 9.7-10.5 6.5a6 6 0 0 0-3.9-1.5c-1.5 0-3.6-.7-4.9-1.5-1.9-1.4-2.4-1.4-5.1 0-1.7.8-4.6 1.5-6.5 1.5-5.7 0-16.5 12.6-16.6 19.3 0 1.2-1.2 4-2.5 6.2a16 16 0 0 0-2.5 8.6q0 4.5-1.5 5.9-1.5 1.2-1.5 7c0 4.1-.5 6.4-1.9 8.1a17 17 0 0 0-2.4 6.9 66 66 0 0 1-4.7 20.7c-.6 2.3-1.5 4.5-2 4.8s-1 1.9-1 3.4c0 1.6-.9 3.9-1.9 5.3a14 14 0 0 0-2.6 5.4 61 61 0 0 1-5.9 14.4c-.7.8-2.5 4.4-4.1 8a52 52 0 0 1-4.1 8.1c-.8.8-1.4 2.2-1.4 3 0 1.4-6.6 12.3-11.9 19.5a56 56 0 0 0-4.6 8c-.9 2.2-3.8 6.1-6.4 8.9a40 40 0 0 0-6.4 8c-.9 1.6-3.6 5-6.1 7.5-2.5 2.4-4.6 5.1-4.6 5.9 0 1.9-41 43.1-42.8 43.1-.8 0-3.9 2.4-7 5.4-3.1 2.9-7 6-8.7 6.9-1.6.8-4.3 2.9-5.9 4.6s-3.4 3.1-3.9 3.1a26 26 0 0 0-5.9 4 28 28 0 0 1-6 4c-.6 0-2.3 1.1-4 2.5-1.6 1.4-3.5 2.5-4.2 2.5s-2.1 1-3.2 2.1c-1 1.2-4.2 3.2-7 4.4a21 21 0 0 0-5.8 3.4 3 3 0 0 1-2.2 1.1c-.9 0-4.2 1.6-7.5 3.5a44 44 0 0 1-8.7 4.1c-1.5.4-3.6 1.4-4.7 2.3q-3.8 3.1-16.5 6.7c-3.6.9-6.9 2.1-7.5 2.6s-2.1.8-3.5.8a9 9 0 0 0-4.9 1.9q-2.2 2-6.7 1.8c-2.8 0-5.1.6-6 1.5-1.2 1.2-3.1 1.4-8.4 1-5-.3-7.6 0-10 1.2-4.7 2.3-40.6 2.4-47.1.1a30 30 0 0 0-10.4-1.3c-3.3.1-7-.4-8.2-1s-3.7-1.2-5.5-1.2-5-.9-7.1-2-4.8-2-6.2-2c-3.3 0-17.6-4.8-19.6-6.6-.8-.8-2.9-1.4-4.6-1.4a7 7 0 0 1-4.7-1.9c-.9-1-3-2.1-4.5-2.4s-5.5-2.2-8.9-4.1c-3.3-2-7.2-3.6-8.6-3.6s-3.4-.8-4.4-1.8-3.6-2.7-5.7-3.9a110 110 0 0 1-16.1-9.2 10 10 0 0 0-3.7-2.1c-.5 0-2.4-1.2-4.2-2.7-3-2.6-6.6-5-12.4-8.2-1.5-.8-2.8-1.7-3.1-2a39 39 0 0 0-8.7-6.1c-.5 0-2.2-1.4-3.9-3.1a24 24 0 0 0-5.9-4.6 156 156 0 0 1-18.2-15.6c-10.8-11-22.4-24-24.1-26.7a51 51 0 0 0-6.6-8c-2.5-2.4-4.6-5.2-4.6-6.1s-.9-2.4-2-3.4-3.9-4.9-6.2-8.7c-2.4-3.9-5.6-8.5-7.1-10.3a29 29 0 0 1-4.3-7.9c-.9-2.4-2.2-5-3-5.7-.8-.6-1.4-1.7-1.4-2.4a19 19 0 0 0-3.5-5.6c-1.9-2.4-3.8-6-4.1-7.9a50 50 0 0 0-3.8-9.5 54 54 0 0 1-4.6-12 54 54 0 0 0-2.7-8.5c-.7-1.4-1.3-3.4-1.3-4.5a12 12 0 0 0-2-5q-1.8-2.9-1.4-5.2c.3-1.2-.1-3.6-1-5.4s-1.6-4.4-1.6-5.9-.7-4.5-1.6-6.5c-1-2.4-1.3-5.1-.9-7.2.4-2.5.1-4-1.4-6q-2.1-2.6-2.1-6.8c0-2.6-.6-4.8-1.5-5.5s-1.5-2.7-1.5-4.6-.4-3.6-1-3.9-1-1.9-1-3.4c0-1.7-1.3-4.3-3.3-6.7a20 20 0 0 1-4.1-6.8c-1.2-4.9-10.4-13.1-16.3-14.5a29 29 0 0 1-7-2.6c-2.6-2-6.7-1.8-11 .5-2.1 1.1-4.8 2-6 2s-2.5.4-2.8 1c-.9 1.5-4.5 1.2-4.5-.4 0-.7-.9-2.5-2-3.9s-2-3.8-2-5.3-.6-3.5-1.4-4.3a75 75 0 0 1-6.3-17.6c-.3-1.7-1.4-4-2.4-5.3a6 6 0 0 1-1.3-5.1c.4-1.7-.1-4.1-1-5.9-.9-1.7-1.6-4.4-1.6-6s-.7-4.6-1.5-6.6c-1-2.3-1.3-5-1-6.9.5-2.4.1-3.9-1.4-5.9-1.6-2-2.1-4.1-2.1-8.6q0-6-1.4-7.2c-2.3-1.8-4.1-57.3-2.1-66 1.9-8.9 10.6-10.9 15.2-3.7.5.7 3.6 3.1 7.1 5.4 11.5 7.8 33.2 5.3 33.2-3.7 0-.9.9-2.5 2-3.5 2-1.8 2-3 2-29.1-.1-17.4.3-28 .9-29.3.7-1.2 1.1-11.7 1.1-28.1 0-21.5.3-26.6 1.5-29.1 1.2-2.2 1.5-5.7 1.4-13.5-.1-8.4.2-10.8 1.5-12.3 1.1-1.3 1.6-3.7 1.6-8.7 0-5.2.5-7.6 2-9.9a8 8 0 0 0 1.4-6.2c-.4-2 0-4.9 1-7.4.9-2.3 1.4-4.9 1.1-5.8s.4-3.4 1.4-5.4c1.3-2.6 1.7-4.9 1.4-7.8-.5-3.1-.1-4.7 1.6-6.9 1.1-1.6 2.1-3.9 2.1-5.2a8 8 0 0 1 1.5-4.2 9 9 0 0 0 1.5-4.7c0-1.5.5-3.1 1-3.4s1-1.7 1-2.9a33 33 0 0 1 3.5-9c1.9-3.7 3.5-7.5 3.5-8.5a244 244 0 0 1 29.7-52.3c2.4-2.7 4.3-5.4 4.3-6 0-1.6 23.2-24.8 24.8-24.8.7 0 4.8-3.3 9.1-7.3 4.2-3.9 9-8 10.6-8.9l9.7-6c1.5-1 3.3-1.8 4.1-1.8s2.2-.9 3.2-2 4.1-3.1 6.9-4.5 5.8-2.9 6.6-3.5l11.5-5.6a139 139 0 0 0 11.5-5.9c.8-.7 2.9-1.5 4.5-1.8a53 53 0 0 0 16.6-5.6c3.4-1.7 7.7-3.1 9.5-3.1a16 16 0 0 0 6.1-1.4 36 36 0 0 1 12-3.6 5 5 0 0 0 3.3-1.5q1.2-1.5 6.9-1.5c3.5 0 6.5-.6 7.7-1.5 1-.8 4.1-1.5 6.7-1.5s5.8-.6 7-1.2c3.7-2.1 18.4-3 63.7-3.6 43.8-.7 48.1-.6 51.2.9"/><path d="M752.5 559.1c-2.7 1.6-6.2 3.5-7.7 4.2a42 42 0 0 0-14.3 14.5c-.3 1.5-1.2 4-2 5.5-2.8 5.5-2.1 30 1 33.3 1.4 1.5 2.5 3.1 2.5 3.7 0 3 6.7 8.6 16 13.4 5.7 2.9 30.7 3.5 33 .8.7-.8 1.9-1.5 2.7-1.5 3 0 12.3-10.4 16.3-18.3 4.5-8.9 5.8-22.7 2.5-28.5-.8-1.5-1.9-4.6-2.5-7-1.2-4.8-8.3-13.8-11.7-14.7-1.2-.4-2.9-1.5-3.9-2.6-.9-1-3-1.9-4.5-1.9-1.6 0-4.3-.9-6.1-2-5.2-3.2-14.9-2.7-21.3 1.1m-296.1 7.1a8 8 0 0 1-4.2 1.8c-1.2 0-2.4.5-2.7 1s-2.4 1.9-4.5 3-4.3 3.1-4.9 4.7c-.6 1.5-2.7 5-4.6 7.8-3.1 4.4-3.5 5.7-3.5 11.1 0 4.8-.4 6.5-2 7.9-1.5 1.3-2 3.1-2 6.6 0 3.8.4 5.1 2 5.9q2 1 2 4.5c0 6 8.1 16.2 17.8 22.3 5.4 3.4 28.3 3 33.1-.6 1.7-1.2 3.7-2.2 4.5-2.2s2.3-1.1 3.3-2.5l5.3-7.3c6.6-8.9 7-10.4 7-24.3 0-10-.3-12.9-1.5-13.9a6 6 0 0 1-1.5-3.9c0-3.6-16.4-20.1-19.9-20.1-1.4 0-3.2-.6-4-1.4-2.6-2.3-16.9-2.6-19.7-.4M597.5 601c-11.1 1-12.2 1.7-17 12l-3.1 6.3a19 19 0 0 0-1.4 7.1q0 4.3-2 6.9-2 2.5-2 6.9c0 2.4-.6 5.3-1.4 6.4-1.6 2.2-2.3 11.4-3.2 38.4-.5 16.2-.4 16.6 2.2 23 3 7.2 9.9 14.6 14.6 15.6 1.5.4 3.3 1.3 3.9 2 2.6 3.2 12.1 6.6 16.7 6.1 2.7-.3 6.2.1 8.5.9 4.8 1.7 12 1.8 14.9.3 1.2-.6 3.9-1.1 6.2-1.1 11.1.2 21.1-15.1 16.1-24.7-3.7-7.3-6-8.1-23.6-8.1-15.9 0-15.9 0-18.9-4.2-3.8-5.2-4.3-14.3-1-18.5 1.6-2.1 2-4.1 2-10.7 0-5.2.5-8.7 1.2-9.4a21 21 0 0 0 2-8c1.3-12.3 2.4-18.2 3.6-19.4.8-.8 1.2-4.6 1.2-10.5 0-9.2 0-9.2-4.5-13-5.7-4.8-6.5-5-15-4.3m138.9 189.1c-.9 1-2.4 1.9-3.3 1.9s-4.1 2.5-7.1 5.5-6 5.5-6.6 5.5c-.7 0-2.6 1.1-4.2 2.5a14 14 0 0 1-3.7 2.5c-.5 0-2.7 1.6-5.1 3.5-2.4 2-5.8 4.1-7.6 4.7s-5.4 2.4-7.9 3.9-5.7 3-7 3.4a13 13 0 0 0-3.9 2c-1.4 1.2-3.4 1.7-11.7 3.2-1.8.3-3.8 1.1-4.4 1.9s-3 1.4-5.6 1.4a11 11 0 0 0-6.8 1.9c-1.9 1.4-3.5 1.7-7.2 1.4q-4.9-.4-8.7 1.1c-5.5 2.3-56.5 2.4-61.9.1-2-.8-6.5-1.5-10-1.5q-6.5 0-7.7-1.5c-.7-.9-2.9-1.5-5.4-1.5-2.3 0-5.1-.7-6.2-1.5-1-.8-3.1-1.5-4.6-1.5s-3-.5-3.3-1-2-1-3.7-1c-1.6 0-4.1-.9-5.5-2a9 9 0 0 0-3.8-2c-.6 0-2-1-3.1-2.1-1-1.2-4.2-3.2-7-4.4a54 54 0 0 1-14.1-11.3 66 66 0 0 0-14.3-11.7q-1.3-1.5-6.5-1.5c-7.1 0-18.5 11.1-18.5 17.9 0 3.8 4 13.3 6 14.6.6.4 1.9 2.3 2.9 4.4 2.3 4.3 15.8 17.9 22.8 22.6 6.6 4.5 30.6 16.5 33 16.5 1.2 0 2.6.6 3.2 1.4 1.2 1.4 4.7 2.3 13.3 3.2 2.6.3 5.2 1.2 5.9 2q1.2 1.4 6.6 1.4c3.4 0 6.8.7 9.3 2 6.1 3.1 76.3 3.1 80.3 0 2-1.6 4-2 9.5-2q7 0 8.1-1.4c.7-.8 3.3-1.6 5.9-1.9 7.5-.9 11.6-1.8 13.2-3.2.8-.7 2.9-1.5 4.5-1.8a130 130 0 0 0 35.5-16.2 32 32 0 0 1 7.1-4c1.4-.3 3.9-1.9 5.4-3.5s3.5-3 4.4-3c2.3 0 22.1-20.8 24.2-25.4 3.9-8.6.4-19.7-8-25.3-3.9-2.5-14.5-2.7-16.7-.2M29 793.5c-1.4.8-3.5 1.4-4.8 1.5-1.2 0-3.2 1.1-4.4 2.5s-2.9 2.5-3.7 2.5c-2.7.1-7.6 5.4-10.7 11.5a22 22 0 0 1-4.1 6.2c-2.5 1-1.8 217 .7 218.3 1.6.8 2 2.1 2 5.9q0 4.8 1.5 6.1c.8.7 1.5 2.7 1.5 4.4 0 1.9 1.1 4.7 2.5 6.6s2.5 4.4 2.5 5.5c0 2.9 7.2 17.1 9.9 19.6 1.2 1.1 2.1 2.6 2.1 3.3 0 1.2 1.9 4 8.2 12 1.3 1.7 2.8 4 3.3 5.3 1.4 3.3 32.4 34.2 36 35.9 3.3 1.6 8.5 5.1 12.9 8.9 1.5 1.4 3.4 2.5 4 2.5a158 158 0 0 1 20.6 10.2c1.4.8 6.6 2.7 11.5 4.3s10.2 3.3 11.7 4.1c1.4.8 4.8 1.4 7.5 1.4q4.8 0 7.8 2c4.7 3.1 225.2 3.1 228 0 1-1.1 2.9-2 4.2-2 4.8 0 13.9-8 20.9-18.5 4.7-6.9 5.1-22.7.7-30.3a47 47 0 0 0-29.3-22.8c-2.5-.4-48.2-.8-101.6-1.1-84.6-.3-97.3-.5-98.4-1.8q-1.2-1.5-7.6-1.5c-4.1 0-7.9-.7-10.6-1.9-2.4-1.1-7.7-2.9-11.8-4.2-4.1-1.2-8.6-3-9.9-4a8 8 0 0 0-4.1-1.9c-.9 0-2.6-1.1-3.8-2.5s-2.9-2.5-3.7-2.5c-1.8 0-23.5-20.8-23.5-22.6 0-.7-1-2.5-2.3-4.1a37 37 0 0 1-3.5-5.3l-3.7-7a37 37 0 0 1-3.1-8.3c-.4-2-1.1-4-1.5-4.3-.5-.3-.9-1.8-.9-3.3s-.5-3.2-1.1-3.8a51 51 0 0 1-1-15c.2-12.6 0-14.2-1.9-16.5-2-2.6-2-3.6-2-85.7 0-83.1 0-83.1-3.5-90.1-4.8-9.6-16-18-24-18-1.2 0-2.8-.7-3.5-1.5-1.6-2-12.6-2-16 0m1154 5c-1.4.8-3.6 1.4-5 1.5-2.8 0-12.5 5.9-15.3 9.3a37 37 0 0 0-6.7 11c0 .8-.9 2.2-2 3.2-1.6 1.4-2 3.1-2 7.9 0 3.8-.6 7-1.5 8.3-1.3 1.8-1.5 13.4-1.4 87.7 0 58.2-.3 86.2-1 87.5-.6 1.1-1.1 4.4-1.1 7.4q0 5.5-1.5 6.7c-.8.7-1.5 1.9-1.5 2.7s-.9 2.6-2 4c-1.2 1.5-1.8 3.4-1.5 4.4q.5 1.8-1.4 3.8a21 21 0 0 0-3.6 5.3l-3.3 6.5a72 72 0 0 1-16.4 16.3c-.7 0-3.1 1.7-5.2 3.7a47 47 0 0 1-9.2 6.4 68 68 0 0 0-6.6 3.6c-.7.6-3 1.6-5 2.2s-4.2 1.9-4.8 2.7c-.8.8-3.1 1.4-6 1.4q-4.8 0-7 2c-1.7 1.5-3.7 2-8 2-3.4 0-6.4.6-7.6 1.5-1.6 1.2-15.2 1.4-98.7 1.5-105.6 0-104.7 0-110.8 5.6-1.4 1.3-3 2.4-3.6 2.4-2.2 0-7.9 6.6-10.6 12.2-1.5 3.1-3.2 6-3.7 6.3-2.5 1.5-1.2 22.4 1.7 27.3 3.7 6.5 14 16.9 18.4 18.6 2 .8 3.9 2.2 4.2 3 1.1 2.8 231.7 2.3 234.2-.4q1.8-2 5.7-2c2.1 0 5.5-.9 7.5-2 2.1-1.1 4.3-2 5-2 1.8 0 16.6-5 17.9-6.1 2-1.6 18.8-9.9 20.1-9.9.7 0 2.1-.9 3.1-2.1.9-1.1 3.3-2.9 5.2-3.9s5.1-3.4 6.9-5.4 4.1-3.6 4.9-3.6c2.2 0 23.9-21.6 27.8-27.7 1.9-2.8 3.8-5.4 4.4-5.8a42 42 0 0 0 4.6-6.3l5.5-8.4a10 10 0 0 0 1.9-4.3c0-.8 1-2.5 2.3-3.7a31 31 0 0 0 6.7-13.5c0-1.2.5-2.5 1-2.8 2.6-1.6 5.4-11.2 6.7-22.7.2-2.6 1.1-5.2 1.9-5.9 1.1-.9 1.4-4 1.4-13 0-10.8.2-12 2-13.1 2.4-1.5 3.1-18.2.8-19.1q-1.5-.3-.1-2.5c1-1.6.9-2.3-.2-3.2-1.9-1.5-1.9-4.9-.2-5.6s2.2-13 .7-13.9q-.9-.6.2-2.5c.9-1.4.9-2.2-.1-3.4s-1.1-1.9-.2-3q1.4-1.3-.4-2.6c-1.9-1.6-1.9-5.9 0-6.6 2.6-1 2.2-26.5-.5-28.2q-1.8-1.2-2-2.2c0-.6.9-1.8 2-2.7 2.2-1.9 3.1-19.3 1-19.3-.5 0-1-1.1-1-2.4 0-1.4.5-2.8 1-3.1 2-1.2 1.2-12.9-1-14.3-1.9-1.2-2-2.3-2-26.1 0-15.8-.4-25.2-1-25.6s-1.7-2.2-2.5-4.1-1.8-3.4-2.4-3.4-1.4-1.5-2-3.3q-1.1-3.2-5.8-6.1a42 42 0 0 1-6.6-4.8c-1-1-2.8-1.8-4.1-1.8s-3.7-.7-5.2-1.5a22 22 0 0 0-15.4 0"/></g></svg>',Da=$a;function Fa(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;">${$a}</span>`}class La{constructor(e){a(this,"applicationToken"),a(this,"modalElement",null),this.applicationToken=e}open(){this.modalElement||(this.addStyles(),this.modalElement=document.createElement("div"),this.modalElement.className="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="#7c3aed" stroke-width="3" fill="none"/>\n <rect x="22" y="28" width="20" height="16" rx="3" stroke="#7c3aed" stroke-width="2.5" fill="none"/>\n <path d="M26 28v-4a6 6 0 0 1 12 0v4" stroke="#7c3aed" stroke-width="2.5" stroke-linecap="round"/>\n <circle cx="32" cy="36" r="2" fill="#7c3aed"/>\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 ${Fa(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="#10b981" stroke-width="3" fill="none"/>\n <path d="M20 32 L28 40 L44 24" stroke="#10b981" 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 ${Fa(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,r;e.preventDefault();const a=null==(n=this.modalElement)?void 0:n.querySelector("#neoface-forgot-email"),i=null==(t=this.modalElement)?void 0:t.querySelector(".neoface-forgot-btn-primary"),s=null==(o=this.modalElement)?void 0:o.querySelector("#neoface-forgot-error"),c=null==(r=null==a?void 0:a.value)?void 0:r.trim();if(c){i.disabled=!0,i.textContent="Enviando...",s.style.display="none";try{await Na(c,this.applicationToken),this.renderSuccess()}catch(d){i.disabled=!1,i.textContent="Enviar link",s.style.display="block",s.textContent=d instanceof E?d.message:"Erro ao enviar email. Tente novamente."}}}addStyles(){const e="neoface-forgot-password-modal-styles";if(document.getElementById(e))return;const n=document.createElement("style");n.id=e,n.textContent="\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: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;\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, #1a1a2e 0%, #16213e 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: #7c3aed;\n box-shadow: 0 0 0 3px rgba(124, 58, 237, 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, #7c3aed 0%, #6d28d9 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(124, 58, 237, 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(124, 58, 237, 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 ",document.head.appendChild(n)}}const Ma=(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 qa();default:return e}},Ua={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..."},qa=()=>{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}},Ba=8,Wa=10,Za=26,Va=8,Ka=-8,Ja=15,Ga=-15,Ha=1500,Ya=150,Xa=.35,Qa=.65,ei=.18,ni=.22,ti=2e4;function oi({personData:e,applicationToken:t,onClose:o,onSuccess:r,onPhotosCaptured:a,onError:i}){const s=n.useRef(null),d=n.useRef(null),l=n.useRef(null),u=n.useRef(null),p=n.useRef(null),f=n.useRef(!1),h=n.useRef("center"),m=n.useRef(null),g=n.useRef(null),v=n.useRef(!1),b=n.useRef(null),[w,x]=n.useReducer(Ma,void 0,qa),[_,k]=n.useState(!1),[E,R]=n.useState("ok"),[T,O]=n.useState(!1);n.useEffect((()=>{if("liveness"===w.status){const e=w.step;h.current!==e&&(h.current=e,f.current||(u.current&&(u.current=null),p.current&&(clearInterval(p.current),p.current=null),x({type:"UPDATE_PROGRESS",progress:0}))),b.current={stepSequence:w.stepSequence,currentStepIndex:w.currentStepIndex,capturedPhotos:w.capturedPhotos},g.current&&clearTimeout(g.current),"complete"!==w.step&&(g.current=window.setTimeout((()=>{x({type:"ERROR",message:"Tempo limite atingido para o movimento. Por favor, tente novamente em um ambiente bem iluminado.",retryable:!0})}),ti))}}),[w.status,"liveness"===w.status&&w.step,"liveness"===w.status&&w.currentStepIndex]);const S=e=>{if(f.current||"complete"===h.current)return;const n=Date.now();e?u.current||(u.current=n,p.current&&clearInterval(p.current),p.current=window.setInterval((()=>{if(!u.current)return;const e=Date.now()-u.current,n=Math.min(e/Ha*100,100);x({type:"UPDATE_PROGRESS",progress:n}),n>=100&&(clearInterval(p.current),p.current=null,I())}),50)):u.current&&(u.current=null,p.current&&(clearInterval(p.current),p.current=null),x({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([c.nets.tinyFaceDetector.loadFromUri(e),c.nets.faceLandmark68Net.loadFromUri(e)]),n])}catch(e){x({type:"ERROR",message:"Não foi possível carregar os modelos de IA. Verifique sua conexão e tente novamente.",retryable:!0})}})()}),[]),n.useEffect((()=>()=>{l.current&&(l.current.getTracks().forEach((e=>{e.stop()})),l.current=null),s.current&&(s.current.srcObject=null),m.current&&(clearTimeout(m.current),m.current=null),p.current&&(clearInterval(p.current),p.current=null),g.current&&(clearTimeout(g.current),g.current=null)}),[]),n.useEffect((()=>{let e=!0;return(async()=>{if("liveness"===w.status&&!l.current){v.current=!1,m.current&&(clearTimeout(m.current),m.current=null),m.current=window.setTimeout((()=>{e&&!1===v.current&&x({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(;!s.current&&e<50;)await new Promise((e=>setTimeout(e,100))),e++;return s.current},o=await t();if(!o)throw new Error("Elemento de vídeo não encontrado");o.srcObject=n,l.current=n,o.onloadedmetadata=()=>{o.play().then((()=>{e&&O(!0)}))}}catch(n){if(!e)return;m.current&&(clearTimeout(m.current),m.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.")),x({type:"ERROR",message:t,retryable:!0})}}})(),()=>{e=!1,m.current&&(clearTimeout(m.current),m.current=null),l.current&&(l.current.getTracks().forEach((e=>e.stop())),l.current=null),p.current&&(clearInterval(p.current),p.current=null),u.current=null}}),[w.status]),n.useEffect((()=>{if("liveness"!==w.status||!s.current)return;let e=!0,n=0;const t=async()=>{if(!e||"liveness"!==w.status)return;if(f.current||"complete"===h.current)return void requestAnimationFrame(t);const o=Date.now();if(o-n<Ya)requestAnimationFrame(t);else{n=o;try{const n=await c.detectSingleFace(s.current,new c.TinyFaceDetectorOptions({inputSize:224,scoreThreshold:.35})).withFaceLandmarks();if(!e)return;const o=!!n;if(k(o),o&&n.detection){const e=(e=>{if(!e||!s.current)return"not-detected";const{box:n}=e.detection,t=s.current.videoWidth||640,o=s.current.videoHeight||480,r=n.width/t;if(r<Xa)return"too-far";if(r>Qa)return"too-close";const a=n.x+n.width/2,i=n.y+n.height/2,c=Math.abs(a-t/2)/t,d=Math.abs(i-o/2)/o;return c>ei||d>ni?"not-centered":"ok"})(n);if("not-detected"!==e&&R(e),"ok"!==e)return S(!1),void requestAnimationFrame(t)}if(o&&n.landmarks){const e=(e=>{try{const n=e.positions||e._positions;if(!Array.isArray(n)||n.length<68)return null;const t=e=>{const t=n[e];return{x:void 0!==t._x?t._x:t.x,y:void 0!==t._y?t._y:t.y}},o=t(30),r=t(8),a=t(36),i=t(45),s=(a.x+i.x)/2,c=(o.x-s)/Math.abs(i.x-a.x)*90,d=(a.y+i.y)/2,l=o.y-d,u=-l/Math.abs(r.y-d)*90+Za;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)<Ba&&Math.abs(n)<Wa;case"up":return e>Va;case"down":return e<Ka;case"left":return n>Ja;case"right":return n<Ga;default:return!1}})(e.pitch,e.yaw,h.current);S(n)}}else u.current&&(u.current=null,p.current&&(clearInterval(p.current),p.current=null),x({type:"UPDATE_PROGRESS",progress:0}))}catch(r){}e&&"liveness"===w.status&&requestAnimationFrame(t)}},o=()=>{e&&s.current&&(v.current=!0,m.current&&(clearTimeout(m.current),m.current=null),t())},r=s.current;if(r&&r.readyState>=2){const n=setTimeout(o,200);return()=>{e=!1,clearTimeout(n),p.current&&(clearInterval(p.current),p.current=null),u.current=null}}{const n=()=>{e&&o()};let t=0;const a=50,i=window.setInterval((()=>{t++,e?s.current&&s.current.readyState>=2?(clearInterval(i),s.current.removeEventListener("canplay",n),o()):t>=a&&clearInterval(i):clearInterval(i)}),300);return null==r||r.addEventListener("canplay",n,{once:!0}),()=>{e=!1,clearInterval(i),null==r||r.removeEventListener("canplay",n),p.current&&(clearInterval(p.current),p.current=null),u.current=null}}}),[w.status]);const I=async()=>{if(!s.current||!d.current||f.current)return;f.current=!0,u.current=null;const e=b.current;if(!e)return void(f.current=!1);const n=d.current,t=s.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(f.current=!1);const t=e.currentStepIndex+1,o=e.stepSequence[t];if("complete"===o){const t=[...e.capturedPhotos,n];x({type:"START_PROCESSING"}),N(t)}else setTimeout((()=>{f.current=!1,x({type:"NEXT_STEP",step:o,photo:n})}),100)}),"image/jpeg",.85)):f.current=!1},N=async n=>{var o;try{if(x({type:"START_PROCESSING"}),t&&n.length>0)try{const{identifyPersonAsync:e}=await Promise.resolve().then((()=>Ca)),r=new Promise((e=>setTimeout((()=>e(null)),5e3))),a=await Promise.race([e(n[0],t,{maxRetries:3,interval:1e3}),r]);if(a&&a.personFound)return void x({type:"DUPLICATE",personName:(null==(o=a.person)?void 0:o.name)||"Pessoa identificada"})}catch(s){}if(a)return x({type:"SUCCESS"}),void a(n);if(!e||!t)throw new Error("Dados de registro não fornecidos");const i=await ba(e,n,t),c={success:i.success,message:i.message,person_id:i.person_id,user_id:i.user_id,person_validated:i.person_validated,face_processing:i.face_processing,onboarding_link:i.onboarding_link};x({type:"SUCCESS"}),r&&r(c)}catch(c){const e=c instanceof Error?c.message:"Erro desconhecido";x({type:"ERROR",message:e}),i(e)}};return y.jsxs(y.Fragment,{children:[y.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, #1a1a2e 0%, #16213e 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: #7c3aed;\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, #7c3aed 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: #10b981;\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, #7c3aed 0%, #6d28d9 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(124, 58, 237, 0.3);\n }\n\n .primary-button:hover {\n transform: translateY(-2px);\n box-shadow: 0 8px 24px rgba(124, 58, 237, 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: 'SF Pro Display', -apple-system, system-ui, sans-serif;\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(124, 58, 237, 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, #7c3aed 0%, #10b981 100%);\n border-radius: 2px;\n transition: width 0.05s linear;\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(124, 58, 237, 0.2);\n border-top-color: #7c3aed;\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(124, 58, 237, 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: #10b981;\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(124, 58, 237, 0.1);\n color: #7c3aed;\n padding: 20px;\n border-radius: 50%;\n border: 2px solid rgba(124, 58, 237, 0.2);\n box-shadow: 0 0 30px rgba(124, 58, 237, 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: #10b981;\n border-radius: 50%;\n padding: 4px;\n border: 3px solid #16213e;\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 "}),y.jsx("div",{className:"modal-overlay",children:y.jsxs("div",{className:"modal-content",children:[y.jsx("button",{className:"close-button",onClick:o,children:"×"}),"liveness"===w.status&&(()=>{if("liveness"!==w.status)return null;const e=`${w.currentStepIndex+1}/${w.stepSequence.length-1}`,n=w.stepProgress;return y.jsxs("div",{className:"liveness-container",children:[y.jsx("div",{className:"progress-indicator",children:y.jsx("span",{className:"progress-text",children:e})}),_&&"ok"!==E&&y.jsxs("div",{className:"status-badge "+("not-centered"===E?"warning":"error"),children:["too-far"===E&&"Aproxime-se mais","too-close"===E&&"Afaste-se um pouco","not-centered"===E&&"Centralize seu rosto"]}),y.jsx("div",{className:"video-wrapper",children:y.jsx("div",{className:`video-circle ${_&&"ok"===E?"face-detected":""} ${n>0?"capturing":""}`,children:y.jsx("video",{ref:s,className:"video-feed "+(T?"ready":""),autoPlay:!0,muted:!0,playsInline:!0})})}),y.jsxs("div",{className:"instruction-box",children:[y.jsx("p",{className:"instruction-text",children:Ua[w.step]}),n>0&&y.jsx("div",{className:"progress-bar",children:y.jsx("div",{className:"progress-fill",style:{width:`${n}%`}})})]}),y.jsxs("div",{className:"branding-small",children:[y.jsx("span",{className:"brand-logo-small",style:{display:"inline-flex",width:18,height:18,color:"currentColor"},dangerouslySetInnerHTML:{__html:Da}}),y.jsx("span",{children:"NeoFaceId by"}),y.jsx("span",{className:"brand-name",children:"OCTA"})]})]})})(),"camera-loading"===w.status&&y.jsxs("div",{className:"processing-container",children:[y.jsxs("div",{className:"spinner-wrapper",children:[y.jsx("div",{className:"spinner"}),y.jsx("div",{className:"spinner-ring"})]}),y.jsx("h3",{children:"Inicializando câmera"}),y.jsx("p",{children:"Aguarde enquanto preparamos a câmera..."}),y.jsxs("div",{className:"branding",style:{marginTop:"40px",paddingTop:"24px",borderTop:"1px solid rgba(255, 255, 255, 0.1)"},children:[y.jsx("span",{children:"NeoFaceId by"}),y.jsx("span",{className:"brand-name",children:"OCTA"})]})]}),"processing"===w.status&&y.jsxs("div",{className:"processing-container",children:[y.jsxs("div",{className:"spinner-wrapper",children:[y.jsx("div",{className:"spinner"}),y.jsx("div",{className:"spinner-ring"})]}),y.jsx("h3",{children:"Processando biometria"}),y.jsx("p",{children:"Analisando suas capturas faciais..."}),y.jsxs("div",{className:"branding",style:{marginTop:"40px",paddingTop:"24px",borderTop:"1px solid rgba(255, 255, 255, 0.1)"},children:[y.jsx("span",{children:"NeoFaceId by"}),y.jsx("span",{className:"brand-name",children:"OCTA"})]})]}),"error"===w.status&&("error"!==w.status?null:y.jsxs("div",{className:"result-container error",children:[y.jsx("div",{className:"result-icon error-icon",children:y.jsxs("svg",{width:"60",height:"60",viewBox:"0 0 60 60",fill:"none",children:[y.jsx("circle",{cx:"30",cy:"30",r:"28",stroke:"currentColor",strokeWidth:"3"}),y.jsx("path",{d:"M20 20 L40 40 M40 20 L20 40",stroke:"currentColor",strokeWidth:"3",strokeLinecap:"round"})]})}),y.jsx("h3",{children:"Não foi possível processar"}),y.jsx("p",{children:w.message}),y.jsxs("div",{className:"button-group",children:[w.retryable&&y.jsx("button",{className:"secondary-button",onClick:()=>x({type:"RESET"}),children:"Tentar Novamente"}),y.jsx("button",{className:"ghost-button",onClick:o,children:"Cancelar"})]})]})),"success"===w.status&&y.jsxs("div",{className:"result-container success",children:[y.jsx("div",{className:"result-icon success-icon",children:y.jsxs("svg",{width:"60",height:"60",viewBox:"0 0 60 60",fill:"none",children:[y.jsx("circle",{cx:"30",cy:"30",r:"28",stroke:"currentColor",strokeWidth:"3"}),y.jsx("path",{d:"M15 30 L25 40 L45 20",stroke:"currentColor",strokeWidth:"3",strokeLinecap:"round",strokeLinejoin:"round"})]})}),y.jsx("h3",{children:a?"Captura concluída!":"Verificação concluída!"}),y.jsx("p",{children:a?"Suas capturas faciais foram realizadas":"Sua biometria foi registrada com sucesso"}),y.jsx("button",{className:"primary-button",onClick:o,children:"Continuar"})]}),"duplicate"===w.status&&(()=>{if("duplicate"!==w.status)return null;const e=w.personName&&"Pessoa identificada"!==w.personName?`Olá, ${w.personName.split(" ")[0]}!`:"Olá!";return y.jsxs("div",{className:"result-container duplicate scale-in",children:[y.jsx("h3",{style:{marginTop:"0px"},children:e}),y.jsx("p",{style:{marginBottom:"32px",fontSize:"15px"},children:"Identificamos seu cadastro biométrico em nossa rede. Você já faz parte da NeoFaceId!"}),y.jsxs("div",{className:"button-group-vertical",children:[y.jsx("button",{className:"primary-button",onClick:()=>{o(),window.location.href="/"},children:"Ir para o Login"}),y.jsx("button",{className:"secondary-button",style:{marginTop:"12px"},onClick:()=>{o(),new La(t??"").open()},children:"Esqueci minha senha"}),y.jsxs("div",{className:"support-section",children:[y.jsx("p",{children:"Não reconhece esta conta?"}),y.jsx("button",{className:"ghost-button",onClick:()=>window.open("https://support.neofaceid.com","_blank"),children:"Falar com Suporte"})]})]}),y.jsxs("div",{className:"branding",style:{marginTop:"32px",paddingTop:"20px",borderTop:"1px solid rgba(255, 255, 255, 0.08)",width:"100%"},children:[y.jsx("span",{className:"brand-logo",style:{display:"inline-flex",width:18,height:18,color:"currentColor"},dangerouslySetInnerHTML:{__html:Da}}),y.jsx("span",{children:"NeoFaceId by"}),y.jsx("span",{className:"brand-name",children:"OCTA"})]})]})})()]})}),y.jsx("canvas",{ref:d})]})}function ri({purpose:e,legalBasis:n,privacyPolicyUrl:t,retentionDays:o,onAccept:r,onDecline:a}){return y.jsxs(y.Fragment,{children:[y.jsx("style",{children:"\n @keyframes neofaceidConsentFadeIn {\n from { opacity: 0; }\n to { opacity: 1; }\n }\n\n @keyframes neofaceidConsentSlideUp {\n from {\n opacity: 0;\n transform: translateY(20px);\n }\n to {\n opacity: 1;\n transform: translateY(0);\n }\n }\n\n .neofaceid-consent-overlay {\n position: fixed;\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 z-index: 10001;\n padding: 20px;\n animation: neofaceidConsentFadeIn 0.3s ease-out;\n font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;\n }\n\n .neofaceid-consent-modal {\n background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);\n border-radius: 20px;\n padding: 32px;\n max-width: 420px;\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: neofaceidConsentSlideUp 0.4s ease-out;\n }\n\n .neofaceid-consent-title {\n font-size: 20px;\n font-weight: 700;\n color: white;\n margin: 0 0 12px 0;\n }\n\n .neofaceid-consent-message {\n font-size: 14px;\n color: rgba(255, 255, 255, 0.7);\n margin: 0 0 16px 0;\n line-height: 1.5;\n }\n\n .neofaceid-consent-link {\n display: inline-block;\n font-size: 14px;\n color: #a78bfa;\n text-decoration: underline;\n margin-bottom: 24px;\n }\n\n .neofaceid-consent-link:hover {\n color: #c4b5fd;\n }\n\n .neofaceid-consent-actions {\n display: flex;\n flex-direction: column;\n gap: 12px;\n }\n\n .neofaceid-consent-button {\n padding: 14px 24px;\n border-radius: 12px;\n border: none;\n font-size: 16px;\n font-weight: 600;\n cursor: pointer;\n transition: all 0.2s;\n font-family: inherit;\n }\n\n .neofaceid-consent-button-primary {\n background: linear-gradient(135deg, #7c3aed 0%, #6d28d9 100%);\n color: white;\n box-shadow: 0 4px 16px rgba(124, 58, 237, 0.3);\n }\n\n .neofaceid-consent-button-primary:hover {\n transform: translateY(-2px);\n box-shadow: 0 8px 24px rgba(124, 58, 237, 0.4);\n }\n\n .neofaceid-consent-button-primary:active {\n transform: translateY(0);\n }\n\n .neofaceid-consent-button-secondary {\n background: rgba(255, 255, 255, 0.1);\n color: white;\n border: 1px solid rgba(255, 255, 255, 0.2);\n }\n\n .neofaceid-consent-button-secondary:hover {\n background: rgba(255, 255, 255, 0.15);\n border-color: rgba(255, 255, 255, 0.3);\n }\n\n @media (max-width: 640px) {\n .neofaceid-consent-modal {\n padding: 24px;\n border-radius: 16px;\n }\n\n .neofaceid-consent-title {\n font-size: 18px;\n }\n }\n "}),y.jsx("div",{className:"neofaceid-consent-overlay",children:y.jsxs("div",{className:"neofaceid-consent-modal",children:[y.jsxs("h3",{className:"neofaceid-consent-title",children:["Uso do seu rosto para ",e]}),y.jsxs("p",{className:"neofaceid-consent-message",children:["Esta captura é realizada com base em ",n,". Os dados biométricos coletados são retidos por até ",o," dias, conforme a finalidade informada."]}),y.jsx("a",{href:t,target:"_blank",rel:"noopener noreferrer",className:"neofaceid-consent-link",children:"Ver política de privacidade"}),y.jsxs("div",{className:"neofaceid-consent-actions",children:[y.jsx("button",{type:"button",className:"neofaceid-consent-button neofaceid-consent-button-primary",onClick:r,children:"Aceito e continuar"}),y.jsx("button",{type:"button",className:"neofaceid-consent-button neofaceid-consent-button-secondary",onClick:a,children:"Recusar"})]})]})})]})}class ai{constructor(){a(this,"container",null),a(this,"root",null)}show(e){this.container||(this.container=document.createElement("div"),this.container.id="neofaceid-consent-modal-container",document.body.appendChild(this.container),this.root=p.createRoot(this.container),this.root.render(y.jsx(ri,{...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)}}const ii={purpose:"autenticação facial",legalBasis:"seu consentimento explícito (Art. 7º, I da LGPD)",privacyPolicyUrl:"https://neofaceid.com/privacidade",retentionDays:90};function si(e={}){return new Promise((n=>{(new ai).show({...ii,...e,onAccept:()=>n(!0),onDecline:()=>n(!1)})}))}class ci{constructor(e){a(this,"modal",null),a(this,"video",null),a(this,"canvas",null),a(this,"stream",null),a(this,"options"),a(this,"countdownInterval",null),a(this,"isCapturing",!1),this.options=e}async open(){try{await this.createModal(),await this.initializeCamera(),this.startCountdown()}catch(e){this.options.onError(new E("Erro ao inicializar câmera: "+e.message,k.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-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">×</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 class="neofaceid-countdown">\n <span class="neofaceid-countdown-number">${this.options.countdown||3}</span>\n </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>\n </div>\n `,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)}}startCountdown(){if(!this.modal)return;const e=this.modal.querySelector(".neofaceid-countdown-number"),n=this.modal.querySelector(".neofaceid-capture-btn"),t=this.modal.querySelector(".neofaceid-status-text");let o=this.options.countdown||3;e&&(e.textContent=o.toString()),this.countdownInterval=window.setInterval((()=>{o--,e&&(e.textContent=o.toString()),o<=0&&(this.countdownInterval&&(clearInterval(this.countdownInterval),this.countdownInterval=null),e&&(e.style.display="none"),n&&(n.disabled=!1,n.textContent="Capturar Agora"),t&&(t.textContent="Pronto para capturar!"),"auto"===this.options.mode&&setTimeout((()=>this.captureImage()),500))}),1e3)}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}`;let 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 E("Erro ao capturar imagem: "+e.message,k.CAPTURE_ERROR))}finally{this.isCapturing=!1}}}async detectBiometricType(e){try{const{detectBiometricType:n}=await Promise.resolve().then((()=>Si)),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.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();const t=document.createElement("style");t.id=e,t.textContent="\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: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;\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: 28px;\n cursor: pointer;\n color: #666;\n padding: 0;\n width: 32px;\n height: 32px;\n display: flex;\n align-items: center;\n justify-content: center;\n border-radius: 50%;\n transition: background-color 0.2s;\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 #4CAF50;\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-countdown {\n position: absolute;\n top: 20px;\n right: 20px;\n background: rgba(0, 0, 0, 0.7);\n color: white;\n padding: 10px;\n border-radius: 50%;\n width: 50px;\n height: 50px;\n display: flex;\n align-items: center;\n justify-content: center;\n }\n\n .neofaceid-countdown-number {\n font-size: 24px;\n font-weight: bold;\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: #4CAF50;\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 ",document.head.appendChild(t)}}class di{constructor(){a(this,"container",null),a(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: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;\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(124, 58, 237, 0.3));\n }\n\n /* Cores por estado */\n .neofaceid-state-preparing .neofaceid-logo { filter: drop-shadow(0 0 15px rgba(124, 58, 237, 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: #10b981;\n animation: neofaceid-scaleIn 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);\n }\n\n .neofaceid-error-icon {\n width: 80px;\n height: 80px;\n color: #ef4444;\n animation: neofaceid-errorShake 0.5s linear, neofaceid-scaleIn 0.4s ease-out;\n }\n "}getStatusText(){switch(this.currentStatus){case"preparing":return"Iniciando câmera";case"detecting":return"Posicione seu rosto";case"waiting-for-face":return"Aguardando rosto";case"capturing":return"Capturando";case"verifying":return"Verificando identidade";case"success":return"Identificado!";case"error":return"Falha na identificação";default:return""}}renderContent(){const e=["detecting","waiting-for-face","verifying"].includes(this.currentStatus),n=!["success","error"].includes(this.currentStatus),t="success"===this.currentStatus,o="error"===this.currentStatus,r=this.getStatusText(),a=["preparing","detecting","waiting-for-face","capturing","verifying"].includes(this.currentStatus);return`\n <style>${this.getStyles()}</style>\n <div class="neofaceid-overlay-container neofaceid-state-${this.currentStatus}">\n <div class="neofaceid-overlay-content">\n <div class="neofaceid-visual-wrapper">\n ${n?`<span class="neofaceid-logo ${e?"pulsing":""}" style="display:inline-flex;align-items:center;justify-content:center;color:currentColor;">${Fa(48).replace("width:18px;height:18px","width:100%;height:100%")}</span>`:""}\n \n ${t?'\n <div class="neofaceid-status-icon">\n <svg class="neofaceid-success-icon" viewBox="0 0 60 60" fill="none" xmlns="http://www.w3.org/2000/svg">\n <circle cx="30" cy="30" r="28" stroke="currentColor" stroke-width="3" fill="none"/>\n <path d="M15 30 L25 40 L45 20" stroke="currentColor" stroke-width="3" stroke-linecap="round" stroke-linejoin="round" fill="none"/>\n </svg>\n </div>\n ':""}\n \n ${o?'\n <div class="neofaceid-status-icon">\n <svg class="neofaceid-error-icon" viewBox="0 0 60 60" fill="none" xmlns="http://www.w3.org/2000/svg">\n <circle cx="30" cy="30" r="28" stroke="currentColor" stroke-width="3" fill="none"/>\n <path d="M20 20 L40 40 M40 20 L20 40" stroke="currentColor" stroke-width="3" stroke-linecap="round"/>\n </svg>\n </div>\n ':""}\n </div>\n \n ${r?`\n <div class="neofaceid-status-text">\n ${r}${a?'\n <span class="neofaceid-dots">\n <span class="neofaceid-dot">.</span>\n <span class="neofaceid-dot">.</span>\n <span class="neofaceid-dot">.</span>\n </span>\n ':""}\n </div>\n `:""}\n </div>\n </div>\n `}show(e="preparing"){this.container?this.updateStatus(e):(this.container=document.createElement("div"),this.container.id="neofaceid-status-overlay",this.currentStatus=e,this.container.innerHTML=this.renderContent(),document.body.appendChild(this.container))}updateStatus(e){this.currentStatus=e,this.container&&(this.container.innerHTML=this.renderContent())}close(){if(this.container){const e=this.container.querySelector(".neofaceid-overlay-container");e&&e.classList.add("fade-out"),setTimeout((()=>{this.container&&document.body.contains(this.container)&&document.body.removeChild(this.container),this.container=null}),300)}}}function li({error:e,onRetry:n,onCredentials:t,onCancel:o,applicationToken:r}){return y.jsxs(y.Fragment,{children:[y.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: rgba(0, 0, 0, 0.6);\n backdrop-filter: blur(8px);\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 }\n\n .neofaceid-fallback-prompt {\n background: linear-gradient(135deg, #1a1a2e 0%, #16213e 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 text-align: center;\n }\n\n .neofaceid-fallback-icon {\n width: 64px;\n height: 64px;\n margin: 0 auto 20px;\n color: #ef4444;\n animation: scaleIn 0.4s ease-out;\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 .neofaceid-fallback-title {\n font-size: 22px;\n font-weight: 700;\n color: white;\n margin: 0 0 12px 0;\n }\n\n .neofaceid-fallback-message {\n font-size: 15px;\n color: rgba(255, 255, 255, 0.7);\n margin: 0 0 28px 0;\n line-height: 1.5;\n }\n\n .neofaceid-fallback-actions {\n display: flex;\n flex-direction: column;\n gap: 12px;\n }\n\n .neofaceid-fallback-button {\n padding: 14px 24px;\n border-radius: 12px;\n border: none;\n font-size: 16px;\n font-weight: 600;\n cursor: pointer;\n transition: all 0.2s;\n font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;\n }\n\n .neofaceid-fallback-button-primary {\n background: linear-gradient(135deg, #7c3aed 0%, #6d28d9 100%);\n color: white;\n box-shadow: 0 4px 16px rgba(124, 58, 237, 0.3);\n }\n\n .neofaceid-fallback-button-primary:hover {\n transform: translateY(-2px);\n box-shadow: 0 8px 24px rgba(124, 58, 237, 0.4);\n }\n\n .neofaceid-fallback-button-primary:active {\n transform: translateY(0);\n }\n\n .neofaceid-fallback-button-secondary {\n background: rgba(255, 255, 255, 0.1);\n color: white;\n border: 1px solid rgba(255, 255, 255, 0.2);\n }\n\n .neofaceid-fallback-button-secondary:hover {\n background: rgba(255, 255, 255, 0.15);\n border-color: rgba(255, 255, 255, 0.3);\n }\n\n .neofaceid-fallback-button-ghost {\n background: transparent;\n color: rgba(255, 255, 255, 0.7);\n padding: 10px;\n }\n\n .neofaceid-fallback-button-ghost:hover {\n color: white;\n background: rgba(255, 255, 255, 0.05);\n }\n\n @media (max-width: 640px) {\n .neofaceid-fallback-prompt {\n padding: 24px;\n border-radius: 16px;\n }\n\n .neofaceid-fallback-title {\n font-size: 20px;\n }\n }\n "}),y.jsx("div",{className:"neofaceid-fallback-overlay",children:y.jsxs("div",{className:"neofaceid-fallback-prompt",children:[y.jsx("div",{className:"neofaceid-fallback-icon",children:y.jsxs("svg",{viewBox:"0 0 64 64",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[y.jsx("circle",{cx:"32",cy:"32",r:"30",stroke:"currentColor",strokeWidth:"3",fill:"none"}),y.jsx("path",{d:"M20 20 L44 44 M44 20 L20 44",stroke:"currentColor",strokeWidth:"3",strokeLinecap:"round"})]})}),y.jsx("h3",{className:"neofaceid-fallback-title",children:"Não foi possível reconhecer"}),y.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."}),y.jsxs("div",{className:"neofaceid-fallback-actions",children:[y.jsx("button",{type:"button",className:"neofaceid-fallback-button neofaceid-fallback-button-primary",onClick:n,children:"Tentar Novamente"}),y.jsx("button",{type:"button",className:"neofaceid-fallback-button neofaceid-fallback-button-secondary",onClick:t,children:"Entrar com Email e Senha"}),r&&y.jsx("button",{type:"button",className:"neofaceid-fallback-button neofaceid-fallback-button-ghost",onClick:()=>{new La(r).open()},children:"Esqueceu sua senha?"}),o&&y.jsx("button",{type:"button",className:"neofaceid-fallback-button neofaceid-fallback-button-ghost",onClick:o,children:"Cancelar"})]})]})})]})}class ui{constructor(){a(this,"container",null),a(this,"root",null)}show(e,n,t,o,r){this.container||(this.container=document.createElement("div"),this.container.id="neofaceid-fallback-prompt",document.body.appendChild(this.container),this.root=p.createRoot(this.container),this.render(e,n,t,o,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,o,r){this.root&&this.container&&this.root.render(y.jsx(li,{error:e,onRetry:()=>{this.close(),n()},onCredentials:()=>{this.close(),t()},applicationToken:r??"",onCancel:()=>{this.close(),null==o||o()}}))}}class pi{constructor(e){a(this,"options"),a(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(){this.addStyles(),this.modalElement=document.createElement("div"),this.modalElement.className="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 ${Fa(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";if(document.getElementById(e))return;const n=document.createElement("style");n.id=e,n.textContent="\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: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;\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, #1a1a2e 0%, #16213e 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: #7c3aed;\n box-shadow: 0 0 0 3px rgba(124, 58, 237, 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, #7c3aed 0%, #6d28d9 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(124, 58, 237, 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(124, 58, 237, 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: 'SF Pro Display', -apple-system, system-ui, sans-serif;\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 ",document.head.appendChild(n)}async handleSubmit(e){e.preventDefault();const n=this.modalElement.querySelector("#email"),t=this.modalElement.querySelector("#password"),o=this.modalElement.querySelector(".neoface-email-submit-btn"),r=this.modalElement.querySelector("#login-error"),a=e=>{r.textContent=e,r.style.display="block"};r.style.display="none",r.textContent="";const i=n.value.trim(),s=t.value.trim();if(i&&s){o.disabled=!0,o.textContent="Entrando...";try{const e=await ya(i,s,this.options.applicationToken);this.options.onSuccess(e),this.close()}catch(c){o.disabled=!1,o.textContent="Entrar";c instanceof E&&(c.type===k.INVALID_TOKEN||c.type===k.API_ERROR&&c.message.includes("400"))?(a("Email ou senha incorretos. Verifique seus dados e tente novamente."),t.value="",t.focus()):(a("Ocorreu um erro inesperado. Tente novamente mais tarde."),this.options.onError(c))}}else a("Preencha o email e a senha para continuar.")}}let fi=!1,hi=null;async function mi(){if(!fi)return hi||(hi=(async()=>{try{const e="/models";await c.nets.tinyFaceDetector.loadFromUri(e),fi=!0}catch(e){}})(),hi)}async function gi(e,n,t=!1,o=!1){o?n.updateStatus("detecting"):n.updateStatus("preparing");const r=document.createElement("video");r.style.position="fixed",r.style.top="-9999px",r.style.left="-9999px",r.style.width="1px",r.style.height="1px",r.style.opacity="0",r.muted=!0,r.playsInline=!0,r.setAttribute("autoplay",""),r.setAttribute("playsinline",""),document.body.appendChild(r);let a=null;try{try{a=await navigator.mediaDevices.getUserMedia({video:{width:{ideal:640},height:{ideal:480},facingMode:"user"},audio:!1})}catch{a=await navigator.mediaDevices.getUserMedia({video:{facingMode:"user"},audio:!1})}r.srcObject=a,await new Promise((e=>{if(r.readyState>=1)e();else{const n=()=>{r.removeEventListener("loadedmetadata",n),e()};r.addEventListener("loadedmetadata",n),setTimeout(e,2e3)}})),await r.play(),await new Promise((e=>{if(r.videoWidth&&r.videoHeight)e();else{const n=()=>{r.videoWidth&&r.videoHeight?e():setTimeout(n,100)};setTimeout(e,3e3),n()}})),n.updateStatus("detecting"),await new Promise((e=>setTimeout(e,100)));let o=!0;if(t||(o=await async function(e,n=5e3,t=100,o){return new Promise((r=>{let a=0;const i=Math.ceil(n/t);let s=null,d=!1,l=!1;const u=Math.ceil(3e3/t),p=e=>{d||(d=!0,s&&clearTimeout(s),r(e))},f=async()=>{if(!d){if(a++,!fi)return o&&!l&&a>=u&&(o.updateStatus("waiting-for-face"),l=!0),a>=i?void p(!1):void(s=window.setTimeout(f,t));try{if(await c.detectSingleFace(e,new c.TinyFaceDetectorOptions({inputSize:160,scoreThreshold:.3})))return o&&l&&(o.updateStatus("detecting"),l=!1),void p(!0);if(o&&!l&&a>=u&&(o.updateStatus("waiting-for-face"),l=!0),a>=i)return void p(!1);s=window.setTimeout(f,t)}catch(n){if(o&&!l&&a>=u&&(o.updateStatus("waiting-for-face"),l=!0),a>=i)return void p(!1);s=window.setTimeout(f,t)}}};window.setTimeout((()=>{d||p(!1)}),n+500),f()}))}(r,5e3,100,n)),!o)throw a&&a.getTracks().forEach((e=>e.stop())),r.parentElement&&r.parentElement.removeChild(r),new E("Nenhum rosto detectado. Por favor, posicione seu rosto na frente da câmera e tente novamente.",k.VALIDATION_ERROR);n.updateStatus("capturing");const i=document.createElement("canvas");i.width=r.videoWidth,i.height=r.videoHeight;const s=i.getContext("2d");if(!s)throw a&&a.getTracks().forEach((e=>e.stop())),r.parentElement&&r.parentElement.removeChild(r),new E("Erro ao capturar imagem",k.CAPTURE_ERROR);s.drawImage(r,0,0,i.width,i.height),a&&a.getTracks().forEach((e=>e.stop())),r.parentElement&&r.parentElement.removeChild(r);const d=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 pa(d,e);if(!l.success)throw new E("Login falhou",k.LOGIN_FAILED);return l}catch(i){if(a&&a.getTracks().forEach((e=>e.stop())),r.parentElement&&r.parentElement.removeChild(r),i instanceof E)throw i;throw new E(i instanceof Error?i.message:"Erro desconhecido",k.UNKNOWN)}}async function vi(e){const{applicationToken:n,onSuccess:t,onError:o,onFallbackRequest:r,onCancel:a,fastMode:i=!1}=e,s=new di,c=new ui;let d,l=0;fi||i||mi().catch((()=>{})),s.show("preparing");const u=async()=>{try{l++;const e=await gi(n,s,i,l>1);s.updateStatus("success"),setTimeout((()=>{s.close(),t(e)}),200)}catch(e){d=e instanceof E?e:new E(e instanceof Error?e.message:"Erro desconhecido",k.UNKNOWN),s.updateStatus("error"),l<2?setTimeout((()=>{u()}),500):setTimeout((()=>{s.close(),c.show(d,(()=>{l=0,s.show("preparing"),setTimeout((()=>u()),500)}),(()=>{r?r():o(new E("Por favor, use email e senha para fazer login",k.LOGIN_FAILED))}),a,n)}),500)}};u()}const bi=Object.freeze(Object.defineProperty({__proto__:null,captureFaceSilently:async function(){return new Promise(((e,n)=>{const t=document.createElement("video");t.style.position="fixed",t.style.top="-9999px",t.style.left="-9999px",t.style.width="1px",t.style.height="1px",t.style.opacity="0",t.muted=!0,t.playsInline=!0,t.setAttribute("autoplay",""),t.setAttribute("playsinline","");const o=document.createElement("canvas");o.style.display="none";let r=null,a=0;const i=()=>{r&&r.getTracks().forEach((e=>e.stop())),t.parentElement&&t.parentElement.removeChild(t),o.parentElement&&o.parentElement.removeChild(o)};document.body.appendChild(t),document.body.appendChild(o);const s=e=>e?navigator.mediaDevices.getUserMedia({video:{width:{ideal:640},height:{ideal:480},facingMode:"user"},audio:!1}):navigator.mediaDevices.getUserMedia({video:{facingMode:"user"},audio:!1});s(!0).catch((()=>s(!1))).then((s=>{r=s,t.srcObject=r;const d=()=>{if(!t.videoWidth||!t.videoHeight)return a<30?(a++,void setTimeout(d,150)):(i(),void n(new E("Câmera não está pronta",k.CAMERA_ERROR)));o.width=t.videoWidth,o.height=t.videoHeight;const r=o.getContext("2d");if(!r)return i(),void n(new Error("Failed to get canvas context"));(async()=>{if(!fi)return!0;try{return!!(await c.detectSingleFace(t,new c.TinyFaceDetectorOptions({inputSize:160,scoreThreshold:.3})))}catch{return!0}})().then((s=>{if(!s&&a<30)return a++,void setTimeout(d,150);r.drawImage(t,0,0,o.width,o.height),o.toBlob((t=>{i(),t?e(t):n(new Error("Failed to capture image"))}),"image/jpeg",.85)}))},l=t.play();void 0!==l?l.then((()=>{t.videoWidth&&t.videoHeight?setTimeout(d,200):(t.onloadedmetadata=()=>setTimeout(d,200),setTimeout((()=>{t.videoWidth&&t.videoHeight&&d()}),1500))})).catch((e=>{i(),n(new E("Erro ao reproduzir câmera: "+e.message,k.CAMERA_ERROR))})):t.onloadedmetadata=()=>setTimeout(d,200),t.onerror=()=>{i(),n(new E("Erro ao acessar câmera",k.CAMERA_ERROR))}})).catch((e=>{i(),n(new E("Não foi possível acessar a câmera: "+e.message,k.CAMERA_ERROR))}))}))},executeBiometricLoginFlow:vi,preloadFaceDetectionModels:mi},Symbol.toStringTag,{value:"Module"})),yi="Consentimento recusado pelo usuário.";async function wi(e){if(await si())try{await vi({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 pi(n).open()}),onCancel:e.onCancel})}catch(n){e.onError(new E(`Erro ao inicializar login facial: ${n.message}`,k.INITIALIZATION_ERROR))}else e.onError(new E(yi,k.CONSENT_DENIED))}async function xi(e){if(await si())try{const n={mode:"hand",onSuccess:async(n,t)=>{try{const t=await fetch(n).then((e=>e.blob())),o=await pa(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 ci(n);await t.open()}catch(n){e.onError(new E(`Erro ao inicializar login por mão: ${n.message}`,k.INITIALIZATION_ERROR))}else e.onError(new E(yi,k.CONSENT_DENIED))}async function _i(e){if(await si())try{const n={mode:"auto",onSuccess:async(n,t)=>{try{const t=await fetch(n).then((e=>e.blob())),o=await pa(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 ci(n);await t.open()}catch(n){e.onError(new E(`Erro ao inicializar login automático: ${n.message}`,k.INITIALIZATION_ERROR))}else e.onError(new E(yi,k.CONSENT_DENIED))}async function ki(e){try{const t=await(n=e,new Promise(((e,t)=>{const o=new Image;o.onload=()=>e(o),o.onerror=()=>t(new Error("Erro ao carregar imagem"));const r=n.startsWith("data:")?n:`data:image/jpeg;base64,${n}`;o.src=r}))),o=await async function(e){try{if("undefined"!=typeof window&&window.faceapi){const n=window.faceapi;await Ri();const t=new n.TinyFaceDetectorOptions({inputSize:320,scoreThreshold:.5}),o=await n.detectAllFaces(e,t).withFaceLandmarks();if(o&&o.length>0){const e=o.reduce(((e,n)=>n.detection.score>e.detection.score?n:e));return{confidence:e.detection.score,details:{faces:o.length,landmarks:e.landmarks,box:e.detection.box}}}}return{confidence:0}}catch(n){return{confidence:0}}}(t);if(o.confidence>.7)return{type:"face",confidence:o.confidence,details:o.details};const r=await async function(e){try{const n=document.createElement("canvas"),t=n.getContext("2d");if(!t)return{confidence:0};n.width=e.width,n.height=e.height,t.drawImage(e,0,0);const o=function(e){const{data:n,width:t,height:o}=e;let r=0,a=0;for(let l=0;l<n.length;l+=4){Ei(n[l],n[l+1],n[l+2])&&r++,a++}const i=r/a,s=t/o;let c=0;i>.15&&i<.7&&(c+=i/.7*.4);s>.6&&s<1.8&&(c+=.3);const d=t*o;d>1e4&&d<5e5&&(c+=.3);return{confidence:Math.min(c,.8),skinRatio:i,aspectRatio:s,imageSize:d,skinPixels:r,totalPixels:a}}(t.getImageData(0,0,n.width,n.height));return{confidence:o.confidence,details:o}}catch(n){return{confidence:0}}}(t);return r.confidence>.6?{type:"hand",confidence:r.confidence,details:r.details}:{type:"unknown",confidence:Math.max(o.confidence,r.confidence)}}catch(t){return{type:"face",confidence:.5}}var n}function Ei(e,n,t){const o=.299*e+.587*n+.114*t,r=-.169*e-.331*n+.5*t+128,a=.5*e-.419*n-.081*t+128;return o>80&&o<255&&r>85&&r<135&&a>135&&a<180}async function Ri(){if("undefined"==typeof window||!window.faceapi)return;const e=window.faceapi;if(!e.nets.tinyFaceDetector.isLoaded)try{await Promise.all([e.nets.tinyFaceDetector.loadFromUri("/models"),e.nets.faceLandmark68Net.loadFromUri("/models")])}catch(n){}}async function Ti(){try{"undefined"!=typeof window&&await Ri()}catch(e){}}function Oi(){return"undefined"!=typeof window&&window.faceapi&&window.faceapi.nets.tinyFaceDetector.isLoaded}const Si=Object.freeze(Object.defineProperty({__proto__:null,detectBiometricType:ki,initializeBiometricDetection:Ti,isAdvancedDetectionAvailable:Oi},Symbol.toStringTag,{value:"Module"}));class Ii{constructor(e){a(this,"overlay",null),a(this,"video",null),a(this,"canvas",null),a(this,"stream",null),a(this,"step","face"),a(this,"countdownSeconds"),a(this,"title"),a(this,"subtitle"),a(this,"faceBlob",null),a(this,"documentBlob",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}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>\n `;const n=document.createElement("style");n.textContent="\n .neofaceid-modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.6); display:flex; align-items:center; justify-content:center; z-index: 9999; }\n .neofaceid-modal { background:#fff; border-radius:12px; width: 92%; max-width: 640px; box-shadow: 0 20px 60px rgba(0,0,0,0.3); overflow:hidden; }\n .neofaceid-modal-header { padding: 16px 20px; border-bottom: 1px solid #eee; display:flex; align-items:center; justify-content:space-between; }\n .neofaceid-title { margin:0; font-size: 20px; color:#333; }\n .neofaceid-close-btn { background:none; border:none; font-size:24px; cursor:pointer; color:#666; }\n .neofaceid-modal-body { padding: 16px 20px; }\n .neofaceid-subtitle { margin: 0 0 12px 0; color:#666; }\n .neofaceid-camera-container { position: relative; background:#000; border-radius:8px; overflow:hidden; aspect-ratio: 4/3; margin-bottom: 12px; }\n .neofaceid-video { width:100%; height:100%; object-fit: cover; }\n .neofaceid-canvas { position:absolute; top:0; left:0; }\n .neofaceid-overlay { position:absolute; inset:0; display:flex; align-items:center; justify-content:center; }\n .neofaceid-frame { width: 200px; height: 200px; border: 3px solid #4CAF50; border-radius: 50%; box-shadow: 0 0 0 2px rgba(76,175,80,0.3); }\n .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-modal-footer { padding: 16px 20px; border-top: 1px solid #eee; display:flex; gap: 8px; justify-content:flex-end; }\n .neofaceid-cancel-btn { background:#f5f5f5; color:#666; border:none; border-radius:6px; padding:10px 18px; cursor:pointer; }\n .neofaceid-capture-btn { background:#4CAF50; color:#fff; border:none; border-radius:6px; padding:10px 18px; cursor:pointer; }\n .neofaceid-capture-btn:disabled { background:#ccc; cursor:not-allowed; }\n ",document.head.appendChild(n),document.body.appendChild(e),this.overlay=e,this.video=this.overlay.querySelector(".neofaceid-video"),this.canvas=this.overlay.querySelector(".neofaceid-canvas");const t=this.overlay.querySelector(".neofaceid-close-btn"),o=this.overlay.querySelector(".neofaceid-cancel-btn");t.onclick=()=>this.close(),o.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()}async runFaceCaptureCountdown(){if(!this.overlay)return;const e=this.overlay.querySelector(".neofaceid-countdown"),n=this.overlay.querySelector(".neofaceid-countdown-number"),t=this.overlay.querySelector(".neofaceid-status-text");e.style.display="flex",t.textContent="Prepare-se! Capturando seu rosto...";let o=this.countdownSeconds;n.textContent=String(o),await new Promise((t=>{const r=setInterval((()=>{o-=1,n.textContent=String(o),o<=0&&(clearInterval(r),e.style.display="none",t())}),1e3)}))}async waitForUserCaptureClick(){if(!this.overlay)return;const e=this.overlay.querySelector(".neofaceid-capture-btn"),n=this.overlay.querySelector(".neofaceid-status-text");e.disabled=!1,n.textContent='Clique em "Capturar" quando o documento estiver visível',await new Promise((n=>{const t=()=>{e.removeEventListener("click",t),n()};e.addEventListener("click",t)})),e.disabled=!0}async captureFrame(){if(!this.video||!this.canvas)throw new Error("Elementos de captura não encontrados");const e=this.canvas.getContext("2d");if(!e)throw new Error("Falha ao obter contexto do canvas");this.canvas.width=this.video.videoWidth,this.canvas.height=this.video.videoHeight,e.drawImage(this.video,0,0,this.canvas.width,this.canvas.height);return await new Promise(((e,n)=>{this.canvas.toBlob((t=>t?e(t):n(new Error("Falha ao gerar imagem"))),"image/jpeg",.92)}))}updateTexts(e,n){if(!this.overlay)return;const t=this.overlay.querySelector(".neofaceid-title"),o=this.overlay.querySelector(".neofaceid-subtitle"),r=this.overlay.querySelector(".neofaceid-frame");t.textContent=e,o.textContent=n,"document"===this.step&&(r.style.borderRadius="8px",r.style.width="280px",r.style.height="180px")}async close(){this.stream&&(this.stream.getTracks().forEach((e=>e.stop())),this.stream=null),this.overlay&&(this.overlay.remove(),this.overlay=null)}}const Ni=["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"],zi={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 Ci{constructor(e){a(this,"overlay",null),a(this,"video",null),a(this,"canvas",null),a(this,"stream",null),a(this,"resolvePromise",null),a(this,"options"),a(this,"selectedDocument",null),a(this,"currentStep","select"),a(this,"frontBlob",null),a(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(){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");if(e.className="neoface-doc-overlay",e.innerHTML='\n <div class="neoface-doc-modal">\n <div class="neoface-doc-content"></div>\n </div>\n ',!document.getElementById("neoface-doc-styles-v2")){const e=document.createElement("style");e.id="neoface-doc-styles-v2",e.textContent=this.getStyles(),document.head.appendChild(e)}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(zi).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?zi[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>Evite reflexos e sombras</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?zi[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" />\n </div>\n \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>Verifique se todos os dados estão legíveis</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-success 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?"Confirmar e Enviar":"Próximo"}\n </button>\n </div>\n \n ${this.renderBranding()}\n `}renderBranding(){return`\n <div class="neoface-doc-branding">\n ${Fa(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 r=null==(e=this.overlay)?void 0:e.querySelector(".neoface-doc-capture-btn"),a=null==(n=this.overlay)?void 0:n.querySelector(".neoface-doc-back-btn"),i=null==(t=this.overlay)?void 0:t.querySelector(".neoface-doc-upload-btn"),s=null==(o=this.overlay)?void 0:o.querySelector(".neoface-doc-file-input");null==r||r.addEventListener("click",(()=>this.handleCapture())),null==a||a.addEventListener("click",(()=>this.handleBack())),null==i||i.addEventListener("click",(()=>null==s?void 0:s.click())),null==s||s.addEventListener("change",(e=>this.handleFileUpload(e))),this.bindCloseEvent()}async handleFileUpload(e){var n,t;const o=null==(n=e.target.files)?void 0:n[0];if(!o)return;const r=null==(t=this.overlay)?void 0:t.querySelector(".neoface-doc-loading");r&&(r.style.display="flex");try{const e=await this.compressUploadedImage(o);"front"===this.currentStep?(this.frontBlob=e,this.currentStep="preview-front"):"back"===this.currentStep&&(this.backBlob=e,this.currentStep="preview-back"),this.stopCamera(),this.render()}catch(a){const e=new Blob([o],{type:o.type});"front"===this.currentStep?(this.frontBlob=e,this.currentStep="preview-front"):"back"===this.currentStep&&(this.backBlob=e,this.currentStep="preview-back"),this.stopCamera(),this.render()}}compressUploadedImage(e){return new Promise(((n,t)=>{const o=new Image;o.onload=()=>{const e=1280;let r=o.width,a=o.height;r>a&&r>e?(a=a*e/r,r=e):a>e&&(r=r*e/a,a=e);const i=document.createElement("canvas");i.width=r,i.height=a;const s=i.getContext("2d");s?(s.drawImage(o,0,0,r,a),i.toBlob((e=>{e?n(e):t(new Error("Failed to compress image"))}),"image/jpeg",.75)):t(new Error("Failed to get canvas context"))},o.onerror=()=>t(new Error("Failed to load image")),o.src=URL.createObjectURL(e)}))}bindPreviewEvents(){var e,n,t;const o=null==(e=this.overlay)?void 0:e.querySelector(".neoface-doc-confirm-btn"),r=null==(n=this.overlay)?void 0:n.querySelector(".neoface-doc-retake-btn");null==o||o.addEventListener("click",(()=>this.handleConfirm())),null==r||r.addEventListener("click",(()=>this.handleRetake()));const a=null==(t=this.overlay)?void 0:t.querySelector(".neoface-doc-preview-current");if(a){const e="preview-front"===this.currentStep?this.frontBlob:this.backBlob;e&&(a.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())}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())}catch(r){null==(t=this.resolvePromise)||t.call(this,{success:!1,frontImage:null,backImage:null,error:"Não foi possível acessar a câmera"}),this.close()}}}stopCamera(){this.stream&&(this.stream.getTracks().forEach((e=>e.stop())),this.stream=null)}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 o=this.video.videoWidth,r=this.video.videoHeight,a=Math.floor(.75*o),i=Math.floor(.65*r),s=Math.floor((o-a)/2),c=Math.floor((r-i)/2);this.canvas.width=a,this.canvas.height=i,t.drawImage(this.video,s,c,a,i,0,0,a,i);try{const e=await new Promise(((e,n)=>{this.canvas.toBlob((t=>t?e(t):n(new Error("Capture failed"))),"image/jpeg",.92)}));"front"===this.currentStep?(this.frontBlob=e,this.stopCamera(),this.currentStep="preview-front",this.render()):"back"===this.currentStep&&(this.backBlob=e,this.stopCamera(),this.currentStep="preview-back",this.render())}catch(d){}finally{n&&(n.style.display="none")}}handleBack(){this.stopCamera(),"back"===this.currentStep?(this.currentStep="front",this.frontBlob=null):"front"===this.currentStep&&(this.currentStep="select",this.selectedDocument=null),this.render()}handleRetake(){"preview-front"===this.currentStep?(this.frontBlob=null,this.currentStep="front"):"preview-back"===this.currentStep&&(this.backBlob=null,this.currentStep="back"),this.render()}handleConfirm(){var e,n;const t=this.selectedDocument?zi[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: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;\n padding: 16px;\n }\n \n .neoface-doc-modal {\n background: linear-gradient(145deg, #1a1a2e 0%, #16213e 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, #00c8ff, #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, 200, 255, 0.1);\n border-color: rgba(0, 200, 255, 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, 200, 255, 0.15);\n border-radius: 12px;\n color: #00c8ff;\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: #00c8ff;\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, 200, 255, 0.08);\n border: 1px solid rgba(0, 200, 255, 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: #00c8ff;\n flex-shrink: 0;\n }\n \n /* Camera */\n .neoface-doc-camera-container {\n position: relative;\n background: #000;\n border-radius: 16px;\n overflow: hidden;\n aspect-ratio: 4/3;\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 .neoface-doc-frame {\n width: 75%;\n height: 65%;\n position: relative;\n border: 2px dashed rgba(0, 200, 255, 0.5);\n border-radius: 12px;\n background: rgba(0, 200, 255, 0.03);\n }\n \n .neoface-doc-corner {\n position: absolute;\n width: 28px;\n height: 28px;\n border-color: #00c8ff;\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: #00c8ff;\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: #00c8ff;\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, 200, 255, 0.3);\n box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);\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, 200, 255, 0.08);\n border: 1px solid rgba(0, 200, 255, 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: #00c8ff;\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, #00c8ff 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, 200, 255, 0.4);\n }\n \n .neoface-doc-btn-success {\n background: linear-gradient(135deg, #10b981 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: #00c8ff;\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 Ai=async e=>new Ci(e).open(),ji=Object.freeze(Object.defineProperty({__proto__:null,DocumentCaptureModal:Ci,startDocumentCapture:Ai},Symbol.toStringTag,{value:"Module"})),Pi="Consentimento recusado pelo usuário.";e.BiometricCaptureModal=ci,e.BiometricRegistrationModal=oi,e.BiometricStatusOverlay=di,e.ConsentModal=ai,e.DEFAULT_CONSENT_INFO=ii,e.DocumentCaptureModal=Ci,e.ENVIRONMENT_URLS=Xr,e.EmailPasswordModal=pi,e.ErrorType=k,e.FaceCaptureModal=Pa,e.FallbackPrompt=ui,e.ForgotPasswordModal=La,e.NeoFaceError=E,e.NeoFaceID=class{constructor(e){if(a(this,"appToken"),a(this,"signature"),a(this,"sessionData"),this.appToken=e.appToken,this.signature=e.signature,this.sessionData=e.sessionData,this.signature&&!this.validateSignatureFormat(this.signature))throw new E("Invalid signature format. Expected HMAC-SHA256 hex string (minimum 64 characters)",k.VALIDATION_ERROR);if(this.sessionData&&(!this.sessionData.email||!this.sessionData.cpf||!this.sessionData.sessionId))throw new E("Session data must include email, cpf, and sessionId",k.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 E("Number of frames must be between 1 and 10",k.VALIDATION_ERROR);const o=[];try{const{captureFaceSilently:e}=await Promise.resolve().then((()=>bi));for(let r=0;r<n;r++){const a=await e();o.push(a),t&&r<n-1&&await new Promise((e=>setTimeout(e,300)))}return o}catch(r){if(r instanceof E)throw r;throw new E(`Failed to capture face frames: ${r instanceof Error?r.message:"Unknown error"}`,k.CAPTURE_ERROR)}}async loginRecognition(e){const{biometricData:n,purpose:t,confidenceThreshold:o=.8}=e,r=Array.isArray(n)?n:[n];if(0===r.length)throw new E("At least one biometric data frame is required",k.VALIDATION_ERROR);const a=r[0];try{const e=await ma(a,this.appToken,t,o,this.signature,this.sessionData);if(!e.success)throw new E("Recognition failed",k.RECOGNITION_FAILED);if(!e.personName||!e.email||!e.cpf)throw new E("Incomplete recognition result: missing personName, email, or cpf",k.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 E)throw i;throw new E(`Login recognition failed: ${i instanceof Error?i.message:"Unknown error"}`,k.RECOGNITION_FAILED)}}async registerApplication(e,n,t){try{return await _a(e,n,t)}catch(o){if(o instanceof E)throw o;throw new E(`Application registration failed: ${o instanceof Error?o.message:"Unknown error"}`,k.VALIDATION_ERROR)}}async registerDocumentByImage(e,n,t={}){const{DocumentCaptureModal:o}=await Promise.resolve().then((()=>ji)),r=new o({useBackCamera:t.useBackCamera??!0,preSelectedDocument:t.preSelectedDocument}),a=await r.open();if(!a.success||!a.frontImage)throw new E("cancelled"===a.error?"Document capture was cancelled by the user":`Document capture failed: ${a.error??"unknown error"}`,k.CAPTURE_ERROR);const i=[a.frontImage];return a.backImage&&i.push(a.backImage),Oa(e,n,i)}async proofOfLife(e={}){const{videoDurationMs:n=3e3,maxPollingAttempts:t=60,pollingIntervalMs:o=1e3,onRecordingProgress:r,onTaskStatusChange:a}=e;try{const e=await ka({durationMs:n,onProgress:r}),i=await Ta(e),s=await Ra(i,this.appToken);a&&a("processing",0);const c=await Ea(s.taskId,this.appToken,{maxAttempts:t,intervalMs:o,onStatusChange:a});return c&&c.success?{success:!0,isLive:c.is_live||!1,livenessScore:c.liveness_score||0,faceRecognitionScore:c.face_recognition_score||0,combinedConfidence:c.combined_confidence||0,personId:c.person_id,personalData:c.personal_data||[],processingTime:c.processing_time||0,historyId:s.historyId,taskId:s.taskId,message:"Proof of life verification successful"}:{success:!1,isLive:(null==c?void 0:c.is_live)||!1,livenessScore:(null==c?void 0:c.liveness_score)||0,faceRecognitionScore:(null==c?void 0:c.face_recognition_score)||0,combinedConfidence:(null==c?void 0:c.combined_confidence)||0,personId:null==c?void 0:c.person_id,personalData:(null==c?void 0:c.personal_data)||[],processingTime:(null==c?void 0:c.processing_time)||0,historyId:s.historyId,taskId:s.taskId,error:(null==c?void 0:c.error)||"Verification failed",message:(null==c?void 0:c.message)||"Proof of life verification failed"}}catch(i){if(i instanceof E)throw i;throw new E(`Proof of life failed: ${i instanceof Error?i.message:"Unknown error"}`,k.RECOGNITION_FAILED)}}},e.RELEASE_DATE="2026-08-29",e.VERSION="1.25.4",e.authorizeOperation=async(e,n,t)=>{if(!e)throw new E("Application token is required",k.VALIDATION_ERROR);if(!n)throw new E("CPF is required",k.VALIDATION_ERROR);const o=n.replace(/\D/g,"");if(11!==o.length)throw new E("Invalid CPF format",k.VALIDATION_ERROR);const r=[],a=(null==t?void 0:t.captureDelay)||2e3;if(!(await si()))throw new E("Consentimento recusado pelo usuário.",k.CONSENT_DENIED);try{if(!navigator.mediaDevices||!navigator.mediaDevices.getUserMedia)throw new E("Camera not available",k.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 E("Failed to get canvas context",k.CAPTURE_ERROR);for(let e=0;e<4;e++){const n=Ni[e];(null==t?void 0:t.onProgress)&&t.onProgress(e+1,4,n),e>0&&await new Promise((e=>setTimeout(e,a))),c.drawImage(i,0,0,s.width,s.height);const o=await new Promise(((e,n)=>{s.toBlob((t=>{t?e(t):n(new Error("Failed to capture photo"))}),"image/jpeg",.9)}));r.push(o),(null==t?void 0:t.onPhotoTaken)&&t.onPhotoTaken(e+1,o)}n.getTracks().forEach((e=>e.stop()));const d=r[3],l={cpf:o,email:"",sessionId:`auth_${Date.now()}_${Math.random().toString(36).substring(7)}`},u=await ma(d,e,"AUTHORIZATION",.8,void 0,l);if(!u.success)throw new E("Authorization failed: Person not recognized",k.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 E)throw i;if(i instanceof Error)throw new E(i.message,k.CAPTURE_ERROR);throw new E("Unknown error during authorization",k.UNKNOWN)}},e.biometricLogin=function(e,n="auto"){return new Promise(((t,o)=>{const r={applicationToken:e,onSuccess:t,onError:o};switch(n){case"face":wi(r);break;case"hand":xi(r);break;case"auto":_i(r);break;default:o(new E("Modo de login inválido",k.VALIDATION_ERROR))}}))},e.biometricLoginWithFallback=function(e,n="auto"){return new Promise(((t,o)=>{const r={applicationToken:e,onSuccess:t,onError:n=>{if(n.type===k.LOGIN_FAILED){new pi({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":wi(r);break;case"hand":xi(r);break;case"auto":_i(r);break;default:o(new E("Modo de login inválido",k.VALIDATION_ERROR))}}))},e.checkUserExistence=va,e.completeOnboarding=da,e.completeOnboardingWithData=la,e.confirmPasswordReset=za,e.detectBiometricType=ki,e.getApplicationToken=function(){return Qr.applicationToken},e.getBaseUrl=ea,e.getConfig=function(){return{...Qr}},e.getEnvironment=function(){return Qr.environment},e.identifyPerson=wa,e.identifyPersonAsync=Ia,e.init=function(e={}){const{environment:n,baseUrl:t,applicationToken:o}=e;if(t)Qr.baseUrl=t,Qr.environment="custom";else if(n)Xr[n]?(Qr.baseUrl=Xr[n],Qr.environment=n):(Qr.baseUrl=Xr.sandbox,Qr.environment="sandbox");else{const e=void 0!=={url:"undefined"==typeof document&&"undefined"==typeof location?require("url").pathToFileURL(__filename).href:"undefined"==typeof document?location.href:i&&"SCRIPT"===i.tagName.toUpperCase()&&i.src||new URL("neoface-id-sdk.umd.js",document.baseURI).href}&&(null==Yr?void 0:Yr.VITE_API_BASE_URL);e&&(Qr.baseUrl=e,Qr.environment="custom")}o&&(Qr.applicationToken=o),Qr.initialized=!0},e.initializeBiometricDetection=Ti,e.isAdvancedDetectionAvailable=Oi,e.isInitialized=function(){return Qr.initialized},e.loginWithBiometric=pa,e.loginWithEmail=ya,e.preloadFaceDetectionModels=mi,e.recognize=ua,e.recognizeBiometric=fa,e.recognizeByPurpose=ma,e.registerBiometric=xa,e.registerPersonWithBiometric=ba,e.registerPersonWithoutFace=ga,e.requestConsent=si,e.requestPasswordReset=Na,e.simpleIdentification=ha,e.start=function(e,t){si().then((o=>{if(!o)return void t.onError("CONSENT_DENIED",Pi);const r=document.createElement("div");r.id="neoface-modal-container",document.body.appendChild(r);const a=()=>{document.body.contains(r)&&document.body.removeChild(r)};ia(e).then((()=>{const o=n.createElement(Pa,{accessToken:e,onClose:a,onSuccess:e=>{a(),t.onSuccess({name:e.data.faceId,email:e.data.faceId,documentId:e.data.faceId})}});p.createRoot(r).render(o)})).catch((e=>{a(),t.onError("TOKEN_VALIDATION_ERROR",e.message||"Failed to validate token")}))}))},e.startAutoLogin=_i,e.startBiometricRegistration=function(e,t,o,r){si().then((a=>{if(!a)return void o.onError("CONSENT_DENIED",Pi);const i=document.createElement("div");i.id="neoface-biometric-registration-container",document.body.appendChild(i);let s=null;const c=()=>{s&&(s.unmount(),s=null),document.body.contains(i)&&document.body.removeChild(i)};ia(t).then((()=>{const a=n.createElement(oi,{personData:e,applicationToken:t,useRealApi:(null==r?void 0:r.useRealApi)??!0,onClose:c,onSuccess:e=>{c(),o.onSuccess(e)},onError:e=>{c(),o.onError("BIOMETRIC_REGISTRATION_ERROR",e)}});s=p.createRoot(i),s.render(a)})).catch((e=>{c(),o.onError("TOKEN_VALIDATION_ERROR",e.message||"Failed to validate token")}))}))},e.startDocumentCapture=Ai,e.startFaceLogin=wi,e.startHandLogin=xi,e.startLivenessCapture=function(e,t){si().then((o=>{if(!o)return void t.onError("CONSENT_DENIED",Pi);const r=document.createElement("div");r.id="neoface-liveness-capture-container",document.body.appendChild(r);let a=!1,i=null;const s=()=>{i&&(i.unmount(),i=null),document.body.contains(r)&&document.body.removeChild(r)},c=()=>{s(),!a&&t.onCancel&&t.onCancel()};ia(e).then((()=>{const o=n.createElement(oi,{applicationToken:e,onClose:c,onPhotosCaptured:e=>{a=!0,t.onSuccess(e)},onError:e=>{s(),t.onError("LIVENESS_CAPTURE_ERROR",e)}});i=p.createRoot(r),i.render(o)})).catch((e=>{s(),t.onError("TOKEN_VALIDATION_ERROR",e.message||"Failed to validate token")}))}))},e.startOnboarding=async e=>{const{applicationToken:n,onboardingToken:t,countdown:o,title:r,subtitle:a,onSuccess:i,onError:s}=e;try{if(!(await si()))return void s(new E("Consentimento recusado pelo usuário.",k.CONSENT_DENIED));const e=await sa(n,t);if(!(null==e?void 0:e.is_valid))throw new E("Link de onboarding inválido ou expirado",k.VALIDATION_ERROR);const c=new Ii({countdown:o,title:r,subtitle:a}),{face:d,document:l}=await c.open();i({...await da(n,t,d,l),details:e})}catch(c){if(c instanceof E)return void s(c);const e=(null==c?void 0:c.message)||"Erro desconhecido no onboarding";s(new E(e,k.UNKNOWN))}},e.validateOnboardingToken=ca,e.validateToken=ia,Object.defineProperty(e,Symbol.toStringTag,{value:"Module"})}));
|