easy-web-worker 6.0.1 → 6.0.3

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 CHANGED
@@ -16,7 +16,7 @@ Check out the running example with **React** and **TypeScript** at [CODEPEN](htt
16
16
  /**
17
17
  * The callback parameter will be the body of the worker
18
18
  */
19
- const worker = createEasyWebWorker((easyWorker) => {
19
+ const worker = createEasyWebWorker(({ onMessage }) => {
20
20
  const fibonacci = (n) => {
21
21
  if (n <= 1) return n;
22
22
  return fibonacci(n - 1) + fibonacci(n - 2);
@@ -25,7 +25,7 @@ const worker = createEasyWebWorker((easyWorker) => {
25
25
  /**
26
26
  * Inside the worker we have to define an action when onMessage
27
27
  */
28
- easyWorker.onMessage((message) => {
28
+ onMessage((message) => {
29
29
  /**
30
30
  * The payload includes whatever parameters are sent from the main thread
31
31
  */
@@ -52,49 +52,78 @@ And that's it! You now have a worker running heavy computation in a real separat
52
52
  You can also create an easy web worker from a static file, or from a native worker instance:
53
53
 
54
54
  ```ts
55
- const worker = createEasyWebWorker('./worker.js');
56
- const worker = createEasyWebWorker(new Worker('./worker.js')); // ƒ Worker() { [native code] }
55
+ const worker = createEasyWebWorker("./worker.js");
56
+ const worker = createEasyWebWorker(new Worker("./worker.js")); // ƒ Worker() { [native code] }
57
57
 
58
- const worker = new EasyWebWorker('./worker.js');
59
- const worker = new EasyWebWorker(new Worker('./worker.js')); // ƒ Worker() { [native code] }
58
+ const worker = new EasyWebWorker("./worker.js");
59
+ const worker = new EasyWebWorker(new Worker("./worker.js")); // ƒ Worker() { [native code] }
60
60
  ```
61
61
 
62
62
  When working with **static files**, which can offer substantial benefits with web workers, you simply need to create an instance of **StaticEasyWebWorker**.
63
63
 
64
64
  The **StaticEasyWebWorker** provides an interface to continue working with [cancelable-promise-jq](https://www.npmjs.com/package/cancelable-promise-jq) and build more complex APIs within your worker.
65
65
 
66
+ From inside your worker, the message callbacks receive a message that includes multiple methods and functions. You can use these to communicate back with the main thread, or to subscribe to and react to the lifecycle of a worker.
67
+
66
68
  ```ts
67
- const easyWorker = new StaticEasyWebWorker();
69
+ const { onMessage } = new StaticEasyWebWorker();
68
70
 
69
71
  /**
70
72
  * For adding a default onMessage
71
73
  */
72
- easyWorker.onMessage((message) => {
73
- // do something
74
+ onMessage((message) => {
75
+ /** Your message receives a payload,
76
+ * which is any information sent from the main thread.*/
77
+ const { payload } = message;
74
78
 
75
- message.reportProgress(10); // report progress
79
+ const bigArrayBuffer = new new ArrayBuffer(1000000)();
76
80
 
77
- /** Take action when the message is canceled by the main thread*/
78
- message.onCancel(() => {});
81
+ /** You can resolve the message and respond to the main thread's promise that is listening.
82
+ * This promise could also send data back to the main thread and transfer data if needed */
83
+ message.resolve({ bigArrayBuffer }, [bigArrayBuffer]);
79
84
 
80
- message.resolve();
85
+ /** You can reject the message and send back a reason,
86
+ * if no transfer is necessary just avoid the second parameter */
87
+ message.reject(new Error("something happened"));
88
+
89
+ const metadata = { message: "progress from inside the worker" };
90
+
91
+ /** You can report progress */
92
+ message.reportProgress(10, metadata, []); // all the methods allows you to send Transferable[]
93
+
94
+ /** You can cancel an operation from within the worker */
95
+ message.cancel("the operating was canceled from the worker");
96
+
97
+ /** You can subscribe to the cancellation event of the message,
98
+ * regardless of whether this cancellation is internal or external to the worker.*/
99
+ const unsubscribeCancel = message.onCancel((reason) => {});
100
+
101
+ // you can unsubscribe from the cancel event as well
102
+ unsubscribeCancel();
103
+
104
+ /**
105
+ * And there is extra listeners for the other events
106
+ * This events represent the lifecycle of the message
107
+ */
108
+ const unsubscribeResolve = message.onResolve((data) => {});
109
+ const unsubscribeReject = message.onReject((data) => {});
110
+ const unsubscribeProgress = message.onProgress((data) => {});
111
+ const unsubscribeFinalize = message.onFinalize((data) => {});
112
+
113
+ /** You can also review the status of the message at any time*/
114
+ const status = message.getStatus(); // pending | resolved | rejected | canceled
81
115
  });
82
116
 
83
117
  /**
84
118
  * For adding specific actions
85
119
  */
86
- easyWorker.onMessage('readCSV', (message) => {
120
+ onMessage("readCSV", (message) => {
87
121
  // do something
88
-
89
- message.reportProgress(20); // report progress
90
-
91
- /** Take action when the message is canceled by the main thread*/
92
- message.onCancel(() => {});
93
-
94
- message.resolve();
95
122
  });
96
123
  ```
97
124
 
125
+ It's important to mention that the **cancel** method is the only one that provides two-way binding. It can travel all the way from the main thread to the worker, cancel something inside the worker, and notify the main thread upon completion.
126
+
98
127
  **easy-web-worker** is designed to enhance the capabilities of the **Worker** class by integrating a pattern of cancelable promises from the [cancelable-promise-jq](https://www.npmjs.com/package/cancelable-promise-jq) library. For straightforward tasks, it simplifies the process by eliminating the need to configure webpack or other bundlers. And for more complex requirements, the **StaticEasyWebWorker** class allows the integration of easy worker and cancelable promises capabilities into your static workers.
99
128
 
100
129
  Start enhancing your applications with robust, cancelable promises and easy web worker integration today! 🌐
@@ -108,15 +137,15 @@ For a comprehensive understanding, watch our informative [introduction video](ht
108
137
  Creating a new worker is as simple as
109
138
 
110
139
  ```TS
111
- const backgroundWorker = new EasyWebWorker<string, string>((easyWorker) => {
112
- easyWorker.onMessage((message) => {
140
+ const backgroundWorker = createEasyWebWorker<string, string>(({ onMessage }) => {
141
+ onMessage((message) => {
113
142
  const { payload } = message;
114
143
 
115
144
  message.resolve(`this is a message from the worker: ${payload}`);
116
145
  });
117
146
 
118
147
  // you could also define and send specific methods which allow you to create a better structured API
119
- easyWorker.onMessage<number, number>('doSomething', (message) => {
148
+ onMessage<number, number>('doSomething', (message) => {
120
149
  const { payload } = message;
121
150
 
122
151
  message.resolve(payload + 2);
@@ -142,13 +171,29 @@ Take into consideration that the _workerBody_ is a template to create a worker i
142
171
  ```TS
143
172
  const message = 'Hello';
144
173
 
145
- await new EasyWebWorker<null, string>((easyWorker) => {
146
- easyWorker.onMessage((message) => {
174
+ await createEasyWebWorker<null, string>(({ onMessage }) => {
175
+ onMessage((message) => {
147
176
 
148
177
  message.resolve(message); // THIS WILL PRODUCE AND ERROR!! the variable *message* will not exist in Worker-Scope.
149
178
  });
150
179
  }).send('hello!');
180
+ ```
151
181
 
182
+ If you need to pass a primitive parameter to the body of the worker, you can use the **primitiveParameters** configuration. This is an array of values that will be serialized and embedded into the worker's body.
183
+
184
+ ```ts
185
+ const message = "Hello";
186
+
187
+ await createEasyWebWorker<null, string>(
188
+ ({ onMessage }, context) => {
189
+ const [message] = context.primitiveParameters;
190
+
191
+ console.log(message); // "hello!" // 👍 it works!
192
+ },
193
+ {
194
+ primitiveParameters: [message],
195
+ }
196
+ ).send("hello!");
152
197
  ```
153
198
 
154
199
  Take a look at Workers API if you don't know yet how they work: https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API,
@@ -157,7 +202,7 @@ You are just allowed to send information to Workers by messages, and vice versa
157
202
 
158
203
  ## IEasyWebWorkerMessage<IPayload = null, IResult = void>
159
204
 
160
- When you defined an onMessage callback in your _Worker_, this will receive all messages from the _send_ method:
205
+ When you defined an onMessage callback in your **Worker**, this will receive all messages from the **send** method:
161
206
 
162
207
  ```TS
163
208
  easyWorker.onMessage((message) => {
@@ -199,15 +244,17 @@ onProgress Is gonna be executed every time you call _message.reportProgress_ ins
199
244
  As _WorkerBody_ are just templates, you could reuse them on other _Workers_, or use them as plugins for your _Workers_. Let's see:
200
245
 
201
246
  ```TS
202
- const WorkerPluggin: EasyWebWorkerBody = (_easyWorker, context) => {
247
+ const reusableWorkerSegment: EasyWebWorkerBody = ({ onMessage, close, importScripts }, context) => {
203
248
  context.doSomething = () => Promise.resolve('This is a plugin example');
204
249
  };
205
250
 
206
- const plugginMessage = await new EasyWebWorker([WorkerPluggin, (easyWorker, context) => easyWorker.onMessage(async (message) => {
251
+ const reusableWorkerSegment = await createEasyWebWorker([
252
+ reusableWorkerSegment,
253
+ ({ onMessage }, context) => onMessage(async (message) => {
207
254
  // context will have all stuff we added on other plugins
208
- const plugginResponse = await context.doSomething();
255
+ const result = await context.doSomething();
209
256
 
210
- message.resolve(plugginResponse);
257
+ message.resolve(result);
211
258
  })]).send();
212
259
 
213
260
  ```
@@ -216,18 +263,18 @@ In this way, you could avoid having to create more than once the same template f
216
263
 
217
264
  ## Importing scripts into your _Workers_
218
265
 
219
- Web Workers has this amazing method called importScripts, are you passed an array of strings in the EeasyWorker extra configuration, all those files are gonna be imported into your worker.
266
+ Web Workers has this amazing method called importScripts, are you passed an array of strings in the EasyWorker extra configuration, all those files are gonna be imported into your worker.
220
267
 
221
268
  // test.js
222
269
 
223
270
  ```TS
224
271
  self.message = 'Hello coders!';
225
- selft.doSomething = () => console.log(self.message);
272
+ self.doSomething = () => console.log(self.message);
226
273
  ```
227
274
 
228
275
  ```TS
229
- await new EasyWebWorker((easyWorker, context) => {
230
- easyWorker.onMessage((message) => context.doSomething());
276
+ await createEasyWebWorker(({ onMessage }, context) => {
277
+ onMessage((message) => context.doSomething());
231
278
  }, {
232
279
  scripts: ['http://localhost:3000/test.js'],
233
280
  }).send();
@@ -248,17 +295,34 @@ let's see how to use it:
248
295
 
249
296
  ```TS
250
297
  // this is gonna create the same message structure the runtime Workers
251
- const worker = new StaticEasyWebWorker((message) => {
298
+ const { onMessage } = createStaticEasyWebWorker();
299
+
300
+ onMessage((message) => {
301
+ setTimeout(() => {
302
+ message.resolve(200);
303
+ }, 5000);
304
+ });
305
+
306
+ onMessage('action', (message) => {
252
307
  setTimeout(() => {
253
308
  message.resolve(200);
254
309
  }, 5000);
255
310
  });
256
311
  ```
257
312
 
313
+ By the way, if you're in need of a super simple static worker, just know that the first parameter of createStaticEasyWebWorker is a function which will be used as the default onmessage callback.
314
+
315
+ ```ts
316
+ createStaticEasyWebWorker((message) => {
317
+ // this is the default onMessage
318
+ });
319
+ ```
320
+
258
321
  and in your main thread:
259
322
 
260
323
  ```TS
261
- const worker = new EasyWebWorker<null,number>('./worker.js');
324
+ const worker = createEasyWebWorker<null,number>('./worker.js');
325
+
262
326
  await worker.send();
263
327
  ```
264
328
 
@@ -273,8 +337,8 @@ With EasyWebWorker, you can create operations that require heavy concurrency and
273
337
  * Notice that the structure of the worker remains the same;
274
338
  * the only changes are in the configuration parameters of the worker.
275
339
  * Take a look below.*/
276
- const worker = createEasyWebWorker((easyWorker) => {
277
- easyWorker.onMessage((message) => {
340
+ const worker = createEasyWebWorker(({ onMessage }) => {
341
+ onMessage((message) => {
278
342
  const { payload } = message;
279
343
 
280
344
  // heavy computation like fibonacci
@@ -315,7 +379,7 @@ interface FilterSource {
315
379
  reportProgress: boolean,
316
380
  }
317
381
 
318
- const worker = new EasyWebWorker<FilterSource, any[]>((easyWorker) => {
382
+ const worker = createEasyWebWorker<FilterSource, any[]>(({ onMessage }) => {
319
383
  const containsValue = (item: any, filter: string): boolean => {
320
384
  const itemKeys = Object.keys(item);
321
385
 
@@ -330,7 +394,7 @@ const worker = new EasyWebWorker<FilterSource, any[]>((easyWorker) => {
330
394
  });
331
395
  };
332
396
 
333
- easyWorker.onMessage((message: IEasyWebWorkerMessage<FilterSource, any[]>) => {
397
+ onMessage((message: IEasyWebWorkerMessage<FilterSource, any[]>) => {
334
398
  const { payload } = message;
335
399
  const { collection, filter = '', reportProgress: countProgress } = payload;
336
400
  const { length: collectionLength } = collection;
@@ -390,15 +454,15 @@ Returns an array of promises that are resolved with the rejection reason provide
390
454
  Example usage:
391
455
 
392
456
  ```typescript
393
- const worker = new EasyWebWorker<string, string>((easyWorker) => {
394
- easyWorker.onMessage(async (message) => {
457
+ const worker = createEasyWebWorker<string, string>(({ onMessage }) => {
458
+ onMessage((message) => {
395
459
  message.resolve(`Received message: ${message.payload}`);
396
460
  });
397
461
  });
398
462
 
399
- const messagePromise = worker.send('Hello!');
463
+ const messagePromise = worker.send("Hello!");
400
464
 
401
- worker.reboot('Worker was restarted');
465
+ worker.reboot("Worker was restarted");
402
466
 
403
467
  // The message promise will be rejected with the reason 'Worker was restarted'
404
468
  ```
@@ -1,5 +1,5 @@
1
- import { EasyWebWorkerMessage } from './EasyWebWorkerMessage';
2
- import { CancelablePromise } from 'cancelable-promise-jq';
1
+ import { EasyWebWorkerMessage } from "./EasyWebWorkerMessage";
2
+ import { CancelablePromise, Subscription } from "cancelable-promise-jq";
3
3
  /**
4
4
  * EasyWorker Config
5
5
  * */
@@ -69,7 +69,7 @@ export interface IMessageData<IPayload = null> {
69
69
  /**
70
70
  * This is the message id
71
71
  * */
72
- readonly messageId: string;
72
+ readonly messageId?: string;
73
73
  /**
74
74
  * When present, this means that the message was resolved
75
75
  */
@@ -166,6 +166,13 @@ easyWorker: IEasyWorkerInstance<IPayload, IResult>,
166
166
  context: DedicatedWorkerGlobalScope & {
167
167
  primitiveParameters: TPrimitiveParameters;
168
168
  } & Record<string, unknown>) => void;
169
+ export type TMessagePostType = "progress" | "resolved" | "rejected" | "canceled" | "worker_cancelation";
170
+ export type TMessageCallback = (messageData: IMessageData<any>, transfer: Transferable[]) => void;
171
+ export type TMessageCallbackType = "onResolve" | "onCancel" | "onReject" | "onProgress" | "onFinalize";
172
+ export type TMessageStatus = TMessagePostType | "pending";
173
+ /**
174
+ * This contract is just for the messages inside the workers
175
+ */
169
176
  export interface IEasyWebWorkerMessage<TPayload = null, TResult = void> {
170
177
  origin?: string;
171
178
  /**
@@ -180,10 +187,6 @@ export interface IEasyWebWorkerMessage<TPayload = null, TResult = void> {
180
187
  * This are the parameters included in the message
181
188
  * */
182
189
  readonly payload: TPayload;
183
- /**
184
- * This method is used to reject the message from inside the worker
185
- * */
186
- readonly reject: (reason?: unknown, transfer?: Transferable[]) => void;
187
190
  /**
188
191
  * This method is used to report the progress of the message from inside the worker
189
192
  * */
@@ -192,16 +195,42 @@ export interface IEasyWebWorkerMessage<TPayload = null, TResult = void> {
192
195
  * This method is used to resolve the message from inside the worker
193
196
  * */
194
197
  readonly resolve: [TResult] extends [void] ? () => void : (payload: TResult, transfer?: Transferable[]) => void;
198
+ /**
199
+ * This method is used to reject the message from inside the worker
200
+ * */
201
+ readonly reject: (reason?: unknown, transfer?: Transferable[]) => void;
195
202
  /**
196
203
  * This method is used to cancel the message from inside the worker
197
204
  * */
198
205
  readonly cancel: (reason?: unknown, transfer?: Transferable[]) => void;
199
206
  /**
200
- * Thus method is used to subscribe to the cancel event from the main thread
207
+ * Gets the current status of the message
208
+ */
209
+ readonly getStatus: () => TMessageStatus;
210
+ /**
211
+ * Returns true if the message is pending
201
212
  */
202
- readonly onCancel: (callback: (reason?: unknown) => void) => void;
203
- readonly getStatus: () => 'pending' | 'resolved' | 'rejected' | 'canceled';
204
213
  readonly isPending: () => boolean;
214
+ /**
215
+ * This method is used to subscribe to the worker resolve event of the message
216
+ */
217
+ readonly onResolve: (callback: TMessageCallback) => Subscription;
218
+ /**
219
+ * This method is used to subscribe to the worker reject event of the message
220
+ */
221
+ readonly onReject: (callback: TMessageCallback) => Subscription;
222
+ /**
223
+ * This method is used to subscribe to the worker cancelation event of the message
224
+ */
225
+ readonly onCancel: (callback: TMessageCallback) => Subscription;
226
+ /**
227
+ * This method is used to subscribe to the worker onProgress event of the message
228
+ */
229
+ readonly onProgress: (callback: TMessageCallback) => Subscription;
230
+ /**
231
+ * This method is used to subscribe to the worker finally event of the message, once the message is resolved | rejected | canceled
232
+ */
233
+ readonly onFinalize: (callback: TMessageCallback) => Subscription;
205
234
  }
206
235
  export declare const createBlobWorker: <IPayload = null, IResult = void, TPrimitiveParameters extends any[] = unknown[]>(source: EasyWebWorkerBody<IPayload, IResult, unknown[]> | EasyWebWorkerBody<IPayload, IResult, unknown[]>[], imports?: string[], origin?: string, { primitiveParameters, }?: {
207
236
  primitiveParameters?: TPrimitiveParameters;
@@ -337,7 +366,7 @@ export declare class EasyWebWorker<TPayload = null, TResult = void, TPrimitivePa
337
366
  * @param {TPayload} payload - whatever json data you want to send to the worker
338
367
  * @returns {IMessagePromise<TResult>} generated defer that will be resolved when the message completed
339
368
  */
340
- send: [TPayload] extends [null] ? () => CancelablePromise<TResult> : (payload: TPayload) => CancelablePromise<TResult>;
369
+ send: [TPayload] extends [null] ? () => CancelablePromise<TResult> : (payload: TPayload, transfer?: Transferable[]) => CancelablePromise<TResult>;
341
370
  private sendToWorker;
342
371
  /**
343
372
  * This method terminate all current messages and send a new one to the worker queue
@@ -3,7 +3,11 @@ export declare const generatedId: () => string;
3
3
  * This function contains an obfuscated version of the StaticEasyWebWorker internal auto invocable function, without comments or types
4
4
  * this template is used to create dynamic workers from strings templates
5
5
  * PLEASE KEEP THIS FUNCTION UPDATED WITH THE LATEST VERSION OF THE StaticEasyWebWorker CLASS
6
- * [IMPORTANT] Avoid ";" at the end of the template, and dont forget to inject the targetOrigin variable: ({targetOrigin:'${origin}'})
6
+ * [IMPORTANT] Avoid ";" at the end of the template, and don't forget to inject the targetOrigin variable: ({targetOrigin:'${origin}'})
7
+ * for minifying the template, please use the following options:
8
+ * - remove comments
9
+ * - remove types
10
+ * - compress using: https://www.toptal.com/developers/javascript-minifier
7
11
  */
8
12
  export declare const getWorkerTemplate: ({ origin }: {
9
13
  origin: string;
@@ -1,4 +1,4 @@
1
- import { IEasyWebWorkerMessage, IEasyWorkerInstance, IMessageData } from './EasyWebWorker';
1
+ import { IEasyWebWorkerMessage, IEasyWorkerInstance, IMessageData } from "./EasyWebWorker";
2
2
  /**
3
3
  * Constructor for the StaticEasyWebWorker
4
4
  * @param onMessageCallback - callback to be called when a message is received
package/lib/bundle.js CHANGED
@@ -1,2 +1,2 @@
1
1
  /*! For license information please see bundle.js.LICENSE.txt */
2
- !function(e,r){"object"==typeof exports&&"object"==typeof module?module.exports=r():"function"==typeof define&&define.amd?define([],r):"object"==typeof exports?exports["easy-web-worker"]=r():e["easy-web-worker"]=r()}(this,(()=>{return e={797:(e,r,t)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.createEasyWebWorker=void 0;var n=t(30);r.createEasyWebWorker=function(e){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return new n.EasyWebWorker(e,r)}},30:(e,r,t)=>{"use strict";function n(e){return n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},n(e)}function o(e,r){return function(e){if(Array.isArray(e))return e}(e)||function(e,r){var t=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=t){var n,o,i,a,c=[],s=!0,l=!1;try{if(i=(t=t.call(e)).next,0===r){if(Object(t)!==t)return;s=!1}else for(;!(s=(n=i.call(t)).done)&&(c.push(n.value),c.length!==r);s=!0);}catch(e){l=!0,o=e}finally{try{if(!s&&null!=t.return&&(a=t.return(),Object(a)!==a))return}finally{if(l)throw o}}return c}}(e,r)||i(e,r)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function i(e,r){if(e){if("string"==typeof e)return a(e,r);var t=Object.prototype.toString.call(e).slice(8,-1);return"Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t?Array.from(e):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?a(e,r):void 0}}function a(e,r){(null==r||r>e.length)&&(r=e.length);for(var t=0,n=new Array(r);t<r;t++)n[t]=e[t];return n}function c(){c=function(){return e};var e={},r=Object.prototype,t=r.hasOwnProperty,o=Object.defineProperty||function(e,r,t){e[r]=t.value},i="function"==typeof Symbol?Symbol:{},a=i.iterator||"@@iterator",s=i.asyncIterator||"@@asyncIterator",l=i.toStringTag||"@@toStringTag";function u(e,r,t){return Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}),e[r]}try{u({},"")}catch(e){u=function(e,r,t){return e[r]=t}}function f(e,r,t,n){var i=r&&r.prototype instanceof p?r:p,a=Object.create(i.prototype),c=new _(n||[]);return o(a,"_invoke",{value:j(e,t,c)}),a}function h(e,r,t){try{return{type:"normal",arg:e.call(r,t)}}catch(e){return{type:"throw",arg:e}}}e.wrap=f;var d={};function p(){}function v(){}function y(){}var m={};u(m,a,(function(){return this}));var g=Object.getPrototypeOf,b=g&&g(g(S([])));b&&b!==r&&t.call(b,a)&&(m=b);var w=y.prototype=p.prototype=Object.create(m);function k(e){["next","throw","return"].forEach((function(r){u(e,r,(function(e){return this._invoke(r,e)}))}))}function P(e,r){function i(o,a,c,s){var l=h(e[o],e,a);if("throw"!==l.type){var u=l.arg,f=u.value;return f&&"object"==n(f)&&t.call(f,"__await")?r.resolve(f.__await).then((function(e){i("next",e,c,s)}),(function(e){i("throw",e,c,s)})):r.resolve(f).then((function(e){u.value=e,c(u)}),(function(e){return i("throw",e,c,s)}))}s(l.arg)}var a;o(this,"_invoke",{value:function(e,t){function n(){return new r((function(r,n){i(e,t,r,n)}))}return a=a?a.then(n,n):n()}})}function j(e,r,t){var n="suspendedStart";return function(o,i){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===o)throw i;return{value:void 0,done:!0}}for(t.method=o,t.arg=i;;){var a=t.delegate;if(a){var c=O(a,t);if(c){if(c===d)continue;return c}}if("next"===t.method)t.sent=t._sent=t.arg;else if("throw"===t.method){if("suspendedStart"===n)throw n="completed",t.arg;t.dispatchException(t.arg)}else"return"===t.method&&t.abrupt("return",t.arg);n="executing";var s=h(e,r,t);if("normal"===s.type){if(n=t.done?"completed":"suspendedYield",s.arg===d)continue;return{value:s.arg,done:t.done}}"throw"===s.type&&(n="completed",t.method="throw",t.arg=s.arg)}}}function O(e,r){var t=r.method,n=e.iterator[t];if(void 0===n)return r.delegate=null,"throw"===t&&e.iterator.return&&(r.method="return",r.arg=void 0,O(e,r),"throw"===r.method)||"return"!==t&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+t+"' method")),d;var o=h(n,e.iterator,r.arg);if("throw"===o.type)return r.method="throw",r.arg=o.arg,r.delegate=null,d;var i=o.arg;return i?i.done?(r[e.resultName]=i.value,r.next=e.nextLoc,"return"!==r.method&&(r.method="next",r.arg=void 0),r.delegate=null,d):i:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,d)}function x(e){var r={tryLoc:e[0]};1 in e&&(r.catchLoc=e[1]),2 in e&&(r.finallyLoc=e[2],r.afterLoc=e[3]),this.tryEntries.push(r)}function E(e){var r=e.completion||{};r.type="normal",delete r.arg,e.completion=r}function _(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(x,this),this.reset(!0)}function S(e){if(e){var r=e[a];if(r)return r.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var n=-1,o=function r(){for(;++n<e.length;)if(t.call(e,n))return r.value=e[n],r.done=!1,r;return r.value=void 0,r.done=!0,r};return o.next=o}}return{next:W}}function W(){return{value:void 0,done:!0}}return v.prototype=y,o(w,"constructor",{value:y,configurable:!0}),o(y,"constructor",{value:v,configurable:!0}),v.displayName=u(y,l,"GeneratorFunction"),e.isGeneratorFunction=function(e){var r="function"==typeof e&&e.constructor;return!!r&&(r===v||"GeneratorFunction"===(r.displayName||r.name))},e.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,y):(e.__proto__=y,u(e,l,"GeneratorFunction")),e.prototype=Object.create(w),e},e.awrap=function(e){return{__await:e}},k(P.prototype),u(P.prototype,s,(function(){return this})),e.AsyncIterator=P,e.async=function(r,t,n,o,i){void 0===i&&(i=Promise);var a=new P(f(r,t,n,o),i);return e.isGeneratorFunction(t)?a:a.next().then((function(e){return e.done?e.value:a.next()}))},k(w),u(w,l,"Generator"),u(w,a,(function(){return this})),u(w,"toString",(function(){return"[object Generator]"})),e.keys=function(e){var r=Object(e),t=[];for(var n in r)t.push(n);return t.reverse(),function e(){for(;t.length;){var n=t.pop();if(n in r)return e.value=n,e.done=!1,e}return e.done=!0,e}},e.values=S,_.prototype={constructor:_,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(E),!e)for(var r in this)"t"===r.charAt(0)&&t.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=void 0)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var r=this;function n(t,n){return a.type="throw",a.arg=e,r.next=t,n&&(r.method="next",r.arg=void 0),!!n}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],a=i.completion;if("root"===i.tryLoc)return n("end");if(i.tryLoc<=this.prev){var c=t.call(i,"catchLoc"),s=t.call(i,"finallyLoc");if(c&&s){if(this.prev<i.catchLoc)return n(i.catchLoc,!0);if(this.prev<i.finallyLoc)return n(i.finallyLoc)}else if(c){if(this.prev<i.catchLoc)return n(i.catchLoc,!0)}else{if(!s)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return n(i.finallyLoc)}}}},abrupt:function(e,r){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&t.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===e||"continue"===e)&&i.tryLoc<=r&&r<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=e,a.arg=r,i?(this.method="next",this.next=i.finallyLoc,d):this.complete(a)},complete:function(e,r){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&r&&(this.next=r),d},finish:function(e){for(var r=this.tryEntries.length-1;r>=0;--r){var t=this.tryEntries[r];if(t.finallyLoc===e)return this.complete(t.completion,t.afterLoc),E(t),d}},catch:function(e){for(var r=this.tryEntries.length-1;r>=0;--r){var t=this.tryEntries[r];if(t.tryLoc===e){var n=t.completion;if("throw"===n.type){var o=n.arg;E(t)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(e,r,t){return this.delegate={iterator:S(e),resultName:r,nextLoc:t},"next"===this.method&&(this.arg=void 0),d}},e}function s(e,r){for(var t=0;t<r.length;t++){var o=r[t];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,(void 0,i=function(e,r){if("object"!==n(e)||null===e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var o=t.call(e,"string");if("object"!==n(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(o.key),"symbol"===n(i)?i:String(i)),o)}var i}var l=function(e,r,t,n){return new(t||(t=Promise))((function(o,i){function a(e){try{s(n.next(e))}catch(e){i(e)}}function c(e){try{s(n.throw(e))}catch(e){i(e)}}function s(e){var r;e.done?o(e.value):(r=e.value,r instanceof t?r:new t((function(e){e(r)}))).then(a,c)}s((n=n.apply(e,r||[])).next())}))};Object.defineProperty(r,"__esModule",{value:!0}),r.EasyWebWorker=r.createBlobWorker=void 0;var u=t(213),f=t(726),h=t(367);r.createBlobWorker=function(e){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"",n=(arguments.length>3&&void 0!==arguments[3]?arguments[3]:{}).primitiveParameters,o=void 0===n?[]:n,i=Array.isArray(e)?e:[e],a="".concat(function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];return e.length?'self.importScripts(["'.concat(e.join('","'),'"]);'):""}(r),"self.primitiveParameters=JSON.parse(`").concat(JSON.stringify(null!=o?o:[]),"`);let ew$=").concat((0,f.getWorkerTemplate)({origin:t}),";let cn$=self;").concat(i.map((function(e){return"\n(".concat(null==e?void 0:e.toString().trim(),")(ew$,cn$);")})).join(""));return(window.URL||window.webkitURL).createObjectURL(new Blob([a],{type:"application/javascript"}))};var d=function(){function e(r){var t=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};!function(e,r){if(!(e instanceof r))throw new TypeError("Cannot call a class as a function")}(this,e),this.source=r,this.workerUrl=null,this.config=null,this.maxWorkers=1,this.workers=[],this.keepAlive=!0,this.warmUpWorkers=!1,this.terminationDelay=1e3,this.origin="",this.primitiveParameters=[],this.messagesQueue=new Map,this.scripts=[],this.warmUp=function(){var e=t.config,r=e.warmUpWorkers,n=e.maxWorkers;r&&new Array(n).fill(null).forEach((function(){return t.getWorkerFromPool()}))},this.fillWorkerMethods=function(e){return e.onmessage=function(e){t.executeMessageCallback(e)},e.onerror=function(e){var r=t.config.onWorkerError;if(!r)throw e;r(e)},e},this.createNewWorker=function(){var e,r=t.workerUrl,n=t.config.workerOptions;n.name=0===(e=t.workers.length)?n.name:"".concat(n.name,"-").concat(e);var o=new Worker(r,n);return t.fillWorkerMethods(o)},this.getWorkerFromPool=function(){var e=t.config.maxWorkers,r=t.messagesQueue.size;if(!t.workers.length||t.workers.length<e&&r){var n=t.createNewWorker();return t.workers.push(n),n}var o=t.workers.shift();return t.workers.push(o),o},this.computeWorkerBaseSource=function(){var e=function(){var e,r;if(t.source instanceof Worker)return t.workers=[t.fillWorkerMethods(t.source)],{isArrayOfWebWorkers:!1,workerUrl:null};var n="string"==typeof t.source||t.source instanceof URL,o="function"==typeof t.source;if(n||o)return{isArrayOfWebWorkers:!1,workerUrl:null!==(e=t.workerUrl)&&void 0!==e?e:t.getWorkerUrl()};var i=Array.isArray(t.source);if(i&&"function"==typeof t.source[0])return{isArrayOfWebWorkers:!1,workerUrl:null!==(r=t.workerUrl)&&void 0!==r?r:t.getWorkerUrl()};var a=i&&t.source[0]instanceof Worker;return a?(t.workers=t.source.map(t.fillWorkerMethods),{isArrayOfWebWorkers:a,workerUrl:null}):{isArrayOfWebWorkers:!1,workerUrl:null}}(),r=e.workerUrl,n=e.isArrayOfWebWorkers;t.workerUrl=r,t.config.maxWorkers=n?t.workers.length:t.config.maxWorkers,t.config.keepAlive=!!n||t.config.keepAlive},this.send=function(e,r){return t.sendToWorker({payload:e},r)},this.sendToWorker=function(e,r){var n,o,i=e.payload,a=e.method,c=new u.EasyWebWorkerMessage,s=c.messageId,l=c.decoupledPromise,f=t.getWorkerFromPool();l.promise.cancel=function(e){l.promise.cancel=l._cancel;var n={messageId:s,method:a,cancelation:{reason:e}};return t.workers.length?(f.postMessage(n,r),l.promise):l.cancel(e)},t.config.keepAlive||null===(o=null===(n=l.promise)||void 0===n?void 0:n.finally)||void 0===o||o.call(n,(function(){setTimeout((function(){t.messagesQueue.size||(t.workers.forEach((function(e){return e.terminate()})),t.workers=[])}),t.config.terminationDelay)})),t.addMessageToQueue(c);var h={messageId:s,method:a,execution:{payload:i}};return f.postMessage(h),l.promise},this.override=function(){for(var e=arguments.length,r=new Array(e),n=0;n<e;n++)r[n]=arguments[n];var o=r[0],i=r[1],a=r[2];return new h.CancelablePromise((function(e,r,n){var s=n.onCancel;return l(t,void 0,void 0,c().mark((function r(){var t,n;return c().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return t=this.cancelAll(i,a),n=s((function(){t.cancel()})),r.next=4,t;case 4:n(),e(this.send.apply(this,[o]));case 6:case"end":return r.stop()}}),r,this)})))}))},this.overrideAfterCurrent=function(){for(var e=arguments.length,r=new Array(e),n=0;n<e;n++)r[n]=arguments[n];var i=r[0],a=r[1],s=r[2];return new h.CancelablePromise((function(e,r,n){var u=n.onCancel,f=n.reportProgress;return l(t,void 0,void 0,c().mark((function r(){var t,n,l,h,d,p;return c().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:if(!this.messagesQueue.size){r.next=10;break}return t=o(this.messagesQueue,1),n=t[0],l=o(n,2),h=l[1],this.RemoveMessageFromQueue(h.messageId),d=this.cancelAll(a,s).onProgress(f),p=u((function(){d.cancel()})),this.addMessageToQueue(h),r.next=9,d;case 9:p();case 10:e(this.send.apply(this,[i]));case 11:case"end":return r.stop()}}),r,this)})))}))},this.workerUrl="string"==typeof r||r instanceof URL?r:null;var i=null!=n?n:{},a=i.scripts,s=void 0===a?[]:a,d=i.name,p=i.onWorkerError,v=void 0===p?null:p,y=i.maxWorkers,m=void 0===y?1:y,g=i.keepAlive,b=void 0===g?null:g,w=i.terminationDelay,k=void 0===w?1e3:w,P=i.warmUpWorkers,j=void 0===P?null:P,O=i.primitiveParameters,x=i.origin,E=void 0===x?"":x,_=i.workerOptions,S=void 0===_?{}:_,W=!m||1===m||j,C=W||null!=b&&b;this.config={scripts:null!=s?s:[],name:d,maxWorkers:m,keepAlive:C,warmUpWorkers:W,workerOptions:Object.assign(Object.assign({},null!=S?S:{}),{name:S.name||(0,f.generatedId)()}),onWorkerError:v,terminationDelay:k,primitiveParameters:O,origin:null!=E?E:""},this.workerOptions=this.config.workerOptions,this.name=this.workerOptions.name,this.scripts=s,this.onWorkerError=v,this.maxWorkers=m,this.keepAlive=C,this.terminationDelay=k,this.warmUpWorkers=W,this.primitiveParameters=null!=O?O:[],this.origin=E,this.computeWorkerBaseSource(),this.warmUp()}var t,n;return t=e,n=[{key:"worker",get:function(){return this.workers.length>1?null:this.workers[0]}},{key:"isExternalWorkerFile",get:function(){return"string"==typeof this.source||this.source instanceof URL}},{key:"RemoveMessageFromQueue",value:function(e){this.messagesQueue.delete(e)}},{key:"executeMessageCallback",value:function(e){var r,t,n=null!==(r=this.messagesQueue.get(e.data.messageId))&&void 0!==r?r:null;if(n){var o=e.data.progress;if(this.workers.length){var c=n.decoupledPromise;if(o){var s=o.percentage,l=o.payload;c.reportProgress(s,l)}else{this.RemoveMessageFromQueue(n.messageId);var u=e.data.worker_cancelation;if(u){var f=u.reason;c.reject(f)}else{var h=e.data.rejected;if(h){var d=h.reason;c.reject(d)}else{var p=e.data.resolved.payload;c.resolve.apply(c,function(e){if(Array.isArray(e))return a(e)}(t=null!=p?p:[])||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(t)||i(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}())}}}}else this.RemoveMessageFromQueue(n.messageId)}}},{key:"getWorkerUrl",value:function(){if(this.isExternalWorkerFile)return this.source;var e=this.config,t=e.primitiveParameters,n=e.scripts,o=e.origin;return(0,r.createBlobWorker)(this.source,n,o,{primitiveParameters:t})}},{key:"cancelAll",value:function(e){var r=this,t=(arguments.length>1&&void 0!==arguments[1]?arguments[1]:{}).force,n=void 0!==t&&t;return new h.CancelablePromise((function(t,o,i){var a=i.onCancel,s=i.reportProgress;return l(r,void 0,void 0,c().mark((function r(){var o,i,l,u,f,d;return c().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:if(l=Array.from(null!==(i=null===(o=this.messagesQueue)||void 0===o?void 0:o.values())&&void 0!==i?i:[]),u=l.length,f=100/u,!n){r.next=5;break}return r.abrupt("return",t(this.reboot(e)));case 5:d=(0,h.groupAsCancelablePromise)(l.map((function(r){return r.decoupledPromise.promise.cancel(e).catch((function(e){return s(f,e),e}))}))),a((function(){d.cancel()})),t(d);case 8:case"end":return r.stop()}}),r,this)})))}))}},{key:"addMessageToQueue",value:function(e){this.messagesQueue.set(e.messageId,e)}},{key:"sendToMethod",value:function(e,r,t){return this.sendToWorker({method:e,payload:r},t)}},{key:"reboot",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"Worker was rebooted";if(!this.workerUrl)throw new Error("You can not reboot a worker that was created from a Worker Instance");this.workers.forEach((function(e){return e.terminate()})),this.workers=[];var r=this.cancelAll(e);return this.warmUp(),r}},{key:"dispose",value:function(){return l(this,void 0,void 0,c().mark((function e(){return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.cancelAll(null);case 2:this.workerUrl&&(window.URL||window.webkitURL).revokeObjectURL("string"==typeof this.workerUrl?this.workerUrl:this.workerUrl.href),this.workers.forEach((function(e){return e.terminate()})),this.workers=[];case 5:case"end":return e.stop()}}),e,this)})))}}],n&&s(t.prototype,n),Object.defineProperty(t,"prototype",{writable:!1}),e}();r.EasyWebWorker=d},726:(e,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.getWorkerTemplate=r.generatedId=void 0,r.generatedId=function(){return"".concat(Date.now()).concat(Math.random().toString(36).substring(2,9))},r.getWorkerTemplate=function(e){var r=e.origin;return'(e=>{let t=new Map,a=new Map([["",()=>{throw"you didn\'t define a message-callback, please assign a callback by calling IEasyWorkerInstance.onMessage"},],]),o=({messageId:e,payload:a,method:o,origin:r})=>{let s=new Set,n="pending",l=(a,s)=>{let l=n,c=a.resolved?"resolved":a.rejected?"rejected":a.worker_cancelation?"canceled":n;if(!t.has(e)){let i="%c#"+e+" Message Not Found: %cThis means that the message was already resolved | rejected | canceled. To avoid this error, please make sure that you are not resolving | rejecting | canceling the same message twice. Also make sure that you are not reporting progress after the message was processed. Remember each message can handle his one cancelation by adding a handler with the %cmessage.onCancel%c method. To now more about this method, please check the documentation at: %chttps://www.npmjs.com/package/easy-web-worker#ieasywebworkermessageipayload--null-iresult--void %cTrying to process message:";console.error(i,"color: darkorange; font-size: 12px; font-weight: bold;","font-weight: normal;","font-weight: bold;","font-weight: normal;","color: lightblue; font-size: 10px; font-weight: bold;","font-weight: bold; color: darkorange;",{messageId:e,status:{current:l,target:c},method:o,action:a});return}let{progress:d}=a;d||t.delete(e),self.postMessage({messageId:e,...a},r,s),n=c},c=(e,t)=>{l({resolved:{payload:void 0===e?[]:[e]}},t)},i=e=>{l({rejected:{reason:e}},[])},d=e=>{let t=[...s];t.forEach(t=>t(e)),l({worker_cancelation:{reason:e}},[])},g=(e,t,a)=>{l({progress:{percentage:e,payload:t}},a)},h=e=>(s.add(e),()=>s.delete(e));return{messageId:e,getStatus:()=>n,isPending:()=>"pending"===n,method:o,payload:a,resolve:c,reject:i,cancel:d,onCancel:h,reportProgress:g}},r=(...e)=>{let[t,o]=e,r="string"==typeof t;if(r){let s=t,n=o;a.set(s,n);return}let l=t;a.set("",l)},s=()=>{let e=[...t.values()];e.forEach(e=>e.reject(Error("worker closed"))),self.close()};self.onmessage=r=>{let{data:s,origin:n}=r,{messageId:l,cancelation:c}=s;if(c){let i=t.get(l);i&&i.cancel(c.reason);return}let{method:d,execution:g}=s,{payload:h}=g,w=o({method:d,messageId:l,payload:h,origin:e||n||void 0});t.set(l,w);let m=a.get(d||"");m&&m(w,r)};let n=(...e)=>{self.importScripts(...e)};return{onMessage:r,close:s,importScripts:n}})(\''.concat(void 0===r?"":r,"')")}},213:(e,r,t)=>{"use strict";function n(e){return n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},n(e)}function o(e,r){for(var t=0;t<r.length;t++){var o=r[t];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,(void 0,i=function(e,r){if("object"!==n(e)||null===e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var o=t.call(e,"string");if("object"!==n(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(o.key),"symbol"===n(i)?i:String(i)),o)}var i}function i(e,r,t){return r&&o(e.prototype,r),t&&o(e,t),Object.defineProperty(e,"prototype",{writable:!1}),e}Object.defineProperty(r,"__esModule",{value:!0}),r.EasyWebWorkerMessage=void 0;var a=t(367),c=t(726),s=i((function e(){!function(e,r){if(!(e instanceof r))throw new TypeError("Cannot call a class as a function")}(this,e),this.messageId=(0,c.generatedId)(),this.decoupledPromise=(0,a.createDecoupledPromise)(),this.decoupledPromise._cancel=this.decoupledPromise.promise.cancel}));r.EasyWebWorkerMessage=s},973:(e,r)=>{"use strict";function t(e){return function(e){if(Array.isArray(e))return n(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,r){if(e){if("string"==typeof e)return n(e,r);var t=Object.prototype.toString.call(e).slice(8,-1);return"Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t?Array.from(e):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?n(e,r):void 0}}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function n(e,r){(null==r||r>e.length)&&(r=e.length);for(var t=0,n=new Array(r);t<r;t++)n[t]=e[t];return n}Object.defineProperty(r,"__esModule",{value:!0}),r.createStaticEasyWebWorker=r.StaticEasyWebWorker=void 0,r.StaticEasyWebWorker=function(e){var r,n,o,i=(r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",n=new Map,o=new Map([["",function(){throw"you didn't defined a message-callback, please assign a callback by calling IEasyWorkerInstance.onMessage"}]]),self.onmessage=function(e){var i=e.data,a=e.origin,c=i.messageId,s=i.cancelation;if(s){var l=s.reason;n.get(c).cancel(l)}else{var u=e.data,f=u.method,h=function(e){var r=e.messageId,o=e.payload,i=e.method,a=e.origin,c=new Set,s="pending",l=function(e,t){var o=s,c=e.resolved?"resolved":e.rejected?"rejected":e.worker_cancelation?"canceled":s;if(n.has(r))e.progress||n.delete(r),self.postMessage(Object.assign({messageId:r},e),a,t),s=c;else{var l="%c#"+r+" Message Not Found: %cThis means that the message was already resolved | rejected | canceled. To avoid this error, please make sure that you are not resolving | rejecting | canceling the same message twice. Also make sure that you are not reporting progress after the message was processed. Remember each message can handle his one cancelation by adding a handler with the %cmessage.onCancel%c method. To now more about this method, please check the documentation at: %chttps://www.npmjs.com/package/easy-web-worker#ieasywebworkermessageipayload--null-iresult--void %cTrying to process message:";console.error(l,"color: darkorange; font-size: 12px; font-weight: bold;","font-weight: normal;","font-weight: bold;","font-weight: normal;","color: lightblue; font-size: 10px; font-weight: bold;","font-weight: bold; color: darkorange;",{messageId:r,status:{current:o,target:c},method:i,action:e})}};return{messageId:r,getStatus:function(){return s},isPending:function(){return"pending"===s},method:i,payload:o,resolve:function(e,r){l({resolved:{payload:void 0===e?[]:[e]}},r)},reject:function(e){l({rejected:{reason:e}},[])},cancel:function(e){t(c).forEach((function(r){return r(e)})),l({worker_cancelation:{reason:e}},[])},onCancel:function(e){return c.add(e),function(){return c.delete(e)}},reportProgress:function(e,r,t){l({progress:{percentage:e,payload:r}},t)}}}({method:f,messageId:c,payload:u.execution.payload,origin:r||a||void 0});n.set(c,h),o.get(f||"")(h,e)}},{onMessage:function(){for(var e=arguments.length,r=new Array(e),t=0;t<e;t++)r[t]=arguments[t];var n=r[0],i=r[1];if("string"==typeof n){var a=n,c=i;o.set(a,c)}else{var s=n;o.set("",s)}},close:function(){t(n.values()).forEach((function(e){return e.reject(new Error("worker closed"))})),self.close()},importScripts:function(){var e;(e=self).importScripts.apply(e,arguments)}}),a=i.close,c=i.onMessage,s=i.importScripts;this.close=a,this.onMessage=c,this.importScripts=s,e&&c(e)},r.createStaticEasyWebWorker=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";return new r.StaticEasyWebWorker(e,t)}},991:(e,r,t)=>{"use strict";var n=Object.create?function(e,r,t,n){void 0===n&&(n=t);var o=Object.getOwnPropertyDescriptor(r,t);o&&!("get"in o?!r.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return r[t]}}),Object.defineProperty(e,n,o)}:function(e,r,t,n){void 0===n&&(n=t),e[n]=r[t]},o=function(e,r){for(var t in e)"default"===t||Object.prototype.hasOwnProperty.call(r,t)||n(r,e,t)};Object.defineProperty(r,"__esModule",{value:!0}),r.default=void 0;var i=t(30);Object.defineProperty(r,"default",{enumerable:!0,get:function(){return i.EasyWebWorker}}),o(t(30),r),o(t(973),r),o(t(797),r)},367:function(e){var r;r=()=>(()=>{"use strict";var e={399:(e,r)=>{function t(e){return t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},t(e)}function n(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function o(){return o="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(e,r,t){var n=function(e,r){for(;!Object.prototype.hasOwnProperty.call(e,r)&&null!==(e=l(e)););return e}(e,r);if(n){var o=Object.getOwnPropertyDescriptor(n,r);return o.get?o.get.call(arguments.length<3?e:t):o.value}},o.apply(this,arguments)}function i(e){var r="function"==typeof Map?new Map:void 0;return i=function(e){if(null===e||(t=e,-1===Function.toString.call(t).indexOf("[native code]")))return e;var t;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==r){if(r.has(e))return r.get(e);r.set(e,n)}function n(){return a(e,arguments,l(this).constructor)}return n.prototype=Object.create(e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),s(n,e)},i(e)}function a(e,r,t){return a=c()?Reflect.construct.bind():function(e,r,t){var n=[null];n.push.apply(n,r);var o=new(Function.bind.apply(e,n));return t&&s(o,t.prototype),o},a.apply(null,arguments)}function c(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}function s(e,r){return s=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,r){return e.__proto__=r,e},s(e,r)}function l(e){return l=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},l(e)}Object.defineProperty(r,"__esModule",{value:!0}),r.CancelablePromise=void 0;var u=function(e){!function(e,r){if("function"!=typeof r&&null!==r)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(r&&r.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),r&&s(e,r)}(f,e);var r,i,a,u=(i=f,a=c(),function(){var e,r=l(i);if(a){var o=l(this).constructor;e=Reflect.construct(r,arguments,o)}else e=r.apply(this,arguments);return function(e,r){if(r&&("object"===t(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");return n(e)}(this,e)});function f(e){var r,t,i,a,c,s;return function(e,r){if(!(e instanceof r))throw new TypeError("Cannot call a class as a function")}(this,f),(a=u.call(this,(function(e,r){c=e,s=r}))).status="pending",a.cancelCallbacks=new Set,a.ownCancelCallbacks=new Set,a.onProgressCallbacks=new Set,a.disposeCallbacks=function(){a.cancelCallbacks=new Set,a.ownCancelCallbacks=new Set,a.onProgressCallbacks=new Set},a.subscribeToOwnCancelEvent=function(e){return a.ownCancelCallbacks.add(e),function(){a.ownCancelCallbacks.delete(e)}},a.cancel=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;if("pending"===a.status)return a.status="canceled",a.ownCancelCallbacks.forEach((function(r){return r(e)})),a.cancelCallbacks.forEach((function(r){return r(e)})),a._reject(e),a.disposeCallbacks(),n(a)},a.onCancel=function(e){var r=(arguments.length>1&&void 0!==arguments[1]?arguments[1]:{}).signal;return a.cancelCallbacks.add(e),null==r||r.subscribe((function(){a.cancelCallbacks.delete(e)})),n(a)},a.onProgress=function(e){var r=(arguments.length>1&&void 0!==arguments[1]?arguments[1]:{}).signal;return a.onProgressCallbacks.add(e),null==r||r.subscribe((function(){a.onProgressCallbacks.delete(e)})),n(a)},a.reportProgress=function(e,r){return a.onProgressCallbacks.forEach((function(t){return t(e,r)})),n(a)},a.createChildPromise=function(){var e,r,t=new f((function(t,n,o){e=t,r=n}));return t.onProgressCallbacks=a.onProgressCallbacks,t.onCancel((function(e){a.cancel(e)})),{promise:t,resolve:e,reject:r}},a._resolve=c,a._reject=s,e((function(e){a.status="resolved",a.disposeCallbacks(),a._resolve(e)}),(function(e){a.status="rejected",a.disposeCallbacks(),a._reject(e)}),{cancel:function(e){return a.cancel(e)},onCancel:function(e){return a.subscribeToOwnCancelEvent(e)},onProgress:function(e){return a.onProgress(e),function(){a.onProgressCallbacks.delete(e)}},reportProgress:function(e,r){a.reportProgress(e,r)}}),a.then=function(e,t){var i=a.createChildPromise(),c=i.promise,s=i.resolve,u=i.reject;return o((r=n(a),l(f.prototype)),"then",r).call(r,e,t).then(s,u),c},a.catch=function(e){var r=a.createChildPromise(),i=r.promise,c=r.resolve,s=r.reject;return o((t=n(a),l(f.prototype)),"catch",t).call(t,e).then(c,s),i},a.finally=function(e){var r=a.createChildPromise(),t=r.promise,c=r.resolve,s=r.reject;return o((i=n(a),l(f.prototype)),"finally",i).call(i,e).then(c,s),t},a}return r=f,Object.defineProperty(r,"prototype",{writable:!1}),r}(i(Promise));r.CancelablePromise=u,u.prototype.constructor=Promise},716:(e,r,t)=>{function n(e){return n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},n(e)}Object.defineProperty(r,"__esModule",{value:!0}),r.toCancelablePromise=r.isPromise=r.groupAsCancelablePromise=r.createDecoupledPromise=r.allSettledCancelable=void 0;var o=t(335),i=t(399);function a(){a=function(){return e};var e={},r=Object.prototype,t=r.hasOwnProperty,o=Object.defineProperty||function(e,r,t){e[r]=t.value},i="function"==typeof Symbol?Symbol:{},c=i.iterator||"@@iterator",s=i.asyncIterator||"@@asyncIterator",l=i.toStringTag||"@@toStringTag";function u(e,r,t){return Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}),e[r]}try{u({},"")}catch(e){u=function(e,r,t){return e[r]=t}}function f(e,r,t,n){var i=r&&r.prototype instanceof p?r:p,a=Object.create(i.prototype),c=new _(n||[]);return o(a,"_invoke",{value:j(e,t,c)}),a}function h(e,r,t){try{return{type:"normal",arg:e.call(r,t)}}catch(e){return{type:"throw",arg:e}}}e.wrap=f;var d={};function p(){}function v(){}function y(){}var m={};u(m,c,(function(){return this}));var g=Object.getPrototypeOf,b=g&&g(g(S([])));b&&b!==r&&t.call(b,c)&&(m=b);var w=y.prototype=p.prototype=Object.create(m);function k(e){["next","throw","return"].forEach((function(r){u(e,r,(function(e){return this._invoke(r,e)}))}))}function P(e,r){function i(o,a,c,s){var l=h(e[o],e,a);if("throw"!==l.type){var u=l.arg,f=u.value;return f&&"object"==n(f)&&t.call(f,"__await")?r.resolve(f.__await).then((function(e){i("next",e,c,s)}),(function(e){i("throw",e,c,s)})):r.resolve(f).then((function(e){u.value=e,c(u)}),(function(e){return i("throw",e,c,s)}))}s(l.arg)}var a;o(this,"_invoke",{value:function(e,t){function n(){return new r((function(r,n){i(e,t,r,n)}))}return a=a?a.then(n,n):n()}})}function j(e,r,t){var n="suspendedStart";return function(o,i){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===o)throw i;return{value:void 0,done:!0}}for(t.method=o,t.arg=i;;){var a=t.delegate;if(a){var c=O(a,t);if(c){if(c===d)continue;return c}}if("next"===t.method)t.sent=t._sent=t.arg;else if("throw"===t.method){if("suspendedStart"===n)throw n="completed",t.arg;t.dispatchException(t.arg)}else"return"===t.method&&t.abrupt("return",t.arg);n="executing";var s=h(e,r,t);if("normal"===s.type){if(n=t.done?"completed":"suspendedYield",s.arg===d)continue;return{value:s.arg,done:t.done}}"throw"===s.type&&(n="completed",t.method="throw",t.arg=s.arg)}}}function O(e,r){var t=r.method,n=e.iterator[t];if(void 0===n)return r.delegate=null,"throw"===t&&e.iterator.return&&(r.method="return",r.arg=void 0,O(e,r),"throw"===r.method)||"return"!==t&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+t+"' method")),d;var o=h(n,e.iterator,r.arg);if("throw"===o.type)return r.method="throw",r.arg=o.arg,r.delegate=null,d;var i=o.arg;return i?i.done?(r[e.resultName]=i.value,r.next=e.nextLoc,"return"!==r.method&&(r.method="next",r.arg=void 0),r.delegate=null,d):i:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,d)}function x(e){var r={tryLoc:e[0]};1 in e&&(r.catchLoc=e[1]),2 in e&&(r.finallyLoc=e[2],r.afterLoc=e[3]),this.tryEntries.push(r)}function E(e){var r=e.completion||{};r.type="normal",delete r.arg,e.completion=r}function _(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(x,this),this.reset(!0)}function S(e){if(e){var r=e[c];if(r)return r.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var n=-1,o=function r(){for(;++n<e.length;)if(t.call(e,n))return r.value=e[n],r.done=!1,r;return r.value=void 0,r.done=!0,r};return o.next=o}}return{next:W}}function W(){return{value:void 0,done:!0}}return v.prototype=y,o(w,"constructor",{value:y,configurable:!0}),o(y,"constructor",{value:v,configurable:!0}),v.displayName=u(y,l,"GeneratorFunction"),e.isGeneratorFunction=function(e){var r="function"==typeof e&&e.constructor;return!!r&&(r===v||"GeneratorFunction"===(r.displayName||r.name))},e.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,y):(e.__proto__=y,u(e,l,"GeneratorFunction")),e.prototype=Object.create(w),e},e.awrap=function(e){return{__await:e}},k(P.prototype),u(P.prototype,s,(function(){return this})),e.AsyncIterator=P,e.async=function(r,t,n,o,i){void 0===i&&(i=Promise);var a=new P(f(r,t,n,o),i);return e.isGeneratorFunction(t)?a:a.next().then((function(e){return e.done?e.value:a.next()}))},k(w),u(w,l,"Generator"),u(w,c,(function(){return this})),u(w,"toString",(function(){return"[object Generator]"})),e.keys=function(e){var r=Object(e),t=[];for(var n in r)t.push(n);return t.reverse(),function e(){for(;t.length;){var n=t.pop();if(n in r)return e.value=n,e.done=!1,e}return e.done=!0,e}},e.values=S,_.prototype={constructor:_,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(E),!e)for(var r in this)"t"===r.charAt(0)&&t.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=void 0)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var r=this;function n(t,n){return a.type="throw",a.arg=e,r.next=t,n&&(r.method="next",r.arg=void 0),!!n}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],a=i.completion;if("root"===i.tryLoc)return n("end");if(i.tryLoc<=this.prev){var c=t.call(i,"catchLoc"),s=t.call(i,"finallyLoc");if(c&&s){if(this.prev<i.catchLoc)return n(i.catchLoc,!0);if(this.prev<i.finallyLoc)return n(i.finallyLoc)}else if(c){if(this.prev<i.catchLoc)return n(i.catchLoc,!0)}else{if(!s)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return n(i.finallyLoc)}}}},abrupt:function(e,r){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&t.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===e||"continue"===e)&&i.tryLoc<=r&&r<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=e,a.arg=r,i?(this.method="next",this.next=i.finallyLoc,d):this.complete(a)},complete:function(e,r){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&r&&(this.next=r),d},finish:function(e){for(var r=this.tryEntries.length-1;r>=0;--r){var t=this.tryEntries[r];if(t.finallyLoc===e)return this.complete(t.completion,t.afterLoc),E(t),d}},catch:function(e){for(var r=this.tryEntries.length-1;r>=0;--r){var t=this.tryEntries[r];if(t.tryLoc===e){var n=t.completion;if("throw"===n.type){var o=n.arg;E(t)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(e,r,t){return this.delegate={iterator:S(e),resultName:r,nextLoc:t},"next"===this.method&&(this.arg=void 0),d}},e}function c(e,r){(null==r||r>e.length)&&(r=e.length);for(var t=0,n=new Array(r);t<r;t++)n[t]=e[t];return n}r.createDecoupledPromise=function(){var e,r,t,n=new i.CancelablePromise((function(n,o,i){e=n,r=o,t=i}));return Object.assign(Object.assign({resolve:e,reject:r},t),{promise:n})};var s=function e(r){if(r instanceof i.CancelablePromise)return r;if("function"==typeof r)return e(r());if(!u(r))return new i.CancelablePromise((function(e){return e(r)}));var t,n,o=new i.CancelablePromise((function(e,o,i){t=e,n=o,r.then(t,n)}));return o.onCancel((function(e){n(e)})),o};r.toCancelablePromise=s;var l=function(e){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!e.length)return null;var t,n=r.maxConcurrent,o=void 0===n?8:n,a=r.executeInOrder,l=void 0!==a&&a,u=r.beforeEachCallback,f=void 0===u?null:u,h=r.afterEachCallback,d=void 0===h?null:h,p=r.onQueueEmptyCallback,v=void 0===p?null:p,y=function(e){if(Array.isArray(e))return c(e)}(t=e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(t)||function(e,r){if(e){if("string"==typeof e)return c(e,r);var t=Object.prototype.toString.call(e).slice(8,-1);return"Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t?Array.from(e):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?c(e,r):void 0}}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}(),m=[];return new i.CancelablePromise((function(r,t,n){(function r(){if(y.length){var t=y.splice(0,o).map((function(r){var t="function"==typeof r?r():r;null==f||f();var o=s(t),i=n.onCancel((function(){o.cancel()}));return o.then((function(r){var t,o;i(),m.push(r),null==d||d(r),n.reportProgress((null!==(t=m.length)&&void 0!==t?t:1)/(null!==(o=e.length)&&void 0!==o?o:1)*100)})),l?o.then((function(e){return e})):o}));return Promise.all(t).then((function(){return r()}))}})().then((function(){null==v||v(m),r(m)}))}))};r.groupAsCancelablePromise=l;var u=function(e){return Promise.resolve(e)===e};r.isPromise=u,r.allSettledCancelable=function(e){var r=[],t=e.map((function(e){var t=s(e);return r.push(t),(0,o.tryCatchPromise)((function(){return t})).then((function(e){return{error:e.error,result:e.result,promise:t}}))})),n=l(r);return new i.CancelablePromise((function(e,r,o){return i=void 0,c=a().mark((function r(){var i,c;return a().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return i=o.onCancel(n.cancel),r.next=3,Promise.all(t);case 3:c=r.sent,i(),e(c);case 6:case"end":return r.stop()}}),r)})),new(i||(i=Promise))((function(e,r){function t(e){try{o(c.next(e))}catch(e){r(e)}}function n(e){try{o(c.throw(e))}catch(e){r(e)}}function o(r){var o;r.done?e(r.value):(o=r.value,o instanceof i?o:new i((function(e){e(o)}))).then(t,n)}o((c=c.apply(void 0,[])).next())}));var i,c}))}},522:(e,r,t)=>{Object.defineProperty(r,"__esModule",{value:!0});var n=t(399);Object.keys(n).forEach((function(e){"default"!==e&&"__esModule"!==e&&(e in r&&r[e]===n[e]||Object.defineProperty(r,e,{enumerable:!0,get:function(){return n[e]}}))}));var o=t(716);Object.keys(o).forEach((function(e){"default"!==e&&"__esModule"!==e&&(e in r&&r[e]===o[e]||Object.defineProperty(r,e,{enumerable:!0,get:function(){return o[e]}}))}))},991:(e,r,t)=>{Object.defineProperty(r,"__esModule",{value:!0});var n=t(522);Object.keys(n).forEach((function(e){"default"!==e&&"__esModule"!==e&&(e in r&&r[e]===n[e]||Object.defineProperty(r,e,{enumerable:!0,get:function(){return n[e]}}))}));var o=t(335);Object.keys(o).forEach((function(e){"default"!==e&&"__esModule"!==e&&(e in r&&r[e]===o[e]||Object.defineProperty(r,e,{enumerable:!0,get:function(){return o[e]}}))}))},335:(e,r,t)=>{Object.defineProperty(r,"__esModule",{value:!0});var n=t(969);Object.keys(n).forEach((function(e){"default"!==e&&"__esModule"!==e&&(e in r&&r[e]===n[e]||Object.defineProperty(r,e,{enumerable:!0,get:function(){return n[e]}}))}))},969:(e,r,t)=>{Object.defineProperty(r,"__esModule",{value:!0});var n=t(948);Object.keys(n).forEach((function(e){"default"!==e&&"__esModule"!==e&&(e in r&&r[e]===n[e]||Object.defineProperty(r,e,{enumerable:!0,get:function(){return n[e]}}))}));var o=t(667);Object.keys(o).forEach((function(e){"default"!==e&&"__esModule"!==e&&(e in r&&r[e]===o[e]||Object.defineProperty(r,e,{enumerable:!0,get:function(){return o[e]}}))}))},948:(e,r,t)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.tryCatchPromise=r.tryCatch=void 0;var n=t(522);r.tryCatch=function(e){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},t=r.defaultResult,n=void 0===t?null:t,o=r.exceptionHandlingType,i=void 0===o?"error":o;try{return{error:null,result:e()}}catch(e){return"ignore"!==i&&console[i](e),{error:e,result:n}}},r.tryCatchPromise=function(e,r){var t=r||{},o=t.defaultResult,i=void 0===o?null:o,a=t.exceptionHandlingType,c=void 0===a?"error":a,s=t.ignoreCancel,l=void 0===s||s,u=null,f=null,h=function(e){f=e,"ignore"!=c&&("canceled"===(null==u?void 0:u.status)&&l||console[c](f))};try{if(e instanceof n.CancelablePromise)return(u=e).then((function(e){return{error:null,result:e,promise:u}})).catch((function(e){return h(e),{error:e,result:i,promise:u}}));var d=e();if(void 0===d)return Promise.reject(Error("tryCatchPromise: callback parameter must return a value () => promise"));var p=d instanceof n.CancelablePromise;return(u=p?d:(0,n.toCancelablePromise)(d)).then((function(e){return{error:null,result:e,promise:u}})).catch((function(e){return h(e),{error:e,result:i,promise:u}}))}catch(e){return h(e),Promise.resolve({error:f,result:i,promise:u})}}},667:(e,r)=>{Object.defineProperty(r,"__esModule",{value:!0})}},r={};return function t(n){var o=r[n];if(void 0!==o)return o.exports;var i=r[n]={exports:{}};return e[n](i,i.exports,t),i.exports}(991)})(),e.exports=r()}},r={},function t(n){var o=r[n];if(void 0!==o)return o.exports;var i=r[n]={exports:{}};return e[n].call(i.exports,i,i.exports,t),i.exports}(991);var e,r}));
2
+ !function(e,r){"object"==typeof exports&&"object"==typeof module?module.exports=r():"function"==typeof define&&define.amd?define([],r):"object"==typeof exports?exports["easy-web-worker"]=r():e["easy-web-worker"]=r()}(this,(()=>{return e={797:(e,r,t)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.createEasyWebWorker=void 0;var n=t(30);r.createEasyWebWorker=function(e){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return new n.EasyWebWorker(e,r)}},30:(e,r,t)=>{"use strict";function n(e){return n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},n(e)}function o(e,r){return function(e){if(Array.isArray(e))return e}(e)||function(e,r){var t=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=t){var n,o,i,a,c=[],s=!0,l=!1;try{if(i=(t=t.call(e)).next,0===r){if(Object(t)!==t)return;s=!1}else for(;!(s=(n=i.call(t)).done)&&(c.push(n.value),c.length!==r);s=!0);}catch(e){l=!0,o=e}finally{try{if(!s&&null!=t.return&&(a=t.return(),Object(a)!==a))return}finally{if(l)throw o}}return c}}(e,r)||i(e,r)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function i(e,r){if(e){if("string"==typeof e)return a(e,r);var t=Object.prototype.toString.call(e).slice(8,-1);return"Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t?Array.from(e):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?a(e,r):void 0}}function a(e,r){(null==r||r>e.length)&&(r=e.length);for(var t=0,n=new Array(r);t<r;t++)n[t]=e[t];return n}function c(){c=function(){return e};var e={},r=Object.prototype,t=r.hasOwnProperty,o=Object.defineProperty||function(e,r,t){e[r]=t.value},i="function"==typeof Symbol?Symbol:{},a=i.iterator||"@@iterator",s=i.asyncIterator||"@@asyncIterator",l=i.toStringTag||"@@toStringTag";function u(e,r,t){return Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}),e[r]}try{u({},"")}catch(e){u=function(e,r,t){return e[r]=t}}function f(e,r,t,n){var i=r&&r.prototype instanceof d?r:d,a=Object.create(i.prototype),c=new _(n||[]);return o(a,"_invoke",{value:j(e,t,c)}),a}function h(e,r,t){try{return{type:"normal",arg:e.call(r,t)}}catch(e){return{type:"throw",arg:e}}}e.wrap=f;var p={};function d(){}function v(){}function y(){}var g={};u(g,a,(function(){return this}));var m=Object.getPrototypeOf,b=m&&m(m(C([])));b&&b!==r&&t.call(b,a)&&(g=b);var w=y.prototype=d.prototype=Object.create(g);function k(e){["next","throw","return"].forEach((function(r){u(e,r,(function(e){return this._invoke(r,e)}))}))}function P(e,r){function i(o,a,c,s){var l=h(e[o],e,a);if("throw"!==l.type){var u=l.arg,f=u.value;return f&&"object"==n(f)&&t.call(f,"__await")?r.resolve(f.__await).then((function(e){i("next",e,c,s)}),(function(e){i("throw",e,c,s)})):r.resolve(f).then((function(e){u.value=e,c(u)}),(function(e){return i("throw",e,c,s)}))}s(l.arg)}var a;o(this,"_invoke",{value:function(e,t){function n(){return new r((function(r,n){i(e,t,r,n)}))}return a=a?a.then(n,n):n()}})}function j(e,r,t){var n="suspendedStart";return function(o,i){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===o)throw i;return{value:void 0,done:!0}}for(t.method=o,t.arg=i;;){var a=t.delegate;if(a){var c=O(a,t);if(c){if(c===p)continue;return c}}if("next"===t.method)t.sent=t._sent=t.arg;else if("throw"===t.method){if("suspendedStart"===n)throw n="completed",t.arg;t.dispatchException(t.arg)}else"return"===t.method&&t.abrupt("return",t.arg);n="executing";var s=h(e,r,t);if("normal"===s.type){if(n=t.done?"completed":"suspendedYield",s.arg===p)continue;return{value:s.arg,done:t.done}}"throw"===s.type&&(n="completed",t.method="throw",t.arg=s.arg)}}}function O(e,r){var t=r.method,n=e.iterator[t];if(void 0===n)return r.delegate=null,"throw"===t&&e.iterator.return&&(r.method="return",r.arg=void 0,O(e,r),"throw"===r.method)||"return"!==t&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+t+"' method")),p;var o=h(n,e.iterator,r.arg);if("throw"===o.type)return r.method="throw",r.arg=o.arg,r.delegate=null,p;var i=o.arg;return i?i.done?(r[e.resultName]=i.value,r.next=e.nextLoc,"return"!==r.method&&(r.method="next",r.arg=void 0),r.delegate=null,p):i:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,p)}function x(e){var r={tryLoc:e[0]};1 in e&&(r.catchLoc=e[1]),2 in e&&(r.finallyLoc=e[2],r.afterLoc=e[3]),this.tryEntries.push(r)}function E(e){var r=e.completion||{};r.type="normal",delete r.arg,e.completion=r}function _(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(x,this),this.reset(!0)}function C(e){if(e){var r=e[a];if(r)return r.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var n=-1,o=function r(){for(;++n<e.length;)if(t.call(e,n))return r.value=e[n],r.done=!1,r;return r.value=void 0,r.done=!0,r};return o.next=o}}return{next:S}}function S(){return{value:void 0,done:!0}}return v.prototype=y,o(w,"constructor",{value:y,configurable:!0}),o(y,"constructor",{value:v,configurable:!0}),v.displayName=u(y,l,"GeneratorFunction"),e.isGeneratorFunction=function(e){var r="function"==typeof e&&e.constructor;return!!r&&(r===v||"GeneratorFunction"===(r.displayName||r.name))},e.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,y):(e.__proto__=y,u(e,l,"GeneratorFunction")),e.prototype=Object.create(w),e},e.awrap=function(e){return{__await:e}},k(P.prototype),u(P.prototype,s,(function(){return this})),e.AsyncIterator=P,e.async=function(r,t,n,o,i){void 0===i&&(i=Promise);var a=new P(f(r,t,n,o),i);return e.isGeneratorFunction(t)?a:a.next().then((function(e){return e.done?e.value:a.next()}))},k(w),u(w,l,"Generator"),u(w,a,(function(){return this})),u(w,"toString",(function(){return"[object Generator]"})),e.keys=function(e){var r=Object(e),t=[];for(var n in r)t.push(n);return t.reverse(),function e(){for(;t.length;){var n=t.pop();if(n in r)return e.value=n,e.done=!1,e}return e.done=!0,e}},e.values=C,_.prototype={constructor:_,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(E),!e)for(var r in this)"t"===r.charAt(0)&&t.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=void 0)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var r=this;function n(t,n){return a.type="throw",a.arg=e,r.next=t,n&&(r.method="next",r.arg=void 0),!!n}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],a=i.completion;if("root"===i.tryLoc)return n("end");if(i.tryLoc<=this.prev){var c=t.call(i,"catchLoc"),s=t.call(i,"finallyLoc");if(c&&s){if(this.prev<i.catchLoc)return n(i.catchLoc,!0);if(this.prev<i.finallyLoc)return n(i.finallyLoc)}else if(c){if(this.prev<i.catchLoc)return n(i.catchLoc,!0)}else{if(!s)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return n(i.finallyLoc)}}}},abrupt:function(e,r){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&t.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===e||"continue"===e)&&i.tryLoc<=r&&r<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=e,a.arg=r,i?(this.method="next",this.next=i.finallyLoc,p):this.complete(a)},complete:function(e,r){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&r&&(this.next=r),p},finish:function(e){for(var r=this.tryEntries.length-1;r>=0;--r){var t=this.tryEntries[r];if(t.finallyLoc===e)return this.complete(t.completion,t.afterLoc),E(t),p}},catch:function(e){for(var r=this.tryEntries.length-1;r>=0;--r){var t=this.tryEntries[r];if(t.tryLoc===e){var n=t.completion;if("throw"===n.type){var o=n.arg;E(t)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(e,r,t){return this.delegate={iterator:C(e),resultName:r,nextLoc:t},"next"===this.method&&(this.arg=void 0),p}},e}function s(e,r){for(var t=0;t<r.length;t++){var o=r[t];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,(void 0,i=function(e,r){if("object"!==n(e)||null===e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var o=t.call(e,"string");if("object"!==n(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(o.key),"symbol"===n(i)?i:String(i)),o)}var i}var l=function(e,r,t,n){return new(t||(t=Promise))((function(o,i){function a(e){try{s(n.next(e))}catch(e){i(e)}}function c(e){try{s(n.throw(e))}catch(e){i(e)}}function s(e){var r;e.done?o(e.value):(r=e.value,r instanceof t?r:new t((function(e){e(r)}))).then(a,c)}s((n=n.apply(e,r||[])).next())}))};Object.defineProperty(r,"__esModule",{value:!0}),r.EasyWebWorker=r.createBlobWorker=void 0;var u=t(213),f=t(726),h=t(367);r.createBlobWorker=function(e){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"",n=(arguments.length>3&&void 0!==arguments[3]?arguments[3]:{}).primitiveParameters,o=void 0===n?[]:n,i=Array.isArray(e)?e:[e],a="".concat(function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];return e.length?'self.importScripts(["'.concat(e.join('","'),'"]);'):""}(r),"self.primitiveParameters=JSON.parse(`").concat(JSON.stringify(null!=o?o:[]),"`);let ew$=").concat((0,f.getWorkerTemplate)({origin:t}),";let cn$=self;").concat(i.map((function(e){return"\n(".concat(null==e?void 0:e.toString().trim(),")(ew$,cn$);")})).join(""));return(window.URL||window.webkitURL).createObjectURL(new Blob([a],{type:"application/javascript"}))};var p=function(){function e(r){var t=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};!function(e,r){if(!(e instanceof r))throw new TypeError("Cannot call a class as a function")}(this,e),this.source=r,this.workerUrl=null,this.config=null,this.maxWorkers=1,this.workers=[],this.keepAlive=!0,this.warmUpWorkers=!1,this.terminationDelay=1e3,this.origin="",this.primitiveParameters=[],this.messagesQueue=new Map,this.scripts=[],this.warmUp=function(){var e=t.config,r=e.warmUpWorkers,n=e.maxWorkers;r&&new Array(n).fill(null).forEach((function(){return t.getWorkerFromPool()}))},this.fillWorkerMethods=function(e){return e.onmessage=function(e){t.executeMessageCallback(e)},e.onerror=function(e){var r=t.config.onWorkerError;if(!r)throw e;r(e)},e},this.createNewWorker=function(){var e,r=t.workerUrl,n=t.config.workerOptions;n.name=0===(e=t.workers.length)?n.name:"".concat(n.name,"-").concat(e);var o=new Worker(r,n);return t.fillWorkerMethods(o)},this.getWorkerFromPool=function(){var e=t.config.maxWorkers,r=t.messagesQueue.size;if(!t.workers.length||t.workers.length<e&&r){var n=t.createNewWorker();return t.workers.push(n),n}var o=t.workers.shift();return t.workers.push(o),o},this.computeWorkerBaseSource=function(){var e=function(){var e,r;if(t.source instanceof Worker)return t.workers=[t.fillWorkerMethods(t.source)],{isArrayOfWebWorkers:!1,workerUrl:null};var n="string"==typeof t.source||t.source instanceof URL,o="function"==typeof t.source;if(n||o)return{isArrayOfWebWorkers:!1,workerUrl:null!==(e=t.workerUrl)&&void 0!==e?e:t.getWorkerUrl()};var i=Array.isArray(t.source);if(i&&"function"==typeof t.source[0])return{isArrayOfWebWorkers:!1,workerUrl:null!==(r=t.workerUrl)&&void 0!==r?r:t.getWorkerUrl()};var a=i&&t.source[0]instanceof Worker;return a?(t.workers=t.source.map(t.fillWorkerMethods),{isArrayOfWebWorkers:a,workerUrl:null}):{isArrayOfWebWorkers:!1,workerUrl:null}}(),r=e.workerUrl,n=e.isArrayOfWebWorkers;t.workerUrl=r,t.config.maxWorkers=n?t.workers.length:t.config.maxWorkers,t.config.keepAlive=!!n||t.config.keepAlive},this.send=function(e,r){return t.sendToWorker({payload:e},r)},this.sendToWorker=function(e,r){var n,o,i=e.payload,a=e.method,c=new u.EasyWebWorkerMessage,s=c.messageId,l=c.decoupledPromise,f=t.getWorkerFromPool();l.promise.cancel=function(e){l.promise.cancel=l._cancel;var n={messageId:s,method:a,cancelation:{reason:e}};return t.workers.length?(f.postMessage(n,r),l.promise):l.cancel(e)},t.config.keepAlive||null===(o=null===(n=l.promise)||void 0===n?void 0:n.finally)||void 0===o||o.call(n,(function(){setTimeout((function(){t.messagesQueue.size||(t.workers.forEach((function(e){return e.terminate()})),t.workers=[])}),t.config.terminationDelay)})),t.addMessageToQueue(c);var h={messageId:s,method:a,execution:{payload:i}};return f.postMessage(h,r),l.promise},this.override=function(){for(var e=arguments.length,r=new Array(e),n=0;n<e;n++)r[n]=arguments[n];var o=r[0],i=r[1],a=r[2];return new h.CancelablePromise((function(e,r,n){var s=n.onCancel;return l(t,void 0,void 0,c().mark((function r(){var t,n;return c().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return t=this.cancelAll(i,a),n=s((function(){t.cancel()})),r.next=4,t;case 4:n(),e(this.send.apply(this,[o]));case 6:case"end":return r.stop()}}),r,this)})))}))},this.overrideAfterCurrent=function(){for(var e=arguments.length,r=new Array(e),n=0;n<e;n++)r[n]=arguments[n];var i=r[0],a=r[1],s=r[2];return new h.CancelablePromise((function(e,r,n){var u=n.onCancel,f=n.reportProgress;return l(t,void 0,void 0,c().mark((function r(){var t,n,l,h,p,d;return c().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:if(!this.messagesQueue.size){r.next=10;break}return t=o(this.messagesQueue,1),n=t[0],l=o(n,2),h=l[1],this.RemoveMessageFromQueue(h.messageId),p=this.cancelAll(a,s).onProgress(f),d=u((function(){p.cancel()})),this.addMessageToQueue(h),r.next=9,p;case 9:d();case 10:e(this.send.apply(this,[i]));case 11:case"end":return r.stop()}}),r,this)})))}))},this.workerUrl="string"==typeof r||r instanceof URL?r:null;var i=null!=n?n:{},a=i.scripts,s=void 0===a?[]:a,p=i.name,d=i.onWorkerError,v=void 0===d?null:d,y=i.maxWorkers,g=void 0===y?1:y,m=i.keepAlive,b=void 0===m?null:m,w=i.terminationDelay,k=void 0===w?1e3:w,P=i.warmUpWorkers,j=void 0===P?null:P,O=i.primitiveParameters,x=i.origin,E=void 0===x?"":x,_=i.workerOptions,C=void 0===_?{}:_,S=!g||1===g||j,W=S||null!=b&&b;this.config={scripts:null!=s?s:[],name:p,maxWorkers:g,keepAlive:W,warmUpWorkers:S,workerOptions:Object.assign(Object.assign({},null!=C?C:{}),{name:C.name||(0,f.generatedId)()}),onWorkerError:v,terminationDelay:k,primitiveParameters:O,origin:null!=E?E:""},this.workerOptions=this.config.workerOptions,this.name=this.workerOptions.name,this.scripts=s,this.onWorkerError=v,this.maxWorkers=g,this.keepAlive=W,this.terminationDelay=k,this.warmUpWorkers=S,this.primitiveParameters=null!=O?O:[],this.origin=E,this.computeWorkerBaseSource(),this.warmUp()}var t,n;return t=e,n=[{key:"worker",get:function(){return this.workers.length>1?null:this.workers[0]}},{key:"isExternalWorkerFile",get:function(){return"string"==typeof this.source||this.source instanceof URL}},{key:"RemoveMessageFromQueue",value:function(e){this.messagesQueue.delete(e)}},{key:"executeMessageCallback",value:function(e){var r,t,n=null!==(r=this.messagesQueue.get(e.data.messageId))&&void 0!==r?r:null;if(n){var o=e.data.progress;if(this.workers.length){var c=n.decoupledPromise;if(o){var s=o.percentage,l=o.payload;c.reportProgress(s,l)}else{this.RemoveMessageFromQueue(n.messageId);var u=e.data.worker_cancelation;if(u){var f=u.reason;c.reject(f)}else{var h=e.data.rejected;if(h){var p=h.reason;c.reject(p)}else{var d=e.data.resolved.payload;c.resolve.apply(c,function(e){if(Array.isArray(e))return a(e)}(t=null!=d?d:[])||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(t)||i(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}())}}}}else this.RemoveMessageFromQueue(n.messageId)}}},{key:"getWorkerUrl",value:function(){if(this.isExternalWorkerFile)return this.source;var e=this.config,t=e.primitiveParameters,n=e.scripts,o=e.origin;return(0,r.createBlobWorker)(this.source,n,o,{primitiveParameters:t})}},{key:"cancelAll",value:function(e){var r=this,t=(arguments.length>1&&void 0!==arguments[1]?arguments[1]:{}).force,n=void 0!==t&&t;return new h.CancelablePromise((function(t,o,i){var a=i.onCancel,s=i.reportProgress;return l(r,void 0,void 0,c().mark((function r(){var o,i,l,u,f,p;return c().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:if(l=Array.from(null!==(i=null===(o=this.messagesQueue)||void 0===o?void 0:o.values())&&void 0!==i?i:[]),u=l.length,f=100/u,!n){r.next=5;break}return r.abrupt("return",t(this.reboot(e)));case 5:p=(0,h.groupAsCancelablePromise)(l.map((function(r){return r.decoupledPromise.promise.cancel(e).catch((function(e){return s(f,e),e}))}))),a((function(){p.cancel()})),t(p);case 8:case"end":return r.stop()}}),r,this)})))}))}},{key:"addMessageToQueue",value:function(e){this.messagesQueue.set(e.messageId,e)}},{key:"sendToMethod",value:function(e,r,t){return this.sendToWorker({method:e,payload:r},t)}},{key:"reboot",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"Worker was rebooted";if(!this.workerUrl)throw new Error("You can not reboot a worker that was created from a Worker Instance");this.workers.forEach((function(e){return e.terminate()})),this.workers=[];var r=this.cancelAll(e);return this.warmUp(),r}},{key:"dispose",value:function(){return l(this,void 0,void 0,c().mark((function e(){return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.cancelAll(null);case 2:this.workerUrl&&(window.URL||window.webkitURL).revokeObjectURL("string"==typeof this.workerUrl?this.workerUrl:this.workerUrl.href),this.workers.forEach((function(e){return e.terminate()})),this.workers=[];case 5:case"end":return e.stop()}}),e,this)})))}}],n&&s(t.prototype,n),Object.defineProperty(t,"prototype",{writable:!1}),e}();r.EasyWebWorker=p},726:(e,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.getWorkerTemplate=r.generatedId=void 0,r.generatedId=function(){return"".concat(Date.now()).concat(Math.random().toString(36).substring(2,9))},r.getWorkerTemplate=function(e){var r=e.origin;return'(e=>{let o=new Map,t=new Map([["",()=>{throw"you didn\'t define a message-callback, please assign a callback by calling easyWorker.onMessage"}]]),n=({messageId:e,payload:t,method:n,origin:a})=>{let r="pending",s=new Map,l=(t,l,c=[])=>{let i=r,g="progress"===t?"pending":t;if(!o.has(e)){let d="%c#"+e+" Message Not Found: %cThis means that the message was already resolved | rejected | canceled. To avoid this error, please make sure that you are not resolving | rejecting | canceling the same message twice. Also make sure that you are not reporting progress after the message was processed. Remember each message can handle his one cancelation by adding a handler with the %cmessage.onCancel%c method. To know more about this method, please check the documentation at: %chttps://www.npmjs.com/package/easy-web-worker#ieasywebworkermessageipayload--null-iresult--void %cTrying to process message:";console.error(d,"color: darkorange; font-size: 12px; font-weight: bold;","font-weight: normal;","font-weight: bold;","font-weight: normal;","color: lightblue; font-size: 10px; font-weight: bold;","font-weight: bold; color: darkorange;",{messageId:e,status:{current:i,target:g},method:n,action:l});return}let h={resolved:"onResolve",rejected:"onReject",canceled:"onCancel",worker_cancelation:"onCancel",pending:"onProgress"}[g],w=s.get(h);w?.forEach(e=>e(l,c));let p=!l.progress;p&&(s.get("onFinalize")?.forEach(e=>e(l,c)),o.delete(e)),self.postMessage({messageId:e,...l},a,c),r=g},c=(e,o=[])=>l("resolved",{resolved:{payload:void 0===e?[]:[e]}},o),i=(e,o=[])=>l("rejected",{rejected:{reason:e}},o),g=(e,o=[])=>l("worker_cancelation",{worker_cancelation:{reason:e}},o),d=(e,o,t=[])=>l("progress",{progress:{percentage:e,payload:o}},t),h=e=>o=>{s.has(e)||s.set(e,new Set);let t=s.get(e);return t.add(o),()=>t.delete(o)};return{messageId:e,method:n,payload:t,getStatus:()=>r,isPending:()=>"pending"===r,resolve:c,reject:i,cancel:g,reportProgress:d,onResolve:h("onResolve"),onReject:h("onReject"),onCancel:h("onCancel"),onProgress:h("onProgress"),onFinalize:h("onFinalize")}},a=(...e)=>{let[o,n]=e,a="string"==typeof o;if(a){let r=o,s=n;t.set(r,s);return}let l=o;t.set("",l)},r=()=>{let e=[...o.values()];e.forEach(e=>e.reject(Error("worker closed"))),self.close()};self.onmessage=a=>{let{data:r,origin:s}=a,{messageId:l,cancelation:c}=r;if(c){let{reason:i}=c,g=o.get(l);g.cancel(i);return}let{method:d,execution:h}=a.data,{payload:w}=h,p=n({method:d,messageId:l,payload:w,origin:e||s||void 0});o.set(l,p);let m=t.get(d||"");m(p,a)};let s=(...e)=>{self.importScripts(...e)};return{onMessage:a,close:r,importScripts:s}})(\''.concat(void 0===r?"":r,"')")}},213:(e,r,t)=>{"use strict";function n(e){return n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},n(e)}function o(e,r){for(var t=0;t<r.length;t++){var o=r[t];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,(void 0,i=function(e,r){if("object"!==n(e)||null===e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var o=t.call(e,"string");if("object"!==n(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(o.key),"symbol"===n(i)?i:String(i)),o)}var i}function i(e,r,t){return r&&o(e.prototype,r),t&&o(e,t),Object.defineProperty(e,"prototype",{writable:!1}),e}Object.defineProperty(r,"__esModule",{value:!0}),r.EasyWebWorkerMessage=void 0;var a=t(367),c=t(726),s=i((function e(){!function(e,r){if(!(e instanceof r))throw new TypeError("Cannot call a class as a function")}(this,e),this.messageId=(0,c.generatedId)(),this.decoupledPromise=(0,a.createDecoupledPromise)(),this.decoupledPromise._cancel=this.decoupledPromise.promise.cancel}));r.EasyWebWorkerMessage=s},973:(e,r)=>{"use strict";function t(e,r){(null==r||r>e.length)&&(r=e.length);for(var t=0,n=new Array(r);t<r;t++)n[t]=e[t];return n}Object.defineProperty(r,"__esModule",{value:!0}),r.createStaticEasyWebWorker=r.StaticEasyWebWorker=void 0,r.StaticEasyWebWorker=function(e){var r,n,o,i=(r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",n=new Map,o=new Map([["",function(){throw"you didn't defined a message-callback, please assign a callback by calling easyWorker.onMessage"}]]),self.onmessage=function(e){var t=e.data,i=e.origin,a=t.messageId,c=t.cancelation;if(c){var s=c.reason;n.get(a).cancel(s)}else{var l=e.data,u=l.method,f=function(e){var r=e.messageId,t=e.payload,o=e.method,i=e.origin,a="pending",c=new Map,s=function(e,t){var s,l=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[],u=a,f="progress"===e?"pending":e;if(n.has(r)){var h={resolved:"onResolve",rejected:"onReject",canceled:"onCancel",worker_cancelation:"onCancel",pending:"onProgress"}[f],p=c.get(h);null==p||p.forEach((function(e){return e(t,l)})),!t.progress&&(null===(s=c.get("onFinalize"))||void 0===s||s.forEach((function(e){return e(t,l)})),n.delete(r)),self.postMessage(Object.assign({messageId:r},t),i,l),a=f}else{var d="%c#"+r+" Message Not Found: %cThis means that the message was already resolved | rejected | canceled. To avoid this error, please make sure that you are not resolving | rejecting | canceling the same message twice. Also make sure that you are not reporting progress after the message was processed. Remember each message can handle his one cancelation by adding a handler with the %cmessage.onCancel%c method. To now more about this method, please check the documentation at: %chttps://www.npmjs.com/package/easy-web-worker#ieasywebworkermessageipayload--null-iresult--void %cTrying to process message:";console.error(d,"color: darkorange; font-size: 12px; font-weight: bold;","font-weight: normal;","font-weight: bold;","font-weight: normal;","color: lightblue; font-size: 10px; font-weight: bold;","font-weight: bold; color: darkorange;",{messageId:r,status:{current:u,target:f},method:o,action:t})}},l=function(e){return function(r){c.has(e)||c.set(e,new Set);var t=c.get(e);return t.add(r),function(){return t.delete(r)}}};return{messageId:r,method:o,payload:t,getStatus:function(){return a},isPending:function(){return"pending"===a},resolve:function(e){return s("resolved",{resolved:{payload:void 0===e?[]:[e]}},arguments.length>1&&void 0!==arguments[1]?arguments[1]:[])},reject:function(e){s("rejected",{rejected:{reason:e}},arguments.length>1&&void 0!==arguments[1]?arguments[1]:[])},cancel:function(e){return s("worker_cancelation",{worker_cancelation:{reason:e}},arguments.length>1&&void 0!==arguments[1]?arguments[1]:[])},reportProgress:function(e,r){s("progress",{progress:{percentage:e,payload:r}},arguments.length>2&&void 0!==arguments[2]?arguments[2]:[])},onResolve:l("onResolve"),onReject:l("onReject"),onCancel:l("onCancel"),onProgress:l("onProgress"),onFinalize:l("onFinalize")}}({method:u,messageId:a,payload:l.execution.payload,origin:r||i||void 0});n.set(a,f),o.get(u||"")(f,e)}},{onMessage:function(){for(var e=arguments.length,r=new Array(e),t=0;t<e;t++)r[t]=arguments[t];var n=r[0],i=r[1];if("string"==typeof n){var a=n,c=i;o.set(a,c)}else{var s=n;o.set("",s)}},close:function(){var e;(e=n.values(),function(e){if(Array.isArray(e))return t(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,r){if(e){if("string"==typeof e)return t(e,r);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?t(e,r):void 0}}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()).forEach((function(e){return e.reject(new Error("worker closed"))})),self.close()},importScripts:function(){var e;(e=self).importScripts.apply(e,arguments)}}),a=i.close,c=i.onMessage,s=i.importScripts;this.close=a,this.onMessage=c,this.importScripts=s,e&&c(e)},r.createStaticEasyWebWorker=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";return new r.StaticEasyWebWorker(e,t)}},991:(e,r,t)=>{"use strict";var n=Object.create?function(e,r,t,n){void 0===n&&(n=t);var o=Object.getOwnPropertyDescriptor(r,t);o&&!("get"in o?!r.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return r[t]}}),Object.defineProperty(e,n,o)}:function(e,r,t,n){void 0===n&&(n=t),e[n]=r[t]},o=function(e,r){for(var t in e)"default"===t||Object.prototype.hasOwnProperty.call(r,t)||n(r,e,t)};Object.defineProperty(r,"__esModule",{value:!0}),r.default=void 0;var i=t(30);Object.defineProperty(r,"default",{enumerable:!0,get:function(){return i.EasyWebWorker}}),o(t(30),r),o(t(973),r),o(t(797),r)},367:function(e){var r;r=()=>(()=>{"use strict";var e={399:(e,r)=>{function t(e){return t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},t(e)}function n(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function o(){return o="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(e,r,t){var n=function(e,r){for(;!Object.prototype.hasOwnProperty.call(e,r)&&null!==(e=l(e)););return e}(e,r);if(n){var o=Object.getOwnPropertyDescriptor(n,r);return o.get?o.get.call(arguments.length<3?e:t):o.value}},o.apply(this,arguments)}function i(e){var r="function"==typeof Map?new Map:void 0;return i=function(e){if(null===e||(t=e,-1===Function.toString.call(t).indexOf("[native code]")))return e;var t;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==r){if(r.has(e))return r.get(e);r.set(e,n)}function n(){return a(e,arguments,l(this).constructor)}return n.prototype=Object.create(e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),s(n,e)},i(e)}function a(e,r,t){return a=c()?Reflect.construct.bind():function(e,r,t){var n=[null];n.push.apply(n,r);var o=new(Function.bind.apply(e,n));return t&&s(o,t.prototype),o},a.apply(null,arguments)}function c(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}function s(e,r){return s=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,r){return e.__proto__=r,e},s(e,r)}function l(e){return l=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},l(e)}Object.defineProperty(r,"__esModule",{value:!0}),r.CancelablePromise=void 0;var u=function(e){!function(e,r){if("function"!=typeof r&&null!==r)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(r&&r.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),r&&s(e,r)}(f,e);var r,i,a,u=(i=f,a=c(),function(){var e,r=l(i);if(a){var o=l(this).constructor;e=Reflect.construct(r,arguments,o)}else e=r.apply(this,arguments);return function(e,r){if(r&&("object"===t(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");return n(e)}(this,e)});function f(e){var r,t,i,a,c,s;return function(e,r){if(!(e instanceof r))throw new TypeError("Cannot call a class as a function")}(this,f),(a=u.call(this,(function(e,r){c=e,s=r}))).status="pending",a.cancelCallbacks=new Set,a.ownCancelCallbacks=new Set,a.onProgressCallbacks=new Set,a.disposeCallbacks=function(){a.cancelCallbacks=new Set,a.ownCancelCallbacks=new Set,a.onProgressCallbacks=new Set},a.subscribeToOwnCancelEvent=function(e){return a.ownCancelCallbacks.add(e),function(){a.ownCancelCallbacks.delete(e)}},a.cancel=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;if("pending"===a.status)return a.status="canceled",a.ownCancelCallbacks.forEach((function(r){return r(e)})),a.cancelCallbacks.forEach((function(r){return r(e)})),a._reject(e),a.disposeCallbacks(),n(a)},a.onCancel=function(e){var r=(arguments.length>1&&void 0!==arguments[1]?arguments[1]:{}).signal;return a.cancelCallbacks.add(e),null==r||r.subscribe((function(){a.cancelCallbacks.delete(e)})),n(a)},a.onProgress=function(e){var r=(arguments.length>1&&void 0!==arguments[1]?arguments[1]:{}).signal;return a.onProgressCallbacks.add(e),null==r||r.subscribe((function(){a.onProgressCallbacks.delete(e)})),n(a)},a.reportProgress=function(e,r){return a.onProgressCallbacks.forEach((function(t){return t(e,r)})),n(a)},a.createChildPromise=function(){var e,r,t=new f((function(t,n,o){e=t,r=n}));return t.onProgressCallbacks=a.onProgressCallbacks,t.onCancel((function(e){a.cancel(e)})),{promise:t,resolve:e,reject:r}},a._resolve=c,a._reject=s,e((function(e){a.status="resolved",a.disposeCallbacks(),a._resolve(e)}),(function(e){a.status="rejected",a.disposeCallbacks(),a._reject(e)}),{cancel:function(e){return a.cancel(e)},onCancel:function(e){return a.subscribeToOwnCancelEvent(e)},onProgress:function(e){return a.onProgress(e),function(){a.onProgressCallbacks.delete(e)}},reportProgress:function(e,r){a.reportProgress(e,r)}}),a.then=function(e,t){var i=a.createChildPromise(),c=i.promise,s=i.resolve,u=i.reject;return o((r=n(a),l(f.prototype)),"then",r).call(r,e,t).then(s,u),c},a.catch=function(e){var r=a.createChildPromise(),i=r.promise,c=r.resolve,s=r.reject;return o((t=n(a),l(f.prototype)),"catch",t).call(t,e).then(c,s),i},a.finally=function(e){var r=a.createChildPromise(),t=r.promise,c=r.resolve,s=r.reject;return o((i=n(a),l(f.prototype)),"finally",i).call(i,e).then(c,s),t},a}return r=f,Object.defineProperty(r,"prototype",{writable:!1}),r}(i(Promise));r.CancelablePromise=u,u.prototype.constructor=Promise},716:(e,r,t)=>{function n(e){return n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},n(e)}Object.defineProperty(r,"__esModule",{value:!0}),r.toCancelablePromise=r.isPromise=r.groupAsCancelablePromise=r.createDecoupledPromise=r.allSettledCancelable=void 0;var o=t(335),i=t(399);function a(){a=function(){return e};var e={},r=Object.prototype,t=r.hasOwnProperty,o=Object.defineProperty||function(e,r,t){e[r]=t.value},i="function"==typeof Symbol?Symbol:{},c=i.iterator||"@@iterator",s=i.asyncIterator||"@@asyncIterator",l=i.toStringTag||"@@toStringTag";function u(e,r,t){return Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}),e[r]}try{u({},"")}catch(e){u=function(e,r,t){return e[r]=t}}function f(e,r,t,n){var i=r&&r.prototype instanceof d?r:d,a=Object.create(i.prototype),c=new _(n||[]);return o(a,"_invoke",{value:j(e,t,c)}),a}function h(e,r,t){try{return{type:"normal",arg:e.call(r,t)}}catch(e){return{type:"throw",arg:e}}}e.wrap=f;var p={};function d(){}function v(){}function y(){}var g={};u(g,c,(function(){return this}));var m=Object.getPrototypeOf,b=m&&m(m(C([])));b&&b!==r&&t.call(b,c)&&(g=b);var w=y.prototype=d.prototype=Object.create(g);function k(e){["next","throw","return"].forEach((function(r){u(e,r,(function(e){return this._invoke(r,e)}))}))}function P(e,r){function i(o,a,c,s){var l=h(e[o],e,a);if("throw"!==l.type){var u=l.arg,f=u.value;return f&&"object"==n(f)&&t.call(f,"__await")?r.resolve(f.__await).then((function(e){i("next",e,c,s)}),(function(e){i("throw",e,c,s)})):r.resolve(f).then((function(e){u.value=e,c(u)}),(function(e){return i("throw",e,c,s)}))}s(l.arg)}var a;o(this,"_invoke",{value:function(e,t){function n(){return new r((function(r,n){i(e,t,r,n)}))}return a=a?a.then(n,n):n()}})}function j(e,r,t){var n="suspendedStart";return function(o,i){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===o)throw i;return{value:void 0,done:!0}}for(t.method=o,t.arg=i;;){var a=t.delegate;if(a){var c=O(a,t);if(c){if(c===p)continue;return c}}if("next"===t.method)t.sent=t._sent=t.arg;else if("throw"===t.method){if("suspendedStart"===n)throw n="completed",t.arg;t.dispatchException(t.arg)}else"return"===t.method&&t.abrupt("return",t.arg);n="executing";var s=h(e,r,t);if("normal"===s.type){if(n=t.done?"completed":"suspendedYield",s.arg===p)continue;return{value:s.arg,done:t.done}}"throw"===s.type&&(n="completed",t.method="throw",t.arg=s.arg)}}}function O(e,r){var t=r.method,n=e.iterator[t];if(void 0===n)return r.delegate=null,"throw"===t&&e.iterator.return&&(r.method="return",r.arg=void 0,O(e,r),"throw"===r.method)||"return"!==t&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+t+"' method")),p;var o=h(n,e.iterator,r.arg);if("throw"===o.type)return r.method="throw",r.arg=o.arg,r.delegate=null,p;var i=o.arg;return i?i.done?(r[e.resultName]=i.value,r.next=e.nextLoc,"return"!==r.method&&(r.method="next",r.arg=void 0),r.delegate=null,p):i:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,p)}function x(e){var r={tryLoc:e[0]};1 in e&&(r.catchLoc=e[1]),2 in e&&(r.finallyLoc=e[2],r.afterLoc=e[3]),this.tryEntries.push(r)}function E(e){var r=e.completion||{};r.type="normal",delete r.arg,e.completion=r}function _(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(x,this),this.reset(!0)}function C(e){if(e){var r=e[c];if(r)return r.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var n=-1,o=function r(){for(;++n<e.length;)if(t.call(e,n))return r.value=e[n],r.done=!1,r;return r.value=void 0,r.done=!0,r};return o.next=o}}return{next:S}}function S(){return{value:void 0,done:!0}}return v.prototype=y,o(w,"constructor",{value:y,configurable:!0}),o(y,"constructor",{value:v,configurable:!0}),v.displayName=u(y,l,"GeneratorFunction"),e.isGeneratorFunction=function(e){var r="function"==typeof e&&e.constructor;return!!r&&(r===v||"GeneratorFunction"===(r.displayName||r.name))},e.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,y):(e.__proto__=y,u(e,l,"GeneratorFunction")),e.prototype=Object.create(w),e},e.awrap=function(e){return{__await:e}},k(P.prototype),u(P.prototype,s,(function(){return this})),e.AsyncIterator=P,e.async=function(r,t,n,o,i){void 0===i&&(i=Promise);var a=new P(f(r,t,n,o),i);return e.isGeneratorFunction(t)?a:a.next().then((function(e){return e.done?e.value:a.next()}))},k(w),u(w,l,"Generator"),u(w,c,(function(){return this})),u(w,"toString",(function(){return"[object Generator]"})),e.keys=function(e){var r=Object(e),t=[];for(var n in r)t.push(n);return t.reverse(),function e(){for(;t.length;){var n=t.pop();if(n in r)return e.value=n,e.done=!1,e}return e.done=!0,e}},e.values=C,_.prototype={constructor:_,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(E),!e)for(var r in this)"t"===r.charAt(0)&&t.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=void 0)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var r=this;function n(t,n){return a.type="throw",a.arg=e,r.next=t,n&&(r.method="next",r.arg=void 0),!!n}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],a=i.completion;if("root"===i.tryLoc)return n("end");if(i.tryLoc<=this.prev){var c=t.call(i,"catchLoc"),s=t.call(i,"finallyLoc");if(c&&s){if(this.prev<i.catchLoc)return n(i.catchLoc,!0);if(this.prev<i.finallyLoc)return n(i.finallyLoc)}else if(c){if(this.prev<i.catchLoc)return n(i.catchLoc,!0)}else{if(!s)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return n(i.finallyLoc)}}}},abrupt:function(e,r){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&t.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===e||"continue"===e)&&i.tryLoc<=r&&r<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=e,a.arg=r,i?(this.method="next",this.next=i.finallyLoc,p):this.complete(a)},complete:function(e,r){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&r&&(this.next=r),p},finish:function(e){for(var r=this.tryEntries.length-1;r>=0;--r){var t=this.tryEntries[r];if(t.finallyLoc===e)return this.complete(t.completion,t.afterLoc),E(t),p}},catch:function(e){for(var r=this.tryEntries.length-1;r>=0;--r){var t=this.tryEntries[r];if(t.tryLoc===e){var n=t.completion;if("throw"===n.type){var o=n.arg;E(t)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(e,r,t){return this.delegate={iterator:C(e),resultName:r,nextLoc:t},"next"===this.method&&(this.arg=void 0),p}},e}function c(e,r){(null==r||r>e.length)&&(r=e.length);for(var t=0,n=new Array(r);t<r;t++)n[t]=e[t];return n}r.createDecoupledPromise=function(){var e,r,t,n=new i.CancelablePromise((function(n,o,i){e=n,r=o,t=i}));return Object.assign(Object.assign({resolve:e,reject:r},t),{promise:n})};var s=function e(r){if(r instanceof i.CancelablePromise)return r;if("function"==typeof r)return e(r());if(!u(r))return new i.CancelablePromise((function(e){return e(r)}));var t,n,o=new i.CancelablePromise((function(e,o,i){t=e,n=o,r.then(t,n)}));return o.onCancel((function(e){n(e)})),o};r.toCancelablePromise=s;var l=function(e){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!e.length)return null;var t,n=r.maxConcurrent,o=void 0===n?8:n,a=r.executeInOrder,l=void 0!==a&&a,u=r.beforeEachCallback,f=void 0===u?null:u,h=r.afterEachCallback,p=void 0===h?null:h,d=r.onQueueEmptyCallback,v=void 0===d?null:d,y=function(e){if(Array.isArray(e))return c(e)}(t=e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(t)||function(e,r){if(e){if("string"==typeof e)return c(e,r);var t=Object.prototype.toString.call(e).slice(8,-1);return"Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t?Array.from(e):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?c(e,r):void 0}}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}(),g=[];return new i.CancelablePromise((function(r,t,n){(function r(){if(y.length){var t=y.splice(0,o).map((function(r){var t="function"==typeof r?r():r;null==f||f();var o=s(t),i=n.onCancel((function(){o.cancel()}));return o.then((function(r){var t,o;i(),g.push(r),null==p||p(r),n.reportProgress((null!==(t=g.length)&&void 0!==t?t:1)/(null!==(o=e.length)&&void 0!==o?o:1)*100)})),l?o.then((function(e){return e})):o}));return Promise.all(t).then((function(){return r()}))}})().then((function(){null==v||v(g),r(g)}))}))};r.groupAsCancelablePromise=l;var u=function(e){return Promise.resolve(e)===e};r.isPromise=u,r.allSettledCancelable=function(e){var r=[],t=e.map((function(e){var t=s(e);return r.push(t),(0,o.tryCatchPromise)((function(){return t})).then((function(e){return{error:e.error,result:e.result,promise:t}}))})),n=l(r);return new i.CancelablePromise((function(e,r,o){return i=void 0,c=a().mark((function r(){var i,c;return a().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return i=o.onCancel(n.cancel),r.next=3,Promise.all(t);case 3:c=r.sent,i(),e(c);case 6:case"end":return r.stop()}}),r)})),new(i||(i=Promise))((function(e,r){function t(e){try{o(c.next(e))}catch(e){r(e)}}function n(e){try{o(c.throw(e))}catch(e){r(e)}}function o(r){var o;r.done?e(r.value):(o=r.value,o instanceof i?o:new i((function(e){e(o)}))).then(t,n)}o((c=c.apply(void 0,[])).next())}));var i,c}))}},522:(e,r,t)=>{Object.defineProperty(r,"__esModule",{value:!0});var n=t(399);Object.keys(n).forEach((function(e){"default"!==e&&"__esModule"!==e&&(e in r&&r[e]===n[e]||Object.defineProperty(r,e,{enumerable:!0,get:function(){return n[e]}}))}));var o=t(716);Object.keys(o).forEach((function(e){"default"!==e&&"__esModule"!==e&&(e in r&&r[e]===o[e]||Object.defineProperty(r,e,{enumerable:!0,get:function(){return o[e]}}))}))},991:(e,r,t)=>{Object.defineProperty(r,"__esModule",{value:!0});var n=t(522);Object.keys(n).forEach((function(e){"default"!==e&&"__esModule"!==e&&(e in r&&r[e]===n[e]||Object.defineProperty(r,e,{enumerable:!0,get:function(){return n[e]}}))}));var o=t(335);Object.keys(o).forEach((function(e){"default"!==e&&"__esModule"!==e&&(e in r&&r[e]===o[e]||Object.defineProperty(r,e,{enumerable:!0,get:function(){return o[e]}}))}))},335:(e,r,t)=>{Object.defineProperty(r,"__esModule",{value:!0});var n=t(969);Object.keys(n).forEach((function(e){"default"!==e&&"__esModule"!==e&&(e in r&&r[e]===n[e]||Object.defineProperty(r,e,{enumerable:!0,get:function(){return n[e]}}))}))},969:(e,r,t)=>{Object.defineProperty(r,"__esModule",{value:!0});var n=t(948);Object.keys(n).forEach((function(e){"default"!==e&&"__esModule"!==e&&(e in r&&r[e]===n[e]||Object.defineProperty(r,e,{enumerable:!0,get:function(){return n[e]}}))}));var o=t(667);Object.keys(o).forEach((function(e){"default"!==e&&"__esModule"!==e&&(e in r&&r[e]===o[e]||Object.defineProperty(r,e,{enumerable:!0,get:function(){return o[e]}}))}))},948:(e,r,t)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.tryCatchPromise=r.tryCatch=void 0;var n=t(522);r.tryCatch=function(e){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},t=r.defaultResult,n=void 0===t?null:t,o=r.exceptionHandlingType,i=void 0===o?"error":o;try{return{error:null,result:e()}}catch(e){return"ignore"!==i&&console[i](e),{error:e,result:n}}},r.tryCatchPromise=function(e,r){var t=r||{},o=t.defaultResult,i=void 0===o?null:o,a=t.exceptionHandlingType,c=void 0===a?"error":a,s=t.ignoreCancel,l=void 0===s||s,u=null,f=null,h=function(e){f=e,"ignore"!=c&&("canceled"===(null==u?void 0:u.status)&&l||console[c](f))};try{if(e instanceof n.CancelablePromise)return(u=e).then((function(e){return{error:null,result:e,promise:u}})).catch((function(e){return h(e),{error:e,result:i,promise:u}}));var p=e();if(void 0===p)return Promise.reject(Error("tryCatchPromise: callback parameter must return a value () => promise"));var d=p instanceof n.CancelablePromise;return(u=d?p:(0,n.toCancelablePromise)(p)).then((function(e){return{error:null,result:e,promise:u}})).catch((function(e){return h(e),{error:e,result:i,promise:u}}))}catch(e){return h(e),Promise.resolve({error:f,result:i,promise:u})}}},667:(e,r)=>{Object.defineProperty(r,"__esModule",{value:!0})}},r={};return function t(n){var o=r[n];if(void 0!==o)return o.exports;var i=r[n]={exports:{}};return e[n](i,i.exports,t),i.exports}(991)})(),e.exports=r()}},r={},function t(n){var o=r[n];if(void 0!==o)return o.exports;var i=r[n]={exports:{}};return e[n].call(i.exports,i,i.exports,t),i.exports}(991);var e,r}));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "easy-web-worker",
3
- "version": "6.0.1",
3
+ "version": "6.0.3",
4
4
  "description": "This is a library to easily handle and create web-workers, if you are a web developer and never tried this... do not wait any longer! Workers are an amazing option to improve user experience and make your webpages even greater",
5
5
  "main": "lib/bundle.js",
6
6
  "types": "lib/index.d.ts",
@@ -47,7 +47,7 @@
47
47
  "@types/jest": "^29.2.4",
48
48
  "@types/node": "^20.11.0",
49
49
  "babel-loader": "^9.1.2",
50
- "cancelable-promise-jq": "^2.0.2",
50
+ "cancelable-promise-jq": "^2.0.4",
51
51
  "jest": "^29.3.1",
52
52
  "jsdom": "^16.4.0",
53
53
  "ts-jest": "^29.1.1",
@@ -58,7 +58,7 @@
58
58
  "webpack-cli": "^5.0.1"
59
59
  },
60
60
  "peerDependencies": {
61
- "cancelable-promise-jq": "^2.0.2"
61
+ "cancelable-promise-jq": "^2.0.4"
62
62
  },
63
63
  "peerDependenciesMeta": {
64
64
  "cancelable-promise-jq": {