@regulaforensics/idv-capture-web 3.1.228-rc → 3.1.231
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +113 -135
- package/dist/main.iife.js +1 -1
- package/dist/main.js +4 -4
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,32 +1,28 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Welcome to IDV Platform Web Components documentation!
|
|
2
2
|
|
|
3
3
|
- [Overview](#overview)
|
|
4
|
-
- [Before
|
|
4
|
+
- [Before You Start](#before-you-start)
|
|
5
5
|
- [Compatibility](#compatibility)
|
|
6
6
|
- [Install via NPM](#install-via-npm)
|
|
7
7
|
- [Install via CDN](#install-via-cdn)
|
|
8
8
|
- [Setup](#setup)
|
|
9
9
|
- [Events](#events)
|
|
10
|
-
- [
|
|
11
|
-
- [Getters](#getters)
|
|
10
|
+
- [Configuration](#configuration)
|
|
12
11
|
- [Methods](#methods)
|
|
12
|
+
- [Examples](#examples)
|
|
13
13
|
|
|
14
14
|
---
|
|
15
15
|
|
|
16
16
|
## Overview
|
|
17
17
|
|
|
18
|
-
The available component is
|
|
18
|
+
The available component is `<idv-flow>`.
|
|
19
19
|
|
|
20
|
-
|
|
20
|
+
The component is based on WebAssembly (compiled from our core C++ code and wrapped with JavaScript). The same code is used across all SDK packages, ensuring consistency between platforms.
|
|
21
21
|
|
|
22
|
-
|
|
22
|
+
## Before You Start
|
|
23
23
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
Please note that:
|
|
27
|
-
|
|
28
|
-
- The components work **only** under the HTTPS protocol on the website.
|
|
29
|
-
- The components library does register the components on the web page itself, so make sure to import the library to your web site before adding the components to the web page code.
|
|
24
|
+
- Components **require HTTPS** — they will not work over plain HTTP.
|
|
25
|
+
- The library automatically registers web components. Import it before adding the components to your HTML.
|
|
30
26
|
|
|
31
27
|
## Compatibility
|
|
32
28
|
|
|
@@ -38,32 +34,27 @@ Please note that:
|
|
|
38
34
|
|
|
39
35
|
## Install via NPM
|
|
40
36
|
|
|
41
|
-
|
|
37
|
+
If you are starting a new project, initialize it:
|
|
42
38
|
|
|
43
39
|
```
|
|
44
40
|
cd /path/to/project
|
|
45
|
-
```
|
|
46
|
-
|
|
47
|
-
Run the following command:
|
|
48
|
-
|
|
49
|
-
```
|
|
50
41
|
npm init
|
|
51
42
|
```
|
|
52
43
|
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
Install idv-capture-web:
|
|
44
|
+
Install the main package:
|
|
56
45
|
|
|
57
46
|
```
|
|
58
47
|
npm i @regulaforensics/idv-capture-web
|
|
48
|
+
```
|
|
59
49
|
|
|
60
|
-
|
|
50
|
+
Optionally, install additional modules:
|
|
61
51
|
|
|
52
|
+
```
|
|
62
53
|
npm i @regulaforensics/idv-face
|
|
63
54
|
npm i @regulaforensics/idv-document
|
|
64
55
|
```
|
|
65
56
|
|
|
66
|
-
Create `index.html` and `index.js` files in the root directory of the project.
|
|
57
|
+
Create `index.html` and `index.js` files in the root directory of the project.
|
|
67
58
|
|
|
68
59
|
Import `@regulaforensics/idv-capture-web` into your `index.js`:
|
|
69
60
|
|
|
@@ -71,11 +62,7 @@ Import `@regulaforensics/idv-capture-web` into your `index.js`:
|
|
|
71
62
|
import './node_modules/@regulaforensics/idv-capture-web/dist/main.js';
|
|
72
63
|
```
|
|
73
64
|
|
|
74
|
-
In `index.html
|
|
75
|
-
|
|
76
|
-
`<idv-flow></idv-flow>`
|
|
77
|
-
|
|
78
|
-
For example:
|
|
65
|
+
In `index.html`, add the component and load `index.js`:
|
|
79
66
|
|
|
80
67
|
```html
|
|
81
68
|
<!DOCTYPE html>
|
|
@@ -91,169 +78,160 @@ For example:
|
|
|
91
78
|
</html>
|
|
92
79
|
```
|
|
93
80
|
|
|
94
|
-
|
|
81
|
+
Here is an <a href="https://github.com/regulaforensics/idv-capture-web-samples/blob/main/webpack/index.js" target="_blank">example of index.js file</a>.
|
|
95
82
|
|
|
96
|
-
|
|
83
|
+
## Install via CDN
|
|
97
84
|
|
|
98
|
-
|
|
85
|
+
Use a CDN if you don’t have a build process (for example, a plain HTML/JS project). Add the following `script` tags to your `.html` file. The CDN link format is `unpkg.com/:package@:version/:file`:
|
|
99
86
|
|
|
100
87
|
```html
|
|
101
88
|
<script src="https://unpkg.com/@regulaforensics/idv-capture-web@latest/dist/main.iife.js"></script>
|
|
102
89
|
|
|
103
90
|
<script src="https://unpkg.com/@regulaforensics/idv-face@latest/dist/main.iife.js"></script>
|
|
104
91
|
<script src="https://unpkg.com/@regulaforensics/idv-document@latest/dist/main.iife.js"></script>
|
|
105
|
-
|
|
106
92
|
```
|
|
107
93
|
|
|
108
|
-
Add the component tag to your HTML, as shown in the example above.
|
|
109
|
-
|
|
110
94
|
## Setup
|
|
111
95
|
|
|
112
|
-
|
|
96
|
+
The setup process involves four steps: **Initialize → Configure → Prepare → Start**.
|
|
113
97
|
|
|
114
|
-
|
|
98
|
+
### Initialize
|
|
115
99
|
|
|
116
100
|
```javascript
|
|
117
|
-
/** import necessary service */
|
|
118
101
|
import { IdvIntegrationService } from '@regulaforensics/idv-capture-web';
|
|
119
|
-
|
|
120
|
-
import {
|
|
121
|
-
import { DocumentIdv } from "@regulaforensics/idv-document";
|
|
102
|
+
import { FaceIdv } from '@regulaforensics/idv-face';
|
|
103
|
+
import { DocumentIdv } from '@regulaforensics/idv-document';
|
|
122
104
|
|
|
123
|
-
|
|
124
|
-
/** create service */
|
|
125
105
|
const service = new IdvIntegrationService();
|
|
126
106
|
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
console.log(event);
|
|
130
|
-
};
|
|
107
|
+
// Event listener
|
|
108
|
+
service.eventListener = (event) => console.log(event);
|
|
131
109
|
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
includedModules: [FaceIdv, DocumentIdv],
|
|
142
|
-
});
|
|
143
|
-
/** if something goes wrong, the command error will contain an error field. */
|
|
144
|
-
if (initResult.error) {
|
|
145
|
-
console.log(initResult.error);
|
|
146
|
-
return;
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
const configureResult = await service.configure({
|
|
150
|
-
baseUrl: 'https://your.host.com',
|
|
151
|
-
userName: '',
|
|
152
|
-
password: '',
|
|
153
|
-
});
|
|
154
|
-
|
|
155
|
-
if (configureResult.error) {
|
|
156
|
-
console.log(configureResult.error);
|
|
157
|
-
return;
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
const prepareResult = await service.prepareWorkflow({
|
|
161
|
-
workflowId: 'your_workflow_id',
|
|
162
|
-
});
|
|
163
|
-
|
|
164
|
-
if (prepareResult.error) {
|
|
165
|
-
console.log(prepareResult.error);
|
|
166
|
-
return;
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
const metadata = { anyMetadata: 'Any Metadata' };
|
|
170
|
-
const locale = 'en-us'; // 'en-us' for example. Should be the language of your workflow
|
|
171
|
-
const startWorkflowResult = await service?.startWorkflow({ locale: locale, metadata: metadata });
|
|
172
|
-
|
|
173
|
-
if (startWorkflowResult.error) {
|
|
174
|
-
console.log(startWorkflowResult.error);
|
|
175
|
-
return;
|
|
176
|
-
}
|
|
177
|
-
|
|
178
|
-
console.log('WORKFLOW FINISHED :', startWorkflowResult);
|
|
179
|
-
})();
|
|
110
|
+
// Initialize modules
|
|
111
|
+
const initResult = await service.initialize({
|
|
112
|
+
modulesConfig: { docreader: { devLicense: 'yourBase64license' } }, // For development use only. Do not use it in production.
|
|
113
|
+
includedModules: [FaceIdv, DocumentIdv],
|
|
114
|
+
});
|
|
115
|
+
|
|
116
|
+
if (initResult.error) {
|
|
117
|
+
console.error(initResult.error);
|
|
118
|
+
}
|
|
180
119
|
```
|
|
181
120
|
|
|
182
|
-
|
|
121
|
+
### Configure
|
|
122
|
+
|
|
123
|
+
Use credentials, API key, or token URL.
|
|
183
124
|
|
|
184
|
-
|
|
125
|
+
**With username/password**
|
|
185
126
|
|
|
186
127
|
```javascript
|
|
187
128
|
const configureResult = await service.configure({
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
129
|
+
baseUrl: 'https://your.host.com',
|
|
130
|
+
userName: '',
|
|
131
|
+
password: '',
|
|
191
132
|
});
|
|
192
133
|
```
|
|
193
134
|
|
|
194
|
-
|
|
135
|
+
**With API key**
|
|
195
136
|
|
|
196
137
|
```javascript
|
|
197
138
|
const configureResult = await service.configure({
|
|
198
|
-
|
|
139
|
+
baseUrl: 'https://your.host.com',
|
|
140
|
+
apiKey: 'yourApiKey',
|
|
141
|
+
ttl: 86400, // Optional. Default is 86400 seconds (24h). You can set a custom TTL in seconds.
|
|
199
142
|
});
|
|
200
143
|
```
|
|
201
144
|
|
|
202
|
-
|
|
145
|
+
**With token URL**
|
|
203
146
|
|
|
204
|
-
|
|
147
|
+
```javascript
|
|
148
|
+
const configureResult = await service.configure({
|
|
149
|
+
url: 'your-token-url',
|
|
150
|
+
});
|
|
151
|
+
```
|
|
205
152
|
|
|
206
|
-
|
|
153
|
+
### Prepare Workflow
|
|
207
154
|
|
|
208
155
|
```javascript
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
};
|
|
156
|
+
const prepareResult = await service.prepareWorkflow({
|
|
157
|
+
workflowId: 'your_workflow_id',
|
|
158
|
+
});
|
|
213
159
|
|
|
214
|
-
|
|
215
|
-
|
|
160
|
+
// Error handling
|
|
161
|
+
if (prepareResult.error) {
|
|
162
|
+
console.error(prepareResult.error);
|
|
163
|
+
}
|
|
216
164
|
```
|
|
217
165
|
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
`nonce` - set CSP nonce id to the style tag
|
|
166
|
+
### Start Workflow
|
|
221
167
|
|
|
222
168
|
```javascript
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
169
|
+
const metadata = { anyMetadata: 'Any Metadata' };
|
|
170
|
+
const locale = 'en-us';
|
|
171
|
+
|
|
172
|
+
const startWorkflowResult = await service.startWorkflow({
|
|
173
|
+
locale,
|
|
174
|
+
metadata,
|
|
175
|
+
});
|
|
226
176
|
|
|
227
|
-
|
|
177
|
+
// Error handling
|
|
178
|
+
if (startWorkflowResult.error) {
|
|
179
|
+
console.error(startWorkflowResult.error);
|
|
180
|
+
}
|
|
228
181
|
|
|
229
|
-
|
|
230
|
-
const service = new IdvIntegrationService();
|
|
231
|
-
service.sessionRestoreMode = true;
|
|
182
|
+
console.log('WORKFLOW FINISHED:', startWorkflowResult);
|
|
232
183
|
```
|
|
233
184
|
|
|
234
|
-
##
|
|
185
|
+
## Events
|
|
186
|
+
|
|
187
|
+
You can subscribe to service events such as status updates, errors, and workflow progress by assigning a listener:
|
|
235
188
|
|
|
236
|
-
`version` - returns the version of the component
|
|
237
189
|
```javascript
|
|
238
|
-
|
|
239
|
-
|
|
190
|
+
const service = new IdvIntegrationService();
|
|
191
|
+
|
|
192
|
+
// Define your listener
|
|
193
|
+
service.eventListener = (event) => {
|
|
194
|
+
console.log('Event received:', event);
|
|
195
|
+
};
|
|
240
196
|
```
|
|
241
197
|
|
|
242
|
-
##
|
|
198
|
+
## Configuration
|
|
199
|
+
|
|
200
|
+
### Setters
|
|
243
201
|
|
|
244
|
-
|
|
202
|
+
| Setter | Description |
|
|
203
|
+
| -------------------- | --------------------------------------- |
|
|
204
|
+
| `nonce` | Sets a CSP nonce for `<style>` tags. |
|
|
205
|
+
| `sessionRestoreMode` | Restores a session if the page reloads. `false` by default.|
|
|
206
|
+
|
|
207
|
+
```javascript
|
|
208
|
+
const service = new IdvIntegrationService();
|
|
209
|
+
service.nonce = 'nonceId';
|
|
210
|
+
service.sessionRestoreMode = true;
|
|
211
|
+
```
|
|
245
212
|
|
|
246
|
-
|
|
213
|
+
### Getters
|
|
247
214
|
|
|
215
|
+
| Getter | Description |
|
|
216
|
+
| -------------------- | --------------------------------------- |
|
|
217
|
+
| `version` | Returns the version of the component. |
|
|
248
218
|
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
219
|
+
```javascript
|
|
220
|
+
const service = new IdvIntegrationService();
|
|
221
|
+
console.log(service.version);
|
|
222
|
+
```
|
|
252
223
|
|
|
253
|
-
|
|
224
|
+
## Methods
|
|
254
225
|
|
|
255
|
-
|
|
226
|
+
| Method | Description | Type | Notes |
|
|
227
|
+
| --------------------------------- | ------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ----------------------------------------------------------------------------------- |
|
|
228
|
+
| `initialize(config: InitConfig)` | Initializes the service. Returns error if initialization fails. | `async initialize(config: InitConfig): Promise<{ error?: BaseInitializationError }>` | Call this first before any other method. |
|
|
229
|
+
| `configure(config)` | Configures the service with credentials, API key, or token. | `async configure(config: CredentialConnectionConfig \| TokenConnectionConfig \| ApiKeyConnectionConfig): Promise<ConfigureCompletion \| TokenConfigureCompletion>` | Required before preparing a workflow.
|
|
230
|
+
| `getWorkFlows(params?)` | Returns a list of available workflows. | `async getWorkFlows(params?: WorkflowListRequest): Promise<WorkflowListCompletion>` | Useful for dynamically displaying workflows to users. |
|
|
231
|
+
| `prepareWorkflow({ workflowId })` | Prepares the service for the given workflow. Checks module and step compatibility. | `async prepareWorkflow({ workflowId }: { workflowId: string }): Promise<PrepareWorkflowCompletion>` | Must be called after configure. Validates workflow and modules. |
|
|
232
|
+
| `startWorkflow(config?)` | Starts the workflow. Show the web component before running and remove it after completion. | `async startWorkflow(config?: StartWorkflowConfig): Promise<WorkflowCompletion>` | Display the component before calling. Pass locale/metadata if needed. |
|
|
233
|
+
| `deinitialize()` | Deinitializes the service. Run `initialize` again to restart. Recommended after completing work. | `async deinitialize(): Promise<DeinitializeCompletion>` | Clean up resources after finishing a workflow. Use `initialize` to start again. |
|
|
256
234
|
|
|
257
|
-
|
|
235
|
+
## Examples
|
|
258
236
|
|
|
259
|
-
|
|
237
|
+
You can find examples of using the components on the <a href="https://github.com/regulaforensics/idv-capture-web-samples/" target="_blank">Samples page</a>.
|
package/dist/main.iife.js
CHANGED
|
@@ -80,4 +80,4 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
80
80
|
`,this.shadowRoot.querySelector("#idv-gui-styles")||this.shadowRoot.appendChild(o)}this._root.render(P.jsx(NP,{moduleProps:this.props.moduleProps,perform:this.props.perform,idvEventListener:this.props.idvEventListener}))}},{key:"disconnectedCallback",value:function(){var o=this;setTimeout(function(){o._mounted&&(o._mounted=!1)})}}],[{key:"isReady",value:function(){return Jy}},{key:"initialize",value:function(o){Jy=!0}},{key:"deinitialize",value:function(){Jy=!1}}])}(m6);ga(as,"displayName",bl),ga(as,"getSupportedTemplates",function(){return Object.values(fi)}),ga(as,"getIdentifier",function(){return bl}),g6(bl,as);function us(r){"@babel/helpers - typeof";return us=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},us(r)}function DO(r){return MP(r)||FP(r)||LP(r)||DP()}function DP(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
|
|
81
81
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function LP(r,e){if(r){if(typeof r=="string")return eh(r,e);var n={}.toString.call(r).slice(8,-1);return n==="Object"&&r.constructor&&(n=r.constructor.name),n==="Map"||n==="Set"?Array.from(r):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?eh(r,e):void 0}}function FP(r){if(typeof Symbol!="undefined"&&r[Symbol.iterator]!=null||r["@@iterator"]!=null)return Array.from(r)}function MP(r){if(Array.isArray(r))return eh(r)}function eh(r,e){(e==null||e>r.length)&&(e=r.length);for(var n=0,o=Array(e);n<e;n++)o[n]=r[n];return o}function LO(r,e){var n=Object.keys(r);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(r);e&&(o=o.filter(function(a){return Object.getOwnPropertyDescriptor(r,a).enumerable})),n.push.apply(n,o)}return n}function UP(r){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?LO(Object(n),!0).forEach(function(o){qP(r,o,n[o])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(n)):LO(Object(n)).forEach(function(o){Object.defineProperty(r,o,Object.getOwnPropertyDescriptor(n,o))})}return r}function qP(r,e,n){return(e=$P(e))in r?Object.defineProperty(r,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):r[e]=n,r}function $P(r){var e=BP(r,"string");return us(e)=="symbol"?e:e+""}function BP(r,e){if(us(r)!="object"||!r)return r;var n=r[Symbol.toPrimitive];if(n!==void 0){var o=n.call(r,e);if(us(o)!="object")return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}function Hr(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */var r,e,n=typeof Symbol=="function"?Symbol:{},o=n.iterator||"@@iterator",a=n.toStringTag||"@@toStringTag";function s(S,b,w,_){var j=b&&b.prototype instanceof c?b:c,O=Object.create(j.prototype);return gn(O,"_invoke",function(k,T,x){var I,E,R,W=0,Z=x||[],$=!1,N={p:0,n:0,v:r,a:Q,f:Q.bind(r,4),d:function(A,B){return I=A,E=0,R=r,N.n=B,l}};function Q(D,A){for(E=D,R=A,e=0;!$&&W&&!B&&e<Z.length;e++){var B,U=Z[e],G=N.p,z=U[2];D>3?(B=z===A)&&(R=U[(E=U[4])?5:(E=3,3)],U[4]=U[5]=r):U[0]<=G&&((B=D<2&&G<U[1])?(E=0,N.v=A,N.n=U[1]):G<z&&(B=D<3||U[0]>A||A>z)&&(U[4]=D,U[5]=A,N.n=z,E=0))}if(B||D>1)return l;throw $=!0,A}return function(D,A,B){if(W>1)throw TypeError("Generator is already running");for($&&A===1&&Q(A,B),E=A,R=B;(e=E<2?r:R)||!$;){I||(E?E<3?(E>1&&(N.n=-1),Q(E,R)):N.n=R:N.v=R);try{if(W=2,I){if(E||(D="next"),e=I[D]){if(!(e=e.call(I,R)))throw TypeError("iterator result is not an object");if(!e.done)return e;R=e.value,E<2&&(E=0)}else E===1&&(e=I.return)&&e.call(I),E<2&&(R=TypeError("The iterator does not provide a '"+D+"' method"),E=1);I=r}else if((e=($=N.n<0)?R:k.call(T,N))!==l)break}catch(U){I=r,E=1,R=U}finally{W=1}}return{value:e,done:$}}}(S,w,_),!0),O}var l={};function c(){}function d(){}function v(){}e=Object.getPrototypeOf;var y=[][o]?e(e([][o]())):(gn(e={},o,function(){return this}),e),h=v.prototype=c.prototype=Object.create(y);function m(S){return Object.setPrototypeOf?Object.setPrototypeOf(S,v):(S.__proto__=v,gn(S,a,"GeneratorFunction")),S.prototype=Object.create(h),S}return d.prototype=v,gn(h,"constructor",v),gn(v,"constructor",d),d.displayName="GeneratorFunction",gn(v,a,"GeneratorFunction"),gn(h),gn(h,a,"Generator"),gn(h,o,function(){return this}),gn(h,"toString",function(){return"[object Generator]"}),(Hr=function(){return{w:s,m}})()}function gn(r,e,n,o){var a=Object.defineProperty;try{a({},"",{})}catch(s){a=0}gn=function(l,c,d,v){function y(h,m){gn(l,h,function(S){return this._invoke(h,m,S)})}c?a?a(l,c,{value:d,enumerable:!v,configurable:!v,writable:!v}):l[c]=d:(y("next",0),y("throw",1),y("return",2))},gn(r,e,n,o)}function FO(r,e,n,o,a,s,l){try{var c=r[s](l),d=c.value}catch(v){return void n(v)}c.done?e(d):Promise.resolve(d).then(o,a)}function An(r){return function(){var e=this,n=arguments;return new Promise(function(o,a){var s=r.apply(e,n);function l(d){FO(s,o,a,l,c,"next",d)}function c(d){FO(s,o,a,l,c,"throw",d)}l(void 0)})}}var VP=function(e,n){return{_isInitialized:!1,_initializationInProgress:!1,_isConnectedToPlatform:!1,_sessionIdFromUrl:null,_ttl:86400,_prepareDataForWorkflow:function(a){n().setWorkflowId(a.workflow.id),n().setWorkflow(a.workflow),n().setLayout(a.workflow.client.layout),n().setProcessingTemplate(a.workflow.client.steps),n().setSessionProperties(a.properties)},_checkAndSetApiTokenToLs:function(a){var s=n().startConfig;if("apiKey"in s&&s.apiKey){var l=n().workflowId,c=n().apiKeyAuthTokenCollection;"authToken"in c&&"apiKey"in c&&oa.setAuthTokenToLs(c.authToken,c.apiKey,a,l,c.tokenExpiredIn)}},_runWasmService:function(){var o=An(Hr().m(function s(){var l,c,d,v;return Hr().w(function(y){for(;;)switch(y.n){case 0:return l=function(){var h=An(Hr().m(function m(){var S,b;return Hr().w(function(w){for(;;)switch(w.n){case 0:return b=(S=n().wasmService)===null||S===void 0?void 0:S.isServiceRunning(),w.a(2,b||null)}},m)}));return function(){return h.apply(this,arguments)}}(),c=function(){return null},y.n=1,s_(l,c);case 1:if(d=y.v,d){y.n=2;break}return v=new xt({errorCode:Pt.INTERNAL_ISSUE,message:"Wasm service is not running"}),y.a(2,{error:v});case 2:return y.a(2,{});case 3:return y.a(2)}},s)}));function a(){return o.apply(this,arguments)}return a}(),_checkIsSessionDataValid:function(a){if("httpCode"in a){var s="what"in a&&typeof a.what=="string"&&a.what.length?a.what:null,l=new Yi(UP({errorCode:Ki.HTTP_ISSUE},s?{message:s}:{})),c=new xt({errorCode:Pt.START_SESSION_FAILED,underlyingBaseError:l});return{error:c}}if("id"in a&&"currentStep"in a)return a;var d=new Yi({errorCode:Ki.DECODING_FAILED}),v=new xt({errorCode:Pt.START_SESSION_FAILED,underlyingBaseError:d});return{error:v}},_runSocketConnection:function(){var o=An(Hr().m(function s(l){var c,d,v,y,h;return Hr().w(function(m){for(;;)switch(m.n){case 0:if(c=n().startConfig,d=c.host,v=c.isSecure,!(d&&l)){m.n=1;break}return m.n=1,Eo.connect({host:d,isSecure:v,token:l});case 1:if(!(!d||!l||!Eo.isConnected())){m.n=2;break}return y=new Yi({errorCode:Ki.CONNECTION_ISSUE,message:"WebSocket connection issue"}),h=new xt({errorCode:Pt.START_SESSION_FAILED,underlyingBaseError:y}),m.a(2,{error:h});case 2:return m.a(2,{})}},s)}));function a(s){return o.apply(this,arguments)}return a}(),_continueSession:function(){var o=An(Hr().m(function s(l,c){var d,v,y,h,m,S,b,w,_,j,O,k,T,x,I;return Hr().w(function(E){for(;;)switch(E.n){case 0:if(d=n().startConfig,v="apiKey"in d&&typeof d.apiKey=="string",y=n().workflowId,h=c?ta.DID_CONTINUE_REMOTE_SESSION:ta.DID_START_RESTORE_SESSION,!c){E.n=1;break}m=c,E.n=8;break;case 1:if(!v){E.n=4;break}if(n().sessionRestoreMode){E.n=2;break}return E.a(2,{});case 2:if(b=d.apiKey,w=oa.getAuthTokenLs(),_=w&&((S=w[b])===null||S===void 0?void 0:S.sessionId),_){E.n=3;break}return E.a(2,{});case 3:_&&(m=_),E.n=8;break;case 4:if(n().sessionRestoreMode){E.n=5;break}return E.a(2,{});case 5:if(j=n().getCurrentSessionDataLs(),j){E.n=6;break}return E.a(2,{});case 6:if(O=j.sessionId,k=j.workflowId,!(!O||k!==y)){E.n=7;break}return E.a(2,{});case 7:m=O;case 8:return E.n=9,n().wasmService.continueSession(m,l);case 9:if(T=E.v,x=n()._checkIsSessionDataValid(T.data),l_(x)){E.n=10;break}return E.a(2,{error:x.error});case 10:return n()._prepareDataForWorkflow(x),I=x.currentStep,n().setCurrentStepId(I),v?n()._checkAndSetApiTokenToLs(x.id):n().setCurrentSessionDataLsAndStore({sessionId:x.id,workflowId:y}),n().setNextStep(x.workflow,x.properties,I),n().listener({eventType:bu.MESSAGE,message:h,module:"IDV"}),E.a(2,x)}},s)}));function a(s,l){return o.apply(this,arguments)}return a}(),initialize:function(a){return An(Hr().m(function s(){var l,c,d;return Hr().w(function(v){for(;;)switch(v.n){case 0:if(!n()._isInitialized){v.n=1;break}return console.warn("Idv:: Already initialized"),v.a(2,{});case 1:if(!n()._initializationInProgress){v.n=2;break}return v.a(2,new Du({errorCode:wu.INITIALIZATION_IN_PROGRESS}));case 2:return e({_initializationInProgress:!0}),v.n=3,n().setAndInitWasmService();case 3:return e({modulesConfig:a.modulesConfig||{}}),l=[as],Array.isArray(a==null?void 0:a.includedModules)&&(c=a.includedModules.filter(function(y){return typeof y=="function"&&y.displayName&&!l.some(function(h){return h.displayName===y.displayName})}),l=[].concat(DO(l),DO(c))),v.n=4,n().loadModules(l);case 4:if(d=v.v,!d.error){v.n=5;break}return v.a(2,{error:d.error});case 5:return e({_initializationInProgress:!1,_isInitialized:!0}),v.a(2,{})}},s)}))()},configureByApiKey:function(a){return An(Hr().m(function s(){var l,c,d,v,y,h,m,S,b,w,_,j;return Hr().w(function(O){for(;;)switch(O.n){case 0:if(n()._isInitialized){O.n=1;break}return O.a(2,{error:new kt({errorCode:Ft.INITIALIZATION_REQUIRED})});case 1:if(!n().currentScreenConfig){O.n=2;break}return O.a(2,{error:new kt({errorCode:Ft.SCENARIO_IN_PROGRESS})});case 2:if(l=["apiKey","baseUrl"],c=l.filter(function(k){return!(a!=null&&a[k])}),!(c.length>0)){O.n=3;break}return O.a(2,{error:new kt({errorCode:Ft.CONFIG_MISSED_OR_INVALID,message:"Missing parameters: ".concat(c.join(", "))})});case 3:if(d=c_(a.baseUrl),d){O.n=4;break}return O.a(2,{error:new kt({errorCode:Ft.CONFIG_MISSED_OR_INVALID,message:"Invalid URL: ".concat(a.baseUrl)})});case 4:return typeof a.ttl=="number"&&!Number.isNaN(a.ttl)&&e({_ttl:a.ttl}),v=n()._ttl,y={host:d.host,isSecure:d.isSecure,port:d.port,apiKey:a.apiKey,deviceDescriptor:{ttl:v}},h=oa.getAuthTokenLs(),m=h&&h[a.apiKey]&&h[a.apiKey].authToken?h[a.apiKey]:null,S=m&&m.authToken,S&&(y.authToken=S),O.n=5,n().connectByApiKey(y);case 5:if(b=O.v,!b.error){O.n=6;break}return w=new kt({errorCode:Ft.CONNECTION_ISSUE,underlyingBaseError:b.error}),O.a(2,{error:w});case 6:return S&&b.authToken!==S&&oa.removeAuthTokenLs(a.apiKey),_=m&&b.authToken===m.authToken&&m,j=_?_.tokenExpiredIn:Date.now()+v*1e3,n().setApiKeyAuthTokenCollection(a.apiKey,b.authToken,j),e({_isConnectedToPlatform:!0}),n().setStartConfig({host:d.host,isSecure:d.isSecure,apiKey:a.apiKey}),O.a(2,b)}},s)}))()},configureWithUrl:function(a){return An(Hr().m(function s(){var l,c,d,v,y;return Hr().w(function(h){for(;;)switch(h.n){case 0:if(n()._isInitialized){h.n=1;break}return h.a(2,{error:new kt({errorCode:Ft.INITIALIZATION_REQUIRED})});case 1:if(!n().currentScreenConfig){h.n=2;break}return h.a(2,{error:new kt({errorCode:Ft.SCENARIO_IN_PROGRESS})});case 2:return l=X5(a),l&&(n().removeCurrentSessionDataLsAndStore(),e({_sessionIdFromUrl:l})),h.n=3,n().connectByUrl(a);case 3:if(c=h.v,!c.error){h.n=4;break}return h.a(2,{error:new kt({errorCode:Ft.CONNECTION_ISSUE,underlyingBaseError:c.error})});case 4:e({_isConnectedToPlatform:!0});try{d=new URL(a),v=d.hostname,y=d.protocol.includes("https"),n().setStartConfig({host:v,isSecure:y})}catch(m){console.log("Invalid urlWithToken")}return h.a(2,c.workflows)}},s)}))()},configureByUserPass:function(a){return An(Hr().m(function s(){var l,c,d,v,y,h;return Hr().w(function(m){for(;;)switch(m.n){case 0:if(n()._isInitialized){m.n=1;break}return m.a(2,{error:new kt({errorCode:Ft.INITIALIZATION_REQUIRED})});case 1:if(!n().currentScreenConfig){m.n=2;break}return m.a(2,{error:new kt({errorCode:Ft.SCENARIO_IN_PROGRESS})});case 2:if(l=["password","userName","baseUrl"],c=l.filter(function(S){return!(a!=null&&a[S])}),!(c.length>0)){m.n=3;break}return m.a(2,{error:new kt({errorCode:Ft.CONFIG_MISSED_OR_INVALID,message:"Missing parameters: ".concat(c.join(", "))})});case 3:if(d=c_(a.baseUrl),d){m.n=4;break}return m.a(2,{error:new kt({errorCode:Ft.CONFIG_MISSED_OR_INVALID,message:"Invalid URL: ".concat(a.baseUrl)})});case 4:return v={host:d.host,isSecure:d.isSecure,password:a.password,port:d.port,userName:a.userName},m.n=5,n().connectByUserPass(v);case 5:if(y=m.v,!y.error){m.n=6;break}return h=new kt({errorCode:Ft.CONNECTION_ISSUE,underlyingBaseError:y.error}),m.a(2,{error:h});case 6:return e({_isConnectedToPlatform:!0}),n().setStartConfig({host:d.host,isSecure:d.isSecure}),m.a(2,{workflows:[]})}},s)}))()},getWorkflows:function(){var a=arguments;return An(Hr().m(function s(){var l,c,d,v,y,h,m;return Hr().w(function(S){for(;;)switch(S.n){case 0:if(l=a.length>0&&a[0]!==void 0?a[0]:{limit:100,skip:0},n()._isInitialized){S.n=1;break}return c=new ci({errorCode:ti.INITIALIZATION_REQUIRED}),S.a(2,{error:c});case 1:if(n()._isConnectedToPlatform){S.n=2;break}return d=new ci({errorCode:ti.CONNECTION_ISSUE}),S.a(2,{error:d});case 2:return S.n=3,n().wasmService.listWorkflows(l);case 3:if(v=S.v,y=null,v.code===4&&(y=Bn.HTTP_ISSUE),v.code!==0&&v.code!==4&&(y=Bn.PROVIDER_ERROR),v.code===0&&!v.data.items&&(y=Bn.DECODING_FAILED),y===null){S.n=4;break}return h=new Mu({errorCode:y}),m=new ci({errorCode:ti.WORKFLOW_ISSUE,message:"No workflow list",underlyingBaseError:h}),S.a(2,{error:m});case 4:return S.a(2,{results:v.data.items})}},s)}))()},prepareWorkflowAndPrepareUi:function(a){return An(Hr().m(function s(){var l,c,d,v,y,h,m,S,b,w,_,j,O,k,T,x,I;return Hr().w(function(E){for(;;)switch(E.n){case 0:if(n()._isInitialized){E.n=1;break}return c=new ci({errorCode:ti.INITIALIZATION_REQUIRED}),E.a(2,{error:c});case 1:if(n()._isConnectedToPlatform){E.n=2;break}return d=new ci({errorCode:ti.CONNECTION_ISSUE}),E.a(2,{error:d});case 2:if(!n().currentScreenConfig){E.n=3;break}return v=new ci({errorCode:ti.SCENARIO_IN_PROGRESS}),E.a(2,{error:v});case 3:return E.n=4,n().wasmService.getWorkflow(a);case 4:if(y=E.v,h=wy(y.data),m=((l=h.client)===null||l===void 0?void 0:l.steps)&&h.client.steps.some(function(R){return R.templateId===op}),S=null,y.code===4&&(S=Bn.HTTP_ISSUE),y.code!==0&&y.code!==4&&(S=Bn.PROVIDER_ERROR),y.code===0&&!y.data.id&&(S=Bn.DECODING_FAILED),y.data.id&&h===null&&(S=Bn.DECODING_FAILED),m||(S=Bn.DECODING_FAILED),S===null){E.n=5;break}return b=new Mu({errorCode:S}),w=new ci({errorCode:ti.INTERNAL_ISSUE,underlyingBaseError:b}),E.a(2,{error:w});case 5:return _=n().externalModules,j=h.steps,O=z5(_,j),k=O.isAllTemplatesSupported,T=O.unsupportedSteps,k||console.log("IDV:: Warning. Unsupported steps found: ",T),x=n().workflowId,x&&a!==x&&_.forEach(function(R){R.component.deinitialize()}),I=n().modulesConfig,_.forEach(function(R){R.component.isReady()||R.component.initialize(I)}),n().setLayout(h.client.layout),n().setProcessingTemplate(h.client.steps),n().setWorkflowId(a),E.a(2,{workflow:h})}},s)}))()},startNewSession:function(a,s,l){return An(Hr().m(function c(){var d,v,y,h,m,S,b,w,_,j,O,k,T,x,I,E,R,W,Z,$,N,Q,D;return Hr().w(function(A){for(;;)switch(A.n){case 0:if(n()._isInitialized){A.n=1;break}return d=new xt({errorCode:Pt.INITIALIZATION_REQUIRED}),A.a(2,{error:d});case 1:if(v=n().workflowId,v){A.n=2;break}return y=new xt({errorCode:Pt.PREPARED_REQUIRED}),A.a(2,{error:y});case 2:if(!n().currentScreenConfig){A.n=3;break}return h=new xt({errorCode:Pt.ALREADY_STARTED}),A.a(2,{error:h});case 3:if(m=function(U){Eo&&Eo.close(),a(U)},n().setWorkflowSessionCompletion(m),S=n().startConfig,b="apiKey"in S&&typeof S.apiKey=="string",w=n().apiKeyAuthTokenCollection,!(b&&"tokenExpiredIn"in w)){A.n=6;break}if(_=w.tokenExpiredIn&&typeof w.tokenExpiredIn=="number"?w.tokenExpiredIn:0,j=Date.now()>_,!j){A.n=6;break}return A.n=4,n().connectByApiKey({apiKey:S.apiKey,host:S.host,deviceDescriptor:{ttl:n()._ttl}});case 4:if(O=A.v,oa.removeAuthTokenLs(S.apiKey),!O.error){A.n=5;break}return k=new Yi({errorCode:Ki.CONNECTION_ISSUE,underlyingBaseError:O.error}),A.a(2,{error:k});case 5:O&&"authToken"in O&&(T=Date.now()+n()._ttl*1e3,n().setApiKeyAuthTokenCollection(S.apiKey,O.authToken,T));case 6:return n().setIsProcessing(!0),A.n=7,n()._runWasmService();case 7:if(x=A.v,!x.error){A.n=8;break}return A.a(2,{error:x.error});case 8:return A.n=9,n().wasmService.getServiceToken();case 9:if(I=A.v,E=I.data,!(!E||typeof E!="string")){A.n=10;break}return R=new Yi({errorCode:Ki.TOKEN_ERROR}),W=new xt({errorCode:Pt.START_SESSION_FAILED,underlyingBaseError:R}),A.a(2,{error:W});case 10:return n().setServiceSessionToken(E),A.n=11,n()._runSocketConnection(E);case 11:if(Z=A.v,!Z.error){A.n=12;break}return A.a(2,{error:Z.error});case 12:return $=n()._sessionIdFromUrl,A.n=13,n()._continueSession(s,$);case 13:if(N=A.v,!("sessionId"in N)){A.n=14;break}return A.a(2,{results:N});case 14:if(!("error"in N)){A.n=15;break}return A.a(2,{error:N.error});case 15:if(!("id"in N)){A.n=16;break}return A.a(2,{});case 16:return A.n=17,n().wasmService.startSession(v,s,l);case 17:if(Q=A.v,D=n()._checkIsSessionDataValid(Q.data),l_(D)){A.n=18;break}return A.a(2,{error:D.error});case 18:return n()._prepareDataForWorkflow(D),b?n()._checkAndSetApiTokenToLs(D.id):n().setCurrentSessionDataLsAndStore({sessionId:D.id,workflowId:v}),n().setIsProcessing(!1),n().setCurrentStepId(D.currentStep),n().listener({eventType:bu.MESSAGE,message:ta.DID_START_SESSION,module:"IDV"}),A.a(2,{})}},c)}))()},playWorkflow:function(){var a=n().currentStepId;if(a)n().onChangeScreen(a);else{var s=new xt({errorCode:Pt.UNKNOWN_STEP});n().workflowSessionCompletion({error:s})}},deinitialize:function(){return An(Hr().m(function a(){var s,l,c;return Hr().w(function(d){for(;;)switch(d.n){case 0:if(n()._isInitialized){d.n=1;break}return s=new Fu({errorCode:Eu.INITIALIZATION_REQUIRED}),d.a(2,{error:s});case 1:if(!n().currentScreenConfig){d.n=2;break}return l=new Fu({errorCode:Eu.SCENARIO_IN_PROGRESS}),d.a(2,{error:l});case 2:return d.n=3,n().deinitializationIdv();case 3:return c=d.v,n().resetProps(),e({_isInitialized:!1}),d.a(2,c)}},a)}))()}}},MO={},rh,UO;function WP(){if(UO)return rh;UO=1;var r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",e=r+"+/",n=r+"-_",o=function(a){for(var s={},l=0;l<64;l++)s[a.charAt(l)]=l;return s};return rh={i2c:e,c2i:o(e),i2cUrl:n,c2iUrl:o(n)},rh}var qO;function zP(){if(qO)return MO;qO=1;var r=je(),e=pr(),n=wt(),o=ir(),a=Cr(),s=Je(),l=Xr(),c=yo(),d=WP().c2i,v=/[^\d+/a-z]/i,y=/[\t\n\f\r ]+/g,h=/[=]{1,2}$/,m=n("atob"),S=String.fromCharCode,b=o("".charAt),w=o("".replace),_=o(v.exec),j=!!m&&!s(function(){return m("aGk=")!=="hi"}),O=j&&s(function(){return m(" ")!==""}),k=j&&!s(function(){m("a")}),T=j&&!s(function(){m()}),x=j&&m.length!==1,I=!j||O||k||T||x;return r({global:!0,bind:!0,enumerable:!0,forced:I},{atob:function(R){if(c(arguments.length,1),j&&!O&&!k)return a(m,e,R);var W=w(l(R),y,""),Z="",$=0,N=0,Q,D,A;if(W.length%4===0&&(W=w(W,h,"")),Q=W.length,Q%4===1||_(v,W))throw new(n("DOMException"))("The string is not correctly encoded","InvalidCharacterError");for(;$<Q;)D=b(W,$++),A=N%4?A*64+d[D]:d[D],N++%4&&(Z+=S(255&A>>(-2*N&6)));return Z}}),MO}zP();var $O={},th,BO;function HP(){if(BO)return th;BO=1;var r=pr(),e=Iu();return th=function(n){if(e){try{return r.process.getBuiltinModule(n)}catch(o){}try{return Function('return require("'+n+'")')()}catch(o){}}},th}var nh,VO;function WO(){return VO||(VO=1,nh={IndexSizeError:{s:"INDEX_SIZE_ERR",c:1,m:1},DOMStringSizeError:{s:"DOMSTRING_SIZE_ERR",c:2,m:0},HierarchyRequestError:{s:"HIERARCHY_REQUEST_ERR",c:3,m:1},WrongDocumentError:{s:"WRONG_DOCUMENT_ERR",c:4,m:1},InvalidCharacterError:{s:"INVALID_CHARACTER_ERR",c:5,m:1},NoDataAllowedError:{s:"NO_DATA_ALLOWED_ERR",c:6,m:0},NoModificationAllowedError:{s:"NO_MODIFICATION_ALLOWED_ERR",c:7,m:1},NotFoundError:{s:"NOT_FOUND_ERR",c:8,m:1},NotSupportedError:{s:"NOT_SUPPORTED_ERR",c:9,m:1},InUseAttributeError:{s:"INUSE_ATTRIBUTE_ERR",c:10,m:1},InvalidStateError:{s:"INVALID_STATE_ERR",c:11,m:1},SyntaxError:{s:"SYNTAX_ERR",c:12,m:1},InvalidModificationError:{s:"INVALID_MODIFICATION_ERR",c:13,m:1},NamespaceError:{s:"NAMESPACE_ERR",c:14,m:1},InvalidAccessError:{s:"INVALID_ACCESS_ERR",c:15,m:1},ValidationError:{s:"VALIDATION_ERR",c:16,m:0},TypeMismatchError:{s:"TYPE_MISMATCH_ERR",c:17,m:1},SecurityError:{s:"SECURITY_ERR",c:18,m:1},NetworkError:{s:"NETWORK_ERR",c:19,m:1},AbortError:{s:"ABORT_ERR",c:20,m:1},URLMismatchError:{s:"URL_MISMATCH_ERR",c:21,m:1},QuotaExceededError:{s:"QUOTA_EXCEEDED_ERR",c:22,m:1},TimeoutError:{s:"TIMEOUT_ERR",c:23,m:1},InvalidNodeTypeError:{s:"INVALID_NODE_TYPE_ERR",c:24,m:1},DataCloneError:{s:"DATA_CLONE_ERR",c:25,m:1}}),nh}var zO;function GP(){if(zO)return $O;zO=1;var r=je(),e=wt(),n=HP(),o=Je(),a=xn(),s=Oi(),l=Tt().f,c=ut(),d=fn(),v=Fr(),y=Gi(),h=kr(),m=_0(),S=al(),b=WO(),w=Hd(),_=Ht(),j=br(),O=pt(),k="DOMException",T="DATA_CLONE_ERR",x=e("Error"),I=e(k)||function(){try{var Pe=e("MessageChannel")||n("worker_threads").MessageChannel;new Pe().port1.postMessage(new WeakMap)}catch(xe){if(xe.name===T&&xe.code===25)return xe.constructor}}(),E=I&&I.prototype,R=x.prototype,W=_.set,Z=_.getterFor(k),$="stack"in new x(k),N=function(Pe){return v(b,Pe)&&b[Pe].m?b[Pe].c:0},Q=function(){y(this,D);var xe=arguments.length,Ye=S(xe<1?void 0:arguments[0]),fr=S(xe<2?void 0:arguments[1],"Error"),lr=N(fr);if(W(this,{type:k,name:fr,message:Ye,code:lr}),j||(this.name=fr,this.message=Ye,this.code=lr),$){var He=new x(Ye);He.name=k,l(this,"stack",s(1,w(He.stack,1)))}},D=Q.prototype=a(R),A=function(Pe){return{enumerable:!0,configurable:!0,get:Pe}},B=function(Pe){return A(function(){return Z(this)[Pe]})};j&&(d(D,"code",B("code")),d(D,"message",B("message")),d(D,"name",B("name"))),l(D,"constructor",s(1,Q));var U=o(function(){return!(new I instanceof x)}),G=U||o(function(){return R.toString!==m||String(new I(1,2))!=="2: 1"}),z=U||o(function(){return new I(1,"DataCloneError").code!==25}),le=U||I[T]!==25||E[T]!==25,F=O?G||z||le:U;r({global:!0,constructor:!0,forced:F},{DOMException:F?Q:I});var X=e(k),he=X.prototype;G&&(O||I===X)&&c(he,"toString",m),z&&j&&I===X&&d(he,"code",A(function(){return N(h(this).name)}));for(var Oe in b)if(v(b,Oe)){var ve=b[Oe],Ae=ve.s,Ne=s(6,ve.c);v(X,Ae)||l(X,Ae,Ne),v(he,Ae)||l(he,Ae,Ne)}return $O}GP();var HO={},GO;function KP(){if(GO)return HO;GO=1;var r=je(),e=pr(),n=wt(),o=Oi(),a=Tt().f,s=Fr(),l=Gi(),c=vu(),d=al(),v=WO(),y=Hd(),h=br(),m=pt(),S="DOMException",b=n("Error"),w=n(S),_=function(){l(this,j);var Q=arguments.length,D=d(Q<1?void 0:arguments[0]),A=d(Q<2?void 0:arguments[1],"Error"),B=new w(D,A),U=new b(D);return U.name=S,a(B,"stack",o(1,y(U.stack,1))),c(B,this,_),B},j=_.prototype=w.prototype,O="stack"in new b(S),k="stack"in new w(1,2),T=w&&h&&Object.getOwnPropertyDescriptor(e,S),x=!!T&&!(T.writable&&T.configurable),I=O&&!x&&!k;r({global:!0,constructor:!0,forced:m||I},{DOMException:I?_:w});var E=n(S),R=E.prototype;if(R.constructor!==E){m||a(R,"constructor",o(1,E));for(var W in v)if(s(v,W)){var Z=v[W],$=Z.s;s(E,$)||a(E,$,o(6,Z.c))}}return HO}KP();var KO={},QO;function QP(){if(QO)return KO;QO=1;var r=wt(),e=Ri(),n="DOMException";return e(r(n),n),KO}QP();var YO={},ih,ZO;function YP(){if(ZO)return ih;ZO=1;var r=su(),e=Xr(),n=$n(),o=RangeError;return ih=function(s){var l=e(n(this)),c="",d=r(s);if(d<0||d===1/0)throw new o("Wrong number of repetitions");for(;d>0;(d>>>=1)&&(l+=l))d&1&&(c+=l);return c},ih}var oh,XO;function ZP(){if(XO)return oh;XO=1;var r=ir(),e=tl(),n=Xr(),o=YP(),a=$n(),s=r(o),l=r("".slice),c=Math.ceil,d=function(v){return function(y,h,m){var S=n(a(y)),b=e(h),w=S.length,_=m===void 0?" ":n(m),j,O;return b<=w||_===""?S:(j=b-w,O=s(_,c(j/_.length)),O.length>j&&(O=l(O,0,j)),v?S+O:O+S)}};return oh={start:d(!1),end:d(!0)},oh}var ah,JO;function XP(){if(JO)return ah;JO=1;var r=ir(),e=Je(),n=ZP().start,o=RangeError,a=isFinite,s=Math.abs,l=Date.prototype,c=l.toISOString,d=r(l.getTime),v=r(l.getUTCDate),y=r(l.getUTCFullYear),h=r(l.getUTCHours),m=r(l.getUTCMilliseconds),S=r(l.getUTCMinutes),b=r(l.getUTCMonth),w=r(l.getUTCSeconds);return ah=e(function(){return c.call(new Date(-50000000000001))!=="0385-07-25T07:06:39.999Z"})||!e(function(){c.call(new Date(NaN))})?function(){if(!a(d(this)))throw new o("Invalid time value");var j=this,O=y(j),k=m(j),T=O<0?"-":O>9999?"+":"";return T+n(s(O),T?6:4,0)+"-"+n(b(j)+1,2,0)+"-"+n(v(j),2,0)+"T"+n(h(j),2,0)+":"+n(S(j),2,0)+":"+n(w(j),2,0)+"."+n(k,3,0)+"Z"}:c,ah}var e3;function JP(){if(e3)return YO;e3=1;var r=je(),e=XP();return r({target:"Date",proto:!0,forced:Date.prototype.toISOString!==e},{toISOString:e}),YO}JP();function ss(r){"@babel/helpers - typeof";return ss=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},ss(r)}function ek(r,e){return ik(r)||nk(r,e)||tk(r,e)||rk()}function rk(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
82
82
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function tk(r,e){if(r){if(typeof r=="string")return r3(r,e);var n={}.toString.call(r).slice(8,-1);return n==="Object"&&r.constructor&&(n=r.constructor.name),n==="Map"||n==="Set"?Array.from(r):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?r3(r,e):void 0}}function r3(r,e){(e==null||e>r.length)&&(e=r.length);for(var n=0,o=Array(e);n<e;n++)o[n]=r[n];return o}function nk(r,e){var n=r==null?null:typeof Symbol!="undefined"&&r[Symbol.iterator]||r["@@iterator"];if(n!=null){var o,a,s,l,c=[],d=!0,v=!1;try{if(s=(n=n.call(r)).next,e!==0)for(;!(d=(o=s.call(n)).done)&&(c.push(o.value),c.length!==e);d=!0);}catch(y){v=!0,a=y}finally{try{if(!d&&n.return!=null&&(l=n.return(),Object(l)!==l))return}finally{if(v)throw a}}return c}}function ik(r){if(Array.isArray(r))return r}function ok(r,e){if(!(r instanceof e))throw new TypeError("Cannot call a class as a function")}function ak(r,e){for(var n=0;n<e.length;n++){var o=e[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(r,t3(o.key),o)}}function uk(r,e,n){return e&&ak(r.prototype,e),Object.defineProperty(r,"prototype",{writable:!1}),r}function Nl(r,e,n){return(e=t3(e))in r?Object.defineProperty(r,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):r[e]=n,r}function t3(r){var e=sk(r,"string");return ss(e)=="symbol"?e:e+""}function sk(r,e){if(ss(r)!="object"||!r)return r;var n=r[Symbol.toPrimitive];if(n!==void 0){var o=n.call(r,e);if(ss(o)!="object")return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(r)}var lk=function(){function r(){ok(this,r),Nl(this,"_domains",[]),Nl(this,"_transports",[]),Nl(this,"_logs",[]),Nl(this,"_prevTime",0);try{if(!window.localStorage)return;var e=window.localStorage.getItem("logger");if(!e)return;var n=e.split(">"),o=ek(n,2),a=o[0],s=o[1];this._domains=a.split(","),s&&(this._transports=s.split(","))}catch(l){return}}return uk(r,[{key:"create",value:function(n,o){var a=this;return function(s){var l=Date.now(),c=new Date(l).toISOString(),d=0;if(a._prevTime&&(d=l-a._prevTime),a._prevTime=l,a._domains.includes(n)&&a._transports.includes("console")){var v=(o==null?void 0:o.color)||"blue";console.log("%c%s: %c%s %c+%dms","color: ".concat(v,";"),"".concat(c," ").concat(n),"",s,"color: ".concat(v,";"),d)}a._logs.push("".concat(c," ").concat(n,": ").concat(s," +").concat(d,"ms"))}}},{key:"getLogs",value:function(){return this._logs}},{key:"clearLogs",value:function(){this._logs=[]}},{key:"saveLogsToFile",value:function(){if(!(!this._transports.includes("file")||!this._logs.length)){var n=this._logs.join(`
|
|
83
|
-
`),o=new Blob([n],{type:"text/plain"}),a=window.URL.createObjectURL(o),s=document.createElement("a");s.download="log.txt",s.href=a,s.click(),window.URL.revokeObjectURL(a),this.clearLogs()}}}])}(),Sa=new lk;function ls(r){"@babel/helpers - typeof";return ls=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},ls(r)}function n3(r,e){var n=Object.keys(r);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(r);e&&(o=o.filter(function(a){return Object.getOwnPropertyDescriptor(r,a).enumerable})),n.push.apply(n,o)}return n}function ck(r){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?n3(Object(n),!0).forEach(function(o){Io(r,o,n[o])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(n)):n3(Object(n)).forEach(function(o){Object.defineProperty(r,o,Object.getOwnPropertyDescriptor(n,o))})}return r}function wr(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */var r,e,n=typeof Symbol=="function"?Symbol:{},o=n.iterator||"@@iterator",a=n.toStringTag||"@@toStringTag";function s(S,b,w,_){var j=b&&b.prototype instanceof c?b:c,O=Object.create(j.prototype);return Sn(O,"_invoke",function(k,T,x){var I,E,R,W=0,Z=x||[],$=!1,N={p:0,n:0,v:r,a:Q,f:Q.bind(r,4),d:function(A,B){return I=A,E=0,R=r,N.n=B,l}};function Q(D,A){for(E=D,R=A,e=0;!$&&W&&!B&&e<Z.length;e++){var B,U=Z[e],G=N.p,z=U[2];D>3?(B=z===A)&&(R=U[(E=U[4])?5:(E=3,3)],U[4]=U[5]=r):U[0]<=G&&((B=D<2&&G<U[1])?(E=0,N.v=A,N.n=U[1]):G<z&&(B=D<3||U[0]>A||A>z)&&(U[4]=D,U[5]=A,N.n=z,E=0))}if(B||D>1)return l;throw $=!0,A}return function(D,A,B){if(W>1)throw TypeError("Generator is already running");for($&&A===1&&Q(A,B),E=A,R=B;(e=E<2?r:R)||!$;){I||(E?E<3?(E>1&&(N.n=-1),Q(E,R)):N.n=R:N.v=R);try{if(W=2,I){if(E||(D="next"),e=I[D]){if(!(e=e.call(I,R)))throw TypeError("iterator result is not an object");if(!e.done)return e;R=e.value,E<2&&(E=0)}else E===1&&(e=I.return)&&e.call(I),E<2&&(R=TypeError("The iterator does not provide a '"+D+"' method"),E=1);I=r}else if((e=($=N.n<0)?R:k.call(T,N))!==l)break}catch(U){I=r,E=1,R=U}finally{W=1}}return{value:e,done:$}}}(S,w,_),!0),O}var l={};function c(){}function d(){}function v(){}e=Object.getPrototypeOf;var y=[][o]?e(e([][o]())):(Sn(e={},o,function(){return this}),e),h=v.prototype=c.prototype=Object.create(y);function m(S){return Object.setPrototypeOf?Object.setPrototypeOf(S,v):(S.__proto__=v,Sn(S,a,"GeneratorFunction")),S.prototype=Object.create(h),S}return d.prototype=v,Sn(h,"constructor",v),Sn(v,"constructor",d),d.displayName="GeneratorFunction",Sn(v,a,"GeneratorFunction"),Sn(h),Sn(h,a,"Generator"),Sn(h,o,function(){return this}),Sn(h,"toString",function(){return"[object Generator]"}),(wr=function(){return{w:s,m}})()}function Sn(r,e,n,o){var a=Object.defineProperty;try{a({},"",{})}catch(s){a=0}Sn=function(l,c,d,v){function y(h,m){Sn(l,h,function(S){return this._invoke(h,m,S)})}c?a?a(l,c,{value:d,enumerable:!v,configurable:!v,writable:!v}):l[c]=d:(y("next",0),y("throw",1),y("return",2))},Sn(r,e,n,o)}function i3(r,e,n,o,a,s,l){try{var c=r[s](l),d=c.value}catch(v){return void n(v)}c.done?e(d):Promise.resolve(d).then(o,a)}function Et(r){return function(){var e=this,n=arguments;return new Promise(function(o,a){var s=r.apply(e,n);function l(d){i3(s,o,a,l,c,"next",d)}function c(d){i3(s,o,a,l,c,"throw",d)}l(void 0)})}}function fk(r,e){if(!(r instanceof e))throw new TypeError("Cannot call a class as a function")}function dk(r,e){for(var n=0;n<e.length;n++){var o=e[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(r,o3(o.key),o)}}function vk(r,e,n){return e&&dk(r.prototype,e),Object.defineProperty(r,"prototype",{writable:!1}),r}function Io(r,e,n){return(e=o3(e))in r?Object.defineProperty(r,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):r[e]=n,r}function o3(r){var e=pk(r,"string");return ls(e)=="symbol"?e:e+""}function pk(r,e){if(ls(r)!="object"||!r)return r;var n=r[Symbol.toPrimitive];if(n!==void 0){var o=n.call(r,e);if(ls(o)!="object")return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(r)}var ba=Sa.create("session_log"),yk=function(){function r(e){fk(this,r),Io(this,"_worker",null),Io(this,"_initialized",!1),Io(this,"_connectedToIdv",!1),Io(this,"_serviceRunning",!1),Io(this,"_userId",H5(VR)),Io(this,"_setErrorScreen",null),e&&(this._setErrorScreen=e)}return vk(r,[{key:"init",value:function(){var e=Et(wr().m(function o(){var a,s,l,c,d;return wr().w(function(v){for(;;)switch(v.p=v.n){case 0:return v.p=1,v.n=2,fetch("https://wasm-development.regulaforensics.com/idv/rc/3.1/1601127-05ea45dc//PlatformAdaptor.worker.js");case 2:return a=v.v,v.n=3,a.blob();case 3:s=v.v,l=URL.createObjectURL(s),this._worker=new Worker(l),v.n=5;break;case 4:v.p=4,d=v.v,console.log("Creating worker error: ".concat(JSON.stringify(d)));case 5:v.n=7;break;case 6:this._worker=new Worker("./PlatformAdaptor.worker.js");case 7:if(this._worker){v.n=8;break}return v.a(2);case 8:return this._worker.postMessage({target:"gl",op:"setPrefetched",preMain:!0}),v.n=9,this.sendMessage({target:"worker-init",URL:document.URL,currentScriptUrl:"https://wasm-development.regulaforensics.com/idv/rc/3.1/1601127-05ea45dc/",preMain:!0});case 9:return c=v.v,v.a(2,c)}},o,this,[[1,4]])}));function n(){return e.apply(this,arguments)}return n}()},{key:"connectByUserPass",value:function(){var e=Et(wr().m(function o(a){var s,l,c;return wr().w(function(d){for(;;)switch(d.n){case 0:return d.n=1,this.sendMessage({target:"custom",method:"connect_idv",connectionParams:{deviceDescriptor:{deviceId:this._userId,deviceType:Su.deviceType,serial:"",macAddress:"00:00:00:00:00:00",heartbeatCadence:2},host:a.host,httpRetryCount:0,httpTimeoutMs:0,isSecure:(s=a.isSecure)!==null&&s!==void 0?s:!0,password:a.password,port:(l=a.port)!==null&&l!==void 0?l:0,schema:"basic",userName:a.userName},preMain:!0});case 1:return c=d.v,c.code===0&&(this._serviceRunning=!0,this._connectedToIdv=!0),d.a(2,c)}},o,this)}));function n(o){return e.apply(this,arguments)}return n}()},{key:"connectByApiKey",value:function(){var e=Et(wr().m(function o(a){var s,l,c;return wr().w(function(d){for(;;)switch(d.n){case 0:return d.n=1,this.sendMessage({target:"custom",method:"connect_by_api_key",connectByApiKeyParams:{isSecure:(s=a.isSecure)!==null&&s!==void 0?s:!0,host:a.host,port:(l=a.port)!==null&&l!==void 0?l:0,httpRetryCount:0,httpTimeoutMs:0,deviceDescriptor:ck({deviceId:this._userId,deviceType:Su.deviceType,serial:"",macAddress:"00:00:00:00:00:00",heartbeatCadence:100,metadata:{}},a.deviceDescriptor),apiKey:a.apiKey,authToken:a.authToken},preMain:!0});case 1:return c=d.v,c.code===0&&(this._serviceRunning=!0,this._connectedToIdv=!0),d.a(2,c)}},o,this)}));function n(o){return e.apply(this,arguments)}return n}()},{key:"connectByUrl",value:function(){var e=Et(wr().m(function o(a){var s;return wr().w(function(l){for(;;)switch(l.n){case 0:return l.n=1,this.sendMessage({target:"custom",method:"connect_by_url",connectByUrlParams:{deviceDescriptor:{deviceId:this._userId,deviceType:Su.deviceType,serial:"",macAddress:"00:00:00:00:00:00",heartbeatCadence:2},httpRetryCount:5,httpTimeoutMs:1e3,url:a},preMain:!0});case 1:return s=l.v,s.code===0&&(this._serviceRunning=!0,this._connectedToIdv=!0),l.a(2,s)}},o,this)}));function n(o){return e.apply(this,arguments)}return n}()},{key:"startSession",value:function(){var e=Et(wr().m(function o(a,s,l){var c,d;return wr().w(function(v){for(;;)switch(v.n){case 0:return c={workflowId:a,locale:s},G5(l)&&(c.metadata=l),v.n=1,this.sendMessage({target:"custom",method:"start_session",sessionParams:c,preMain:!0});case 1:return d=v.v,d.code===0&&(Sa.clearLogs(),ba("Command: 5. Result code: ".concat(d.code,". Session id: ").concat(d.data.id,". Cur step: ").concat(d.data.currentStep,"."))),v.a(2,d)}},o,this)}));function n(o,a,s){return e.apply(this,arguments)}return n}()},{key:"continueSession",value:function(){var e=Et(wr().m(function o(a,s){var l,c;return wr().w(function(d){for(;;)switch(d.n){case 0:return l={sessionId:a,locale:s},d.n=1,this.sendMessage({continueParams:l,target:"custom",method:"continue_session",preMain:!0});case 1:return c=d.v,c.code===0&&(Sa.clearLogs(),ba("Command: 10. Result code: ".concat(c.code,". Session id: ").concat(c.data.id,". Cur step: ").concat(c.data.currentStep,"."))),d.a(2,c)}},o,this)}));function n(o,a){return e.apply(this,arguments)}return n}()},{key:"listWorkflows",value:function(){var e=Et(wr().m(function o(){var a,s,l=arguments;return wr().w(function(c){for(;;)switch(c.n){case 0:return a=l.length>0&&l[0]!==void 0?l[0]:{limit:0,skip:0},c.n=1,this.sendMessage({workflowsParams:a,target:"custom",method:"list_workflows",preMain:!0});case 1:return s=c.v,c.a(2,s)}},o,this)}));function n(){return e.apply(this,arguments)}return n}()},{key:"getHealth",value:function(){var e=Et(wr().m(function o(){var a;return wr().w(function(s){for(;;)switch(s.n){case 0:return s.n=1,this.sendMessage({target:"custom",method:"get_health",preMain:!0});case 1:return a=s.v,s.a(2,a)}},o,this)}));function n(){return e.apply(this,arguments)}return n}()},{key:"getServiceToken",value:function(){var e=Et(wr().m(function o(){var a;return wr().w(function(s){for(;;)switch(s.n){case 0:return s.n=1,this.sendMessage({target:"custom",method:"get_service_token",preMain:!0});case 1:return a=s.v,s.a(2,a)}},o,this)}));function n(){return e.apply(this,arguments)}return n}()},{key:"abandonSession",value:function(){var e=Et(wr().m(function o(){var a;return wr().w(function(s){for(;;)switch(s.n){case 0:return s.n=1,this.sendMessage({target:"custom",method:"abandon_session",preMain:!0});case 1:return a=s.v,s.a(2,a)}},o,this)}));function n(){return e.apply(this,arguments)}return n}()},{key:"getWorkflow",value:function(){var e=Et(wr().m(function o(a){var s;return wr().w(function(l){for(;;)switch(l.n){case 0:return l.n=1,this.sendMessage({workflowIdParams:{workflowId:a},target:"custom",method:"get_workflow",preMain:!0});case 1:return s=l.v,l.a(2,s)}},o,this)}));function n(o){return e.apply(this,arguments)}return n}()},{key:"pushData",value:function(){var e=Et(wr().m(function o(a,s){var l;return wr().w(function(c){for(;;)switch(c.n){case 0:return ba("Command: 9. Request payload: ".concat(JSON.stringify(s))),c.n=1,this.sendMessage({target:"custom",method:"push_data",pushDataParams:{data:s,stage:0,step:a},preMain:!0});case 1:return l=c.v,ba("Command: 9. Result code: ".concat(l.code)),c.a(2,l)}},o,this)}));function n(o,a){return e.apply(this,arguments)}return n}()},{key:"getSessionState",value:function(){var e=Et(wr().m(function o(){var a;return wr().w(function(s){for(;;)switch(s.n){case 0:return s.n=1,this.sendMessage({target:"custom",method:"get_session_state",preMain:!0});case 1:return a=s.v,ba("Command: 7. Result code: ".concat(a.code,". Cur step: ").concat(a.data.currentStep,". Proc files: ").concat(a.data.isProcessingFiles)),s.a(2,a)}},o,this)}));function n(){return e.apply(this,arguments)}return n}()},{key:"waitForSessionUpdate",value:function(){var e=Et(wr().m(function o(){var a;return wr().w(function(s){for(;;)switch(s.n){case 0:return s.n=1,this.sendMessage({waitingSessionParams:{periodMs:1e3},target:"custom",method:"wait_for_session_update",preMain:!0});case 1:return a=s.v,ba("Command: 8. Result code: ".concat(a.code)),s.a(2,a)}},o,this)}));function n(){return e.apply(this,arguments)}return n}()},{key:"pushSessionLogs",value:function(){var e=Et(wr().m(function o(a){var s;return wr().w(function(l){for(;;)switch(l.n){case 0:return l.n=1,this.sendMessage({target:"custom",method:"push_session_logs",pushSessionLogsParams:a,preMain:!0});case 1:return s=l.v,l.a(2,s)}},o,this)}));function n(o){return e.apply(this,arguments)}return n}()},{key:"disconnect",value:function(){var e=Et(wr().m(function o(){var a;return wr().w(function(s){for(;;)switch(s.n){case 0:return s.n=1,this.sendMessage({target:"custom",method:"disconnect",preMain:!0});case 1:return a=s.v,this._connectedToIdv=!1,this._serviceRunning=!1,s.a(2,a)}},o,this)}));function n(){return e.apply(this,arguments)}return n}()},{key:"sendMessage",value:function(){var e=Et(wr().m(function o(a){var s=this;return wr().w(function(l){for(;;)switch(l.n){case 0:return l.a(2,new Promise(function(c,d){if(!s._worker)return d();s._worker.onmessage=function(v){var y=v.data.target;if(y!=="stdout"){if(y==="custom"){var h=v.data,m=h.method,S=h.data;m==="onRuntimeInitialized"&&(s._initialized=!0),c(S)}if(y==="stderr"){var b=v.data.content;s._setErrorScreen&&s._setErrorScreen(b)}}},s._worker.postMessage(a)}))}},o)}));function n(o){return e.apply(this,arguments)}return n}()},{key:"isServiceRunning",value:function(){return this._serviceRunning}},{key:"isServiceConnected",value:function(){return this._connectedToIdv}},{key:"terminateWorker",value:function(){if(this.isServiceRunning()){var n;(n=this._worker)===null||n===void 0||n.terminate(),this._serviceRunning=!1,this._initialized=!1,this._connectedToIdv=!1}}},{key:"shutdown",value:function(){var e=Et(wr().m(function o(){var a;return wr().w(function(s){for(;;)switch(s.n){case 0:if(this._worker){s.n=1;break}return s.a(2,{code:0});case 1:if(this._connectedToIdv){s.n=2;break}return this.terminateWorker(),s.a(2,{code:0});case 2:return s.n=3,this.disconnect();case 3:return a=s.v,this.terminateWorker(),s.a(2,a)}},o,this)}));function n(){return e.apply(this,arguments)}return n}()}])}();function cs(r){"@babel/helpers - typeof";return cs=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},cs(r)}function a3(r,e){var n=Object.keys(r);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(r);e&&(o=o.filter(function(a){return Object.getOwnPropertyDescriptor(r,a).enumerable})),n.push.apply(n,o)}return n}function fs(r){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?a3(Object(n),!0).forEach(function(o){hk(r,o,n[o])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(n)):a3(Object(n)).forEach(function(o){Object.defineProperty(r,o,Object.getOwnPropertyDescriptor(n,o))})}return r}function hk(r,e,n){return(e=mk(e))in r?Object.defineProperty(r,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):r[e]=n,r}function mk(r){var e=gk(r,"string");return cs(e)=="symbol"?e:e+""}function gk(r,e){if(cs(r)!="object"||!r)return r;var n=r[Symbol.toPrimitive];if(n!==void 0){var o=n.call(r,e);if(cs(o)!="object")return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}function qr(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */var r,e,n=typeof Symbol=="function"?Symbol:{},o=n.iterator||"@@iterator",a=n.toStringTag||"@@toStringTag";function s(S,b,w,_){var j=b&&b.prototype instanceof c?b:c,O=Object.create(j.prototype);return bn(O,"_invoke",function(k,T,x){var I,E,R,W=0,Z=x||[],$=!1,N={p:0,n:0,v:r,a:Q,f:Q.bind(r,4),d:function(A,B){return I=A,E=0,R=r,N.n=B,l}};function Q(D,A){for(E=D,R=A,e=0;!$&&W&&!B&&e<Z.length;e++){var B,U=Z[e],G=N.p,z=U[2];D>3?(B=z===A)&&(R=U[(E=U[4])?5:(E=3,3)],U[4]=U[5]=r):U[0]<=G&&((B=D<2&&G<U[1])?(E=0,N.v=A,N.n=U[1]):G<z&&(B=D<3||U[0]>A||A>z)&&(U[4]=D,U[5]=A,N.n=z,E=0))}if(B||D>1)return l;throw $=!0,A}return function(D,A,B){if(W>1)throw TypeError("Generator is already running");for($&&A===1&&Q(A,B),E=A,R=B;(e=E<2?r:R)||!$;){I||(E?E<3?(E>1&&(N.n=-1),Q(E,R)):N.n=R:N.v=R);try{if(W=2,I){if(E||(D="next"),e=I[D]){if(!(e=e.call(I,R)))throw TypeError("iterator result is not an object");if(!e.done)return e;R=e.value,E<2&&(E=0)}else E===1&&(e=I.return)&&e.call(I),E<2&&(R=TypeError("The iterator does not provide a '"+D+"' method"),E=1);I=r}else if((e=($=N.n<0)?R:k.call(T,N))!==l)break}catch(U){I=r,E=1,R=U}finally{W=1}}return{value:e,done:$}}}(S,w,_),!0),O}var l={};function c(){}function d(){}function v(){}e=Object.getPrototypeOf;var y=[][o]?e(e([][o]())):(bn(e={},o,function(){return this}),e),h=v.prototype=c.prototype=Object.create(y);function m(S){return Object.setPrototypeOf?Object.setPrototypeOf(S,v):(S.__proto__=v,bn(S,a,"GeneratorFunction")),S.prototype=Object.create(h),S}return d.prototype=v,bn(h,"constructor",v),bn(v,"constructor",d),d.displayName="GeneratorFunction",bn(v,a,"GeneratorFunction"),bn(h),bn(h,a,"Generator"),bn(h,o,function(){return this}),bn(h,"toString",function(){return"[object Generator]"}),(qr=function(){return{w:s,m}})()}function bn(r,e,n,o){var a=Object.defineProperty;try{a({},"",{})}catch(s){a=0}bn=function(l,c,d,v){function y(h,m){bn(l,h,function(S){return this._invoke(h,m,S)})}c?a?a(l,c,{value:d,enumerable:!v,configurable:!v,writable:!v}):l[c]=d:(y("next",0),y("throw",1),y("return",2))},bn(r,e,n,o)}function u3(r,e,n,o,a,s,l){try{var c=r[s](l),d=c.value}catch(v){return void n(v)}c.done?e(d):Promise.resolve(d).then(o,a)}function wn(r){return function(){var e=this,n=arguments;return new Promise(function(o,a){var s=r.apply(e,n);function l(d){u3(s,o,a,l,c,"next",d)}function c(d){u3(s,o,a,l,c,"throw",d)}l(void 0)})}}var Sk=function(e,n){return{wasmService:null,isProcessing:!1,isFinalWaitingUi:!1,setAndInitWasmService:function(){var o=wn(qr().m(function s(){var l;return qr().w(function(c){for(;;)switch(c.n){case 0:return l=new yk,c.n=1,l.init();case 1:e({wasmService:l});case 2:return c.a(2)}},s)}));function a(){return o.apply(this,arguments)}return a}(),setFinalWaitingUi:function(a){e({isFinalWaitingUi:a})},connectByApiKey:function(a){return wn(qr().m(function s(){var l,c,d,v,y;return qr().w(function(h){for(;;)switch(h.n){case 0:return l=n().wasmService,h.n=1,l.connectByApiKey(a);case 1:if(c=h.v,d=null,c.code===4&&(d=ki.HTTP_ISSUE),c.code!==0&&c.code!==4&&(d=ki.PROVIDER_ERROR),d===null){h.n=2;break}return v=new sa({errorCode:d}),y=new Lu({errorCode:cl.CONNECTION_ISSUE,underlyingBaseError:v}),h.a(2,{error:y});case 2:return h.a(2,c.data);case 3:return h.a(2)}},s)}))()},connectByUserPass:function(a){return wn(qr().m(function s(){var l,c,d;return qr().w(function(v){for(;;)switch(v.n){case 0:return v.n=1,n().wasmService.connectByUserPass(a);case 1:if(l=v.v,c=null,l.code===4&&(c=ki.HTTP_ISSUE),l.code!==0&&l.code!==4&&(c=ki.PROVIDER_ERROR),c===null){v.n=2;break}return d=new sa({errorCode:c}),v.a(2,{error:d});case 2:return v.a(2,{})}},s)}))()},connectByUrl:function(a){return wn(qr().m(function s(){var l,c,d,v,y;return qr().w(function(h){for(;;)switch(h.n){case 0:return l=n().wasmService,h.n=1,l.connectByUrl(a);case 1:if(c=h.v,d=null,c.code===4&&(d=ki.HTTP_ISSUE),c.code!==0&&c.code!==4&&(d=ki.PROVIDER_ERROR),d===null){h.n=2;break}return v=new sa({errorCode:d}),y=new Lu({errorCode:cl.CONNECTION_ISSUE,underlyingBaseError:v}),h.a(2,{workflows:[],error:y});case 2:return h.a(2,{workflows:c.data});case 3:return h.a(2)}},s)}))()},workflowSessionCompletion:function(){},setWorkflowSessionCompletion:function(a){var s=function(c){var d,v=(d=n().currentSessionData)===null||d===void 0?void 0:d.sessionId,y=fs(fs({},c.results),{},{sessionId:v}),h=fs({results:y},c.error&&{error:c.error});if(n().removeCurrentSessionDataLsAndStore(),a(h),c.error){var m=Sa.getLogs(),S=m.join("; ");n().wasmService.pushSessionLogs({sessionId:v,body:{log:S,errorCode:c.error.shortChain,deviceInfo:{platform:"Web"}}})}Sa.clearLogs()};e(function(){return{workflowSessionCompletion:s}})},loadModules:function(){var o=wn(qr().m(function s(l){var c,d,v;return qr().w(function(y){for(;;)switch(y.p=y.n){case 0:return y.p=0,y.n=1,bk(l);case 1:return c=y.v,e(function(){return{externalModules:c}}),y.a(2,{});case 2:return y.p=2,y.v,(d=n().wasmService)===null||d===void 0||d.shutdown(),n().resetWasmService(),n().resetProps(),v=new Du({errorCode:wu.MODULES_INSTANTIATION_FAILURE}),y.a(2,{error:v})}},s,null,[[0,2]])}));function a(s){return o.apply(this,arguments)}return a}(),setProcessingTemplate:function(a){var s=wy(a.find(function(l){return l.templateId===op}));s.templateLayout=u_(s.templateLayout,n().layout),e({processingTransformedTemplate:s})},setIsProcessing:function(a){e({isProcessing:a})},_pushStep:function(){var o=wn(qr().m(function s(l,c){var d,v,y;return qr().w(function(h){for(;;)switch(h.n){case 0:return d=null,v=function(){var m=wn(qr().m(function S(){var b,w,_,j;return qr().w(function(O){for(;;)switch(O.n){case 0:return O.n=1,n().wasmService.pushData(l,c);case 1:if(b=O.v,w=null,b.code===4&&(w=jn.HTTP_ISSUE),b.code!==0&&b.code!==4&&(w=jn.PROVIDER_ERROR),w!==null&&(_=new la({errorCode:jn.HTTP_ISSUE}),j=new xt({errorCode:Pt.INTERNAL_ISSUE,message:"Error from external module",underlyingBaseError:_}),d=j),b.code!==0){O.n=2;break}return d=null,O.a(2,b);case 2:return O.a(2,null);case 3:return O.a(2)}},S)}));return function(){return m.apply(this,arguments)}}(),y=function(){return null},h.n=1,s_(v,y);case 1:return h.a(2,d?{error:d}:{})}},s)}));function a(s,l){return o.apply(this,arguments)}return a}(),_findStepById:function(a){var s=n().workflow;if(!s||!a)return null;var l=s.steps.find(function(c){return c.id===a});return l!=null?l:null},_waitingForNextStep:function(){var o=wn(qr().m(function s(){var l,c,d,v;return qr().w(function(y){for(;;)switch(y.n){case 0:return l=null,c=null,d=function(){var h=wn(qr().m(function m(){var S,b,w,_,j,O,k,T,x,I,E,R,W,Z;return qr().w(function($){for(;;)switch($.n){case 0:return $.n=1,n().wasmService.getSessionState();case 1:if(_=$.v,j=(S=_.data)===null||S===void 0?void 0:S.currentStep,O=(b=_.data)===null||b===void 0?void 0:b.isProcessingFiles,k=(w=_.data)===null||w===void 0||(w=w.workflow)===null||w===void 0?void 0:w.steps,T=W5(k,j),x=_.code===4,I=_.code!==0&&_.code!==4,E=_.code===0&&(!_.data.workflow||!_.data.currentStep),R=null,k&&!T&&(R=jn.NOT_DATA_TYPE),x&&(R=jn.HTTP_ISSUE),I&&(R=jn.PROVIDER_ERROR),O&&(R=jn.IS_PROCESSING),E&&(R=jn.DECODING_FAILED),R!==null&&(W=new la({errorCode:R}),Z=new xt({errorCode:Pt.INTERNAL_ISSUE,underlyingBaseError:W}),l=Z),!(T&&!O&&!x&&!I&&!E)){$.n=2;break}return l=null,$.a(2,_.data);case 2:return $.a(2,null)}},m)}));return function(){return h.apply(this,arguments)}}(),y.n=1,new Promise(function(h){var m=1e4,S=6,b=0,w,_=function(){var O=wn(qr().m(function k(T){return qr().w(function(x){for(;;)switch(x.n){case 0:if(!T){x.n=1;break}return w=window.setTimeout(function(){_(!1)},m),x.a(2);case 1:return x.n=2,d();case 2:c=x.v,b++,!c&&b<S?w=window.setTimeout(function(){_(!1)},m):(Eo.clearSubscriptions(),h());case 3:return x.a(2)}},k)}));return function(T){return O.apply(this,arguments)}}();if(Eo.isConnected()){var j=function(k){var T=JSON.parse(atob(JSON.parse(k).payload));T.eventType==="SESSION_UPDATED"&&(clearTimeout(w),_(!1))};Eo.onMessage(j)}_(!0)});case 1:if(!l){y.n=2;break}return y.a(2,{error:l});case 2:if(!c){y.n=3;break}return y.a(2,{sessionData:c});case 3:return l=new la({errorCode:jn.DECODING_FAILED}),v=new xt({errorCode:Pt.INTERNAL_ISSUE,underlyingBaseError:l}),y.a(2,{error:v})}},s)}));function a(){return o.apply(this,arguments)}return a}(),setFinalStepAndStopProcess:function(a){var s=a||n().currentStepId;if(s){var l=n()._findStepById(s);l&&(n().workflowSessionCompletion({results:{finalStep:{id:l.id,name:l.name,final:l.final}}}),n().resetSession(),n().listener({eventType:bu.MESSAGE,message:ta.DID_END_SESSION,module:"IDV"}))}},setNextStep:function(a,s,l){n().setWorkflow(a),n().setLayout(a.client.layout),n().setProcessingTemplate(a.client.steps),n().setSessionProperties(s);var c=n()._findStepById(l),d=function(y){return!!y&&Object.prototype.toString.call(y)==="[object Object]"&&y.templateId};if(c!=null&&c.final&&!d(c.client)){n().setFinalStepAndStopProcess(c.id);return}c!=null&&c.final&&d(c.client)&&n().setFinalWaitingUi(!0),n().onChangeScreen(l),n().setIsProcessing(!1)},pushStepWaitNextStepAndSet:function(){var o=wn(qr().m(function s(l){var c,d,v,y,h,m,S,b;return qr().w(function(w){for(;;)switch(w.n){case 0:if(c=n().currentStepId,c){w.n=1;break}return w.a(2);case 1:if(n().setIsProcessing(!0),!n().isFinalWaitingUi){w.n=2;break}return n().setFinalStepAndStopProcess(),w.a(2);case 2:if(!l.errorCode){w.n=3;break}return d=l,v=new xt({errorCode:Pt.MODULES_ISSUE,message:"Error from external module",underlyingBaseError:d}),n().workflowSessionCompletion({error:v}),n().resetSession(),w.a(2);case 3:return w.n=4,n()._pushStep(c,l);case 4:if(y=w.v,!y.error){w.n=5;break}return n().workflowSessionCompletion({error:y.error}),n().resetSession(),w.a(2);case 5:return w.n=6,n()._waitingForNextStep();case 6:if(h=w.v,!h.error){w.n=7;break}return n().workflowSessionCompletion({error:h.error}),n().resetSession(),w.a(2);case 7:m=h.sessionData.workflow,S=h.sessionData.currentStep,b=h.sessionData.properties,n().setNextStep(m,b,S);case 8:return w.a(2)}},s)}));function a(s){return o.apply(this,arguments)}return a}(),onChangeScreen:function(a){if(!a)return e(function(){return{currentScreenConfig:null}});var s=n().workflow,l=n().sessionProperties,c=null;if(a===op&&n().processingTransformedTemplate!==null){var d=n().processingTransformedTemplate;d&&(c={templateId:d.templateId,templateLayout:d.templateLayout,dataSource:null})}else{var v,y,h=n()._findStepById(a);if(typeof(h==null||(v=h.client)===null||v===void 0?void 0:v.templateId)=="string"){var m;c=fs(fs({},h==null?void 0:h.client),{},{templateId:h.client.templateId,dataSource:(m=h.dataSource)!==null&&m!==void 0?m:null,properties:l})}if(c){var S;c.sessionId=(S=n().currentSessionData)===null||S===void 0?void 0:S.sessionId,c.serviceToken=n().serviceToken}if(c&&K5(h==null||(y=h.client)===null||y===void 0?void 0:y.templateLayout)){var b=u_(h.client.templateLayout,n().layout);b&&(c.templateLayout=b)}}var w=V5(n().externalModules,s.steps,a);if(c===null||!w){var _=new xt({errorCode:Pt.UNKNOWN_STEP,message:"Unsupported step template"});n().workflowSessionCompletion({error:_}),e(function(){return{currentScreenConfig:null}}),n().resetSession();return}n().setCurrentStepId(a),e(function(){return{currentScreenConfig:c}})},deinitializationIdv:function(){var o=wn(qr().m(function s(){var l,c;return qr().w(function(d){for(;;)switch(d.n){case 0:return d.n=1,(l=n().wasmService)===null||l===void 0?void 0:l.shutdown();case 1:if(c=d.v,n().resetWasmService(),n().externalModules.forEach(function(v){v.component.deinitialize&&v.component.isReady&&v.component.deinitialize()}),(c==null?void 0:c.code)!==0){d.n=2;break}return d.a(2,{});case 2:return d.a(2,{})}},s)}));function a(){return o.apply(this,arguments)}return a}(),resetSession:function(){return e(function(){return{isFinalWaitingUi:!1,isProcessing:!1,processingTransformedTemplate:null,currentStepId:null,layout:null,currentScreenConfig:null,workflowId:void 0,workflow:null,serviceToken:void 0}})},resetWasmService:function(){return e(function(){return{wasmService:null}})}}};function bk(r){return uh.apply(this,arguments)}function uh(){return uh=wn(qr().m(function r(e){var n,o,a,s,l;return qr().w(function(c){for(;;)switch(c.n){case 0:for(n=[],o=0,a=e;o<a.length;o++)s=a[o],s&&n.push({id:s.getIdentifier(),supportedTemplates:s.getSupportedTemplates(),component:s});return l=n.filter(function(d){return d!==null}),c.a(2,l)}},r)})),uh.apply(this,arguments)}function ds(r){"@babel/helpers - typeof";return ds=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},ds(r)}function s3(r,e){var n=Object.keys(r);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(r);e&&(o=o.filter(function(a){return Object.getOwnPropertyDescriptor(r,a).enumerable})),n.push.apply(n,o)}return n}function sh(r){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?s3(Object(n),!0).forEach(function(o){wk(r,o,n[o])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(n)):s3(Object(n)).forEach(function(o){Object.defineProperty(r,o,Object.getOwnPropertyDescriptor(n,o))})}return r}function wk(r,e,n){return(e=Ek(e))in r?Object.defineProperty(r,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):r[e]=n,r}function Ek(r){var e=_k(r,"string");return ds(e)=="symbol"?e:e+""}function _k(r,e){if(ds(r)!="object"||!r)return r;var n=r[Symbol.toPrimitive];if(n!==void 0){var o=n.call(r,e);if(ds(o)!="object")return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}var Jr=D8(function(){return sh(sh(sh({},t6.apply(void 0,arguments)),VP.apply(void 0,arguments)),Sk.apply(void 0,arguments))}),Ck=function(e){var n=e.children;return P.jsx("div",{style:{position:"absolute",top:0,left:0,flex:"1 1 100%",display:"flex",justifyContent:"center",alignItems:"center",alignContent:"center",height:"100%",width:"100%",background:"white",zIndex:1e3},children:n})};function vs(r){"@babel/helpers - typeof";return vs=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},vs(r)}function l3(r,e){var n=Object.keys(r);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(r);e&&(o=o.filter(function(a){return Object.getOwnPropertyDescriptor(r,a).enumerable})),n.push.apply(n,o)}return n}function c3(r){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?l3(Object(n),!0).forEach(function(o){Ok(r,o,n[o])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(n)):l3(Object(n)).forEach(function(o){Object.defineProperty(r,o,Object.getOwnPropertyDescriptor(n,o))})}return r}function Ok(r,e,n){return(e=Ik(e))in r?Object.defineProperty(r,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):r[e]=n,r}function Ik(r){var e=Rk(r,"string");return vs(e)=="symbol"?e:e+""}function Rk(r,e){if(vs(r)!="object"||!r)return r;var n=r[Symbol.toPrimitive];if(n!==void 0){var o=n.call(r,e);if(vs(o)!="object")return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}var f3=function(e){var n=e.config,o=e.tagName,a=cr.useRef(null);return cr.useEffect(function(){a.current&&a.current.setProps(n)},[n]),cr.createElement(o,{ref:a,style:{width:"100%",height:"100%"}})},Tk=function(){var e=Jr(function(b){return b.currentScreenConfig}),n=Jr(function(b){return b.pushStepWaitNextStepAndSet}),o=Jr(function(b){return b.processingTransformedTemplate}),a=Jr(function(b){return b.isProcessing}),s=Jr(function(b){return b.setIsProcessing}),l=Jr(function(b){return b.listener}),c=Jr(function(b){return b.externalModules}),d=Jr(function(b){return b.modulesConfig}),v=function(w,_){l({eventType:bu.MESSAGE,message:_,module:w})},y=function(w){s(w)},h=function(w){s(!1),n(w)},m=cr.useCallback(function(){var b=c.find(function(w){return w.supportedTemplates.includes("PROGRESS")});return b&&o?P.jsx(f3,{config:{perform:h,moduleProps:c3(c3({},o),{},{templateId:"PROGRESS"}),modulesConfig:d,idvEventListener:v,isProcessing:y},tagName:b==null?void 0:b.id}):"Processing..."},[c,e,o]),S=cr.useCallback(function(){if(!e)return null;var b=c.find(function(w){return w.supportedTemplates.includes(e.templateId)});if(b&&e)return P.jsx(f3,{config:{perform:h,moduleProps:e,modulesConfig:d,idvEventListener:v,isProcessing:y},tagName:b==null?void 0:b.id})},[e,c]);return!e&&!o?null:P.jsx(P.Fragment,{children:P.jsx(eb,{direction:ip.Ltr,children:P.jsxs(P.Fragment,{children:[a&&P.jsx(Ck,{children:m()}),S()]})})})};function Pk(){return P.jsx(cr.StrictMode,{children:P.jsx(d8,{children:P.jsx(Tk,{})})})}function wa(r){"@babel/helpers - typeof";return wa=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},wa(r)}function kk(r,e){if(!(r instanceof e))throw new TypeError("Cannot call a class as a function")}function d3(r,e){for(var n=0;n<e.length;n++){var o=e[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(r,p3(o.key),o)}}function xk(r,e,n){return e&&d3(r.prototype,e),n&&d3(r,n),Object.defineProperty(r,"prototype",{writable:!1}),r}function jk(r,e,n){return e=ys(e),Ak(r,ch()?Reflect.construct(e,[],ys(r).constructor):e.apply(r,n))}function Ak(r,e){if(e&&(wa(e)=="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Nk(r)}function Nk(r){if(r===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return r}function Dk(r,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");r.prototype=Object.create(e&&e.prototype,{constructor:{value:r,writable:!0,configurable:!0}}),Object.defineProperty(r,"prototype",{writable:!1}),e&&ps(r,e)}function lh(r){var e=typeof Map=="function"?new Map:void 0;return lh=function(o){if(o===null||!Fk(o))return o;if(typeof o!="function")throw new TypeError("Super expression must either be null or a function");if(e!==void 0){if(e.has(o))return e.get(o);e.set(o,a)}function a(){return Lk(o,arguments,ys(this).constructor)}return a.prototype=Object.create(o.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}}),ps(a,o)},lh(r)}function Lk(r,e,n){if(ch())return Reflect.construct.apply(null,arguments);var o=[null];o.push.apply(o,e);var a=new(r.bind.apply(r,o));return n&&ps(a,n.prototype),a}function ch(){try{var r=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(ch=function(){return!!r})()}function Fk(r){try{return Function.toString.call(r).indexOf("[native code]")!==-1}catch(e){return typeof r=="function"}}function ps(r,e){return ps=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,o){return n.__proto__=o,n},ps(r,e)}function ys(r){return ys=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},ys(r)}function v3(r,e,n){return(e=p3(e))in r?Object.defineProperty(r,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):r[e]=n,r}function p3(r){var e=Mk(r,"string");return wa(e)=="symbol"?e:e+""}function Mk(r,e){if(wa(r)!="object"||!r)return r;var n=r[Symbol.toPrimitive];if(n!==void 0){var o=n.call(r,e);if(wa(o)!="object")return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(r)}var Uk="*,::after,::before{box-sizing:border-box}h1,h2,h3,h4,p,ul{padding:0;margin:0}li{list-style:none}:host{display:block;container-type:inline-size;container-name:host;width:100%;height:100%}",y3=function(r){function e(){var n;return kk(this,e),n=jk(this,e),v3(n,"_root",E2.createRoot(n.attachShadow({mode:"open"}))),v3(n,"_mounted",!1),n}return Dk(e,r),xk(e,[{key:"connectedCallback",value:function(){this.render(),this._mounted=!0}},{key:"version",get:function(){return"".concat("3.1.228-rc".trim())}},{key:"render",value:function(){this._root.render(P.jsxs("div",{part:"idv",className:"idv",style:{backgroundColor:"white",height:"100%"},children:[P.jsx("style",{nonce:Jr.getState().getNonce(),children:Uk}),P.jsx(Pk,{})]}))}},{key:"disconnectedCallback",value:function(){var o=this;setTimeout(function(){o._mounted&&(o._mounted=!1,o._root.unmount(),Sa.clearLogs())})}}],[{key:"observedAttributes",get:function(){return[]}}])}(lh(HTMLElement));function hs(r){"@babel/helpers - typeof";return hs=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},hs(r)}function En(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */var r,e,n=typeof Symbol=="function"?Symbol:{},o=n.iterator||"@@iterator",a=n.toStringTag||"@@toStringTag";function s(S,b,w,_){var j=b&&b.prototype instanceof c?b:c,O=Object.create(j.prototype);return _n(O,"_invoke",function(k,T,x){var I,E,R,W=0,Z=x||[],$=!1,N={p:0,n:0,v:r,a:Q,f:Q.bind(r,4),d:function(A,B){return I=A,E=0,R=r,N.n=B,l}};function Q(D,A){for(E=D,R=A,e=0;!$&&W&&!B&&e<Z.length;e++){var B,U=Z[e],G=N.p,z=U[2];D>3?(B=z===A)&&(R=U[(E=U[4])?5:(E=3,3)],U[4]=U[5]=r):U[0]<=G&&((B=D<2&&G<U[1])?(E=0,N.v=A,N.n=U[1]):G<z&&(B=D<3||U[0]>A||A>z)&&(U[4]=D,U[5]=A,N.n=z,E=0))}if(B||D>1)return l;throw $=!0,A}return function(D,A,B){if(W>1)throw TypeError("Generator is already running");for($&&A===1&&Q(A,B),E=A,R=B;(e=E<2?r:R)||!$;){I||(E?E<3?(E>1&&(N.n=-1),Q(E,R)):N.n=R:N.v=R);try{if(W=2,I){if(E||(D="next"),e=I[D]){if(!(e=e.call(I,R)))throw TypeError("iterator result is not an object");if(!e.done)return e;R=e.value,E<2&&(E=0)}else E===1&&(e=I.return)&&e.call(I),E<2&&(R=TypeError("The iterator does not provide a '"+D+"' method"),E=1);I=r}else if((e=($=N.n<0)?R:k.call(T,N))!==l)break}catch(U){I=r,E=1,R=U}finally{W=1}}return{value:e,done:$}}}(S,w,_),!0),O}var l={};function c(){}function d(){}function v(){}e=Object.getPrototypeOf;var y=[][o]?e(e([][o]())):(_n(e={},o,function(){return this}),e),h=v.prototype=c.prototype=Object.create(y);function m(S){return Object.setPrototypeOf?Object.setPrototypeOf(S,v):(S.__proto__=v,_n(S,a,"GeneratorFunction")),S.prototype=Object.create(h),S}return d.prototype=v,_n(h,"constructor",v),_n(v,"constructor",d),d.displayName="GeneratorFunction",_n(v,a,"GeneratorFunction"),_n(h),_n(h,a,"Generator"),_n(h,o,function(){return this}),_n(h,"toString",function(){return"[object Generator]"}),(En=function(){return{w:s,m}})()}function _n(r,e,n,o){var a=Object.defineProperty;try{a({},"",{})}catch(s){a=0}_n=function(l,c,d,v){function y(h,m){_n(l,h,function(S){return this._invoke(h,m,S)})}c?a?a(l,c,{value:d,enumerable:!v,configurable:!v,writable:!v}):l[c]=d:(y("next",0),y("throw",1),y("return",2))},_n(r,e,n,o)}function h3(r,e,n,o,a,s,l){try{var c=r[s](l),d=c.value}catch(v){return void n(v)}c.done?e(d):Promise.resolve(d).then(o,a)}function Ea(r){return function(){var e=this,n=arguments;return new Promise(function(o,a){var s=r.apply(e,n);function l(d){h3(s,o,a,l,c,"next",d)}function c(d){h3(s,o,a,l,c,"throw",d)}l(void 0)})}}function qk(r,e){if(!(r instanceof e))throw new TypeError("Cannot call a class as a function")}function $k(r,e){for(var n=0;n<e.length;n++){var o=e[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(r,Vk(o.key),o)}}function Bk(r,e,n){return e&&$k(r.prototype,e),Object.defineProperty(r,"prototype",{writable:!1}),r}function Vk(r){var e=Wk(r,"string");return hs(e)=="symbol"?e:e+""}function Wk(r,e){if(hs(r)!="object"||!r)return r;var n=r[Symbol.toPrimitive];if(n!==void 0){var o=n.call(r,e);if(hs(o)!="object")return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(r)}var zk=function(){function r(){qk(this,r)}return Bk(r,[{key:"initialize",value:function(){var e=Ea(En().m(function o(a){var s;return En().w(function(l){for(;;)switch(l.n){case 0:return s=Jr.getState().initialize(a),l.a(2,s)}},o)}));function n(o){return e.apply(this,arguments)}return n}()},{key:"configure",value:function(){var e=Ea(En().m(function o(a){var s,l,c;return En().w(function(d){for(;;)switch(d.n){case 0:if(!("userName"in a)){d.n=2;break}return d.n=1,Jr.getState().configureByUserPass(a);case 1:return s=d.v,d.a(2,s);case 2:if(!("apiKey"in a)){d.n=4;break}return d.n=3,Jr.getState().configureByApiKey(a);case 3:return l=d.v,d.a(2,l);case 4:if(!("url"in a&&Object.keys(a).length===1)){d.n=6;break}return d.n=5,Jr.getState().configureWithUrl(a.url);case 5:return c=d.v,d.a(2,c);case 6:return d.a(2,{error:new kt({errorCode:Ft.CONFIG_MISSED_OR_INVALID,message:"No valid config found"})})}},o)}));function n(o){return e.apply(this,arguments)}return n}()},{key:"getWorkFlows",value:function(){var e=Ea(En().m(function o(a){var s;return En().w(function(l){for(;;)switch(l.n){case 0:return l.n=1,Jr.getState().getWorkflows(a);case 1:return s=l.v,l.a(2,s)}},o)}));function n(o){return e.apply(this,arguments)}return n}()},{key:"prepareWorkflow",value:function(){var e=Ea(En().m(function o(a){var s,l;return En().w(function(c){for(;;)switch(c.n){case 0:return s=a.workflowId,c.n=1,Jr.getState().prepareWorkflowAndPrepareUi(s);case 1:return l=c.v,c.a(2,l)}},o)}));function n(o){return e.apply(this,arguments)}return n}()},{key:"startWorkflow",value:function(){var e=Ea(En().m(function o(a){return En().w(function(s){for(;;)switch(s.n){case 0:return s.a(2,new Promise(function(l){var c=function(m){l(m)},d=a==null?void 0:a.locale,v=a==null?void 0:a.metadata,y=Z5(d);Jr.getState().startNewSession(c,y,v).then(function(h){h.error&&(Jr.getState().removeCurrentSessionDataLsAndStore(),c(h)),h.results&&(Jr.getState().removeCurrentSessionDataLsAndStore(),c(h)),Jr.getState().playWorkflow()})}))}},o)}));function n(o){return e.apply(this,arguments)}return n}()},{key:"deinitialize",value:function(){var e=Ea(En().m(function o(){var a;return En().w(function(s){for(;;)switch(s.n){case 0:return s.n=1,Jr.getState().deinitialize();case 1:return a=s.v,s.a(2,a)}},o)}));function n(){return e.apply(this,arguments)}return n}()},{key:"version",get:function(){var n;return(n="3.1.228-rc")!==null&&n!==void 0?n:"Version unavailable. Something went wrong"}},{key:"nonce",set:function(n){Jr.getState().setNonce(n)}},{key:"eventListener",set:function(n){if(!n||typeof n!="function"){console.warn("IdvIntegrationService:: listener is not a function");return}Jr.getState().setListener(n)}},{key:"sessionRestoreMode",set:function(n){Jr.getState().setSessionRestoreMode(n)}}])}(),Hk=window.customElements.get("idv-flow");return Hk||window.customElements.define("idv-flow",y3),_r.ConnectionError=ki,_r.DeinitializationError=Eu,_r.IdvEventTypesEnum=bu,_r.IdvIntegrationService=zk,_r.IdvServiceMessages=ta,_r.IdvWebComponent=y3,_r.InitializeError=wu,_r.PrepareWorkflowError=ti,_r.SessionError=jn,_r.StartSessionError=Ki,_r.WorkflowError=Pt,_r.WorkflowPlatformError=Bn,Object.defineProperty(_r,Symbol.toStringTag,{value:"Module"}),_r}({});
|
|
83
|
+
`),o=new Blob([n],{type:"text/plain"}),a=window.URL.createObjectURL(o),s=document.createElement("a");s.download="log.txt",s.href=a,s.click(),window.URL.revokeObjectURL(a),this.clearLogs()}}}])}(),Sa=new lk;function ls(r){"@babel/helpers - typeof";return ls=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},ls(r)}function n3(r,e){var n=Object.keys(r);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(r);e&&(o=o.filter(function(a){return Object.getOwnPropertyDescriptor(r,a).enumerable})),n.push.apply(n,o)}return n}function ck(r){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?n3(Object(n),!0).forEach(function(o){Io(r,o,n[o])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(n)):n3(Object(n)).forEach(function(o){Object.defineProperty(r,o,Object.getOwnPropertyDescriptor(n,o))})}return r}function wr(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */var r,e,n=typeof Symbol=="function"?Symbol:{},o=n.iterator||"@@iterator",a=n.toStringTag||"@@toStringTag";function s(S,b,w,_){var j=b&&b.prototype instanceof c?b:c,O=Object.create(j.prototype);return Sn(O,"_invoke",function(k,T,x){var I,E,R,W=0,Z=x||[],$=!1,N={p:0,n:0,v:r,a:Q,f:Q.bind(r,4),d:function(A,B){return I=A,E=0,R=r,N.n=B,l}};function Q(D,A){for(E=D,R=A,e=0;!$&&W&&!B&&e<Z.length;e++){var B,U=Z[e],G=N.p,z=U[2];D>3?(B=z===A)&&(R=U[(E=U[4])?5:(E=3,3)],U[4]=U[5]=r):U[0]<=G&&((B=D<2&&G<U[1])?(E=0,N.v=A,N.n=U[1]):G<z&&(B=D<3||U[0]>A||A>z)&&(U[4]=D,U[5]=A,N.n=z,E=0))}if(B||D>1)return l;throw $=!0,A}return function(D,A,B){if(W>1)throw TypeError("Generator is already running");for($&&A===1&&Q(A,B),E=A,R=B;(e=E<2?r:R)||!$;){I||(E?E<3?(E>1&&(N.n=-1),Q(E,R)):N.n=R:N.v=R);try{if(W=2,I){if(E||(D="next"),e=I[D]){if(!(e=e.call(I,R)))throw TypeError("iterator result is not an object");if(!e.done)return e;R=e.value,E<2&&(E=0)}else E===1&&(e=I.return)&&e.call(I),E<2&&(R=TypeError("The iterator does not provide a '"+D+"' method"),E=1);I=r}else if((e=($=N.n<0)?R:k.call(T,N))!==l)break}catch(U){I=r,E=1,R=U}finally{W=1}}return{value:e,done:$}}}(S,w,_),!0),O}var l={};function c(){}function d(){}function v(){}e=Object.getPrototypeOf;var y=[][o]?e(e([][o]())):(Sn(e={},o,function(){return this}),e),h=v.prototype=c.prototype=Object.create(y);function m(S){return Object.setPrototypeOf?Object.setPrototypeOf(S,v):(S.__proto__=v,Sn(S,a,"GeneratorFunction")),S.prototype=Object.create(h),S}return d.prototype=v,Sn(h,"constructor",v),Sn(v,"constructor",d),d.displayName="GeneratorFunction",Sn(v,a,"GeneratorFunction"),Sn(h),Sn(h,a,"Generator"),Sn(h,o,function(){return this}),Sn(h,"toString",function(){return"[object Generator]"}),(wr=function(){return{w:s,m}})()}function Sn(r,e,n,o){var a=Object.defineProperty;try{a({},"",{})}catch(s){a=0}Sn=function(l,c,d,v){function y(h,m){Sn(l,h,function(S){return this._invoke(h,m,S)})}c?a?a(l,c,{value:d,enumerable:!v,configurable:!v,writable:!v}):l[c]=d:(y("next",0),y("throw",1),y("return",2))},Sn(r,e,n,o)}function i3(r,e,n,o,a,s,l){try{var c=r[s](l),d=c.value}catch(v){return void n(v)}c.done?e(d):Promise.resolve(d).then(o,a)}function Et(r){return function(){var e=this,n=arguments;return new Promise(function(o,a){var s=r.apply(e,n);function l(d){i3(s,o,a,l,c,"next",d)}function c(d){i3(s,o,a,l,c,"throw",d)}l(void 0)})}}function fk(r,e){if(!(r instanceof e))throw new TypeError("Cannot call a class as a function")}function dk(r,e){for(var n=0;n<e.length;n++){var o=e[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(r,o3(o.key),o)}}function vk(r,e,n){return e&&dk(r.prototype,e),Object.defineProperty(r,"prototype",{writable:!1}),r}function Io(r,e,n){return(e=o3(e))in r?Object.defineProperty(r,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):r[e]=n,r}function o3(r){var e=pk(r,"string");return ls(e)=="symbol"?e:e+""}function pk(r,e){if(ls(r)!="object"||!r)return r;var n=r[Symbol.toPrimitive];if(n!==void 0){var o=n.call(r,e);if(ls(o)!="object")return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(r)}var ba=Sa.create("session_log"),yk=function(){function r(e){fk(this,r),Io(this,"_worker",null),Io(this,"_initialized",!1),Io(this,"_connectedToIdv",!1),Io(this,"_serviceRunning",!1),Io(this,"_userId",H5(VR)),Io(this,"_setErrorScreen",null),e&&(this._setErrorScreen=e)}return vk(r,[{key:"init",value:function(){var e=Et(wr().m(function o(){var a,s,l,c,d;return wr().w(function(v){for(;;)switch(v.p=v.n){case 0:return v.p=1,v.n=2,fetch("https://wasm.regulaforensics.com/idv/release/3.1/2e218c7-05ea45dc//PlatformAdaptor.worker.js");case 2:return a=v.v,v.n=3,a.blob();case 3:s=v.v,l=URL.createObjectURL(s),this._worker=new Worker(l),v.n=5;break;case 4:v.p=4,d=v.v,console.log("Creating worker error: ".concat(JSON.stringify(d)));case 5:v.n=7;break;case 6:this._worker=new Worker("./PlatformAdaptor.worker.js");case 7:if(this._worker){v.n=8;break}return v.a(2);case 8:return this._worker.postMessage({target:"gl",op:"setPrefetched",preMain:!0}),v.n=9,this.sendMessage({target:"worker-init",URL:document.URL,currentScriptUrl:"https://wasm.regulaforensics.com/idv/release/3.1/2e218c7-05ea45dc/",preMain:!0});case 9:return c=v.v,v.a(2,c)}},o,this,[[1,4]])}));function n(){return e.apply(this,arguments)}return n}()},{key:"connectByUserPass",value:function(){var e=Et(wr().m(function o(a){var s,l,c;return wr().w(function(d){for(;;)switch(d.n){case 0:return d.n=1,this.sendMessage({target:"custom",method:"connect_idv",connectionParams:{deviceDescriptor:{deviceId:this._userId,deviceType:Su.deviceType,serial:"",macAddress:"00:00:00:00:00:00",heartbeatCadence:2},host:a.host,httpRetryCount:0,httpTimeoutMs:0,isSecure:(s=a.isSecure)!==null&&s!==void 0?s:!0,password:a.password,port:(l=a.port)!==null&&l!==void 0?l:0,schema:"basic",userName:a.userName},preMain:!0});case 1:return c=d.v,c.code===0&&(this._serviceRunning=!0,this._connectedToIdv=!0),d.a(2,c)}},o,this)}));function n(o){return e.apply(this,arguments)}return n}()},{key:"connectByApiKey",value:function(){var e=Et(wr().m(function o(a){var s,l,c;return wr().w(function(d){for(;;)switch(d.n){case 0:return d.n=1,this.sendMessage({target:"custom",method:"connect_by_api_key",connectByApiKeyParams:{isSecure:(s=a.isSecure)!==null&&s!==void 0?s:!0,host:a.host,port:(l=a.port)!==null&&l!==void 0?l:0,httpRetryCount:0,httpTimeoutMs:0,deviceDescriptor:ck({deviceId:this._userId,deviceType:Su.deviceType,serial:"",macAddress:"00:00:00:00:00:00",heartbeatCadence:100,metadata:{}},a.deviceDescriptor),apiKey:a.apiKey,authToken:a.authToken},preMain:!0});case 1:return c=d.v,c.code===0&&(this._serviceRunning=!0,this._connectedToIdv=!0),d.a(2,c)}},o,this)}));function n(o){return e.apply(this,arguments)}return n}()},{key:"connectByUrl",value:function(){var e=Et(wr().m(function o(a){var s;return wr().w(function(l){for(;;)switch(l.n){case 0:return l.n=1,this.sendMessage({target:"custom",method:"connect_by_url",connectByUrlParams:{deviceDescriptor:{deviceId:this._userId,deviceType:Su.deviceType,serial:"",macAddress:"00:00:00:00:00:00",heartbeatCadence:2},httpRetryCount:5,httpTimeoutMs:1e3,url:a},preMain:!0});case 1:return s=l.v,s.code===0&&(this._serviceRunning=!0,this._connectedToIdv=!0),l.a(2,s)}},o,this)}));function n(o){return e.apply(this,arguments)}return n}()},{key:"startSession",value:function(){var e=Et(wr().m(function o(a,s,l){var c,d;return wr().w(function(v){for(;;)switch(v.n){case 0:return c={workflowId:a,locale:s},G5(l)&&(c.metadata=l),v.n=1,this.sendMessage({target:"custom",method:"start_session",sessionParams:c,preMain:!0});case 1:return d=v.v,d.code===0&&(Sa.clearLogs(),ba("Command: 5. Result code: ".concat(d.code,". Session id: ").concat(d.data.id,". Cur step: ").concat(d.data.currentStep,"."))),v.a(2,d)}},o,this)}));function n(o,a,s){return e.apply(this,arguments)}return n}()},{key:"continueSession",value:function(){var e=Et(wr().m(function o(a,s){var l,c;return wr().w(function(d){for(;;)switch(d.n){case 0:return l={sessionId:a,locale:s},d.n=1,this.sendMessage({continueParams:l,target:"custom",method:"continue_session",preMain:!0});case 1:return c=d.v,c.code===0&&(Sa.clearLogs(),ba("Command: 10. Result code: ".concat(c.code,". Session id: ").concat(c.data.id,". Cur step: ").concat(c.data.currentStep,"."))),d.a(2,c)}},o,this)}));function n(o,a){return e.apply(this,arguments)}return n}()},{key:"listWorkflows",value:function(){var e=Et(wr().m(function o(){var a,s,l=arguments;return wr().w(function(c){for(;;)switch(c.n){case 0:return a=l.length>0&&l[0]!==void 0?l[0]:{limit:0,skip:0},c.n=1,this.sendMessage({workflowsParams:a,target:"custom",method:"list_workflows",preMain:!0});case 1:return s=c.v,c.a(2,s)}},o,this)}));function n(){return e.apply(this,arguments)}return n}()},{key:"getHealth",value:function(){var e=Et(wr().m(function o(){var a;return wr().w(function(s){for(;;)switch(s.n){case 0:return s.n=1,this.sendMessage({target:"custom",method:"get_health",preMain:!0});case 1:return a=s.v,s.a(2,a)}},o,this)}));function n(){return e.apply(this,arguments)}return n}()},{key:"getServiceToken",value:function(){var e=Et(wr().m(function o(){var a;return wr().w(function(s){for(;;)switch(s.n){case 0:return s.n=1,this.sendMessage({target:"custom",method:"get_service_token",preMain:!0});case 1:return a=s.v,s.a(2,a)}},o,this)}));function n(){return e.apply(this,arguments)}return n}()},{key:"abandonSession",value:function(){var e=Et(wr().m(function o(){var a;return wr().w(function(s){for(;;)switch(s.n){case 0:return s.n=1,this.sendMessage({target:"custom",method:"abandon_session",preMain:!0});case 1:return a=s.v,s.a(2,a)}},o,this)}));function n(){return e.apply(this,arguments)}return n}()},{key:"getWorkflow",value:function(){var e=Et(wr().m(function o(a){var s;return wr().w(function(l){for(;;)switch(l.n){case 0:return l.n=1,this.sendMessage({workflowIdParams:{workflowId:a},target:"custom",method:"get_workflow",preMain:!0});case 1:return s=l.v,l.a(2,s)}},o,this)}));function n(o){return e.apply(this,arguments)}return n}()},{key:"pushData",value:function(){var e=Et(wr().m(function o(a,s){var l;return wr().w(function(c){for(;;)switch(c.n){case 0:return ba("Command: 9. Request payload: ".concat(JSON.stringify(s))),c.n=1,this.sendMessage({target:"custom",method:"push_data",pushDataParams:{data:s,stage:0,step:a},preMain:!0});case 1:return l=c.v,ba("Command: 9. Result code: ".concat(l.code)),c.a(2,l)}},o,this)}));function n(o,a){return e.apply(this,arguments)}return n}()},{key:"getSessionState",value:function(){var e=Et(wr().m(function o(){var a;return wr().w(function(s){for(;;)switch(s.n){case 0:return s.n=1,this.sendMessage({target:"custom",method:"get_session_state",preMain:!0});case 1:return a=s.v,ba("Command: 7. Result code: ".concat(a.code,". Cur step: ").concat(a.data.currentStep,". Proc files: ").concat(a.data.isProcessingFiles)),s.a(2,a)}},o,this)}));function n(){return e.apply(this,arguments)}return n}()},{key:"waitForSessionUpdate",value:function(){var e=Et(wr().m(function o(){var a;return wr().w(function(s){for(;;)switch(s.n){case 0:return s.n=1,this.sendMessage({waitingSessionParams:{periodMs:1e3},target:"custom",method:"wait_for_session_update",preMain:!0});case 1:return a=s.v,ba("Command: 8. Result code: ".concat(a.code)),s.a(2,a)}},o,this)}));function n(){return e.apply(this,arguments)}return n}()},{key:"pushSessionLogs",value:function(){var e=Et(wr().m(function o(a){var s;return wr().w(function(l){for(;;)switch(l.n){case 0:return l.n=1,this.sendMessage({target:"custom",method:"push_session_logs",pushSessionLogsParams:a,preMain:!0});case 1:return s=l.v,l.a(2,s)}},o,this)}));function n(o){return e.apply(this,arguments)}return n}()},{key:"disconnect",value:function(){var e=Et(wr().m(function o(){var a;return wr().w(function(s){for(;;)switch(s.n){case 0:return s.n=1,this.sendMessage({target:"custom",method:"disconnect",preMain:!0});case 1:return a=s.v,this._connectedToIdv=!1,this._serviceRunning=!1,s.a(2,a)}},o,this)}));function n(){return e.apply(this,arguments)}return n}()},{key:"sendMessage",value:function(){var e=Et(wr().m(function o(a){var s=this;return wr().w(function(l){for(;;)switch(l.n){case 0:return l.a(2,new Promise(function(c,d){if(!s._worker)return d();s._worker.onmessage=function(v){var y=v.data.target;if(y!=="stdout"){if(y==="custom"){var h=v.data,m=h.method,S=h.data;m==="onRuntimeInitialized"&&(s._initialized=!0),c(S)}if(y==="stderr"){var b=v.data.content;s._setErrorScreen&&s._setErrorScreen(b)}}},s._worker.postMessage(a)}))}},o)}));function n(o){return e.apply(this,arguments)}return n}()},{key:"isServiceRunning",value:function(){return this._serviceRunning}},{key:"isServiceConnected",value:function(){return this._connectedToIdv}},{key:"terminateWorker",value:function(){if(this.isServiceRunning()){var n;(n=this._worker)===null||n===void 0||n.terminate(),this._serviceRunning=!1,this._initialized=!1,this._connectedToIdv=!1}}},{key:"shutdown",value:function(){var e=Et(wr().m(function o(){var a;return wr().w(function(s){for(;;)switch(s.n){case 0:if(this._worker){s.n=1;break}return s.a(2,{code:0});case 1:if(this._connectedToIdv){s.n=2;break}return this.terminateWorker(),s.a(2,{code:0});case 2:return s.n=3,this.disconnect();case 3:return a=s.v,this.terminateWorker(),s.a(2,a)}},o,this)}));function n(){return e.apply(this,arguments)}return n}()}])}();function cs(r){"@babel/helpers - typeof";return cs=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},cs(r)}function a3(r,e){var n=Object.keys(r);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(r);e&&(o=o.filter(function(a){return Object.getOwnPropertyDescriptor(r,a).enumerable})),n.push.apply(n,o)}return n}function fs(r){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?a3(Object(n),!0).forEach(function(o){hk(r,o,n[o])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(n)):a3(Object(n)).forEach(function(o){Object.defineProperty(r,o,Object.getOwnPropertyDescriptor(n,o))})}return r}function hk(r,e,n){return(e=mk(e))in r?Object.defineProperty(r,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):r[e]=n,r}function mk(r){var e=gk(r,"string");return cs(e)=="symbol"?e:e+""}function gk(r,e){if(cs(r)!="object"||!r)return r;var n=r[Symbol.toPrimitive];if(n!==void 0){var o=n.call(r,e);if(cs(o)!="object")return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}function qr(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */var r,e,n=typeof Symbol=="function"?Symbol:{},o=n.iterator||"@@iterator",a=n.toStringTag||"@@toStringTag";function s(S,b,w,_){var j=b&&b.prototype instanceof c?b:c,O=Object.create(j.prototype);return bn(O,"_invoke",function(k,T,x){var I,E,R,W=0,Z=x||[],$=!1,N={p:0,n:0,v:r,a:Q,f:Q.bind(r,4),d:function(A,B){return I=A,E=0,R=r,N.n=B,l}};function Q(D,A){for(E=D,R=A,e=0;!$&&W&&!B&&e<Z.length;e++){var B,U=Z[e],G=N.p,z=U[2];D>3?(B=z===A)&&(R=U[(E=U[4])?5:(E=3,3)],U[4]=U[5]=r):U[0]<=G&&((B=D<2&&G<U[1])?(E=0,N.v=A,N.n=U[1]):G<z&&(B=D<3||U[0]>A||A>z)&&(U[4]=D,U[5]=A,N.n=z,E=0))}if(B||D>1)return l;throw $=!0,A}return function(D,A,B){if(W>1)throw TypeError("Generator is already running");for($&&A===1&&Q(A,B),E=A,R=B;(e=E<2?r:R)||!$;){I||(E?E<3?(E>1&&(N.n=-1),Q(E,R)):N.n=R:N.v=R);try{if(W=2,I){if(E||(D="next"),e=I[D]){if(!(e=e.call(I,R)))throw TypeError("iterator result is not an object");if(!e.done)return e;R=e.value,E<2&&(E=0)}else E===1&&(e=I.return)&&e.call(I),E<2&&(R=TypeError("The iterator does not provide a '"+D+"' method"),E=1);I=r}else if((e=($=N.n<0)?R:k.call(T,N))!==l)break}catch(U){I=r,E=1,R=U}finally{W=1}}return{value:e,done:$}}}(S,w,_),!0),O}var l={};function c(){}function d(){}function v(){}e=Object.getPrototypeOf;var y=[][o]?e(e([][o]())):(bn(e={},o,function(){return this}),e),h=v.prototype=c.prototype=Object.create(y);function m(S){return Object.setPrototypeOf?Object.setPrototypeOf(S,v):(S.__proto__=v,bn(S,a,"GeneratorFunction")),S.prototype=Object.create(h),S}return d.prototype=v,bn(h,"constructor",v),bn(v,"constructor",d),d.displayName="GeneratorFunction",bn(v,a,"GeneratorFunction"),bn(h),bn(h,a,"Generator"),bn(h,o,function(){return this}),bn(h,"toString",function(){return"[object Generator]"}),(qr=function(){return{w:s,m}})()}function bn(r,e,n,o){var a=Object.defineProperty;try{a({},"",{})}catch(s){a=0}bn=function(l,c,d,v){function y(h,m){bn(l,h,function(S){return this._invoke(h,m,S)})}c?a?a(l,c,{value:d,enumerable:!v,configurable:!v,writable:!v}):l[c]=d:(y("next",0),y("throw",1),y("return",2))},bn(r,e,n,o)}function u3(r,e,n,o,a,s,l){try{var c=r[s](l),d=c.value}catch(v){return void n(v)}c.done?e(d):Promise.resolve(d).then(o,a)}function wn(r){return function(){var e=this,n=arguments;return new Promise(function(o,a){var s=r.apply(e,n);function l(d){u3(s,o,a,l,c,"next",d)}function c(d){u3(s,o,a,l,c,"throw",d)}l(void 0)})}}var Sk=function(e,n){return{wasmService:null,isProcessing:!1,isFinalWaitingUi:!1,setAndInitWasmService:function(){var o=wn(qr().m(function s(){var l;return qr().w(function(c){for(;;)switch(c.n){case 0:return l=new yk,c.n=1,l.init();case 1:e({wasmService:l});case 2:return c.a(2)}},s)}));function a(){return o.apply(this,arguments)}return a}(),setFinalWaitingUi:function(a){e({isFinalWaitingUi:a})},connectByApiKey:function(a){return wn(qr().m(function s(){var l,c,d,v,y;return qr().w(function(h){for(;;)switch(h.n){case 0:return l=n().wasmService,h.n=1,l.connectByApiKey(a);case 1:if(c=h.v,d=null,c.code===4&&(d=ki.HTTP_ISSUE),c.code!==0&&c.code!==4&&(d=ki.PROVIDER_ERROR),d===null){h.n=2;break}return v=new sa({errorCode:d}),y=new Lu({errorCode:cl.CONNECTION_ISSUE,underlyingBaseError:v}),h.a(2,{error:y});case 2:return h.a(2,c.data);case 3:return h.a(2)}},s)}))()},connectByUserPass:function(a){return wn(qr().m(function s(){var l,c,d;return qr().w(function(v){for(;;)switch(v.n){case 0:return v.n=1,n().wasmService.connectByUserPass(a);case 1:if(l=v.v,c=null,l.code===4&&(c=ki.HTTP_ISSUE),l.code!==0&&l.code!==4&&(c=ki.PROVIDER_ERROR),c===null){v.n=2;break}return d=new sa({errorCode:c}),v.a(2,{error:d});case 2:return v.a(2,{})}},s)}))()},connectByUrl:function(a){return wn(qr().m(function s(){var l,c,d,v,y;return qr().w(function(h){for(;;)switch(h.n){case 0:return l=n().wasmService,h.n=1,l.connectByUrl(a);case 1:if(c=h.v,d=null,c.code===4&&(d=ki.HTTP_ISSUE),c.code!==0&&c.code!==4&&(d=ki.PROVIDER_ERROR),d===null){h.n=2;break}return v=new sa({errorCode:d}),y=new Lu({errorCode:cl.CONNECTION_ISSUE,underlyingBaseError:v}),h.a(2,{workflows:[],error:y});case 2:return h.a(2,{workflows:c.data});case 3:return h.a(2)}},s)}))()},workflowSessionCompletion:function(){},setWorkflowSessionCompletion:function(a){var s=function(c){var d,v=(d=n().currentSessionData)===null||d===void 0?void 0:d.sessionId,y=fs(fs({},c.results),{},{sessionId:v}),h=fs({results:y},c.error&&{error:c.error});if(n().removeCurrentSessionDataLsAndStore(),a(h),c.error){var m=Sa.getLogs(),S=m.join("; ");n().wasmService.pushSessionLogs({sessionId:v,body:{log:S,errorCode:c.error.shortChain,deviceInfo:{platform:"Web"}}})}Sa.clearLogs()};e(function(){return{workflowSessionCompletion:s}})},loadModules:function(){var o=wn(qr().m(function s(l){var c,d,v;return qr().w(function(y){for(;;)switch(y.p=y.n){case 0:return y.p=0,y.n=1,bk(l);case 1:return c=y.v,e(function(){return{externalModules:c}}),y.a(2,{});case 2:return y.p=2,y.v,(d=n().wasmService)===null||d===void 0||d.shutdown(),n().resetWasmService(),n().resetProps(),v=new Du({errorCode:wu.MODULES_INSTANTIATION_FAILURE}),y.a(2,{error:v})}},s,null,[[0,2]])}));function a(s){return o.apply(this,arguments)}return a}(),setProcessingTemplate:function(a){var s=wy(a.find(function(l){return l.templateId===op}));s.templateLayout=u_(s.templateLayout,n().layout),e({processingTransformedTemplate:s})},setIsProcessing:function(a){e({isProcessing:a})},_pushStep:function(){var o=wn(qr().m(function s(l,c){var d,v,y;return qr().w(function(h){for(;;)switch(h.n){case 0:return d=null,v=function(){var m=wn(qr().m(function S(){var b,w,_,j;return qr().w(function(O){for(;;)switch(O.n){case 0:return O.n=1,n().wasmService.pushData(l,c);case 1:if(b=O.v,w=null,b.code===4&&(w=jn.HTTP_ISSUE),b.code!==0&&b.code!==4&&(w=jn.PROVIDER_ERROR),w!==null&&(_=new la({errorCode:jn.HTTP_ISSUE}),j=new xt({errorCode:Pt.INTERNAL_ISSUE,message:"Error from external module",underlyingBaseError:_}),d=j),b.code!==0){O.n=2;break}return d=null,O.a(2,b);case 2:return O.a(2,null);case 3:return O.a(2)}},S)}));return function(){return m.apply(this,arguments)}}(),y=function(){return null},h.n=1,s_(v,y);case 1:return h.a(2,d?{error:d}:{})}},s)}));function a(s,l){return o.apply(this,arguments)}return a}(),_findStepById:function(a){var s=n().workflow;if(!s||!a)return null;var l=s.steps.find(function(c){return c.id===a});return l!=null?l:null},_waitingForNextStep:function(){var o=wn(qr().m(function s(){var l,c,d,v;return qr().w(function(y){for(;;)switch(y.n){case 0:return l=null,c=null,d=function(){var h=wn(qr().m(function m(){var S,b,w,_,j,O,k,T,x,I,E,R,W,Z;return qr().w(function($){for(;;)switch($.n){case 0:return $.n=1,n().wasmService.getSessionState();case 1:if(_=$.v,j=(S=_.data)===null||S===void 0?void 0:S.currentStep,O=(b=_.data)===null||b===void 0?void 0:b.isProcessingFiles,k=(w=_.data)===null||w===void 0||(w=w.workflow)===null||w===void 0?void 0:w.steps,T=W5(k,j),x=_.code===4,I=_.code!==0&&_.code!==4,E=_.code===0&&(!_.data.workflow||!_.data.currentStep),R=null,k&&!T&&(R=jn.NOT_DATA_TYPE),x&&(R=jn.HTTP_ISSUE),I&&(R=jn.PROVIDER_ERROR),O&&(R=jn.IS_PROCESSING),E&&(R=jn.DECODING_FAILED),R!==null&&(W=new la({errorCode:R}),Z=new xt({errorCode:Pt.INTERNAL_ISSUE,underlyingBaseError:W}),l=Z),!(T&&!O&&!x&&!I&&!E)){$.n=2;break}return l=null,$.a(2,_.data);case 2:return $.a(2,null)}},m)}));return function(){return h.apply(this,arguments)}}(),y.n=1,new Promise(function(h){var m=1e4,S=6,b=0,w,_=function(){var O=wn(qr().m(function k(T){return qr().w(function(x){for(;;)switch(x.n){case 0:if(!T){x.n=1;break}return w=window.setTimeout(function(){_(!1)},m),x.a(2);case 1:return x.n=2,d();case 2:c=x.v,b++,!c&&b<S?w=window.setTimeout(function(){_(!1)},m):(Eo.clearSubscriptions(),h());case 3:return x.a(2)}},k)}));return function(T){return O.apply(this,arguments)}}();if(Eo.isConnected()){var j=function(k){var T=JSON.parse(atob(JSON.parse(k).payload));T.eventType==="SESSION_UPDATED"&&(clearTimeout(w),_(!1))};Eo.onMessage(j)}_(!0)});case 1:if(!l){y.n=2;break}return y.a(2,{error:l});case 2:if(!c){y.n=3;break}return y.a(2,{sessionData:c});case 3:return l=new la({errorCode:jn.DECODING_FAILED}),v=new xt({errorCode:Pt.INTERNAL_ISSUE,underlyingBaseError:l}),y.a(2,{error:v})}},s)}));function a(){return o.apply(this,arguments)}return a}(),setFinalStepAndStopProcess:function(a){var s=a||n().currentStepId;if(s){var l=n()._findStepById(s);l&&(n().workflowSessionCompletion({results:{finalStep:{id:l.id,name:l.name,final:l.final}}}),n().resetSession(),n().listener({eventType:bu.MESSAGE,message:ta.DID_END_SESSION,module:"IDV"}))}},setNextStep:function(a,s,l){n().setWorkflow(a),n().setLayout(a.client.layout),n().setProcessingTemplate(a.client.steps),n().setSessionProperties(s);var c=n()._findStepById(l),d=function(y){return!!y&&Object.prototype.toString.call(y)==="[object Object]"&&y.templateId};if(c!=null&&c.final&&!d(c.client)){n().setFinalStepAndStopProcess(c.id);return}c!=null&&c.final&&d(c.client)&&n().setFinalWaitingUi(!0),n().onChangeScreen(l),n().setIsProcessing(!1)},pushStepWaitNextStepAndSet:function(){var o=wn(qr().m(function s(l){var c,d,v,y,h,m,S,b;return qr().w(function(w){for(;;)switch(w.n){case 0:if(c=n().currentStepId,c){w.n=1;break}return w.a(2);case 1:if(n().setIsProcessing(!0),!n().isFinalWaitingUi){w.n=2;break}return n().setFinalStepAndStopProcess(),w.a(2);case 2:if(!l.errorCode){w.n=3;break}return d=l,v=new xt({errorCode:Pt.MODULES_ISSUE,message:"Error from external module",underlyingBaseError:d}),n().workflowSessionCompletion({error:v}),n().resetSession(),w.a(2);case 3:return w.n=4,n()._pushStep(c,l);case 4:if(y=w.v,!y.error){w.n=5;break}return n().workflowSessionCompletion({error:y.error}),n().resetSession(),w.a(2);case 5:return w.n=6,n()._waitingForNextStep();case 6:if(h=w.v,!h.error){w.n=7;break}return n().workflowSessionCompletion({error:h.error}),n().resetSession(),w.a(2);case 7:m=h.sessionData.workflow,S=h.sessionData.currentStep,b=h.sessionData.properties,n().setNextStep(m,b,S);case 8:return w.a(2)}},s)}));function a(s){return o.apply(this,arguments)}return a}(),onChangeScreen:function(a){if(!a)return e(function(){return{currentScreenConfig:null}});var s=n().workflow,l=n().sessionProperties,c=null;if(a===op&&n().processingTransformedTemplate!==null){var d=n().processingTransformedTemplate;d&&(c={templateId:d.templateId,templateLayout:d.templateLayout,dataSource:null})}else{var v,y,h=n()._findStepById(a);if(typeof(h==null||(v=h.client)===null||v===void 0?void 0:v.templateId)=="string"){var m;c=fs(fs({},h==null?void 0:h.client),{},{templateId:h.client.templateId,dataSource:(m=h.dataSource)!==null&&m!==void 0?m:null,properties:l})}if(c){var S;c.sessionId=(S=n().currentSessionData)===null||S===void 0?void 0:S.sessionId,c.serviceToken=n().serviceToken}if(c&&K5(h==null||(y=h.client)===null||y===void 0?void 0:y.templateLayout)){var b=u_(h.client.templateLayout,n().layout);b&&(c.templateLayout=b)}}var w=V5(n().externalModules,s.steps,a);if(c===null||!w){var _=new xt({errorCode:Pt.UNKNOWN_STEP,message:"Unsupported step template"});n().workflowSessionCompletion({error:_}),e(function(){return{currentScreenConfig:null}}),n().resetSession();return}n().setCurrentStepId(a),e(function(){return{currentScreenConfig:c}})},deinitializationIdv:function(){var o=wn(qr().m(function s(){var l,c;return qr().w(function(d){for(;;)switch(d.n){case 0:return d.n=1,(l=n().wasmService)===null||l===void 0?void 0:l.shutdown();case 1:if(c=d.v,n().resetWasmService(),n().externalModules.forEach(function(v){v.component.deinitialize&&v.component.isReady&&v.component.deinitialize()}),(c==null?void 0:c.code)!==0){d.n=2;break}return d.a(2,{});case 2:return d.a(2,{})}},s)}));function a(){return o.apply(this,arguments)}return a}(),resetSession:function(){return e(function(){return{isFinalWaitingUi:!1,isProcessing:!1,processingTransformedTemplate:null,currentStepId:null,layout:null,currentScreenConfig:null,workflowId:void 0,workflow:null,serviceToken:void 0}})},resetWasmService:function(){return e(function(){return{wasmService:null}})}}};function bk(r){return uh.apply(this,arguments)}function uh(){return uh=wn(qr().m(function r(e){var n,o,a,s,l;return qr().w(function(c){for(;;)switch(c.n){case 0:for(n=[],o=0,a=e;o<a.length;o++)s=a[o],s&&n.push({id:s.getIdentifier(),supportedTemplates:s.getSupportedTemplates(),component:s});return l=n.filter(function(d){return d!==null}),c.a(2,l)}},r)})),uh.apply(this,arguments)}function ds(r){"@babel/helpers - typeof";return ds=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},ds(r)}function s3(r,e){var n=Object.keys(r);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(r);e&&(o=o.filter(function(a){return Object.getOwnPropertyDescriptor(r,a).enumerable})),n.push.apply(n,o)}return n}function sh(r){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?s3(Object(n),!0).forEach(function(o){wk(r,o,n[o])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(n)):s3(Object(n)).forEach(function(o){Object.defineProperty(r,o,Object.getOwnPropertyDescriptor(n,o))})}return r}function wk(r,e,n){return(e=Ek(e))in r?Object.defineProperty(r,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):r[e]=n,r}function Ek(r){var e=_k(r,"string");return ds(e)=="symbol"?e:e+""}function _k(r,e){if(ds(r)!="object"||!r)return r;var n=r[Symbol.toPrimitive];if(n!==void 0){var o=n.call(r,e);if(ds(o)!="object")return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}var Jr=D8(function(){return sh(sh(sh({},t6.apply(void 0,arguments)),VP.apply(void 0,arguments)),Sk.apply(void 0,arguments))}),Ck=function(e){var n=e.children;return P.jsx("div",{style:{position:"absolute",top:0,left:0,flex:"1 1 100%",display:"flex",justifyContent:"center",alignItems:"center",alignContent:"center",height:"100%",width:"100%",background:"white",zIndex:1e3},children:n})};function vs(r){"@babel/helpers - typeof";return vs=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},vs(r)}function l3(r,e){var n=Object.keys(r);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(r);e&&(o=o.filter(function(a){return Object.getOwnPropertyDescriptor(r,a).enumerable})),n.push.apply(n,o)}return n}function c3(r){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?l3(Object(n),!0).forEach(function(o){Ok(r,o,n[o])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(n)):l3(Object(n)).forEach(function(o){Object.defineProperty(r,o,Object.getOwnPropertyDescriptor(n,o))})}return r}function Ok(r,e,n){return(e=Ik(e))in r?Object.defineProperty(r,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):r[e]=n,r}function Ik(r){var e=Rk(r,"string");return vs(e)=="symbol"?e:e+""}function Rk(r,e){if(vs(r)!="object"||!r)return r;var n=r[Symbol.toPrimitive];if(n!==void 0){var o=n.call(r,e);if(vs(o)!="object")return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}var f3=function(e){var n=e.config,o=e.tagName,a=cr.useRef(null);return cr.useEffect(function(){a.current&&a.current.setProps(n)},[n]),cr.createElement(o,{ref:a,style:{width:"100%",height:"100%"}})},Tk=function(){var e=Jr(function(b){return b.currentScreenConfig}),n=Jr(function(b){return b.pushStepWaitNextStepAndSet}),o=Jr(function(b){return b.processingTransformedTemplate}),a=Jr(function(b){return b.isProcessing}),s=Jr(function(b){return b.setIsProcessing}),l=Jr(function(b){return b.listener}),c=Jr(function(b){return b.externalModules}),d=Jr(function(b){return b.modulesConfig}),v=function(w,_){l({eventType:bu.MESSAGE,message:_,module:w})},y=function(w){s(w)},h=function(w){s(!1),n(w)},m=cr.useCallback(function(){var b=c.find(function(w){return w.supportedTemplates.includes("PROGRESS")});return b&&o?P.jsx(f3,{config:{perform:h,moduleProps:c3(c3({},o),{},{templateId:"PROGRESS"}),modulesConfig:d,idvEventListener:v,isProcessing:y},tagName:b==null?void 0:b.id}):"Processing..."},[c,e,o]),S=cr.useCallback(function(){if(!e)return null;var b=c.find(function(w){return w.supportedTemplates.includes(e.templateId)});if(b&&e)return P.jsx(f3,{config:{perform:h,moduleProps:e,modulesConfig:d,idvEventListener:v,isProcessing:y},tagName:b==null?void 0:b.id})},[e,c]);return!e&&!o?null:P.jsx(P.Fragment,{children:P.jsx(eb,{direction:ip.Ltr,children:P.jsxs(P.Fragment,{children:[a&&P.jsx(Ck,{children:m()}),S()]})})})};function Pk(){return P.jsx(cr.StrictMode,{children:P.jsx(d8,{children:P.jsx(Tk,{})})})}function wa(r){"@babel/helpers - typeof";return wa=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},wa(r)}function kk(r,e){if(!(r instanceof e))throw new TypeError("Cannot call a class as a function")}function d3(r,e){for(var n=0;n<e.length;n++){var o=e[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(r,p3(o.key),o)}}function xk(r,e,n){return e&&d3(r.prototype,e),n&&d3(r,n),Object.defineProperty(r,"prototype",{writable:!1}),r}function jk(r,e,n){return e=ys(e),Ak(r,ch()?Reflect.construct(e,[],ys(r).constructor):e.apply(r,n))}function Ak(r,e){if(e&&(wa(e)=="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Nk(r)}function Nk(r){if(r===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return r}function Dk(r,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");r.prototype=Object.create(e&&e.prototype,{constructor:{value:r,writable:!0,configurable:!0}}),Object.defineProperty(r,"prototype",{writable:!1}),e&&ps(r,e)}function lh(r){var e=typeof Map=="function"?new Map:void 0;return lh=function(o){if(o===null||!Fk(o))return o;if(typeof o!="function")throw new TypeError("Super expression must either be null or a function");if(e!==void 0){if(e.has(o))return e.get(o);e.set(o,a)}function a(){return Lk(o,arguments,ys(this).constructor)}return a.prototype=Object.create(o.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}}),ps(a,o)},lh(r)}function Lk(r,e,n){if(ch())return Reflect.construct.apply(null,arguments);var o=[null];o.push.apply(o,e);var a=new(r.bind.apply(r,o));return n&&ps(a,n.prototype),a}function ch(){try{var r=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(ch=function(){return!!r})()}function Fk(r){try{return Function.toString.call(r).indexOf("[native code]")!==-1}catch(e){return typeof r=="function"}}function ps(r,e){return ps=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,o){return n.__proto__=o,n},ps(r,e)}function ys(r){return ys=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},ys(r)}function v3(r,e,n){return(e=p3(e))in r?Object.defineProperty(r,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):r[e]=n,r}function p3(r){var e=Mk(r,"string");return wa(e)=="symbol"?e:e+""}function Mk(r,e){if(wa(r)!="object"||!r)return r;var n=r[Symbol.toPrimitive];if(n!==void 0){var o=n.call(r,e);if(wa(o)!="object")return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(r)}var Uk="*,::after,::before{box-sizing:border-box}h1,h2,h3,h4,p,ul{padding:0;margin:0}li{list-style:none}:host{display:block;container-type:inline-size;container-name:host;width:100%;height:100%}",y3=function(r){function e(){var n;return kk(this,e),n=jk(this,e),v3(n,"_root",E2.createRoot(n.attachShadow({mode:"open"}))),v3(n,"_mounted",!1),n}return Dk(e,r),xk(e,[{key:"connectedCallback",value:function(){this.render(),this._mounted=!0}},{key:"version",get:function(){return"".concat("3.1.231".trim())}},{key:"render",value:function(){this._root.render(P.jsxs("div",{part:"idv",className:"idv",style:{backgroundColor:"white",height:"100%"},children:[P.jsx("style",{nonce:Jr.getState().getNonce(),children:Uk}),P.jsx(Pk,{})]}))}},{key:"disconnectedCallback",value:function(){var o=this;setTimeout(function(){o._mounted&&(o._mounted=!1,o._root.unmount(),Sa.clearLogs())})}}],[{key:"observedAttributes",get:function(){return[]}}])}(lh(HTMLElement));function hs(r){"@babel/helpers - typeof";return hs=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},hs(r)}function En(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */var r,e,n=typeof Symbol=="function"?Symbol:{},o=n.iterator||"@@iterator",a=n.toStringTag||"@@toStringTag";function s(S,b,w,_){var j=b&&b.prototype instanceof c?b:c,O=Object.create(j.prototype);return _n(O,"_invoke",function(k,T,x){var I,E,R,W=0,Z=x||[],$=!1,N={p:0,n:0,v:r,a:Q,f:Q.bind(r,4),d:function(A,B){return I=A,E=0,R=r,N.n=B,l}};function Q(D,A){for(E=D,R=A,e=0;!$&&W&&!B&&e<Z.length;e++){var B,U=Z[e],G=N.p,z=U[2];D>3?(B=z===A)&&(R=U[(E=U[4])?5:(E=3,3)],U[4]=U[5]=r):U[0]<=G&&((B=D<2&&G<U[1])?(E=0,N.v=A,N.n=U[1]):G<z&&(B=D<3||U[0]>A||A>z)&&(U[4]=D,U[5]=A,N.n=z,E=0))}if(B||D>1)return l;throw $=!0,A}return function(D,A,B){if(W>1)throw TypeError("Generator is already running");for($&&A===1&&Q(A,B),E=A,R=B;(e=E<2?r:R)||!$;){I||(E?E<3?(E>1&&(N.n=-1),Q(E,R)):N.n=R:N.v=R);try{if(W=2,I){if(E||(D="next"),e=I[D]){if(!(e=e.call(I,R)))throw TypeError("iterator result is not an object");if(!e.done)return e;R=e.value,E<2&&(E=0)}else E===1&&(e=I.return)&&e.call(I),E<2&&(R=TypeError("The iterator does not provide a '"+D+"' method"),E=1);I=r}else if((e=($=N.n<0)?R:k.call(T,N))!==l)break}catch(U){I=r,E=1,R=U}finally{W=1}}return{value:e,done:$}}}(S,w,_),!0),O}var l={};function c(){}function d(){}function v(){}e=Object.getPrototypeOf;var y=[][o]?e(e([][o]())):(_n(e={},o,function(){return this}),e),h=v.prototype=c.prototype=Object.create(y);function m(S){return Object.setPrototypeOf?Object.setPrototypeOf(S,v):(S.__proto__=v,_n(S,a,"GeneratorFunction")),S.prototype=Object.create(h),S}return d.prototype=v,_n(h,"constructor",v),_n(v,"constructor",d),d.displayName="GeneratorFunction",_n(v,a,"GeneratorFunction"),_n(h),_n(h,a,"Generator"),_n(h,o,function(){return this}),_n(h,"toString",function(){return"[object Generator]"}),(En=function(){return{w:s,m}})()}function _n(r,e,n,o){var a=Object.defineProperty;try{a({},"",{})}catch(s){a=0}_n=function(l,c,d,v){function y(h,m){_n(l,h,function(S){return this._invoke(h,m,S)})}c?a?a(l,c,{value:d,enumerable:!v,configurable:!v,writable:!v}):l[c]=d:(y("next",0),y("throw",1),y("return",2))},_n(r,e,n,o)}function h3(r,e,n,o,a,s,l){try{var c=r[s](l),d=c.value}catch(v){return void n(v)}c.done?e(d):Promise.resolve(d).then(o,a)}function Ea(r){return function(){var e=this,n=arguments;return new Promise(function(o,a){var s=r.apply(e,n);function l(d){h3(s,o,a,l,c,"next",d)}function c(d){h3(s,o,a,l,c,"throw",d)}l(void 0)})}}function qk(r,e){if(!(r instanceof e))throw new TypeError("Cannot call a class as a function")}function $k(r,e){for(var n=0;n<e.length;n++){var o=e[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(r,Vk(o.key),o)}}function Bk(r,e,n){return e&&$k(r.prototype,e),Object.defineProperty(r,"prototype",{writable:!1}),r}function Vk(r){var e=Wk(r,"string");return hs(e)=="symbol"?e:e+""}function Wk(r,e){if(hs(r)!="object"||!r)return r;var n=r[Symbol.toPrimitive];if(n!==void 0){var o=n.call(r,e);if(hs(o)!="object")return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(r)}var zk=function(){function r(){qk(this,r)}return Bk(r,[{key:"initialize",value:function(){var e=Ea(En().m(function o(a){var s;return En().w(function(l){for(;;)switch(l.n){case 0:return s=Jr.getState().initialize(a),l.a(2,s)}},o)}));function n(o){return e.apply(this,arguments)}return n}()},{key:"configure",value:function(){var e=Ea(En().m(function o(a){var s,l,c;return En().w(function(d){for(;;)switch(d.n){case 0:if(!("userName"in a)){d.n=2;break}return d.n=1,Jr.getState().configureByUserPass(a);case 1:return s=d.v,d.a(2,s);case 2:if(!("apiKey"in a)){d.n=4;break}return d.n=3,Jr.getState().configureByApiKey(a);case 3:return l=d.v,d.a(2,l);case 4:if(!("url"in a&&Object.keys(a).length===1)){d.n=6;break}return d.n=5,Jr.getState().configureWithUrl(a.url);case 5:return c=d.v,d.a(2,c);case 6:return d.a(2,{error:new kt({errorCode:Ft.CONFIG_MISSED_OR_INVALID,message:"No valid config found"})})}},o)}));function n(o){return e.apply(this,arguments)}return n}()},{key:"getWorkFlows",value:function(){var e=Ea(En().m(function o(a){var s;return En().w(function(l){for(;;)switch(l.n){case 0:return l.n=1,Jr.getState().getWorkflows(a);case 1:return s=l.v,l.a(2,s)}},o)}));function n(o){return e.apply(this,arguments)}return n}()},{key:"prepareWorkflow",value:function(){var e=Ea(En().m(function o(a){var s,l;return En().w(function(c){for(;;)switch(c.n){case 0:return s=a.workflowId,c.n=1,Jr.getState().prepareWorkflowAndPrepareUi(s);case 1:return l=c.v,c.a(2,l)}},o)}));function n(o){return e.apply(this,arguments)}return n}()},{key:"startWorkflow",value:function(){var e=Ea(En().m(function o(a){return En().w(function(s){for(;;)switch(s.n){case 0:return s.a(2,new Promise(function(l){var c=function(m){l(m)},d=a==null?void 0:a.locale,v=a==null?void 0:a.metadata,y=Z5(d);Jr.getState().startNewSession(c,y,v).then(function(h){h.error&&(Jr.getState().removeCurrentSessionDataLsAndStore(),c(h)),h.results&&(Jr.getState().removeCurrentSessionDataLsAndStore(),c(h)),Jr.getState().playWorkflow()})}))}},o)}));function n(o){return e.apply(this,arguments)}return n}()},{key:"deinitialize",value:function(){var e=Ea(En().m(function o(){var a;return En().w(function(s){for(;;)switch(s.n){case 0:return s.n=1,Jr.getState().deinitialize();case 1:return a=s.v,s.a(2,a)}},o)}));function n(){return e.apply(this,arguments)}return n}()},{key:"version",get:function(){var n;return(n="3.1.231")!==null&&n!==void 0?n:"Version unavailable. Something went wrong"}},{key:"nonce",set:function(n){Jr.getState().setNonce(n)}},{key:"eventListener",set:function(n){if(!n||typeof n!="function"){console.warn("IdvIntegrationService:: listener is not a function");return}Jr.getState().setListener(n)}},{key:"sessionRestoreMode",set:function(n){Jr.getState().setSessionRestoreMode(n)}}])}(),Hk=window.customElements.get("idv-flow");return Hk||window.customElements.define("idv-flow",y3),_r.ConnectionError=ki,_r.DeinitializationError=Eu,_r.IdvEventTypesEnum=bu,_r.IdvIntegrationService=zk,_r.IdvServiceMessages=ta,_r.IdvWebComponent=y3,_r.InitializeError=wu,_r.PrepareWorkflowError=ti,_r.SessionError=jn,_r.StartSessionError=Ki,_r.WorkflowError=Pt,_r.WorkflowPlatformError=Bn,Object.defineProperty(_r,Symbol.toStringTag,{value:"Module"}),_r}({});
|
package/dist/main.js
CHANGED
|
@@ -19388,7 +19388,7 @@ var ga = ka.create("session_log"), Vx = /* @__PURE__ */ function() {
|
|
|
19388
19388
|
return wr().w(function(v) {
|
|
19389
19389
|
for (; ; ) switch (v.p = v.n) {
|
|
19390
19390
|
case 0:
|
|
19391
|
-
return v.p = 1, v.n = 2, fetch("https://wasm
|
|
19391
|
+
return v.p = 1, v.n = 2, fetch("https://wasm.regulaforensics.com/idv/release/3.1/2e218c7-05ea45dc//PlatformAdaptor.worker.js");
|
|
19392
19392
|
case 2:
|
|
19393
19393
|
return a = v.v, v.n = 3, a.blob();
|
|
19394
19394
|
case 3:
|
|
@@ -19415,7 +19415,7 @@ var ga = ka.create("session_log"), Vx = /* @__PURE__ */ function() {
|
|
|
19415
19415
|
}), v.n = 9, this.sendMessage({
|
|
19416
19416
|
target: "worker-init",
|
|
19417
19417
|
URL: document.URL,
|
|
19418
|
-
currentScriptUrl: "https://wasm
|
|
19418
|
+
currentScriptUrl: "https://wasm.regulaforensics.com/idv/release/3.1/2e218c7-05ea45dc/",
|
|
19419
19419
|
preMain: !0
|
|
19420
19420
|
});
|
|
19421
19421
|
case 9:
|
|
@@ -20945,7 +20945,7 @@ var vj = "*,::after,::before{box-sizing:border-box}h1,h2,h3,h4,p,ul{padding:0;ma
|
|
|
20945
20945
|
}, {
|
|
20946
20946
|
key: "version",
|
|
20947
20947
|
get: function() {
|
|
20948
|
-
return "".concat("3.1.
|
|
20948
|
+
return "".concat("3.1.231".trim());
|
|
20949
20949
|
}
|
|
20950
20950
|
}, {
|
|
20951
20951
|
key: "render",
|
|
@@ -21263,7 +21263,7 @@ var Ej = /* @__PURE__ */ function() {
|
|
|
21263
21263
|
key: "version",
|
|
21264
21264
|
get: function() {
|
|
21265
21265
|
var n;
|
|
21266
|
-
return (n = "3.1.
|
|
21266
|
+
return (n = "3.1.231") !== null && n !== void 0 ? n : "Version unavailable. Something went wrong";
|
|
21267
21267
|
}
|
|
21268
21268
|
}, {
|
|
21269
21269
|
key: "nonce",
|