santoid-sdk 5.2.0 → 5.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (66) hide show
  1. package/.bitbucket/pipelines/generated/pipeline/pipes/sonarsource/sonarcloud-scan/sonarcloud-scan.log +263 -295
  2. package/CHANGELOG.md +7 -0
  3. package/README.md +455 -143
  4. package/api/ApiAsyncService.d.ts +32 -0
  5. package/api/ApiAsyncService.js +15 -0
  6. package/api/ApiFaceMatchService.d.ts +30 -0
  7. package/api/ApiFaceMatchService.js +32 -0
  8. package/api/ApiOcrService.d.ts +62 -0
  9. package/api/ApiOcrService.js +25 -0
  10. package/api/ApiTypificationService.d.ts +23 -0
  11. package/api/{TypificationService.js → ApiTypificationService.js} +8 -9
  12. package/browser/index.js +1 -1
  13. package/client/core/commons/BaseCoreService.d.ts +23 -0
  14. package/client/core/commons/BaseCoreService.js +156 -0
  15. package/client/core/index.d.ts +4 -0
  16. package/client/core/index.js +9 -0
  17. package/client/core/methods/faceMatch/Service.d.ts +19 -0
  18. package/client/core/methods/faceMatch/Service.js +122 -0
  19. package/client/core/methods/faceMatch/index.d.ts +15 -0
  20. package/client/core/methods/faceMatch/index.js +43 -0
  21. package/client/core/methods/ocr/Service.d.ts +11 -0
  22. package/client/core/methods/ocr/Service.js +52 -0
  23. package/client/core/methods/ocr/index.d.ts +10 -0
  24. package/client/core/methods/ocr/index.js +40 -0
  25. package/client/core/methods/typification/Service.d.ts +9 -0
  26. package/client/core/methods/typification/Service.js +52 -0
  27. package/client/core/methods/typification/index.d.ts +10 -0
  28. package/client/core/methods/typification/index.js +40 -0
  29. package/client/core/utils/types.d.ts +30 -0
  30. package/client/core/utils/types.js +2 -0
  31. package/client/index.d.ts +6 -0
  32. package/client/index.js +6 -0
  33. package/client/liveness/methods/livenessDetection/Service.js +10 -2
  34. package/client/liveness/methods/livenessDetection/index.js +5 -1
  35. package/client/liveness/methods/uploadIdentificationDocument/Service.d.ts +19 -19
  36. package/client/liveness/methods/uploadIdentificationDocument/Service.js +8 -4
  37. package/client/liveness/methods/uploadIdentificationDocument/index.d.ts +4 -6
  38. package/client/liveness/utils/getNextFrame.d.ts +4 -1
  39. package/client/liveness/utils/getNextFrame.js +9 -3
  40. package/package.json +1 -1
  41. package/server/core/index.d.ts +4 -0
  42. package/server/core/index.js +9 -0
  43. package/server/core/methods/faceMatch/Service.d.ts +9 -0
  44. package/server/core/methods/faceMatch/Service.js +23 -0
  45. package/server/core/methods/faceMatch/index.d.ts +7 -0
  46. package/server/core/methods/faceMatch/index.js +28 -0
  47. package/server/core/methods/ocr/Service.d.ts +9 -0
  48. package/server/core/methods/ocr/Service.js +23 -0
  49. package/server/core/methods/ocr/index.d.ts +7 -0
  50. package/server/core/methods/ocr/index.js +28 -0
  51. package/server/core/methods/typification/Service.d.ts +9 -0
  52. package/server/core/methods/typification/Service.js +23 -0
  53. package/server/core/methods/typification/index.d.ts +7 -0
  54. package/server/core/methods/typification/index.js +28 -0
  55. package/server/index.d.ts +6 -0
  56. package/server/index.js +6 -0
  57. package/server/liveness/methods/livenessDetection/index.js +5 -1
  58. package/server/liveness/methods/uploadIdentificationDocument/Service.d.ts +2 -2
  59. package/server/liveness/methods/uploadIdentificationDocument/Service.js +4 -4
  60. package/server/liveness/methods/uploadIdentificationDocument/index.d.ts +6 -8
  61. package/utils/error.d.ts +19 -2
  62. package/utils/error.js +21 -2
  63. package/utils/types.d.ts +1 -0
  64. package/api/FaceMatchService.d.ts +0 -42
  65. package/api/FaceMatchService.js +0 -26
  66. package/api/TypificationService.d.ts +0 -90
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ApiAsyncService = void 0;
4
+ const AbstractService_1 = require("./AbstractService");
5
+ class ApiAsyncService extends AbstractService_1.AbstractService {
6
+ constructor(asyncServiceOptions, ...abstractServiceOptions) {
7
+ super(...abstractServiceOptions);
8
+ this.resultsRoute = asyncServiceOptions.resultsRoute;
9
+ }
10
+ async get(requestId) {
11
+ const response = await this.request().get(`/api/v1/tracks/${this.options.track}/${this.resultsRoute}/` + requestId);
12
+ return response.data;
13
+ }
14
+ }
15
+ exports.ApiAsyncService = ApiAsyncService;
@@ -0,0 +1,30 @@
1
+ import { type AbstractService } from './AbstractService';
2
+ import { ApiAsyncService, type IAsyncProcessingStartedResponse } from './ApiAsyncService';
3
+ export declare class ApiFaceMatchService<TFileType> extends ApiAsyncService {
4
+ constructor(...abstractServiceOptions: ConstructorParameters<typeof AbstractService>);
5
+ faceMatch(imageFile1: TFileType, imageFile2?: TFileType, customerRequestId?: string): Promise<IAsyncProcessingStartedResponse>;
6
+ get(...params: Parameters<InstanceType<typeof ApiAsyncService>['get']>): Promise<IFaceMatchStatusGetResponse>;
7
+ }
8
+ interface IFaceMatchStatusGetResponse extends Awaited<ReturnType<InstanceType<typeof ApiAsyncService>['get']>> {
9
+ fileImage1?: string;
10
+ fileImage2?: string;
11
+ }
12
+ export interface IFaceMatchResult {
13
+ domain: string;
14
+ track: string;
15
+ service: string;
16
+ requestId: string;
17
+ requestType: string;
18
+ customerRequestId: string;
19
+ executionDatetime: string;
20
+ error?: {
21
+ error: string;
22
+ };
23
+ status: string;
24
+ comparison_score: number;
25
+ similarity_score: number;
26
+ match: boolean;
27
+ fileImage1?: string;
28
+ fileImage2?: string;
29
+ }
30
+ export {};
@@ -0,0 +1,32 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ApiFaceMatchService = void 0;
4
+ const ApiAsyncService_1 = require("./ApiAsyncService");
5
+ const index_1 = require("../utils/index");
6
+ class ApiFaceMatchService extends ApiAsyncService_1.ApiAsyncService {
7
+ constructor(...abstractServiceOptions) {
8
+ super({ resultsRoute: 'face-async' }, ...abstractServiceOptions);
9
+ }
10
+ async faceMatch(imageFile1, imageFile2, customerRequestId) {
11
+ const requestFn = async () => {
12
+ const formData = new this.serviceOptions.FormDataClass();
13
+ formData.append('track', this.options.track);
14
+ formData.append('deliveryFront', 'true');
15
+ formData.append('sensitive_data_compliance', 'true');
16
+ formData.append('imageFile1', imageFile1, 'imageFile1.jpg');
17
+ if (imageFile2) {
18
+ formData.append('imageFile2', imageFile2, 'imageFile2.jpg');
19
+ }
20
+ if (customerRequestId) {
21
+ formData.append('customerRequestId', customerRequestId);
22
+ }
23
+ const response = await this.request({ contentType: 'multipart/form-data' }).post('/api/v1/face-match-async', formData);
24
+ return response.data;
25
+ };
26
+ return await (0, index_1.retryAsyncFunctionXTimes)(requestFn);
27
+ }
28
+ async get(...params) {
29
+ return await super.get(...params);
30
+ }
31
+ }
32
+ exports.ApiFaceMatchService = ApiFaceMatchService;
@@ -0,0 +1,62 @@
1
+ import { type AbstractService } from './AbstractService';
2
+ import { ApiAsyncService, type IAsyncProcessingStartedResponse, type IBaseAsyncResult } from './ApiAsyncService';
3
+ export declare class ApiOcrService<TFileType> extends ApiAsyncService {
4
+ constructor(...abstractServiceOptions: ConstructorParameters<typeof AbstractService>);
5
+ extract(imageFile: TFileType, customerRequestId: string): Promise<IAsyncProcessingStartedResponse>;
6
+ }
7
+ export interface IOcrListResult {
8
+ x: number;
9
+ y: number;
10
+ w: number;
11
+ h: number;
12
+ bottomRight: number[];
13
+ topLeft: number[];
14
+ dataField?: string;
15
+ dataFieldValue?: boolean;
16
+ label: string | null;
17
+ ocr?: string | null;
18
+ ocr_score?: number;
19
+ cropBase64?: string | null;
20
+ }
21
+ export interface ICropResult {
22
+ x: number;
23
+ y: number;
24
+ w: number;
25
+ h: number;
26
+ bottomRight: number[];
27
+ topLeft: number[];
28
+ label: string | null;
29
+ text: string | null;
30
+ ocr_score: number | null;
31
+ crop: string | null;
32
+ ocrInterpretive?: boolean | string | null;
33
+ ocrList: IOcrListResult[] | null;
34
+ serpro_query?: {
35
+ serpro_data: any;
36
+ search_logs: {
37
+ document: string;
38
+ type: string;
39
+ search_time: string;
40
+ status_code: number;
41
+ message: string;
42
+ };
43
+ } | null;
44
+ validation: {
45
+ type: string | null;
46
+ value: number | string | boolean;
47
+ } | null;
48
+ validationSerpro?: Record<string, number | boolean>;
49
+ }
50
+ export interface IOcrDocumentResult {
51
+ error?: {
52
+ message: string;
53
+ };
54
+ ocr: {
55
+ template: string;
56
+ labels: ICropResult[] | null;
57
+ } | boolean;
58
+ }
59
+ export interface IOcrResult extends IBaseAsyncResult {
60
+ template: string;
61
+ documents: IOcrDocumentResult[];
62
+ }
@@ -0,0 +1,25 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ApiOcrService = void 0;
4
+ const ApiAsyncService_1 = require("./ApiAsyncService");
5
+ const index_1 = require("../utils/index");
6
+ class ApiOcrService extends ApiAsyncService_1.ApiAsyncService {
7
+ constructor(...abstractServiceOptions) {
8
+ super({ resultsRoute: 'ocr-async' }, ...abstractServiceOptions);
9
+ }
10
+ async extract(imageFile, customerRequestId) {
11
+ const requestFn = async () => {
12
+ const formData = new this.serviceOptions.FormDataClass();
13
+ formData.append('imageFile', imageFile, 'imageFile.jpg');
14
+ formData.append('track', this.options.track);
15
+ formData.append('template', this.options.template);
16
+ formData.append('customerRequestId', customerRequestId);
17
+ formData.append('deliveryFront', 'true');
18
+ const response = await this.request({ contentType: 'multipart/form-data' })
19
+ .post('/api/v1/ocr-async/ocr', formData);
20
+ return response.data;
21
+ };
22
+ return await (0, index_1.retryAsyncFunctionXTimes)(requestFn);
23
+ }
24
+ }
25
+ exports.ApiOcrService = ApiOcrService;
@@ -0,0 +1,23 @@
1
+ import { type AbstractService } from './AbstractService';
2
+ import { ApiAsyncService, type IAsyncProcessingStartedResponse, type IBaseAsyncResult } from './ApiAsyncService';
3
+ import { type ICropResult } from './ApiOcrService';
4
+ export declare class ApiTypificationService<TFileType> extends ApiAsyncService {
5
+ constructor(...abstractServiceOptions: ConstructorParameters<typeof AbstractService>);
6
+ predict(imageFile: TFileType, customerRequestId: string): Promise<IAsyncProcessingStartedResponse>;
7
+ }
8
+ export interface ITypificationDocumentResult {
9
+ typification: {
10
+ id: string;
11
+ score: number;
12
+ };
13
+ error?: {
14
+ message: string;
15
+ };
16
+ ocr?: {
17
+ template: string;
18
+ labels: ICropResult[] | null;
19
+ } | boolean;
20
+ }
21
+ export interface ITypificationResult extends IBaseAsyncResult {
22
+ documents: ITypificationDocumentResult[];
23
+ }
@@ -1,25 +1,24 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.TypificationService = void 0;
4
- const AbstractService_1 = require("./AbstractService");
3
+ exports.ApiTypificationService = void 0;
4
+ const ApiAsyncService_1 = require("./ApiAsyncService");
5
5
  const index_1 = require("../utils/index");
6
- class TypificationService extends AbstractService_1.AbstractService {
6
+ class ApiTypificationService extends ApiAsyncService_1.ApiAsyncService {
7
+ constructor(...abstractServiceOptions) {
8
+ super({ resultsRoute: 'typification-async' }, ...abstractServiceOptions);
9
+ }
7
10
  async predict(imageFile, customerRequestId) {
8
11
  const requestFn = async () => {
9
12
  const formData = new this.serviceOptions.FormDataClass();
10
13
  formData.append('imageFile', imageFile, 'imageFile.jpg');
11
14
  formData.append('track', this.options.track);
12
15
  formData.append('customerRequestId', customerRequestId);
13
- formData.append('deliveryFront', true);
16
+ formData.append('deliveryFront', 'true');
14
17
  const response = await this.request({ contentType: 'multipart/form-data' })
15
18
  .post('/api/v1/typification-async/predict', formData);
16
19
  return response.data;
17
20
  };
18
21
  return await (0, index_1.retryAsyncFunctionXTimes)(requestFn);
19
22
  }
20
- async get(requestId) {
21
- const response = await this.request().get(`/api/v1/tracks/${this.options.track}/typification-async/` + requestId);
22
- return response.data;
23
- }
24
23
  }
25
- exports.TypificationService = TypificationService;
24
+ exports.ApiTypificationService = ApiTypificationService;
package/browser/index.js CHANGED
@@ -1 +1 @@
1
- !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define("SantoiDSDK",[],t):"object"==typeof exports?exports.SantoiDSDK=t():e.SantoiDSDK=t()}(this,(()=>(()=>{var e={373:function(e,t,n){"use strict";var o=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.AbstractService=void 0;const r=o(n(218)),s=n(661);t.AbstractService=class{constructor(e,t){this.options=e,this.serviceOptions=t}request(e){var t,n,{contentType:o="application/json",authToken:i=this.options.token,baseUrl:a=(null!==(t=this.options.customApiUrl)&&void 0!==t?t:s.API_GATEWAY_URL)}=void 0===e?{}:e;const c={baseURL:a,headers:{"Content-Type":o,Authorization:`Bearer ${i}`}};let l=this.options.domain;if(!this.options.domain&&this.options.token){const e=this.serviceOptions.tryDecodeJwt(this.options.token);l=null===(n=null==e?void 0:e.claims)||void 0===n?void 0:n.domain}return c.headers&&(l&&(c.headers.Domain=l),this.options.useBillingAccounts&&(c.headers.clientCredentials=!0)),r.default.create(c)}}},605:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.FaceMatchService=void 0;const o=n(373),r=n(951);class s extends o.AbstractService{async faceMatch(e,t,n){return await(0,r.retryAsyncFunctionXTimes)((async()=>{const o=new this.serviceOptions.FormDataClass;return o.append("track",this.options.track),o.append("customerRequestId",n),o.append("deliveryFront",!0),o.append("sensitive_data_compliance",!0),o.append("imageFile1",e,"imageFile1.jpg"),o.append("imageFile2",t,"imageFile2.jpg"),(await this.request({contentType:"multipart/form-data"}).post("/api/v1/face-match-async",o)).data}))}async get(e){return(await this.request().get(`/api/v1/tracks/${this.options.track}/face-async/`+e)).data}}t.FaceMatchService=s},144:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.TypificationService=void 0;const o=n(373),r=n(951);class s extends o.AbstractService{async predict(e,t){return await(0,r.retryAsyncFunctionXTimes)((async()=>{const n=new this.serviceOptions.FormDataClass;return n.append("imageFile",e,"imageFile.jpg"),n.append("track",this.options.track),n.append("customerRequestId",t),n.append("deliveryFront",!0),(await this.request({contentType:"multipart/form-data"}).post("/api/v1/typification-async/predict",n)).data}))}async get(e){return(await this.request().get(`/api/v1/tracks/${this.options.track}/typification-async/`+e)).data}}t.TypificationService=s},122:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.insertUploadIdentificationDocument=void 0;const o=n(661);t.insertUploadIdentificationDocument=function(e,t){var n,r,s;const i=t?document.querySelector(t):document.body;if(!i)throw new Error("Cannot find target element");const a=document.createElement("iframe");a.style.overflow="hidden",a.style.border="0",a.setAttribute("width",null!==(n=e.width)&&void 0!==n?n:"100%"),a.setAttribute("height",null!==(r=e.height)&&void 0!==r?r:"550px"),a.setAttribute("scrolling","no"),a.setAttribute("allow","camera; microphone; clipboard-read; clipboard-write");let c=`${null!==(s=e.customAppUrl)&&void 0!==s?s:o.APPLICATION_URL}/share/domains/${e.domain}/tracks/${e.track}/flow/${e.flow}/embedded`;e.token&&(c+=`?accessToken=${e.token}`),a.setAttribute("src",c),i.appendChild(a)}},42:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.LivenessDetectionService=void 0;const o=n(551),r=n(620),s=n(951),i=n(661);t.LivenessDetectionService=class{constructor(e,t){this.frameGetControls={},this.currentStep="front",this.pauseSendingFramesToWebSocket=!1,this.websocketClosedBySDK=!1,this.validationSuccess=!1,this.canSendNextBytes=!0,this.endCalled=!1,this.cancelSendingFramesToWebsocket=void 0,this.successFrames={front:void 0,right:void 0,left:void 0,up:void 0,bottom:void 0},this.options=e,this.abstractWebSocket=t}async onWebSocketMessage(e){var t,n,r,i,a,c,l,u;const d=e.data,p=JSON.parse(d);return(null==p?void 0:p.validation)&&this.currentStep&&(this.successFrames[this.currentStep]=this.lastSentBytes),(null==p?void 0:p.next_step)&&!p.error&&(this.currentStep=p.next_step,await(null===(n=(t=this.options).onNextStep)||void 0===n?void 0:n.call(t,p.next_step)),await(null===(i=(r=this.options)[`on${(0,s.capitalizeFirstLetter)(p.next_step)}Step`])||void 0===i?void 0:i.call(r))),p&&(this.canSendNextBytes=!!(null==p?void 0:p.can_send_next_bytes)),(null==p?void 0:p.success)&&(this.successFrames.bottom=this.lastSentBytes,this.validationSuccess=!0,await(null===(c=(a=this.options).onSuccess)||void 0===c?void 0:c.call(a,{livenessId:p.livenessId,successFrames:this.successFrames})),await this.stopLivenessDetection()),(null==p?void 0:p.error)&&await(null===(u=(l=this.options).onError)||void 0===u?void 0:u.call(l,new o.SDKError({message:"Wrong position",code:o.ELivenessDetectionErrorCodes.WRONG_POSITION}))),p}async stopLivenessDetection(){var e,t,n,o,r;await(0,s.waitFor)((()=>!!this.cancelSendingFramesToWebsocket)),null===(e=this.cancelSendingFramesToWebsocket)||void 0===e||e.call(this),await(null===(n=(t=this.frameGetControls).stopGettingFrames)||void 0===n?void 0:n.call(t)),this.abstractWebSocket.disconnectFromWebSocket(),this.endCalled||(await(null===(r=(o=this.options).onEnd)||void 0===r?void 0:r.call(o)),this.endCalled=!0),this.websocketClosedBySDK=!0}async sendFramesToWebSocket(){var e,t;try{if(this.canSendNextBytes&&!this.pauseSendingFramesToWebSocket){const n=await(null===(t=(e=this.frameGetControls).getNextFrame)||void 0===t?void 0:t.call(e));n&&(this.abstractWebSocket.send(n),this.lastSentBytes=n,this.canSendNextBytes=!1)}}catch(e){await this.stopLivenessDetection()}}async onConnect(){var e,t,n,o,a,c,l,u,d,p;try{if(this.options.getNextFrame)this.frameGetControls.startGettingFrames=this.options.startGettingFrames,this.frameGetControls.getNextFrame=this.options.getNextFrame,this.frameGetControls.stopGettingFrames=this.options.stopGettingFrames,this.frameGetControls.videoStream=await(null===(t=(e=this.options).startGettingFrames)||void 0===t?void 0:t.call(e));else{const e=await(0,r.getDefaultFrameControls)();this.frameGetControls.startGettingFrames=e.startGettingFrames,this.frameGetControls.getNextFrame=e.getNextFrame,this.frameGetControls.stopGettingFrames=e.stopGettingFrames,this.frameGetControls.videoStream=await(null===(o=(n=this.frameGetControls).startGettingFrames)||void 0===o?void 0:o.call(n))}await(null===(c=(a=this.options).onStart)||void 0===c?void 0:c.call(a,{videoStream:this.getVideoStream()})),await(null===(u=(l=this.options).onNextStep)||void 0===u?void 0:u.call(l,"front")),await(null===(p=(d=this.options).onFrontStep)||void 0===p?void 0:p.call(d)),this.cancelSendingFramesToWebsocket=(0,s.callAsyncFunctionEveryXSeconds)((async()=>{await this.sendFramesToWebSocket()}),i.SEND_FRAMES_INTERVAL_MS)}catch(e){await this.onError()}}async onError(){var e,t;this.validationSuccess||(await(null===(t=(e=this.options).onError)||void 0===t?void 0:t.call(e,new o.SDKError({message:"Internal Error",code:o.EDefaultErrorCodes.INTERNAL_ERROR}))),await this.stopLivenessDetection())}resumeGettingFrames(){this.pauseSendingFramesToWebSocket=!1}pauseGettingFrames(){this.pauseSendingFramesToWebSocket=!0}getVideoStream(){var e;return null===(e=this.frameGetControls)||void 0===e?void 0:e.videoStream}}},234:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.livenessDetection=void 0;const o=n(42),r=n(551),s=n(706),i=n(616);t.livenessDetection=function(e){var t;try{const n=new s.AbstractWebSocket({WebSocketClass:null!==(t=e.CustomWebSocketClass)&&void 0!==t?t:WebSocket,decodeJwt:i.decodeJwt},e);n.startConnection();const r=new o.LivenessDetectionService(e,n);return n.waitForWebSocketConnection().then((()=>{r.onConnect()})).catch((()=>{r.onError()})),n.addListener("message",(e=>{r.onWebSocketMessage(e)})),n.addListener("error",(()=>{r.onError()})),n.addListener("close",(()=>{r.onError()})),{getVideoStream:()=>r.getVideoStream(),stopLivenessDetection:async()=>{await r.stopLivenessDetection()},resumeGettingFrames:()=>{r.resumeGettingFrames()},pauseGettingFrames:()=>{r.pauseGettingFrames()}}}catch(e){throw new r.SDKError({message:"Error while starting SDK",code:r.EDefaultErrorCodes.INITIALIZATION_ERROR})}}},171:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.UploadIdentificationDocumentService=void 0;const o=n(144),r=n(605),s=n(551),i=n(877),a=n(616);t.UploadIdentificationDocumentService=class{constructor(e,t){this.results={uploadedDocument:null,typification:{status:null,results:null,loading:!1,error:null},liveness:{status:null,results:null,loading:!1,error:null},faceMatch:{status:null,results:null,loading:!1,error:null}},this.options=e,this.internalOptions=t,this.typificationService=new o.TypificationService(e,{FormDataClass:FormData,tryDecodeJwt:a.tryDecodeJwt}),this.faceMatchService=new r.FaceMatchService(e,{FormDataClass:FormData,tryDecodeJwt:a.tryDecodeJwt})}getResults(){return this.results}async updateResults(e){var t,n,o,r,s,i;this.results=Object.assign(Object.assign({},this.results),e),await(null===(n=(t=this.options).onUpdate)||void 0===n?void 0:n.call(t,this.results)),e.faceMatch||this.tryStartFaceMatch(),Object.entries(this.results).every((([e,t])=>"uploadedDocument"===e||!!t.results))&&(await(null===(r=(o=this.options).onSuccess)||void 0===r?void 0:r.call(o,this.results)),await(null===(i=(s=this.options).onEnd)||void 0===i?void 0:i.call(s)))}updateUploadedDocument(e){this.results.uploadedDocument=e}async waitForResults(e){let t=!1;return await new Promise(((n,o)=>{const r=setInterval((async()=>{var s,i,a,c;try{null===(i=(s=this.options).onClearInterval)||void 0===i||i.call(s,r);const l=await this.typificationService.get(e);if("validation"!==(null==l?void 0:l.status)||t){if("error"===(null==l?void 0:l.status))clearInterval(r),o(new Error("Não foi possível processar os resultados do Upload de Documentos"));else if("processed"===(null==l?void 0:l.status)&&l.fileURL){const e=await fetch(l.fileURL),t=await e.json();t&&(clearInterval(r),n(t))}}else await(null===(c=(a=this.options).onValidationRequested)||void 0===c?void 0:c.call(a,{track:this.options.track,requestId:l.id})),t=!0}catch(e){clearInterval(r),o(new Error(e))}}),5e3)}))}async waitForResultsFaceMatch(e){return await new Promise(((t,n)=>{const o=setInterval((async()=>{var r,s,i,a;try{null===(s=(r=this.options).onClearInterval)||void 0===s||s.call(r,o);const c=await this.faceMatchService.get(e);if("error"===(null==c?void 0:c.status)||"error_connector"===(null==c?void 0:c.status))clearInterval(o),n(new Error("Não foi possível processar os resultados do FaceMatch"));else if("processed"===(null==c?void 0:c.status)&&c.fileURL){const e=await fetch(c.fileURL);let n=await e.json();n=Object.assign(Object.assign({},n),{fileImage1:null!==(i=c.fileImage1)&&void 0!==i?i:"",fileImage2:null!==(a=c.fileImage2)&&void 0!==a?a:""}),n&&(clearInterval(o),t(n))}}catch(e){clearInterval(o),n(new Error(e))}}),5e3)}))}async startDocumentUpload(e){var t,n;try{this.updateResults({typification:{status:null,results:null,loading:!0,error:null}}),this.updateUploadedDocument(e);const{requestId:t}=await this.typificationService.predict(e,`sdk-typification-${(0,i.v4)()}`),n=await this.waitForResults(t);this.updateResults({typification:{status:"success",results:n,loading:!1,error:null}})}catch(e){const o=new s.SDKError({message:"Error during document upload/analysis",code:s.EUploadIdentificationDocumentErrorCodes.DOCUMENT_ANALYSIS_ERROR,details:e});await(null===(n=(t=this.options).onError)||void 0===n?void 0:n.call(t,o)),this.updateResults({typification:{status:"error",results:null,loading:!1,error:o}})}}startLivenessDetection(e){var t,n;const o=Object.assign(Object.assign({},this.options.livenessDetectionOptions),e);this.updateResults({liveness:{results:null,status:null,loading:!0,error:null}});try{return this.internalOptions.livenessDetection(Object.assign(Object.assign({domain:this.options.domain,customId:this.options.customId,customWebSocketUrl:this.options.customWebSocketUrl,token:this.options.token,track:this.options.track},o),{onSuccess:async e=>{var t;await(null===(t=null==o?void 0:o.onSuccess)||void 0===t?void 0:t.call(o,e)),this.updateResults({liveness:{status:"success",results:e,loading:!1,error:null}})},onError:async e=>{var t,n,r;await(null===(t=null==o?void 0:o.onError)||void 0===t?void 0:t.call(o,e)),await(null===(r=(n=this.options).onError)||void 0===r?void 0:r.call(n,e)),this.updateResults({liveness:{status:"error",results:null,loading:"wrong-position"===(null==e?void 0:e.code),error:null!=e?e:null}})}}))}catch(e){const o=new s.SDKError({message:"Error during liveness detection",code:s.EUploadIdentificationDocumentErrorCodes.LIVENESS_DETECTION_ERROR,details:e});null===(n=(t=this.options).onError)||void 0===n||n.call(t,o),this.updateResults({liveness:{status:"error",results:null,loading:!1,error:o}})}}async startFaceMatch(e,t){var n,o;try{this.updateResults({faceMatch:{status:null,results:null,loading:!0,error:null}});const{requestId:n}=await this.faceMatchService.faceMatch(e,t,`sdk-facematch-${(0,i.v4)()}`),o=await this.waitForResultsFaceMatch(n);this.updateResults({faceMatch:{results:o,status:"success",loading:!1,error:null}})}catch(e){const t=new s.SDKError({message:"Error when comparing the face with the document",code:s.EUploadIdentificationDocumentErrorCodes.FACE_MATCH_ERROR,details:e});await(null===(o=(n=this.options).onError)||void 0===o?void 0:o.call(n,t)),this.updateResults({faceMatch:{results:null,status:"error",loading:!1,error:t}})}}async tryStartFaceMatch(){var e,t,n;!this.results.uploadedDocument||!(null===(e=this.results.liveness.results)||void 0===e?void 0:e.successFrames.front)||this.results.faceMatch.loading||this.results.liveness.loading||this.results.typification.loading?await(null===(n=(t=this.options).onError)||void 0===n?void 0:n.call(t,new s.SDKError({message:"Unavailable faces",code:s.EUploadIdentificationDocumentErrorCodes.FACE_MATCH_UNAVAILABLE_FACES_ERROR}))):await this.startFaceMatch(this.results.uploadedDocument,this.results.liveness.results.successFrames.front)}startAll(e,t){this.startDocumentUpload(e),this.startLivenessDetection(t)}}},604:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.uploadIdentificationDocument=void 0;const o=n(171),r=n(234);t.uploadIdentificationDocument=function(e){const t=new o.UploadIdentificationDocumentService(e,{livenessDetection:r.livenessDetection});return{startDocumentUpload:async(...e)=>{await t.startDocumentUpload(...e)},startLivenessDetection:(...e)=>t.startLivenessDetection(...e),startFaceComparison:async(...e)=>{await t.tryStartFaceMatch(...e)},startAll:(...e)=>{t.startAll(...e)},getResults:(...e)=>t.getResults(...e)}}},620:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getDefaultFrameControls=void 0,t.getDefaultFrameControls=async function(){let e,t,n,o;return{startGettingFrames:async function(){return e&&t&&n||(e=await navigator.mediaDevices.getUserMedia({video:!0}),t=document.createElement("video"),t.setAttribute("autoplay","true"),t.style.transform="scale(-1, 1)",t.style.position="absolute",t.style.left="99999px",document.body.appendChild(t),t.srcObject=e,n=document.createElement("canvas"),o=n.getContext("2d")),e},getNextFrame:async function(){if(n&&t)return n.width=t.videoWidth,n.height=t.videoHeight,null==o||o.drawImage(t,0,0,n.width,n.height),await new Promise(((e,t)=>{n?n.toBlob((t=>{e(t)})):e(null)}));throw new Error("Cannot found video element")},stopGettingFrames:function(){t&&(document.body.removeChild(t),t=void 0),n&&(n=void 0),o&&(o=void 0),e&&(null==e||e.getTracks().forEach((e=>{e.stop()})),e=void 0)}}}},616:(e,t)=>{"use strict";function n(e){const t=e.split(".")[1].replace(/-/g,"+").replace(/_/g,"/"),n=decodeURIComponent(window.atob(t).split("").map((e=>"%"+("00"+e.charCodeAt(0).toString(16)).slice(-2))).join(""));return JSON.parse(n)}Object.defineProperty(t,"__esModule",{value:!0}),t.tryDecodeJwt=t.decodeJwt=void 0,t.decodeJwt=n,t.tryDecodeJwt=function(e){try{return n(e)}catch(e){return null}}},661:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.DEFAULT_RETRY_TIME_STEP=t.DEFAULT_NUMBER_OF_RETRIES=t.SEND_FRAMES_INTERVAL_MS=t.APPLICATION_URL=t.API_GATEWAY_URL=t.WEBSOCKET_BASE_URL=void 0,t.WEBSOCKET_BASE_URL="wss://santoid-liveness-w4ynos5dlq-ue.a.run.app/api/v1/liveness/ws",t.API_GATEWAY_URL="https://api.santoid.com.br",t.APPLICATION_URL="https://app.santoid.com.br",t.SEND_FRAMES_INTERVAL_MS=100,t.DEFAULT_NUMBER_OF_RETRIES=5,t.DEFAULT_RETRY_TIME_STEP=1e3},551:(e,t)=>{"use strict";var n,o,r;Object.defineProperty(t,"__esModule",{value:!0}),t.SDKError=t.EUploadIdentificationDocumentErrorCodes=t.ELivenessDetectionErrorCodes=t.EDefaultErrorCodes=void 0,function(e){e.INITIALIZATION_ERROR="initialization-error",e.INTERNAL_ERROR="internal-error"}(n||(t.EDefaultErrorCodes=n={})),function(e){e.WRONG_POSITION="liveness-detection/wrong-position"}(o||(t.ELivenessDetectionErrorCodes=o={})),function(e){e.FACE_MATCH_ERROR="upload-identification-document/face-match-error",e.FACE_MATCH_UNAVAILABLE_FACES_ERROR="upload-identification-document/face-match-unavailable-faces-error",e.DOCUMENT_ANALYSIS_ERROR="upload-identification-document/document-analysis-error",e.LIVENESS_DETECTION_ERROR="upload-identification-document/liveness-detection-error"}(r||(t.EUploadIdentificationDocumentErrorCodes=r={}));class s extends Error{constructor({message:e,code:t,details:n}){super(e),this.code=t,this.details=n}}t.SDKError=s},951:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.retryAsyncFunctionXTimes=t.callAsyncFunctionEveryXSeconds=t.waitFor=t.wait=t.capitalizeFirstLetter=void 0;const o=n(218),r=n(661);async function s(e){await new Promise((t=>{e()?t():setTimeout((()=>{s(e).then(t)}),500)}))}function i(e){var t;return e instanceof o.AxiosError&&(503===(null===(t=e.response)||void 0===t?void 0:t.status)||"Network Error"===e.message)}t.capitalizeFirstLetter=function(e){return e.charAt(0).toUpperCase()+e.slice(1)},t.wait=async e=>{await new Promise((t=>{setTimeout(t,e)}))},t.waitFor=s,t.callAsyncFunctionEveryXSeconds=function e(t,n,o={stop:!1}){const r={timerEnd:!1};return setTimeout((()=>{r.timerEnd=!0}),n),t().then((async()=>{await s((()=>r.timerEnd)),o.stop||e(t,n,o)})),function(){o.stop=!0}},t.retryAsyncFunctionXTimes=async function e(n,o=i,s=r.DEFAULT_NUMBER_OF_RETRIES,a=1e3,c=r.DEFAULT_RETRY_TIME_STEP){try{return await n()}catch(r){if(o(r)&&s>0)return await(0,t.wait)(a),await e(n,o,s-1,a+c,c);throw r}}},706:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.AbstractWebSocket=void 0;const o=n(661);t.AbstractWebSocket=class{constructor(e,t){this.classOptions=e,this.sdkOptions=t}startConnection(){var e,t;const n=this.classOptions.decodeJwt(this.sdkOptions.token),r={x_endpoint_api_userinfo:this.sdkOptions.token,domain:null!==(e=this.sdkOptions.domain)&&void 0!==e?e:n.claims.domain,track:this.sdkOptions.track};this.sdkOptions.customId&&(r.customerRequestId=this.sdkOptions.customId),this.sdkOptions.useBillingAccounts&&(r.clientCredentials=!0);const s=Object.entries(r).map((e=>e.join("="))).join("&");this.websocket=new this.classOptions.WebSocketClass(`${null!==(t=this.sdkOptions.customWebSocketUrl)&&void 0!==t?t:o.WEBSOCKET_BASE_URL}?${s}`)}async waitForWebSocketConnection(){if(await new Promise((e=>{const t=setInterval((()=>{[3,1].includes(this.websocket.readyState)&&(clearInterval(t),e())}),5)})),3===this.websocket.readyState)throw new Error("Cannot connect to server")}disconnectFromWebSocket(){var e,t;[2,3].includes(this.websocket.readyState)||null===(t=(e=this.websocket).close)||void 0===t||t.call(e)}get readyState(){return this.websocket.readyState}addListener(e,t){var n,o;this.websocket.on?this.websocket.on(e,t):null===(o=(n=this.websocket).addEventListener)||void 0===o||o.call(n,e,t)}send(e){this.websocket.send(e)}}},877:(e,t,n)=>{var o=n(570),r=n(358),s=r;s.v1=o,s.v4=r,e.exports=s},327:e=>{for(var t=[],n=0;n<256;++n)t[n]=(n+256).toString(16).substr(1);e.exports=function(e,n){var o=n||0,r=t;return[r[e[o++]],r[e[o++]],r[e[o++]],r[e[o++]],"-",r[e[o++]],r[e[o++]],"-",r[e[o++]],r[e[o++]],"-",r[e[o++]],r[e[o++]],"-",r[e[o++]],r[e[o++]],r[e[o++]],r[e[o++]],r[e[o++]],r[e[o++]]].join("")}},217:e=>{var t="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||"undefined"!=typeof msCrypto&&"function"==typeof window.msCrypto.getRandomValues&&msCrypto.getRandomValues.bind(msCrypto);if(t){var n=new Uint8Array(16);e.exports=function(){return t(n),n}}else{var o=new Array(16);e.exports=function(){for(var e,t=0;t<16;t++)0==(3&t)&&(e=4294967296*Math.random()),o[t]=e>>>((3&t)<<3)&255;return o}}},570:(e,t,n)=>{var o,r,s=n(217),i=n(327),a=0,c=0;e.exports=function(e,t,n){var l=t&&n||0,u=t||[],d=(e=e||{}).node||o,p=void 0!==e.clockseq?e.clockseq:r;if(null==d||null==p){var f=s();null==d&&(d=o=[1|f[0],f[1],f[2],f[3],f[4],f[5]]),null==p&&(p=r=16383&(f[6]<<8|f[7]))}var h=void 0!==e.msecs?e.msecs:(new Date).getTime(),m=void 0!==e.nsecs?e.nsecs:c+1,v=h-a+(m-c)/1e4;if(v<0&&void 0===e.clockseq&&(p=p+1&16383),(v<0||h>a)&&void 0===e.nsecs&&(m=0),m>=1e4)throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");a=h,c=m,r=p;var y=(1e4*(268435455&(h+=122192928e5))+m)%4294967296;u[l++]=y>>>24&255,u[l++]=y>>>16&255,u[l++]=y>>>8&255,u[l++]=255&y;var g=h/4294967296*1e4&268435455;u[l++]=g>>>8&255,u[l++]=255&g,u[l++]=g>>>24&15|16,u[l++]=g>>>16&255,u[l++]=p>>>8|128,u[l++]=255&p;for(var w=0;w<6;++w)u[l+w]=d[w];return t||i(u)}},358:(e,t,n)=>{var o=n(217),r=n(327);e.exports=function(e,t,n){var s=t&&n||0;"string"==typeof e&&(t="binary"===e?new Array(16):null,e=null);var i=(e=e||{}).random||(e.rng||o)();if(i[6]=15&i[6]|64,i[8]=63&i[8]|128,t)for(var a=0;a<16;++a)t[s+a]=i[a];return t||r(i)}},218:(e,t,n)=>{"use strict";function o(e,t){return function(){return e.apply(t,arguments)}}const{toString:r}=Object.prototype,{getPrototypeOf:s}=Object,i=(a=Object.create(null),e=>{const t=r.call(e);return a[t]||(a[t]=t.slice(8,-1).toLowerCase())});var a;const c=e=>(e=e.toLowerCase(),t=>i(t)===e),l=e=>t=>typeof t===e,{isArray:u}=Array,d=l("undefined"),p=c("ArrayBuffer"),f=l("string"),h=l("function"),m=l("number"),v=e=>null!==e&&"object"==typeof e,y=e=>{if("object"!==i(e))return!1;const t=s(e);return!(null!==t&&t!==Object.prototype&&null!==Object.getPrototypeOf(t)||Symbol.toStringTag in e||Symbol.iterator in e)},g=c("Date"),w=c("File"),E=c("Blob"),b=c("FileList"),S=c("URLSearchParams");function O(e,t,{allOwnKeys:n=!1}={}){if(null==e)return;let o,r;if("object"!=typeof e&&(e=[e]),u(e))for(o=0,r=e.length;o<r;o++)t.call(null,e[o],o,e);else{const r=n?Object.getOwnPropertyNames(e):Object.keys(e),s=r.length;let i;for(o=0;o<s;o++)i=r[o],t.call(null,e[i],i,e)}}function R(e,t){t=t.toLowerCase();const n=Object.keys(e);let o,r=n.length;for(;r-- >0;)if(o=n[r],t===o.toLowerCase())return o;return null}const A="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:n.g,T=e=>!d(e)&&e!==A,_=(F="undefined"!=typeof Uint8Array&&s(Uint8Array),e=>F&&e instanceof F);var F;const C=c("HTMLFormElement"),D=(({hasOwnProperty:e})=>(t,n)=>e.call(t,n))(Object.prototype),N=c("RegExp"),k=(e,t)=>{const n=Object.getOwnPropertyDescriptors(e),o={};O(n,((n,r)=>{let s;!1!==(s=t(n,r,e))&&(o[r]=s||n)})),Object.defineProperties(e,o)},j="abcdefghijklmnopqrstuvwxyz",U="0123456789",L={DIGIT:U,ALPHA:j,ALPHA_DIGIT:j+j.toUpperCase()+U},x=c("AsyncFunction");var I={isArray:u,isArrayBuffer:p,isBuffer:function(e){return null!==e&&!d(e)&&null!==e.constructor&&!d(e.constructor)&&h(e.constructor.isBuffer)&&e.constructor.isBuffer(e)},isFormData:e=>{let t;return e&&("function"==typeof FormData&&e instanceof FormData||h(e.append)&&("formdata"===(t=i(e))||"object"===t&&h(e.toString)&&"[object FormData]"===e.toString()))},isArrayBufferView:function(e){let t;return t="undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer&&p(e.buffer),t},isString:f,isNumber:m,isBoolean:e=>!0===e||!1===e,isObject:v,isPlainObject:y,isUndefined:d,isDate:g,isFile:w,isBlob:E,isRegExp:N,isFunction:h,isStream:e=>v(e)&&h(e.pipe),isURLSearchParams:S,isTypedArray:_,isFileList:b,forEach:O,merge:function e(){const{caseless:t}=T(this)&&this||{},n={},o=(o,r)=>{const s=t&&R(n,r)||r;y(n[s])&&y(o)?n[s]=e(n[s],o):y(o)?n[s]=e({},o):u(o)?n[s]=o.slice():n[s]=o};for(let e=0,t=arguments.length;e<t;e++)arguments[e]&&O(arguments[e],o);return n},extend:(e,t,n,{allOwnKeys:r}={})=>(O(t,((t,r)=>{n&&h(t)?e[r]=o(t,n):e[r]=t}),{allOwnKeys:r}),e),trim:e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,""),stripBOM:e=>(65279===e.charCodeAt(0)&&(e=e.slice(1)),e),inherits:(e,t,n,o)=>{e.prototype=Object.create(t.prototype,o),e.prototype.constructor=e,Object.defineProperty(e,"super",{value:t.prototype}),n&&Object.assign(e.prototype,n)},toFlatObject:(e,t,n,o)=>{let r,i,a;const c={};if(t=t||{},null==e)return t;do{for(r=Object.getOwnPropertyNames(e),i=r.length;i-- >0;)a=r[i],o&&!o(a,e,t)||c[a]||(t[a]=e[a],c[a]=!0);e=!1!==n&&s(e)}while(e&&(!n||n(e,t))&&e!==Object.prototype);return t},kindOf:i,kindOfTest:c,endsWith:(e,t,n)=>{e=String(e),(void 0===n||n>e.length)&&(n=e.length),n-=t.length;const o=e.indexOf(t,n);return-1!==o&&o===n},toArray:e=>{if(!e)return null;if(u(e))return e;let t=e.length;if(!m(t))return null;const n=new Array(t);for(;t-- >0;)n[t]=e[t];return n},forEachEntry:(e,t)=>{const n=(e&&e[Symbol.iterator]).call(e);let o;for(;(o=n.next())&&!o.done;){const n=o.value;t.call(e,n[0],n[1])}},matchAll:(e,t)=>{let n;const o=[];for(;null!==(n=e.exec(t));)o.push(n);return o},isHTMLForm:C,hasOwnProperty:D,hasOwnProp:D,reduceDescriptors:k,freezeMethods:e=>{k(e,((t,n)=>{if(h(e)&&-1!==["arguments","caller","callee"].indexOf(n))return!1;const o=e[n];h(o)&&(t.enumerable=!1,"writable"in t?t.writable=!1:t.set||(t.set=()=>{throw Error("Can not rewrite read-only method '"+n+"'")}))}))},toObjectSet:(e,t)=>{const n={},o=e=>{e.forEach((e=>{n[e]=!0}))};return u(e)?o(e):o(String(e).split(t)),n},toCamelCase:e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,(function(e,t,n){return t.toUpperCase()+n})),noop:()=>{},toFiniteNumber:(e,t)=>(e=+e,Number.isFinite(e)?e:t),findKey:R,global:A,isContextDefined:T,ALPHABET:L,generateString:(e=16,t=L.ALPHA_DIGIT)=>{let n="";const{length:o}=t;for(;e--;)n+=t[Math.random()*o|0];return n},isSpecCompliantForm:function(e){return!!(e&&h(e.append)&&"FormData"===e[Symbol.toStringTag]&&e[Symbol.iterator])},toJSONObject:e=>{const t=new Array(10),n=(e,o)=>{if(v(e)){if(t.indexOf(e)>=0)return;if(!("toJSON"in e)){t[o]=e;const r=u(e)?[]:{};return O(e,((e,t)=>{const s=n(e,o+1);!d(s)&&(r[t]=s)})),t[o]=void 0,r}}return e};return n(e,0)},isAsyncFn:x,isThenable:e=>e&&(v(e)||h(e))&&h(e.then)&&h(e.catch)};function P(e,t,n,o,r){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=(new Error).stack,this.message=e,this.name="AxiosError",t&&(this.code=t),n&&(this.config=n),o&&(this.request=o),r&&(this.response=r)}I.inherits(P,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:I.toJSONObject(this.config),code:this.code,status:this.response&&this.response.status?this.response.status:null}}});const M=P.prototype,B={};function W(e){return I.isPlainObject(e)||I.isArray(e)}function q(e){return I.endsWith(e,"[]")?e.slice(0,-2):e}function G(e,t,n){return e?e.concat(t).map((function(e,t){return e=q(e),!n&&t?"["+e+"]":e})).join(n?".":""):t}["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach((e=>{B[e]={value:e}})),Object.defineProperties(P,B),Object.defineProperty(M,"isAxiosError",{value:!0}),P.from=(e,t,n,o,r,s)=>{const i=Object.create(M);return I.toFlatObject(e,i,(function(e){return e!==Error.prototype}),(e=>"isAxiosError"!==e)),P.call(i,e.message,t,n,o,r),i.cause=e,i.name=e.name,s&&Object.assign(i,s),i};const J=I.toFlatObject(I,{},null,(function(e){return/^is[A-Z]/.test(e)}));function K(e,t,n){if(!I.isObject(e))throw new TypeError("target must be an object");t=t||new FormData;const o=(n=I.toFlatObject(n,{metaTokens:!0,dots:!1,indexes:!1},!1,(function(e,t){return!I.isUndefined(t[e])}))).metaTokens,r=n.visitor||l,s=n.dots,i=n.indexes,a=(n.Blob||"undefined"!=typeof Blob&&Blob)&&I.isSpecCompliantForm(t);if(!I.isFunction(r))throw new TypeError("visitor must be a function");function c(e){if(null===e)return"";if(I.isDate(e))return e.toISOString();if(!a&&I.isBlob(e))throw new P("Blob is not supported. Use a Buffer instead.");return I.isArrayBuffer(e)||I.isTypedArray(e)?a&&"function"==typeof Blob?new Blob([e]):Buffer.from(e):e}function l(e,n,r){let a=e;if(e&&!r&&"object"==typeof e)if(I.endsWith(n,"{}"))n=o?n:n.slice(0,-2),e=JSON.stringify(e);else if(I.isArray(e)&&function(e){return I.isArray(e)&&!e.some(W)}(e)||(I.isFileList(e)||I.endsWith(n,"[]"))&&(a=I.toArray(e)))return n=q(n),a.forEach((function(e,o){!I.isUndefined(e)&&null!==e&&t.append(!0===i?G([n],o,s):null===i?n:n+"[]",c(e))})),!1;return!!W(e)||(t.append(G(r,n,s),c(e)),!1)}const u=[],d=Object.assign(J,{defaultVisitor:l,convertValue:c,isVisitable:W});if(!I.isObject(e))throw new TypeError("data must be an object");return function e(n,o){if(!I.isUndefined(n)){if(-1!==u.indexOf(n))throw Error("Circular reference detected in "+o.join("."));u.push(n),I.forEach(n,(function(n,s){!0===(!(I.isUndefined(n)||null===n)&&r.call(t,n,I.isString(s)?s.trim():s,o,d))&&e(n,o?o.concat(s):[s])})),u.pop()}}(e),t}function z(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,(function(e){return t[e]}))}function V(e,t){this._pairs=[],e&&K(e,this,t)}const H=V.prototype;function $(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function X(e,t,n){if(!t)return e;const o=n&&n.encode||$,r=n&&n.serialize;let s;if(s=r?r(t,n):I.isURLSearchParams(t)?t.toString():new V(t,n).toString(o),s){const t=e.indexOf("#");-1!==t&&(e=e.slice(0,t)),e+=(-1===e.indexOf("?")?"?":"&")+s}return e}H.append=function(e,t){this._pairs.push([e,t])},H.toString=function(e){const t=e?function(t){return e.call(this,t,z)}:z;return this._pairs.map((function(e){return t(e[0])+"="+t(e[1])}),"").join("&")};var Y=class{constructor(){this.handlers=[]}use(e,t,n){return this.handlers.push({fulfilled:e,rejected:t,synchronous:!!n&&n.synchronous,runWhen:n?n.runWhen:null}),this.handlers.length-1}eject(e){this.handlers[e]&&(this.handlers[e]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(e){I.forEach(this.handlers,(function(t){null!==t&&e(t)}))}},Z={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},Q={isBrowser:!0,classes:{URLSearchParams:"undefined"!=typeof URLSearchParams?URLSearchParams:V,FormData:"undefined"!=typeof FormData?FormData:null,Blob:"undefined"!=typeof Blob?Blob:null},isStandardBrowserEnv:(()=>{let e;return("undefined"==typeof navigator||"ReactNative"!==(e=navigator.product)&&"NativeScript"!==e&&"NS"!==e)&&"undefined"!=typeof window&&"undefined"!=typeof document})(),isStandardBrowserWebWorkerEnv:"undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope&&"function"==typeof self.importScripts,protocols:["http","https","file","blob","url","data"]};function ee(e){function t(e,n,o,r){let s=e[r++];const i=Number.isFinite(+s),a=r>=e.length;return s=!s&&I.isArray(o)?o.length:s,a?(I.hasOwnProp(o,s)?o[s]=[o[s],n]:o[s]=n,!i):(o[s]&&I.isObject(o[s])||(o[s]=[]),t(e,n,o[s],r)&&I.isArray(o[s])&&(o[s]=function(e){const t={},n=Object.keys(e);let o;const r=n.length;let s;for(o=0;o<r;o++)s=n[o],t[s]=e[s];return t}(o[s])),!i)}if(I.isFormData(e)&&I.isFunction(e.entries)){const n={};return I.forEachEntry(e,((e,o)=>{t(function(e){return I.matchAll(/\w+|\[(\w*)]/g,e).map((e=>"[]"===e[0]?"":e[1]||e[0]))}(e),o,n,0)})),n}return null}const te={transitional:Z,adapter:["xhr","http"],transformRequest:[function(e,t){const n=t.getContentType()||"",o=n.indexOf("application/json")>-1,r=I.isObject(e);if(r&&I.isHTMLForm(e)&&(e=new FormData(e)),I.isFormData(e))return o&&o?JSON.stringify(ee(e)):e;if(I.isArrayBuffer(e)||I.isBuffer(e)||I.isStream(e)||I.isFile(e)||I.isBlob(e))return e;if(I.isArrayBufferView(e))return e.buffer;if(I.isURLSearchParams(e))return t.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let s;if(r){if(n.indexOf("application/x-www-form-urlencoded")>-1)return function(e,t){return K(e,new Q.classes.URLSearchParams,Object.assign({visitor:function(e,t,n,o){return Q.isNode&&I.isBuffer(e)?(this.append(t,e.toString("base64")),!1):o.defaultVisitor.apply(this,arguments)}},t))}(e,this.formSerializer).toString();if((s=I.isFileList(e))||n.indexOf("multipart/form-data")>-1){const t=this.env&&this.env.FormData;return K(s?{"files[]":e}:e,t&&new t,this.formSerializer)}}return r||o?(t.setContentType("application/json",!1),function(e,t,n){if(I.isString(e))try{return(0,JSON.parse)(e),I.trim(e)}catch(e){if("SyntaxError"!==e.name)throw e}return(0,JSON.stringify)(e)}(e)):e}],transformResponse:[function(e){const t=this.transitional||te.transitional,n=t&&t.forcedJSONParsing,o="json"===this.responseType;if(e&&I.isString(e)&&(n&&!this.responseType||o)){const n=!(t&&t.silentJSONParsing)&&o;try{return JSON.parse(e)}catch(e){if(n){if("SyntaxError"===e.name)throw P.from(e,P.ERR_BAD_RESPONSE,this,null,this.response);throw e}}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:Q.classes.FormData,Blob:Q.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};I.forEach(["delete","get","head","post","put","patch"],(e=>{te.headers[e]={}}));var ne=te;const oe=I.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),re=Symbol("internals");function se(e){return e&&String(e).trim().toLowerCase()}function ie(e){return!1===e||null==e?e:I.isArray(e)?e.map(ie):String(e)}function ae(e,t,n,o,r){return I.isFunction(o)?o.call(this,t,n):(r&&(t=n),I.isString(t)?I.isString(o)?-1!==t.indexOf(o):I.isRegExp(o)?o.test(t):void 0:void 0)}class ce{constructor(e){e&&this.set(e)}set(e,t,n){const o=this;function r(e,t,n){const r=se(t);if(!r)throw new Error("header name must be a non-empty string");const s=I.findKey(o,r);(!s||void 0===o[s]||!0===n||void 0===n&&!1!==o[s])&&(o[s||t]=ie(e))}const s=(e,t)=>I.forEach(e,((e,n)=>r(e,n,t)));return I.isPlainObject(e)||e instanceof this.constructor?s(e,t):I.isString(e)&&(e=e.trim())&&!/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim())?s((e=>{const t={};let n,o,r;return e&&e.split("\n").forEach((function(e){r=e.indexOf(":"),n=e.substring(0,r).trim().toLowerCase(),o=e.substring(r+1).trim(),!n||t[n]&&oe[n]||("set-cookie"===n?t[n]?t[n].push(o):t[n]=[o]:t[n]=t[n]?t[n]+", "+o:o)})),t})(e),t):null!=e&&r(t,e,n),this}get(e,t){if(e=se(e)){const n=I.findKey(this,e);if(n){const e=this[n];if(!t)return e;if(!0===t)return function(e){const t=Object.create(null),n=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let o;for(;o=n.exec(e);)t[o[1]]=o[2];return t}(e);if(I.isFunction(t))return t.call(this,e,n);if(I.isRegExp(t))return t.exec(e);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,t){if(e=se(e)){const n=I.findKey(this,e);return!(!n||void 0===this[n]||t&&!ae(0,this[n],n,t))}return!1}delete(e,t){const n=this;let o=!1;function r(e){if(e=se(e)){const r=I.findKey(n,e);!r||t&&!ae(0,n[r],r,t)||(delete n[r],o=!0)}}return I.isArray(e)?e.forEach(r):r(e),o}clear(e){const t=Object.keys(this);let n=t.length,o=!1;for(;n--;){const r=t[n];e&&!ae(0,this[r],r,e,!0)||(delete this[r],o=!0)}return o}normalize(e){const t=this,n={};return I.forEach(this,((o,r)=>{const s=I.findKey(n,r);if(s)return t[s]=ie(o),void delete t[r];const i=e?function(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,((e,t,n)=>t.toUpperCase()+n))}(r):String(r).trim();i!==r&&delete t[r],t[i]=ie(o),n[i]=!0})),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){const t=Object.create(null);return I.forEach(this,((n,o)=>{null!=n&&!1!==n&&(t[o]=e&&I.isArray(n)?n.join(", "):n)})),t}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map((([e,t])=>e+": "+t)).join("\n")}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(e){return e instanceof this?e:new this(e)}static concat(e,...t){const n=new this(e);return t.forEach((e=>n.set(e))),n}static accessor(e){const t=(this[re]=this[re]={accessors:{}}).accessors,n=this.prototype;function o(e){const o=se(e);t[o]||(function(e,t){const n=I.toCamelCase(" "+t);["get","set","has"].forEach((o=>{Object.defineProperty(e,o+n,{value:function(e,n,r){return this[o].call(this,t,e,n,r)},configurable:!0})}))}(n,e),t[o]=!0)}return I.isArray(e)?e.forEach(o):o(e),this}}ce.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),I.reduceDescriptors(ce.prototype,(({value:e},t)=>{let n=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(e){this[n]=e}}})),I.freezeMethods(ce);var le=ce;function ue(e,t){const n=this||ne,o=t||n,r=le.from(o.headers);let s=o.data;return I.forEach(e,(function(e){s=e.call(n,s,r.normalize(),t?t.status:void 0)})),r.normalize(),s}function de(e){return!(!e||!e.__CANCEL__)}function pe(e,t,n){P.call(this,null==e?"canceled":e,P.ERR_CANCELED,t,n),this.name="CanceledError"}I.inherits(pe,P,{__CANCEL__:!0});var fe=Q.isStandardBrowserEnv?{write:function(e,t,n,o,r,s){const i=[];i.push(e+"="+encodeURIComponent(t)),I.isNumber(n)&&i.push("expires="+new Date(n).toGMTString()),I.isString(o)&&i.push("path="+o),I.isString(r)&&i.push("domain="+r),!0===s&&i.push("secure"),document.cookie=i.join("; ")},read:function(e){const t=document.cookie.match(new RegExp("(^|;\\s*)("+e+")=([^;]*)"));return t?decodeURIComponent(t[3]):null},remove:function(e){this.write(e,"",Date.now()-864e5)}}:{write:function(){},read:function(){return null},remove:function(){}};function he(e,t){return e&&!/^([a-z][a-z\d+\-.]*:)?\/\//i.test(t)?function(e,t){return t?e.replace(/\/+$/,"")+"/"+t.replace(/^\/+/,""):e}(e,t):t}var me=Q.isStandardBrowserEnv?function(){const e=/(msie|trident)/i.test(navigator.userAgent),t=document.createElement("a");let n;function o(n){let o=n;return e&&(t.setAttribute("href",o),o=t.href),t.setAttribute("href",o),{href:t.href,protocol:t.protocol?t.protocol.replace(/:$/,""):"",host:t.host,search:t.search?t.search.replace(/^\?/,""):"",hash:t.hash?t.hash.replace(/^#/,""):"",hostname:t.hostname,port:t.port,pathname:"/"===t.pathname.charAt(0)?t.pathname:"/"+t.pathname}}return n=o(window.location.href),function(e){const t=I.isString(e)?o(e):e;return t.protocol===n.protocol&&t.host===n.host}}():function(){return!0};function ve(e,t){let n=0;const o=function(e,t){e=e||10;const n=new Array(e),o=new Array(e);let r,s=0,i=0;return t=void 0!==t?t:1e3,function(a){const c=Date.now(),l=o[i];r||(r=c),n[s]=a,o[s]=c;let u=i,d=0;for(;u!==s;)d+=n[u++],u%=e;if(s=(s+1)%e,s===i&&(i=(i+1)%e),c-r<t)return;const p=l&&c-l;return p?Math.round(1e3*d/p):void 0}}(50,250);return r=>{const s=r.loaded,i=r.lengthComputable?r.total:void 0,a=s-n,c=o(a);n=s;const l={loaded:s,total:i,progress:i?s/i:void 0,bytes:a,rate:c||void 0,estimated:c&&i&&s<=i?(i-s)/c:void 0,event:r};l[t?"download":"upload"]=!0,e(l)}}const ye={http:null,xhr:"undefined"!=typeof XMLHttpRequest&&function(e){return new Promise((function(t,n){let o=e.data;const r=le.from(e.headers).normalize(),s=e.responseType;let i,a;function c(){e.cancelToken&&e.cancelToken.unsubscribe(i),e.signal&&e.signal.removeEventListener("abort",i)}I.isFormData(o)&&(Q.isStandardBrowserEnv||Q.isStandardBrowserWebWorkerEnv?r.setContentType(!1):r.getContentType(/^\s*multipart\/form-data/)?I.isString(a=r.getContentType())&&r.setContentType(a.replace(/^\s*(multipart\/form-data);+/,"$1")):r.setContentType("multipart/form-data"));let l=new XMLHttpRequest;if(e.auth){const t=e.auth.username||"",n=e.auth.password?unescape(encodeURIComponent(e.auth.password)):"";r.set("Authorization","Basic "+btoa(t+":"+n))}const u=he(e.baseURL,e.url);function d(){if(!l)return;const o=le.from("getAllResponseHeaders"in l&&l.getAllResponseHeaders());!function(e,t,n){const o=n.config.validateStatus;n.status&&o&&!o(n.status)?t(new P("Request failed with status code "+n.status,[P.ERR_BAD_REQUEST,P.ERR_BAD_RESPONSE][Math.floor(n.status/100)-4],n.config,n.request,n)):e(n)}((function(e){t(e),c()}),(function(e){n(e),c()}),{data:s&&"text"!==s&&"json"!==s?l.response:l.responseText,status:l.status,statusText:l.statusText,headers:o,config:e,request:l}),l=null}if(l.open(e.method.toUpperCase(),X(u,e.params,e.paramsSerializer),!0),l.timeout=e.timeout,"onloadend"in l?l.onloadend=d:l.onreadystatechange=function(){l&&4===l.readyState&&(0!==l.status||l.responseURL&&0===l.responseURL.indexOf("file:"))&&setTimeout(d)},l.onabort=function(){l&&(n(new P("Request aborted",P.ECONNABORTED,e,l)),l=null)},l.onerror=function(){n(new P("Network Error",P.ERR_NETWORK,e,l)),l=null},l.ontimeout=function(){let t=e.timeout?"timeout of "+e.timeout+"ms exceeded":"timeout exceeded";const o=e.transitional||Z;e.timeoutErrorMessage&&(t=e.timeoutErrorMessage),n(new P(t,o.clarifyTimeoutError?P.ETIMEDOUT:P.ECONNABORTED,e,l)),l=null},Q.isStandardBrowserEnv){const t=(e.withCredentials||me(u))&&e.xsrfCookieName&&fe.read(e.xsrfCookieName);t&&r.set(e.xsrfHeaderName,t)}void 0===o&&r.setContentType(null),"setRequestHeader"in l&&I.forEach(r.toJSON(),(function(e,t){l.setRequestHeader(t,e)})),I.isUndefined(e.withCredentials)||(l.withCredentials=!!e.withCredentials),s&&"json"!==s&&(l.responseType=e.responseType),"function"==typeof e.onDownloadProgress&&l.addEventListener("progress",ve(e.onDownloadProgress,!0)),"function"==typeof e.onUploadProgress&&l.upload&&l.upload.addEventListener("progress",ve(e.onUploadProgress)),(e.cancelToken||e.signal)&&(i=t=>{l&&(n(!t||t.type?new pe(null,e,l):t),l.abort(),l=null)},e.cancelToken&&e.cancelToken.subscribe(i),e.signal&&(e.signal.aborted?i():e.signal.addEventListener("abort",i)));const p=function(e){const t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}(u);p&&-1===Q.protocols.indexOf(p)?n(new P("Unsupported protocol "+p+":",P.ERR_BAD_REQUEST,e)):l.send(o||null)}))}};I.forEach(ye,((e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch(e){}Object.defineProperty(e,"adapterName",{value:t})}}));const ge=e=>`- ${e}`,we=e=>I.isFunction(e)||null===e||!1===e;var Ee=e=>{e=I.isArray(e)?e:[e];const{length:t}=e;let n,o;const r={};for(let s=0;s<t;s++){let t;if(n=e[s],o=n,!we(n)&&(o=ye[(t=String(n)).toLowerCase()],void 0===o))throw new P(`Unknown adapter '${t}'`);if(o)break;r[t||"#"+s]=o}if(!o){const e=Object.entries(r).map((([e,t])=>`adapter ${e} `+(!1===t?"is not supported by the environment":"is not available in the build")));throw new P("There is no suitable adapter to dispatch the request "+(t?e.length>1?"since :\n"+e.map(ge).join("\n"):" "+ge(e[0]):"as no adapter specified"),"ERR_NOT_SUPPORT")}return o};function be(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new pe(null,e)}function Se(e){return be(e),e.headers=le.from(e.headers),e.data=ue.call(e,e.transformRequest),-1!==["post","put","patch"].indexOf(e.method)&&e.headers.setContentType("application/x-www-form-urlencoded",!1),Ee(e.adapter||ne.adapter)(e).then((function(t){return be(e),t.data=ue.call(e,e.transformResponse,t),t.headers=le.from(t.headers),t}),(function(t){return de(t)||(be(e),t&&t.response&&(t.response.data=ue.call(e,e.transformResponse,t.response),t.response.headers=le.from(t.response.headers))),Promise.reject(t)}))}const Oe=e=>e instanceof le?e.toJSON():e;function Re(e,t){t=t||{};const n={};function o(e,t,n){return I.isPlainObject(e)&&I.isPlainObject(t)?I.merge.call({caseless:n},e,t):I.isPlainObject(t)?I.merge({},t):I.isArray(t)?t.slice():t}function r(e,t,n){return I.isUndefined(t)?I.isUndefined(e)?void 0:o(void 0,e,n):o(e,t,n)}function s(e,t){if(!I.isUndefined(t))return o(void 0,t)}function i(e,t){return I.isUndefined(t)?I.isUndefined(e)?void 0:o(void 0,e):o(void 0,t)}function a(n,r,s){return s in t?o(n,r):s in e?o(void 0,n):void 0}const c={url:s,method:s,data:s,baseURL:i,transformRequest:i,transformResponse:i,paramsSerializer:i,timeout:i,timeoutMessage:i,withCredentials:i,adapter:i,responseType:i,xsrfCookieName:i,xsrfHeaderName:i,onUploadProgress:i,onDownloadProgress:i,decompress:i,maxContentLength:i,maxBodyLength:i,beforeRedirect:i,transport:i,httpAgent:i,httpsAgent:i,cancelToken:i,socketPath:i,responseEncoding:i,validateStatus:a,headers:(e,t)=>r(Oe(e),Oe(t),!0)};return I.forEach(Object.keys(Object.assign({},e,t)),(function(o){const s=c[o]||r,i=s(e[o],t[o],o);I.isUndefined(i)&&s!==a||(n[o]=i)})),n}const Ae={};["object","boolean","number","function","string","symbol"].forEach(((e,t)=>{Ae[e]=function(n){return typeof n===e||"a"+(t<1?"n ":" ")+e}}));const Te={};Ae.transitional=function(e,t,n){function o(e,t){return"[Axios v1.5.1] Transitional option '"+e+"'"+t+(n?". "+n:"")}return(n,r,s)=>{if(!1===e)throw new P(o(r," has been removed"+(t?" in "+t:"")),P.ERR_DEPRECATED);return t&&!Te[r]&&(Te[r]=!0,console.warn(o(r," has been deprecated since v"+t+" and will be removed in the near future"))),!e||e(n,r,s)}};var _e={assertOptions:function(e,t,n){if("object"!=typeof e)throw new P("options must be an object",P.ERR_BAD_OPTION_VALUE);const o=Object.keys(e);let r=o.length;for(;r-- >0;){const s=o[r],i=t[s];if(i){const t=e[s],n=void 0===t||i(t,s,e);if(!0!==n)throw new P("option "+s+" must be "+n,P.ERR_BAD_OPTION_VALUE)}else if(!0!==n)throw new P("Unknown option "+s,P.ERR_BAD_OPTION)}},validators:Ae};const Fe=_e.validators;class Ce{constructor(e){this.defaults=e,this.interceptors={request:new Y,response:new Y}}request(e,t){"string"==typeof e?(t=t||{}).url=e:t=e||{},t=Re(this.defaults,t);const{transitional:n,paramsSerializer:o,headers:r}=t;void 0!==n&&_e.assertOptions(n,{silentJSONParsing:Fe.transitional(Fe.boolean),forcedJSONParsing:Fe.transitional(Fe.boolean),clarifyTimeoutError:Fe.transitional(Fe.boolean)},!1),null!=o&&(I.isFunction(o)?t.paramsSerializer={serialize:o}:_e.assertOptions(o,{encode:Fe.function,serialize:Fe.function},!0)),t.method=(t.method||this.defaults.method||"get").toLowerCase();let s=r&&I.merge(r.common,r[t.method]);r&&I.forEach(["delete","get","head","post","put","patch","common"],(e=>{delete r[e]})),t.headers=le.concat(s,r);const i=[];let a=!0;this.interceptors.request.forEach((function(e){"function"==typeof e.runWhen&&!1===e.runWhen(t)||(a=a&&e.synchronous,i.unshift(e.fulfilled,e.rejected))}));const c=[];let l;this.interceptors.response.forEach((function(e){c.push(e.fulfilled,e.rejected)}));let u,d=0;if(!a){const e=[Se.bind(this),void 0];for(e.unshift.apply(e,i),e.push.apply(e,c),u=e.length,l=Promise.resolve(t);d<u;)l=l.then(e[d++],e[d++]);return l}u=i.length;let p=t;for(d=0;d<u;){const e=i[d++],t=i[d++];try{p=e(p)}catch(e){t.call(this,e);break}}try{l=Se.call(this,p)}catch(e){return Promise.reject(e)}for(d=0,u=c.length;d<u;)l=l.then(c[d++],c[d++]);return l}getUri(e){return X(he((e=Re(this.defaults,e)).baseURL,e.url),e.params,e.paramsSerializer)}}I.forEach(["delete","get","head","options"],(function(e){Ce.prototype[e]=function(t,n){return this.request(Re(n||{},{method:e,url:t,data:(n||{}).data}))}})),I.forEach(["post","put","patch"],(function(e){function t(t){return function(n,o,r){return this.request(Re(r||{},{method:e,headers:t?{"Content-Type":"multipart/form-data"}:{},url:n,data:o}))}}Ce.prototype[e]=t(),Ce.prototype[e+"Form"]=t(!0)}));var De=Ce;class Ne{constructor(e){if("function"!=typeof e)throw new TypeError("executor must be a function.");let t;this.promise=new Promise((function(e){t=e}));const n=this;this.promise.then((e=>{if(!n._listeners)return;let t=n._listeners.length;for(;t-- >0;)n._listeners[t](e);n._listeners=null})),this.promise.then=e=>{let t;const o=new Promise((e=>{n.subscribe(e),t=e})).then(e);return o.cancel=function(){n.unsubscribe(t)},o},e((function(e,o,r){n.reason||(n.reason=new pe(e,o,r),t(n.reason))}))}throwIfRequested(){if(this.reason)throw this.reason}subscribe(e){this.reason?e(this.reason):this._listeners?this._listeners.push(e):this._listeners=[e]}unsubscribe(e){if(!this._listeners)return;const t=this._listeners.indexOf(e);-1!==t&&this._listeners.splice(t,1)}static source(){let e;return{token:new Ne((function(t){e=t})),cancel:e}}}var ke=Ne;const je={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(je).forEach((([e,t])=>{je[t]=e}));var Ue=je;const Le=function e(t){const n=new De(t),r=o(De.prototype.request,n);return I.extend(r,De.prototype,n,{allOwnKeys:!0}),I.extend(r,n,null,{allOwnKeys:!0}),r.create=function(n){return e(Re(t,n))},r}(ne);Le.Axios=De,Le.CanceledError=pe,Le.CancelToken=ke,Le.isCancel=de,Le.VERSION="1.5.1",Le.toFormData=K,Le.AxiosError=P,Le.Cancel=Le.CanceledError,Le.all=function(e){return Promise.all(e)},Le.spread=function(e){return function(t){return e.apply(null,t)}},Le.isAxiosError=function(e){return I.isObject(e)&&!0===e.isAxiosError},Le.mergeConfig=Re,Le.AxiosHeaders=le,Le.formToJSON=e=>ee(I.isHTMLForm(e)?new FormData(e):e),Le.getAdapter=Ee,Le.HttpStatusCode=Ue,Le.default=Le,e.exports=Le}},t={};function n(o){var r=t[o];if(void 0!==r)return r.exports;var s=t[o]={exports:{}};return e[o].call(s.exports,s,s.exports,n),s.exports}n.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}();var o={};return(()=>{"use strict";var e=o;const t=n(234),r=n(604),s=n(122);class i{}i.livenessDetection=t.livenessDetection,i.uploadIdentificationDocument=r.uploadIdentificationDocument,i.insertUploadIdentificationDocument=s.insertUploadIdentificationDocument,e.default=i})(),o.default})()));
1
+ !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define("SantoiDSDK",[],t):"object"==typeof exports?exports.SantoiDSDK=t():e.SantoiDSDK=t()}(this,(()=>(()=>{var e={373:function(e,t,r){"use strict";var s=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.AbstractService=void 0;const o=s(r(218)),n=r(661);t.AbstractService=class{constructor(e,t){this.options=e,this.serviceOptions=t}request(e){var t,r,{contentType:s="application/json",authToken:i=this.options.token,baseUrl:a=(null!==(t=this.options.customApiUrl)&&void 0!==t?t:n.API_GATEWAY_URL)}=void 0===e?{}:e;const c={baseURL:a,headers:{"Content-Type":s,Authorization:`Bearer ${i}`}};let l=this.options.domain;if(!this.options.domain&&this.options.token){const e=this.serviceOptions.tryDecodeJwt(this.options.token);l=null===(r=null==e?void 0:e.claims)||void 0===r?void 0:r.domain}return c.headers&&(l&&(c.headers.Domain=l),this.options.useBillingAccounts&&(c.headers.clientCredentials=!0)),o.default.create(c)}}},151:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ApiAsyncService=void 0;const s=r(373);class o extends s.AbstractService{constructor(e,...t){super(...t),this.resultsRoute=e.resultsRoute}async get(e){return(await this.request().get(`/api/v1/tracks/${this.options.track}/${this.resultsRoute}/`+e)).data}}t.ApiAsyncService=o},748:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ApiFaceMatchService=void 0;const s=r(151),o=r(951);class n extends s.ApiAsyncService{constructor(...e){super({resultsRoute:"face-async"},...e)}async faceMatch(e,t,r){return await(0,o.retryAsyncFunctionXTimes)((async()=>{const s=new this.serviceOptions.FormDataClass;return s.append("track",this.options.track),s.append("deliveryFront","true"),s.append("sensitive_data_compliance","true"),s.append("imageFile1",e,"imageFile1.jpg"),t&&s.append("imageFile2",t,"imageFile2.jpg"),r&&s.append("customerRequestId",r),(await this.request({contentType:"multipart/form-data"}).post("/api/v1/face-match-async",s)).data}))}async get(...e){return await super.get(...e)}}t.ApiFaceMatchService=n},926:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ApiOcrService=void 0;const s=r(151),o=r(951);class n extends s.ApiAsyncService{constructor(...e){super({resultsRoute:"ocr-async"},...e)}async extract(e,t){return await(0,o.retryAsyncFunctionXTimes)((async()=>{const r=new this.serviceOptions.FormDataClass;return r.append("imageFile",e,"imageFile.jpg"),r.append("track",this.options.track),r.append("template",this.options.template),r.append("customerRequestId",t),r.append("deliveryFront","true"),(await this.request({contentType:"multipart/form-data"}).post("/api/v1/ocr-async/ocr",r)).data}))}}t.ApiOcrService=n},456:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ApiTypificationService=void 0;const s=r(151),o=r(951);class n extends s.ApiAsyncService{constructor(...e){super({resultsRoute:"typification-async"},...e)}async predict(e,t){return await(0,o.retryAsyncFunctionXTimes)((async()=>{const r=new this.serviceOptions.FormDataClass;return r.append("imageFile",e,"imageFile.jpg"),r.append("track",this.options.track),r.append("customerRequestId",t),r.append("deliveryFront","true"),(await this.request({contentType:"multipart/form-data"}).post("/api/v1/typification-async/predict",r)).data}))}}t.ApiTypificationService=n},135:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.BaseCoreService=void 0;const s=r(551),o=r(620);t.BaseCoreService=class{constructor(e){this.results={status:null,results:null,loading:!1,error:null},this.cameraIsActive=!1,this.cameraIsSetup=!1,this.options=e}async initialize(e){var t;e?this.startProcessing(e):(null!==(t=this.options.startTheCameraImmediately)&&void 0!==t?t:void 0===this.options.startTheCameraImmediately)&&await this.startCamera()}async updateResults(e){var t,r;this.results=Object.assign(Object.assign({},this.results),e),await(null===(r=(t=this.options).onUpdate)||void 0===r?void 0:r.call(t,this.results))}getVideoStream(){var e;return null===(e=this.frameGetControls)||void 0===e?void 0:e.videoStream}async setupCamera(){this.frameGetControls=await(0,o.getDefaultFrameControls)(),this.cameraIsSetup=!0}async startCamera(e){var t,r,o,n,i,a;try{if(this.cameraIsActive)throw new s.SDKError({message:"The camera has already been initialized",code:s.ECameraErrorCodes.ALREADY_STARTED,fatal:!1});if(this.results.loading)throw new s.SDKError({message:"Typification processing has already started",code:s.EProcessingErrorCodes.ALREADY_STARTED,fatal:!1});this.cameraIsSetup||await this.setupCamera(),this.frameGetControls.videoStream=await(null===(r=(t=this.frameGetControls).startGettingFrames)||void 0===r?void 0:r.call(t,e)),await(null===(n=(o=this.options).onCameraStart)||void 0===n?void 0:n.call(o,{videoStream:this.getVideoStream()})),this.cameraIsActive=!0}catch(e){const t=e instanceof s.SDKError?e:new s.SDKError({message:"Camera initialization error",code:s.ECameraErrorCodes.INITIALIZATION_ERROR,fatal:!1,details:e});await(null===(a=(i=this.options).onError)||void 0===a?void 0:a.call(i,t))}}async stopCamera(){var e,t,r,o,n,i;try{if(!this.cameraIsActive)throw new s.SDKError({message:"Camera not initialized",code:s.ECameraErrorCodes.NOT_INITIALIZED,fatal:!1});await(null===(t=(e=this.frameGetControls).stopGettingFrames)||void 0===t?void 0:t.call(e)),await(null===(o=(r=this.options).onCameraStop)||void 0===o?void 0:o.call(r)),this.cameraIsActive=!1}catch(e){const t=e instanceof s.SDKError?e:new s.SDKError({message:"Error during camera shutdown",code:s.ECameraErrorCodes.SHUTDOWN_ERROR,fatal:!1,details:e});await(null===(i=(n=this.options).onError)||void 0===i?void 0:i.call(n,t))}}async captureImage({startProcessing:e=!0}={}){var t,r;const o=await(null===(r=(t=this.frameGetControls).getNextFrame)||void 0===r?void 0:r.call(t));if(o)return e&&(await this.stopCamera(),await this.startProcessing(o)),o;throw new s.SDKError({message:"Cannot capture image",code:s.ECameraErrorCodes.CANNOT_CAPTURE_IMAGE,fatal:!1})}async waitForResults(e){let t=!1;return await new Promise(((r,s)=>{const o=setInterval((async()=>{var n,i,a,c;try{null===(i=(n=this.options).onClearInterval)||void 0===i||i.call(n,o);const s=await this.service.get(e);if("validation"===(null==s?void 0:s.status)&&!t)return await(null===(c=(a=this.options).onValidationRequested)||void 0===c?void 0:c.call(a,{track:this.options.track,requestId:s.id})),void(t=!0);if("error"===(null==s?void 0:s.status))throw new Error("Não foi possível processar os resultados do Upload de Documentos");if("processed"===(null==s?void 0:s.status)&&s.fileURL){const e=await fetch(s.fileURL),t=await e.json();t&&(clearInterval(o),r(t))}}catch(e){clearInterval(o),s(e)}}),5e3)}))}}},474:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.FaceMatchService=void 0;const s=r(877),o=r(551),n=r(616),i=r(748),a=r(135);class c extends a.BaseCoreService{constructor(e){super(e),this.selectedFile1=void 0,this.selectedFile2=void 0,this.service=new i.ApiFaceMatchService(e,{FormDataClass:FormData,tryDecodeJwt:n.tryDecodeJwt})}async initialize(e,t){var r;e?this.startProcessing(e,t):(null!==(r=this.options.startTheCameraImmediately)&&void 0!==r?r:void 0===this.options.startTheCameraImmediately)&&await this.startCamera()}async captureFirstImage({startProcessing:e=!0}={}){const t=await super.captureImage({startProcessing:!1});return this.selectedFile1=t,e&&(await this.stopCamera(),await this.startProcessing(this.selectedFile1)),t}async captureSecondImage({startProcessing:e=!0}={}){if(!this.selectedFile1)throw new o.SDKError({message:"Select the first image before selecting the second",code:o.EFaceMatchErrorCodes.FIRST_IMAGE_NOT_SELECTED,fatal:!1});const t=await super.captureImage({startProcessing:!1});return this.selectedFile2=t,e&&(await this.stopCamera(),await this.startProcessing(this.selectedFile1,this.selectedFile2)),t}async startProcessing(e,t){var r,n,i,a,c,l,u;try{if(this.cameraIsActive)throw new o.SDKError({message:"Cannot start because the camera is running",code:o.ECameraErrorCodes.IS_RUNNING,fatal:!1});if(null===(r=this.results)||void 0===r?void 0:r.loading)throw new o.SDKError({message:"Processing has already started",code:o.EProcessingErrorCodes.ALREADY_STARTED,fatal:!1});this.updateResults({status:null,results:null,loading:!0,error:null});const{requestId:l}=await this.service.faceMatch(e,t,`sdk-ocr-${(0,s.v4)()}`),u=await this.waitForResultsFaceMatch(l);this.updateResults({status:"success",results:u,loading:!1,error:null}),null===(i=(n=this.options).onSuccess)||void 0===i||i.call(n,u),null===(c=(a=this.options).onEnd)||void 0===c||c.call(a)}catch(e){const t=e instanceof o.SDKError?e:new o.SDKError({message:"Error during document upload/analysis",code:o.EProcessingErrorCodes.PROCESSING_ERROR,fatal:!1,details:e});await(null===(u=(l=this.options).onError)||void 0===u?void 0:u.call(l,t)),this.updateResults({status:"error",results:null,loading:!1,error:t})}}async waitForResultsFaceMatch(e){return await new Promise(((t,r)=>{const s=setInterval((async()=>{var o,n,i,a;try{null===(n=(o=this.options).onClearInterval)||void 0===n||n.call(o,s);const r=await this.service.get(e);if("error"===(null==r?void 0:r.status)||"error_connector"===(null==r?void 0:r.status))throw new Error("Não foi possível processar os resultados do FaceMatch");if("processed"===(null==r?void 0:r.status)&&r.fileURL){const e=await fetch(r.fileURL);let o=await e.json();o=Object.assign(Object.assign({},o),{fileImage1:null!==(i=r.fileImage1)&&void 0!==i?i:"",fileImage2:null!==(a=r.fileImage2)&&void 0!==a?a:""}),o&&(clearInterval(s),t(o))}}catch(e){clearInterval(s),r(new Error(e))}}),5e3)}))}}t.FaceMatchService=c},927:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.faceMatch=void 0;const s=r(551),o=r(474);t.faceMatch=async function(e,t,r){var n,i;try{const s=new o.FaceMatchService(e);return await s.initialize(t,r),await(null===(i=(n=s.options).onStart)||void 0===i?void 0:i.call(n,{videoStream:s.getVideoStream()})),{startCamera:async(...e)=>{await s.startCamera(...e)},stopCamera:async()=>{await s.stopCamera()},captureFirstImage:async(...e)=>await s.captureFirstImage(...e),captureSecondImage:async(...e)=>await s.captureSecondImage(...e),getVideoStream:()=>s.getVideoStream(),sendFiles:async(...e)=>{await s.startProcessing(...e)}}}catch(e){throw new s.SDKError({message:"Error while starting SDK",code:s.EDefaultErrorCodes.INITIALIZATION_ERROR,fatal:!0,details:e})}}},577:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.OcrService=void 0;const s=r(877),o=r(551),n=r(616),i=r(926),a=r(135);class c extends a.BaseCoreService{constructor(e){super(e),this.service=new i.ApiOcrService(e,{FormDataClass:FormData,tryDecodeJwt:n.tryDecodeJwt})}async startProcessing(e){var t,r,n,i,a,c,l;try{if(this.cameraIsActive)throw new o.SDKError({message:"Cannot start because the camera is running",code:o.ECameraErrorCodes.IS_RUNNING,fatal:!1});if(null===(t=this.results)||void 0===t?void 0:t.loading)throw new o.SDKError({message:"Processing has already started",code:o.EProcessingErrorCodes.ALREADY_STARTED,fatal:!1});this.updateResults({status:null,results:null,loading:!0,error:null});const{requestId:c}=await this.service.extract(e,`sdk-ocr-${(0,s.v4)()}`),l=await this.waitForResults(c);this.updateResults({status:"success",results:l,loading:!1,error:null}),null===(n=(r=this.options).onSuccess)||void 0===n||n.call(r,l),null===(a=(i=this.options).onEnd)||void 0===a||a.call(i)}catch(e){const t=e instanceof o.SDKError?e:new o.SDKError({message:"Error during document upload/analysis",code:o.EProcessingErrorCodes.PROCESSING_ERROR,fatal:!1,details:e});await(null===(l=(c=this.options).onError)||void 0===l?void 0:l.call(c,t)),this.updateResults({status:"error",results:null,loading:!1,error:t})}}}t.OcrService=c},168:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ocr=void 0;const s=r(551),o=r(577);t.ocr=async function(e,t){var r,n;try{const s=new o.OcrService(e);return await s.initialize(t),await(null===(n=(r=s.options).onStart)||void 0===n?void 0:n.call(r,{videoStream:s.getVideoStream()})),{startCamera:async(...e)=>{await s.startCamera(...e)},stopCamera:async()=>{await s.stopCamera()},captureImage:async()=>await s.captureImage(),getVideoStream:()=>s.getVideoStream(),sendFile:async e=>{await s.startProcessing(e)}}}catch(e){throw new s.SDKError({message:"Error while starting SDK",code:s.EDefaultErrorCodes.INITIALIZATION_ERROR,fatal:!0,details:e})}}},983:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.TypificationService=void 0;const s=r(877),o=r(551),n=r(616),i=r(456),a=r(135);class c extends a.BaseCoreService{constructor(e){super(e),this.service=new i.ApiTypificationService(e,{FormDataClass:FormData,tryDecodeJwt:n.tryDecodeJwt})}async startProcessing(e){var t,r,n,i,a,c,l;try{if(this.cameraIsActive)throw new o.SDKError({message:"Cannot start because the camera is running",code:o.ECameraErrorCodes.IS_RUNNING,fatal:!1});if(null===(t=this.results)||void 0===t?void 0:t.loading)throw new o.SDKError({message:"Processing has already started",code:o.EProcessingErrorCodes.ALREADY_STARTED,fatal:!1});this.updateResults({status:null,results:null,loading:!0,error:null});const{requestId:c}=await this.service.predict(e,`sdk-typification-${(0,s.v4)()}`),l=await this.waitForResults(c);this.updateResults({status:"success",results:l,loading:!1,error:null}),null===(n=(r=this.options).onSuccess)||void 0===n||n.call(r,l),null===(a=(i=this.options).onEnd)||void 0===a||a.call(i)}catch(e){const t=e instanceof o.SDKError?e:new o.SDKError({message:"Error during document upload/analysis",code:o.EProcessingErrorCodes.PROCESSING_ERROR,fatal:!1,details:e});await(null===(l=(c=this.options).onError)||void 0===l?void 0:l.call(c,t)),this.updateResults({status:"error",results:null,loading:!1,error:t})}}}t.TypificationService=c},344:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.typification=void 0;const s=r(551),o=r(983);t.typification=async function(e,t){var r,n;try{const s=new o.TypificationService(e);return await s.initialize(t),await(null===(n=(r=s.options).onStart)||void 0===n?void 0:n.call(r,{videoStream:s.getVideoStream()})),{startCamera:async(...e)=>{await s.startCamera(...e)},stopCamera:async()=>{await s.stopCamera()},captureImage:async()=>await s.captureImage(),getVideoStream:()=>s.getVideoStream(),sendFile:async e=>{await s.startProcessing(e)}}}catch(e){throw new s.SDKError({message:"Error while starting SDK",code:s.EDefaultErrorCodes.INITIALIZATION_ERROR,fatal:!0,details:e})}}},122:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.insertUploadIdentificationDocument=void 0;const s=r(661);t.insertUploadIdentificationDocument=function(e,t){var r,o,n;const i=t?document.querySelector(t):document.body;if(!i)throw new Error("Cannot find target element");const a=document.createElement("iframe");a.style.overflow="hidden",a.style.border="0",a.setAttribute("width",null!==(r=e.width)&&void 0!==r?r:"100%"),a.setAttribute("height",null!==(o=e.height)&&void 0!==o?o:"550px"),a.setAttribute("scrolling","no"),a.setAttribute("allow","camera; microphone; clipboard-read; clipboard-write");let c=`${null!==(n=e.customAppUrl)&&void 0!==n?n:s.APPLICATION_URL}/share/domains/${e.domain}/tracks/${e.track}/flow/${e.flow}/embedded`;e.token&&(c+=`?accessToken=${e.token}`),a.setAttribute("src",c),i.appendChild(a)}},42:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.LivenessDetectionService=void 0;const s=r(551),o=r(620),n=r(951),i=r(661);t.LivenessDetectionService=class{constructor(e,t){this.frameGetControls={},this.currentStep="front",this.pauseSendingFramesToWebSocket=!1,this.websocketClosedBySDK=!1,this.validationSuccess=!1,this.canSendNextBytes=!0,this.endCalled=!1,this.cancelSendingFramesToWebsocket=void 0,this.successFrames={front:void 0,right:void 0,left:void 0,up:void 0,bottom:void 0},this.options=e,this.abstractWebSocket=t}async onWebSocketMessage(e){var t,r,o,i,a,c,l,u;const d=e.data,p=JSON.parse(d);return(null==p?void 0:p.validation)&&this.currentStep&&(this.successFrames[this.currentStep]=this.lastSentBytes),(null==p?void 0:p.next_step)&&!p.error&&(this.currentStep=p.next_step,await(null===(r=(t=this.options).onNextStep)||void 0===r?void 0:r.call(t,p.next_step)),await(null===(i=(o=this.options)[`on${(0,n.capitalizeFirstLetter)(p.next_step)}Step`])||void 0===i?void 0:i.call(o))),p&&(this.canSendNextBytes=!!(null==p?void 0:p.can_send_next_bytes)),(null==p?void 0:p.success)&&(this.successFrames.bottom=this.lastSentBytes,this.validationSuccess=!0,await(null===(c=(a=this.options).onSuccess)||void 0===c?void 0:c.call(a,{livenessId:p.livenessId,successFrames:this.successFrames})),await this.stopLivenessDetection()),(null==p?void 0:p.error)&&await(null===(u=(l=this.options).onError)||void 0===u?void 0:u.call(l,new s.SDKError({message:"Wrong position",code:s.ELivenessDetectionErrorCodes.WRONG_POSITION,fatal:!1}))),p}async stopLivenessDetection(){var e,t,r,s,o;await(0,n.waitFor)((()=>!!this.cancelSendingFramesToWebsocket)),null===(e=this.cancelSendingFramesToWebsocket)||void 0===e||e.call(this),await(null===(r=(t=this.frameGetControls).stopGettingFrames)||void 0===r?void 0:r.call(t)),this.abstractWebSocket.disconnectFromWebSocket(),this.endCalled||(await(null===(o=(s=this.options).onEnd)||void 0===o?void 0:o.call(s)),this.endCalled=!0),this.websocketClosedBySDK=!0}async sendFramesToWebSocket(){var e,t;try{if(this.canSendNextBytes&&!this.pauseSendingFramesToWebSocket){const r=await(null===(t=(e=this.frameGetControls).getNextFrame)||void 0===t?void 0:t.call(e));r&&(this.abstractWebSocket.send(r),this.lastSentBytes=r,this.canSendNextBytes=!1)}}catch(e){await this.stopLivenessDetection()}}async onConnect(){var e,t,r,s,a,c,l,u,d,p;try{if(this.options.getNextFrame)this.frameGetControls.startGettingFrames=this.options.startGettingFrames,this.frameGetControls.getNextFrame=this.options.getNextFrame,this.frameGetControls.stopGettingFrames=this.options.stopGettingFrames,this.frameGetControls.videoStream=await(null===(t=(e=this.options).startGettingFrames)||void 0===t?void 0:t.call(e));else{const e=await(0,o.getDefaultFrameControls)();this.frameGetControls.startGettingFrames=e.startGettingFrames,this.frameGetControls.getNextFrame=e.getNextFrame,this.frameGetControls.stopGettingFrames=e.stopGettingFrames,this.frameGetControls.videoStream=await(null===(s=(r=this.frameGetControls).startGettingFrames)||void 0===s?void 0:s.call(r))}await(null===(c=(a=this.options).onStart)||void 0===c?void 0:c.call(a,{videoStream:this.getVideoStream()})),await(null===(u=(l=this.options).onNextStep)||void 0===u?void 0:u.call(l,"front")),await(null===(p=(d=this.options).onFrontStep)||void 0===p?void 0:p.call(d)),this.cancelSendingFramesToWebsocket=(0,n.callAsyncFunctionEveryXSeconds)((async()=>{await this.sendFramesToWebSocket()}),i.SEND_FRAMES_INTERVAL_MS)}catch(e){await this.onError()}}async onError(){var e,t;this.validationSuccess||(await(null===(t=(e=this.options).onError)||void 0===t?void 0:t.call(e,new s.SDKError({message:"Internal Error",code:s.EDefaultErrorCodes.INTERNAL_ERROR,fatal:!1}))),await this.stopLivenessDetection())}resumeGettingFrames(){this.pauseSendingFramesToWebSocket=!1}pauseGettingFrames(){this.pauseSendingFramesToWebSocket=!0}getVideoStream(){var e;return null===(e=this.frameGetControls)||void 0===e?void 0:e.videoStream}}},234:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.livenessDetection=void 0;const s=r(42),o=r(551),n=r(706),i=r(616);t.livenessDetection=function(e){var t;try{const r=new n.AbstractWebSocket({WebSocketClass:null!==(t=e.CustomWebSocketClass)&&void 0!==t?t:WebSocket,decodeJwt:i.decodeJwt},e);r.startConnection();const o=new s.LivenessDetectionService(e,r);return r.waitForWebSocketConnection().then((()=>{o.onConnect()})).catch((()=>{o.onError()})),r.addListener("message",(e=>{o.onWebSocketMessage(e)})),r.addListener("error",(()=>{o.onError()})),r.addListener("close",(()=>{o.onError()})),{getVideoStream:()=>o.getVideoStream(),stopLivenessDetection:async()=>{await o.stopLivenessDetection()},resumeGettingFrames:()=>{o.resumeGettingFrames()},pauseGettingFrames:()=>{o.pauseGettingFrames()}}}catch(e){throw new o.SDKError({message:"Error while starting SDK",code:o.EDefaultErrorCodes.INITIALIZATION_ERROR,fatal:!0})}}},171:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.UploadIdentificationDocumentService=void 0;const s=r(456),o=r(748),n=r(551),i=r(877),a=r(616);t.UploadIdentificationDocumentService=class{constructor(e,t){this.results={uploadedDocument:null,typification:{status:null,results:null,loading:!1,error:null},liveness:{status:null,results:null,loading:!1,error:null},faceMatch:{status:null,results:null,loading:!1,error:null}},this.options=e,this.internalOptions=t,this.typificationService=new s.ApiTypificationService(e,{FormDataClass:FormData,tryDecodeJwt:a.tryDecodeJwt}),this.faceMatchService=new o.ApiFaceMatchService(e,{FormDataClass:FormData,tryDecodeJwt:a.tryDecodeJwt})}getResults(){return this.results}async updateResults(e){var t,r,s,o,n,i;this.results=Object.assign(Object.assign({},this.results),e),await(null===(r=(t=this.options).onUpdate)||void 0===r?void 0:r.call(t,this.results)),e.faceMatch||this.tryStartFaceMatch(),Object.entries(this.results).every((([e,t])=>"uploadedDocument"===e||!!t.results))&&(await(null===(o=(s=this.options).onSuccess)||void 0===o?void 0:o.call(s,this.results)),await(null===(i=(n=this.options).onEnd)||void 0===i?void 0:i.call(n)))}updateUploadedDocument(e){this.results.uploadedDocument=e}async waitForResults(e){let t=!1;return await new Promise(((r,s)=>{const o=setInterval((async()=>{var n,i,a,c;try{null===(i=(n=this.options).onClearInterval)||void 0===i||i.call(n,o);const l=await this.typificationService.get(e);if("validation"!==(null==l?void 0:l.status)||t){if("error"===(null==l?void 0:l.status))clearInterval(o),s(new Error("Não foi possível processar os resultados do Upload de Documentos"));else if("processed"===(null==l?void 0:l.status)&&l.fileURL){const e=await fetch(l.fileURL),t=await e.json();t&&(clearInterval(o),r(t))}}else await(null===(c=(a=this.options).onValidationRequested)||void 0===c?void 0:c.call(a,{track:this.options.track,requestId:l.id})),t=!0}catch(e){clearInterval(o),s(new Error(e))}}),5e3)}))}async waitForResultsFaceMatch(e){return await new Promise(((t,r)=>{const s=setInterval((async()=>{var o,n,i,a;try{null===(n=(o=this.options).onClearInterval)||void 0===n||n.call(o,s);const c=await this.faceMatchService.get(e);if("error"===(null==c?void 0:c.status)||"error_connector"===(null==c?void 0:c.status))clearInterval(s),r(new Error("Não foi possível processar os resultados do FaceMatch"));else if("processed"===(null==c?void 0:c.status)&&c.fileURL){const e=await fetch(c.fileURL);let r=await e.json();r=Object.assign(Object.assign({},r),{fileImage1:null!==(i=c.fileImage1)&&void 0!==i?i:"",fileImage2:null!==(a=c.fileImage2)&&void 0!==a?a:""}),r&&(clearInterval(s),t(r))}}catch(e){clearInterval(s),r(new Error(e))}}),5e3)}))}async startDocumentUpload(e){var t,r;try{this.updateResults({typification:{status:null,results:null,loading:!0,error:null}}),this.updateUploadedDocument(e);const{requestId:t}=await this.typificationService.predict(e,`sdk-typification-${(0,i.v4)()}`),r=await this.waitForResults(t);this.updateResults({typification:{status:"success",results:r,loading:!1,error:null}})}catch(e){const s=new n.SDKError({message:"Error during document upload/analysis",code:n.EUploadIdentificationDocumentErrorCodes.DOCUMENT_ANALYSIS_ERROR,fatal:!1,details:e});await(null===(r=(t=this.options).onError)||void 0===r?void 0:r.call(t,s)),this.updateResults({typification:{status:"error",results:null,loading:!1,error:s}})}}startLivenessDetection(e){var t,r;const s=Object.assign(Object.assign({},this.options.livenessDetectionOptions),e);this.updateResults({liveness:{results:null,status:null,loading:!0,error:null}});try{return this.internalOptions.livenessDetection(Object.assign(Object.assign({domain:this.options.domain,customId:this.options.customId,customWebSocketUrl:this.options.customWebSocketUrl,token:this.options.token,track:this.options.track},s),{onSuccess:async e=>{var t;await(null===(t=null==s?void 0:s.onSuccess)||void 0===t?void 0:t.call(s,e)),this.updateResults({liveness:{status:"success",results:e,loading:!1,error:null}})},onError:async e=>{var t,r,o;await(null===(t=null==s?void 0:s.onError)||void 0===t?void 0:t.call(s,e)),await(null===(o=(r=this.options).onError)||void 0===o?void 0:o.call(r,e)),this.updateResults({liveness:{status:"error",results:null,loading:"wrong-position"===(null==e?void 0:e.code),error:null!=e?e:null}})}}))}catch(e){const s=new n.SDKError({message:"Error during liveness detection",code:n.EUploadIdentificationDocumentErrorCodes.LIVENESS_DETECTION_ERROR,fatal:!1,details:e});null===(r=(t=this.options).onError)||void 0===r||r.call(t,s),this.updateResults({liveness:{status:"error",results:null,loading:!1,error:s}})}}async startFaceMatch(e,t){var r,s;try{this.updateResults({faceMatch:{status:null,results:null,loading:!0,error:null}});const{requestId:r}=await this.faceMatchService.faceMatch(e,t,`sdk-facematch-${(0,i.v4)()}`),s=await this.waitForResultsFaceMatch(r);this.updateResults({faceMatch:{results:s,status:"success",loading:!1,error:null}})}catch(e){const t=new n.SDKError({message:"Error when comparing the face with the document",code:n.EUploadIdentificationDocumentErrorCodes.FACE_MATCH_ERROR,fatal:!1,details:e});await(null===(s=(r=this.options).onError)||void 0===s?void 0:s.call(r,t)),this.updateResults({faceMatch:{results:null,status:"error",loading:!1,error:t}})}}async tryStartFaceMatch(){var e,t,r;!this.results.uploadedDocument||!(null===(e=this.results.liveness.results)||void 0===e?void 0:e.successFrames.front)||this.results.faceMatch.loading||this.results.liveness.loading||this.results.typification.loading?await(null===(r=(t=this.options).onError)||void 0===r?void 0:r.call(t,new n.SDKError({message:"Unavailable faces",code:n.EUploadIdentificationDocumentErrorCodes.FACE_MATCH_UNAVAILABLE_FACES_ERROR,fatal:!1}))):await this.startFaceMatch(this.results.uploadedDocument,this.results.liveness.results.successFrames.front)}startAll(e,t){this.startDocumentUpload(e),this.startLivenessDetection(t)}}},604:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.uploadIdentificationDocument=void 0;const s=r(171),o=r(234);t.uploadIdentificationDocument=function(e){const t=new s.UploadIdentificationDocumentService(e,{livenessDetection:o.livenessDetection});return{startDocumentUpload:async(...e)=>{await t.startDocumentUpload(...e)},startLivenessDetection:(...e)=>t.startLivenessDetection(...e),startFaceComparison:async(...e)=>{await t.tryStartFaceMatch(...e)},startAll:(...e)=>{t.startAll(...e)},getResults:(...e)=>t.getResults(...e)}}},620:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getDefaultFrameControls=void 0,t.getDefaultFrameControls=async function(){let e,t,r,s;return{startGettingFrames:async function(o){var n;return e&&t&&r||(e=await navigator.mediaDevices.getUserMedia({audio:!1,video:{facingMode:null!==(n=null==o?void 0:o.facingMode)&&void 0!==n?n:"user"}}),t=document.createElement("video"),t.setAttribute("autoplay","true"),t.style.transform="scale(-1, 1)",t.style.position="absolute",t.style.left="-99999px",document.body.appendChild(t),t.srcObject=e,r=document.createElement("canvas"),s=r.getContext("2d")),e},getNextFrame:async function(){if(r&&t)return r.width=t.videoWidth,r.height=t.videoHeight,null==s||s.drawImage(t,0,0,r.width,r.height),await new Promise(((e,t)=>{r?r.toBlob((t=>{e(t)})):e(null)}));throw new Error("Cannot found video element")},stopGettingFrames:function(){t&&(document.body.removeChild(t),t=void 0),r&&(r=void 0),s&&(s=void 0),e&&(null==e||e.getTracks().forEach((e=>{e.stop()})),e=void 0)}}}},616:(e,t)=>{"use strict";function r(e){const t=e.split(".")[1].replace(/-/g,"+").replace(/_/g,"/"),r=decodeURIComponent(window.atob(t).split("").map((e=>"%"+("00"+e.charCodeAt(0).toString(16)).slice(-2))).join(""));return JSON.parse(r)}Object.defineProperty(t,"__esModule",{value:!0}),t.tryDecodeJwt=t.decodeJwt=void 0,t.decodeJwt=r,t.tryDecodeJwt=function(e){try{return r(e)}catch(e){return null}}},661:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.DEFAULT_RETRY_TIME_STEP=t.DEFAULT_NUMBER_OF_RETRIES=t.SEND_FRAMES_INTERVAL_MS=t.APPLICATION_URL=t.API_GATEWAY_URL=t.WEBSOCKET_BASE_URL=void 0,t.WEBSOCKET_BASE_URL="wss://santoid-liveness-w4ynos5dlq-ue.a.run.app/api/v1/liveness/ws",t.API_GATEWAY_URL="https://api.santoid.com.br",t.APPLICATION_URL="https://app.santoid.com.br",t.SEND_FRAMES_INTERVAL_MS=100,t.DEFAULT_NUMBER_OF_RETRIES=5,t.DEFAULT_RETRY_TIME_STEP=1e3},551:(e,t)=>{"use strict";var r,s,o,n,i,a;Object.defineProperty(t,"__esModule",{value:!0}),t.SDKError=t.EProcessingErrorCodes=t.ECameraErrorCodes=t.EFaceMatchErrorCodes=t.EUploadIdentificationDocumentErrorCodes=t.ELivenessDetectionErrorCodes=t.EDefaultErrorCodes=void 0,function(e){e.INITIALIZATION_ERROR="initialization-error",e.INTERNAL_ERROR="internal-error"}(r||(t.EDefaultErrorCodes=r={})),function(e){e.WRONG_POSITION="liveness-detection/wrong-position"}(s||(t.ELivenessDetectionErrorCodes=s={})),function(e){e.FACE_MATCH_ERROR="upload-identification-document/face-match-error",e.FACE_MATCH_UNAVAILABLE_FACES_ERROR="upload-identification-document/face-match-unavailable-faces-error",e.DOCUMENT_ANALYSIS_ERROR="upload-identification-document/document-analysis-error",e.LIVENESS_DETECTION_ERROR="upload-identification-document/liveness-detection-error"}(o||(t.EUploadIdentificationDocumentErrorCodes=o={})),function(e){e.FIRST_IMAGE_NOT_SELECTED="face-match/first-image-not-selected"}(n||(t.EFaceMatchErrorCodes=n={})),function(e){e.INITIALIZATION_ERROR="camera/initialization-error",e.IS_RUNNING="camera/is-running",e.ALREADY_STARTED="camera/already-started",e.NOT_INITIALIZED="camera/not-initialized",e.CANNOT_CAPTURE_IMAGE="camera/cannot-capture-image",e.SHUTDOWN_ERROR="camera/shutdown-error"}(i||(t.ECameraErrorCodes=i={})),function(e){e.PROCESSING_ERROR="processing/processing-error",e.ALREADY_STARTED="processing/already-started"}(a||(t.EProcessingErrorCodes=a={}));class c extends Error{constructor({message:e,code:t,fatal:r,details:s}){super(e),this.code=t,this.fatal=r,this.details=s}}t.SDKError=c},951:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.retryAsyncFunctionXTimes=t.callAsyncFunctionEveryXSeconds=t.waitFor=t.wait=t.capitalizeFirstLetter=void 0;const s=r(218),o=r(661);async function n(e){await new Promise((t=>{e()?t():setTimeout((()=>{n(e).then(t)}),500)}))}function i(e){var t;return e instanceof s.AxiosError&&(503===(null===(t=e.response)||void 0===t?void 0:t.status)||"Network Error"===e.message)}t.capitalizeFirstLetter=function(e){return e.charAt(0).toUpperCase()+e.slice(1)},t.wait=async e=>{await new Promise((t=>{setTimeout(t,e)}))},t.waitFor=n,t.callAsyncFunctionEveryXSeconds=function e(t,r,s={stop:!1}){const o={timerEnd:!1};return setTimeout((()=>{o.timerEnd=!0}),r),t().then((async()=>{await n((()=>o.timerEnd)),s.stop||e(t,r,s)})),function(){s.stop=!0}},t.retryAsyncFunctionXTimes=async function e(r,s=i,n=o.DEFAULT_NUMBER_OF_RETRIES,a=1e3,c=o.DEFAULT_RETRY_TIME_STEP){try{return await r()}catch(o){if(s(o)&&n>0)return await(0,t.wait)(a),await e(r,s,n-1,a+c,c);throw o}}},706:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.AbstractWebSocket=void 0;const s=r(661);t.AbstractWebSocket=class{constructor(e,t){this.classOptions=e,this.sdkOptions=t}startConnection(){var e,t;const r=this.classOptions.decodeJwt(this.sdkOptions.token),o={x_endpoint_api_userinfo:this.sdkOptions.token,domain:null!==(e=this.sdkOptions.domain)&&void 0!==e?e:r.claims.domain,track:this.sdkOptions.track};this.sdkOptions.customId&&(o.customerRequestId=this.sdkOptions.customId),this.sdkOptions.useBillingAccounts&&(o.clientCredentials=!0);const n=Object.entries(o).map((e=>e.join("="))).join("&");this.websocket=new this.classOptions.WebSocketClass(`${null!==(t=this.sdkOptions.customWebSocketUrl)&&void 0!==t?t:s.WEBSOCKET_BASE_URL}?${n}`)}async waitForWebSocketConnection(){if(await new Promise((e=>{const t=setInterval((()=>{[3,1].includes(this.websocket.readyState)&&(clearInterval(t),e())}),5)})),3===this.websocket.readyState)throw new Error("Cannot connect to server")}disconnectFromWebSocket(){var e,t;[2,3].includes(this.websocket.readyState)||null===(t=(e=this.websocket).close)||void 0===t||t.call(e)}get readyState(){return this.websocket.readyState}addListener(e,t){var r,s;this.websocket.on?this.websocket.on(e,t):null===(s=(r=this.websocket).addEventListener)||void 0===s||s.call(r,e,t)}send(e){this.websocket.send(e)}}},877:(e,t,r)=>{var s=r(570),o=r(358),n=o;n.v1=s,n.v4=o,e.exports=n},327:e=>{for(var t=[],r=0;r<256;++r)t[r]=(r+256).toString(16).substr(1);e.exports=function(e,r){var s=r||0,o=t;return[o[e[s++]],o[e[s++]],o[e[s++]],o[e[s++]],"-",o[e[s++]],o[e[s++]],"-",o[e[s++]],o[e[s++]],"-",o[e[s++]],o[e[s++]],"-",o[e[s++]],o[e[s++]],o[e[s++]],o[e[s++]],o[e[s++]],o[e[s++]]].join("")}},217:e=>{var t="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||"undefined"!=typeof msCrypto&&"function"==typeof window.msCrypto.getRandomValues&&msCrypto.getRandomValues.bind(msCrypto);if(t){var r=new Uint8Array(16);e.exports=function(){return t(r),r}}else{var s=new Array(16);e.exports=function(){for(var e,t=0;t<16;t++)0==(3&t)&&(e=4294967296*Math.random()),s[t]=e>>>((3&t)<<3)&255;return s}}},570:(e,t,r)=>{var s,o,n=r(217),i=r(327),a=0,c=0;e.exports=function(e,t,r){var l=t&&r||0,u=t||[],d=(e=e||{}).node||s,p=void 0!==e.clockseq?e.clockseq:o;if(null==d||null==p){var h=n();null==d&&(d=s=[1|h[0],h[1],h[2],h[3],h[4],h[5]]),null==p&&(p=o=16383&(h[6]<<8|h[7]))}var f=void 0!==e.msecs?e.msecs:(new Date).getTime(),m=void 0!==e.nsecs?e.nsecs:c+1,v=f-a+(m-c)/1e4;if(v<0&&void 0===e.clockseq&&(p=p+1&16383),(v<0||f>a)&&void 0===e.nsecs&&(m=0),m>=1e4)throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");a=f,c=m,o=p;var g=(1e4*(268435455&(f+=122192928e5))+m)%4294967296;u[l++]=g>>>24&255,u[l++]=g>>>16&255,u[l++]=g>>>8&255,u[l++]=255&g;var y=f/4294967296*1e4&268435455;u[l++]=y>>>8&255,u[l++]=255&y,u[l++]=y>>>24&15|16,u[l++]=y>>>16&255,u[l++]=p>>>8|128,u[l++]=255&p;for(var E=0;E<6;++E)u[l+E]=d[E];return t||i(u)}},358:(e,t,r)=>{var s=r(217),o=r(327);e.exports=function(e,t,r){var n=t&&r||0;"string"==typeof e&&(t="binary"===e?new Array(16):null,e=null);var i=(e=e||{}).random||(e.rng||s)();if(i[6]=15&i[6]|64,i[8]=63&i[8]|128,t)for(var a=0;a<16;++a)t[n+a]=i[a];return t||o(i)}},218:(e,t,r)=>{"use strict";function s(e,t){return function(){return e.apply(t,arguments)}}const{toString:o}=Object.prototype,{getPrototypeOf:n}=Object,i=(a=Object.create(null),e=>{const t=o.call(e);return a[t]||(a[t]=t.slice(8,-1).toLowerCase())});var a;const c=e=>(e=e.toLowerCase(),t=>i(t)===e),l=e=>t=>typeof t===e,{isArray:u}=Array,d=l("undefined"),p=c("ArrayBuffer"),h=l("string"),f=l("function"),m=l("number"),v=e=>null!==e&&"object"==typeof e,g=e=>{if("object"!==i(e))return!1;const t=n(e);return!(null!==t&&t!==Object.prototype&&null!==Object.getPrototypeOf(t)||Symbol.toStringTag in e||Symbol.iterator in e)},y=c("Date"),E=c("File"),w=c("Blob"),S=c("FileList"),b=c("URLSearchParams");function R(e,t,{allOwnKeys:r=!1}={}){if(null==e)return;let s,o;if("object"!=typeof e&&(e=[e]),u(e))for(s=0,o=e.length;s<o;s++)t.call(null,e[s],s,e);else{const o=r?Object.getOwnPropertyNames(e):Object.keys(e),n=o.length;let i;for(s=0;s<n;s++)i=o[s],t.call(null,e[i],i,e)}}function O(e,t){t=t.toLowerCase();const r=Object.keys(e);let s,o=r.length;for(;o-- >0;)if(s=r[o],t===s.toLowerCase())return s;return null}const C="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:r.g,A=e=>!d(e)&&e!==C,D=(_="undefined"!=typeof Uint8Array&&n(Uint8Array),e=>_&&e instanceof _);var _;const T=c("HTMLFormElement"),F=(({hasOwnProperty:e})=>(t,r)=>e.call(t,r))(Object.prototype),I=c("RegExp"),N=(e,t)=>{const r=Object.getOwnPropertyDescriptors(e),s={};R(r,((r,o)=>{let n;!1!==(n=t(r,o,e))&&(s[o]=n||r)})),Object.defineProperties(e,s)},P="abcdefghijklmnopqrstuvwxyz",L="0123456789",j={DIGIT:L,ALPHA:P,ALPHA_DIGIT:P+P.toUpperCase()+L},U=c("AsyncFunction");var k={isArray:u,isArrayBuffer:p,isBuffer:function(e){return null!==e&&!d(e)&&null!==e.constructor&&!d(e.constructor)&&f(e.constructor.isBuffer)&&e.constructor.isBuffer(e)},isFormData:e=>{let t;return e&&("function"==typeof FormData&&e instanceof FormData||f(e.append)&&("formdata"===(t=i(e))||"object"===t&&f(e.toString)&&"[object FormData]"===e.toString()))},isArrayBufferView:function(e){let t;return t="undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer&&p(e.buffer),t},isString:h,isNumber:m,isBoolean:e=>!0===e||!1===e,isObject:v,isPlainObject:g,isUndefined:d,isDate:y,isFile:E,isBlob:w,isRegExp:I,isFunction:f,isStream:e=>v(e)&&f(e.pipe),isURLSearchParams:b,isTypedArray:D,isFileList:S,forEach:R,merge:function e(){const{caseless:t}=A(this)&&this||{},r={},s=(s,o)=>{const n=t&&O(r,o)||o;g(r[n])&&g(s)?r[n]=e(r[n],s):g(s)?r[n]=e({},s):u(s)?r[n]=s.slice():r[n]=s};for(let e=0,t=arguments.length;e<t;e++)arguments[e]&&R(arguments[e],s);return r},extend:(e,t,r,{allOwnKeys:o}={})=>(R(t,((t,o)=>{r&&f(t)?e[o]=s(t,r):e[o]=t}),{allOwnKeys:o}),e),trim:e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,""),stripBOM:e=>(65279===e.charCodeAt(0)&&(e=e.slice(1)),e),inherits:(e,t,r,s)=>{e.prototype=Object.create(t.prototype,s),e.prototype.constructor=e,Object.defineProperty(e,"super",{value:t.prototype}),r&&Object.assign(e.prototype,r)},toFlatObject:(e,t,r,s)=>{let o,i,a;const c={};if(t=t||{},null==e)return t;do{for(o=Object.getOwnPropertyNames(e),i=o.length;i-- >0;)a=o[i],s&&!s(a,e,t)||c[a]||(t[a]=e[a],c[a]=!0);e=!1!==r&&n(e)}while(e&&(!r||r(e,t))&&e!==Object.prototype);return t},kindOf:i,kindOfTest:c,endsWith:(e,t,r)=>{e=String(e),(void 0===r||r>e.length)&&(r=e.length),r-=t.length;const s=e.indexOf(t,r);return-1!==s&&s===r},toArray:e=>{if(!e)return null;if(u(e))return e;let t=e.length;if(!m(t))return null;const r=new Array(t);for(;t-- >0;)r[t]=e[t];return r},forEachEntry:(e,t)=>{const r=(e&&e[Symbol.iterator]).call(e);let s;for(;(s=r.next())&&!s.done;){const r=s.value;t.call(e,r[0],r[1])}},matchAll:(e,t)=>{let r;const s=[];for(;null!==(r=e.exec(t));)s.push(r);return s},isHTMLForm:T,hasOwnProperty:F,hasOwnProp:F,reduceDescriptors:N,freezeMethods:e=>{N(e,((t,r)=>{if(f(e)&&-1!==["arguments","caller","callee"].indexOf(r))return!1;const s=e[r];f(s)&&(t.enumerable=!1,"writable"in t?t.writable=!1:t.set||(t.set=()=>{throw Error("Can not rewrite read-only method '"+r+"'")}))}))},toObjectSet:(e,t)=>{const r={},s=e=>{e.forEach((e=>{r[e]=!0}))};return u(e)?s(e):s(String(e).split(t)),r},toCamelCase:e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,(function(e,t,r){return t.toUpperCase()+r})),noop:()=>{},toFiniteNumber:(e,t)=>(e=+e,Number.isFinite(e)?e:t),findKey:O,global:C,isContextDefined:A,ALPHABET:j,generateString:(e=16,t=j.ALPHA_DIGIT)=>{let r="";const{length:s}=t;for(;e--;)r+=t[Math.random()*s|0];return r},isSpecCompliantForm:function(e){return!!(e&&f(e.append)&&"FormData"===e[Symbol.toStringTag]&&e[Symbol.iterator])},toJSONObject:e=>{const t=new Array(10),r=(e,s)=>{if(v(e)){if(t.indexOf(e)>=0)return;if(!("toJSON"in e)){t[s]=e;const o=u(e)?[]:{};return R(e,((e,t)=>{const n=r(e,s+1);!d(n)&&(o[t]=n)})),t[s]=void 0,o}}return e};return r(e,0)},isAsyncFn:U,isThenable:e=>e&&(v(e)||f(e))&&f(e.then)&&f(e.catch)};function x(e,t,r,s,o){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=(new Error).stack,this.message=e,this.name="AxiosError",t&&(this.code=t),r&&(this.config=r),s&&(this.request=s),o&&(this.response=o)}k.inherits(x,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:k.toJSONObject(this.config),code:this.code,status:this.response&&this.response.status?this.response.status:null}}});const M=x.prototype,B={};function G(e){return k.isPlainObject(e)||k.isArray(e)}function K(e){return k.endsWith(e,"[]")?e.slice(0,-2):e}function W(e,t,r){return e?e.concat(t).map((function(e,t){return e=K(e),!r&&t?"["+e+"]":e})).join(r?".":""):t}["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach((e=>{B[e]={value:e}})),Object.defineProperties(x,B),Object.defineProperty(M,"isAxiosError",{value:!0}),x.from=(e,t,r,s,o,n)=>{const i=Object.create(M);return k.toFlatObject(e,i,(function(e){return e!==Error.prototype}),(e=>"isAxiosError"!==e)),x.call(i,e.message,t,r,s,o),i.cause=e,i.name=e.name,n&&Object.assign(i,n),i};const q=k.toFlatObject(k,{},null,(function(e){return/^is[A-Z]/.test(e)}));function V(e,t,r){if(!k.isObject(e))throw new TypeError("target must be an object");t=t||new FormData;const s=(r=k.toFlatObject(r,{metaTokens:!0,dots:!1,indexes:!1},!1,(function(e,t){return!k.isUndefined(t[e])}))).metaTokens,o=r.visitor||l,n=r.dots,i=r.indexes,a=(r.Blob||"undefined"!=typeof Blob&&Blob)&&k.isSpecCompliantForm(t);if(!k.isFunction(o))throw new TypeError("visitor must be a function");function c(e){if(null===e)return"";if(k.isDate(e))return e.toISOString();if(!a&&k.isBlob(e))throw new x("Blob is not supported. Use a Buffer instead.");return k.isArrayBuffer(e)||k.isTypedArray(e)?a&&"function"==typeof Blob?new Blob([e]):Buffer.from(e):e}function l(e,r,o){let a=e;if(e&&!o&&"object"==typeof e)if(k.endsWith(r,"{}"))r=s?r:r.slice(0,-2),e=JSON.stringify(e);else if(k.isArray(e)&&function(e){return k.isArray(e)&&!e.some(G)}(e)||(k.isFileList(e)||k.endsWith(r,"[]"))&&(a=k.toArray(e)))return r=K(r),a.forEach((function(e,s){!k.isUndefined(e)&&null!==e&&t.append(!0===i?W([r],s,n):null===i?r:r+"[]",c(e))})),!1;return!!G(e)||(t.append(W(o,r,n),c(e)),!1)}const u=[],d=Object.assign(q,{defaultVisitor:l,convertValue:c,isVisitable:G});if(!k.isObject(e))throw new TypeError("data must be an object");return function e(r,s){if(!k.isUndefined(r)){if(-1!==u.indexOf(r))throw Error("Circular reference detected in "+s.join("."));u.push(r),k.forEach(r,(function(r,n){!0===(!(k.isUndefined(r)||null===r)&&o.call(t,r,k.isString(n)?n.trim():n,s,d))&&e(r,s?s.concat(n):[n])})),u.pop()}}(e),t}function z(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,(function(e){return t[e]}))}function J(e,t){this._pairs=[],e&&V(e,this,t)}const H=J.prototype;function $(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function Y(e,t,r){if(!t)return e;const s=r&&r.encode||$,o=r&&r.serialize;let n;if(n=o?o(t,r):k.isURLSearchParams(t)?t.toString():new J(t,r).toString(s),n){const t=e.indexOf("#");-1!==t&&(e=e.slice(0,t)),e+=(-1===e.indexOf("?")?"?":"&")+n}return e}H.append=function(e,t){this._pairs.push([e,t])},H.toString=function(e){const t=e?function(t){return e.call(this,t,z)}:z;return this._pairs.map((function(e){return t(e[0])+"="+t(e[1])}),"").join("&")};var X=class{constructor(){this.handlers=[]}use(e,t,r){return this.handlers.push({fulfilled:e,rejected:t,synchronous:!!r&&r.synchronous,runWhen:r?r.runWhen:null}),this.handlers.length-1}eject(e){this.handlers[e]&&(this.handlers[e]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(e){k.forEach(this.handlers,(function(t){null!==t&&e(t)}))}},Z={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},Q={isBrowser:!0,classes:{URLSearchParams:"undefined"!=typeof URLSearchParams?URLSearchParams:J,FormData:"undefined"!=typeof FormData?FormData:null,Blob:"undefined"!=typeof Blob?Blob:null},isStandardBrowserEnv:(()=>{let e;return("undefined"==typeof navigator||"ReactNative"!==(e=navigator.product)&&"NativeScript"!==e&&"NS"!==e)&&"undefined"!=typeof window&&"undefined"!=typeof document})(),isStandardBrowserWebWorkerEnv:"undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope&&"function"==typeof self.importScripts,protocols:["http","https","file","blob","url","data"]};function ee(e){function t(e,r,s,o){let n=e[o++];const i=Number.isFinite(+n),a=o>=e.length;return n=!n&&k.isArray(s)?s.length:n,a?(k.hasOwnProp(s,n)?s[n]=[s[n],r]:s[n]=r,!i):(s[n]&&k.isObject(s[n])||(s[n]=[]),t(e,r,s[n],o)&&k.isArray(s[n])&&(s[n]=function(e){const t={},r=Object.keys(e);let s;const o=r.length;let n;for(s=0;s<o;s++)n=r[s],t[n]=e[n];return t}(s[n])),!i)}if(k.isFormData(e)&&k.isFunction(e.entries)){const r={};return k.forEachEntry(e,((e,s)=>{t(function(e){return k.matchAll(/\w+|\[(\w*)]/g,e).map((e=>"[]"===e[0]?"":e[1]||e[0]))}(e),s,r,0)})),r}return null}const te={transitional:Z,adapter:["xhr","http"],transformRequest:[function(e,t){const r=t.getContentType()||"",s=r.indexOf("application/json")>-1,o=k.isObject(e);if(o&&k.isHTMLForm(e)&&(e=new FormData(e)),k.isFormData(e))return s&&s?JSON.stringify(ee(e)):e;if(k.isArrayBuffer(e)||k.isBuffer(e)||k.isStream(e)||k.isFile(e)||k.isBlob(e))return e;if(k.isArrayBufferView(e))return e.buffer;if(k.isURLSearchParams(e))return t.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let n;if(o){if(r.indexOf("application/x-www-form-urlencoded")>-1)return function(e,t){return V(e,new Q.classes.URLSearchParams,Object.assign({visitor:function(e,t,r,s){return Q.isNode&&k.isBuffer(e)?(this.append(t,e.toString("base64")),!1):s.defaultVisitor.apply(this,arguments)}},t))}(e,this.formSerializer).toString();if((n=k.isFileList(e))||r.indexOf("multipart/form-data")>-1){const t=this.env&&this.env.FormData;return V(n?{"files[]":e}:e,t&&new t,this.formSerializer)}}return o||s?(t.setContentType("application/json",!1),function(e,t,r){if(k.isString(e))try{return(0,JSON.parse)(e),k.trim(e)}catch(e){if("SyntaxError"!==e.name)throw e}return(0,JSON.stringify)(e)}(e)):e}],transformResponse:[function(e){const t=this.transitional||te.transitional,r=t&&t.forcedJSONParsing,s="json"===this.responseType;if(e&&k.isString(e)&&(r&&!this.responseType||s)){const r=!(t&&t.silentJSONParsing)&&s;try{return JSON.parse(e)}catch(e){if(r){if("SyntaxError"===e.name)throw x.from(e,x.ERR_BAD_RESPONSE,this,null,this.response);throw e}}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:Q.classes.FormData,Blob:Q.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};k.forEach(["delete","get","head","post","put","patch"],(e=>{te.headers[e]={}}));var re=te;const se=k.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),oe=Symbol("internals");function ne(e){return e&&String(e).trim().toLowerCase()}function ie(e){return!1===e||null==e?e:k.isArray(e)?e.map(ie):String(e)}function ae(e,t,r,s,o){return k.isFunction(s)?s.call(this,t,r):(o&&(t=r),k.isString(t)?k.isString(s)?-1!==t.indexOf(s):k.isRegExp(s)?s.test(t):void 0:void 0)}class ce{constructor(e){e&&this.set(e)}set(e,t,r){const s=this;function o(e,t,r){const o=ne(t);if(!o)throw new Error("header name must be a non-empty string");const n=k.findKey(s,o);(!n||void 0===s[n]||!0===r||void 0===r&&!1!==s[n])&&(s[n||t]=ie(e))}const n=(e,t)=>k.forEach(e,((e,r)=>o(e,r,t)));return k.isPlainObject(e)||e instanceof this.constructor?n(e,t):k.isString(e)&&(e=e.trim())&&!/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim())?n((e=>{const t={};let r,s,o;return e&&e.split("\n").forEach((function(e){o=e.indexOf(":"),r=e.substring(0,o).trim().toLowerCase(),s=e.substring(o+1).trim(),!r||t[r]&&se[r]||("set-cookie"===r?t[r]?t[r].push(s):t[r]=[s]:t[r]=t[r]?t[r]+", "+s:s)})),t})(e),t):null!=e&&o(t,e,r),this}get(e,t){if(e=ne(e)){const r=k.findKey(this,e);if(r){const e=this[r];if(!t)return e;if(!0===t)return function(e){const t=Object.create(null),r=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let s;for(;s=r.exec(e);)t[s[1]]=s[2];return t}(e);if(k.isFunction(t))return t.call(this,e,r);if(k.isRegExp(t))return t.exec(e);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,t){if(e=ne(e)){const r=k.findKey(this,e);return!(!r||void 0===this[r]||t&&!ae(0,this[r],r,t))}return!1}delete(e,t){const r=this;let s=!1;function o(e){if(e=ne(e)){const o=k.findKey(r,e);!o||t&&!ae(0,r[o],o,t)||(delete r[o],s=!0)}}return k.isArray(e)?e.forEach(o):o(e),s}clear(e){const t=Object.keys(this);let r=t.length,s=!1;for(;r--;){const o=t[r];e&&!ae(0,this[o],o,e,!0)||(delete this[o],s=!0)}return s}normalize(e){const t=this,r={};return k.forEach(this,((s,o)=>{const n=k.findKey(r,o);if(n)return t[n]=ie(s),void delete t[o];const i=e?function(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,((e,t,r)=>t.toUpperCase()+r))}(o):String(o).trim();i!==o&&delete t[o],t[i]=ie(s),r[i]=!0})),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){const t=Object.create(null);return k.forEach(this,((r,s)=>{null!=r&&!1!==r&&(t[s]=e&&k.isArray(r)?r.join(", "):r)})),t}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map((([e,t])=>e+": "+t)).join("\n")}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(e){return e instanceof this?e:new this(e)}static concat(e,...t){const r=new this(e);return t.forEach((e=>r.set(e))),r}static accessor(e){const t=(this[oe]=this[oe]={accessors:{}}).accessors,r=this.prototype;function s(e){const s=ne(e);t[s]||(function(e,t){const r=k.toCamelCase(" "+t);["get","set","has"].forEach((s=>{Object.defineProperty(e,s+r,{value:function(e,r,o){return this[s].call(this,t,e,r,o)},configurable:!0})}))}(r,e),t[s]=!0)}return k.isArray(e)?e.forEach(s):s(e),this}}ce.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),k.reduceDescriptors(ce.prototype,(({value:e},t)=>{let r=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(e){this[r]=e}}})),k.freezeMethods(ce);var le=ce;function ue(e,t){const r=this||re,s=t||r,o=le.from(s.headers);let n=s.data;return k.forEach(e,(function(e){n=e.call(r,n,o.normalize(),t?t.status:void 0)})),o.normalize(),n}function de(e){return!(!e||!e.__CANCEL__)}function pe(e,t,r){x.call(this,null==e?"canceled":e,x.ERR_CANCELED,t,r),this.name="CanceledError"}k.inherits(pe,x,{__CANCEL__:!0});var he=Q.isStandardBrowserEnv?{write:function(e,t,r,s,o,n){const i=[];i.push(e+"="+encodeURIComponent(t)),k.isNumber(r)&&i.push("expires="+new Date(r).toGMTString()),k.isString(s)&&i.push("path="+s),k.isString(o)&&i.push("domain="+o),!0===n&&i.push("secure"),document.cookie=i.join("; ")},read:function(e){const t=document.cookie.match(new RegExp("(^|;\\s*)("+e+")=([^;]*)"));return t?decodeURIComponent(t[3]):null},remove:function(e){this.write(e,"",Date.now()-864e5)}}:{write:function(){},read:function(){return null},remove:function(){}};function fe(e,t){return e&&!/^([a-z][a-z\d+\-.]*:)?\/\//i.test(t)?function(e,t){return t?e.replace(/\/+$/,"")+"/"+t.replace(/^\/+/,""):e}(e,t):t}var me=Q.isStandardBrowserEnv?function(){const e=/(msie|trident)/i.test(navigator.userAgent),t=document.createElement("a");let r;function s(r){let s=r;return e&&(t.setAttribute("href",s),s=t.href),t.setAttribute("href",s),{href:t.href,protocol:t.protocol?t.protocol.replace(/:$/,""):"",host:t.host,search:t.search?t.search.replace(/^\?/,""):"",hash:t.hash?t.hash.replace(/^#/,""):"",hostname:t.hostname,port:t.port,pathname:"/"===t.pathname.charAt(0)?t.pathname:"/"+t.pathname}}return r=s(window.location.href),function(e){const t=k.isString(e)?s(e):e;return t.protocol===r.protocol&&t.host===r.host}}():function(){return!0};function ve(e,t){let r=0;const s=function(e,t){e=e||10;const r=new Array(e),s=new Array(e);let o,n=0,i=0;return t=void 0!==t?t:1e3,function(a){const c=Date.now(),l=s[i];o||(o=c),r[n]=a,s[n]=c;let u=i,d=0;for(;u!==n;)d+=r[u++],u%=e;if(n=(n+1)%e,n===i&&(i=(i+1)%e),c-o<t)return;const p=l&&c-l;return p?Math.round(1e3*d/p):void 0}}(50,250);return o=>{const n=o.loaded,i=o.lengthComputable?o.total:void 0,a=n-r,c=s(a);r=n;const l={loaded:n,total:i,progress:i?n/i:void 0,bytes:a,rate:c||void 0,estimated:c&&i&&n<=i?(i-n)/c:void 0,event:o};l[t?"download":"upload"]=!0,e(l)}}const ge={http:null,xhr:"undefined"!=typeof XMLHttpRequest&&function(e){return new Promise((function(t,r){let s=e.data;const o=le.from(e.headers).normalize(),n=e.responseType;let i,a;function c(){e.cancelToken&&e.cancelToken.unsubscribe(i),e.signal&&e.signal.removeEventListener("abort",i)}k.isFormData(s)&&(Q.isStandardBrowserEnv||Q.isStandardBrowserWebWorkerEnv?o.setContentType(!1):o.getContentType(/^\s*multipart\/form-data/)?k.isString(a=o.getContentType())&&o.setContentType(a.replace(/^\s*(multipart\/form-data);+/,"$1")):o.setContentType("multipart/form-data"));let l=new XMLHttpRequest;if(e.auth){const t=e.auth.username||"",r=e.auth.password?unescape(encodeURIComponent(e.auth.password)):"";o.set("Authorization","Basic "+btoa(t+":"+r))}const u=fe(e.baseURL,e.url);function d(){if(!l)return;const s=le.from("getAllResponseHeaders"in l&&l.getAllResponseHeaders());!function(e,t,r){const s=r.config.validateStatus;r.status&&s&&!s(r.status)?t(new x("Request failed with status code "+r.status,[x.ERR_BAD_REQUEST,x.ERR_BAD_RESPONSE][Math.floor(r.status/100)-4],r.config,r.request,r)):e(r)}((function(e){t(e),c()}),(function(e){r(e),c()}),{data:n&&"text"!==n&&"json"!==n?l.response:l.responseText,status:l.status,statusText:l.statusText,headers:s,config:e,request:l}),l=null}if(l.open(e.method.toUpperCase(),Y(u,e.params,e.paramsSerializer),!0),l.timeout=e.timeout,"onloadend"in l?l.onloadend=d:l.onreadystatechange=function(){l&&4===l.readyState&&(0!==l.status||l.responseURL&&0===l.responseURL.indexOf("file:"))&&setTimeout(d)},l.onabort=function(){l&&(r(new x("Request aborted",x.ECONNABORTED,e,l)),l=null)},l.onerror=function(){r(new x("Network Error",x.ERR_NETWORK,e,l)),l=null},l.ontimeout=function(){let t=e.timeout?"timeout of "+e.timeout+"ms exceeded":"timeout exceeded";const s=e.transitional||Z;e.timeoutErrorMessage&&(t=e.timeoutErrorMessage),r(new x(t,s.clarifyTimeoutError?x.ETIMEDOUT:x.ECONNABORTED,e,l)),l=null},Q.isStandardBrowserEnv){const t=(e.withCredentials||me(u))&&e.xsrfCookieName&&he.read(e.xsrfCookieName);t&&o.set(e.xsrfHeaderName,t)}void 0===s&&o.setContentType(null),"setRequestHeader"in l&&k.forEach(o.toJSON(),(function(e,t){l.setRequestHeader(t,e)})),k.isUndefined(e.withCredentials)||(l.withCredentials=!!e.withCredentials),n&&"json"!==n&&(l.responseType=e.responseType),"function"==typeof e.onDownloadProgress&&l.addEventListener("progress",ve(e.onDownloadProgress,!0)),"function"==typeof e.onUploadProgress&&l.upload&&l.upload.addEventListener("progress",ve(e.onUploadProgress)),(e.cancelToken||e.signal)&&(i=t=>{l&&(r(!t||t.type?new pe(null,e,l):t),l.abort(),l=null)},e.cancelToken&&e.cancelToken.subscribe(i),e.signal&&(e.signal.aborted?i():e.signal.addEventListener("abort",i)));const p=function(e){const t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}(u);p&&-1===Q.protocols.indexOf(p)?r(new x("Unsupported protocol "+p+":",x.ERR_BAD_REQUEST,e)):l.send(s||null)}))}};k.forEach(ge,((e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch(e){}Object.defineProperty(e,"adapterName",{value:t})}}));const ye=e=>`- ${e}`,Ee=e=>k.isFunction(e)||null===e||!1===e;var we=e=>{e=k.isArray(e)?e:[e];const{length:t}=e;let r,s;const o={};for(let n=0;n<t;n++){let t;if(r=e[n],s=r,!Ee(r)&&(s=ge[(t=String(r)).toLowerCase()],void 0===s))throw new x(`Unknown adapter '${t}'`);if(s)break;o[t||"#"+n]=s}if(!s){const e=Object.entries(o).map((([e,t])=>`adapter ${e} `+(!1===t?"is not supported by the environment":"is not available in the build")));throw new x("There is no suitable adapter to dispatch the request "+(t?e.length>1?"since :\n"+e.map(ye).join("\n"):" "+ye(e[0]):"as no adapter specified"),"ERR_NOT_SUPPORT")}return s};function Se(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new pe(null,e)}function be(e){return Se(e),e.headers=le.from(e.headers),e.data=ue.call(e,e.transformRequest),-1!==["post","put","patch"].indexOf(e.method)&&e.headers.setContentType("application/x-www-form-urlencoded",!1),we(e.adapter||re.adapter)(e).then((function(t){return Se(e),t.data=ue.call(e,e.transformResponse,t),t.headers=le.from(t.headers),t}),(function(t){return de(t)||(Se(e),t&&t.response&&(t.response.data=ue.call(e,e.transformResponse,t.response),t.response.headers=le.from(t.response.headers))),Promise.reject(t)}))}const Re=e=>e instanceof le?e.toJSON():e;function Oe(e,t){t=t||{};const r={};function s(e,t,r){return k.isPlainObject(e)&&k.isPlainObject(t)?k.merge.call({caseless:r},e,t):k.isPlainObject(t)?k.merge({},t):k.isArray(t)?t.slice():t}function o(e,t,r){return k.isUndefined(t)?k.isUndefined(e)?void 0:s(void 0,e,r):s(e,t,r)}function n(e,t){if(!k.isUndefined(t))return s(void 0,t)}function i(e,t){return k.isUndefined(t)?k.isUndefined(e)?void 0:s(void 0,e):s(void 0,t)}function a(r,o,n){return n in t?s(r,o):n in e?s(void 0,r):void 0}const c={url:n,method:n,data:n,baseURL:i,transformRequest:i,transformResponse:i,paramsSerializer:i,timeout:i,timeoutMessage:i,withCredentials:i,adapter:i,responseType:i,xsrfCookieName:i,xsrfHeaderName:i,onUploadProgress:i,onDownloadProgress:i,decompress:i,maxContentLength:i,maxBodyLength:i,beforeRedirect:i,transport:i,httpAgent:i,httpsAgent:i,cancelToken:i,socketPath:i,responseEncoding:i,validateStatus:a,headers:(e,t)=>o(Re(e),Re(t),!0)};return k.forEach(Object.keys(Object.assign({},e,t)),(function(s){const n=c[s]||o,i=n(e[s],t[s],s);k.isUndefined(i)&&n!==a||(r[s]=i)})),r}const Ce={};["object","boolean","number","function","string","symbol"].forEach(((e,t)=>{Ce[e]=function(r){return typeof r===e||"a"+(t<1?"n ":" ")+e}}));const Ae={};Ce.transitional=function(e,t,r){function s(e,t){return"[Axios v1.5.1] Transitional option '"+e+"'"+t+(r?". "+r:"")}return(r,o,n)=>{if(!1===e)throw new x(s(o," has been removed"+(t?" in "+t:"")),x.ERR_DEPRECATED);return t&&!Ae[o]&&(Ae[o]=!0,console.warn(s(o," has been deprecated since v"+t+" and will be removed in the near future"))),!e||e(r,o,n)}};var De={assertOptions:function(e,t,r){if("object"!=typeof e)throw new x("options must be an object",x.ERR_BAD_OPTION_VALUE);const s=Object.keys(e);let o=s.length;for(;o-- >0;){const n=s[o],i=t[n];if(i){const t=e[n],r=void 0===t||i(t,n,e);if(!0!==r)throw new x("option "+n+" must be "+r,x.ERR_BAD_OPTION_VALUE)}else if(!0!==r)throw new x("Unknown option "+n,x.ERR_BAD_OPTION)}},validators:Ce};const _e=De.validators;class Te{constructor(e){this.defaults=e,this.interceptors={request:new X,response:new X}}request(e,t){"string"==typeof e?(t=t||{}).url=e:t=e||{},t=Oe(this.defaults,t);const{transitional:r,paramsSerializer:s,headers:o}=t;void 0!==r&&De.assertOptions(r,{silentJSONParsing:_e.transitional(_e.boolean),forcedJSONParsing:_e.transitional(_e.boolean),clarifyTimeoutError:_e.transitional(_e.boolean)},!1),null!=s&&(k.isFunction(s)?t.paramsSerializer={serialize:s}:De.assertOptions(s,{encode:_e.function,serialize:_e.function},!0)),t.method=(t.method||this.defaults.method||"get").toLowerCase();let n=o&&k.merge(o.common,o[t.method]);o&&k.forEach(["delete","get","head","post","put","patch","common"],(e=>{delete o[e]})),t.headers=le.concat(n,o);const i=[];let a=!0;this.interceptors.request.forEach((function(e){"function"==typeof e.runWhen&&!1===e.runWhen(t)||(a=a&&e.synchronous,i.unshift(e.fulfilled,e.rejected))}));const c=[];let l;this.interceptors.response.forEach((function(e){c.push(e.fulfilled,e.rejected)}));let u,d=0;if(!a){const e=[be.bind(this),void 0];for(e.unshift.apply(e,i),e.push.apply(e,c),u=e.length,l=Promise.resolve(t);d<u;)l=l.then(e[d++],e[d++]);return l}u=i.length;let p=t;for(d=0;d<u;){const e=i[d++],t=i[d++];try{p=e(p)}catch(e){t.call(this,e);break}}try{l=be.call(this,p)}catch(e){return Promise.reject(e)}for(d=0,u=c.length;d<u;)l=l.then(c[d++],c[d++]);return l}getUri(e){return Y(fe((e=Oe(this.defaults,e)).baseURL,e.url),e.params,e.paramsSerializer)}}k.forEach(["delete","get","head","options"],(function(e){Te.prototype[e]=function(t,r){return this.request(Oe(r||{},{method:e,url:t,data:(r||{}).data}))}})),k.forEach(["post","put","patch"],(function(e){function t(t){return function(r,s,o){return this.request(Oe(o||{},{method:e,headers:t?{"Content-Type":"multipart/form-data"}:{},url:r,data:s}))}}Te.prototype[e]=t(),Te.prototype[e+"Form"]=t(!0)}));var Fe=Te;class Ie{constructor(e){if("function"!=typeof e)throw new TypeError("executor must be a function.");let t;this.promise=new Promise((function(e){t=e}));const r=this;this.promise.then((e=>{if(!r._listeners)return;let t=r._listeners.length;for(;t-- >0;)r._listeners[t](e);r._listeners=null})),this.promise.then=e=>{let t;const s=new Promise((e=>{r.subscribe(e),t=e})).then(e);return s.cancel=function(){r.unsubscribe(t)},s},e((function(e,s,o){r.reason||(r.reason=new pe(e,s,o),t(r.reason))}))}throwIfRequested(){if(this.reason)throw this.reason}subscribe(e){this.reason?e(this.reason):this._listeners?this._listeners.push(e):this._listeners=[e]}unsubscribe(e){if(!this._listeners)return;const t=this._listeners.indexOf(e);-1!==t&&this._listeners.splice(t,1)}static source(){let e;return{token:new Ie((function(t){e=t})),cancel:e}}}var Ne=Ie;const Pe={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(Pe).forEach((([e,t])=>{Pe[t]=e}));var Le=Pe;const je=function e(t){const r=new Fe(t),o=s(Fe.prototype.request,r);return k.extend(o,Fe.prototype,r,{allOwnKeys:!0}),k.extend(o,r,null,{allOwnKeys:!0}),o.create=function(r){return e(Oe(t,r))},o}(re);je.Axios=Fe,je.CanceledError=pe,je.CancelToken=Ne,je.isCancel=de,je.VERSION="1.5.1",je.toFormData=V,je.AxiosError=x,je.Cancel=je.CanceledError,je.all=function(e){return Promise.all(e)},je.spread=function(e){return function(t){return e.apply(null,t)}},je.isAxiosError=function(e){return k.isObject(e)&&!0===e.isAxiosError},je.mergeConfig=Oe,je.AxiosHeaders=le,je.formToJSON=e=>ee(k.isHTMLForm(e)?new FormData(e):e),je.getAdapter=we,je.HttpStatusCode=Le,je.default=je,e.exports=je}},t={};function r(s){var o=t[s];if(void 0!==o)return o.exports;var n=t[s]={exports:{}};return e[s].call(n.exports,n,n.exports,r),n.exports}r.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}();var s={};return(()=>{"use strict";var e=s;const t=r(234),o=r(604),n=r(122),i=r(344),a=r(927),c=r(168);class l{}l.livenessDetection=t.livenessDetection,l.uploadIdentificationDocument=o.uploadIdentificationDocument,l.insertUploadIdentificationDocument=n.insertUploadIdentificationDocument,l.typification=i.typification,l.ocr=c.ocr,l.faceMatch=a.faceMatch,e.default=l})(),s.default})()));
@@ -0,0 +1,23 @@
1
+ import { type IFrameControls, type IStartGettingFramesOptions } from '../../liveness/utils/getNextFrame';
2
+ import { type ApiAsyncService } from '../../../api/ApiAsyncService';
3
+ import { type TCoreServiceOptions, type ICoreServiceResult } from '../utils/types';
4
+ export declare abstract class BaseCoreService<TFrameType, TMediaType, TResultsContentType> {
5
+ frameGetControls: IFrameControls<TFrameType, TMediaType>;
6
+ options: TCoreServiceOptions<TMediaType, TResultsContentType>;
7
+ results: ICoreServiceResult<TResultsContentType>;
8
+ service: ApiAsyncService;
9
+ cameraIsActive: boolean;
10
+ cameraIsSetup: boolean;
11
+ constructor(options: TCoreServiceOptions<TMediaType, TResultsContentType>);
12
+ initialize(file?: TFrameType): Promise<void>;
13
+ abstract startProcessing(file: TFrameType): Promise<void>;
14
+ updateResults(updatedResults: Partial<ICoreServiceResult<TResultsContentType>>): Promise<void>;
15
+ getVideoStream(): TMediaType | undefined;
16
+ setupCamera(): Promise<void>;
17
+ startCamera(cameraOptions?: IStartGettingFramesOptions): Promise<void>;
18
+ stopCamera(): Promise<void>;
19
+ captureImage({ startProcessing }?: {
20
+ startProcessing?: boolean | undefined;
21
+ }): Promise<NonNullable<Awaited<TFrameType>>>;
22
+ waitForResults(requestId: string): Promise<TResultsContentType>;
23
+ }